Skip to content

Commit 0d1d290

Browse files
feat(cdn): add methods to list aws and alibaba regions
1 parent 193a257 commit 0d1d290

File tree

8 files changed

+294
-27
lines changed

8 files changed

+294
-27
lines changed

.stats.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
configured_endpoints: 607
1+
configured_endpoints: 609
22
openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/gcore%2Fgcore-56132999d4ac773438df4415a4bb56c8cf7f067c3c340d80424bf968074f66dc.yml
33
openapi_spec_hash: c33cea043ddbfe20778e0774313fa7e6
4-
config_hash: e9817aca06ab90c1d5249560a1a300b8
4+
config_hash: bb4a27712c30f7a2b52e1f3b31766f24

api.md

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2082,15 +2082,25 @@ Methods:
20822082
Types:
20832083

20842084
```python
2085-
from gcore.types.cdn import CdnAccount, CdnAccountLimits, CdnAvailableFeatures, PurgeStatus
2085+
from gcore.types.cdn import (
2086+
AlibabaRegions,
2087+
AwsRegions,
2088+
CdnAccount,
2089+
CdnAccountLimits,
2090+
CdnAvailableFeatures,
2091+
PurgeStatus,
2092+
CdnListPurgeStatusesResponse,
2093+
)
20862094
```
20872095

20882096
Methods:
20892097

20902098
- <code title="get /cdn/clients/me/limits">client.cdn.<a href="./src/gcore/resources/cdn/cdn.py">get_account_limits</a>() -> <a href="./src/gcore/types/cdn/cdn_account_limits.py">CdnAccountLimits</a></code>
20912099
- <code title="get /cdn/clients/me">client.cdn.<a href="./src/gcore/resources/cdn/cdn.py">get_account_overview</a>() -> <a href="./src/gcore/types/cdn/cdn_account.py">CdnAccount</a></code>
20922100
- <code title="get /cdn/clients/me/features">client.cdn.<a href="./src/gcore/resources/cdn/cdn.py">get_available_features</a>() -> <a href="./src/gcore/types/cdn/cdn_available_features.py">CdnAvailableFeatures</a></code>
2093-
- <code title="get /cdn/purge_statuses">client.cdn.<a href="./src/gcore/resources/cdn/cdn.py">list_purge_statuses</a>(\*\*<a href="src/gcore/types/cdn/cdn_list_purge_statuses_params.py">params</a>) -> <a href="./src/gcore/types/cdn/purge_status.py">SyncOffsetPageCdn[PurgeStatus]</a></code>
2101+
- <code title="get /cdn/alibaba_regions">client.cdn.<a href="./src/gcore/resources/cdn/cdn.py">list_alibaba_regions</a>() -> <a href="./src/gcore/types/cdn/alibaba_regions.py">AlibabaRegions</a></code>
2102+
- <code title="get /cdn/aws_regions">client.cdn.<a href="./src/gcore/resources/cdn/cdn.py">list_aws_regions</a>() -> <a href="./src/gcore/types/cdn/aws_regions.py">AwsRegions</a></code>
2103+
- <code title="get /cdn/purge_statuses">client.cdn.<a href="./src/gcore/resources/cdn/cdn.py">list_purge_statuses</a>(\*\*<a href="src/gcore/types/cdn/cdn_list_purge_statuses_params.py">params</a>) -> <a href="./src/gcore/types/cdn/cdn_list_purge_statuses_response.py">CdnListPurgeStatusesResponse</a></code>
20942104
- <code title="patch /cdn/clients/me">client.cdn.<a href="./src/gcore/resources/cdn/cdn.py">update_account</a>(\*\*<a href="src/gcore/types/cdn/cdn_update_account_params.py">params</a>) -> <a href="./src/gcore/types/cdn/cdn_account.py">CdnAccount</a></code>
20952105

20962106
## Resources

src/gcore/resources/cdn/cdn.py

