Skip to content

Commit 2802edf

Browse files
feat(cloud): add support for postgres
1 parent 27bc07a commit 2802edf

32 files changed

+3516
-2
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: 609
1+
configured_endpoints: 618
22
openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/gcore%2Fgcore-1089f2c131ebee7df82e158c4210c07f019b47549d84fe6ea7f022117c83a008.yml
33
openapi_spec_hash: 9758acbadc1ee1bc0d826d4657e1ad4a
4-
config_hash: 4758209f53bb13d06f55e4cf6c952b6d
4+
config_hash: 79098512b2ff15053f2813524c207add

api.md

Lines changed: 57 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1006,6 +1006,63 @@ Methods:
10061006

10071007
- <code title="post /cloud/v1/usage_report">client.cloud.usage_reports.<a href="./src/gcore/resources/cloud/usage_reports.py">get</a>(\*\*<a href="src/gcore/types/cloud/usage_report_get_params.py">params</a>) -> <a href="./src/gcore/types/cloud/usage_report.py">UsageReport</a></code>
10081008

1009+
## Databases
1010+
1011+
### Postgres
1012+
1013+
#### Clusters
1014+
1015+
Types:
1016+
1017+
```python
1018+
from gcore.types.cloud.databases.postgres import PostgresCluster, PostgresClusterShort
1019+
```
1020+
1021+
Methods:
1022+
1023+
- <code title="post /cloud/v1/dbaas/postgres/clusters/{project_id}/{region_id}">client.cloud.databases.postgres.clusters.<a href="./src/gcore/resources/cloud/databases/postgres/clusters/clusters.py">create</a>(\*, project_id, region_id, \*\*<a href="src/gcore/types/cloud/databases/postgres/cluster_create_params.py">params</a>) -> <a href="./src/gcore/types/cloud/task_id_list.py">TaskIDList</a></code>
1024+
- <code title="patch /cloud/v1/dbaas/postgres/clusters/{project_id}/{region_id}/{cluster_name}">client.cloud.databases.postgres.clusters.<a href="./src/gcore/resources/cloud/databases/postgres/clusters/clusters.py">update</a>(cluster_name, \*, project_id, region_id, \*\*<a href="src/gcore/types/cloud/databases/postgres/cluster_update_params.py">params</a>) -> <a href="./src/gcore/types/cloud/task_id_list.py">TaskIDList</a></code>
1025+
- <code title="get /cloud/v1/dbaas/postgres/clusters/{project_id}/{region_id}">client.cloud.databases.postgres.clusters.<a href="./src/gcore/resources/cloud/databases/postgres/clusters/clusters.py">list</a>(\*, project_id, region_id, \*\*<a href="src/gcore/types/cloud/databases/postgres/cluster_list_params.py">params</a>) -> <a href="./src/gcore/types/cloud/databases/postgres/postgres_cluster_short.py">SyncOffsetPage[PostgresClusterShort]</a></code>
1026+
- <code title="delete /cloud/v1/dbaas/postgres/clusters/{project_id}/{region_id}/{cluster_name}">client.cloud.databases.postgres.clusters.<a href="./src/gcore/resources/cloud/databases/postgres/clusters/clusters.py">delete</a>(cluster_name, \*, project_id, region_id) -> <a href="./src/gcore/types/cloud/task_id_list.py">TaskIDList</a></code>
1027+
- <code title="get /cloud/v1/dbaas/postgres/clusters/{project_id}/{region_id}/{cluster_name}">client.cloud.databases.postgres.clusters.<a href="./src/gcore/resources/cloud/databases/postgres/clusters/clusters.py">get</a>(cluster_name, \*, project_id, region_id) -> <a href="./src/gcore/types/cloud/databases/postgres/postgres_cluster.py">PostgresCluster</a></code>
1028+
1029+
##### UserCredentials
1030+
1031+
Types:
1032+
1033+
```python
1034+
from gcore.types.cloud.databases.postgres.clusters import PostgresUserCredentials
1035+
```
1036+
1037+
Methods:
1038+
1039+
- <code title="get /cloud/v1/dbaas/postgres/clusters/{project_id}/{region_id}/{cluster_name}/users/{username}/credentials">client.cloud.databases.postgres.clusters.user_credentials.<a href="./src/gcore/resources/cloud/databases/postgres/clusters/user_credentials.py">get</a>(username, \*, project_id, region_id, cluster_name) -> <a href="./src/gcore/types/cloud/databases/postgres/clusters/postgres_user_credentials.py">PostgresUserCredentials</a></code>
1040+
- <code title="post /cloud/v1/dbaas/postgres/clusters/{project_id}/{region_id}/{cluster_name}/users/{username}/credentials">client.cloud.databases.postgres.clusters.user_credentials.<a href="./src/gcore/resources/cloud/databases/postgres/clusters/user_credentials.py">regenerate</a>(username, \*, project_id, region_id, cluster_name) -> <a href="./src/gcore/types/cloud/databases/postgres/clusters/postgres_user_credentials.py">PostgresUserCredentials</a></code>
1041+
1042+
#### Configurations
1043+
1044+
Types:
1045+
1046+
```python
1047+
from gcore.types.cloud.databases.postgres import PostgresConfiguration
1048+
```
1049+
1050+
Methods:
1051+
1052+
- <code title="get /cloud/v1/dbaas/postgres/configuration/{project_id}/{region_id}">client.cloud.databases.postgres.configurations.<a href="./src/gcore/resources/cloud/databases/postgres/configurations.py">get</a>(\*, project_id, region_id) -> <a href="./src/gcore/types/cloud/databases/postgres/postgres_configuration.py">PostgresConfiguration</a></code>
1053+
1054+
#### CustomConfigurations
1055+
1056+
Types:
1057+
1058+
```python
1059+
from gcore.types.cloud.databases.postgres import PgConfValidation
1060+
```
1061+
1062+
Methods:
1063+
1064+
- <code title="post /cloud/v1/dbaas/postgres/validate_pg_conf/{project_id}/{region_id}">client.cloud.databases.postgres.custom_configurations.<a href="./src/gcore/resources/cloud/databases/postgres/custom_configurations.py">validate</a>(\*, project_id, region_id, \*\*<a href="src/gcore/types/cloud/databases/postgres/custom_configuration_validate_params.py">params</a>) -> <a href="./src/gcore/types/cloud/databases/postgres/pg_conf_validation.py">PgConfValidation</a></code>
1065+
10091066
# Waap
10101067

