peak-sdk 1.8.0__py3-none-any.whl → 1.9.0__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- peak/_version.py +1 -1
- peak/cli/resources/tenants.py +53 -3
- peak/resources/tenants.py +37 -2
- {peak_sdk-1.8.0.dist-info → peak_sdk-1.9.0.dist-info}/METADATA +1 -1
- {peak_sdk-1.8.0.dist-info → peak_sdk-1.9.0.dist-info}/RECORD +8 -8
- {peak_sdk-1.8.0.dist-info → peak_sdk-1.9.0.dist-info}/LICENSE +0 -0
- {peak_sdk-1.8.0.dist-info → peak_sdk-1.9.0.dist-info}/WHEEL +0 -0
- {peak_sdk-1.8.0.dist-info → peak_sdk-1.9.0.dist-info}/entry_points.txt +0 -0
peak/_version.py
CHANGED
peak/cli/resources/tenants.py
CHANGED
@@ -23,7 +23,7 @@ from typing import Optional
|
|
23
23
|
|
24
24
|
import typer
|
25
25
|
from peak.cli.args import OUTPUT_TYPES, PAGING
|
26
|
-
from peak.constants import OutputTypes
|
26
|
+
from peak.constants import OutputTypes, OutputTypesNoTable
|
27
27
|
from peak.output import Writer
|
28
28
|
from peak.resources.tenants import Tenant
|
29
29
|
|
@@ -37,6 +37,11 @@ _ENTITY_TYPE = typer.Option(
|
|
37
37
|
help="Entity type to be used in this operation (e.g. - `workflow`, `webapp`, `api-deployment`).",
|
38
38
|
)
|
39
39
|
|
40
|
+
_DATA_STORE_TYPE = typer.Option(
|
41
|
+
None,
|
42
|
+
help="Data store type. The only allowed values is data-warehouse.",
|
43
|
+
)
|
44
|
+
|
40
45
|
|
41
46
|
@app.command(
|
42
47
|
"list-instance-options",
|
@@ -58,7 +63,7 @@ def list_instance_options(
|
|
58
63
|
|
59
64
|
\b
|
60
65
|
🆗 ***Response:***
|
61
|
-
```
|
66
|
+
```json
|
62
67
|
{
|
63
68
|
"data": [
|
64
69
|
{
|
@@ -66,7 +71,7 @@ def list_instance_options(
|
|
66
71
|
"gpu": null,
|
67
72
|
"gpuMemory": null,
|
68
73
|
"id": 20,
|
69
|
-
"instanceClass": "
|
74
|
+
"instanceClass": "General Purpose",
|
70
75
|
"memory": 125,
|
71
76
|
"name": "Pico (0.125CPU, 0.125GB RAM)",
|
72
77
|
"provider": "k8s",
|
@@ -84,3 +89,48 @@ def list_instance_options(
|
|
84
89
|
with writer.pager():
|
85
90
|
response = tenants_client.list_instance_options(entity_type=entity_type)
|
86
91
|
writer.write(response)
|
92
|
+
|
93
|
+
|
94
|
+
@app.command(
|
95
|
+
short_help="Get credentails for a data store.",
|
96
|
+
)
|
97
|
+
def get_credentials(
|
98
|
+
ctx: typer.Context,
|
99
|
+
data_store_type: Optional[str] = _DATA_STORE_TYPE,
|
100
|
+
output_type: Optional[OutputTypesNoTable] = OUTPUT_TYPES, # noqa: ARG001
|
101
|
+
) -> None:
|
102
|
+
"""***Get*** credentials for the given data store type.
|
103
|
+
|
104
|
+
\b
|
105
|
+
📝 ***Example Usage:***<br/>
|
106
|
+
```bash
|
107
|
+
peak tenants get-credentials --data-store-type data-warehouse
|
108
|
+
```
|
109
|
+
|
110
|
+
\b
|
111
|
+
🆗 ***Response:***
|
112
|
+
```json
|
113
|
+
{
|
114
|
+
"application": "application",
|
115
|
+
"connectionString": "snowflake://host/database?authenticator=OAUTH&token=generated-access-token",
|
116
|
+
"integration": "integration_name",
|
117
|
+
"port": 443,
|
118
|
+
"role": "role_name",
|
119
|
+
"schema": "schema",
|
120
|
+
"warehouse": "warehouse",
|
121
|
+
"accessToken": "generated-access-token",
|
122
|
+
"authType": "oauth",
|
123
|
+
"database": "database",
|
124
|
+
"host": "host",
|
125
|
+
"dataWarehouseType": "snowflake"
|
126
|
+
}
|
127
|
+
```
|
128
|
+
|
129
|
+
🔗 [**API Documentation**](https://service.peak.ai/connections/api-docs/index.htm#/connections/get_api_v1_connections_credentials)
|
130
|
+
"""
|
131
|
+
tenants_client: Tenant = ctx.obj["client"]
|
132
|
+
writer = Writer()
|
133
|
+
|
134
|
+
with writer.pager():
|
135
|
+
response = tenants_client.get_credentials(data_store_type=data_store_type)
|
136
|
+
writer.write(response)
|
peak/resources/tenants.py
CHANGED
@@ -31,7 +31,8 @@ from peak.session import Session
|
|
31
31
|
class Tenant(BaseClient):
|
32
32
|
"""Tenant client class."""
|
33
33
|
|
34
|
-
|
34
|
+
QUOTA_BASE_ENDPOINT = "quota/api/v1"
|
35
|
+
CONNECTIONS_BASE_ENDPOINT = "connections/api/v1"
|
35
36
|
|
36
37
|
def list_instance_options(
|
37
38
|
self,
|
@@ -56,7 +57,7 @@ class Tenant(BaseClient):
|
|
56
57
|
NotFoundException: The given image does not exist.
|
57
58
|
InternalServerErrorException: The server failed to process the request.
|
58
59
|
"""
|
59
|
-
method, endpoint = HttpMethods.GET, f"{self.
|
60
|
+
method, endpoint = HttpMethods.GET, f"{self.QUOTA_BASE_ENDPOINT}/settings/tenant-instance-options"
|
60
61
|
params = {"entityType": entity_type}
|
61
62
|
|
62
63
|
return self.session.create_request( # type: ignore[no-any-return]
|
@@ -66,6 +67,40 @@ class Tenant(BaseClient):
|
|
66
67
|
params=params,
|
67
68
|
)
|
68
69
|
|
70
|
+
def get_credentials(
|
71
|
+
self,
|
72
|
+
data_store_type: Optional[str] = None,
|
73
|
+
) -> Dict[str, Any]:
|
74
|
+
"""Retrieve credentials for a given data store type.
|
75
|
+
|
76
|
+
REFERENCE:
|
77
|
+
🔗 `API Documentation <https://service.peak.ai/connections/api-docs/index.htm#/connections/get_api_v1_connections_credentials>`__
|
78
|
+
|
79
|
+
Args:
|
80
|
+
data_store_type (str): The type of the data store.
|
81
|
+
Allowed values are - data-warehouse.
|
82
|
+
Default - data-warehouse
|
83
|
+
|
84
|
+
Returns:
|
85
|
+
Dict[str, Any]: a dictionary containing the credentials for the data store.
|
86
|
+
|
87
|
+
Raises:
|
88
|
+
BadRequestException: The given request parameters are invalid.
|
89
|
+
UnauthorizedException: The credentials are invalid.
|
90
|
+
ForbiddenException: The user does not have permission to perform the operation.
|
91
|
+
NotFoundException: The given image does not exist.
|
92
|
+
InternalServerErrorException: The server failed to process the request.
|
93
|
+
"""
|
94
|
+
method, endpoint = HttpMethods.GET, f"{self.CONNECTIONS_BASE_ENDPOINT}/connections/credentials"
|
95
|
+
params = {"type": data_store_type}
|
96
|
+
|
97
|
+
return self.session.create_request( # type: ignore[no-any-return]
|
98
|
+
endpoint,
|
99
|
+
method,
|
100
|
+
content_type=ContentType.APPLICATION_JSON,
|
101
|
+
params=params,
|
102
|
+
)
|
103
|
+
|
69
104
|
|
70
105
|
def get_client(session: Optional[Session] = None) -> Tenant:
|
71
106
|
"""Returns a Tenant client, If no session is provided, a default session is used.
|
@@ -1,6 +1,6 @@
|
|
1
1
|
peak/__init__.py,sha256=yULGsiciVPNjdTO6uwEynsyLFiGBA2n7TT72DzKn9z8,1263
|
2
2
|
peak/_metadata.py,sha256=ulvZZj-Vpjp6zVSUyw3vFjckTsX_QH0GPb0K1yln2io,25190
|
3
|
-
peak/_version.py,sha256=
|
3
|
+
peak/_version.py,sha256=M4whDJj9RrzgffEaA0-SyoFtv4gSxWM-jH5gwkE8FGE,886
|
4
4
|
peak/auth.py,sha256=KcqCqovY6sFiMGNAGP9k3AtCAXrZ-tYd7QP-PFYorX0,904
|
5
5
|
peak/base_client.py,sha256=3cS8hZApONkojwdgzt_tbwSxwpFcn3xGwzVcmxkgOJc,1808
|
6
6
|
peak/callbacks.py,sha256=OwAvipxU4kNNHr97J4LyuE3fs5JttXkrny0WIOKgJPU,3045
|
@@ -23,7 +23,7 @@ peak/cli/resources/alerts/emails.py,sha256=10ledYdyD6jQgTac62xn8yDodOLwoj8wD4s3H
|
|
23
23
|
peak/cli/resources/artifacts.py,sha256=GiJ-yR1bvClDVO6EIHGqDyqsLGpmlUh9Bk_UPdUc-Co,12105
|
24
24
|
peak/cli/resources/images.py,sha256=SwZC0y6pw3mq1HMiO9nPV3YzykbMuSIGt2TD47ZTZ1Y,43133
|
25
25
|
peak/cli/resources/services.py,sha256=lBQX__-fEXx1xYFxEH6iq2T_jZQmNzWx3CJ1bwAzoEE,24295
|
26
|
-
peak/cli/resources/tenants.py,sha256=
|
26
|
+
peak/cli/resources/tenants.py,sha256=1vmNOwmLQdNV9RSVNaOZBRcAzHkOzIcVNz5ZH390O0c,4066
|
27
27
|
peak/cli/resources/users.py,sha256=1qDv8bHYoIBHZ903Y5PBU_KIrMvOY4FrHPay4r0UF_c,2635
|
28
28
|
peak/cli/resources/webapps.py,sha256=RyYxi2x8aJcQQ4Zowu0xqyMAmS8qlp0Mp-zodDKqkVw,21140
|
29
29
|
peak/cli/resources/workflows.py,sha256=xJhXMB_j-1JZD8w-h4Sl9oe820WOvABoksOY6GS742w,52219
|
@@ -48,7 +48,7 @@ peak/resources/alerts.py,sha256=-RIfyCa4bkrb32poJlbKnsfLslpw49DyqvUOCTl-mUo,1237
|
|
48
48
|
peak/resources/artifacts.py,sha256=lLVRRrznKKYVOA-pinWyqLpRd-AoFHGkFYwLT9aEGOU,14365
|
49
49
|
peak/resources/images.py,sha256=7UB-jNEkE3HaqGLiTkv5wf5SU_9Y-jeFoMG_aMPT-y8,46715
|
50
50
|
peak/resources/services.py,sha256=B9FJQD4eFGYdHbYbfHocfXm1LlRGil7yTmQPwTEpazM,16910
|
51
|
-
peak/resources/tenants.py,sha256=
|
51
|
+
peak/resources/tenants.py,sha256=amTs39KZ5hxDd7h3h1qo3TgYJOY1Eql0EhRgDBPlQ6Y,4380
|
52
52
|
peak/resources/users.py,sha256=X9NfZo1dVvXQk_DCxzTKGG_VCsSmk7HzHdJrRR90mKQ,3428
|
53
53
|
peak/resources/webapps.py,sha256=6rJDEj0dkQ8bPm0OnNchB7_Ec4eN9FBCUhD8r7YyX5U,13719
|
54
54
|
peak/resources/workflows.py,sha256=ePDis4MFa7HZd2PCEt2Y-WfpdFY1hsOmJStiXxccVwc,52753
|
@@ -111,8 +111,8 @@ peak/tools/logging/log_level.py,sha256=Xtv4zZnYk4QBix_MfCRGim4yJbv7w2tTbNKe_s4Qm
|
|
111
111
|
peak/tools/logging/logger.py,sha256=Jow5D3hqek-n0kHWNeL2nKbC9NfpfkWFT_FmPp-skTw,15653
|
112
112
|
peak/tools/logging/utils.py,sha256=qmjdBbCc1Y6JDbSgNXfdnLnpkx7fb9kPw9u8uO3AAII,3330
|
113
113
|
peak/validators.py,sha256=_nVAXF_AB443voKNjyQsCTQBAVVAqn7xCbCbBguohIs,2715
|
114
|
-
peak_sdk-1.
|
115
|
-
peak_sdk-1.
|
116
|
-
peak_sdk-1.
|
117
|
-
peak_sdk-1.
|
118
|
-
peak_sdk-1.
|
114
|
+
peak_sdk-1.9.0.dist-info/LICENSE,sha256=W0jszenKx7YdFA7BDnyg8xDKXzCP8AperJb_PHh9paQ,11340
|
115
|
+
peak_sdk-1.9.0.dist-info/METADATA,sha256=GulBZwrr94fmLmqWp0NCIMt8CK7mILEV-Jn8B4FJ9EY,7139
|
116
|
+
peak_sdk-1.9.0.dist-info/WHEEL,sha256=sP946D7jFCHeNz5Iq4fL4Lu-PrWrFsgfLXbbkciIZwg,88
|
117
|
+
peak_sdk-1.9.0.dist-info/entry_points.txt,sha256=zHCEjuOTjkfmqivgEZQsPGm4zFA4W3Q_vKCjPr7W6lE,47
|
118
|
+
peak_sdk-1.9.0.dist-info/RECORD,,
|
File without changes
|
File without changes
|
File without changes
|