@distilled.cloud/scaleway 0.0.0 → 1.0.0-rc.22
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +201 -0
- package/README.md +171 -4
- package/lib/.lazy.json +1 -0
- package/lib/_bundle/lazy.js +4 -0
- package/lib/_bundle/sdk.js +2 -0
- package/lib/_bundle/sdk.js.map +1 -0
- package/lib/credentials.d.ts +44 -0
- package/lib/credentials.d.ts.map +1 -0
- package/lib/credentials.js +1 -0
- package/lib/errors.d.ts +285 -0
- package/lib/errors.d.ts.map +1 -0
- package/lib/errors.js +1 -0
- package/lib/index.d.ts +48 -0
- package/lib/index.d.ts.map +1 -0
- package/lib/index.js +6 -0
- package/lib/pagination.d.ts +10 -0
- package/lib/pagination.d.ts.map +1 -0
- package/lib/pagination.js +1 -0
- package/lib/protocol.d.ts +48 -0
- package/lib/protocol.d.ts.map +1 -0
- package/lib/protocol.js +1 -0
- package/lib/retry.d.ts +31 -0
- package/lib/retry.d.ts.map +1 -0
- package/lib/retry.js +1 -0
- package/lib/services/account_contract_v3.d.ts +124 -0
- package/lib/services/account_contract_v3.d.ts.map +1 -0
- package/lib/services/account_contract_v3.js +2 -0
- package/lib/services/account_contract_v3.js.map +1 -0
- package/lib/services/account_iso_code_v3.d.ts +44 -0
- package/lib/services/account_iso_code_v3.d.ts.map +1 -0
- package/lib/services/account_iso_code_v3.js +2 -0
- package/lib/services/account_iso_code_v3.js.map +1 -0
- package/lib/services/account_organization_v3.d.ts +290 -0
- package/lib/services/account_organization_v3.d.ts.map +1 -0
- package/lib/services/account_organization_v3.js +2 -0
- package/lib/services/account_organization_v3.js.map +1 -0
- package/lib/services/account_project_v3.d.ts +173 -0
- package/lib/services/account_project_v3.d.ts.map +1 -0
- package/lib/services/account_project_v3.js +2 -0
- package/lib/services/account_project_v3.js.map +1 -0
- package/lib/services/account_unauthenticated_user_v3.d.ts +479 -0
- package/lib/services/account_unauthenticated_user_v3.d.ts.map +1 -0
- package/lib/services/account_unauthenticated_user_v3.js +35 -0
- package/lib/services/account_unauthenticated_user_v3.js.map +1 -0
- package/lib/services/account_unauthenticated_v3.d.ts +18 -0
- package/lib/services/account_unauthenticated_v3.d.ts.map +1 -0
- package/lib/services/account_unauthenticated_v3.js +2 -0
- package/lib/services/account_unauthenticated_v3.js.map +1 -0
- package/lib/services/account_user_v3.d.ts +522 -0
- package/lib/services/account_user_v3.d.ts.map +1 -0
- package/lib/services/account_user_v3.js +39 -0
- package/lib/services/account_user_v3.js.map +1 -0
- package/lib/services/annotations_v1.d.ts +260 -0
- package/lib/services/annotations_v1.d.ts.map +1 -0
- package/lib/services/annotations_v1.js +2 -0
- package/lib/services/annotations_v1.js.map +1 -0
- package/lib/services/baremetal_private_network_v1.d.ts +95 -0
- package/lib/services/baremetal_private_network_v1.d.ts.map +1 -0
- package/lib/services/baremetal_private_network_v1.js +2 -0
- package/lib/services/baremetal_private_network_v1.js.map +1 -0
- package/lib/services/baremetal_private_network_v3.d.ts +110 -0
- package/lib/services/baremetal_private_network_v3.d.ts.map +1 -0
- package/lib/services/baremetal_private_network_v3.js +2 -0
- package/lib/services/baremetal_private_network_v3.js.map +1 -0
- package/lib/services/baremetal_v1.d.ts +1089 -0
- package/lib/services/baremetal_v1.d.ts.map +1 -0
- package/lib/services/baremetal_v1.js +52 -0
- package/lib/services/baremetal_v1.js.map +1 -0
- package/lib/services/billing_electronic_billing_v2.d.ts +86 -0
- package/lib/services/billing_electronic_billing_v2.d.ts.map +1 -0
- package/lib/services/billing_electronic_billing_v2.js +2 -0
- package/lib/services/billing_electronic_billing_v2.js.map +1 -0
- package/lib/services/billing_v2.d.ts +187 -0
- package/lib/services/billing_v2.d.ts.map +1 -0
- package/lib/services/billing_v2.js +2 -0
- package/lib/services/billing_v2.js.map +1 -0
- package/lib/services/block_v1.d.ts +401 -0
- package/lib/services/block_v1.d.ts.map +1 -0
- package/lib/services/block_v1.js +27 -0
- package/lib/services/block_v1.js.map +1 -0
- package/lib/services/cockpit_global_v1.d.ts +75 -0
- package/lib/services/cockpit_global_v1.d.ts.map +1 -0
- package/lib/services/cockpit_global_v1.js +2 -0
- package/lib/services/cockpit_global_v1.js.map +1 -0
- package/lib/services/cockpit_regional_v1.d.ts +739 -0
- package/lib/services/cockpit_regional_v1.d.ts.map +1 -0
- package/lib/services/cockpit_regional_v1.js +47 -0
- package/lib/services/cockpit_regional_v1.js.map +1 -0
- package/lib/services/containers_v1.d.ts +822 -0
- package/lib/services/containers_v1.d.ts.map +1 -0
- package/lib/services/containers_v1.js +39 -0
- package/lib/services/containers_v1.js.map +1 -0
- package/lib/services/dedibox_billing_v1.d.ts +151 -0
- package/lib/services/dedibox_billing_v1.d.ts.map +1 -0
- package/lib/services/dedibox_billing_v1.js +2 -0
- package/lib/services/dedibox_billing_v1.js.map +1 -0
- package/lib/services/dedibox_ipv6_block_v1.d.ts +119 -0
- package/lib/services/dedibox_ipv6_block_v1.d.ts.map +1 -0
- package/lib/services/dedibox_ipv6_block_v1.js +2 -0
- package/lib/services/dedibox_ipv6_block_v1.js.map +1 -0
- package/lib/services/dedibox_rpn_san_v1.d.ts +486 -0
- package/lib/services/dedibox_rpn_san_v1.d.ts.map +1 -0
- package/lib/services/dedibox_rpn_san_v1.js +2 -0
- package/lib/services/dedibox_rpn_san_v1.js.map +1 -0
- package/lib/services/dedibox_rpn_v1.d.ts +68 -0
- package/lib/services/dedibox_rpn_v1.d.ts.map +1 -0
- package/lib/services/dedibox_rpn_v1.js +2 -0
- package/lib/services/dedibox_rpn_v1.js.map +1 -0
- package/lib/services/dedibox_rpn_v1_v1.d.ts +687 -0
- package/lib/services/dedibox_rpn_v1_v1.d.ts.map +1 -0
- package/lib/services/dedibox_rpn_v1_v1.js +30 -0
- package/lib/services/dedibox_rpn_v1_v1.js.map +1 -0
- package/lib/services/dedibox_rpn_v2_v1.d.ts +646 -0
- package/lib/services/dedibox_rpn_v2_v1.d.ts.map +1 -0
- package/lib/services/dedibox_rpn_v2_v1.js +27 -0
- package/lib/services/dedibox_rpn_v2_v1.js.map +1 -0
- package/lib/services/dedibox_v1.d.ts +1351 -0
- package/lib/services/dedibox_v1.d.ts.map +1 -0
- package/lib/services/dedibox_v1.js +70 -0
- package/lib/services/dedibox_v1.js.map +1 -0
- package/lib/services/generative_apis_openai_v1.d.ts +772 -0
- package/lib/services/generative_apis_openai_v1.d.ts.map +1 -0
- package/lib/services/generative_apis_openai_v1.js +24 -0
- package/lib/services/generative_apis_openai_v1.js.map +1 -0
- package/lib/services/generative_apis_v1.d.ts +82 -0
- package/lib/services/generative_apis_v1.d.ts.map +1 -0
- package/lib/services/generative_apis_v1.js +2 -0
- package/lib/services/generative_apis_v1.js.map +1 -0
- package/lib/services/index.d.ts +57 -0
- package/lib/services/index.d.ts.map +1 -0
- package/lib/services/index.js +56 -0
- package/lib/services/inference_v1.d.ts +460 -0
- package/lib/services/inference_v1.d.ts.map +1 -0
- package/lib/services/inference_v1.js +33 -0
- package/lib/services/inference_v1.js.map +1 -0
- package/lib/services/instance_v1.d.ts +2183 -0
- package/lib/services/instance_v1.d.ts.map +1 -0
- package/lib/services/instance_v1.js +112 -0
- package/lib/services/instance_v1.js.map +1 -0
- package/lib/services/iot_v1.d.ts +837 -0
- package/lib/services/iot_v1.d.ts.map +1 -0
- package/lib/services/iot_v1.js +50 -0
- package/lib/services/iot_v1.js.map +1 -0
- package/lib/services/ipam_v1.d.ts +244 -0
- package/lib/services/ipam_v1.d.ts.map +1 -0
- package/lib/services/ipam_v1.js +2 -0
- package/lib/services/ipam_v1.js.map +1 -0
- package/lib/services/k8s_v1.d.ts +1223 -0
- package/lib/services/k8s_v1.d.ts.map +1 -0
- package/lib/services/k8s_v1.js +61 -0
- package/lib/services/k8s_v1.js.map +1 -0
- package/lib/services/lb_zoned_v1.d.ts +1517 -0
- package/lib/services/lb_zoned_v1.d.ts.map +1 -0
- package/lib/services/lb_zoned_v1.js +75 -0
- package/lib/services/lb_zoned_v1.js.map +1 -0
- package/lib/services/marketplace_console_v2.d.ts +72 -0
- package/lib/services/marketplace_console_v2.d.ts.map +1 -0
- package/lib/services/marketplace_console_v2.js +2 -0
- package/lib/services/marketplace_console_v2.js.map +1 -0
- package/lib/services/marketplace_v2.d.ts +169 -0
- package/lib/services/marketplace_v2.d.ts.map +1 -0
- package/lib/services/marketplace_v2.js +2 -0
- package/lib/services/marketplace_v2.js.map +1 -0
- package/lib/services/mongodb_v1.d.ts +698 -0
- package/lib/services/mongodb_v1.d.ts.map +1 -0
- package/lib/services/mongodb_v1.js +43 -0
- package/lib/services/mongodb_v1.js.map +1 -0
- package/lib/services/partner_v1.d.ts +142 -0
- package/lib/services/partner_v1.d.ts.map +1 -0
- package/lib/services/partner_v1.js +2 -0
- package/lib/services/partner_v1.js.map +1 -0
- package/lib/services/rdb_encryption_v1.d.ts +17 -0
- package/lib/services/rdb_encryption_v1.d.ts.map +1 -0
- package/lib/services/rdb_encryption_v1.js +2 -0
- package/lib/services/rdb_encryption_v1.js.map +1 -0
- package/lib/services/rdb_v1.d.ts +1422 -0
- package/lib/services/rdb_v1.d.ts.map +1 -0
- package/lib/services/rdb_v1.js +87 -0
- package/lib/services/rdb_v1.js.map +1 -0
- package/lib/services/redis_v1.d.ts +602 -0
- package/lib/services/redis_v1.d.ts.map +1 -0
- package/lib/services/redis_v1.js +42 -0
- package/lib/services/redis_v1.js.map +1 -0
- package/lib/services/registry_v1.d.ts +281 -0
- package/lib/services/registry_v1.d.ts.map +1 -0
- package/lib/services/registry_v1.js +2 -0
- package/lib/services/registry_v1.js.map +1 -0
- package/lib/services/reseller_v1.d.ts +81 -0
- package/lib/services/reseller_v1.d.ts.map +1 -0
- package/lib/services/reseller_v1.js +2 -0
- package/lib/services/reseller_v1.js.map +1 -0
- package/lib/services/vpc_gw_v2.d.ts +640 -0
- package/lib/services/vpc_gw_v2.d.ts.map +1 -0
- package/lib/services/vpc_gw_v2.js +46 -0
- package/lib/services/vpc_gw_v2.js.map +1 -0
- package/lib/services/vpc_private_network_with_nics_v2.d.ts +114 -0
- package/lib/services/vpc_private_network_with_nics_v2.d.ts.map +1 -0
- package/lib/services/vpc_private_network_with_nics_v2.js +2 -0
- package/lib/services/vpc_private_network_with_nics_v2.js.map +1 -0
- package/lib/services/vpc_routes_with_nexthop_v2.d.ts +87 -0
- package/lib/services/vpc_routes_with_nexthop_v2.d.ts.map +1 -0
- package/lib/services/vpc_routes_with_nexthop_v2.js +2 -0
- package/lib/services/vpc_routes_with_nexthop_v2.js.map +1 -0
- package/lib/services/vpc_v2.d.ts +875 -0
- package/lib/services/vpc_v2.d.ts.map +1 -0
- package/lib/services/vpc_v2.js +54 -0
- package/lib/services/vpc_v2.js.map +1 -0
- package/lib/services/webhosting_backup_v1.d.ts +182 -0
- package/lib/services/webhosting_backup_v1.d.ts.map +1 -0
- package/lib/services/webhosting_backup_v1.js +2 -0
- package/lib/services/webhosting_backup_v1.js.map +1 -0
- package/lib/services/webhosting_control_panel_v1.d.ts +37 -0
- package/lib/services/webhosting_control_panel_v1.d.ts.map +1 -0
- package/lib/services/webhosting_control_panel_v1.js +2 -0
- package/lib/services/webhosting_control_panel_v1.js.map +1 -0
- package/lib/services/webhosting_database_v1.d.ts +195 -0
- package/lib/services/webhosting_database_v1.d.ts.map +1 -0
- package/lib/services/webhosting_database_v1.js +2 -0
- package/lib/services/webhosting_database_v1.js.map +1 -0
- package/lib/services/webhosting_dedibox_v1.d.ts +232 -0
- package/lib/services/webhosting_dedibox_v1.d.ts.map +1 -0
- package/lib/services/webhosting_dedibox_v1.js +2 -0
- package/lib/services/webhosting_dedibox_v1.js.map +1 -0
- package/lib/services/webhosting_dns_v1.d.ts +177 -0
- package/lib/services/webhosting_dns_v1.d.ts.map +1 -0
- package/lib/services/webhosting_dns_v1.js +2 -0
- package/lib/services/webhosting_dns_v1.js.map +1 -0
- package/lib/services/webhosting_free_domain_v1.d.ts +51 -0
- package/lib/services/webhosting_free_domain_v1.d.ts.map +1 -0
- package/lib/services/webhosting_free_domain_v1.js +2 -0
- package/lib/services/webhosting_free_domain_v1.js.map +1 -0
- package/lib/services/webhosting_ftp_account_v1.d.ts +79 -0
- package/lib/services/webhosting_ftp_account_v1.d.ts.map +1 -0
- package/lib/services/webhosting_ftp_account_v1.js +2 -0
- package/lib/services/webhosting_ftp_account_v1.js.map +1 -0
- package/lib/services/webhosting_hosting_v1.d.ts +502 -0
- package/lib/services/webhosting_hosting_v1.d.ts.map +1 -0
- package/lib/services/webhosting_hosting_v1.js +27 -0
- package/lib/services/webhosting_hosting_v1.js.map +1 -0
- package/lib/services/webhosting_mail_account_v1.d.ts +84 -0
- package/lib/services/webhosting_mail_account_v1.d.ts.map +1 -0
- package/lib/services/webhosting_mail_account_v1.js +2 -0
- package/lib/services/webhosting_mail_account_v1.js.map +1 -0
- package/lib/services/webhosting_offer_v1.d.ts +122 -0
- package/lib/services/webhosting_offer_v1.d.ts.map +1 -0
- package/lib/services/webhosting_offer_v1.js +2 -0
- package/lib/services/webhosting_offer_v1.js.map +1 -0
- package/lib/services/webhosting_website_v1.d.ts +75 -0
- package/lib/services/webhosting_website_v1.d.ts.map +1 -0
- package/lib/services/webhosting_website_v1.js +2 -0
- package/lib/services/webhosting_website_v1.js.map +1 -0
- package/lib/services.lazy/account_contract_v3.js +1 -0
- package/lib/services.lazy/account_iso_code_v3.js +1 -0
- package/lib/services.lazy/account_organization_v3.js +1 -0
- package/lib/services.lazy/account_project_v3.js +1 -0
- package/lib/services.lazy/account_unauthenticated_user_v3.js +3 -0
- package/lib/services.lazy/account_unauthenticated_v3.js +1 -0
- package/lib/services.lazy/account_user_v3.js +3 -0
- package/lib/services.lazy/annotations_v1.js +1 -0
- package/lib/services.lazy/baremetal_private_network_v1.js +1 -0
- package/lib/services.lazy/baremetal_private_network_v3.js +1 -0
- package/lib/services.lazy/baremetal_v1.js +3 -0
- package/lib/services.lazy/billing_electronic_billing_v2.js +1 -0
- package/lib/services.lazy/billing_v2.js +1 -0
- package/lib/services.lazy/block_v1.js +3 -0
- package/lib/services.lazy/cockpit_global_v1.js +1 -0
- package/lib/services.lazy/cockpit_regional_v1.js +3 -0
- package/lib/services.lazy/containers_v1.js +3 -0
- package/lib/services.lazy/dedibox_billing_v1.js +1 -0
- package/lib/services.lazy/dedibox_ipv6_block_v1.js +1 -0
- package/lib/services.lazy/dedibox_rpn_san_v1.js +1 -0
- package/lib/services.lazy/dedibox_rpn_v1.js +1 -0
- package/lib/services.lazy/dedibox_rpn_v1_v1.js +3 -0
- package/lib/services.lazy/dedibox_rpn_v2_v1.js +3 -0
- package/lib/services.lazy/dedibox_v1.js +3 -0
- package/lib/services.lazy/generative_apis_openai_v1.js +3 -0
- package/lib/services.lazy/generative_apis_v1.js +1 -0
- package/lib/services.lazy/index.js +3 -0
- package/lib/services.lazy/inference_v1.js +3 -0
- package/lib/services.lazy/instance_v1.js +3 -0
- package/lib/services.lazy/iot_v1.js +3 -0
- package/lib/services.lazy/ipam_v1.js +1 -0
- package/lib/services.lazy/k8s_v1.js +3 -0
- package/lib/services.lazy/lb_zoned_v1.js +3 -0
- package/lib/services.lazy/marketplace_console_v2.js +1 -0
- package/lib/services.lazy/marketplace_v2.js +1 -0
- package/lib/services.lazy/mongodb_v1.js +3 -0
- package/lib/services.lazy/partner_v1.js +1 -0
- package/lib/services.lazy/rdb_encryption_v1.js +1 -0
- package/lib/services.lazy/rdb_v1.js +3 -0
- package/lib/services.lazy/redis_v1.js +3 -0
- package/lib/services.lazy/registry_v1.js +1 -0
- package/lib/services.lazy/reseller_v1.js +1 -0
- package/lib/services.lazy/vpc_gw_v2.js +3 -0
- package/lib/services.lazy/vpc_private_network_with_nics_v2.js +1 -0
- package/lib/services.lazy/vpc_routes_with_nexthop_v2.js +1 -0
- package/lib/services.lazy/vpc_v2.js +3 -0
- package/lib/services.lazy/webhosting_backup_v1.js +1 -0
- package/lib/services.lazy/webhosting_control_panel_v1.js +1 -0
- package/lib/services.lazy/webhosting_database_v1.js +1 -0
- package/lib/services.lazy/webhosting_dedibox_v1.js +1 -0
- package/lib/services.lazy/webhosting_dns_v1.js +1 -0
- package/lib/services.lazy/webhosting_free_domain_v1.js +1 -0
- package/lib/services.lazy/webhosting_ftp_account_v1.js +1 -0
- package/lib/services.lazy/webhosting_hosting_v1.js +3 -0
- package/lib/services.lazy/webhosting_mail_account_v1.js +1 -0
- package/lib/services.lazy/webhosting_offer_v1.js +1 -0
- package/lib/services.lazy/webhosting_website_v1.js +1 -0
- package/lib/traits.d.ts +25 -0
- package/lib/traits.d.ts.map +1 -0
- package/lib/traits.js +1 -0
- package/lib/unstable-services/apple_silicon_private_network_v1alpha1.d.ts +119 -0
- package/lib/unstable-services/apple_silicon_private_network_v1alpha1.d.ts.map +1 -0
- package/lib/unstable-services/apple_silicon_private_network_v1alpha1.js +2 -0
- package/lib/unstable-services/apple_silicon_private_network_v1alpha1.js.map +1 -0
- package/lib/unstable-services/apple_silicon_v1alpha1.d.ts +569 -0
- package/lib/unstable-services/apple_silicon_v1alpha1.d.ts.map +1 -0
- package/lib/unstable-services/apple_silicon_v1alpha1.js +38 -0
- package/lib/unstable-services/apple_silicon_v1alpha1.js.map +1 -0
- package/lib/unstable-services/audit_trail_v1alpha1.d.ts +1082 -0
- package/lib/unstable-services/audit_trail_v1alpha1.d.ts.map +1 -0
- package/lib/unstable-services/audit_trail_v1alpha1.js +47 -0
- package/lib/unstable-services/audit_trail_v1alpha1.js.map +1 -0
- package/lib/unstable-services/autoscaling_v1alpha2.d.ts +368 -0
- package/lib/unstable-services/autoscaling_v1alpha2.d.ts.map +1 -0
- package/lib/unstable-services/autoscaling_v1alpha2.js +2 -0
- package/lib/unstable-services/autoscaling_v1alpha2.js.map +1 -0
- package/lib/unstable-services/billing_fin_ops_v2beta1.d.ts +78 -0
- package/lib/unstable-services/billing_fin_ops_v2beta1.d.ts.map +1 -0
- package/lib/unstable-services/billing_fin_ops_v2beta1.js +2 -0
- package/lib/unstable-services/billing_fin_ops_v2beta1.js.map +1 -0
- package/lib/unstable-services/billing_v2beta1.d.ts +411 -0
- package/lib/unstable-services/billing_v2beta1.d.ts.map +1 -0
- package/lib/unstable-services/billing_v2beta1.js +25 -0
- package/lib/unstable-services/billing_v2beta1.js.map +1 -0
- package/lib/unstable-services/block_v1alpha1.d.ts +372 -0
- package/lib/unstable-services/block_v1alpha1.d.ts.map +1 -0
- package/lib/unstable-services/block_v1alpha1.js +27 -0
- package/lib/unstable-services/block_v1alpha1.js.map +1 -0
- package/lib/unstable-services/data_orchestrator_v1alpha2.d.ts +440 -0
- package/lib/unstable-services/data_orchestrator_v1alpha2.d.ts.map +1 -0
- package/lib/unstable-services/data_orchestrator_v1alpha2.js +27 -0
- package/lib/unstable-services/data_orchestrator_v1alpha2.js.map +1 -0
- package/lib/unstable-services/datalab_v1beta1.d.ts +322 -0
- package/lib/unstable-services/datalab_v1beta1.d.ts.map +1 -0
- package/lib/unstable-services/datalab_v1beta1.js +2 -0
- package/lib/unstable-services/datalab_v1beta1.js.map +1 -0
- package/lib/unstable-services/dataviz_v1alpha1.d.ts +456 -0
- package/lib/unstable-services/dataviz_v1alpha1.d.ts.map +1 -0
- package/lib/unstable-services/dataviz_v1alpha1.js +34 -0
- package/lib/unstable-services/dataviz_v1alpha1.js.map +1 -0
- package/lib/unstable-services/datawarehouse_v1beta1.d.ts +492 -0
- package/lib/unstable-services/datawarehouse_v1beta1.d.ts.map +1 -0
- package/lib/unstable-services/datawarehouse_v1beta1.js +34 -0
- package/lib/unstable-services/datawarehouse_v1beta1.js.map +1 -0
- package/lib/unstable-services/domain_registrar_v2beta1.d.ts +1087 -0
- package/lib/unstable-services/domain_registrar_v2beta1.d.ts.map +1 -0
- package/lib/unstable-services/domain_registrar_v2beta1.js +50 -0
- package/lib/unstable-services/domain_registrar_v2beta1.js.map +1 -0
- package/lib/unstable-services/domain_suggestion_v2beta1.d.ts +19 -0
- package/lib/unstable-services/domain_suggestion_v2beta1.d.ts.map +1 -0
- package/lib/unstable-services/domain_suggestion_v2beta1.js +2 -0
- package/lib/unstable-services/domain_suggestion_v2beta1.js.map +1 -0
- package/lib/unstable-services/domain_v2beta1.d.ts +520 -0
- package/lib/unstable-services/domain_v2beta1.d.ts.map +1 -0
- package/lib/unstable-services/domain_v2beta1.js +44 -0
- package/lib/unstable-services/domain_v2beta1.js.map +1 -0
- package/lib/unstable-services/edge_services_v1beta1.d.ts +1153 -0
- package/lib/unstable-services/edge_services_v1beta1.d.ts.map +1 -0
- package/lib/unstable-services/edge_services_v1beta1.js +81 -0
- package/lib/unstable-services/edge_services_v1beta1.js.map +1 -0
- package/lib/unstable-services/environmental_footprint_user_v1alpha1.d.ts +149 -0
- package/lib/unstable-services/environmental_footprint_user_v1alpha1.d.ts.map +1 -0
- package/lib/unstable-services/environmental_footprint_user_v1alpha1.js +2 -0
- package/lib/unstable-services/environmental_footprint_user_v1alpha1.js.map +1 -0
- package/lib/unstable-services/file_v1alpha1.d.ts +350 -0
- package/lib/unstable-services/file_v1alpha1.d.ts.map +1 -0
- package/lib/unstable-services/file_v1alpha1.js +24 -0
- package/lib/unstable-services/file_v1alpha1.js.map +1 -0
- package/lib/unstable-services/flexible_ip_v1alpha1.d.ts +241 -0
- package/lib/unstable-services/flexible_ip_v1alpha1.d.ts.map +1 -0
- package/lib/unstable-services/flexible_ip_v1alpha1.js +2 -0
- package/lib/unstable-services/flexible_ip_v1alpha1.js.map +1 -0
- package/lib/unstable-services/functions_v1beta1.d.ts +852 -0
- package/lib/unstable-services/functions_v1beta1.d.ts.map +1 -0
- package/lib/unstable-services/functions_v1beta1.js +49 -0
- package/lib/unstable-services/functions_v1beta1.js.map +1 -0
- package/lib/unstable-services/iam_unauthenticated_v1alpha1.d.ts +257 -0
- package/lib/unstable-services/iam_unauthenticated_v1alpha1.d.ts.map +1 -0
- package/lib/unstable-services/iam_unauthenticated_v1alpha1.js +2 -0
- package/lib/unstable-services/iam_unauthenticated_v1alpha1.js.map +1 -0
- package/lib/unstable-services/iam_v1alpha1.d.ts +1506 -0
- package/lib/unstable-services/iam_v1alpha1.d.ts.map +1 -0
- package/lib/unstable-services/iam_v1alpha1.js +105 -0
- package/lib/unstable-services/iam_v1alpha1.js.map +1 -0
- package/lib/unstable-services/index.d.ts +44 -0
- package/lib/unstable-services/index.d.ts.map +1 -0
- package/lib/unstable-services/index.js +43 -0
- package/lib/unstable-services/instance_v2alpha1.d.ts +1755 -0
- package/lib/unstable-services/instance_v2alpha1.d.ts.map +1 -0
- package/lib/unstable-services/instance_v2alpha1.js +81 -0
- package/lib/unstable-services/instance_v2alpha1.js.map +1 -0
- package/lib/unstable-services/instance_volume_v2alpha1.d.ts +333 -0
- package/lib/unstable-services/instance_volume_v2alpha1.d.ts.map +1 -0
- package/lib/unstable-services/instance_volume_v2alpha1.js +26 -0
- package/lib/unstable-services/instance_volume_v2alpha1.js.map +1 -0
- package/lib/unstable-services/interlink_v1beta1.d.ts +636 -0
- package/lib/unstable-services/interlink_v1beta1.d.ts.map +1 -0
- package/lib/unstable-services/interlink_v1beta1.js +39 -0
- package/lib/unstable-services/interlink_v1beta1.js.map +1 -0
- package/lib/unstable-services/kafka_v1alpha1.d.ts +451 -0
- package/lib/unstable-services/kafka_v1alpha1.d.ts.map +1 -0
- package/lib/unstable-services/kafka_v1alpha1.js +27 -0
- package/lib/unstable-services/kafka_v1alpha1.js.map +1 -0
- package/lib/unstable-services/key_manager_v1alpha1.d.ts +515 -0
- package/lib/unstable-services/key_manager_v1alpha1.d.ts.map +1 -0
- package/lib/unstable-services/key_manager_v1alpha1.js +36 -0
- package/lib/unstable-services/key_manager_v1alpha1.js.map +1 -0
- package/lib/unstable-services/mailbox_v1alpha1.d.ts +438 -0
- package/lib/unstable-services/mailbox_v1alpha1.d.ts.map +1 -0
- package/lib/unstable-services/mailbox_v1alpha1.js +39 -0
- package/lib/unstable-services/mailbox_v1alpha1.js.map +1 -0
- package/lib/unstable-services/messageq_v1alpha1.d.ts +420 -0
- package/lib/unstable-services/messageq_v1alpha1.d.ts.map +1 -0
- package/lib/unstable-services/messageq_v1alpha1.js +29 -0
- package/lib/unstable-services/messageq_v1alpha1.js.map +1 -0
- package/lib/unstable-services/mnq_console_v1beta1.d.ts +32 -0
- package/lib/unstable-services/mnq_console_v1beta1.d.ts.map +1 -0
- package/lib/unstable-services/mnq_console_v1beta1.js +2 -0
- package/lib/unstable-services/mnq_console_v1beta1.js.map +1 -0
- package/lib/unstable-services/mnq_nats_v1beta1.d.ts +177 -0
- package/lib/unstable-services/mnq_nats_v1beta1.d.ts.map +1 -0
- package/lib/unstable-services/mnq_nats_v1beta1.js +2 -0
- package/lib/unstable-services/mnq_nats_v1beta1.js.map +1 -0
- package/lib/unstable-services/mnq_sns_v1beta1.d.ts +155 -0
- package/lib/unstable-services/mnq_sns_v1beta1.d.ts.map +1 -0
- package/lib/unstable-services/mnq_sns_v1beta1.js +2 -0
- package/lib/unstable-services/mnq_sns_v1beta1.js.map +1 -0
- package/lib/unstable-services/mnq_sqs_v1beta1.d.ts +155 -0
- package/lib/unstable-services/mnq_sqs_v1beta1.d.ts.map +1 -0
- package/lib/unstable-services/mnq_sqs_v1beta1.js +2 -0
- package/lib/unstable-services/mnq_sqs_v1beta1.js.map +1 -0
- package/lib/unstable-services/mongodb_v1alpha1.d.ts +604 -0
- package/lib/unstable-services/mongodb_v1alpha1.d.ts.map +1 -0
- package/lib/unstable-services/mongodb_v1alpha1.js +37 -0
- package/lib/unstable-services/mongodb_v1alpha1.js.map +1 -0
- package/lib/unstable-services/product_catalog_public_catalog_v2alpha1.d.ts +479 -0
- package/lib/unstable-services/product_catalog_public_catalog_v2alpha1.d.ts.map +1 -0
- package/lib/unstable-services/product_catalog_public_catalog_v2alpha1.js +2 -0
- package/lib/unstable-services/product_catalog_public_catalog_v2alpha1.js.map +1 -0
- package/lib/unstable-services/qaas_v1alpha1.d.ts +764 -0
- package/lib/unstable-services/qaas_v1alpha1.d.ts.map +1 -0
- package/lib/unstable-services/qaas_v1alpha1.js +51 -0
- package/lib/unstable-services/qaas_v1alpha1.js.map +1 -0
- package/lib/unstable-services/s2s_vpn_v1alpha1.d.ts +794 -0
- package/lib/unstable-services/s2s_vpn_v1alpha1.d.ts.map +1 -0
- package/lib/unstable-services/s2s_vpn_v1alpha1.js +45 -0
- package/lib/unstable-services/s2s_vpn_v1alpha1.js.map +1 -0
- package/lib/unstable-services/search_v1alpha1.d.ts +120 -0
- package/lib/unstable-services/search_v1alpha1.d.ts.map +1 -0
- package/lib/unstable-services/search_v1alpha1.js +2 -0
- package/lib/unstable-services/search_v1alpha1.js.map +1 -0
- package/lib/unstable-services/searchdb_v1alpha1.d.ts +424 -0
- package/lib/unstable-services/searchdb_v1alpha1.d.ts.map +1 -0
- package/lib/unstable-services/searchdb_v1alpha1.js +29 -0
- package/lib/unstable-services/searchdb_v1alpha1.js.map +1 -0
- package/lib/unstable-services/secret_manager_v1beta1.d.ts +407 -0
- package/lib/unstable-services/secret_manager_v1beta1.d.ts.map +1 -0
- package/lib/unstable-services/secret_manager_v1beta1.js +32 -0
- package/lib/unstable-services/secret_manager_v1beta1.js.map +1 -0
- package/lib/unstable-services/serverless_jobs_v1alpha1.d.ts +331 -0
- package/lib/unstable-services/serverless_jobs_v1alpha1.d.ts.map +1 -0
- package/lib/unstable-services/serverless_jobs_v1alpha1.js +28 -0
- package/lib/unstable-services/serverless_jobs_v1alpha1.js.map +1 -0
- package/lib/unstable-services/serverless_jobs_v1alpha2.d.ts +546 -0
- package/lib/unstable-services/serverless_jobs_v1alpha2.d.ts.map +1 -0
- package/lib/unstable-services/serverless_jobs_v1alpha2.js +35 -0
- package/lib/unstable-services/serverless_jobs_v1alpha2.js.map +1 -0
- package/lib/unstable-services/serverless_sqldb_v1alpha1.d.ts +239 -0
- package/lib/unstable-services/serverless_sqldb_v1alpha1.d.ts.map +1 -0
- package/lib/unstable-services/serverless_sqldb_v1alpha1.js +2 -0
- package/lib/unstable-services/serverless_sqldb_v1alpha1.js.map +1 -0
- package/lib/unstable-services/transactional_email_v1alpha1.d.ts +936 -0
- package/lib/unstable-services/transactional_email_v1alpha1.d.ts.map +1 -0
- package/lib/unstable-services/transactional_email_v1alpha1.js +46 -0
- package/lib/unstable-services/transactional_email_v1alpha1.js.map +1 -0
- package/lib/unstable-services.lazy/apple_silicon_private_network_v1alpha1.js +1 -0
- package/lib/unstable-services.lazy/apple_silicon_v1alpha1.js +3 -0
- package/lib/unstable-services.lazy/audit_trail_v1alpha1.js +3 -0
- package/lib/unstable-services.lazy/autoscaling_v1alpha2.js +1 -0
- package/lib/unstable-services.lazy/billing_fin_ops_v2beta1.js +1 -0
- package/lib/unstable-services.lazy/billing_v2beta1.js +3 -0
- package/lib/unstable-services.lazy/block_v1alpha1.js +3 -0
- package/lib/unstable-services.lazy/data_orchestrator_v1alpha2.js +3 -0
- package/lib/unstable-services.lazy/datalab_v1beta1.js +1 -0
- package/lib/unstable-services.lazy/dataviz_v1alpha1.js +3 -0
- package/lib/unstable-services.lazy/datawarehouse_v1beta1.js +3 -0
- package/lib/unstable-services.lazy/domain_registrar_v2beta1.js +3 -0
- package/lib/unstable-services.lazy/domain_suggestion_v2beta1.js +1 -0
- package/lib/unstable-services.lazy/domain_v2beta1.js +3 -0
- package/lib/unstable-services.lazy/edge_services_v1beta1.js +3 -0
- package/lib/unstable-services.lazy/environmental_footprint_user_v1alpha1.js +1 -0
- package/lib/unstable-services.lazy/file_v1alpha1.js +3 -0
- package/lib/unstable-services.lazy/flexible_ip_v1alpha1.js +1 -0
- package/lib/unstable-services.lazy/functions_v1beta1.js +3 -0
- package/lib/unstable-services.lazy/iam_unauthenticated_v1alpha1.js +1 -0
- package/lib/unstable-services.lazy/iam_v1alpha1.js +3 -0
- package/lib/unstable-services.lazy/index.js +3 -0
- package/lib/unstable-services.lazy/instance_v2alpha1.js +3 -0
- package/lib/unstable-services.lazy/instance_volume_v2alpha1.js +3 -0
- package/lib/unstable-services.lazy/interlink_v1beta1.js +3 -0
- package/lib/unstable-services.lazy/kafka_v1alpha1.js +3 -0
- package/lib/unstable-services.lazy/key_manager_v1alpha1.js +3 -0
- package/lib/unstable-services.lazy/mailbox_v1alpha1.js +3 -0
- package/lib/unstable-services.lazy/messageq_v1alpha1.js +3 -0
- package/lib/unstable-services.lazy/mnq_console_v1beta1.js +1 -0
- package/lib/unstable-services.lazy/mnq_nats_v1beta1.js +1 -0
- package/lib/unstable-services.lazy/mnq_sns_v1beta1.js +1 -0
- package/lib/unstable-services.lazy/mnq_sqs_v1beta1.js +1 -0
- package/lib/unstable-services.lazy/mongodb_v1alpha1.js +3 -0
- package/lib/unstable-services.lazy/product_catalog_public_catalog_v2alpha1.js +1 -0
- package/lib/unstable-services.lazy/qaas_v1alpha1.js +3 -0
- package/lib/unstable-services.lazy/s2s_vpn_v1alpha1.js +3 -0
- package/lib/unstable-services.lazy/search_v1alpha1.js +1 -0
- package/lib/unstable-services.lazy/searchdb_v1alpha1.js +3 -0
- package/lib/unstable-services.lazy/secret_manager_v1beta1.js +3 -0
- package/lib/unstable-services.lazy/serverless_jobs_v1alpha1.js +3 -0
- package/lib/unstable-services.lazy/serverless_jobs_v1alpha2.js +3 -0
- package/lib/unstable-services.lazy/serverless_sqldb_v1alpha1.js +1 -0
- package/lib/unstable-services.lazy/transactional_email_v1alpha1.js +3 -0
- package/package.json +89 -2
- package/src/credentials.ts +104 -0
- package/src/errors.ts +307 -0
- package/src/index.ts +52 -0
- package/src/pagination.ts +65 -0
- package/src/protocol.ts +496 -0
- package/src/retry.ts +47 -0
- package/src/services/account_contract_v3.ts +441 -0
- package/src/services/account_iso_code_v3.ts +165 -0
- package/src/services/account_organization_v3.ts +947 -0
- package/src/services/account_project_v3.ts +530 -0
- package/src/services/account_unauthenticated_user_v3.ts +1445 -0
- package/src/services/account_unauthenticated_v3.ts +92 -0
- package/src/services/account_user_v3.ts +1657 -0
- package/src/services/annotations_v1.ts +897 -0
- package/src/services/baremetal_private_network_v1.ts +327 -0
- package/src/services/baremetal_private_network_v3.ts +376 -0
- package/src/services/baremetal_v1.ts +3072 -0
- package/src/services/billing_electronic_billing_v2.ts +323 -0
- package/src/services/billing_v2.ts +662 -0
- package/src/services/block_v1.ts +1282 -0
- package/src/services/cockpit_global_v1.ts +282 -0
- package/src/services/cockpit_regional_v1.ts +2177 -0
- package/src/services/containers_v1.ts +2110 -0
- package/src/services/dedibox_billing_v1.ts +621 -0
- package/src/services/dedibox_ipv6_block_v1.ts +468 -0
- package/src/services/dedibox_rpn_san_v1.ts +1185 -0
- package/src/services/dedibox_rpn_v1.ts +207 -0
- package/src/services/dedibox_rpn_v1_v1.ts +1763 -0
- package/src/services/dedibox_rpn_v2_v1.ts +1654 -0
- package/src/services/dedibox_v1.ts +3765 -0
- package/src/services/generative_apis_openai_v1.ts +1692 -0
- package/src/services/generative_apis_v1.ts +251 -0
- package/src/services/index.ts +57 -0
- package/src/services/inference_v1.ts +1353 -0
- package/src/services/instance_v1.ts +6611 -0
- package/src/services/iot_v1.ts +2419 -0
- package/src/services/ipam_v1.ts +716 -0
- package/src/services/k8s_v1.ts +3108 -0
- package/src/services/lb_zoned_v1.ts +4533 -0
- package/src/services/marketplace_console_v2.ts +198 -0
- package/src/services/marketplace_v2.ts +625 -0
- package/src/services/mongodb_v1.ts +2104 -0
- package/src/services/partner_v1.ts +462 -0
- package/src/services/rdb_encryption_v1.ts +83 -0
- package/src/services/rdb_v1.ts +4211 -0
- package/src/services/redis_v1.ts +1918 -0
- package/src/services/registry_v1.ts +863 -0
- package/src/services/reseller_v1.ts +258 -0
- package/src/services/vpc_gw_v2.ts +2137 -0
- package/src/services/vpc_private_network_with_nics_v2.ts +311 -0
- package/src/services/vpc_routes_with_nexthop_v2.ts +226 -0
- package/src/services/vpc_v2.ts +2533 -0
- package/src/services/webhosting_backup_v1.ts +578 -0
- package/src/services/webhosting_control_panel_v1.ts +130 -0
- package/src/services/webhosting_database_v1.ts +682 -0
- package/src/services/webhosting_dedibox_v1.ts +480 -0
- package/src/services/webhosting_dns_v1.ts +471 -0
- package/src/services/webhosting_free_domain_v1.ts +190 -0
- package/src/services/webhosting_ftp_account_v1.ts +280 -0
- package/src/services/webhosting_hosting_v1.ts +1309 -0
- package/src/services/webhosting_mail_account_v1.ts +291 -0
- package/src/services/webhosting_offer_v1.ts +289 -0
- package/src/services/webhosting_website_v1.ts +274 -0
- package/src/traits.ts +63 -0
- package/src/unstable-services/apple_silicon_private_network_v1alpha1.ts +395 -0
- package/src/unstable-services/apple_silicon_v1alpha1.ts +1685 -0
- package/src/unstable-services/audit_trail_v1alpha1.ts +3220 -0
- package/src/unstable-services/autoscaling_v1alpha2.ts +1103 -0
- package/src/unstable-services/billing_fin_ops_v2beta1.ts +195 -0
- package/src/unstable-services/billing_v2beta1.ts +1203 -0
- package/src/unstable-services/block_v1alpha1.ts +1239 -0
- package/src/unstable-services/data_orchestrator_v1alpha2.ts +1230 -0
- package/src/unstable-services/datalab_v1beta1.ts +852 -0
- package/src/unstable-services/dataviz_v1alpha1.ts +1478 -0
- package/src/unstable-services/datawarehouse_v1beta1.ts +1504 -0
- package/src/unstable-services/domain_registrar_v2beta1.ts +2979 -0
- package/src/unstable-services/domain_suggestion_v2beta1.ts +86 -0
- package/src/unstable-services/domain_v2beta1.ts +1794 -0
- package/src/unstable-services/edge_services_v1beta1.ts +3724 -0
- package/src/unstable-services/environmental_footprint_user_v1alpha1.ts +429 -0
- package/src/unstable-services/file_v1alpha1.ts +1016 -0
- package/src/unstable-services/flexible_ip_v1alpha1.ts +804 -0
- package/src/unstable-services/functions_v1beta1.ts +2410 -0
- package/src/unstable-services/iam_unauthenticated_v1alpha1.ts +863 -0
- package/src/unstable-services/iam_v1alpha1.ts +4919 -0
- package/src/unstable-services/index.ts +44 -0
- package/src/unstable-services/instance_v2alpha1.ts +5395 -0
- package/src/unstable-services/instance_volume_v2alpha1.ts +1111 -0
- package/src/unstable-services/interlink_v1beta1.ts +1791 -0
- package/src/unstable-services/kafka_v1alpha1.ts +1275 -0
- package/src/unstable-services/key_manager_v1alpha1.ts +1618 -0
- package/src/unstable-services/mailbox_v1alpha1.ts +1561 -0
- package/src/unstable-services/messageq_v1alpha1.ts +1266 -0
- package/src/unstable-services/mnq_console_v1beta1.ts +111 -0
- package/src/unstable-services/mnq_nats_v1beta1.ts +608 -0
- package/src/unstable-services/mnq_sns_v1beta1.ts +523 -0
- package/src/unstable-services/mnq_sqs_v1beta1.ts +523 -0
- package/src/unstable-services/mongodb_v1alpha1.ts +1789 -0
- package/src/unstable-services/product_catalog_public_catalog_v2alpha1.ts +1113 -0
- package/src/unstable-services/qaas_v1alpha1.ts +2404 -0
- package/src/unstable-services/s2s_vpn_v1alpha1.ts +2173 -0
- package/src/unstable-services/search_v1alpha1.ts +349 -0
- package/src/unstable-services/searchdb_v1alpha1.ts +1273 -0
- package/src/unstable-services/secret_manager_v1beta1.ts +1255 -0
- package/src/unstable-services/serverless_jobs_v1alpha1.ts +1017 -0
- package/src/unstable-services/serverless_jobs_v1alpha2.ts +1516 -0
- package/src/unstable-services/serverless_sqldb_v1alpha1.ts +747 -0
- package/src/unstable-services/transactional_email_v1alpha1.ts +2495 -0
package/src/protocol.ts
ADDED
|
@@ -0,0 +1,496 @@
|
|
|
1
|
+
import {
|
|
2
|
+
InternalServerError,
|
|
3
|
+
TooManyRequests,
|
|
4
|
+
type InvalidInput,
|
|
5
|
+
} from "@distilled.cloud/core/errors";
|
|
6
|
+
import { setOwnKey } from "@distilled.cloud/core/plain-values";
|
|
7
|
+
import type {
|
|
8
|
+
DeclaredError,
|
|
9
|
+
DeclaredErrorClass,
|
|
10
|
+
DecodeArgs,
|
|
11
|
+
EncodeArgs,
|
|
12
|
+
ErrorOf,
|
|
13
|
+
Protocol,
|
|
14
|
+
ProtocolOf,
|
|
15
|
+
} from "@distilled.cloud/core/protocol";
|
|
16
|
+
import {
|
|
17
|
+
buildRequest,
|
|
18
|
+
getAnn,
|
|
19
|
+
mapKeys,
|
|
20
|
+
matchTypedError,
|
|
21
|
+
} from "@distilled.cloud/core/protocol-http";
|
|
22
|
+
import {
|
|
23
|
+
declaredStatusClass,
|
|
24
|
+
readBinaryResponse,
|
|
25
|
+
unwrapRedactedDeep,
|
|
26
|
+
validateSuccess,
|
|
27
|
+
} from "@distilled.cloud/core/protocol-rest";
|
|
28
|
+
import { parseRetryAfterForStatus } from "@distilled.cloud/core/retry-after";
|
|
29
|
+
import { SdkError } from "@distilled.cloud/core/sdk-error";
|
|
30
|
+
import { httpSymbol } from "@distilled.cloud/core/trait";
|
|
31
|
+
/**
|
|
32
|
+
* ScalewayProtocol -- JSON over HTTPS, authenticated by `X-Auth-Token`.
|
|
33
|
+
*
|
|
34
|
+
* Every Scaleway API lives under one host (`https://api.scaleway.com`,
|
|
35
|
+
* overridable with `SCW_API_URL`) with the product and version in the path
|
|
36
|
+
* (`/instance/v1/zones/{zone}/servers`); Generative APIs alone answer on
|
|
37
|
+
* `https://api.scaleway.ai` and take the key as `Authorization: Bearer`.
|
|
38
|
+
* The host is baked into each generated operation's `T.Http({ baseUrl })`.
|
|
39
|
+
*
|
|
40
|
+
* Requests: a `{region}` / `{zone}` path segment the caller leaves out is
|
|
41
|
+
* filled from the credentials' default, as the official SDKs do with
|
|
42
|
+
* `SCW_DEFAULT_REGION` / `SCW_DEFAULT_ZONE`. Arrays in the query string
|
|
43
|
+
* repeat the key (`tags=a&tags=b`), which core's request builder already
|
|
44
|
+
* does.
|
|
45
|
+
*
|
|
46
|
+
* Responses: success bodies are the payload, no envelope. Scaleway's
|
|
47
|
+
* proto3 JSON writes every unset message or wrapper field as `null` where
|
|
48
|
+
* the specs declare a plain optional member (`gpu_info`, `price_per_month`,
|
|
49
|
+
* `float_min`, ...), so `null` properties are dropped before decoding -- the
|
|
50
|
+
* same thing the official SDKs' unmarshallers do (`null` -> `undefined`).
|
|
51
|
+
* Instance v1 list endpoints answer their count as `X-Total-Count` rather
|
|
52
|
+
* than in the body; it is folded into the body as `total_count`
|
|
53
|
+
* (scaleway-sdk-js `fixLegacyTotalCount`). A non-JSON success body (Instance user data is
|
|
54
|
+
* `text/plain`) is returned as text.
|
|
55
|
+
*
|
|
56
|
+
* Failures are `{ type, message, ... }`; see `errors.ts` for the `type`
|
|
57
|
+
* dispatch. Its classes and core's status classes are the service's errors
|
|
58
|
+
* (`ScalewayServiceErrors`): the protocol builds one only from the classes
|
|
59
|
+
* the operation lists.
|
|
60
|
+
*/
|
|
61
|
+
import * as Duration from "effect/Duration";
|
|
62
|
+
import * as Effect from "effect/Effect";
|
|
63
|
+
import type * as HttpClient from "effect/http/HttpClient";
|
|
64
|
+
import * as HttpClientRequest from "effect/http/HttpClientRequest";
|
|
65
|
+
import * as Redacted from "effect/Redacted";
|
|
66
|
+
import type * as AST from "effect/SchemaAST";
|
|
67
|
+
import { Credentials, DEFAULT_API_URL, type Config } from "./credentials.ts";
|
|
68
|
+
import {
|
|
69
|
+
AlreadyExistsError,
|
|
70
|
+
DeniedAuthenticationError,
|
|
71
|
+
InvalidArgumentsError,
|
|
72
|
+
OutOfStockError,
|
|
73
|
+
PermissionsDeniedError,
|
|
74
|
+
PreconditionFailedError,
|
|
75
|
+
QuotasExceededError,
|
|
76
|
+
ResourceExpiredError,
|
|
77
|
+
ResourceLockedError,
|
|
78
|
+
ResourceNotFoundError,
|
|
79
|
+
ScalewayParseError,
|
|
80
|
+
TransientStateError,
|
|
81
|
+
UnknownScalewayError,
|
|
82
|
+
} from "./errors.ts";
|
|
83
|
+
import type { ScalewayErrors, ScalewayServiceError } from "./errors.ts";
|
|
84
|
+
import type { ScalewayHttpTrait } from "./traits.ts";
|
|
85
|
+
|
|
86
|
+
/**
|
|
87
|
+
* What every generated Scaleway operation fails with besides its own
|
|
88
|
+
* errors: the service's errors, the protocol's, and what resolving the
|
|
89
|
+
* credentials fails with. Generated service files annotate operations with
|
|
90
|
+
* `API.OperationMethod<I, O, ScalewayOpError, ScalewayOpContext>` explicitly
|
|
91
|
+
* so the compiler never infers these back out of the schema generics.
|
|
92
|
+
*/
|
|
93
|
+
export type ScalewayOpError = ScalewayServiceError | ErrorOf<typeof ScalewayProtocol>;
|
|
94
|
+
|
|
95
|
+
/** Context (requirements) shared by every generated Scaleway operation. */
|
|
96
|
+
export type ScalewayOpContext = Credentials | HttpClient.HttpClient;
|
|
97
|
+
|
|
98
|
+
const GENERATIVE_APIS_HOST = "https://api.scaleway.ai";
|
|
99
|
+
|
|
100
|
+
type Json = Record<string, unknown>;
|
|
101
|
+
|
|
102
|
+
const isObject = (value: unknown): value is Json =>
|
|
103
|
+
value !== null && typeof value === "object" && !Array.isArray(value);
|
|
104
|
+
|
|
105
|
+
const str = (value: unknown): string | undefined => (typeof value === "string" ? value : undefined);
|
|
106
|
+
|
|
107
|
+
const records = (value: unknown): Json[] => (Array.isArray(value) ? value.filter(isObject) : []);
|
|
108
|
+
|
|
109
|
+
const UUID = /^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/i;
|
|
110
|
+
|
|
111
|
+
/** An error Scaleway's `type` envelope names: one of its classes, or core's `TooManyRequests`. */
|
|
112
|
+
type EnvelopeError = ScalewayErrors | TooManyRequests;
|
|
113
|
+
|
|
114
|
+
/**
|
|
115
|
+
* Scaleway's typed error for a failure body, or undefined when its `type`
|
|
116
|
+
* is not one the official SDKs recognise (the caller then falls back to the
|
|
117
|
+
* HTTP status). Mirrors scaleway-sdk-js `parseScalewayError`, including the
|
|
118
|
+
* two legacy envelopes Instance v1 still answers with. `build` makes the
|
|
119
|
+
* error from its class and fields, and can answer `undefined` too.
|
|
120
|
+
*/
|
|
121
|
+
const envelopeError = <A>(
|
|
122
|
+
build: <Props>(cls: new (props: Props) => EnvelopeError, props: Props) => A,
|
|
123
|
+
body: unknown,
|
|
124
|
+
message: string,
|
|
125
|
+
headers: Record<string, string | undefined>,
|
|
126
|
+
status: number,
|
|
127
|
+
): A | undefined => {
|
|
128
|
+
if (!isObject(body) || typeof body.type !== "string") return undefined;
|
|
129
|
+
const resource = str(body.resource);
|
|
130
|
+
const resource_id = str(body.resource_id);
|
|
131
|
+
switch (body.type) {
|
|
132
|
+
case "invalid_arguments":
|
|
133
|
+
return build(InvalidArgumentsError, {
|
|
134
|
+
message,
|
|
135
|
+
details: records(body.details).flatMap((d) =>
|
|
136
|
+
typeof d.argument_name === "string" && typeof d.reason === "string"
|
|
137
|
+
? [
|
|
138
|
+
{
|
|
139
|
+
argument_name: d.argument_name,
|
|
140
|
+
reason: d.reason,
|
|
141
|
+
help_message: str(d.help_message),
|
|
142
|
+
},
|
|
143
|
+
]
|
|
144
|
+
: [],
|
|
145
|
+
),
|
|
146
|
+
body,
|
|
147
|
+
});
|
|
148
|
+
case "denied_authentication":
|
|
149
|
+
return build(DeniedAuthenticationError, {
|
|
150
|
+
message,
|
|
151
|
+
method: str(body.method),
|
|
152
|
+
reason: str(body.reason),
|
|
153
|
+
body,
|
|
154
|
+
});
|
|
155
|
+
case "permissions_denied":
|
|
156
|
+
return build(PermissionsDeniedError, {
|
|
157
|
+
message,
|
|
158
|
+
details: records(body.details).flatMap((d) =>
|
|
159
|
+
typeof d.resource === "string" && typeof d.action === "string"
|
|
160
|
+
? [{ resource: d.resource, action: d.action }]
|
|
161
|
+
: [],
|
|
162
|
+
),
|
|
163
|
+
body,
|
|
164
|
+
});
|
|
165
|
+
case "quotas_exceeded":
|
|
166
|
+
return build(QuotasExceededError, {
|
|
167
|
+
message,
|
|
168
|
+
details: records(body.details).flatMap((d) =>
|
|
169
|
+
typeof d.resource === "string" &&
|
|
170
|
+
typeof d.quota === "number" &&
|
|
171
|
+
typeof d.current === "number"
|
|
172
|
+
? [{ resource: d.resource, quota: d.quota, current: d.current }]
|
|
173
|
+
: [],
|
|
174
|
+
),
|
|
175
|
+
body,
|
|
176
|
+
});
|
|
177
|
+
case "not_found":
|
|
178
|
+
return build(ResourceNotFoundError, { message, resource, resource_id, body });
|
|
179
|
+
case "expired":
|
|
180
|
+
return build(ResourceExpiredError, {
|
|
181
|
+
message,
|
|
182
|
+
resource,
|
|
183
|
+
resource_id,
|
|
184
|
+
expired_since: str(body.expired_since),
|
|
185
|
+
body,
|
|
186
|
+
});
|
|
187
|
+
case "locked":
|
|
188
|
+
return build(ResourceLockedError, { message, resource, resource_id, body });
|
|
189
|
+
case "transient_state":
|
|
190
|
+
return build(TransientStateError, {
|
|
191
|
+
message,
|
|
192
|
+
resource,
|
|
193
|
+
resource_id,
|
|
194
|
+
current_state: str(body.current_state),
|
|
195
|
+
body,
|
|
196
|
+
});
|
|
197
|
+
case "already_exists":
|
|
198
|
+
return build(AlreadyExistsError, {
|
|
199
|
+
message,
|
|
200
|
+
resource,
|
|
201
|
+
resource_id,
|
|
202
|
+
help_message: str(body.help_message),
|
|
203
|
+
body,
|
|
204
|
+
});
|
|
205
|
+
case "precondition_failed":
|
|
206
|
+
return build(PreconditionFailedError, {
|
|
207
|
+
message,
|
|
208
|
+
precondition: str(body.precondition),
|
|
209
|
+
help_message: str(body.help_message),
|
|
210
|
+
body,
|
|
211
|
+
});
|
|
212
|
+
case "out_of_stock":
|
|
213
|
+
return build(OutOfStockError, { message, resource, body });
|
|
214
|
+
case "too_many_requests": {
|
|
215
|
+
// `reset_seconds` is the server's own wait hint when no Retry-After
|
|
216
|
+
// header came with it.
|
|
217
|
+
const reset = typeof body.reset_seconds === "number" ? body.reset_seconds : undefined;
|
|
218
|
+
return build(TooManyRequests, {
|
|
219
|
+
message,
|
|
220
|
+
retryAfter:
|
|
221
|
+
parseRetryAfterForStatus(429, headers) ??
|
|
222
|
+
(reset !== undefined ? Duration.seconds(reset) : undefined),
|
|
223
|
+
});
|
|
224
|
+
}
|
|
225
|
+
case "unknown_resource": {
|
|
226
|
+
// Legacy Instance v1: `"<uuid>" not found` / `Security group '<uuid>' not found`.
|
|
227
|
+
const parts = (str(body.message) ?? "").split(/["']/);
|
|
228
|
+
if (parts.length === 3 && UUID.test(parts[1]!)) {
|
|
229
|
+
return build(ResourceNotFoundError, {
|
|
230
|
+
message,
|
|
231
|
+
resource: parts[0]!.trim().toLowerCase().split(" ").join("_") || undefined,
|
|
232
|
+
resource_id: parts[1],
|
|
233
|
+
body,
|
|
234
|
+
});
|
|
235
|
+
}
|
|
236
|
+
return status === 404 ? build(ResourceNotFoundError, { message, body }) : undefined;
|
|
237
|
+
}
|
|
238
|
+
case "invalid_request_error": {
|
|
239
|
+
// Legacy Instance v1: quota failures and per-field validation messages.
|
|
240
|
+
if ((str(body.message) ?? "").toLowerCase().includes("quota exceeded for this resource")) {
|
|
241
|
+
return build(QuotasExceededError, {
|
|
242
|
+
message,
|
|
243
|
+
details: [{ resource: resource ?? "", quota: 0, current: 0 }],
|
|
244
|
+
body,
|
|
245
|
+
});
|
|
246
|
+
}
|
|
247
|
+
const fields = isObject(body.fields) ? Object.entries(body.fields) : [];
|
|
248
|
+
const details = fields.flatMap(([argument_name, messages]) =>
|
|
249
|
+
(Array.isArray(messages) ? messages : [])
|
|
250
|
+
.filter((m): m is string => typeof m === "string")
|
|
251
|
+
.map((help_message) => ({ argument_name, reason: "constraint", help_message })),
|
|
252
|
+
);
|
|
253
|
+
return details.length > 0
|
|
254
|
+
? build(InvalidArgumentsError, { message, details, body })
|
|
255
|
+
: undefined;
|
|
256
|
+
}
|
|
257
|
+
default:
|
|
258
|
+
return undefined;
|
|
259
|
+
}
|
|
260
|
+
};
|
|
261
|
+
|
|
262
|
+
/**
|
|
263
|
+
* Scaleway's typed error for a failure body, or undefined when its `type`
|
|
264
|
+
* is not one the official SDKs recognise. See {@link envelopeError}.
|
|
265
|
+
*/
|
|
266
|
+
export const scalewayError = (
|
|
267
|
+
body: unknown,
|
|
268
|
+
message: string,
|
|
269
|
+
headers: Record<string, string | undefined>,
|
|
270
|
+
status: number,
|
|
271
|
+
): EnvelopeError | undefined =>
|
|
272
|
+
envelopeError((cls, props) => new cls(props), body, message, headers, status);
|
|
273
|
+
|
|
274
|
+
/**
|
|
275
|
+
* An instance of `cls`, a class of the service's errors, built from the
|
|
276
|
+
* operation's own list: `undefined` when the operation does not list the
|
|
277
|
+
* class (every generated operation lists `ScalewayServiceErrors`).
|
|
278
|
+
*/
|
|
279
|
+
const declaredError = <Props>(
|
|
280
|
+
errors: ReadonlyArray<DeclaredErrorClass>,
|
|
281
|
+
cls: new (props: Props) => unknown,
|
|
282
|
+
props: Props,
|
|
283
|
+
): DeclaredError | undefined => {
|
|
284
|
+
const known: unknown = cls;
|
|
285
|
+
const Declared = errors.find((declared) => declared === known);
|
|
286
|
+
return Declared === undefined ? undefined : new Declared(props);
|
|
287
|
+
};
|
|
288
|
+
|
|
289
|
+
/**
|
|
290
|
+
* Human-readable message for a failure body. Scaleway's `message` is often
|
|
291
|
+
* generic (`"invalid argument(s)"`), so the per-argument `help_message`s
|
|
292
|
+
* are appended when present.
|
|
293
|
+
*/
|
|
294
|
+
const failureMessage = (body: unknown, status: number, text: string): string => {
|
|
295
|
+
if (!isObject(body)) return text.trim() !== "" ? text.trim() : `HTTP ${status}`;
|
|
296
|
+
const base = str(body.message) ?? str(body.help_message) ?? str(body.type) ?? `HTTP ${status}`;
|
|
297
|
+
const help = records(body.details)
|
|
298
|
+
.map((d) =>
|
|
299
|
+
typeof d.argument_name === "string"
|
|
300
|
+
? `${d.argument_name}: ${str(d.help_message) ?? str(d.reason) ?? "invalid"}`
|
|
301
|
+
: undefined,
|
|
302
|
+
)
|
|
303
|
+
.filter((s): s is string => s !== undefined);
|
|
304
|
+
return help.length > 0 ? `${base} (${help.join("; ")})` : base;
|
|
305
|
+
};
|
|
306
|
+
|
|
307
|
+
const httpTraitOf = (inputAst: AST.AST): ScalewayHttpTrait | SdkError => {
|
|
308
|
+
const http = getAnn(inputAst, httpSymbol) as ScalewayHttpTrait | undefined;
|
|
309
|
+
if (http === undefined || typeof http.baseUrl !== "string" || http.baseUrl === "") {
|
|
310
|
+
return new SdkError({
|
|
311
|
+
message: "Scaleway operation is missing T.Http({ baseUrl }) -- regenerate from convert",
|
|
312
|
+
});
|
|
313
|
+
}
|
|
314
|
+
return http;
|
|
315
|
+
};
|
|
316
|
+
|
|
317
|
+
const baseUrlFor = (creds: Config, http: ScalewayHttpTrait): string =>
|
|
318
|
+
http.baseUrl === DEFAULT_API_URL && creds.apiUrl !== undefined && creds.apiUrl !== ""
|
|
319
|
+
? creds.apiUrl.replace(/\/+$/, "")
|
|
320
|
+
: http.baseUrl;
|
|
321
|
+
|
|
322
|
+
/** Fill `region` / `zone` the caller left out from the configured defaults. */
|
|
323
|
+
const withLocality = (input: unknown, uri: string, creds: Config): unknown => {
|
|
324
|
+
const obj = isObject(input) ? input : {};
|
|
325
|
+
const missing = (key: string) =>
|
|
326
|
+
uri.includes(`{${key}}`) && (obj[key] === undefined || obj[key] === null || obj[key] === "");
|
|
327
|
+
if (!missing("region") && !missing("zone")) return input;
|
|
328
|
+
return {
|
|
329
|
+
...obj,
|
|
330
|
+
...(missing("region") ? { region: creds.region } : {}),
|
|
331
|
+
...(missing("zone") ? { zone: creds.zone } : {}),
|
|
332
|
+
};
|
|
333
|
+
};
|
|
334
|
+
|
|
335
|
+
/** Drop `null` properties, recursively (array elements are kept). */
|
|
336
|
+
export const stripNulls = (value: unknown): unknown => {
|
|
337
|
+
if (Array.isArray(value)) return value.map(stripNulls);
|
|
338
|
+
if (isObject(value)) {
|
|
339
|
+
const out: Json = {};
|
|
340
|
+
for (const [k, v] of Object.entries(value)) {
|
|
341
|
+
// setOwnKey keeps a `__proto__` key a key instead of the prototype.
|
|
342
|
+
if (v !== null) setOwnKey(out, k, stripNulls(v));
|
|
343
|
+
}
|
|
344
|
+
return out;
|
|
345
|
+
}
|
|
346
|
+
return value;
|
|
347
|
+
};
|
|
348
|
+
|
|
349
|
+
const isJsonContentType = (contentType: string | undefined): boolean =>
|
|
350
|
+
contentType === undefined || contentType === "" || /[/+]json\b/i.test(contentType);
|
|
351
|
+
|
|
352
|
+
/**
|
|
353
|
+
* The HTTP request for an operation input. Resolves credentials, fills the
|
|
354
|
+
* default region / zone, picks the host and sets the auth headers; a `...Raw`
|
|
355
|
+
* download also asks for the file itself with `dl=1`.
|
|
356
|
+
*/
|
|
357
|
+
export const encodeRequest = (
|
|
358
|
+
input: unknown,
|
|
359
|
+
inputAst: AST.AST,
|
|
360
|
+
extraHeaders: Record<string, string> = {},
|
|
361
|
+
): Effect.Effect<HttpClientRequest.HttpClientRequest, InvalidInput | SdkError, Credentials> =>
|
|
362
|
+
Effect.gen(function* () {
|
|
363
|
+
const resolve = yield* Credentials;
|
|
364
|
+
const creds = yield* resolve;
|
|
365
|
+
const http = httpTraitOf(inputAst);
|
|
366
|
+
if (http instanceof SdkError) return yield* http;
|
|
367
|
+
const secretKey = Redacted.value(creds.secretKey);
|
|
368
|
+
const request = yield* buildRequest({
|
|
369
|
+
input: withLocality(unwrapRedactedDeep(input), http.uri, creds),
|
|
370
|
+
inputAst,
|
|
371
|
+
baseUrl: baseUrlFor(creds, http),
|
|
372
|
+
headers: {
|
|
373
|
+
"X-Auth-Token": secretKey,
|
|
374
|
+
...(http.baseUrl === GENERATIVE_APIS_HOST ? { Authorization: `Bearer ${secretKey}` } : {}),
|
|
375
|
+
...extraHeaders,
|
|
376
|
+
},
|
|
377
|
+
});
|
|
378
|
+
return http.rawDownload === true
|
|
379
|
+
? HttpClientRequest.appendUrlParam(request, "dl", "1")
|
|
380
|
+
: request;
|
|
381
|
+
});
|
|
382
|
+
|
|
383
|
+
/**
|
|
384
|
+
* The typed error for a failed response: per-operation matchers (from
|
|
385
|
+
* patches), then Scaleway's `type` envelope, then the HTTP status, then
|
|
386
|
+
* {@link UnknownScalewayError}.
|
|
387
|
+
*/
|
|
388
|
+
export const failureFor = (
|
|
389
|
+
status: number,
|
|
390
|
+
text: string,
|
|
391
|
+
headers: Record<string, string | undefined>,
|
|
392
|
+
errorClasses: ReadonlyArray<DeclaredErrorClass> = [],
|
|
393
|
+
): DeclaredError | InternalServerError | UnknownScalewayError => {
|
|
394
|
+
let json: unknown;
|
|
395
|
+
let nonJson = false;
|
|
396
|
+
if (text.trim().length > 0) {
|
|
397
|
+
try {
|
|
398
|
+
json = JSON.parse(text);
|
|
399
|
+
} catch {
|
|
400
|
+
nonJson = true;
|
|
401
|
+
}
|
|
402
|
+
}
|
|
403
|
+
const body = nonJson ? text : json;
|
|
404
|
+
const message = failureMessage(json, status, text);
|
|
405
|
+
|
|
406
|
+
// 1. Per-operation typed error (matcher metadata from patches).
|
|
407
|
+
const typed = matchTypedError(errorClasses, status, [{ code: undefined, message }], {
|
|
408
|
+
body,
|
|
409
|
+
headers,
|
|
410
|
+
});
|
|
411
|
+
if (typed !== undefined) return typed;
|
|
412
|
+
|
|
413
|
+
// 2. Scaleway's `type` envelope.
|
|
414
|
+
const scw = nonJson
|
|
415
|
+
? undefined
|
|
416
|
+
: envelopeError(
|
|
417
|
+
(cls, props) => declaredError(errorClasses, cls, props),
|
|
418
|
+
json,
|
|
419
|
+
message,
|
|
420
|
+
headers,
|
|
421
|
+
status,
|
|
422
|
+
);
|
|
423
|
+
if (scw !== undefined) return scw;
|
|
424
|
+
|
|
425
|
+
// 3. The HTTP status: core's class for it, which the service declares.
|
|
426
|
+
const StatusErrorClass = declaredStatusClass(status, errorClasses);
|
|
427
|
+
if (StatusErrorClass) {
|
|
428
|
+
return new StatusErrorClass({ message, retryAfter: parseRetryAfterForStatus(status, headers) });
|
|
429
|
+
}
|
|
430
|
+
if (status >= 500) {
|
|
431
|
+
return new InternalServerError({
|
|
432
|
+
message,
|
|
433
|
+
retryAfter: parseRetryAfterForStatus(status, headers),
|
|
434
|
+
});
|
|
435
|
+
}
|
|
436
|
+
|
|
437
|
+
// 4. Fallback.
|
|
438
|
+
return new UnknownScalewayError({
|
|
439
|
+
code: isObject(json) ? str(json.type) : undefined,
|
|
440
|
+
message,
|
|
441
|
+
body,
|
|
442
|
+
});
|
|
443
|
+
};
|
|
444
|
+
|
|
445
|
+
const scalewayProtocolMethods = {
|
|
446
|
+
encode: ({ input, inputAst }: EncodeArgs) => encodeRequest(input, inputAst),
|
|
447
|
+
decode: ({ response, outputAst, errors: errorClasses }: DecodeArgs) =>
|
|
448
|
+
Effect.gen(function* () {
|
|
449
|
+
const status = response.status;
|
|
450
|
+
const headers = response.headers as Record<string, string | undefined>;
|
|
451
|
+
|
|
452
|
+
// `...Raw` downloads: the body is the file.
|
|
453
|
+
const binary =
|
|
454
|
+
status >= 200 && status < 300 ? readBinaryResponse(response, outputAst) : undefined;
|
|
455
|
+
if (binary !== undefined) return yield* binary;
|
|
456
|
+
|
|
457
|
+
const text = (yield* response.text) ?? "";
|
|
458
|
+
if (status >= 400) {
|
|
459
|
+
return yield* Effect.fail(failureFor(status, text, headers, errorClasses));
|
|
460
|
+
}
|
|
461
|
+
|
|
462
|
+
// A success body is JSON only when it says so (user data is
|
|
463
|
+
// `text/plain`).
|
|
464
|
+
let json: unknown;
|
|
465
|
+
let nonJson = false;
|
|
466
|
+
if (text.trim().length > 0) {
|
|
467
|
+
if (isJsonContentType(headers["content-type"])) {
|
|
468
|
+
try {
|
|
469
|
+
json = JSON.parse(text);
|
|
470
|
+
} catch {
|
|
471
|
+
nonJson = true;
|
|
472
|
+
}
|
|
473
|
+
} else {
|
|
474
|
+
nonJson = true;
|
|
475
|
+
}
|
|
476
|
+
}
|
|
477
|
+
|
|
478
|
+
let body: unknown = nonJson ? text : stripNulls(json ?? {});
|
|
479
|
+
const totalCount = headers["x-total-count"];
|
|
480
|
+
if (isObject(body) && !("total_count" in body) && totalCount !== undefined) {
|
|
481
|
+
const n = Math.trunc(Number(totalCount));
|
|
482
|
+
if (!Number.isNaN(n)) body = { ...body, total_count: n };
|
|
483
|
+
}
|
|
484
|
+
|
|
485
|
+
// Strict mode checks the mapped body against the output schema, and
|
|
486
|
+
// parse errors withhold a body that can hold a secret (core
|
|
487
|
+
// `validateSuccess`).
|
|
488
|
+
return yield* validateSuccess(
|
|
489
|
+
outputAst,
|
|
490
|
+
{ value: mapKeys(outputAst, body, "decode"), body: nonJson ? text : json, nonJson },
|
|
491
|
+
(info) => new ScalewayParseError(info),
|
|
492
|
+
);
|
|
493
|
+
}),
|
|
494
|
+
} satisfies Protocol<unknown, unknown>;
|
|
495
|
+
|
|
496
|
+
export const ScalewayProtocol: ProtocolOf<typeof scalewayProtocolMethods> = scalewayProtocolMethods;
|
package/src/retry.ts
ADDED
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
import { type Policy, throttlingFactory, transientFactory } from "@distilled.cloud/core/retry";
|
|
2
|
+
/**
|
|
3
|
+
* Scaleway retry configuration.
|
|
4
|
+
*
|
|
5
|
+
* Defines the per-SDK `Retry` Context.Service tag that generated operations
|
|
6
|
+
* wire into `API.make`. Callers can install a blanket retry policy at the
|
|
7
|
+
* layer level and have every Scaleway API call below it pick it up:
|
|
8
|
+
*
|
|
9
|
+
* @example
|
|
10
|
+
* ```ts
|
|
11
|
+
* import * as Scaleway from "@distilled.cloud/scaleway";
|
|
12
|
+
*
|
|
13
|
+
* myEffect.pipe(Scaleway.Retry.transient);
|
|
14
|
+
* ```
|
|
15
|
+
*/
|
|
16
|
+
import * as Context from "effect/Context";
|
|
17
|
+
import * as Effect from "effect/Effect";
|
|
18
|
+
import * as Layer from "effect/Layer";
|
|
19
|
+
|
|
20
|
+
export {
|
|
21
|
+
type Options,
|
|
22
|
+
type Factory,
|
|
23
|
+
type Policy,
|
|
24
|
+
makeDefault,
|
|
25
|
+
jittered,
|
|
26
|
+
capped,
|
|
27
|
+
throttlingOptions,
|
|
28
|
+
transientOptions,
|
|
29
|
+
throttlingFactory,
|
|
30
|
+
transientFactory,
|
|
31
|
+
} from "@distilled.cloud/core/retry";
|
|
32
|
+
|
|
33
|
+
/** Context tag for configuring retry behavior of Scaleway API calls. */
|
|
34
|
+
export class Retry extends Context.Service<Retry, Policy>()("ScalewayRetry") {}
|
|
35
|
+
|
|
36
|
+
/** Provides a custom retry policy to every Scaleway API call below it. */
|
|
37
|
+
export const policy = (optionsOrFactory: Policy) =>
|
|
38
|
+
Effect.provide(Layer.succeed(Retry, optionsOrFactory));
|
|
39
|
+
|
|
40
|
+
/** Disables all automatic retries. */
|
|
41
|
+
export const none = Effect.provide(Layer.succeed(Retry, { while: () => false }));
|
|
42
|
+
|
|
43
|
+
/** Apply the throttling retry policy (retries throttling errors indefinitely). */
|
|
44
|
+
export const throttling = policy(throttlingFactory);
|
|
45
|
+
|
|
46
|
+
/** Apply the transient retry policy (retries all transient errors indefinitely). */
|
|
47
|
+
export const transient = policy(transientFactory);
|