diff --git a/.release-please-manifest.json b/.release-please-manifest.json index 0a40b9d7..ea2682c3 100644 --- a/.release-please-manifest.json +++ b/.release-please-manifest.json @@ -1,3 +1,3 @@ { - ".": "0.40.0" + ".": "0.41.0" } \ No newline at end of file diff --git a/.stats.yml b/.stats.yml index c2eb9ed1..0b6c3449 100644 --- a/.stats.yml +++ b/.stats.yml @@ -1,4 +1,4 @@ configured_endpoints: 658 -openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/gcore%2Fgcore-979c8dcf6f85145ede67f446fa50785ed5847281a8dc67b5b85dc146bf2782a3.yml -openapi_spec_hash: c5ae6893846eda4838239c4711465c7e -config_hash: adcd166301758ddd61a653444255d48c +openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/gcore%2Fgcore-e7708c017357421a39e6de2f7141415c93951bbc835742909b0d9d6f0825a318.yml +openapi_spec_hash: 2abb653b57137b808c182cb1e778a429 +config_hash: ab6b5443d52ca04e4e0e12def131f8e6 diff --git a/CHANGELOG.md b/CHANGELOG.md index c40af1a8..cc98f8e3 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,28 @@ # Changelog +## 0.41.0 (2026-04-03) + +Full Changelog: [v0.40.0...v0.41.0](https://github.com/G-Core/gcore-python/compare/v0.40.0...v0.41.0) + +### Features + +* **api:** aggregated API specs update ([0a6812c](https://github.com/G-Core/gcore-python/commit/0a6812cd7efd5906a2e93c5e5fdf9daa3818a957)) +* **api:** aggregated API specs update ([6cee9d3](https://github.com/G-Core/gcore-python/commit/6cee9d3e8554f0417a635be879e7e316440b3b8f)) +* **api:** aggregated API specs update ([d40d2c7](https://github.com/G-Core/gcore-python/commit/d40d2c7b9713e6efd8b006134eaa51cf5f457d81)) +* **api:** aggregated API specs update ([7c3f529](https://github.com/G-Core/gcore-python/commit/7c3f5294def02deee6f7f0dfef7292873ae9b5a1)) +* **cloud:** add support for Baremetal servers in Terraform ([33f5cc2](https://github.com/G-Core/gcore-python/commit/33f5cc29ad63e5d9b0d6ab7c12a85059ffc1d985)) + + +### Bug Fixes + +* **iam:** inject default limit on users list to ensure paginated response ([6b2bf6a](https://github.com/G-Core/gcore-python/commit/6b2bf6ace50dd041db352ee575ccfae496e6d92e)) + + +### Chores + +* **tests:** bump steady to v0.20.1 ([5b0b1de](https://github.com/G-Core/gcore-python/commit/5b0b1de4864f44973f6c48ba38f35a84b3a8e37b)) +* **tests:** bump steady to v0.20.2 ([7f62464](https://github.com/G-Core/gcore-python/commit/7f62464cbf6c388fbb56d0f038353c1c976614a2)) + ## 0.40.0 (2026-03-30) Full Changelog: [v0.39.0...v0.40.0](https://github.com/G-Core/gcore-python/compare/v0.39.0...v0.40.0) diff --git a/pyproject.toml b/pyproject.toml index e1f6e294..5f2b6b35 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,6 +1,6 @@ [project] name = "gcore" -version = "0.40.0" +version = "0.41.0" description = "The official Python library for the gcore API" dynamic = ["readme"] license = "Apache-2.0" diff --git a/scripts/mock b/scripts/mock index e730c7fc..439a2c67 100755 --- a/scripts/mock +++ b/scripts/mock @@ -22,9 +22,9 @@ echo "==> Starting mock server with URL ${URL}" # Run steady mock on the given spec if [ "$1" == "--daemon" ]; then # Pre-install the package so the download doesn't eat into the startup timeout - npm exec --package=@stdy/cli@0.19.7 -- steady --version + npm exec --package=@stdy/cli@0.20.2 -- steady --version - npm exec --package=@stdy/cli@0.19.7 -- steady --host 127.0.0.1 -p 4010 --validator-query-array-format=repeat --validator-form-array-format=repeat --validator-query-object-format=dots --validator-form-object-format=dots "$URL" &> .stdy.log & + npm exec --package=@stdy/cli@0.20.2 -- steady --host 127.0.0.1 -p 4010 --validator-query-array-format=repeat --validator-form-array-format=repeat --validator-query-object-format=dots --validator-form-object-format=dots "$URL" &> .stdy.log & # Wait for server to come online via health endpoint (max 30s) echo -n "Waiting for server" @@ -48,5 +48,5 @@ if [ "$1" == "--daemon" ]; then echo else - npm exec --package=@stdy/cli@0.19.7 -- steady --host 127.0.0.1 -p 4010 --validator-query-array-format=repeat --validator-form-array-format=repeat --validator-query-object-format=dots --validator-form-object-format=dots "$URL" + npm exec --package=@stdy/cli@0.20.2 -- steady --host 127.0.0.1 -p 4010 --validator-query-array-format=repeat --validator-form-array-format=repeat --validator-query-object-format=dots --validator-form-object-format=dots "$URL" fi diff --git a/scripts/test b/scripts/test index 46c5eb8d..f0d896d8 100755 --- a/scripts/test +++ b/scripts/test @@ -43,7 +43,7 @@ elif ! steady_is_running ; then echo -e "To run the server, pass in the path or url of your OpenAPI" echo -e "spec to the steady command:" echo - echo -e " \$ ${YELLOW}npm exec --package=@stdy/cli@0.19.7 -- steady path/to/your.openapi.yml --host 127.0.0.1 -p 4010 --validator-query-array-format=repeat --validator-form-array-format=repeat --validator-query-object-format=dots --validator-form-object-format=dots${NC}" + echo -e " \$ ${YELLOW}npm exec --package=@stdy/cli@0.20.2 -- steady path/to/your.openapi.yml --host 127.0.0.1 -p 4010 --validator-query-array-format=repeat --validator-form-array-format=repeat --validator-query-object-format=dots --validator-form-object-format=dots${NC}" echo exit 1 diff --git a/src/gcore/_version.py b/src/gcore/_version.py index 9c0d445a..139c4ad2 100644 --- a/src/gcore/_version.py +++ b/src/gcore/_version.py @@ -1,4 +1,4 @@ # File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. __title__ = "gcore" -__version__ = "0.40.0" # x-release-please-version +__version__ = "0.41.0" # x-release-please-version diff --git a/src/gcore/resources/cdn/api.md b/src/gcore/resources/cdn/api.md index 0c122395..70a85773 100644 --- a/src/gcore/resources/cdn/api.md +++ b/src/gcore/resources/cdn/api.md @@ -19,8 +19,8 @@ Methods: - client.cdn.get_account_limits() -> CDNAccountLimits - client.cdn.get_account_overview() -> CDNAccount - client.cdn.get_available_features() -> CDNAvailableFeatures -- client.cdn.list_alibaba_regions() -> AlibabaRegions -- client.cdn.list_aws_regions() -> AwsRegions +- client.cdn.list_alibaba_regions(\*\*params) -> AlibabaRegions +- client.cdn.list_aws_regions(\*\*params) -> AwsRegions - client.cdn.list_purge_statuses(\*\*params) -> CDNListPurgeStatusesResponse - client.cdn.update_account(\*\*params) -> CDNAccount @@ -69,7 +69,7 @@ Methods: - client.cdn.cdn_resources.rules.create(resource_id, \*\*params) -> CDNResourceRule - client.cdn.cdn_resources.rules.update(rule_id, \*, resource_id, \*\*params) -> CDNResourceRule -- client.cdn.cdn_resources.rules.list(resource_id) -> CDNResourceRuleList +- client.cdn.cdn_resources.rules.list(resource_id, \*\*params) -> SyncOffsetPage[CDNResourceRule] - client.cdn.cdn_resources.rules.delete(rule_id, \*, resource_id) -> None - client.cdn.cdn_resources.rules.get(rule_id, \*, resource_id) -> CDNResourceRule - client.cdn.cdn_resources.rules.replace(rule_id, \*, resource_id, \*\*params) -> CDNResourceRule @@ -84,7 +84,7 @@ from gcore.types.cdn import ShieldListResponse Methods: -- client.cdn.shields.list() -> ShieldListResponse +- client.cdn.shields.list(\*\*params) -> SyncOffsetPage[ShieldListResponse] ## OriginGroups @@ -115,7 +115,7 @@ Methods: - client.cdn.rule_templates.create(\*\*params) -> RuleTemplate - client.cdn.rule_templates.update(rule_template_id, \*\*params) -> RuleTemplate -- client.cdn.rule_templates.list() -> RuleTemplateList +- client.cdn.rule_templates.list(\*\*params) -> SyncOffsetPage[RuleTemplate] - client.cdn.rule_templates.delete(rule_template_id) -> None - client.cdn.rule_templates.get(rule_template_id) -> RuleTemplate - client.cdn.rule_templates.replace(rule_template_id, \*\*params) -> RuleTemplate diff --git a/src/gcore/resources/cdn/cdn.py b/src/gcore/resources/cdn/cdn.py index 7b80bde4..0419323c 100644 --- a/src/gcore/resources/cdn/cdn.py +++ b/src/gcore/resources/cdn/cdn.py @@ -2,6 +2,8 @@ from __future__ import annotations +from typing import Any, cast + import httpx from .ips import ( @@ -70,7 +72,12 @@ async_to_raw_response_wrapper, async_to_streamed_response_wrapper, ) -from ...types.cdn import cdn_update_account_params, cdn_list_purge_statuses_params +from ...types.cdn import ( + cdn_update_account_params, + cdn_list_aws_regions_params, + cdn_list_purge_statuses_params, + cdn_list_alibaba_regions_params, +) from .certificates import ( CertificatesResource, AsyncCertificatesResource, @@ -314,6 +321,8 @@ def get_available_features( def list_alibaba_regions( self, *, + limit: int | Omit = omit, + offset: int | Omit = omit, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. # The extra values given here take precedence over values defined on the client or passed to this method. extra_headers: Headers | None = None, @@ -321,18 +330,48 @@ def list_alibaba_regions( extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> AlibabaRegions: - """Get the list of Alibaba Cloud regions.""" - return self._get( - "/cdn/alibaba_regions", - options=make_request_options( - extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout + """ + Get the list of Alibaba Cloud regions. + + Args: + limit: Maximum number of items to return in the response. Cannot exceed 1000. + + offset: Number of items to skip from the beginning of the list. + + extra_headers: Send extra headers + + extra_query: Add additional query parameters to the request + + extra_body: Add additional JSON properties to the request + + timeout: Override the client-level default timeout for this request, in seconds + """ + return cast( + AlibabaRegions, + self._get( + "/cdn/alibaba_regions", + options=make_request_options( + extra_headers=extra_headers, + extra_query=extra_query, + extra_body=extra_body, + timeout=timeout, + query=maybe_transform( + { + "limit": limit, + "offset": offset, + }, + cdn_list_alibaba_regions_params.CDNListAlibabaRegionsParams, + ), + ), + cast_to=cast(Any, AlibabaRegions), # Union types cannot be passed in as arguments in the type system ), - cast_to=AlibabaRegions, ) def list_aws_regions( self, *, + limit: int | Omit = omit, + offset: int | Omit = omit, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. # The extra values given here take precedence over values defined on the client or passed to this method. extra_headers: Headers | None = None, @@ -340,13 +379,41 @@ def list_aws_regions( extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> AwsRegions: - """Get the list of Amazon AWS regions.""" - return self._get( - "/cdn/aws_regions", - options=make_request_options( - extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout + """ + Get the list of Amazon AWS regions. + + Args: + limit: Maximum number of items to return in the response. Cannot exceed 1000. + + offset: Number of items to skip from the beginning of the list. + + extra_headers: Send extra headers + + extra_query: Add additional query parameters to the request + + extra_body: Add additional JSON properties to the request + + timeout: Override the client-level default timeout for this request, in seconds + """ + return cast( + AwsRegions, + self._get( + "/cdn/aws_regions", + options=make_request_options( + extra_headers=extra_headers, + extra_query=extra_query, + extra_body=extra_body, + timeout=timeout, + query=maybe_transform( + { + "limit": limit, + "offset": offset, + }, + cdn_list_aws_regions_params.CDNListAwsRegionsParams, + ), + ), + cast_to=cast(Any, AwsRegions), # Union types cannot be passed in as arguments in the type system ), - cast_to=AwsRegions, ) def list_purge_statuses( @@ -421,27 +488,32 @@ def list_purge_statuses( timeout: Override the client-level default timeout for this request, in seconds """ - return self._get( - "/cdn/purge_statuses", - options=make_request_options( - extra_headers=extra_headers, - extra_query=extra_query, - extra_body=extra_body, - timeout=timeout, - query=maybe_transform( - { - "cname": cname, - "from_created": from_created, - "limit": limit, - "offset": offset, - "purge_type": purge_type, - "status": status, - "to_created": to_created, - }, - cdn_list_purge_statuses_params.CDNListPurgeStatusesParams, + return cast( + CDNListPurgeStatusesResponse, + self._get( + "/cdn/purge_statuses", + options=make_request_options( + extra_headers=extra_headers, + extra_query=extra_query, + extra_body=extra_body, + timeout=timeout, + query=maybe_transform( + { + "cname": cname, + "from_created": from_created, + "limit": limit, + "offset": offset, + "purge_type": purge_type, + "status": status, + "to_created": to_created, + }, + cdn_list_purge_statuses_params.CDNListPurgeStatusesParams, + ), ), + cast_to=cast( + Any, CDNListPurgeStatusesResponse + ), # Union types cannot be passed in as arguments in the type system ), - cast_to=CDNListPurgeStatusesResponse, ) def update_account( @@ -659,6 +731,8 @@ async def get_available_features( async def list_alibaba_regions( self, *, + limit: int | Omit = omit, + offset: int | Omit = omit, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. # The extra values given here take precedence over values defined on the client or passed to this method. extra_headers: Headers | None = None, @@ -666,18 +740,48 @@ async def list_alibaba_regions( extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> AlibabaRegions: - """Get the list of Alibaba Cloud regions.""" - return await self._get( - "/cdn/alibaba_regions", - options=make_request_options( - extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout + """ + Get the list of Alibaba Cloud regions. + + Args: + limit: Maximum number of items to return in the response. Cannot exceed 1000. + + offset: Number of items to skip from the beginning of the list. + + extra_headers: Send extra headers + + extra_query: Add additional query parameters to the request + + extra_body: Add additional JSON properties to the request + + timeout: Override the client-level default timeout for this request, in seconds + """ + return cast( + AlibabaRegions, + await self._get( + "/cdn/alibaba_regions", + options=make_request_options( + extra_headers=extra_headers, + extra_query=extra_query, + extra_body=extra_body, + timeout=timeout, + query=await async_maybe_transform( + { + "limit": limit, + "offset": offset, + }, + cdn_list_alibaba_regions_params.CDNListAlibabaRegionsParams, + ), + ), + cast_to=cast(Any, AlibabaRegions), # Union types cannot be passed in as arguments in the type system ), - cast_to=AlibabaRegions, ) async def list_aws_regions( self, *, + limit: int | Omit = omit, + offset: int | Omit = omit, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. # The extra values given here take precedence over values defined on the client or passed to this method. extra_headers: Headers | None = None, @@ -685,13 +789,41 @@ async def list_aws_regions( extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> AwsRegions: - """Get the list of Amazon AWS regions.""" - return await self._get( - "/cdn/aws_regions", - options=make_request_options( - extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout + """ + Get the list of Amazon AWS regions. + + Args: + limit: Maximum number of items to return in the response. Cannot exceed 1000. + + offset: Number of items to skip from the beginning of the list. + + extra_headers: Send extra headers + + extra_query: Add additional query parameters to the request + + extra_body: Add additional JSON properties to the request + + timeout: Override the client-level default timeout for this request, in seconds + """ + return cast( + AwsRegions, + await self._get( + "/cdn/aws_regions", + options=make_request_options( + extra_headers=extra_headers, + extra_query=extra_query, + extra_body=extra_body, + timeout=timeout, + query=await async_maybe_transform( + { + "limit": limit, + "offset": offset, + }, + cdn_list_aws_regions_params.CDNListAwsRegionsParams, + ), + ), + cast_to=cast(Any, AwsRegions), # Union types cannot be passed in as arguments in the type system ), - cast_to=AwsRegions, ) async def list_purge_statuses( @@ -766,27 +898,32 @@ async def list_purge_statuses( timeout: Override the client-level default timeout for this request, in seconds """ - return await self._get( - "/cdn/purge_statuses", - options=make_request_options( - extra_headers=extra_headers, - extra_query=extra_query, - extra_body=extra_body, - timeout=timeout, - query=await async_maybe_transform( - { - "cname": cname, - "from_created": from_created, - "limit": limit, - "offset": offset, - "purge_type": purge_type, - "status": status, - "to_created": to_created, - }, - cdn_list_purge_statuses_params.CDNListPurgeStatusesParams, + return cast( + CDNListPurgeStatusesResponse, + await self._get( + "/cdn/purge_statuses", + options=make_request_options( + extra_headers=extra_headers, + extra_query=extra_query, + extra_body=extra_body, + timeout=timeout, + query=await async_maybe_transform( + { + "cname": cname, + "from_created": from_created, + "limit": limit, + "offset": offset, + "purge_type": purge_type, + "status": status, + "to_created": to_created, + }, + cdn_list_purge_statuses_params.CDNListPurgeStatusesParams, + ), ), + cast_to=cast( + Any, CDNListPurgeStatusesResponse + ), # Union types cannot be passed in as arguments in the type system ), - cast_to=CDNListPurgeStatusesResponse, ) async def update_account( diff --git a/src/gcore/resources/cdn/cdn_resources/cdn_resources.py b/src/gcore/resources/cdn/cdn_resources/cdn_resources.py index 1661b305..958ba110 100644 --- a/src/gcore/resources/cdn/cdn_resources/cdn_resources.py +++ b/src/gcore/resources/cdn/cdn_resources/cdn_resources.py @@ -2,7 +2,7 @@ from __future__ import annotations -from typing import Optional +from typing import Any, Optional, cast from typing_extensions import Literal, overload import httpx @@ -360,8 +360,10 @@ def list( cname: str | Omit = omit, deleted: bool | Omit = omit, enabled: bool | Omit = omit, + limit: int | Omit = omit, max_created: str | Omit = omit, min_created: str | Omit = omit, + offset: int | Omit = omit, origin_group: int | Omit = omit, rules: str | Omit = omit, secondary_hostnames: str | Omit = omit, @@ -400,12 +402,16 @@ def list( - **true** - CDN resource is enabled. - **false** - CDN resource is disabled. + limit: Maximum number of items to return in the response. Cannot exceed 1000. + max_created: Most recent date of CDN resource creation for which CDN resources should be returned (ISO 8601/RFC 3339 format, UTC.) min_created: Earliest date of CDN resource creation for which CDN resources should be returned (ISO 8601/RFC 3339 format, UTC.) + offset: Number of items to skip from the beginning of the list. + origin_group: Origin group ID. rules: Rule name or pattern. @@ -461,36 +467,41 @@ def list( timeout: Override the client-level default timeout for this request, in seconds """ - return self._get( - "/cdn/resources", - options=make_request_options( - extra_headers=extra_headers, - extra_query=extra_query, - extra_body=extra_body, - timeout=timeout, - query=maybe_transform( - { - "cname": cname, - "deleted": deleted, - "enabled": enabled, - "max_created": max_created, - "min_created": min_created, - "origin_group": origin_group, - "rules": rules, - "secondary_hostnames": secondary_hostnames, - "shield_dc": shield_dc, - "shielded": shielded, - "ssl_data": ssl_data, - "ssl_data_in": ssl_data_in, - "ssl_enabled": ssl_enabled, - "status": status, - "suspend": suspend, - "vp_enabled": vp_enabled, - }, - cdn_resource_list_params.CDNResourceListParams, + return cast( + CDNResourceList, + self._get( + "/cdn/resources", + options=make_request_options( + extra_headers=extra_headers, + extra_query=extra_query, + extra_body=extra_body, + timeout=timeout, + query=maybe_transform( + { + "cname": cname, + "deleted": deleted, + "enabled": enabled, + "limit": limit, + "max_created": max_created, + "min_created": min_created, + "offset": offset, + "origin_group": origin_group, + "rules": rules, + "secondary_hostnames": secondary_hostnames, + "shield_dc": shield_dc, + "shielded": shielded, + "ssl_data": ssl_data, + "ssl_data_in": ssl_data_in, + "ssl_enabled": ssl_enabled, + "status": status, + "suspend": suspend, + "vp_enabled": vp_enabled, + }, + cdn_resource_list_params.CDNResourceListParams, + ), ), + cast_to=cast(Any, CDNResourceList), # Union types cannot be passed in as arguments in the type system ), - cast_to=CDNResourceList, ) def delete( @@ -1271,8 +1282,10 @@ async def list( cname: str | Omit = omit, deleted: bool | Omit = omit, enabled: bool | Omit = omit, + limit: int | Omit = omit, max_created: str | Omit = omit, min_created: str | Omit = omit, + offset: int | Omit = omit, origin_group: int | Omit = omit, rules: str | Omit = omit, secondary_hostnames: str | Omit = omit, @@ -1311,12 +1324,16 @@ async def list( - **true** - CDN resource is enabled. - **false** - CDN resource is disabled. + limit: Maximum number of items to return in the response. Cannot exceed 1000. + max_created: Most recent date of CDN resource creation for which CDN resources should be returned (ISO 8601/RFC 3339 format, UTC.) min_created: Earliest date of CDN resource creation for which CDN resources should be returned (ISO 8601/RFC 3339 format, UTC.) + offset: Number of items to skip from the beginning of the list. + origin_group: Origin group ID. rules: Rule name or pattern. @@ -1372,36 +1389,41 @@ async def list( timeout: Override the client-level default timeout for this request, in seconds """ - return await self._get( - "/cdn/resources", - options=make_request_options( - extra_headers=extra_headers, - extra_query=extra_query, - extra_body=extra_body, - timeout=timeout, - query=await async_maybe_transform( - { - "cname": cname, - "deleted": deleted, - "enabled": enabled, - "max_created": max_created, - "min_created": min_created, - "origin_group": origin_group, - "rules": rules, - "secondary_hostnames": secondary_hostnames, - "shield_dc": shield_dc, - "shielded": shielded, - "ssl_data": ssl_data, - "ssl_data_in": ssl_data_in, - "ssl_enabled": ssl_enabled, - "status": status, - "suspend": suspend, - "vp_enabled": vp_enabled, - }, - cdn_resource_list_params.CDNResourceListParams, + return cast( + CDNResourceList, + await self._get( + "/cdn/resources", + options=make_request_options( + extra_headers=extra_headers, + extra_query=extra_query, + extra_body=extra_body, + timeout=timeout, + query=await async_maybe_transform( + { + "cname": cname, + "deleted": deleted, + "enabled": enabled, + "limit": limit, + "max_created": max_created, + "min_created": min_created, + "offset": offset, + "origin_group": origin_group, + "rules": rules, + "secondary_hostnames": secondary_hostnames, + "shield_dc": shield_dc, + "shielded": shielded, + "ssl_data": ssl_data, + "ssl_data_in": ssl_data_in, + "ssl_enabled": ssl_enabled, + "status": status, + "suspend": suspend, + "vp_enabled": vp_enabled, + }, + cdn_resource_list_params.CDNResourceListParams, + ), ), + cast_to=cast(Any, CDNResourceList), # Union types cannot be passed in as arguments in the type system ), - cast_to=CDNResourceList, ) async def delete( diff --git a/src/gcore/resources/cdn/cdn_resources/rules.py b/src/gcore/resources/cdn/cdn_resources/rules.py index 63e9f8ea..2fabd405 100644 --- a/src/gcore/resources/cdn/cdn_resources/rules.py +++ b/src/gcore/resources/cdn/cdn_resources/rules.py @@ -17,10 +17,10 @@ async_to_raw_response_wrapper, async_to_streamed_response_wrapper, ) -from ...._base_client import make_request_options -from ....types.cdn.cdn_resources import rule_create_params, rule_update_params, rule_replace_params +from ....pagination import SyncOffsetPage, AsyncOffsetPage +from ...._base_client import AsyncPaginator, make_request_options +from ....types.cdn.cdn_resources import rule_list_params, rule_create_params, rule_update_params, rule_replace_params from ....types.cdn.cdn_resources.cdn_resource_rule import CDNResourceRule -from ....types.cdn.cdn_resources.cdn_resource_rule_list import CDNResourceRuleList __all__ = ["RulesResource", "AsyncRulesResource"] @@ -264,17 +264,24 @@ def list( self, resource_id: int, *, + limit: int | Omit = omit, + offset: int | Omit = omit, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. # The extra values given here take precedence over values defined on the client or passed to this method. extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = not_given, - ) -> CDNResourceRuleList: - """ - Get rules list + ) -> SyncOffsetPage[CDNResourceRule]: + """Get rules list Args: + limit: Maximum number of items to return in the response. + + Cannot exceed 1000. + + offset: Number of items to skip from the beginning of the list. + extra_headers: Send extra headers extra_query: Add additional query parameters to the request @@ -283,12 +290,23 @@ def list( timeout: Override the client-level default timeout for this request, in seconds """ - return self._get( + return self._get_api_list( path_template("/cdn/resources/{resource_id}/rules", resource_id=resource_id), + page=SyncOffsetPage[CDNResourceRule], options=make_request_options( - extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout + extra_headers=extra_headers, + extra_query=extra_query, + extra_body=extra_body, + timeout=timeout, + query=maybe_transform( + { + "limit": limit, + "offset": offset, + }, + rule_list_params.RuleListParams, + ), ), - cast_to=CDNResourceRuleList, + model=CDNResourceRule, ) def delete( @@ -705,21 +723,28 @@ async def update( cast_to=CDNResourceRule, ) - async def list( + def list( self, resource_id: int, *, + limit: int | Omit = omit, + offset: int | Omit = omit, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. # The extra values given here take precedence over values defined on the client or passed to this method. extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = not_given, - ) -> CDNResourceRuleList: - """ - Get rules list + ) -> AsyncPaginator[CDNResourceRule, AsyncOffsetPage[CDNResourceRule]]: + """Get rules list Args: + limit: Maximum number of items to return in the response. + + Cannot exceed 1000. + + offset: Number of items to skip from the beginning of the list. + extra_headers: Send extra headers extra_query: Add additional query parameters to the request @@ -728,12 +753,23 @@ async def list( timeout: Override the client-level default timeout for this request, in seconds """ - return await self._get( + return self._get_api_list( path_template("/cdn/resources/{resource_id}/rules", resource_id=resource_id), + page=AsyncOffsetPage[CDNResourceRule], options=make_request_options( - extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout + extra_headers=extra_headers, + extra_query=extra_query, + extra_body=extra_body, + timeout=timeout, + query=maybe_transform( + { + "limit": limit, + "offset": offset, + }, + rule_list_params.RuleListParams, + ), ), - cast_to=CDNResourceRuleList, + model=CDNResourceRule, ) async def delete( diff --git a/src/gcore/resources/cdn/certificates.py b/src/gcore/resources/cdn/certificates.py index 0e35bcac..a145c8c5 100644 --- a/src/gcore/resources/cdn/certificates.py +++ b/src/gcore/resources/cdn/certificates.py @@ -2,6 +2,7 @@ from __future__ import annotations +from typing import Any, cast from typing_extensions import overload import httpx @@ -189,6 +190,8 @@ def list( self, *, automated: bool | Omit = omit, + limit: int | Omit = omit, + offset: int | Omit = omit, resource_id: int | Omit = omit, validity_not_after_lte: str | Omit = omit, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. @@ -209,6 +212,10 @@ def list( - **true** – Certificate was issued automatically. - **false** – Certificate was added by a user. + limit: Maximum number of items to return in the response. Cannot exceed 1000. + + offset: Number of items to skip from the beginning of the list. + resource_id: CDN resource ID for which certificates are requested. validity_not_after_lte: Date and time when the certificate become untrusted (ISO 8601/RFC 3339 format, @@ -224,23 +231,28 @@ def list( timeout: Override the client-level default timeout for this request, in seconds """ - return self._get( - "/cdn/sslData", - options=make_request_options( - extra_headers=extra_headers, - extra_query=extra_query, - extra_body=extra_body, - timeout=timeout, - query=maybe_transform( - { - "automated": automated, - "resource_id": resource_id, - "validity_not_after_lte": validity_not_after_lte, - }, - certificate_list_params.CertificateListParams, + return cast( + SslDetailList, + self._get( + "/cdn/sslData", + options=make_request_options( + extra_headers=extra_headers, + extra_query=extra_query, + extra_body=extra_body, + timeout=timeout, + query=maybe_transform( + { + "automated": automated, + "limit": limit, + "offset": offset, + "resource_id": resource_id, + "validity_not_after_lte": validity_not_after_lte, + }, + certificate_list_params.CertificateListParams, + ), ), + cast_to=cast(Any, SslDetailList), # Union types cannot be passed in as arguments in the type system ), - cast_to=SslDetailList, ) def delete( @@ -636,6 +648,8 @@ async def list( self, *, automated: bool | Omit = omit, + limit: int | Omit = omit, + offset: int | Omit = omit, resource_id: int | Omit = omit, validity_not_after_lte: str | Omit = omit, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. @@ -656,6 +670,10 @@ async def list( - **true** – Certificate was issued automatically. - **false** – Certificate was added by a user. + limit: Maximum number of items to return in the response. Cannot exceed 1000. + + offset: Number of items to skip from the beginning of the list. + resource_id: CDN resource ID for which certificates are requested. validity_not_after_lte: Date and time when the certificate become untrusted (ISO 8601/RFC 3339 format, @@ -671,23 +689,28 @@ async def list( timeout: Override the client-level default timeout for this request, in seconds """ - return await self._get( - "/cdn/sslData", - options=make_request_options( - extra_headers=extra_headers, - extra_query=extra_query, - extra_body=extra_body, - timeout=timeout, - query=await async_maybe_transform( - { - "automated": automated, - "resource_id": resource_id, - "validity_not_after_lte": validity_not_after_lte, - }, - certificate_list_params.CertificateListParams, + return cast( + SslDetailList, + await self._get( + "/cdn/sslData", + options=make_request_options( + extra_headers=extra_headers, + extra_query=extra_query, + extra_body=extra_body, + timeout=timeout, + query=await async_maybe_transform( + { + "automated": automated, + "limit": limit, + "offset": offset, + "resource_id": resource_id, + "validity_not_after_lte": validity_not_after_lte, + }, + certificate_list_params.CertificateListParams, + ), ), + cast_to=cast(Any, SslDetailList), # Union types cannot be passed in as arguments in the type system ), - cast_to=SslDetailList, ) async def delete( diff --git a/src/gcore/resources/cdn/logs_uploader/configs.py b/src/gcore/resources/cdn/logs_uploader/configs.py index 131d1ce7..a735d99e 100644 --- a/src/gcore/resources/cdn/logs_uploader/configs.py +++ b/src/gcore/resources/cdn/logs_uploader/configs.py @@ -2,7 +2,7 @@ from __future__ import annotations -from typing import Iterable +from typing import Any, Iterable, cast import httpx @@ -184,6 +184,8 @@ def update( def list( self, *, + limit: int | Omit = omit, + offset: int | Omit = omit, resource_ids: Iterable[int] | Omit = omit, search: str | Omit = omit, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. @@ -197,6 +199,10 @@ def list( Get list of logs uploader configs. Args: + limit: Maximum number of items to return in the response. Cannot exceed 1000. + + offset: Number of items to skip from the beginning of the list. + resource_ids: Filter by ids of CDN resources that are assigned to given config. search: Search by config name or id. @@ -209,22 +215,29 @@ def list( timeout: Override the client-level default timeout for this request, in seconds """ - return self._get( - "/cdn/logs_uploader/configs", - options=make_request_options( - extra_headers=extra_headers, - extra_query=extra_query, - extra_body=extra_body, - timeout=timeout, - query=maybe_transform( - { - "resource_ids": resource_ids, - "search": search, - }, - config_list_params.ConfigListParams, + return cast( + LogsUploaderConfigList, + self._get( + "/cdn/logs_uploader/configs", + options=make_request_options( + extra_headers=extra_headers, + extra_query=extra_query, + extra_body=extra_body, + timeout=timeout, + query=maybe_transform( + { + "limit": limit, + "offset": offset, + "resource_ids": resource_ids, + "search": search, + }, + config_list_params.ConfigListParams, + ), ), + cast_to=cast( + Any, LogsUploaderConfigList + ), # Union types cannot be passed in as arguments in the type system ), - cast_to=LogsUploaderConfigList, ) def delete( @@ -543,6 +556,8 @@ async def update( async def list( self, *, + limit: int | Omit = omit, + offset: int | Omit = omit, resource_ids: Iterable[int] | Omit = omit, search: str | Omit = omit, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. @@ -556,6 +571,10 @@ async def list( Get list of logs uploader configs. Args: + limit: Maximum number of items to return in the response. Cannot exceed 1000. + + offset: Number of items to skip from the beginning of the list. + resource_ids: Filter by ids of CDN resources that are assigned to given config. search: Search by config name or id. @@ -568,22 +587,29 @@ async def list( timeout: Override the client-level default timeout for this request, in seconds """ - return await self._get( - "/cdn/logs_uploader/configs", - options=make_request_options( - extra_headers=extra_headers, - extra_query=extra_query, - extra_body=extra_body, - timeout=timeout, - query=await async_maybe_transform( - { - "resource_ids": resource_ids, - "search": search, - }, - config_list_params.ConfigListParams, + return cast( + LogsUploaderConfigList, + await self._get( + "/cdn/logs_uploader/configs", + options=make_request_options( + extra_headers=extra_headers, + extra_query=extra_query, + extra_body=extra_body, + timeout=timeout, + query=await async_maybe_transform( + { + "limit": limit, + "offset": offset, + "resource_ids": resource_ids, + "search": search, + }, + config_list_params.ConfigListParams, + ), ), + cast_to=cast( + Any, LogsUploaderConfigList + ), # Union types cannot be passed in as arguments in the type system ), - cast_to=LogsUploaderConfigList, ) async def delete( diff --git a/src/gcore/resources/cdn/logs_uploader/policies.py b/src/gcore/resources/cdn/logs_uploader/policies.py index eabd7de8..3100a57b 100644 --- a/src/gcore/resources/cdn/logs_uploader/policies.py +++ b/src/gcore/resources/cdn/logs_uploader/policies.py @@ -2,7 +2,7 @@ from __future__ import annotations -from typing import Dict, Iterable, Optional +from typing import Any, Dict, Iterable, Optional, cast from typing_extensions import Literal import httpx @@ -316,6 +316,8 @@ def list( self, *, config_ids: Iterable[int] | Omit = omit, + limit: int | Omit = omit, + offset: int | Omit = omit, search: str | Omit = omit, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. # The extra values given here take precedence over values defined on the client or passed to this method. @@ -330,6 +332,10 @@ def list( Args: config_ids: Filter by ids of related logs uploader configs that use given policy. + limit: Maximum number of items to return in the response. Cannot exceed 1000. + + offset: Number of items to skip from the beginning of the list. + search: Search by policy name or id. extra_headers: Send extra headers @@ -340,22 +346,29 @@ def list( timeout: Override the client-level default timeout for this request, in seconds """ - return self._get( - "/cdn/logs_uploader/policies", - options=make_request_options( - extra_headers=extra_headers, - extra_query=extra_query, - extra_body=extra_body, - timeout=timeout, - query=maybe_transform( - { - "config_ids": config_ids, - "search": search, - }, - policy_list_params.PolicyListParams, + return cast( + LogsUploaderPolicyList, + self._get( + "/cdn/logs_uploader/policies", + options=make_request_options( + extra_headers=extra_headers, + extra_query=extra_query, + extra_body=extra_body, + timeout=timeout, + query=maybe_transform( + { + "config_ids": config_ids, + "limit": limit, + "offset": offset, + "search": search, + }, + policy_list_params.PolicyListParams, + ), ), + cast_to=cast( + Any, LogsUploaderPolicyList + ), # Union types cannot be passed in as arguments in the type system ), - cast_to=LogsUploaderPolicyList, ) def delete( @@ -858,6 +871,8 @@ async def list( self, *, config_ids: Iterable[int] | Omit = omit, + limit: int | Omit = omit, + offset: int | Omit = omit, search: str | Omit = omit, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. # The extra values given here take precedence over values defined on the client or passed to this method. @@ -872,6 +887,10 @@ async def list( Args: config_ids: Filter by ids of related logs uploader configs that use given policy. + limit: Maximum number of items to return in the response. Cannot exceed 1000. + + offset: Number of items to skip from the beginning of the list. + search: Search by policy name or id. extra_headers: Send extra headers @@ -882,22 +901,29 @@ async def list( timeout: Override the client-level default timeout for this request, in seconds """ - return await self._get( - "/cdn/logs_uploader/policies", - options=make_request_options( - extra_headers=extra_headers, - extra_query=extra_query, - extra_body=extra_body, - timeout=timeout, - query=await async_maybe_transform( - { - "config_ids": config_ids, - "search": search, - }, - policy_list_params.PolicyListParams, + return cast( + LogsUploaderPolicyList, + await self._get( + "/cdn/logs_uploader/policies", + options=make_request_options( + extra_headers=extra_headers, + extra_query=extra_query, + extra_body=extra_body, + timeout=timeout, + query=await async_maybe_transform( + { + "config_ids": config_ids, + "limit": limit, + "offset": offset, + "search": search, + }, + policy_list_params.PolicyListParams, + ), ), + cast_to=cast( + Any, LogsUploaderPolicyList + ), # Union types cannot be passed in as arguments in the type system ), - cast_to=LogsUploaderPolicyList, ) async def delete( diff --git a/src/gcore/resources/cdn/logs_uploader/targets.py b/src/gcore/resources/cdn/logs_uploader/targets.py index 5be0945e..7502ca34 100644 --- a/src/gcore/resources/cdn/logs_uploader/targets.py +++ b/src/gcore/resources/cdn/logs_uploader/targets.py @@ -2,7 +2,7 @@ from __future__ import annotations -from typing import Iterable +from typing import Any, Iterable, cast from typing_extensions import Literal import httpx @@ -171,6 +171,8 @@ def list( self, *, config_ids: Iterable[int] | Omit = omit, + limit: int | Omit = omit, + offset: int | Omit = omit, search: str | Omit = omit, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. # The extra values given here take precedence over values defined on the client or passed to this method. @@ -185,6 +187,10 @@ def list( Args: config_ids: Filter by ids of related logs uploader configs that use given target. + limit: Maximum number of items to return in the response. Cannot exceed 1000. + + offset: Number of items to skip from the beginning of the list. + search: Search by target name or id. extra_headers: Send extra headers @@ -195,22 +201,29 @@ def list( timeout: Override the client-level default timeout for this request, in seconds """ - return self._get( - "/cdn/logs_uploader/targets", - options=make_request_options( - extra_headers=extra_headers, - extra_query=extra_query, - extra_body=extra_body, - timeout=timeout, - query=maybe_transform( - { - "config_ids": config_ids, - "search": search, - }, - target_list_params.TargetListParams, + return cast( + LogsUploaderTargetList, + self._get( + "/cdn/logs_uploader/targets", + options=make_request_options( + extra_headers=extra_headers, + extra_query=extra_query, + extra_body=extra_body, + timeout=timeout, + query=maybe_transform( + { + "config_ids": config_ids, + "limit": limit, + "offset": offset, + "search": search, + }, + target_list_params.TargetListParams, + ), ), + cast_to=cast( + Any, LogsUploaderTargetList + ), # Union types cannot be passed in as arguments in the type system ), - cast_to=LogsUploaderTargetList, ) def delete( @@ -507,6 +520,8 @@ async def list( self, *, config_ids: Iterable[int] | Omit = omit, + limit: int | Omit = omit, + offset: int | Omit = omit, search: str | Omit = omit, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. # The extra values given here take precedence over values defined on the client or passed to this method. @@ -521,6 +536,10 @@ async def list( Args: config_ids: Filter by ids of related logs uploader configs that use given target. + limit: Maximum number of items to return in the response. Cannot exceed 1000. + + offset: Number of items to skip from the beginning of the list. + search: Search by target name or id. extra_headers: Send extra headers @@ -531,22 +550,29 @@ async def list( timeout: Override the client-level default timeout for this request, in seconds """ - return await self._get( - "/cdn/logs_uploader/targets", - options=make_request_options( - extra_headers=extra_headers, - extra_query=extra_query, - extra_body=extra_body, - timeout=timeout, - query=await async_maybe_transform( - { - "config_ids": config_ids, - "search": search, - }, - target_list_params.TargetListParams, + return cast( + LogsUploaderTargetList, + await self._get( + "/cdn/logs_uploader/targets", + options=make_request_options( + extra_headers=extra_headers, + extra_query=extra_query, + extra_body=extra_body, + timeout=timeout, + query=await async_maybe_transform( + { + "config_ids": config_ids, + "limit": limit, + "offset": offset, + "search": search, + }, + target_list_params.TargetListParams, + ), ), + cast_to=cast( + Any, LogsUploaderTargetList + ), # Union types cannot be passed in as arguments in the type system ), - cast_to=LogsUploaderTargetList, ) async def delete( diff --git a/src/gcore/resources/cdn/origin_groups.py b/src/gcore/resources/cdn/origin_groups.py index d9d2f73f..01a4a919 100644 --- a/src/gcore/resources/cdn/origin_groups.py +++ b/src/gcore/resources/cdn/origin_groups.py @@ -76,8 +76,6 @@ def create( Args: name: Origin group name. - sources: List of origin sources in the origin group. - auth_type: Origin authentication type. Possible values: @@ -274,8 +272,6 @@ def update( - **`http_503`** - a origin returned a response with the code 503 - **`http_504`** - a origin returned a response with the code 504 - sources: List of origin sources in the origin group. - use_next: Defines whether to use the next origin from the origin group if origin responds with the cases specified in `proxy_next_upstream`. If you enable it, you must specify cases in `proxy_next_upstream`. @@ -408,7 +404,9 @@ def list( self, *, has_related_resources: bool | Omit = omit, + limit: int | Omit = omit, name: str | Omit = omit, + offset: int | Omit = omit, sources: str | Omit = omit, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. # The extra values given here take precedence over values defined on the client or passed to this method. @@ -428,8 +426,12 @@ def list( - **true** – Origin group has related CDN resources. - **false** – Origin group does not have related CDN resources. + limit: Maximum number of items to return in the response. Cannot exceed 1000. + name: Origin group name. + offset: Number of items to skip from the beginning of the list. + sources: Origin sources (IP addresses or domains) in the origin group. extra_headers: Send extra headers @@ -440,23 +442,28 @@ def list( timeout: Override the client-level default timeout for this request, in seconds """ - return self._get( - "/cdn/origin_groups", - options=make_request_options( - extra_headers=extra_headers, - extra_query=extra_query, - extra_body=extra_body, - timeout=timeout, - query=maybe_transform( - { - "has_related_resources": has_related_resources, - "name": name, - "sources": sources, - }, - origin_group_list_params.OriginGroupListParams, + return cast( + OriginGroupsList, + self._get( + "/cdn/origin_groups", + options=make_request_options( + extra_headers=extra_headers, + extra_query=extra_query, + extra_body=extra_body, + timeout=timeout, + query=maybe_transform( + { + "has_related_resources": has_related_resources, + "limit": limit, + "name": name, + "offset": offset, + "sources": sources, + }, + origin_group_list_params.OriginGroupListParams, + ), ), + cast_to=cast(Any, OriginGroupsList), # Union types cannot be passed in as arguments in the type system ), - cast_to=OriginGroupsList, ) def delete( @@ -558,8 +565,6 @@ def replace( path: Parameter is **deprecated**. - sources: List of origin sources in the origin group. - use_next: Defines whether to use the next origin from the origin group if origin responds with the cases specified in `proxy_next_upstream`. If you enable it, you must specify cases in `proxy_next_upstream`. @@ -755,8 +760,6 @@ async def create( Args: name: Origin group name. - sources: List of origin sources in the origin group. - auth_type: Origin authentication type. Possible values: @@ -953,8 +956,6 @@ async def update( - **`http_503`** - a origin returned a response with the code 503 - **`http_504`** - a origin returned a response with the code 504 - sources: List of origin sources in the origin group. - use_next: Defines whether to use the next origin from the origin group if origin responds with the cases specified in `proxy_next_upstream`. If you enable it, you must specify cases in `proxy_next_upstream`. @@ -1087,7 +1088,9 @@ async def list( self, *, has_related_resources: bool | Omit = omit, + limit: int | Omit = omit, name: str | Omit = omit, + offset: int | Omit = omit, sources: str | Omit = omit, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. # The extra values given here take precedence over values defined on the client or passed to this method. @@ -1107,8 +1110,12 @@ async def list( - **true** – Origin group has related CDN resources. - **false** – Origin group does not have related CDN resources. + limit: Maximum number of items to return in the response. Cannot exceed 1000. + name: Origin group name. + offset: Number of items to skip from the beginning of the list. + sources: Origin sources (IP addresses or domains) in the origin group. extra_headers: Send extra headers @@ -1119,23 +1126,28 @@ async def list( timeout: Override the client-level default timeout for this request, in seconds """ - return await self._get( - "/cdn/origin_groups", - options=make_request_options( - extra_headers=extra_headers, - extra_query=extra_query, - extra_body=extra_body, - timeout=timeout, - query=await async_maybe_transform( - { - "has_related_resources": has_related_resources, - "name": name, - "sources": sources, - }, - origin_group_list_params.OriginGroupListParams, + return cast( + OriginGroupsList, + await self._get( + "/cdn/origin_groups", + options=make_request_options( + extra_headers=extra_headers, + extra_query=extra_query, + extra_body=extra_body, + timeout=timeout, + query=await async_maybe_transform( + { + "has_related_resources": has_related_resources, + "limit": limit, + "name": name, + "offset": offset, + "sources": sources, + }, + origin_group_list_params.OriginGroupListParams, + ), ), + cast_to=cast(Any, OriginGroupsList), # Union types cannot be passed in as arguments in the type system ), - cast_to=OriginGroupsList, ) async def delete( @@ -1237,8 +1249,6 @@ async def replace( path: Parameter is **deprecated**. - sources: List of origin sources in the origin group. - use_next: Defines whether to use the next origin from the origin group if origin responds with the cases specified in `proxy_next_upstream`. If you enable it, you must specify cases in `proxy_next_upstream`. diff --git a/src/gcore/resources/cdn/rule_templates.py b/src/gcore/resources/cdn/rule_templates.py index 7782c733..7080e040 100644 --- a/src/gcore/resources/cdn/rule_templates.py +++ b/src/gcore/resources/cdn/rule_templates.py @@ -17,10 +17,15 @@ async_to_raw_response_wrapper, async_to_streamed_response_wrapper, ) -from ...types.cdn import rule_template_create_params, rule_template_update_params, rule_template_replace_params -from ..._base_client import make_request_options +from ...types.cdn import ( + rule_template_list_params, + rule_template_create_params, + rule_template_update_params, + rule_template_replace_params, +) +from ...pagination import SyncOffsetPage, AsyncOffsetPage +from ..._base_client import AsyncPaginator, make_request_options from ...types.cdn.rule_template import RuleTemplate -from ...types.cdn.rule_template_list import RuleTemplateList __all__ = ["RuleTemplatesResource", "AsyncRuleTemplatesResource"] @@ -229,20 +234,48 @@ def update( def list( self, *, + limit: int | Omit = omit, + offset: int | Omit = omit, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. # The extra values given here take precedence over values defined on the client or passed to this method. extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = not_given, - ) -> RuleTemplateList: - """Get rule templates list""" - return self._get( + ) -> SyncOffsetPage[RuleTemplate]: + """ + Get rule templates list + + Args: + limit: Maximum number of items to return in the response. Cannot exceed 1000. + + offset: Number of items to skip from the beginning of the list. + + extra_headers: Send extra headers + + extra_query: Add additional query parameters to the request + + extra_body: Add additional JSON properties to the request + + timeout: Override the client-level default timeout for this request, in seconds + """ + return self._get_api_list( "/cdn/resources/rule_templates", + page=SyncOffsetPage[RuleTemplate], options=make_request_options( - extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout + extra_headers=extra_headers, + extra_query=extra_query, + extra_body=extra_body, + timeout=timeout, + query=maybe_transform( + { + "limit": limit, + "offset": offset, + }, + rule_template_list_params.RuleTemplateListParams, + ), ), - cast_to=RuleTemplateList, + model=RuleTemplate, ) def delete( @@ -599,23 +632,51 @@ async def update( cast_to=RuleTemplate, ) - async def list( + def list( self, *, + limit: int | Omit = omit, + offset: int | Omit = omit, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. # The extra values given here take precedence over values defined on the client or passed to this method. extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = not_given, - ) -> RuleTemplateList: - """Get rule templates list""" - return await self._get( + ) -> AsyncPaginator[RuleTemplate, AsyncOffsetPage[RuleTemplate]]: + """ + Get rule templates list + + Args: + limit: Maximum number of items to return in the response. Cannot exceed 1000. + + offset: Number of items to skip from the beginning of the list. + + extra_headers: Send extra headers + + extra_query: Add additional query parameters to the request + + extra_body: Add additional JSON properties to the request + + timeout: Override the client-level default timeout for this request, in seconds + """ + return self._get_api_list( "/cdn/resources/rule_templates", + page=AsyncOffsetPage[RuleTemplate], options=make_request_options( - extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout + extra_headers=extra_headers, + extra_query=extra_query, + extra_body=extra_body, + timeout=timeout, + query=maybe_transform( + { + "limit": limit, + "offset": offset, + }, + rule_template_list_params.RuleTemplateListParams, + ), ), - cast_to=RuleTemplateList, + model=RuleTemplate, ) async def delete( diff --git a/src/gcore/resources/cdn/shields.py b/src/gcore/resources/cdn/shields.py index 07c64807..8eb3ed5f 100644 --- a/src/gcore/resources/cdn/shields.py +++ b/src/gcore/resources/cdn/shields.py @@ -4,7 +4,8 @@ import httpx -from ..._types import Body, Query, Headers, NotGiven, not_given +from ..._types import Body, Omit, Query, Headers, NotGiven, omit, not_given +from ..._utils import maybe_transform from ..._compat import cached_property from ..._resource import SyncAPIResource, AsyncAPIResource from ..._response import ( @@ -13,7 +14,9 @@ async_to_raw_response_wrapper, async_to_streamed_response_wrapper, ) -from ..._base_client import make_request_options +from ...types.cdn import shield_list_params +from ...pagination import SyncOffsetPage, AsyncOffsetPage +from ..._base_client import AsyncPaginator, make_request_options from ...types.cdn.shield_list_response import ShieldListResponse __all__ = ["ShieldsResource", "AsyncShieldsResource"] @@ -42,20 +45,48 @@ def with_streaming_response(self) -> ShieldsResourceWithStreamingResponse: def list( self, *, + limit: int | Omit = omit, + offset: int | Omit = omit, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. # The extra values given here take precedence over values defined on the client or passed to this method. extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = not_given, - ) -> ShieldListResponse: - """Get information about all origin shielding locations available in the account.""" - return self._get( + ) -> SyncOffsetPage[ShieldListResponse]: + """ + Get information about all origin shielding locations available in the account. + + Args: + limit: Maximum number of items to return in the response. Cannot exceed 1000. + + offset: Number of items to skip from the beginning of the list. + + extra_headers: Send extra headers + + extra_query: Add additional query parameters to the request + + extra_body: Add additional JSON properties to the request + + timeout: Override the client-level default timeout for this request, in seconds + """ + return self._get_api_list( "/cdn/shieldingpop_v2", + page=SyncOffsetPage[ShieldListResponse], options=make_request_options( - extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout + extra_headers=extra_headers, + extra_query=extra_query, + extra_body=extra_body, + timeout=timeout, + query=maybe_transform( + { + "limit": limit, + "offset": offset, + }, + shield_list_params.ShieldListParams, + ), ), - cast_to=ShieldListResponse, + model=ShieldListResponse, ) @@ -79,23 +110,51 @@ def with_streaming_response(self) -> AsyncShieldsResourceWithStreamingResponse: """ return AsyncShieldsResourceWithStreamingResponse(self) - async def list( + def list( self, *, + limit: int | Omit = omit, + offset: int | Omit = omit, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. # The extra values given here take precedence over values defined on the client or passed to this method. extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = not_given, - ) -> ShieldListResponse: - """Get information about all origin shielding locations available in the account.""" - return await self._get( + ) -> AsyncPaginator[ShieldListResponse, AsyncOffsetPage[ShieldListResponse]]: + """ + Get information about all origin shielding locations available in the account. + + Args: + limit: Maximum number of items to return in the response. Cannot exceed 1000. + + offset: Number of items to skip from the beginning of the list. + + extra_headers: Send extra headers + + extra_query: Add additional query parameters to the request + + extra_body: Add additional JSON properties to the request + + timeout: Override the client-level default timeout for this request, in seconds + """ + return self._get_api_list( "/cdn/shieldingpop_v2", + page=AsyncOffsetPage[ShieldListResponse], options=make_request_options( - extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout + extra_headers=extra_headers, + extra_query=extra_query, + extra_body=extra_body, + timeout=timeout, + query=maybe_transform( + { + "limit": limit, + "offset": offset, + }, + shield_list_params.ShieldListParams, + ), ), - cast_to=ShieldListResponse, + model=ShieldListResponse, ) diff --git a/src/gcore/resources/cdn/trusted_ca_certificates.py b/src/gcore/resources/cdn/trusted_ca_certificates.py index 21e94c2d..0d9b5e7b 100644 --- a/src/gcore/resources/cdn/trusted_ca_certificates.py +++ b/src/gcore/resources/cdn/trusted_ca_certificates.py @@ -2,6 +2,8 @@ from __future__ import annotations +from typing import Any, cast + import httpx from ..._types import Body, Omit, Query, Headers, NoneType, NotGiven, omit, not_given @@ -104,6 +106,8 @@ def list( self, *, automated: bool | Omit = omit, + limit: int | Omit = omit, + offset: int | Omit = omit, resource_id: int | Omit = omit, validity_not_after_lte: str | Omit = omit, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. @@ -124,6 +128,10 @@ def list( - **true** – Certificate was issued automatically. - **false** – Certificate was added by a user. + limit: Maximum number of items to return in the response. Cannot exceed 1000. + + offset: Number of items to skip from the beginning of the list. + resource_id: CDN resource ID for which the certificates are requested. validity_not_after_lte: Date and time when the certificate become untrusted (ISO 8601/RFC 3339 format, @@ -139,23 +147,28 @@ def list( timeout: Override the client-level default timeout for this request, in seconds """ - return self._get( - "/cdn/sslCertificates", - options=make_request_options( - extra_headers=extra_headers, - extra_query=extra_query, - extra_body=extra_body, - timeout=timeout, - query=maybe_transform( - { - "automated": automated, - "resource_id": resource_id, - "validity_not_after_lte": validity_not_after_lte, - }, - trusted_ca_certificate_list_params.TrustedCaCertificateListParams, + return cast( + CaCertificateList, + self._get( + "/cdn/sslCertificates", + options=make_request_options( + extra_headers=extra_headers, + extra_query=extra_query, + extra_body=extra_body, + timeout=timeout, + query=maybe_transform( + { + "automated": automated, + "limit": limit, + "offset": offset, + "resource_id": resource_id, + "validity_not_after_lte": validity_not_after_lte, + }, + trusted_ca_certificate_list_params.TrustedCaCertificateListParams, + ), ), + cast_to=cast(Any, CaCertificateList), # Union types cannot be passed in as arguments in the type system ), - cast_to=CaCertificateList, ) def delete( @@ -339,6 +352,8 @@ async def list( self, *, automated: bool | Omit = omit, + limit: int | Omit = omit, + offset: int | Omit = omit, resource_id: int | Omit = omit, validity_not_after_lte: str | Omit = omit, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. @@ -359,6 +374,10 @@ async def list( - **true** – Certificate was issued automatically. - **false** – Certificate was added by a user. + limit: Maximum number of items to return in the response. Cannot exceed 1000. + + offset: Number of items to skip from the beginning of the list. + resource_id: CDN resource ID for which the certificates are requested. validity_not_after_lte: Date and time when the certificate become untrusted (ISO 8601/RFC 3339 format, @@ -374,23 +393,28 @@ async def list( timeout: Override the client-level default timeout for this request, in seconds """ - return await self._get( - "/cdn/sslCertificates", - options=make_request_options( - extra_headers=extra_headers, - extra_query=extra_query, - extra_body=extra_body, - timeout=timeout, - query=await async_maybe_transform( - { - "automated": automated, - "resource_id": resource_id, - "validity_not_after_lte": validity_not_after_lte, - }, - trusted_ca_certificate_list_params.TrustedCaCertificateListParams, + return cast( + CaCertificateList, + await self._get( + "/cdn/sslCertificates", + options=make_request_options( + extra_headers=extra_headers, + extra_query=extra_query, + extra_body=extra_body, + timeout=timeout, + query=await async_maybe_transform( + { + "automated": automated, + "limit": limit, + "offset": offset, + "resource_id": resource_id, + "validity_not_after_lte": validity_not_after_lte, + }, + trusted_ca_certificate_list_params.TrustedCaCertificateListParams, + ), ), + cast_to=cast(Any, CaCertificateList), # Union types cannot be passed in as arguments in the type system ), - cast_to=CaCertificateList, ) async def delete( diff --git a/src/gcore/resources/cloud/baremetal/baremetal.py b/src/gcore/resources/cloud/baremetal/baremetal.py index 6922c20d..1330f410 100644 --- a/src/gcore/resources/cloud/baremetal/baremetal.py +++ b/src/gcore/resources/cloud/baremetal/baremetal.py @@ -43,6 +43,9 @@ def flavors(self) -> FlavorsResource: @cached_property def servers(self) -> ServersResource: + """ + Bare metal servers are dedicated physical machines with direct hardware access, supporting provisioning, rebuilding, and network configuration within a cloud region. + """ return ServersResource(self._client) @cached_property @@ -76,6 +79,9 @@ def flavors(self) -> AsyncFlavorsResource: @cached_property def servers(self) -> AsyncServersResource: + """ + Bare metal servers are dedicated physical machines with direct hardware access, supporting provisioning, rebuilding, and network configuration within a cloud region. + """ return AsyncServersResource(self._client) @cached_property @@ -112,6 +118,9 @@ def flavors(self) -> FlavorsResourceWithRawResponse: @cached_property def servers(self) -> ServersResourceWithRawResponse: + """ + Bare metal servers are dedicated physical machines with direct hardware access, supporting provisioning, rebuilding, and network configuration within a cloud region. + """ return ServersResourceWithRawResponse(self._baremetal.servers) @@ -129,6 +138,9 @@ def flavors(self) -> AsyncFlavorsResourceWithRawResponse: @cached_property def servers(self) -> AsyncServersResourceWithRawResponse: + """ + Bare metal servers are dedicated physical machines with direct hardware access, supporting provisioning, rebuilding, and network configuration within a cloud region. + """ return AsyncServersResourceWithRawResponse(self._baremetal.servers) @@ -146,6 +158,9 @@ def flavors(self) -> FlavorsResourceWithStreamingResponse: @cached_property def servers(self) -> ServersResourceWithStreamingResponse: + """ + Bare metal servers are dedicated physical machines with direct hardware access, supporting provisioning, rebuilding, and network configuration within a cloud region. + """ return ServersResourceWithStreamingResponse(self._baremetal.servers) @@ -163,4 +178,7 @@ def flavors(self) -> AsyncFlavorsResourceWithStreamingResponse: @cached_property def servers(self) -> AsyncServersResourceWithStreamingResponse: + """ + Bare metal servers are dedicated physical machines with direct hardware access, supporting provisioning, rebuilding, and network configuration within a cloud region. + """ return AsyncServersResourceWithStreamingResponse(self._baremetal.servers) diff --git a/src/gcore/resources/cloud/baremetal/servers.py b/src/gcore/resources/cloud/baremetal/servers.py index 7a19a281..e5a67844 100644 --- a/src/gcore/resources/cloud/baremetal/servers.py +++ b/src/gcore/resources/cloud/baremetal/servers.py @@ -35,6 +35,10 @@ class ServersResource(SyncAPIResource): + """ + Bare metal servers are dedicated physical machines with direct hardware access, supporting provisioning, rebuilding, and network configuration within a cloud region. + """ + @cached_property def with_raw_response(self) -> ServersResourceWithRawResponse: """ @@ -740,6 +744,10 @@ def rebuild_and_poll( class AsyncServersResource(AsyncAPIResource): + """ + Bare metal servers are dedicated physical machines with direct hardware access, supporting provisioning, rebuilding, and network configuration within a cloud region. + """ + @cached_property def with_raw_response(self) -> AsyncServersResourceWithRawResponse: """ diff --git a/src/gcore/resources/fastedge/apps/apps.py b/src/gcore/resources/fastedge/apps/apps.py index 2d8a8d44..ca7f918d 100644 --- a/src/gcore/resources/fastedge/apps/apps.py +++ b/src/gcore/resources/fastedge/apps/apps.py @@ -102,9 +102,6 @@ def create( env: Environment variables - log: Logging channel. Use 'kafka' to enable log collection (queryable via API), or - 'none' to disable logging. - name: Unique application name (alphanumeric, hyphens allowed) rsp_headers: Extra headers to add to the response @@ -191,9 +188,6 @@ def update( env: Environment variables - log: Logging channel. Use 'kafka' to enable log collection (queryable via API), or - 'none' to disable logging. - name: Unique application name (alphanumeric, hyphens allowed) rsp_headers: Extra headers to add to the response @@ -515,9 +509,6 @@ async def create( env: Environment variables - log: Logging channel. Use 'kafka' to enable log collection (queryable via API), or - 'none' to disable logging. - name: Unique application name (alphanumeric, hyphens allowed) rsp_headers: Extra headers to add to the response @@ -604,9 +595,6 @@ async def update( env: Environment variables - log: Logging channel. Use 'kafka' to enable log collection (queryable via API), or - 'none' to disable logging. - name: Unique application name (alphanumeric, hyphens allowed) rsp_headers: Extra headers to add to the response diff --git a/src/gcore/resources/fastedge/apps/logs.py b/src/gcore/resources/fastedge/apps/logs.py index 592b136a..5adb7ee5 100644 --- a/src/gcore/resources/fastedge/apps/logs.py +++ b/src/gcore/resources/fastedge/apps/logs.py @@ -59,6 +59,7 @@ def list( from_: Union[str, datetime] | Omit = omit, limit: int | Omit = omit, offset: int | Omit = omit, + request_id: str | Omit = omit, search: str | Omit = omit, sort: Literal["desc", "asc"] | Omit = omit, to: Union[str, datetime] | Omit = omit, @@ -73,7 +74,7 @@ def list( List logs for the app Args: - client_ip: Search by client IP + client_ip: Search by client IP address edge: Edge name @@ -84,6 +85,8 @@ def list( offset: Offset for pagination + request_id: Search by request ID + search: Search string sort: Sort order (default desc) @@ -113,6 +116,7 @@ def list( "from_": from_, "limit": limit, "offset": offset, + "request_id": request_id, "search": search, "sort": sort, "to": to, @@ -157,6 +161,7 @@ def list( from_: Union[str, datetime] | Omit = omit, limit: int | Omit = omit, offset: int | Omit = omit, + request_id: str | Omit = omit, search: str | Omit = omit, sort: Literal["desc", "asc"] | Omit = omit, to: Union[str, datetime] | Omit = omit, @@ -171,7 +176,7 @@ def list( List logs for the app Args: - client_ip: Search by client IP + client_ip: Search by client IP address edge: Edge name @@ -182,6 +187,8 @@ def list( offset: Offset for pagination + request_id: Search by request ID + search: Search string sort: Sort order (default desc) @@ -211,6 +218,7 @@ def list( "from_": from_, "limit": limit, "offset": offset, + "request_id": request_id, "search": search, "sort": sort, "to": to, diff --git a/src/gcore/resources/iam/users.py b/src/gcore/resources/iam/users.py index ef4c53d7..91d1fb68 100644 --- a/src/gcore/resources/iam/users.py +++ b/src/gcore/resources/iam/users.py @@ -111,7 +111,7 @@ def update( def list( self, *, - limit: int | Omit = omit, + limit: int | Omit = 50, offset: int | Omit = omit, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. # The extra values given here take precedence over values defined on the client or passed to this method. @@ -368,7 +368,7 @@ async def update( def list( self, *, - limit: int | Omit = omit, + limit: int | Omit = 50, offset: int | Omit = omit, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. # The extra values given here take precedence over values defined on the client or passed to this method. diff --git a/src/gcore/types/cdn/__init__.py b/src/gcore/types/cdn/__init__.py index 5b706659..f050ca01 100644 --- a/src/gcore/types/cdn/__init__.py +++ b/src/gcore/types/cdn/__init__.py @@ -25,6 +25,7 @@ from .metric_list_params import MetricListParams as MetricListParams from .origin_groups_list import OriginGroupsList as OriginGroupsList from .rule_template_list import RuleTemplateList as RuleTemplateList +from .shield_list_params import ShieldListParams as ShieldListParams from .ssl_request_status import SslRequestStatus as SslRequestStatus from .usage_series_stats import UsageSeriesStats as UsageSeriesStats from .ca_certificate_list import CaCertificateList as CaCertificateList @@ -46,11 +47,13 @@ from .cdn_update_account_params import CDNUpdateAccountParams as CDNUpdateAccountParams from .certificate_create_params import CertificateCreateParams as CertificateCreateParams from .resource_aggregated_stats import ResourceAggregatedStats as ResourceAggregatedStats +from .rule_template_list_params import RuleTemplateListParams as RuleTemplateListParams from .cdn_resource_create_params import CDNResourceCreateParams as CDNResourceCreateParams from .cdn_resource_update_params import CDNResourceUpdateParams as CDNResourceUpdateParams from .certificate_replace_params import CertificateReplaceParams as CertificateReplaceParams from .origin_group_create_params import OriginGroupCreateParams as OriginGroupCreateParams from .origin_group_update_params import OriginGroupUpdateParams as OriginGroupUpdateParams +from .cdn_list_aws_regions_params import CDNListAwsRegionsParams as CDNListAwsRegionsParams from .cdn_resource_replace_params import CDNResourceReplaceParams as CDNResourceReplaceParams from .origin_group_replace_params import OriginGroupReplaceParams as OriginGroupReplaceParams from .rule_template_create_params import RuleTemplateCreateParams as RuleTemplateCreateParams @@ -59,6 +62,7 @@ from .rule_template_replace_params import RuleTemplateReplaceParams as RuleTemplateReplaceParams from .certificate_get_status_params import CertificateGetStatusParams as CertificateGetStatusParams from .cdn_list_purge_statuses_params import CDNListPurgeStatusesParams as CDNListPurgeStatusesParams +from .cdn_list_alibaba_regions_params import CDNListAlibabaRegionsParams as CDNListAlibabaRegionsParams from .cdn_list_purge_statuses_response import CDNListPurgeStatusesResponse as CDNListPurgeStatusesResponse from .trusted_ca_certificate_list_params import TrustedCaCertificateListParams as TrustedCaCertificateListParams from .trusted_ca_certificate_create_params import TrustedCaCertificateCreateParams as TrustedCaCertificateCreateParams diff --git a/src/gcore/types/cdn/alibaba_regions.py b/src/gcore/types/cdn/alibaba_regions.py index 8be22234..7b0ed1bc 100644 --- a/src/gcore/types/cdn/alibaba_regions.py +++ b/src/gcore/types/cdn/alibaba_regions.py @@ -1,14 +1,14 @@ # File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. -from typing import List, Optional +from typing import List, Union, Optional from typing_extensions import TypeAlias from ..._models import BaseModel -__all__ = ["AlibabaRegions", "AlibabaRegionItem"] +__all__ = ["AlibabaRegions", "PlainList", "PaginatedList", "PaginatedListResult"] -class AlibabaRegionItem(BaseModel): +class PlainList(BaseModel): id: Optional[int] = None """Region ID.""" @@ -19,4 +19,28 @@ class AlibabaRegionItem(BaseModel): """Region name.""" -AlibabaRegions: TypeAlias = List[AlibabaRegionItem] +class PaginatedListResult(BaseModel): + id: Optional[int] = None + """Region ID.""" + + code: Optional[str] = None + """Region code.""" + + name: Optional[str] = None + """Region name.""" + + +class PaginatedList(BaseModel): + count: int + """Total number of items.""" + + next: Optional[str] = None + """URL to the next page of results. Null if current page is the last one.""" + + previous: Optional[str] = None + """URL to the previous page of results. Null if current page is the first one.""" + + results: List[PaginatedListResult] + + +AlibabaRegions: TypeAlias = Union[List[PlainList], PaginatedList] diff --git a/src/gcore/types/cdn/aws_regions.py b/src/gcore/types/cdn/aws_regions.py index 0dccf9b9..221ccc9d 100644 --- a/src/gcore/types/cdn/aws_regions.py +++ b/src/gcore/types/cdn/aws_regions.py @@ -1,14 +1,14 @@ # File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. -from typing import List, Optional +from typing import List, Union, Optional from typing_extensions import TypeAlias from ..._models import BaseModel -__all__ = ["AwsRegions", "AwsRegionItem"] +__all__ = ["AwsRegions", "PlainList", "PaginatedList", "PaginatedListResult"] -class AwsRegionItem(BaseModel): +class PlainList(BaseModel): id: Optional[int] = None """Region ID.""" @@ -19,4 +19,28 @@ class AwsRegionItem(BaseModel): """Region name.""" -AwsRegions: TypeAlias = List[AwsRegionItem] +class PaginatedListResult(BaseModel): + id: Optional[int] = None + """Region ID.""" + + code: Optional[str] = None + """Region code.""" + + name: Optional[str] = None + """Region name.""" + + +class PaginatedList(BaseModel): + count: int + """Total number of items.""" + + next: Optional[str] = None + """URL to the next page of results. Null if current page is the last one.""" + + previous: Optional[str] = None + """URL to the previous page of results. Null if current page is the first one.""" + + results: List[PaginatedListResult] + + +AwsRegions: TypeAlias = Union[List[PlainList], PaginatedList] diff --git a/src/gcore/types/cdn/ca_certificate_list.py b/src/gcore/types/cdn/ca_certificate_list.py index 1f56b642..dad79769 100644 --- a/src/gcore/types/cdn/ca_certificate_list.py +++ b/src/gcore/types/cdn/ca_certificate_list.py @@ -1,10 +1,25 @@ # File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. -from typing import List +from typing import List, Union, Optional from typing_extensions import TypeAlias +from ..._models import BaseModel from .ca_certificate import CaCertificate -__all__ = ["CaCertificateList"] +__all__ = ["CaCertificateList", "PaginatedList"] -CaCertificateList: TypeAlias = List[CaCertificate] + +class PaginatedList(BaseModel): + count: int + """Total number of items.""" + + next: Optional[str] = None + """URL to the next page of results. Null if current page is the last one.""" + + previous: Optional[str] = None + """URL to the previous page of results. Null if current page is the first one.""" + + results: List[CaCertificate] + + +CaCertificateList: TypeAlias = Union[List[CaCertificate], PaginatedList] diff --git a/src/gcore/types/cdn/cdn_list_alibaba_regions_params.py b/src/gcore/types/cdn/cdn_list_alibaba_regions_params.py new file mode 100644 index 00000000..7820a114 --- /dev/null +++ b/src/gcore/types/cdn/cdn_list_alibaba_regions_params.py @@ -0,0 +1,15 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from __future__ import annotations + +from typing_extensions import TypedDict + +__all__ = ["CDNListAlibabaRegionsParams"] + + +class CDNListAlibabaRegionsParams(TypedDict, total=False): + limit: int + """Maximum number of items to return in the response. Cannot exceed 1000.""" + + offset: int + """Number of items to skip from the beginning of the list.""" diff --git a/src/gcore/types/cdn/cdn_list_aws_regions_params.py b/src/gcore/types/cdn/cdn_list_aws_regions_params.py new file mode 100644 index 00000000..568651fe --- /dev/null +++ b/src/gcore/types/cdn/cdn_list_aws_regions_params.py @@ -0,0 +1,15 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from __future__ import annotations + +from typing_extensions import TypedDict + +__all__ = ["CDNListAwsRegionsParams"] + + +class CDNListAwsRegionsParams(TypedDict, total=False): + limit: int + """Maximum number of items to return in the response. Cannot exceed 1000.""" + + offset: int + """Number of items to skip from the beginning of the list.""" diff --git a/src/gcore/types/cdn/cdn_list_purge_statuses_response.py b/src/gcore/types/cdn/cdn_list_purge_statuses_response.py index e0a38e7c..0796e5e6 100644 --- a/src/gcore/types/cdn/cdn_list_purge_statuses_response.py +++ b/src/gcore/types/cdn/cdn_list_purge_statuses_response.py @@ -1,10 +1,25 @@ # File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. -from typing import List +from typing import List, Union, Optional from typing_extensions import TypeAlias +from ..._models import BaseModel from .purge_status import PurgeStatus -__all__ = ["CDNListPurgeStatusesResponse"] +__all__ = ["CDNListPurgeStatusesResponse", "PaginatedList"] -CDNListPurgeStatusesResponse: TypeAlias = List[PurgeStatus] + +class PaginatedList(BaseModel): + count: int + """Total number of items.""" + + next: Optional[str] = None + """URL to the next page of results. Null if current page is the last one.""" + + previous: Optional[str] = None + """URL to the previous page of results. Null if current page is the first one.""" + + results: List[PurgeStatus] + + +CDNListPurgeStatusesResponse: TypeAlias = Union[List[PurgeStatus], PaginatedList] diff --git a/src/gcore/types/cdn/cdn_resource_list.py b/src/gcore/types/cdn/cdn_resource_list.py index 8146c2e7..b2cf58ff 100644 --- a/src/gcore/types/cdn/cdn_resource_list.py +++ b/src/gcore/types/cdn/cdn_resource_list.py @@ -1,10 +1,25 @@ # File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. -from typing import List +from typing import List, Union, Optional from typing_extensions import TypeAlias +from ..._models import BaseModel from .cdn_resource import CDNResource -__all__ = ["CDNResourceList"] +__all__ = ["CDNResourceList", "PaginatedList"] -CDNResourceList: TypeAlias = List[CDNResource] + +class PaginatedList(BaseModel): + count: int + """Total number of items.""" + + next: Optional[str] = None + """URL to the next page of results. Null if current page is the last one.""" + + previous: Optional[str] = None + """URL to the previous page of results. Null if current page is the first one.""" + + results: List[CDNResource] + + +CDNResourceList: TypeAlias = Union[List[CDNResource], PaginatedList] diff --git a/src/gcore/types/cdn/cdn_resource_list_params.py b/src/gcore/types/cdn/cdn_resource_list_params.py index 98c70e08..9a063eed 100644 --- a/src/gcore/types/cdn/cdn_resource_list_params.py +++ b/src/gcore/types/cdn/cdn_resource_list_params.py @@ -31,6 +31,9 @@ class CDNResourceListParams(TypedDict, total=False): - **false** - CDN resource is disabled. """ + limit: int + """Maximum number of items to return in the response. Cannot exceed 1000.""" + max_created: str """ Most recent date of CDN resource creation for which CDN resources should be @@ -43,6 +46,9 @@ class CDNResourceListParams(TypedDict, total=False): returned (ISO 8601/RFC 3339 format, UTC.) """ + offset: int + """Number of items to skip from the beginning of the list.""" + origin_group: Annotated[int, PropertyInfo(alias="originGroup")] """Origin group ID.""" diff --git a/src/gcore/types/cdn/cdn_resources/__init__.py b/src/gcore/types/cdn/cdn_resources/__init__.py index 78504c1b..ef1318c5 100644 --- a/src/gcore/types/cdn/cdn_resources/__init__.py +++ b/src/gcore/types/cdn/cdn_resources/__init__.py @@ -3,6 +3,7 @@ from __future__ import annotations from .origin_shielding import OriginShielding as OriginShielding +from .rule_list_params import RuleListParams as RuleListParams from .cdn_resource_rule import CDNResourceRule as CDNResourceRule from .rule_create_params import RuleCreateParams as RuleCreateParams from .rule_update_params import RuleUpdateParams as RuleUpdateParams diff --git a/src/gcore/types/cdn/cdn_resources/cdn_resource_rule_list.py b/src/gcore/types/cdn/cdn_resources/cdn_resource_rule_list.py index dc21eb0c..4840bd84 100644 --- a/src/gcore/types/cdn/cdn_resources/cdn_resource_rule_list.py +++ b/src/gcore/types/cdn/cdn_resources/cdn_resource_rule_list.py @@ -1,10 +1,25 @@ # File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. -from typing import List +from typing import List, Union, Optional from typing_extensions import TypeAlias +from ...._models import BaseModel from .cdn_resource_rule import CDNResourceRule -__all__ = ["CDNResourceRuleList"] +__all__ = ["CDNResourceRuleList", "PaginatedList"] -CDNResourceRuleList: TypeAlias = List[CDNResourceRule] + +class PaginatedList(BaseModel): + count: int + """Total number of items.""" + + next: Optional[str] = None + """URL to the next page of results. Null if current page is the last one.""" + + previous: Optional[str] = None + """URL to the previous page of results. Null if current page is the first one.""" + + results: List[CDNResourceRule] + + +CDNResourceRuleList: TypeAlias = Union[List[CDNResourceRule], PaginatedList] diff --git a/src/gcore/types/cdn/cdn_resources/rule_list_params.py b/src/gcore/types/cdn/cdn_resources/rule_list_params.py new file mode 100644 index 00000000..333a21d2 --- /dev/null +++ b/src/gcore/types/cdn/cdn_resources/rule_list_params.py @@ -0,0 +1,15 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from __future__ import annotations + +from typing_extensions import TypedDict + +__all__ = ["RuleListParams"] + + +class RuleListParams(TypedDict, total=False): + limit: int + """Maximum number of items to return in the response. Cannot exceed 1000.""" + + offset: int + """Number of items to skip from the beginning of the list.""" diff --git a/src/gcore/types/cdn/certificate_list_params.py b/src/gcore/types/cdn/certificate_list_params.py index 7474922f..dd3fa235 100644 --- a/src/gcore/types/cdn/certificate_list_params.py +++ b/src/gcore/types/cdn/certificate_list_params.py @@ -17,6 +17,12 @@ class CertificateListParams(TypedDict, total=False): - **false** – Certificate was added by a user. """ + limit: int + """Maximum number of items to return in the response. Cannot exceed 1000.""" + + offset: int + """Number of items to skip from the beginning of the list.""" + resource_id: int """CDN resource ID for which certificates are requested.""" diff --git a/src/gcore/types/cdn/logs_uploader/config_list_params.py b/src/gcore/types/cdn/logs_uploader/config_list_params.py index 8b2e42b2..81301d91 100644 --- a/src/gcore/types/cdn/logs_uploader/config_list_params.py +++ b/src/gcore/types/cdn/logs_uploader/config_list_params.py @@ -9,6 +9,12 @@ class ConfigListParams(TypedDict, total=False): + limit: int + """Maximum number of items to return in the response. Cannot exceed 1000.""" + + offset: int + """Number of items to skip from the beginning of the list.""" + resource_ids: Iterable[int] """Filter by ids of CDN resources that are assigned to given config.""" diff --git a/src/gcore/types/cdn/logs_uploader/logs_uploader_config_list.py b/src/gcore/types/cdn/logs_uploader/logs_uploader_config_list.py index 477aaf6c..65ec5b13 100644 --- a/src/gcore/types/cdn/logs_uploader/logs_uploader_config_list.py +++ b/src/gcore/types/cdn/logs_uploader/logs_uploader_config_list.py @@ -1,10 +1,25 @@ # File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. -from typing import List +from typing import List, Union, Optional from typing_extensions import TypeAlias +from ...._models import BaseModel from .logs_uploader_config import LogsUploaderConfig -__all__ = ["LogsUploaderConfigList"] +__all__ = ["LogsUploaderConfigList", "PaginatedList"] -LogsUploaderConfigList: TypeAlias = List[LogsUploaderConfig] + +class PaginatedList(BaseModel): + count: int + """Total number of items.""" + + next: Optional[str] = None + """URL to the next page of results. Null if current page is the last one.""" + + previous: Optional[str] = None + """URL to the previous page of results. Null if current page is the first one.""" + + results: List[LogsUploaderConfig] + + +LogsUploaderConfigList: TypeAlias = Union[List[LogsUploaderConfig], PaginatedList] diff --git a/src/gcore/types/cdn/logs_uploader/logs_uploader_policy_list.py b/src/gcore/types/cdn/logs_uploader/logs_uploader_policy_list.py index 75f9a44e..b55e07b0 100644 --- a/src/gcore/types/cdn/logs_uploader/logs_uploader_policy_list.py +++ b/src/gcore/types/cdn/logs_uploader/logs_uploader_policy_list.py @@ -1,10 +1,25 @@ # File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. -from typing import List +from typing import List, Union, Optional from typing_extensions import TypeAlias +from ...._models import BaseModel from .logs_uploader_policy import LogsUploaderPolicy -__all__ = ["LogsUploaderPolicyList"] +__all__ = ["LogsUploaderPolicyList", "PaginatedList"] -LogsUploaderPolicyList: TypeAlias = List[LogsUploaderPolicy] + +class PaginatedList(BaseModel): + count: int + """Total number of items.""" + + next: Optional[str] = None + """URL to the next page of results. Null if current page is the last one.""" + + previous: Optional[str] = None + """URL to the previous page of results. Null if current page is the first one.""" + + results: List[LogsUploaderPolicy] + + +LogsUploaderPolicyList: TypeAlias = Union[List[LogsUploaderPolicy], PaginatedList] diff --git a/src/gcore/types/cdn/logs_uploader/logs_uploader_target_list.py b/src/gcore/types/cdn/logs_uploader/logs_uploader_target_list.py index f3df6d6b..2601b2cc 100644 --- a/src/gcore/types/cdn/logs_uploader/logs_uploader_target_list.py +++ b/src/gcore/types/cdn/logs_uploader/logs_uploader_target_list.py @@ -1,10 +1,25 @@ # File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. -from typing import List +from typing import List, Union, Optional from typing_extensions import TypeAlias +from ...._models import BaseModel from .logs_uploader_target import LogsUploaderTarget -__all__ = ["LogsUploaderTargetList"] +__all__ = ["LogsUploaderTargetList", "PaginatedList"] -LogsUploaderTargetList: TypeAlias = List[LogsUploaderTarget] + +class PaginatedList(BaseModel): + count: int + """Total number of items.""" + + next: Optional[str] = None + """URL to the next page of results. Null if current page is the last one.""" + + previous: Optional[str] = None + """URL to the previous page of results. Null if current page is the first one.""" + + results: List[LogsUploaderTarget] + + +LogsUploaderTargetList: TypeAlias = Union[List[LogsUploaderTarget], PaginatedList] diff --git a/src/gcore/types/cdn/logs_uploader/policy_list_params.py b/src/gcore/types/cdn/logs_uploader/policy_list_params.py index 4b2a2b4a..b051b27b 100644 --- a/src/gcore/types/cdn/logs_uploader/policy_list_params.py +++ b/src/gcore/types/cdn/logs_uploader/policy_list_params.py @@ -12,5 +12,11 @@ class PolicyListParams(TypedDict, total=False): config_ids: Iterable[int] """Filter by ids of related logs uploader configs that use given policy.""" + limit: int + """Maximum number of items to return in the response. Cannot exceed 1000.""" + + offset: int + """Number of items to skip from the beginning of the list.""" + search: str """Search by policy name or id.""" diff --git a/src/gcore/types/cdn/logs_uploader/target_list_params.py b/src/gcore/types/cdn/logs_uploader/target_list_params.py index aed247de..7387e660 100644 --- a/src/gcore/types/cdn/logs_uploader/target_list_params.py +++ b/src/gcore/types/cdn/logs_uploader/target_list_params.py @@ -12,5 +12,11 @@ class TargetListParams(TypedDict, total=False): config_ids: Iterable[int] """Filter by ids of related logs uploader configs that use given target.""" + limit: int + """Maximum number of items to return in the response. Cannot exceed 1000.""" + + offset: int + """Number of items to skip from the beginning of the list.""" + search: str """Search by target name or id.""" diff --git a/src/gcore/types/cdn/origin_group_create_params.py b/src/gcore/types/cdn/origin_group_create_params.py index 2c77824a..10e256e5 100644 --- a/src/gcore/types/cdn/origin_group_create_params.py +++ b/src/gcore/types/cdn/origin_group_create_params.py @@ -2,12 +2,21 @@ from __future__ import annotations -from typing import Union, Iterable -from typing_extensions import Required, TypeAlias, TypedDict +from typing import Union, Iterable, Optional +from typing_extensions import Literal, Required, TypeAlias, TypedDict from ..._types import SequenceNotStr -__all__ = ["OriginGroupCreateParams", "NoneAuth", "NoneAuthSource", "AwsSignatureV4", "AwsSignatureV4Auth"] +__all__ = [ + "OriginGroupCreateParams", + "NoneAuth", + "NoneAuthSource", + "NoneAuthSourceChangeHostSource", + "NoneAuthSourceChangeS3Source", + "NoneAuthSourceChangeS3SourceConfig", + "AwsSignatureV4", + "AwsSignatureV4Auth", +] class NoneAuth(TypedDict, total=False): @@ -15,7 +24,6 @@ class NoneAuth(TypedDict, total=False): """Origin group name.""" sources: Required[Iterable[NoneAuthSource]] - """List of origin sources in the origin group.""" auth_type: str """Origin authentication type. @@ -58,7 +66,10 @@ class NoneAuth(TypedDict, total=False): """ -class NoneAuthSource(TypedDict, total=False): +class NoneAuthSourceChangeHostSource(TypedDict, total=False): + source: Required[str] + """IP address or domain name of the origin and the port, if custom port is used.""" + backup: bool """ Defines whether the origin is a backup, meaning that it will not be used until @@ -81,8 +92,114 @@ class NoneAuthSource(TypedDict, total=False): Origin group must contain at least one enabled origin. """ - source: str - """IP address or domain name of the origin and the port, if custom port is used.""" + host_header_override: Optional[str] + """Per-origin Host header override. + + When set, the CDN sends this value as the Host header when requesting content + from this origin instead of the default. + """ + + tag: str + """Tag for the origin source.""" + + +class NoneAuthSourceChangeS3SourceConfig(TypedDict, total=False): + """S3 storage configuration. Required when `origin_type` is `s3`.""" + + s3_access_key_id: Required[str] + """Access key ID for the S3 account. Masked as `SECRET_VALUE` in responses. + + Restrictions: + + - Latin letters (A-Z, a-z), numbers (0-9), colon, dash, and underscore. + - From 4 to 255 characters. + """ + + s3_bucket_name: Required[str] + """S3 bucket name.""" + + s3_secret_access_key: Required[str] + """Secret access key for the S3 account. Masked as `SECRET_VALUE` in responses. + + Restrictions: + + - Latin letters (A-Z, a-z), numbers (0-9), pluses, slashes, dashes, colons and + underscores. + - From 16 to 255 characters. + """ + + s3_type: Required[Literal["amazon", "other"]] + """Storage type compatible with S3. + + Possible values: + + - **amazon** - AWS S3 storage. + - **other** - Other (not AWS) S3 compatible storage. + """ + + s3_auth_type: str + """S3 authentication type.""" + + s3_region: Optional[str] + """S3 storage region. + + The parameter is required if `s3_type` is `amazon`. + """ + + s3_storage_hostname: Optional[str] + """S3 storage hostname. + + The parameter is required if `s3_type` is `other`. + """ + + +class NoneAuthSourceChangeS3Source(TypedDict, total=False): + config: Required[NoneAuthSourceChangeS3SourceConfig] + """S3 storage configuration. Required when `origin_type` is `s3`.""" + + backup: bool + """ + Defines whether the origin is a backup, meaning that it will not be used until + one of active origins become unavailable. + + Possible values: + + - **true** - Origin is a backup. + - **false** - Origin is not a backup. + """ + + enabled: bool + """Enables or disables an origin source in the origin group. + + Possible values: + + - **true** - Origin is enabled and the CDN uses it to pull content. + - **false** - Origin is disabled and the CDN does not use it to pull content. + + Origin group must contain at least one enabled origin. + """ + + host_header_override: Optional[str] + """Per-origin Host header override. + + When set, the CDN sends this value as the Host header when requesting content + from this origin instead of the default. + """ + + origin_type: Literal["host", "s3"] + """Origin type. Present in responses only for S3 sources. + + Possible values: + + - **host** - A source server or endpoint from which content is fetched. + - **s3** - S3 storage with either AWS v4 authentication or public access. + """ + + tag: str + """Tag for the origin source.""" + + +NoneAuthSource: TypeAlias = Union[NoneAuthSourceChangeHostSource, NoneAuthSourceChangeS3Source] class AwsSignatureV4(TypedDict, total=False): @@ -143,12 +260,7 @@ class AwsSignatureV4Auth(TypedDict, total=False): """ s3_bucket_name: Required[str] - """S3 bucket name. - - Restrictions: - - - Maximum 128 characters. - """ + """S3 bucket name.""" s3_secret_access_key: Required[str] """Secret access key for the S3 account. diff --git a/src/gcore/types/cdn/origin_group_list_params.py b/src/gcore/types/cdn/origin_group_list_params.py index 9a19eea1..2216e193 100644 --- a/src/gcore/types/cdn/origin_group_list_params.py +++ b/src/gcore/types/cdn/origin_group_list_params.py @@ -17,8 +17,14 @@ class OriginGroupListParams(TypedDict, total=False): - **false** – Origin group does not have related CDN resources. """ + limit: int + """Maximum number of items to return in the response. Cannot exceed 1000.""" + name: str """Origin group name.""" + offset: int + """Number of items to skip from the beginning of the list.""" + sources: str """Origin sources (IP addresses or domains) in the origin group.""" diff --git a/src/gcore/types/cdn/origin_group_replace_params.py b/src/gcore/types/cdn/origin_group_replace_params.py index 42086867..4a93b73b 100644 --- a/src/gcore/types/cdn/origin_group_replace_params.py +++ b/src/gcore/types/cdn/origin_group_replace_params.py @@ -2,12 +2,21 @@ from __future__ import annotations -from typing import Union, Iterable -from typing_extensions import Required, TypeAlias, TypedDict +from typing import Union, Iterable, Optional +from typing_extensions import Literal, Required, TypeAlias, TypedDict from ..._types import SequenceNotStr -__all__ = ["OriginGroupReplaceParams", "NoneAuth", "NoneAuthSource", "AwsSignatureV4", "AwsSignatureV4Auth"] +__all__ = [ + "OriginGroupReplaceParams", + "NoneAuth", + "NoneAuthSource", + "NoneAuthSourceChangeHostSource", + "NoneAuthSourceChangeS3Source", + "NoneAuthSourceChangeS3SourceConfig", + "AwsSignatureV4", + "AwsSignatureV4Auth", +] class NoneAuth(TypedDict, total=False): @@ -27,7 +36,6 @@ class NoneAuth(TypedDict, total=False): """Parameter is **deprecated**.""" sources: Required[Iterable[NoneAuthSource]] - """List of origin sources in the origin group.""" use_next: Required[bool] """ @@ -61,7 +69,10 @@ class NoneAuth(TypedDict, total=False): """ -class NoneAuthSource(TypedDict, total=False): +class NoneAuthSourceChangeHostSource(TypedDict, total=False): + source: Required[str] + """IP address or domain name of the origin and the port, if custom port is used.""" + backup: bool """ Defines whether the origin is a backup, meaning that it will not be used until @@ -84,8 +95,114 @@ class NoneAuthSource(TypedDict, total=False): Origin group must contain at least one enabled origin. """ - source: str - """IP address or domain name of the origin and the port, if custom port is used.""" + host_header_override: Optional[str] + """Per-origin Host header override. + + When set, the CDN sends this value as the Host header when requesting content + from this origin instead of the default. + """ + + tag: str + """Tag for the origin source.""" + + +class NoneAuthSourceChangeS3SourceConfig(TypedDict, total=False): + """S3 storage configuration. Required when `origin_type` is `s3`.""" + + s3_access_key_id: Required[str] + """Access key ID for the S3 account. Masked as `SECRET_VALUE` in responses. + + Restrictions: + + - Latin letters (A-Z, a-z), numbers (0-9), colon, dash, and underscore. + - From 4 to 255 characters. + """ + + s3_bucket_name: Required[str] + """S3 bucket name.""" + + s3_secret_access_key: Required[str] + """Secret access key for the S3 account. Masked as `SECRET_VALUE` in responses. + + Restrictions: + + - Latin letters (A-Z, a-z), numbers (0-9), pluses, slashes, dashes, colons and + underscores. + - From 16 to 255 characters. + """ + + s3_type: Required[Literal["amazon", "other"]] + """Storage type compatible with S3. + + Possible values: + + - **amazon** - AWS S3 storage. + - **other** - Other (not AWS) S3 compatible storage. + """ + + s3_auth_type: str + """S3 authentication type.""" + + s3_region: Optional[str] + """S3 storage region. + + The parameter is required if `s3_type` is `amazon`. + """ + + s3_storage_hostname: Optional[str] + """S3 storage hostname. + + The parameter is required if `s3_type` is `other`. + """ + + +class NoneAuthSourceChangeS3Source(TypedDict, total=False): + config: Required[NoneAuthSourceChangeS3SourceConfig] + """S3 storage configuration. Required when `origin_type` is `s3`.""" + + backup: bool + """ + Defines whether the origin is a backup, meaning that it will not be used until + one of active origins become unavailable. + + Possible values: + + - **true** - Origin is a backup. + - **false** - Origin is not a backup. + """ + + enabled: bool + """Enables or disables an origin source in the origin group. + + Possible values: + + - **true** - Origin is enabled and the CDN uses it to pull content. + - **false** - Origin is disabled and the CDN does not use it to pull content. + + Origin group must contain at least one enabled origin. + """ + + host_header_override: Optional[str] + """Per-origin Host header override. + + When set, the CDN sends this value as the Host header when requesting content + from this origin instead of the default. + """ + + origin_type: Literal["host", "s3"] + """Origin type. Present in responses only for S3 sources. + + Possible values: + + - **host** - A source server or endpoint from which content is fetched. + - **s3** - S3 storage with either AWS v4 authentication or public access. + """ + + tag: str + """Tag for the origin source.""" + + +NoneAuthSource: TypeAlias = Union[NoneAuthSourceChangeHostSource, NoneAuthSourceChangeS3Source] class AwsSignatureV4(TypedDict, total=False): @@ -149,12 +266,7 @@ class AwsSignatureV4Auth(TypedDict, total=False): """ s3_bucket_name: Required[str] - """S3 bucket name. - - Restrictions: - - - Maximum 128 characters. - """ + """S3 bucket name.""" s3_secret_access_key: Required[str] """Secret access key for the S3 account. diff --git a/src/gcore/types/cdn/origin_group_update_params.py b/src/gcore/types/cdn/origin_group_update_params.py index 1b4efd18..39593b45 100644 --- a/src/gcore/types/cdn/origin_group_update_params.py +++ b/src/gcore/types/cdn/origin_group_update_params.py @@ -2,12 +2,21 @@ from __future__ import annotations -from typing import Union, Iterable -from typing_extensions import Required, TypeAlias, TypedDict +from typing import Union, Iterable, Optional +from typing_extensions import Literal, Required, TypeAlias, TypedDict from ..._types import SequenceNotStr -__all__ = ["OriginGroupUpdateParams", "NoneAuth", "NoneAuthSource", "AwsSignatureV4", "AwsSignatureV4Auth"] +__all__ = [ + "OriginGroupUpdateParams", + "NoneAuth", + "NoneAuthSource", + "NoneAuthSourceChangeHostSource", + "NoneAuthSourceChangeS3Source", + "NoneAuthSourceChangeS3SourceConfig", + "AwsSignatureV4", + "AwsSignatureV4Auth", +] class NoneAuth(TypedDict, total=False): @@ -46,7 +55,6 @@ class NoneAuth(TypedDict, total=False): """ sources: Iterable[NoneAuthSource] - """List of origin sources in the origin group.""" use_next: bool """ @@ -61,7 +69,10 @@ class NoneAuth(TypedDict, total=False): """ -class NoneAuthSource(TypedDict, total=False): +class NoneAuthSourceChangeHostSource(TypedDict, total=False): + source: Required[str] + """IP address or domain name of the origin and the port, if custom port is used.""" + backup: bool """ Defines whether the origin is a backup, meaning that it will not be used until @@ -84,8 +95,114 @@ class NoneAuthSource(TypedDict, total=False): Origin group must contain at least one enabled origin. """ - source: str - """IP address or domain name of the origin and the port, if custom port is used.""" + host_header_override: Optional[str] + """Per-origin Host header override. + + When set, the CDN sends this value as the Host header when requesting content + from this origin instead of the default. + """ + + tag: str + """Tag for the origin source.""" + + +class NoneAuthSourceChangeS3SourceConfig(TypedDict, total=False): + """S3 storage configuration. Required when `origin_type` is `s3`.""" + + s3_access_key_id: Required[str] + """Access key ID for the S3 account. Masked as `SECRET_VALUE` in responses. + + Restrictions: + + - Latin letters (A-Z, a-z), numbers (0-9), colon, dash, and underscore. + - From 4 to 255 characters. + """ + + s3_bucket_name: Required[str] + """S3 bucket name.""" + + s3_secret_access_key: Required[str] + """Secret access key for the S3 account. Masked as `SECRET_VALUE` in responses. + + Restrictions: + + - Latin letters (A-Z, a-z), numbers (0-9), pluses, slashes, dashes, colons and + underscores. + - From 16 to 255 characters. + """ + + s3_type: Required[Literal["amazon", "other"]] + """Storage type compatible with S3. + + Possible values: + + - **amazon** - AWS S3 storage. + - **other** - Other (not AWS) S3 compatible storage. + """ + + s3_auth_type: str + """S3 authentication type.""" + + s3_region: Optional[str] + """S3 storage region. + + The parameter is required if `s3_type` is `amazon`. + """ + + s3_storage_hostname: Optional[str] + """S3 storage hostname. + + The parameter is required if `s3_type` is `other`. + """ + + +class NoneAuthSourceChangeS3Source(TypedDict, total=False): + config: Required[NoneAuthSourceChangeS3SourceConfig] + """S3 storage configuration. Required when `origin_type` is `s3`.""" + + backup: bool + """ + Defines whether the origin is a backup, meaning that it will not be used until + one of active origins become unavailable. + + Possible values: + + - **true** - Origin is a backup. + - **false** - Origin is not a backup. + """ + + enabled: bool + """Enables or disables an origin source in the origin group. + + Possible values: + + - **true** - Origin is enabled and the CDN uses it to pull content. + - **false** - Origin is disabled and the CDN does not use it to pull content. + + Origin group must contain at least one enabled origin. + """ + + host_header_override: Optional[str] + """Per-origin Host header override. + + When set, the CDN sends this value as the Host header when requesting content + from this origin instead of the default. + """ + + origin_type: Literal["host", "s3"] + """Origin type. Present in responses only for S3 sources. + + Possible values: + + - **host** - A source server or endpoint from which content is fetched. + - **s3** - S3 storage with either AWS v4 authentication or public access. + """ + + tag: str + """Tag for the origin source.""" + + +NoneAuthSource: TypeAlias = Union[NoneAuthSourceChangeHostSource, NoneAuthSourceChangeS3Source] class AwsSignatureV4(TypedDict, total=False): @@ -149,12 +266,7 @@ class AwsSignatureV4Auth(TypedDict, total=False): """ s3_bucket_name: Required[str] - """S3 bucket name. - - Restrictions: - - - Maximum 128 characters. - """ + """S3 bucket name.""" s3_secret_access_key: Required[str] """Secret access key for the S3 account. diff --git a/src/gcore/types/cdn/origin_groups.py b/src/gcore/types/cdn/origin_groups.py index 863ea739..4bf02eb8 100644 --- a/src/gcore/types/cdn/origin_groups.py +++ b/src/gcore/types/cdn/origin_groups.py @@ -1,14 +1,28 @@ # File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. from typing import List, Union, Optional -from typing_extensions import TypeAlias +from typing_extensions import Literal, TypeAlias from ..._models import BaseModel -__all__ = ["OriginGroups", "NoneAuth", "NoneAuthSource", "AwsSignatureV4", "AwsSignatureV4Auth"] +__all__ = [ + "OriginGroups", + "NoneAuth", + "NoneAuthSource", + "NoneAuthSourceHostSourceResponse", + "NoneAuthSourceS3SourceResponse", + "NoneAuthSourceS3SourceResponseConfig", + "AwsSignatureV4", + "AwsSignatureV4Auth", +] -class NoneAuthSource(BaseModel): +class NoneAuthSourceHostSourceResponse(BaseModel): + """A host origin source.""" + + source: str + """IP address or domain name of the origin and the port, if custom port is used.""" + backup: Optional[bool] = None """ Defines whether the origin is a backup, meaning that it will not be used until @@ -31,14 +45,139 @@ class NoneAuthSource(BaseModel): Origin group must contain at least one enabled origin. """ - source: Optional[str] = None - """IP address or domain name of the origin and the port, if custom port is used.""" + host_header_override: Optional[str] = None + """Per-origin Host header override. + + When set, the CDN sends this value as the Host header when requesting content + from this origin instead of the default. + """ + + tag: Optional[str] = None + """Tag for the origin source.""" + + +class NoneAuthSourceS3SourceResponseConfig(BaseModel): + """S3 storage configuration. Required when `origin_type` is `s3`.""" + + s3_access_key_id: str + """Access key ID for the S3 account. Masked as `SECRET_VALUE` in responses. + + Restrictions: + + - Latin letters (A-Z, a-z), numbers (0-9), colon, dash, and underscore. + - From 4 to 255 characters. + """ + + s3_bucket_name: str + """S3 bucket name.""" + + s3_secret_access_key: str + """Secret access key for the S3 account. Masked as `SECRET_VALUE` in responses. + + Restrictions: + + - Latin letters (A-Z, a-z), numbers (0-9), pluses, slashes, dashes, colons and + underscores. + - From 16 to 255 characters. + """ + + s3_type: Literal["amazon", "other"] + """Storage type compatible with S3. + + Possible values: + + - **amazon** - AWS S3 storage. + - **other** - Other (not AWS) S3 compatible storage. + """ + + s3_auth_type: Optional[str] = None + """S3 authentication type.""" + + s3_region: Optional[str] = None + """S3 storage region. + + The parameter is required if `s3_type` is `amazon`. + """ + + s3_storage_hostname: Optional[str] = None + """S3 storage hostname. + + The parameter is required if `s3_type` is `other`. + """ + + +class NoneAuthSourceS3SourceResponse(BaseModel): + """An S3 origin source.""" + + config: NoneAuthSourceS3SourceResponseConfig + """S3 storage configuration. Required when `origin_type` is `s3`.""" + + origin_type: Literal["host", "s3"] + """Origin type. Present in responses only for S3 sources. + + Possible values: + + - **host** - A source server or endpoint from which content is fetched. + - **s3** - S3 storage with either AWS v4 authentication or public access. + """ + + backup: Optional[bool] = None + """ + Defines whether the origin is a backup, meaning that it will not be used until + one of active origins become unavailable. + + Possible values: + + - **true** - Origin is a backup. + - **false** - Origin is not a backup. + """ + + enabled: Optional[bool] = None + """Enables or disables an origin source in the origin group. + + Possible values: + + - **true** - Origin is enabled and the CDN uses it to pull content. + - **false** - Origin is disabled and the CDN does not use it to pull content. + + Origin group must contain at least one enabled origin. + """ + + host_header_override: Optional[str] = None + """Per-origin Host header override. + + When set, the CDN sends this value as the Host header when requesting content + from this origin instead of the default. + """ + + tag: Optional[str] = None + """Tag for the origin source.""" + + +NoneAuthSource: TypeAlias = Union[NoneAuthSourceHostSourceResponse, NoneAuthSourceS3SourceResponse] class NoneAuth(BaseModel): - id: Optional[int] = None + """ + Origin group with host origins, or mixed host and S3 origins using inline `origin_type` and `config` in sources. + """ + + id: int """Origin group ID.""" + name: str + """Origin group name.""" + + sources: List[NoneAuthSource] + """List of origin sources in the origin group. + + Each entry can be a host origin or an S3 origin. + + Host origins have a `source` field with the hostname or IP. S3 origins have + `origin_type: s3` and a `config` object with S3 credentials. Both types can be + mixed in the same origin group. + """ + auth_type: Optional[str] = None """Origin authentication type. @@ -57,9 +196,6 @@ class NoneAuth(BaseModel): - **false** - Origin group does not have related CDN resources. """ - name: Optional[str] = None - """Origin group name.""" - path: Optional[str] = None """Parameter is **deprecated**.""" @@ -82,9 +218,6 @@ class NoneAuth(BaseModel): - **`http_504`** - a origin returned a response with the code 504 """ - sources: Optional[List[NoneAuthSource]] = None - """List of origin sources in the origin group.""" - use_next: Optional[bool] = None """ Defines whether to use the next origin from the origin group if origin responds @@ -111,12 +244,7 @@ class AwsSignatureV4Auth(BaseModel): """ s3_bucket_name: str - """S3 bucket name. - - Restrictions: - - - Maximum 128 characters. - """ + """S3 bucket name.""" s3_secret_access_key: str """Secret access key for the S3 account. @@ -152,18 +280,21 @@ class AwsSignatureV4Auth(BaseModel): class AwsSignatureV4(BaseModel): - id: Optional[int] = None + id: int """Origin group ID.""" - auth: Optional[AwsSignatureV4Auth] = None + auth: AwsSignatureV4Auth """Credentials to access the private bucket.""" - auth_type: Optional[str] = None + auth_type: str """Authentication type. **awsSignatureV4** value is used for S3 storage. """ + name: str + """Origin group name.""" + has_related_resources: Optional[bool] = None """Defines whether the origin group has related CDN resources. @@ -173,9 +304,6 @@ class AwsSignatureV4(BaseModel): - **false** - Origin group does not have related CDN resources. """ - name: Optional[str] = None - """Origin group name.""" - path: Optional[str] = None """Parameter is **deprecated**.""" diff --git a/src/gcore/types/cdn/origin_groups_list.py b/src/gcore/types/cdn/origin_groups_list.py index 248241d2..d1944ef9 100644 --- a/src/gcore/types/cdn/origin_groups_list.py +++ b/src/gcore/types/cdn/origin_groups_list.py @@ -1,10 +1,25 @@ # File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. -from typing import List +from typing import List, Union, Optional from typing_extensions import TypeAlias +from ..._models import BaseModel from .origin_groups import OriginGroups -__all__ = ["OriginGroupsList"] +__all__ = ["OriginGroupsList", "PaginatedList"] -OriginGroupsList: TypeAlias = List[OriginGroups] + +class PaginatedList(BaseModel): + count: int + """Total number of items.""" + + next: Optional[str] = None + """URL to the next page of results. Null if current page is the last one.""" + + previous: Optional[str] = None + """URL to the previous page of results. Null if current page is the first one.""" + + results: List[OriginGroups] + + +OriginGroupsList: TypeAlias = Union[List[OriginGroups], PaginatedList] diff --git a/src/gcore/types/cdn/rule_template_list.py b/src/gcore/types/cdn/rule_template_list.py index 7d194b4f..67803c82 100644 --- a/src/gcore/types/cdn/rule_template_list.py +++ b/src/gcore/types/cdn/rule_template_list.py @@ -1,10 +1,25 @@ # File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. -from typing import List +from typing import List, Union, Optional from typing_extensions import TypeAlias +from ..._models import BaseModel from .rule_template import RuleTemplate -__all__ = ["RuleTemplateList"] +__all__ = ["RuleTemplateList", "PaginatedList"] -RuleTemplateList: TypeAlias = List[RuleTemplate] + +class PaginatedList(BaseModel): + count: int + """Total number of items.""" + + next: Optional[str] = None + """URL to the next page of results. Null if current page is the last one.""" + + previous: Optional[str] = None + """URL to the previous page of results. Null if current page is the first one.""" + + results: List[RuleTemplate] + + +RuleTemplateList: TypeAlias = Union[List[RuleTemplate], PaginatedList] diff --git a/src/gcore/types/cdn/rule_template_list_params.py b/src/gcore/types/cdn/rule_template_list_params.py new file mode 100644 index 00000000..162f86f5 --- /dev/null +++ b/src/gcore/types/cdn/rule_template_list_params.py @@ -0,0 +1,15 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from __future__ import annotations + +from typing_extensions import TypedDict + +__all__ = ["RuleTemplateListParams"] + + +class RuleTemplateListParams(TypedDict, total=False): + limit: int + """Maximum number of items to return in the response. Cannot exceed 1000.""" + + offset: int + """Number of items to skip from the beginning of the list.""" diff --git a/src/gcore/types/cdn/shield_list_params.py b/src/gcore/types/cdn/shield_list_params.py new file mode 100644 index 00000000..1e5928fc --- /dev/null +++ b/src/gcore/types/cdn/shield_list_params.py @@ -0,0 +1,15 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from __future__ import annotations + +from typing_extensions import TypedDict + +__all__ = ["ShieldListParams"] + + +class ShieldListParams(TypedDict, total=False): + limit: int + """Maximum number of items to return in the response. Cannot exceed 1000.""" + + offset: int + """Number of items to skip from the beginning of the list.""" diff --git a/src/gcore/types/cdn/shield_list_response.py b/src/gcore/types/cdn/shield_list_response.py index 4449e462..6956cf1e 100644 --- a/src/gcore/types/cdn/shield_list_response.py +++ b/src/gcore/types/cdn/shield_list_response.py @@ -1,14 +1,13 @@ # File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. -from typing import List, Optional -from typing_extensions import TypeAlias +from typing import Optional from ..._models import BaseModel -__all__ = ["ShieldListResponse", "ShieldListResponseItem"] +__all__ = ["ShieldListResponse"] -class ShieldListResponseItem(BaseModel): +class ShieldListResponse(BaseModel): id: Optional[int] = None """Origin shielding location ID.""" @@ -20,6 +19,3 @@ class ShieldListResponseItem(BaseModel): datacenter: Optional[str] = None """Name of origin shielding location datacenter.""" - - -ShieldListResponse: TypeAlias = List[ShieldListResponseItem] diff --git a/src/gcore/types/cdn/ssl_detail_list.py b/src/gcore/types/cdn/ssl_detail_list.py index 8a6a991b..cb1c87d0 100644 --- a/src/gcore/types/cdn/ssl_detail_list.py +++ b/src/gcore/types/cdn/ssl_detail_list.py @@ -1,10 +1,25 @@ # File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. -from typing import List +from typing import List, Union, Optional from typing_extensions import TypeAlias +from ..._models import BaseModel from .ssl_detail import SslDetail -__all__ = ["SslDetailList"] +__all__ = ["SslDetailList", "PaginatedList"] -SslDetailList: TypeAlias = List[SslDetail] + +class PaginatedList(BaseModel): + count: int + """Total number of items.""" + + next: Optional[str] = None + """URL to the next page of results. Null if current page is the last one.""" + + previous: Optional[str] = None + """URL to the previous page of results. Null if current page is the first one.""" + + results: List[SslDetail] + + +SslDetailList: TypeAlias = Union[List[SslDetail], PaginatedList] diff --git a/src/gcore/types/cdn/trusted_ca_certificate_list_params.py b/src/gcore/types/cdn/trusted_ca_certificate_list_params.py index 468e9a37..8c19772b 100644 --- a/src/gcore/types/cdn/trusted_ca_certificate_list_params.py +++ b/src/gcore/types/cdn/trusted_ca_certificate_list_params.py @@ -17,6 +17,12 @@ class TrustedCaCertificateListParams(TypedDict, total=False): - **false** – Certificate was added by a user. """ + limit: int + """Maximum number of items to return in the response. Cannot exceed 1000.""" + + offset: int + """Number of items to skip from the beginning of the list.""" + resource_id: int """CDN resource ID for which the certificates are requested.""" diff --git a/src/gcore/types/fastedge/app.py b/src/gcore/types/fastedge/app.py index ea6ff027..a4fa9504 100644 --- a/src/gcore/types/fastedge/app.py +++ b/src/gcore/types/fastedge/app.py @@ -52,11 +52,6 @@ class App(BaseModel): """Environment variables""" log: Optional[Literal["kafka", "none"]] = None - """Logging channel. - - Use 'kafka' to enable log collection (queryable via API), or 'none' to disable - logging. - """ name: Optional[str] = None """Unique application name (alphanumeric, hyphens allowed)""" diff --git a/src/gcore/types/fastedge/app_create_params.py b/src/gcore/types/fastedge/app_create_params.py index 53b9a0b1..337cfe20 100644 --- a/src/gcore/types/fastedge/app_create_params.py +++ b/src/gcore/types/fastedge/app_create_params.py @@ -25,11 +25,6 @@ class AppCreateParams(TypedDict, total=False): """Environment variables""" log: Optional[Literal["kafka", "none"]] - """Logging channel. - - Use 'kafka' to enable log collection (queryable via API), or 'none' to disable - logging. - """ name: str """Unique application name (alphanumeric, hyphens allowed)""" diff --git a/src/gcore/types/fastedge/app_param.py b/src/gcore/types/fastedge/app_param.py index 22f917ab..d9df67dc 100644 --- a/src/gcore/types/fastedge/app_param.py +++ b/src/gcore/types/fastedge/app_param.py @@ -39,11 +39,6 @@ class AppParam(TypedDict, total=False): """Environment variables""" log: Optional[Literal["kafka", "none"]] - """Logging channel. - - Use 'kafka' to enable log collection (queryable via API), or 'none' to disable - logging. - """ name: str """Unique application name (alphanumeric, hyphens allowed)""" diff --git a/src/gcore/types/fastedge/app_update_params.py b/src/gcore/types/fastedge/app_update_params.py index 999c134b..8b383027 100644 --- a/src/gcore/types/fastedge/app_update_params.py +++ b/src/gcore/types/fastedge/app_update_params.py @@ -25,11 +25,6 @@ class AppUpdateParams(TypedDict, total=False): """Environment variables""" log: Optional[Literal["kafka", "none"]] - """Logging channel. - - Use 'kafka' to enable log collection (queryable via API), or 'none' to disable - logging. - """ name: str """Unique application name (alphanumeric, hyphens allowed)""" diff --git a/src/gcore/types/fastedge/apps/log.py b/src/gcore/types/fastedge/apps/log.py index ddfee5b1..f609e716 100644 --- a/src/gcore/types/fastedge/apps/log.py +++ b/src/gcore/types/fastedge/apps/log.py @@ -24,5 +24,8 @@ class Log(BaseModel): log: Optional[str] = None """The actual log message content""" + request_id: Optional[str] = None + """Request ID""" + timestamp: Optional[datetime] = None """When the log was generated (RFC3339 format)""" diff --git a/src/gcore/types/fastedge/apps/log_list_params.py b/src/gcore/types/fastedge/apps/log_list_params.py index 059cc1e9..71712f98 100644 --- a/src/gcore/types/fastedge/apps/log_list_params.py +++ b/src/gcore/types/fastedge/apps/log_list_params.py @@ -13,7 +13,7 @@ class LogListParams(TypedDict, total=False): client_ip: str - """Search by client IP""" + """Search by client IP address""" edge: str """Edge name""" @@ -30,6 +30,9 @@ class LogListParams(TypedDict, total=False): offset: int """Offset for pagination""" + request_id: str + """Search by request ID""" + search: str """Search string""" diff --git a/tests/api_resources/cdn/cdn_resources/test_rules.py b/tests/api_resources/cdn/cdn_resources/test_rules.py index 7cb0d490..0fb4027d 100644 --- a/tests/api_resources/cdn/cdn_resources/test_rules.py +++ b/tests/api_resources/cdn/cdn_resources/test_rules.py @@ -9,9 +9,9 @@ from gcore import Gcore, AsyncGcore from tests.utils import assert_matches_type +from gcore.pagination import SyncOffsetPage, AsyncOffsetPage from gcore.types.cdn.cdn_resources import ( CDNResourceRule, - CDNResourceRuleList, ) base_url = os.environ.get("TEST_API_BASE_URL", "http://127.0.0.1:4010") @@ -656,31 +656,40 @@ def test_streaming_response_update(self, client: Gcore) -> None: @parametrize def test_method_list(self, client: Gcore) -> None: rule = client.cdn.cdn_resources.rules.list( - 0, + resource_id=0, + ) + assert_matches_type(SyncOffsetPage[CDNResourceRule], rule, path=["response"]) + + @parametrize + def test_method_list_with_all_params(self, client: Gcore) -> None: + rule = client.cdn.cdn_resources.rules.list( + resource_id=0, + limit=1, + offset=0, ) - assert_matches_type(CDNResourceRuleList, rule, path=["response"]) + assert_matches_type(SyncOffsetPage[CDNResourceRule], rule, path=["response"]) @parametrize def test_raw_response_list(self, client: Gcore) -> None: response = client.cdn.cdn_resources.rules.with_raw_response.list( - 0, + resource_id=0, ) assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" rule = response.parse() - assert_matches_type(CDNResourceRuleList, rule, path=["response"]) + assert_matches_type(SyncOffsetPage[CDNResourceRule], rule, path=["response"]) @parametrize def test_streaming_response_list(self, client: Gcore) -> None: with client.cdn.cdn_resources.rules.with_streaming_response.list( - 0, + resource_id=0, ) as response: assert not response.is_closed assert response.http_request.headers.get("X-Stainless-Lang") == "python" rule = response.parse() - assert_matches_type(CDNResourceRuleList, rule, path=["response"]) + assert_matches_type(SyncOffsetPage[CDNResourceRule], rule, path=["response"]) assert cast(Any, response.is_closed) is True @@ -1714,31 +1723,40 @@ async def test_streaming_response_update(self, async_client: AsyncGcore) -> None @parametrize async def test_method_list(self, async_client: AsyncGcore) -> None: rule = await async_client.cdn.cdn_resources.rules.list( - 0, + resource_id=0, + ) + assert_matches_type(AsyncOffsetPage[CDNResourceRule], rule, path=["response"]) + + @parametrize + async def test_method_list_with_all_params(self, async_client: AsyncGcore) -> None: + rule = await async_client.cdn.cdn_resources.rules.list( + resource_id=0, + limit=1, + offset=0, ) - assert_matches_type(CDNResourceRuleList, rule, path=["response"]) + assert_matches_type(AsyncOffsetPage[CDNResourceRule], rule, path=["response"]) @parametrize async def test_raw_response_list(self, async_client: AsyncGcore) -> None: response = await async_client.cdn.cdn_resources.rules.with_raw_response.list( - 0, + resource_id=0, ) assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" rule = await response.parse() - assert_matches_type(CDNResourceRuleList, rule, path=["response"]) + assert_matches_type(AsyncOffsetPage[CDNResourceRule], rule, path=["response"]) @parametrize async def test_streaming_response_list(self, async_client: AsyncGcore) -> None: async with async_client.cdn.cdn_resources.rules.with_streaming_response.list( - 0, + resource_id=0, ) as response: assert not response.is_closed assert response.http_request.headers.get("X-Stainless-Lang") == "python" rule = await response.parse() - assert_matches_type(CDNResourceRuleList, rule, path=["response"]) + assert_matches_type(AsyncOffsetPage[CDNResourceRule], rule, path=["response"]) assert cast(Any, response.is_closed) is True diff --git a/tests/api_resources/cdn/logs_uploader/test_configs.py b/tests/api_resources/cdn/logs_uploader/test_configs.py index 77fc82eb..713edd4c 100644 --- a/tests/api_resources/cdn/logs_uploader/test_configs.py +++ b/tests/api_resources/cdn/logs_uploader/test_configs.py @@ -122,6 +122,8 @@ def test_method_list(self, client: Gcore) -> None: @parametrize def test_method_list_with_all_params(self, client: Gcore) -> None: config = client.cdn.logs_uploader.configs.list( + limit=1, + offset=0, resource_ids=[0], search="search", ) @@ -400,6 +402,8 @@ async def test_method_list(self, async_client: AsyncGcore) -> None: @parametrize async def test_method_list_with_all_params(self, async_client: AsyncGcore) -> None: config = await async_client.cdn.logs_uploader.configs.list( + limit=1, + offset=0, resource_ids=[0], search="search", ) diff --git a/tests/api_resources/cdn/logs_uploader/test_policies.py b/tests/api_resources/cdn/logs_uploader/test_policies.py index 249b03cc..d3f7cb3f 100644 --- a/tests/api_resources/cdn/logs_uploader/test_policies.py +++ b/tests/api_resources/cdn/logs_uploader/test_policies.py @@ -133,6 +133,8 @@ def test_method_list(self, client: Gcore) -> None: def test_method_list_with_all_params(self, client: Gcore) -> None: policy = client.cdn.logs_uploader.policies.list( config_ids=[0], + limit=1, + offset=0, search="search", ) assert_matches_type(LogsUploaderPolicyList, policy, path=["response"]) @@ -417,6 +419,8 @@ async def test_method_list(self, async_client: AsyncGcore) -> None: async def test_method_list_with_all_params(self, async_client: AsyncGcore) -> None: policy = await async_client.cdn.logs_uploader.policies.list( config_ids=[0], + limit=1, + offset=0, search="search", ) assert_matches_type(LogsUploaderPolicyList, policy, path=["response"]) diff --git a/tests/api_resources/cdn/logs_uploader/test_targets.py b/tests/api_resources/cdn/logs_uploader/test_targets.py index 3cea5248..2f7577df 100644 --- a/tests/api_resources/cdn/logs_uploader/test_targets.py +++ b/tests/api_resources/cdn/logs_uploader/test_targets.py @@ -150,6 +150,8 @@ def test_method_list(self, client: Gcore) -> None: def test_method_list_with_all_params(self, client: Gcore) -> None: target = client.cdn.logs_uploader.targets.list( config_ids=[0], + limit=1, + offset=0, search="search", ) assert_matches_type(LogsUploaderTargetList, target, path=["response"]) @@ -476,6 +478,8 @@ async def test_method_list(self, async_client: AsyncGcore) -> None: async def test_method_list_with_all_params(self, async_client: AsyncGcore) -> None: target = await async_client.cdn.logs_uploader.targets.list( config_ids=[0], + limit=1, + offset=0, search="search", ) assert_matches_type(LogsUploaderTargetList, target, path=["response"]) diff --git a/tests/api_resources/cdn/test_cdn_resources.py b/tests/api_resources/cdn/test_cdn_resources.py index 44b3ac8b..5ac9ab6a 100644 --- a/tests/api_resources/cdn/test_cdn_resources.py +++ b/tests/api_resources/cdn/test_cdn_resources.py @@ -714,8 +714,10 @@ def test_method_list_with_all_params(self, client: Gcore) -> None: cname="cname", deleted=True, enabled=True, + limit=1, max_created="max_created", min_created="min_created", + offset=0, origin_group=0, rules="rules", secondary_hostnames="secondaryHostnames", @@ -2036,8 +2038,10 @@ async def test_method_list_with_all_params(self, async_client: AsyncGcore) -> No cname="cname", deleted=True, enabled=True, + limit=1, max_created="max_created", min_created="min_created", + offset=0, origin_group=0, rules="rules", secondary_hostnames="secondaryHostnames", diff --git a/tests/api_resources/cdn/test_certificates.py b/tests/api_resources/cdn/test_certificates.py index da6d3aad..d23d5739 100644 --- a/tests/api_resources/cdn/test_certificates.py +++ b/tests/api_resources/cdn/test_certificates.py @@ -111,6 +111,8 @@ def test_method_list(self, client: Gcore) -> None: def test_method_list_with_all_params(self, client: Gcore) -> None: certificate = client.cdn.certificates.list( automated=True, + limit=1, + offset=0, resource_id=0, validity_not_after_lte="validity_not_after_lte", ) @@ -446,6 +448,8 @@ async def test_method_list(self, async_client: AsyncGcore) -> None: async def test_method_list_with_all_params(self, async_client: AsyncGcore) -> None: certificate = await async_client.cdn.certificates.list( automated=True, + limit=1, + offset=0, resource_id=0, validity_not_after_lte="validity_not_after_lte", ) diff --git a/tests/api_resources/cdn/test_origin_groups.py b/tests/api_resources/cdn/test_origin_groups.py index 43dc567c..58a1b94f 100644 --- a/tests/api_resources/cdn/test_origin_groups.py +++ b/tests/api_resources/cdn/test_origin_groups.py @@ -24,7 +24,7 @@ class TestOriginGroups: def test_method_create_overload_1(self, client: Gcore) -> None: origin_group = client.cdn.origin_groups.create( name="YourOriginGroup", - sources=[{}, {}], + sources=[{"source": "yourwebsite.com"}], ) assert_matches_type(OriginGroups, origin_group, path=["response"]) @@ -34,15 +34,12 @@ def test_method_create_with_all_params_overload_1(self, client: Gcore) -> None: name="YourOriginGroup", sources=[ { - "backup": False, - "enabled": True, "source": "yourwebsite.com", - }, - { - "backup": True, + "backup": False, "enabled": True, - "source": "1.2.3.4:5500", - }, + "host_header_override": None, + "tag": "default", + } ], auth_type="none", proxy_next_upstream=["error", "timeout", "invalid_header", "http_500", "http_502", "http_503", "http_504"], @@ -54,7 +51,7 @@ def test_method_create_with_all_params_overload_1(self, client: Gcore) -> None: def test_raw_response_create_overload_1(self, client: Gcore) -> None: response = client.cdn.origin_groups.with_raw_response.create( name="YourOriginGroup", - sources=[{}, {}], + sources=[{"source": "yourwebsite.com"}], ) assert response.is_closed is True @@ -66,7 +63,7 @@ def test_raw_response_create_overload_1(self, client: Gcore) -> None: def test_streaming_response_create_overload_1(self, client: Gcore) -> None: with client.cdn.origin_groups.with_streaming_response.create( name="YourOriginGroup", - sources=[{}, {}], + sources=[{"source": "yourwebsite.com"}], ) as response: assert not response.is_closed assert response.http_request.headers.get("X-Stainless-Lang") == "python" @@ -164,9 +161,11 @@ def test_method_update_with_all_params_overload_1(self, client: Gcore) -> None: proxy_next_upstream=["error", "timeout", "invalid_header", "http_500", "http_502", "http_503", "http_504"], sources=[ { + "source": "yourdomain.com", "backup": False, "enabled": True, - "source": "yourdomain.com", + "host_header_override": None, + "tag": "default", } ], use_next=True, @@ -259,7 +258,9 @@ def test_method_list(self, client: Gcore) -> None: def test_method_list_with_all_params(self, client: Gcore) -> None: origin_group = client.cdn.origin_groups.list( has_related_resources=True, + limit=1, name="name", + offset=0, sources="sources", ) assert_matches_type(OriginGroupsList, origin_group, path=["response"]) @@ -353,7 +354,7 @@ def test_method_replace_overload_1(self, client: Gcore) -> None: auth_type="none", name="YourOriginGroup", path="", - sources=[{}], + sources=[{"source": "yourdomain.com"}], use_next=True, ) assert_matches_type(OriginGroups, origin_group, path=["response"]) @@ -367,9 +368,11 @@ def test_method_replace_with_all_params_overload_1(self, client: Gcore) -> None: path="", sources=[ { + "source": "yourdomain.com", "backup": False, "enabled": True, - "source": "yourdomain.com", + "host_header_override": None, + "tag": "default", } ], use_next=True, @@ -384,7 +387,7 @@ def test_raw_response_replace_overload_1(self, client: Gcore) -> None: auth_type="none", name="YourOriginGroup", path="", - sources=[{}], + sources=[{"source": "yourdomain.com"}], use_next=True, ) @@ -400,7 +403,7 @@ def test_streaming_response_replace_overload_1(self, client: Gcore) -> None: auth_type="none", name="YourOriginGroup", path="", - sources=[{}], + sources=[{"source": "yourdomain.com"}], use_next=True, ) as response: assert not response.is_closed @@ -502,7 +505,7 @@ class TestAsyncOriginGroups: async def test_method_create_overload_1(self, async_client: AsyncGcore) -> None: origin_group = await async_client.cdn.origin_groups.create( name="YourOriginGroup", - sources=[{}, {}], + sources=[{"source": "yourwebsite.com"}], ) assert_matches_type(OriginGroups, origin_group, path=["response"]) @@ -512,15 +515,12 @@ async def test_method_create_with_all_params_overload_1(self, async_client: Asyn name="YourOriginGroup", sources=[ { - "backup": False, - "enabled": True, "source": "yourwebsite.com", - }, - { - "backup": True, + "backup": False, "enabled": True, - "source": "1.2.3.4:5500", - }, + "host_header_override": None, + "tag": "default", + } ], auth_type="none", proxy_next_upstream=["error", "timeout", "invalid_header", "http_500", "http_502", "http_503", "http_504"], @@ -532,7 +532,7 @@ async def test_method_create_with_all_params_overload_1(self, async_client: Asyn async def test_raw_response_create_overload_1(self, async_client: AsyncGcore) -> None: response = await async_client.cdn.origin_groups.with_raw_response.create( name="YourOriginGroup", - sources=[{}, {}], + sources=[{"source": "yourwebsite.com"}], ) assert response.is_closed is True @@ -544,7 +544,7 @@ async def test_raw_response_create_overload_1(self, async_client: AsyncGcore) -> async def test_streaming_response_create_overload_1(self, async_client: AsyncGcore) -> None: async with async_client.cdn.origin_groups.with_streaming_response.create( name="YourOriginGroup", - sources=[{}, {}], + sources=[{"source": "yourwebsite.com"}], ) as response: assert not response.is_closed assert response.http_request.headers.get("X-Stainless-Lang") == "python" @@ -642,9 +642,11 @@ async def test_method_update_with_all_params_overload_1(self, async_client: Asyn proxy_next_upstream=["error", "timeout", "invalid_header", "http_500", "http_502", "http_503", "http_504"], sources=[ { + "source": "yourdomain.com", "backup": False, "enabled": True, - "source": "yourdomain.com", + "host_header_override": None, + "tag": "default", } ], use_next=True, @@ -737,7 +739,9 @@ async def test_method_list(self, async_client: AsyncGcore) -> None: async def test_method_list_with_all_params(self, async_client: AsyncGcore) -> None: origin_group = await async_client.cdn.origin_groups.list( has_related_resources=True, + limit=1, name="name", + offset=0, sources="sources", ) assert_matches_type(OriginGroupsList, origin_group, path=["response"]) @@ -831,7 +835,7 @@ async def test_method_replace_overload_1(self, async_client: AsyncGcore) -> None auth_type="none", name="YourOriginGroup", path="", - sources=[{}], + sources=[{"source": "yourdomain.com"}], use_next=True, ) assert_matches_type(OriginGroups, origin_group, path=["response"]) @@ -845,9 +849,11 @@ async def test_method_replace_with_all_params_overload_1(self, async_client: Asy path="", sources=[ { + "source": "yourdomain.com", "backup": False, "enabled": True, - "source": "yourdomain.com", + "host_header_override": None, + "tag": "default", } ], use_next=True, @@ -862,7 +868,7 @@ async def test_raw_response_replace_overload_1(self, async_client: AsyncGcore) - auth_type="none", name="YourOriginGroup", path="", - sources=[{}], + sources=[{"source": "yourdomain.com"}], use_next=True, ) @@ -878,7 +884,7 @@ async def test_streaming_response_replace_overload_1(self, async_client: AsyncGc auth_type="none", name="YourOriginGroup", path="", - sources=[{}], + sources=[{"source": "yourdomain.com"}], use_next=True, ) as response: assert not response.is_closed diff --git a/tests/api_resources/cdn/test_rule_templates.py b/tests/api_resources/cdn/test_rule_templates.py index e7d8cb23..0457f565 100644 --- a/tests/api_resources/cdn/test_rule_templates.py +++ b/tests/api_resources/cdn/test_rule_templates.py @@ -11,8 +11,8 @@ from tests.utils import assert_matches_type from gcore.types.cdn import ( RuleTemplate, - RuleTemplateList, ) +from gcore.pagination import SyncOffsetPage, AsyncOffsetPage base_url = os.environ.get("TEST_API_BASE_URL", "http://127.0.0.1:4010") @@ -641,7 +641,15 @@ def test_streaming_response_update(self, client: Gcore) -> None: @parametrize def test_method_list(self, client: Gcore) -> None: rule_template = client.cdn.rule_templates.list() - assert_matches_type(RuleTemplateList, rule_template, path=["response"]) + assert_matches_type(SyncOffsetPage[RuleTemplate], rule_template, path=["response"]) + + @parametrize + def test_method_list_with_all_params(self, client: Gcore) -> None: + rule_template = client.cdn.rule_templates.list( + limit=1, + offset=0, + ) + assert_matches_type(SyncOffsetPage[RuleTemplate], rule_template, path=["response"]) @parametrize def test_raw_response_list(self, client: Gcore) -> None: @@ -650,7 +658,7 @@ def test_raw_response_list(self, client: Gcore) -> None: assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" rule_template = response.parse() - assert_matches_type(RuleTemplateList, rule_template, path=["response"]) + assert_matches_type(SyncOffsetPage[RuleTemplate], rule_template, path=["response"]) @parametrize def test_streaming_response_list(self, client: Gcore) -> None: @@ -659,7 +667,7 @@ def test_streaming_response_list(self, client: Gcore) -> None: assert response.http_request.headers.get("X-Stainless-Lang") == "python" rule_template = response.parse() - assert_matches_type(RuleTemplateList, rule_template, path=["response"]) + assert_matches_type(SyncOffsetPage[RuleTemplate], rule_template, path=["response"]) assert cast(Any, response.is_closed) is True @@ -1666,7 +1674,15 @@ async def test_streaming_response_update(self, async_client: AsyncGcore) -> None @parametrize async def test_method_list(self, async_client: AsyncGcore) -> None: rule_template = await async_client.cdn.rule_templates.list() - assert_matches_type(RuleTemplateList, rule_template, path=["response"]) + assert_matches_type(AsyncOffsetPage[RuleTemplate], rule_template, path=["response"]) + + @parametrize + async def test_method_list_with_all_params(self, async_client: AsyncGcore) -> None: + rule_template = await async_client.cdn.rule_templates.list( + limit=1, + offset=0, + ) + assert_matches_type(AsyncOffsetPage[RuleTemplate], rule_template, path=["response"]) @parametrize async def test_raw_response_list(self, async_client: AsyncGcore) -> None: @@ -1675,7 +1691,7 @@ async def test_raw_response_list(self, async_client: AsyncGcore) -> None: assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" rule_template = await response.parse() - assert_matches_type(RuleTemplateList, rule_template, path=["response"]) + assert_matches_type(AsyncOffsetPage[RuleTemplate], rule_template, path=["response"]) @parametrize async def test_streaming_response_list(self, async_client: AsyncGcore) -> None: @@ -1684,7 +1700,7 @@ async def test_streaming_response_list(self, async_client: AsyncGcore) -> None: assert response.http_request.headers.get("X-Stainless-Lang") == "python" rule_template = await response.parse() - assert_matches_type(RuleTemplateList, rule_template, path=["response"]) + assert_matches_type(AsyncOffsetPage[RuleTemplate], rule_template, path=["response"]) assert cast(Any, response.is_closed) is True diff --git a/tests/api_resources/cdn/test_shields.py b/tests/api_resources/cdn/test_shields.py index 0600aa49..f175c08a 100644 --- a/tests/api_resources/cdn/test_shields.py +++ b/tests/api_resources/cdn/test_shields.py @@ -10,6 +10,7 @@ from gcore import Gcore, AsyncGcore from tests.utils import assert_matches_type from gcore.types.cdn import ShieldListResponse +from gcore.pagination import SyncOffsetPage, AsyncOffsetPage base_url = os.environ.get("TEST_API_BASE_URL", "http://127.0.0.1:4010") @@ -20,7 +21,15 @@ class TestShields: @parametrize def test_method_list(self, client: Gcore) -> None: shield = client.cdn.shields.list() - assert_matches_type(ShieldListResponse, shield, path=["response"]) + assert_matches_type(SyncOffsetPage[ShieldListResponse], shield, path=["response"]) + + @parametrize + def test_method_list_with_all_params(self, client: Gcore) -> None: + shield = client.cdn.shields.list( + limit=1, + offset=0, + ) + assert_matches_type(SyncOffsetPage[ShieldListResponse], shield, path=["response"]) @parametrize def test_raw_response_list(self, client: Gcore) -> None: @@ -29,7 +38,7 @@ def test_raw_response_list(self, client: Gcore) -> None: assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" shield = response.parse() - assert_matches_type(ShieldListResponse, shield, path=["response"]) + assert_matches_type(SyncOffsetPage[ShieldListResponse], shield, path=["response"]) @parametrize def test_streaming_response_list(self, client: Gcore) -> None: @@ -38,7 +47,7 @@ def test_streaming_response_list(self, client: Gcore) -> None: assert response.http_request.headers.get("X-Stainless-Lang") == "python" shield = response.parse() - assert_matches_type(ShieldListResponse, shield, path=["response"]) + assert_matches_type(SyncOffsetPage[ShieldListResponse], shield, path=["response"]) assert cast(Any, response.is_closed) is True @@ -51,7 +60,15 @@ class TestAsyncShields: @parametrize async def test_method_list(self, async_client: AsyncGcore) -> None: shield = await async_client.cdn.shields.list() - assert_matches_type(ShieldListResponse, shield, path=["response"]) + assert_matches_type(AsyncOffsetPage[ShieldListResponse], shield, path=["response"]) + + @parametrize + async def test_method_list_with_all_params(self, async_client: AsyncGcore) -> None: + shield = await async_client.cdn.shields.list( + limit=1, + offset=0, + ) + assert_matches_type(AsyncOffsetPage[ShieldListResponse], shield, path=["response"]) @parametrize async def test_raw_response_list(self, async_client: AsyncGcore) -> None: @@ -60,7 +77,7 @@ async def test_raw_response_list(self, async_client: AsyncGcore) -> None: assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" shield = await response.parse() - assert_matches_type(ShieldListResponse, shield, path=["response"]) + assert_matches_type(AsyncOffsetPage[ShieldListResponse], shield, path=["response"]) @parametrize async def test_streaming_response_list(self, async_client: AsyncGcore) -> None: @@ -69,6 +86,6 @@ async def test_streaming_response_list(self, async_client: AsyncGcore) -> None: assert response.http_request.headers.get("X-Stainless-Lang") == "python" shield = await response.parse() - assert_matches_type(ShieldListResponse, shield, path=["response"]) + assert_matches_type(AsyncOffsetPage[ShieldListResponse], shield, path=["response"]) assert cast(Any, response.is_closed) is True diff --git a/tests/api_resources/cdn/test_trusted_ca_certificates.py b/tests/api_resources/cdn/test_trusted_ca_certificates.py index 0d0df832..f3c1fa48 100644 --- a/tests/api_resources/cdn/test_trusted_ca_certificates.py +++ b/tests/api_resources/cdn/test_trusted_ca_certificates.py @@ -63,6 +63,8 @@ def test_method_list(self, client: Gcore) -> None: def test_method_list_with_all_params(self, client: Gcore) -> None: trusted_ca_certificate = client.cdn.trusted_ca_certificates.list( automated=True, + limit=1, + offset=0, resource_id=0, validity_not_after_lte="validity_not_after_lte", ) @@ -233,6 +235,8 @@ async def test_method_list(self, async_client: AsyncGcore) -> None: async def test_method_list_with_all_params(self, async_client: AsyncGcore) -> None: trusted_ca_certificate = await async_client.cdn.trusted_ca_certificates.list( automated=True, + limit=1, + offset=0, resource_id=0, validity_not_after_lte="validity_not_after_lte", ) diff --git a/tests/api_resources/cloud/baremetal/test_servers.py b/tests/api_resources/cloud/baremetal/test_servers.py index b86a277b..a165f795 100644 --- a/tests/api_resources/cloud/baremetal/test_servers.py +++ b/tests/api_resources/cloud/baremetal/test_servers.py @@ -58,7 +58,7 @@ def test_method_create_with_all_params(self, client: Gcore) -> None: } ], }, - image_id="image_id", + image_id="b5b4d65d-945f-4b98-ab6f-332319c724ef", name="my-bare-metal", name_template="name_template", password="password", @@ -422,7 +422,7 @@ async def test_method_create_with_all_params(self, async_client: AsyncGcore) -> } ], }, - image_id="image_id", + image_id="b5b4d65d-945f-4b98-ab6f-332319c724ef", name="my-bare-metal", name_template="name_template", password="password", diff --git a/tests/api_resources/cloud/test_instances.py b/tests/api_resources/cloud/test_instances.py index 30ec9ca0..dd5d7f45 100644 --- a/tests/api_resources/cloud/test_instances.py +++ b/tests/api_resources/cloud/test_instances.py @@ -33,8 +33,8 @@ def test_method_create(self, client: Gcore) -> None: interfaces=[{"type": "external"}], volumes=[ { - "size": 20, - "source": "new-volume", + "image_id": "e460e48c-6836-447e-bc9c-16fc4225d318", + "source": "image", } ], ) @@ -56,11 +56,13 @@ def test_method_create_with_all_params(self, client: Gcore) -> None: ], volumes=[ { - "size": 20, - "source": "new-volume", + "image_id": "e460e48c-6836-447e-bc9c-16fc4225d318", + "source": "image", "attachment_tag": "boot", + "boot_index": 0, "delete_on_termination": False, "name": "boot-volume", + "size": 50, "tags": {"my-tag": "my-tag-value"}, "type_name": "ssd_hiiops", } @@ -88,8 +90,8 @@ def test_raw_response_create(self, client: Gcore) -> None: interfaces=[{"type": "external"}], volumes=[ { - "size": 20, - "source": "new-volume", + "image_id": "e460e48c-6836-447e-bc9c-16fc4225d318", + "source": "image", } ], ) @@ -108,8 +110,8 @@ def test_streaming_response_create(self, client: Gcore) -> None: interfaces=[{"type": "external"}], volumes=[ { - "size": 20, - "source": "new-volume", + "image_id": "e460e48c-6836-447e-bc9c-16fc4225d318", + "source": "image", } ], ) as response: @@ -903,8 +905,8 @@ async def test_method_create(self, async_client: AsyncGcore) -> None: interfaces=[{"type": "external"}], volumes=[ { - "size": 20, - "source": "new-volume", + "image_id": "e460e48c-6836-447e-bc9c-16fc4225d318", + "source": "image", } ], ) @@ -926,11 +928,13 @@ async def test_method_create_with_all_params(self, async_client: AsyncGcore) -> ], volumes=[ { - "size": 20, - "source": "new-volume", + "image_id": "e460e48c-6836-447e-bc9c-16fc4225d318", + "source": "image", "attachment_tag": "boot", + "boot_index": 0, "delete_on_termination": False, "name": "boot-volume", + "size": 50, "tags": {"my-tag": "my-tag-value"}, "type_name": "ssd_hiiops", } @@ -958,8 +962,8 @@ async def test_raw_response_create(self, async_client: AsyncGcore) -> None: interfaces=[{"type": "external"}], volumes=[ { - "size": 20, - "source": "new-volume", + "image_id": "e460e48c-6836-447e-bc9c-16fc4225d318", + "source": "image", } ], ) @@ -978,8 +982,8 @@ async def test_streaming_response_create(self, async_client: AsyncGcore) -> None interfaces=[{"type": "external"}], volumes=[ { - "size": 20, - "source": "new-volume", + "image_id": "e460e48c-6836-447e-bc9c-16fc4225d318", + "source": "image", } ], ) as response: diff --git a/tests/api_resources/fastedge/apps/test_logs.py b/tests/api_resources/fastedge/apps/test_logs.py index a5a1323d..a3ca384f 100644 --- a/tests/api_resources/fastedge/apps/test_logs.py +++ b/tests/api_resources/fastedge/apps/test_logs.py @@ -32,14 +32,15 @@ def test_method_list(self, client: Gcore) -> None: def test_method_list_with_all_params(self, client: Gcore) -> None: log = client.fastedge.apps.logs.list( app_id=0, - client_ip="192.168.1.1", + client_ip="client_ip", edge="edge", - from_=parse_datetime("2019-12-27T18:11:19.117Z"), + from_=parse_datetime("2023-12-31T23:59:59Z"), limit=0, offset=0, + request_id="request_id", search="search", sort="desc", - to=parse_datetime("2019-12-27T18:11:19.117Z"), + to=parse_datetime("2026-01-31T23:59:59Z"), ) assert_matches_type(SyncOffsetPageFastedgeAppLogs[Log], log, path=["response"]) @@ -88,14 +89,15 @@ async def test_method_list(self, async_client: AsyncGcore) -> None: async def test_method_list_with_all_params(self, async_client: AsyncGcore) -> None: log = await async_client.fastedge.apps.logs.list( app_id=0, - client_ip="192.168.1.1", + client_ip="client_ip", edge="edge", - from_=parse_datetime("2019-12-27T18:11:19.117Z"), + from_=parse_datetime("2023-12-31T23:59:59Z"), limit=0, offset=0, + request_id="request_id", search="search", sort="desc", - to=parse_datetime("2019-12-27T18:11:19.117Z"), + to=parse_datetime("2026-01-31T23:59:59Z"), ) assert_matches_type(AsyncOffsetPageFastedgeAppLogs[Log], log, path=["response"]) diff --git a/tests/api_resources/test_cdn.py b/tests/api_resources/test_cdn.py index 153a1094..b2a4de5a 100644 --- a/tests/api_resources/test_cdn.py +++ b/tests/api_resources/test_cdn.py @@ -104,6 +104,14 @@ def test_method_list_alibaba_regions(self, client: Gcore) -> None: cdn = client.cdn.list_alibaba_regions() assert_matches_type(AlibabaRegions, cdn, path=["response"]) + @parametrize + def test_method_list_alibaba_regions_with_all_params(self, client: Gcore) -> None: + cdn = client.cdn.list_alibaba_regions( + limit=1, + offset=0, + ) + assert_matches_type(AlibabaRegions, cdn, path=["response"]) + @parametrize def test_raw_response_list_alibaba_regions(self, client: Gcore) -> None: response = client.cdn.with_raw_response.list_alibaba_regions() @@ -129,6 +137,14 @@ def test_method_list_aws_regions(self, client: Gcore) -> None: cdn = client.cdn.list_aws_regions() assert_matches_type(AwsRegions, cdn, path=["response"]) + @parametrize + def test_method_list_aws_regions_with_all_params(self, client: Gcore) -> None: + cdn = client.cdn.list_aws_regions( + limit=1, + offset=0, + ) + assert_matches_type(AwsRegions, cdn, path=["response"]) + @parametrize def test_raw_response_list_aws_regions(self, client: Gcore) -> None: response = client.cdn.with_raw_response.list_aws_regions() @@ -305,6 +321,14 @@ async def test_method_list_alibaba_regions(self, async_client: AsyncGcore) -> No cdn = await async_client.cdn.list_alibaba_regions() assert_matches_type(AlibabaRegions, cdn, path=["response"]) + @parametrize + async def test_method_list_alibaba_regions_with_all_params(self, async_client: AsyncGcore) -> None: + cdn = await async_client.cdn.list_alibaba_regions( + limit=1, + offset=0, + ) + assert_matches_type(AlibabaRegions, cdn, path=["response"]) + @parametrize async def test_raw_response_list_alibaba_regions(self, async_client: AsyncGcore) -> None: response = await async_client.cdn.with_raw_response.list_alibaba_regions() @@ -330,6 +354,14 @@ async def test_method_list_aws_regions(self, async_client: AsyncGcore) -> None: cdn = await async_client.cdn.list_aws_regions() assert_matches_type(AwsRegions, cdn, path=["response"]) + @parametrize + async def test_method_list_aws_regions_with_all_params(self, async_client: AsyncGcore) -> None: + cdn = await async_client.cdn.list_aws_regions( + limit=1, + offset=0, + ) + assert_matches_type(AwsRegions, cdn, path=["response"]) + @parametrize async def test_raw_response_list_aws_regions(self, async_client: AsyncGcore) -> None: response = await async_client.cdn.with_raw_response.list_aws_regions()