Lines changed: 112 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,6 @@
6363
async_to_streamed_response_wrapper,
6464
)
6565
from ...types.cdn import cdn_update_account_params, cdn_list_purge_statuses_params
66-
from ...pagination import SyncOffsetPageCdn, AsyncOffsetPageCdn
6766
from .certificates import (
6867
CertificatesResource,
6968
AsyncCertificatesResource,
@@ -80,7 +79,7 @@
8079
OriginGroupsResourceWithStreamingResponse,
8180
AsyncOriginGroupsResourceWithStreamingResponse,
8281
)
83-
from ..._base_client import AsyncPaginator, make_request_options
82+
from ..._base_client import make_request_options
8483
from .rule_templates import (
8584
RuleTemplatesResource,
8685
AsyncRuleTemplatesResource,
@@ -105,6 +104,7 @@
105104
ResourcesResourceWithStreamingResponse,
106105
AsyncResourcesResourceWithStreamingResponse,
107106
)
107+
from ...types.cdn.aws_regions import AwsRegions
108108
from ...types.cdn.cdn_account import CdnAccount
109109
from .trusted_ca_certificates import (
110110
TrustedCaCertificatesResource,
@@ -114,7 +114,7 @@
114114
TrustedCaCertificatesResourceWithStreamingResponse,
115115
AsyncTrustedCaCertificatesResourceWithStreamingResponse,
116116
)
117-
from ...types.cdn.purge_status import PurgeStatus
117+
from ...types.cdn.alibaba_regions import AlibabaRegions
118118
from .logs_uploader.logs_uploader import (
119119
LogsUploaderResource,
120120
AsyncLogsUploaderResource,
@@ -125,6 +125,7 @@
125125
)
126126
from ...types.cdn.cdn_account_limits import CdnAccountLimits
127127
from ...types.cdn.cdn_available_features import CdnAvailableFeatures
128+
from ...types.cdn.cdn_list_purge_statuses_response import CdnListPurgeStatusesResponse
128129

129130
__all__ = ["CdnResource", "AsyncCdnResource"]
130131

@@ -258,6 +259,44 @@ def get_available_features(
258259
cast_to=CdnAvailableFeatures,
259260
)
260261