10111068
Types:

src/gcore/resources/cloud/__init__.py

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -96,6 +96,14 @@
9696
BaremetalResourceWithStreamingResponse,
9797
AsyncBaremetalResourceWithStreamingResponse,
9898
)
99+
from .databases import (
100+
DatabasesResource,
101+
AsyncDatabasesResource,
102+
DatabasesResourceWithRawResponse,
103+
AsyncDatabasesResourceWithRawResponse,
104+
DatabasesResourceWithStreamingResponse,
105+
AsyncDatabasesResourceWithStreamingResponse,
106+
)
99107
from .inference import (
100108
InferenceResource,
101109
AsyncInferenceResource,
@@ -374,6 +382,12 @@
374382
"AsyncUsageReportsResourceWithRawResponse",
375383
"UsageReportsResourceWithStreamingResponse",
376384
"AsyncUsageReportsResourceWithStreamingResponse",
385+
"DatabasesResource",
386+
"AsyncDatabasesResource",
387+
"DatabasesResourceWithRawResponse",
388+
"AsyncDatabasesResourceWithRawResponse",
389+
"DatabasesResourceWithStreamingResponse",
390+
"AsyncDatabasesResourceWithStreamingResponse",
377391
"CloudResource",
378392
"AsyncCloudResource",
379393
"CloudResourceWithRawResponse",

src/gcore/resources/cloud/cloud.py

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -140,6 +140,14 @@
140140
BaremetalResourceWithStreamingResponse,
141141
AsyncBaremetalResourceWithStreamingResponse,
142142
)
143+
from .databases.databases import (
144+
DatabasesResource,
145+
AsyncDatabasesResource,
146+
DatabasesResourceWithRawResponse,
147+
AsyncDatabasesResourceWithRawResponse,
148+
DatabasesResourceWithStreamingResponse,
149+
AsyncDatabasesResourceWithStreamingResponse,
150+
)
143151
from .inference.inference import (
144152
InferenceResource,
145153
AsyncInferenceResource,
@@ -328,6 +336,10 @@ def cost_reports(self) -> CostReportsResource:
328336
def usage_reports(self) -> UsageReportsResource:
329337
return UsageReportsResource(self._client)
330338

339+
@cached_property
340+
def databases(self) -> DatabasesResource:
341+
return DatabasesResource(self._client)
342+
331343
@cached_property
332344
def with_raw_response(self) -> CloudResourceWithRawResponse:
333345
"""
@@ -460,6 +472,10 @@ def cost_reports(self) -> AsyncCostReportsResource:
460472
def usage_reports(self) -> AsyncUsageReportsResource:
461473
return AsyncUsageReportsResource(self._client)
462474

475+
@cached_property
476+
def databases(self) -> AsyncDatabasesResource:
477+
return AsyncDatabasesResource(self._client)
478+
463479
@cached_property
464480
def with_raw_response(self) -> AsyncCloudResourceWithRawResponse:
465481
"""
@@ -595,6 +611,10 @@ def cost_reports(self) -> CostReportsResourceWithRawResponse:
595611
def usage_reports(self) -> UsageReportsResourceWithRawResponse:
596612
return UsageReportsResourceWithRawResponse(self._cloud.usage_reports)
597613

614+
@cached_property
615+
def databases(self) -> DatabasesResourceWithRawResponse:
616+
return DatabasesResourceWithRawResponse(self._cloud.databases)
617+
598618

599619
class AsyncCloudResourceWithRawResponse:
600620
def __init__(self, cloud: AsyncCloudResource) -> None:
@@ -711,6 +731,10 @@ def cost_reports(self) -> AsyncCostReportsResourceWithRawResponse:
711731
def usage_reports(self) -> AsyncUsageReportsResourceWithRawResponse:
712732
return AsyncUsageReportsResourceWithRawResponse(self._cloud.usage_reports)
713733

734+
@cached_property
735+
def databases(self) -> AsyncDatabasesResourceWithRawResponse:
736+
return AsyncDatabasesResourceWithRawResponse(self._cloud.databases)
737+
714738

715739
class CloudResourceWithStreamingResponse:
716740
def __init__(self, cloud: CloudResource) -> None:
@@ -827,6 +851,10 @@ def cost_reports(self) -> CostReportsResourceWithStreamingResponse:
827851
def usage_reports(self) -> UsageReportsResourceWithStreamingResponse:
828852
return UsageReportsResourceWithStreamingResponse(self._cloud.usage_reports)
829853

854+
@cached_property
855+
def databases(self) -> DatabasesResourceWithStreamingResponse:
856+
return DatabasesResourceWithStreamingResponse(self._cloud.databases)
857+
830858

831859
class AsyncCloudResourceWithStreamingResponse:
832860
def __init__(self, cloud: AsyncCloudResource) -> None:
@@ -942,3 +970,7 @@ def cost_reports(self) -> AsyncCostReportsResourceWithStreamingResponse:
942970
@cached_property
943971
def usage_reports(self) -> AsyncUsageReportsResourceWithStreamingResponse:
944972
return AsyncUsageReportsResourceWithStreamingResponse(self._cloud.usage_reports)
973+
974+
@cached_property
975+
def databases(self) -> AsyncDatabasesResourceWithStreamingResponse:
976+
return AsyncDatabasesResourceWithStreamingResponse(self._cloud.databases)
Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
2+
3+
from .postgres import (
4+
PostgresResource,
5+
AsyncPostgresResource,
6+
PostgresResourceWithRawResponse,
7+
AsyncPostgresResourceWithRawResponse,
8+
PostgresResourceWithStreamingResponse,
9+
AsyncPostgresResourceWithStreamingResponse,
10+
)
11+
from .databases import (
12+
DatabasesResource,
13+
AsyncDatabasesResource,
14+
DatabasesResourceWithRawResponse,
15+
AsyncDatabasesResourceWithRawResponse,
16+
DatabasesResourceWithStreamingResponse,
17+
AsyncDatabasesResourceWithStreamingResponse,
18+
)
19+
20+
__all__ = [
21+
"PostgresResource",
22+
"AsyncPostgresResource",
23+
"PostgresResourceWithRawResponse",
24+
"AsyncPostgresResourceWithRawResponse",
25+
"PostgresResourceWithStreamingResponse",
26+
"AsyncPostgresResourceWithStreamingResponse",
27+
"DatabasesResource",
28+
"AsyncDatabasesResource",
29+
"DatabasesResourceWithRawResponse",
30+
"AsyncDatabasesResourceWithRawResponse",
31+
"DatabasesResourceWithStreamingResponse",
32+
"AsyncDatabasesResourceWithStreamingResponse",
33+
]
Lines changed: 102 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,102 @@
1+
# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
2+
3+
from __future__ import annotations
4+
5+
from ...._compat import cached_property
6+
from ...._resource import SyncAPIResource, AsyncAPIResource
7+
from .postgres.postgres import (
8+
PostgresResource,
9+
AsyncPostgresResource,
10+
PostgresResourceWithRawResponse,
11+
AsyncPostgresResourceWithRawResponse,
12+
PostgresResourceWithStreamingResponse,
13+
AsyncPostgresResourceWithStreamingResponse,
14+
)
15+
16+
__all__ = ["DatabasesResource", "AsyncDatabasesResource"]
17+
18+
19+
class DatabasesResource(SyncAPIResource):
20+
@cached_property
21+
def postgres(self) -> PostgresResource:
22+
return PostgresResource(self._client)
23+
24+
@cached_property
25+
def with_raw_response(self) -> DatabasesResourceWithRawResponse:
26+
"""
27+
This property can be used as a prefix for any HTTP method call to return
28+
the raw response object instead of the parsed content.
29+
30+
For more information, see https://www.github.com/G-Core/gcore-python#accessing-raw-response-data-eg-headers
31+
"""
32+
return DatabasesResourceWithRawResponse(self)
33+
34+
@cached_property
35+
def with_streaming_response(self) -> DatabasesResourceWithStreamingResponse:
36+
"""
37+
An alternative to `.with_raw_response` that doesn't eagerly read the response body.
38+
39+
For more information, see https://www.github.com/G-Core/gcore-python#with_streaming_response
40+
"""
41+
return DatabasesResourceWithStreamingResponse(self)
42+
43+
44+
class AsyncDatabasesResource(AsyncAPIResource):
45+
@cached_property
46+
def postgres(self) -> AsyncPostgresResource:
47+
return AsyncPostgresResource(self._client)
48+
49+
@cached_property
50+
def with_raw_response(self) -> AsyncDatabasesResourceWithRawResponse:
51+
"""
52+
This property can be used as a prefix for any HTTP method call to return
53+
the raw response object instead of the parsed content.
54+
55+
For more information, see https://www.github.com/G-Core/gcore-python#accessing-raw-response-data-eg-headers
56+
"""
57+
return AsyncDatabasesResourceWithRawResponse(self)
58+
59+
@cached_property
60+
def with_streaming_response(self) -> AsyncDatabasesResourceWithStreamingResponse:
61+
"""
62+
An alternative to `.with_raw_response` that doesn't eagerly read the response body.
63+
64+
For more information, see https://www.github.com/G-Core/gcore-python#with_streaming_response
65+
"""
66+
return AsyncDatabasesResourceWithStreamingResponse(self)
67+
68+
69+
class DatabasesResourceWithRawResponse:
70+
def __init__(self, databases: DatabasesResource) -> None:
71+
self._databases = databases
72+
73+
@cached_property
74+
def postgres(self) -> PostgresResourceWithRawResponse:
75+
return PostgresResourceWithRawResponse(self._databases.postgres)
76+
77+
78+
class AsyncDatabasesResourceWithRawResponse:
79+
def __init__(self, databases: AsyncDatabasesResource) -> None:
80+
self._databases = databases
81+
82+
@cached_property
83+
def postgres(self) -> AsyncPostgresResourceWithRawResponse:
84+
return AsyncPostgresResourceWithRawResponse(self._databases.postgres)
85+
86+
87+
class DatabasesResourceWithStreamingResponse:
88+
def __init__(self, databases: DatabasesResource) -> None:
89+
self._databases = databases
90+
91+
@cached_property
92+
def postgres(self) -> PostgresResourceWithStreamingResponse:
93+
return PostgresResourceWithStreamingResponse(self._databases.postgres)
94+
95+
96+
class AsyncDatabasesResourceWithStreamingResponse:
97+
def __init__(self, databases: AsyncDatabasesResource) -> None:
98+
self._databases = databases
99+
100+
@cached_property
101+
def postgres(self) -> AsyncPostgresResourceWithStreamingResponse:
102+
return AsyncPostgresResourceWithStreamingResponse(self._databases.postgres)
Lines changed: 61 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,61 @@
1+
# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
2+
3+
from .clusters import (
4+
ClustersResource,
5+
AsyncClustersResource,
6+
ClustersResourceWithRawResponse,
7+
AsyncClustersResourceWithRawResponse,
8+
ClustersResourceWithStreamingResponse,
9+
AsyncClustersResourceWithStreamingResponse,
10+
)
11+
from .postgres import (
12+
PostgresResource,
13+
AsyncPostgresResource,
14+
PostgresResourceWithRawResponse,
15+
AsyncPostgresResourceWithRawResponse,
16+
PostgresResourceWithStreamingResponse,
17+
AsyncPostgresResourceWithStreamingResponse,
18+
)
19+
from .configurations import (
20+
ConfigurationsResource,
21+
AsyncConfigurationsResource,
22+
ConfigurationsResourceWithRawResponse,
23+
AsyncConfigurationsResourceWithRawResponse,
24+
ConfigurationsResourceWithStreamingResponse,
25+
AsyncConfigurationsResourceWithStreamingResponse,
26+
)
27+
from .custom_configurations import (
28+
CustomConfigurationsResource,
29+
AsyncCustomConfigurationsResource,
30+
CustomConfigurationsResourceWithRawResponse,
31+
AsyncCustomConfigurationsResourceWithRawResponse,
32+
CustomConfigurationsResourceWithStreamingResponse,
33+
AsyncCustomConfigurationsResourceWithStreamingResponse,
34+
)
35+
36+
__all__ = [
37+
"ClustersResource",
38+
"AsyncClustersResource",
39+
"ClustersResourceWithRawResponse",
40+
"AsyncClustersResourceWithRawResponse",
41+
"ClustersResourceWithStreamingResponse",
42+
"AsyncClustersResourceWithStreamingResponse",
43+
"ConfigurationsResource",
44+
"AsyncConfigurationsResource",
45+
"ConfigurationsResourceWithRawResponse",
46+
"AsyncConfigurationsResourceWithRawResponse",
47+
"ConfigurationsResourceWithStreamingResponse",
48+
"AsyncConfigurationsResourceWithStreamingResponse",
49+
"CustomConfigurationsResource",
50+
"AsyncCustomConfigurationsResource",
51+
"CustomConfigurationsResourceWithRawResponse",
52+
"AsyncCustomConfigurationsResourceWithRawResponse",
53+
"CustomConfigurationsResourceWithStreamingResponse",
54+
"AsyncCustomConfigurationsResourceWithStreamingResponse",
55+
"PostgresResource",
56+
"AsyncPostgresResource",
57+
"PostgresResourceWithRawResponse",
58+
"AsyncPostgresResourceWithRawResponse",
59+
"PostgresResourceWithStreamingResponse",
60+
"AsyncPostgresResourceWithStreamingResponse",
61+
]

0 commit comments

Comments
 (0)