262+
def list_alibaba_regions(
263+
self,
264+
*,
265+
# Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
266+
# The extra values given here take precedence over values defined on the client or passed to this method.
267+
extra_headers: Headers | None = None,
268+
extra_query: Query | None = None,
269+
extra_body: Body | None = None,
270+
timeout: float | httpx.Timeout | None | NotGiven = not_given,
271+
) -> AlibabaRegions:
272+
"""Get the list of Alibaba Cloud regions."""
273+
return self._get(
274+
"/cdn/alibaba_regions",
275+
options=make_request_options(
276+
extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout
277+
),
278+
cast_to=AlibabaRegions,
279+
)
280+
281+
def list_aws_regions(
282+
self,
283+
*,
284+
# Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
285+
# The extra values given here take precedence over values defined on the client or passed to this method.
286+
extra_headers: Headers | None = None,
287+
extra_query: Query | None = None,
288+
extra_body: Body | None = None,
289+
timeout: float | httpx.Timeout | None | NotGiven = not_given,
290+
) -> AwsRegions:
291+
"""Get the list of Amazon AWS regions."""
292+
return self._get(
293+
"/cdn/aws_regions",
294+
options=make_request_options(
295+
extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout
296+
),
297+
cast_to=AwsRegions,
298+
)
299+
261300
def list_purge_statuses(
262301
self,
263302
*,
@@ -274,7 +313,7 @@ def list_purge_statuses(
274313
extra_query: Query | None = None,
275314
extra_body: Body | None = None,
276315
timeout: float | httpx.Timeout | None | NotGiven = not_given,
277-
) -> SyncOffsetPageCdn[PurgeStatus]:
316+
) -> CdnListPurgeStatusesResponse:
278317
"""
279318
Get purges history.
280319
@@ -330,9 +369,8 @@ def list_purge_statuses(
330369
331370
timeout: Override the client-level default timeout for this request, in seconds
332371
"""
333-
return self._get_api_list(
372+
return self._get(
334373
"/cdn/purge_statuses",
335-
page=SyncOffsetPageCdn[PurgeStatus],
336374
options=make_request_options(
337375
extra_headers=extra_headers,
338376
extra_query=extra_query,
@@ -351,7 +389,7 @@ def list_purge_statuses(
351389
cdn_list_purge_statuses_params.CdnListPurgeStatusesParams,
352390
),
353391
),
354-
model=PurgeStatus,
392+
cast_to=CdnListPurgeStatusesResponse,
355393
)
356394

357395
def update_account(
@@ -522,7 +560,45 @@ async def get_available_features(
522560
cast_to=CdnAvailableFeatures,
523561
)
524562

525-
def list_purge_statuses(
563+
async def list_alibaba_regions(
564+
self,
565+
*,
566+
# Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
567+
# The extra values given here take precedence over values defined on the client or passed to this method.
568+
extra_headers: Headers | None = None,
569+
extra_query: Query | None = None,
570+
extra_body: Body | None = None,
571+
timeout: float | httpx.Timeout | None | NotGiven = not_given,
572+
) -> AlibabaRegions:
573+
"""Get the list of Alibaba Cloud regions."""
574+
return await self._get(
575+
"/cdn/alibaba_regions",
576+
options=make_request_options(
577+
extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout
578+
),
579+
cast_to=AlibabaRegions,
580+
)
581+
582+
async def list_aws_regions(
583+
self,
584+
*,
585+
# Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
586+
# The extra values given here take precedence over values defined on the client or passed to this method.
587+
extra_headers: Headers | None = None,
588+
extra_query: Query | None = None,
589+
extra_body: Body | None = None,
590+
timeout: float | httpx.Timeout | None | NotGiven = not_given,
591+
) -> AwsRegions:
592+
"""Get the list of Amazon AWS regions."""
593+
return await self._get(
594+
"/cdn/aws_regions",
595+
options=make_request_options(
596+
extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout
597+
),
598+
cast_to=AwsRegions,
599+
)
600+
601+
async def list_purge_statuses(
526602
self,
527603
*,
528604
cname: str | Omit = omit,
@@ -538,7 +614,7 @@ def list_purge_statuses(
538614
extra_query: Query | None = None,
539615
extra_body: Body | None = None,
540616
timeout: float | httpx.Timeout | None | NotGiven = not_given,
541-
) -> AsyncPaginator[PurgeStatus, AsyncOffsetPageCdn[PurgeStatus]]:
617+
) -> CdnListPurgeStatusesResponse:
542618
"""
543619
Get purges history.
544620
@@ -594,15 +670,14 @@ def list_purge_statuses(
594670
595671
timeout: Override the client-level default timeout for this request, in seconds
596672
"""
597-
return self._get_api_list(
673+
return await self._get(
598674
"/cdn/purge_statuses",
599-
page=AsyncOffsetPageCdn[PurgeStatus],
600675
options=make_request_options(
601676
extra_headers=extra_headers,
602677
extra_query=extra_query,
603678
extra_body=extra_body,
604679
timeout=timeout,
605-
query=maybe_transform(
680+
query=await async_maybe_transform(
606681
{
607682
"cname": cname,
608683
"from_created": from_created,
@@ -615,7 +690,7 @@ def list_purge_statuses(
615690
cdn_list_purge_statuses_params.CdnListPurgeStatusesParams,
616691
),
617692
),
618-
model=PurgeStatus,
693+
cast_to=CdnListPurgeStatusesResponse,
619694
)
620695

621696
async def update_account(
@@ -670,6 +745,12 @@ def __init__(self, cdn: CdnResource) -> None:
670745
self.get_available_features = to_raw_response_wrapper(
671746
cdn.get_available_features,
672747
)
748+
self.list_alibaba_regions = to_raw_response_wrapper(
749+
cdn.list_alibaba_regions,
750+
)
751+
self.list_aws_regions = to_raw_response_wrapper(
752+
cdn.list_aws_regions,
753+
)
673754
self.list_purge_statuses = to_raw_response_wrapper(
674755
cdn.list_purge_statuses,
675756
)
@@ -743,6 +824,12 @@ def __init__(self, cdn: AsyncCdnResource) -> None:
743824
self.get_available_features = async_to_raw_response_wrapper(
744825
cdn.get_available_features,
745826
)
827+
self.list_alibaba_regions = async_to_raw_response_wrapper(
828+
cdn.list_alibaba_regions,
829+
)
830+
self.list_aws_regions = async_to_raw_response_wrapper(
831+
cdn.list_aws_regions,
832+
)
746833
self.list_purge_statuses = async_to_raw_response_wrapper(
747834
cdn.list_purge_statuses,
748835
)
@@ -816,6 +903,12 @@ def __init__(self, cdn: CdnResource) -> None:
816903
self.get_available_features = to_streamed_response_wrapper(
817904
cdn.get_available_features,
818905
)
906+
self.list_alibaba_regions = to_streamed_response_wrapper(
907+
cdn.list_alibaba_regions,
908+
)
909+
self.list_aws_regions = to_streamed_response_wrapper(
910+
cdn.list_aws_regions,
911+
)
819912
self.list_purge_statuses = to_streamed_response_wrapper(
820913
cdn.list_purge_statuses,
821914
)
@@ -889,6 +982,12 @@ def __init__(self, cdn: AsyncCdnResource) -> None:
889982
self.get_available_features = async_to_streamed_response_wrapper(
890983
cdn.get_available_features,
891984
)
985+
self.list_alibaba_regions = async_to_streamed_response_wrapper(
986+
cdn.list_alibaba_regions,
987+
)
988+
self.list_aws_regions = async_to_streamed_response_wrapper(
989+
cdn.list_aws_regions,
990+
)
892991
self.list_purge_statuses = async_to_streamed_response_wrapper(
893992
cdn.list_purge_statuses,
894993
)

src/gcore/types/cdn/__init__.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
from __future__ import annotations
44

55
from .ssl_detail import SslDetail as SslDetail
6+
from .aws_regions import AwsRegions as AwsRegions
67
from .cdn_account import CdnAccount as CdnAccount
78
from .cdn_metrics import CdnMetrics as CdnMetrics
89
from .cdn_resource import CdnResource as CdnResource
@@ -12,6 +13,7 @@
1213
from .rule_template import RuleTemplate as RuleTemplate
1314
from .ca_certificate import CaCertificate as CaCertificate
1415
from .public_ip_list import PublicIPList as PublicIPList
16+
from .alibaba_regions import AlibabaRegions as AlibabaRegions
1517
from .log_list_params import LogListParams as LogListParams
1618
from .ssl_detail_list import SslDetailList as SslDetailList
1719
from .network_capacity import NetworkCapacity as NetworkCapacity
@@ -55,6 +57,7 @@
5557
from .rule_template_replace_params import RuleTemplateReplaceParams as RuleTemplateReplaceParams
5658
from .certificate_get_status_params import CertificateGetStatusParams as CertificateGetStatusParams
5759
from .cdn_list_purge_statuses_params import CdnListPurgeStatusesParams as CdnListPurgeStatusesParams
60+
from .cdn_list_purge_statuses_response import CdnListPurgeStatusesResponse as CdnListPurgeStatusesResponse
5861
from .trusted_ca_certificate_list_params import TrustedCaCertificateListParams as TrustedCaCertificateListParams
5962
from .trusted_ca_certificate_create_params import TrustedCaCertificateCreateParams as TrustedCaCertificateCreateParams
6063
from .trusted_ca_certificate_replace_params import (
Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
2+
3+
from typing import List, Optional
4+
from typing_extensions import TypeAlias
5+
6+
from ..._models import BaseModel
7+
8+
__all__ = ["AlibabaRegions", "AlibabaRegionItem"]
9+
10+
11+
class AlibabaRegionItem(BaseModel):
12+
id: Optional[int] = None
13+
"""Region ID."""
14+
15+
code: Optional[str] = None
16+
"""Region code."""
17+
18+
name: Optional[str] = None
19+
"""Region name."""
20+
21+
22+
AlibabaRegions: TypeAlias = List[AlibabaRegionItem]

src/gcore/types/cdn/aws_regions.py

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
2+
3+
from typing import List, Optional
4+
from typing_extensions import TypeAlias
5+
6+
from ..._models import BaseModel
7+
8+
__all__ = ["AwsRegions", "AwsRegionItem"]
9+
10+
11+
class AwsRegionItem(BaseModel):
12+
id: Optional[int] = None
13+
"""Region ID."""
14+
15+
code: Optional[str] = None
16+
"""Region code."""
17+
18+
name: Optional[str] = None
19+
"""Region name."""
20+
21+
22+
AwsRegions: TypeAlias = List[AwsRegionItem]
Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
2+
3+
from typing import List
4+
from typing_extensions import TypeAlias
5+
6+
from .purge_status import PurgeStatus
7+
8+
__all__ = ["CdnListPurgeStatusesResponse"]
9+
10+
CdnListPurgeStatusesResponse: TypeAlias = List[PurgeStatus]

0 commit comments

Comments
 (0)