peak-sdk 1.11.0__tar.gz → 1.13.0__tar.gz
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_sdk-1.11.0 → peak_sdk-1.13.0}/PKG-INFO +45 -7
- {peak_sdk-1.11.0 → peak_sdk-1.13.0}/peak/__init__.py +3 -2
- {peak_sdk-1.11.0 → peak_sdk-1.13.0}/peak/_metadata.py +185 -1
- {peak_sdk-1.11.0 → peak_sdk-1.13.0}/peak/_version.py +1 -1
- {peak_sdk-1.11.0 → peak_sdk-1.13.0}/peak/callbacks.py +22 -2
- {peak_sdk-1.11.0 → peak_sdk-1.13.0}/peak/cli/cli.py +2 -0
- {peak_sdk-1.11.0 → peak_sdk-1.13.0}/peak/cli/helpers.py +2 -0
- peak_sdk-1.13.0/peak/cli/metrics/__init__.py +21 -0
- peak_sdk-1.13.0/peak/cli/metrics/metrics.py +707 -0
- {peak_sdk-1.11.0 → peak_sdk-1.13.0}/peak/cli/press/apps/deployments.py +12 -6
- {peak_sdk-1.11.0 → peak_sdk-1.13.0}/peak/cli/press/apps/specs.py +20 -0
- {peak_sdk-1.11.0 → peak_sdk-1.13.0}/peak/cli/press/blocks/deployments.py +5 -6
- {peak_sdk-1.11.0 → peak_sdk-1.13.0}/peak/cli/press/blocks/specs.py +2 -0
- {peak_sdk-1.11.0 → peak_sdk-1.13.0}/peak/cli/press/deployments.py +49 -3
- {peak_sdk-1.11.0 → peak_sdk-1.13.0}/peak/cli/resources/services.py +20 -5
- {peak_sdk-1.11.0 → peak_sdk-1.13.0}/peak/handler.py +16 -7
- peak_sdk-1.13.0/peak/metrics/__init__.py +26 -0
- peak_sdk-1.13.0/peak/metrics/metrics.py +553 -0
- {peak_sdk-1.11.0 → peak_sdk-1.13.0}/peak/output.py +9 -1
- {peak_sdk-1.11.0 → peak_sdk-1.13.0}/peak/press/apps.py +100 -5
- {peak_sdk-1.11.0 → peak_sdk-1.13.0}/peak/press/blocks.py +2 -0
- {peak_sdk-1.11.0 → peak_sdk-1.13.0}/peak/press/deployments.py +35 -0
- {peak_sdk-1.11.0 → peak_sdk-1.13.0}/peak/resources/__init__.py +10 -1
- {peak_sdk-1.11.0 → peak_sdk-1.13.0}/peak/resources/services.py +5 -2
- peak_sdk-1.13.0/peak/sample_yaml/metrics/create_collection.yaml +8 -0
- peak_sdk-1.13.0/peak/sample_yaml/metrics/publish.yaml +6 -0
- peak_sdk-1.13.0/peak/sample_yaml/metrics/query.yaml +25 -0
- {peak_sdk-1.11.0 → peak_sdk-1.13.0}/peak/sample_yaml/press/apps/deployments/create_app_deployment.yaml +12 -0
- {peak_sdk-1.11.0 → peak_sdk-1.13.0}/peak/sample_yaml/press/apps/deployments/create_app_deployment_revision.yaml +12 -0
- peak_sdk-1.13.0/peak/sample_yaml/press/apps/specs/create_app_spec.yaml +94 -0
- peak_sdk-1.13.0/peak/sample_yaml/press/apps/specs/create_app_spec_release.yaml +78 -0
- {peak_sdk-1.11.0 → peak_sdk-1.13.0}/peak/sample_yaml/press/blocks/specs/service/api/create_block_spec.yaml +28 -28
- {peak_sdk-1.11.0 → peak_sdk-1.13.0}/peak/sample_yaml/press/blocks/specs/service/api/create_block_spec_release.yaml +28 -28
- {peak_sdk-1.11.0 → peak_sdk-1.13.0}/peak/sample_yaml/press/blocks/specs/service/webapp/create_block_spec.yaml +29 -28
- {peak_sdk-1.11.0 → peak_sdk-1.13.0}/peak/sample_yaml/press/blocks/specs/service/webapp/create_block_spec_release.yaml +29 -28
- {peak_sdk-1.11.0 → peak_sdk-1.13.0}/peak/sample_yaml/press/blocks/specs/workflow/create_block_spec.yaml +32 -32
- {peak_sdk-1.11.0 → peak_sdk-1.13.0}/peak/sample_yaml/press/blocks/specs/workflow/create_block_spec_release.yaml +32 -32
- peak_sdk-1.13.0/peak/sample_yaml/press/patch_parameters.yaml +9 -0
- {peak_sdk-1.11.0 → peak_sdk-1.13.0}/peak/sample_yaml/resources/services/create_or_update_service.yaml +1 -0
- {peak_sdk-1.11.0 → peak_sdk-1.13.0}/peak/sample_yaml/resources/services/create_service.yaml +1 -0
- {peak_sdk-1.11.0 → peak_sdk-1.13.0}/peak/sample_yaml/resources/services/update_service.yaml +1 -0
- {peak_sdk-1.11.0 → peak_sdk-1.13.0}/peak/sample_yaml/resources/webapps/create_or_update_webapp.yaml +1 -0
- {peak_sdk-1.11.0 → peak_sdk-1.13.0}/peak/sample_yaml/resources/webapps/create_webapp.yaml +1 -0
- {peak_sdk-1.11.0 → peak_sdk-1.13.0}/peak/sample_yaml/resources/webapps/update_webapp.yaml +1 -0
- {peak_sdk-1.11.0 → peak_sdk-1.13.0}/pypi-home.md +41 -4
- {peak_sdk-1.11.0 → peak_sdk-1.13.0}/pyproject.toml +7 -7
- peak_sdk-1.11.0/peak/sample_yaml/press/apps/specs/create_app_spec.yaml +0 -31
- peak_sdk-1.11.0/peak/sample_yaml/press/apps/specs/create_app_spec_release.yaml +0 -15
- {peak_sdk-1.11.0 → peak_sdk-1.13.0}/LICENSE +0 -0
- {peak_sdk-1.11.0 → peak_sdk-1.13.0}/peak/auth.py +0 -0
- {peak_sdk-1.11.0 → peak_sdk-1.13.0}/peak/base_client.py +0 -0
- {peak_sdk-1.11.0 → peak_sdk-1.13.0}/peak/cli/__init_.py +0 -0
- {peak_sdk-1.11.0 → peak_sdk-1.13.0}/peak/cli/args.py +0 -0
- {peak_sdk-1.11.0 → peak_sdk-1.13.0}/peak/cli/press/__init__.py +0 -0
- {peak_sdk-1.11.0 → peak_sdk-1.13.0}/peak/cli/press/apps/__init__.py +0 -0
- {peak_sdk-1.11.0 → peak_sdk-1.13.0}/peak/cli/press/blocks/__init__.py +0 -0
- {peak_sdk-1.11.0 → peak_sdk-1.13.0}/peak/cli/press/specs.py +0 -0
- {peak_sdk-1.11.0 → peak_sdk-1.13.0}/peak/cli/resources/__init__.py +0 -0
- {peak_sdk-1.11.0 → peak_sdk-1.13.0}/peak/cli/resources/alerts/__init__.py +0 -0
- {peak_sdk-1.11.0 → peak_sdk-1.13.0}/peak/cli/resources/alerts/emails.py +0 -0
- {peak_sdk-1.11.0 → peak_sdk-1.13.0}/peak/cli/resources/artifacts.py +0 -0
- {peak_sdk-1.11.0 → peak_sdk-1.13.0}/peak/cli/resources/images.py +0 -0
- {peak_sdk-1.11.0 → peak_sdk-1.13.0}/peak/cli/resources/tenants.py +0 -0
- {peak_sdk-1.11.0 → peak_sdk-1.13.0}/peak/cli/resources/users.py +0 -0
- {peak_sdk-1.11.0 → peak_sdk-1.13.0}/peak/cli/resources/webapps.py +0 -0
- {peak_sdk-1.11.0 → peak_sdk-1.13.0}/peak/cli/resources/workflows.py +0 -0
- {peak_sdk-1.11.0 → peak_sdk-1.13.0}/peak/cli/ruff.toml +0 -0
- {peak_sdk-1.11.0 → peak_sdk-1.13.0}/peak/cli/version.py +0 -0
- {peak_sdk-1.11.0 → peak_sdk-1.13.0}/peak/compression.py +0 -0
- {peak_sdk-1.11.0 → peak_sdk-1.13.0}/peak/config.py +0 -0
- {peak_sdk-1.11.0 → peak_sdk-1.13.0}/peak/constants.py +0 -0
- {peak_sdk-1.11.0 → peak_sdk-1.13.0}/peak/exceptions.py +0 -0
- {peak_sdk-1.11.0 → peak_sdk-1.13.0}/peak/helpers.py +0 -0
- {peak_sdk-1.11.0 → peak_sdk-1.13.0}/peak/logger.py +0 -0
- {peak_sdk-1.11.0 → peak_sdk-1.13.0}/peak/press/__init__.py +0 -0
- {peak_sdk-1.11.0 → peak_sdk-1.13.0}/peak/press/specs.py +0 -0
- {peak_sdk-1.11.0 → peak_sdk-1.13.0}/peak/py.typed +0 -0
- {peak_sdk-1.11.0 → peak_sdk-1.13.0}/peak/resources/alerts.py +0 -0
- {peak_sdk-1.11.0 → peak_sdk-1.13.0}/peak/resources/artifacts.py +0 -0
- {peak_sdk-1.11.0 → peak_sdk-1.13.0}/peak/resources/images.py +0 -0
- {peak_sdk-1.11.0 → peak_sdk-1.13.0}/peak/resources/tenants.py +0 -0
- {peak_sdk-1.11.0 → peak_sdk-1.13.0}/peak/resources/users.py +0 -0
- {peak_sdk-1.11.0 → peak_sdk-1.13.0}/peak/resources/webapps.py +0 -0
- {peak_sdk-1.11.0 → peak_sdk-1.13.0}/peak/resources/workflows.py +0 -0
- {peak_sdk-1.11.0 → peak_sdk-1.13.0}/peak/sample_yaml/press/apps/deployments/update_app_deployment_metadata.yaml +0 -0
- {peak_sdk-1.11.0 → peak_sdk-1.13.0}/peak/sample_yaml/press/apps/specs/update_app_spec_metadata.yaml +0 -0
- {peak_sdk-1.11.0 → peak_sdk-1.13.0}/peak/sample_yaml/press/blocks/deployments/create_block_deployment.yaml +0 -0
- {peak_sdk-1.11.0 → peak_sdk-1.13.0}/peak/sample_yaml/press/blocks/deployments/create_block_deployment_revision.yaml +0 -0
- {peak_sdk-1.11.0 → peak_sdk-1.13.0}/peak/sample_yaml/press/blocks/deployments/patch_block_parameters.yaml +0 -0
- {peak_sdk-1.11.0 → peak_sdk-1.13.0}/peak/sample_yaml/press/blocks/deployments/update_block_deployment_metadata.yaml +0 -0
- {peak_sdk-1.11.0 → peak_sdk-1.13.0}/peak/sample_yaml/press/blocks/specs/update_block_spec_metadata.yaml +0 -0
- {peak_sdk-1.11.0 → peak_sdk-1.13.0}/peak/sample_yaml/resources/artifacts/create_artifact.yaml +0 -0
- {peak_sdk-1.11.0 → peak_sdk-1.13.0}/peak/sample_yaml/resources/artifacts/create_artifact_version.yaml +0 -0
- {peak_sdk-1.11.0 → peak_sdk-1.13.0}/peak/sample_yaml/resources/artifacts/update_artifact_metadata.yaml +0 -0
- {peak_sdk-1.11.0 → peak_sdk-1.13.0}/peak/sample_yaml/resources/emails/send_email.yaml +0 -0
- {peak_sdk-1.11.0 → peak_sdk-1.13.0}/peak/sample_yaml/resources/images/dockerfile/create_image.yaml +0 -0
- {peak_sdk-1.11.0 → peak_sdk-1.13.0}/peak/sample_yaml/resources/images/dockerfile/create_image_version.yaml +0 -0
- {peak_sdk-1.11.0 → peak_sdk-1.13.0}/peak/sample_yaml/resources/images/dockerfile/update_version.yaml +0 -0
- {peak_sdk-1.11.0 → peak_sdk-1.13.0}/peak/sample_yaml/resources/images/github/create_image.yaml +0 -0
- {peak_sdk-1.11.0 → peak_sdk-1.13.0}/peak/sample_yaml/resources/images/github/create_image_version.yaml +0 -0
- {peak_sdk-1.11.0 → peak_sdk-1.13.0}/peak/sample_yaml/resources/images/github/update_version.yaml +0 -0
- {peak_sdk-1.11.0 → peak_sdk-1.13.0}/peak/sample_yaml/resources/images/upload/create_image.yaml +0 -0
- {peak_sdk-1.11.0 → peak_sdk-1.13.0}/peak/sample_yaml/resources/images/upload/create_image_version.yaml +0 -0
- {peak_sdk-1.11.0 → peak_sdk-1.13.0}/peak/sample_yaml/resources/images/upload/create_or_update_image.yaml +0 -0
- {peak_sdk-1.11.0 → peak_sdk-1.13.0}/peak/sample_yaml/resources/images/upload/update_version.yaml +0 -0
- {peak_sdk-1.11.0 → peak_sdk-1.13.0}/peak/sample_yaml/resources/services/test_service.yaml +0 -0
- {peak_sdk-1.11.0 → peak_sdk-1.13.0}/peak/sample_yaml/resources/workflows/create_or_update_workflow.yaml +0 -0
- {peak_sdk-1.11.0 → peak_sdk-1.13.0}/peak/sample_yaml/resources/workflows/create_workflow.yaml +0 -0
- {peak_sdk-1.11.0 → peak_sdk-1.13.0}/peak/sample_yaml/resources/workflows/execute_partial_workflow.yaml +0 -0
- {peak_sdk-1.11.0 → peak_sdk-1.13.0}/peak/sample_yaml/resources/workflows/execute_workflow.yaml +0 -0
- {peak_sdk-1.11.0 → peak_sdk-1.13.0}/peak/sample_yaml/resources/workflows/patch_workflow.yaml +0 -0
- {peak_sdk-1.11.0 → peak_sdk-1.13.0}/peak/sample_yaml/resources/workflows/update_workflow.yaml +0 -0
- {peak_sdk-1.11.0 → peak_sdk-1.13.0}/peak/sample_yaml/resources/workflows/workflow_auto_retry.yaml +0 -0
- {peak_sdk-1.11.0 → peak_sdk-1.13.0}/peak/sample_yaml/resources/workflows/workflow_execution_parameters.yaml +0 -0
- {peak_sdk-1.11.0 → peak_sdk-1.13.0}/peak/sample_yaml/resources/workflows/workflow_input_parameters.yaml +0 -0
- {peak_sdk-1.11.0 → peak_sdk-1.13.0}/peak/sample_yaml/resources/workflows/workflow_input_parameters_inherit.yaml +0 -0
- {peak_sdk-1.11.0 → peak_sdk-1.13.0}/peak/sample_yaml/resources/workflows/workflow_output_parameters.yaml +0 -0
- {peak_sdk-1.11.0 → peak_sdk-1.13.0}/peak/sample_yaml/resources/workflows/workflow_skippable_steps.yaml +0 -0
- {peak_sdk-1.11.0 → peak_sdk-1.13.0}/peak/session.py +0 -0
- {peak_sdk-1.11.0 → peak_sdk-1.13.0}/peak/telemetry.py +0 -0
- {peak_sdk-1.11.0 → peak_sdk-1.13.0}/peak/template.py +0 -0
- {peak_sdk-1.11.0 → peak_sdk-1.13.0}/peak/tools/__init__.py +0 -0
- {peak_sdk-1.11.0 → peak_sdk-1.13.0}/peak/tools/logging/__init__.py +0 -0
- {peak_sdk-1.11.0 → peak_sdk-1.13.0}/peak/tools/logging/log_handler.py +0 -0
- {peak_sdk-1.11.0 → peak_sdk-1.13.0}/peak/tools/logging/log_level.py +0 -0
- {peak_sdk-1.11.0 → peak_sdk-1.13.0}/peak/tools/logging/logger.py +0 -0
- {peak_sdk-1.11.0 → peak_sdk-1.13.0}/peak/tools/logging/utils.py +0 -0
- {peak_sdk-1.11.0 → peak_sdk-1.13.0}/peak/validators.py +0 -0
@@ -1,12 +1,12 @@
|
|
1
1
|
Metadata-Version: 2.1
|
2
2
|
Name: peak-sdk
|
3
|
-
Version: 1.
|
3
|
+
Version: 1.13.0
|
4
4
|
Summary: Python SDK for interacting with the Peak platform
|
5
5
|
Home-page: https://docs.peak.ai/sdk/latest/
|
6
6
|
License: Apache-2.0
|
7
7
|
Author: Peak
|
8
8
|
Author-email: support@peak.ai
|
9
|
-
Requires-Python: >=3.8.1,<3.
|
9
|
+
Requires-Python: >=3.8.1,<3.13
|
10
10
|
Classifier: Development Status :: 5 - Production/Stable
|
11
11
|
Classifier: Intended Audience :: Developers
|
12
12
|
Classifier: License :: OSI Approved :: Apache Software License
|
@@ -16,6 +16,7 @@ Classifier: Programming Language :: Python :: 3
|
|
16
16
|
Classifier: Programming Language :: Python :: 3.9
|
17
17
|
Classifier: Programming Language :: Python :: 3.10
|
18
18
|
Classifier: Programming Language :: Python :: 3.11
|
19
|
+
Classifier: Programming Language :: Python :: 3.12
|
19
20
|
Classifier: Programming Language :: Python :: 3.8
|
20
21
|
Classifier: Topic :: Software Development :: Libraries :: Application Frameworks
|
21
22
|
Classifier: Typing :: Typed
|
@@ -28,7 +29,7 @@ Requires-Dist: requests (>=2.32,<3.0)
|
|
28
29
|
Requires-Dist: requests-toolbelt (>=1.0,<2.0)
|
29
30
|
Requires-Dist: shellingham (<1.5.4)
|
30
31
|
Requires-Dist: structlog (>=24.2.0,<25.0.0)
|
31
|
-
Requires-Dist: typer (>=0.12.
|
32
|
+
Requires-Dist: typer (>=0.12.4,<0.13.0)
|
32
33
|
Requires-Dist: urllib3 (<2)
|
33
34
|
Project-URL: Documentation, https://docs.peak.ai/sdk/latest/
|
34
35
|
Description-Content-Type: text/markdown
|
@@ -93,6 +94,37 @@ Follow these steps to create a virtual environment using Python's built-in `venv
|
|
93
94
|
echo "compinit" >> ~/.zshrc # replace .zshrc with your shell's configuration file
|
94
95
|
```
|
95
96
|
|
97
|
+
### Checking Package Version
|
98
|
+
|
99
|
+
- As mentioned above, the Peak SDK ships with a CLI as well. You can check the version of both the CLI and the SDK quite easily.
|
100
|
+
- You can check the version for the `peak-cli` using the following command
|
101
|
+
|
102
|
+
```bash
|
103
|
+
peak --version
|
104
|
+
```
|
105
|
+
|
106
|
+
This should return a response of the following format
|
107
|
+
|
108
|
+
```bash
|
109
|
+
peak-cli==1.13.0
|
110
|
+
Python==3.12.3
|
111
|
+
System==Darwin(23.6.0)
|
112
|
+
```
|
113
|
+
|
114
|
+
- To check the version of the `peak-sdk`, the following code snippet can be used
|
115
|
+
|
116
|
+
```python
|
117
|
+
import peak
|
118
|
+
|
119
|
+
print(peak.__version__)
|
120
|
+
```
|
121
|
+
|
122
|
+
This should print the version of the SDK
|
123
|
+
|
124
|
+
```
|
125
|
+
1.13.0
|
126
|
+
```
|
127
|
+
|
96
128
|
### Using the SDK and CLI
|
97
129
|
|
98
130
|
- To start using the SDK and CLI, you'll need either an API Key or a Personal Access Token (PAT).
|
@@ -135,13 +167,13 @@ Here are some quick links to help you navigate easily:
|
|
135
167
|
<tr>
|
136
168
|
<td>3.8</td>
|
137
169
|
<td>🟢</td>
|
138
|
-
<td
|
170
|
+
<td>🟢</td>
|
139
171
|
<td>🟤</td>
|
140
172
|
</tr>
|
141
173
|
<tr>
|
142
174
|
<td>3.9</td>
|
143
175
|
<td>🟢</td>
|
144
|
-
<td
|
176
|
+
<td>🟢</td>
|
145
177
|
<td>🟤</td>
|
146
178
|
</tr>
|
147
179
|
<tr>
|
@@ -152,8 +184,14 @@ Here are some quick links to help you navigate easily:
|
|
152
184
|
</tr>
|
153
185
|
<tr>
|
154
186
|
<td>3.11</td>
|
155
|
-
<td
|
156
|
-
<td
|
187
|
+
<td>🟢</td>
|
188
|
+
<td>🟢</td>
|
189
|
+
<td>🟤</td>
|
190
|
+
</tr>
|
191
|
+
<tr>
|
192
|
+
<td>3.12</td>
|
193
|
+
<td>🟢</td>
|
194
|
+
<td>🟢</td>
|
157
195
|
<td>🟤</td>
|
158
196
|
</tr>
|
159
197
|
</tbody>
|
@@ -24,13 +24,14 @@ Copyright © 2024 Peak AI
|
|
24
24
|
|
25
25
|
Unauthorized copying of this file, via any medium is strictly prohibited.
|
26
26
|
"""
|
27
|
+
|
27
28
|
from __future__ import annotations
|
28
29
|
|
29
30
|
from typing import List
|
30
31
|
|
31
|
-
from peak import press, resources, tools
|
32
|
+
from peak import metrics, press, resources, tools
|
32
33
|
from peak.session import Session
|
33
34
|
|
34
35
|
from ._version import __version__
|
35
36
|
|
36
|
-
__all__: List[str] = ["Session", "press", "resources", "tools", "__version__"]
|
37
|
+
__all__: List[str] = ["Session", "metrics", "press", "resources", "tools", "__version__"]
|
@@ -695,6 +695,168 @@ command_metadata: Dict[str, Any] = {
|
|
695
695
|
"subheader_key": "templateCount",
|
696
696
|
},
|
697
697
|
},
|
698
|
+
"metrics>list": {
|
699
|
+
"table_params": {
|
700
|
+
"output_keys": {
|
701
|
+
"name": {
|
702
|
+
"label": "Name",
|
703
|
+
},
|
704
|
+
"type": {
|
705
|
+
"label": "Type",
|
706
|
+
},
|
707
|
+
"description": {
|
708
|
+
"label": "Description",
|
709
|
+
},
|
710
|
+
"collectionId": {
|
711
|
+
"label": "Collection ID",
|
712
|
+
},
|
713
|
+
"publicationId": {
|
714
|
+
"label": "Publication ID",
|
715
|
+
},
|
716
|
+
"metadata": {
|
717
|
+
"label": "Metadata",
|
718
|
+
},
|
719
|
+
},
|
720
|
+
"title": "Metrics",
|
721
|
+
"data_key": "data",
|
722
|
+
"subheader_key": "totalCount",
|
723
|
+
},
|
724
|
+
},
|
725
|
+
"metrics>list>measure": {
|
726
|
+
"table_params": {
|
727
|
+
"output_keys": {
|
728
|
+
"name": {
|
729
|
+
"label": "Name",
|
730
|
+
},
|
731
|
+
"type": {
|
732
|
+
"label": "Type",
|
733
|
+
},
|
734
|
+
"aggType": {
|
735
|
+
"label": "Aggregation Type",
|
736
|
+
},
|
737
|
+
"cube": {
|
738
|
+
"label": "Cube",
|
739
|
+
},
|
740
|
+
"description": {
|
741
|
+
"label": "Description",
|
742
|
+
},
|
743
|
+
"collectionId": {
|
744
|
+
"label": "Collection ID",
|
745
|
+
},
|
746
|
+
"publicationId": {
|
747
|
+
"label": "Publication ID",
|
748
|
+
},
|
749
|
+
"metadata": {
|
750
|
+
"label": "Metadata",
|
751
|
+
},
|
752
|
+
},
|
753
|
+
"title": "Measures",
|
754
|
+
"data_key": "data",
|
755
|
+
"subheader_key": "totalCount",
|
756
|
+
},
|
757
|
+
},
|
758
|
+
"metrics>list>dimension": {
|
759
|
+
"table_params": {
|
760
|
+
"output_keys": {
|
761
|
+
"name": {
|
762
|
+
"label": "Name",
|
763
|
+
},
|
764
|
+
"type": {
|
765
|
+
"label": "Type",
|
766
|
+
},
|
767
|
+
"primaryKey": {
|
768
|
+
"label": "Primary Key",
|
769
|
+
},
|
770
|
+
"cube": {
|
771
|
+
"label": "Cube",
|
772
|
+
},
|
773
|
+
"description": {
|
774
|
+
"label": "Description",
|
775
|
+
},
|
776
|
+
"collectionId": {
|
777
|
+
"label": "Collection ID",
|
778
|
+
},
|
779
|
+
"publicationId": {
|
780
|
+
"label": "Publication ID",
|
781
|
+
},
|
782
|
+
"metadata": {
|
783
|
+
"label": "Metadata",
|
784
|
+
},
|
785
|
+
},
|
786
|
+
"title": "Dimensions",
|
787
|
+
"data_key": "data",
|
788
|
+
"subheader_key": "totalCount",
|
789
|
+
},
|
790
|
+
},
|
791
|
+
"metrics>list>segment": {
|
792
|
+
"table_params": {
|
793
|
+
"output_keys": {
|
794
|
+
"name": {
|
795
|
+
"label": "Name",
|
796
|
+
},
|
797
|
+
"cube": {
|
798
|
+
"label": "Cube",
|
799
|
+
},
|
800
|
+
"description": {
|
801
|
+
"label": "Description",
|
802
|
+
},
|
803
|
+
"collectionId": {
|
804
|
+
"label": "Collection ID",
|
805
|
+
},
|
806
|
+
"publicationId": {
|
807
|
+
"label": "Publication ID",
|
808
|
+
},
|
809
|
+
"metadata": {
|
810
|
+
"label": "Metadata",
|
811
|
+
},
|
812
|
+
},
|
813
|
+
"title": "Segments",
|
814
|
+
"data_key": "data",
|
815
|
+
"subheader_key": "totalCount",
|
816
|
+
},
|
817
|
+
},
|
818
|
+
"metrics>list-collections": {
|
819
|
+
"table_params": {
|
820
|
+
"output_keys": {
|
821
|
+
"id": {
|
822
|
+
"label": "ID",
|
823
|
+
},
|
824
|
+
"name": {
|
825
|
+
"label": "Name",
|
826
|
+
},
|
827
|
+
"description": {
|
828
|
+
"label": "Description",
|
829
|
+
},
|
830
|
+
"scope": {
|
831
|
+
"label": "Scope",
|
832
|
+
},
|
833
|
+
"createdAt": {
|
834
|
+
"label": "Created At",
|
835
|
+
},
|
836
|
+
"createdBy": {
|
837
|
+
"label": "Created By",
|
838
|
+
},
|
839
|
+
},
|
840
|
+
"title": "Collections",
|
841
|
+
"data_key": "collections",
|
842
|
+
"subheader_key": "totalCount",
|
843
|
+
},
|
844
|
+
},
|
845
|
+
"metrics>list-namespaces": {
|
846
|
+
"table_params": {
|
847
|
+
"output_keys": {
|
848
|
+
"name": {
|
849
|
+
"label": "Name",
|
850
|
+
},
|
851
|
+
"models": {
|
852
|
+
"label": "Models",
|
853
|
+
},
|
854
|
+
},
|
855
|
+
"title": "Namespaces",
|
856
|
+
"data_key": "namespaces",
|
857
|
+
"subheader_key": "totalCount",
|
858
|
+
},
|
859
|
+
},
|
698
860
|
"artifacts>create": {
|
699
861
|
"request_body_yaml_path": "sample_yaml/resources/artifacts/create_artifact.yaml",
|
700
862
|
},
|
@@ -794,6 +956,28 @@ command_metadata: Dict[str, Any] = {
|
|
794
956
|
"blocks>deployments>patch-parameters": {
|
795
957
|
"request_body_yaml_path": "sample_yaml/press/blocks/deployments/patch_block_parameters.yaml",
|
796
958
|
},
|
959
|
+
"deployments>patch-parameters": {
|
960
|
+
"request_body_yaml_path": "sample_yaml/press/patch_parameters.yaml",
|
961
|
+
},
|
962
|
+
"metrics>publish": {
|
963
|
+
"request_body_yaml_path": "sample_yaml/metrics/publish.yaml",
|
964
|
+
},
|
965
|
+
"metrics>query": {
|
966
|
+
"request_body_yaml_path": "sample_yaml/metrics/query.yaml",
|
967
|
+
"table_params": {
|
968
|
+
"output_keys": {},
|
969
|
+
"title": "Query Data",
|
970
|
+
"data_key": "data",
|
971
|
+
"subheader_key": "totalCount",
|
972
|
+
},
|
973
|
+
},
|
974
|
+
"metrics>create-collection": {
|
975
|
+
"request_body_yaml_path": "sample_yaml/metrics/create_collection.yaml",
|
976
|
+
},
|
977
|
+
}
|
978
|
+
|
979
|
+
command_parameter: Dict[str, str] = {
|
980
|
+
"metrics>list": "type",
|
797
981
|
}
|
798
982
|
|
799
|
-
__all__: List[str] = ["command_metadata"]
|
983
|
+
__all__: List[str] = ["command_metadata", "command_parameter"]
|
@@ -27,7 +27,7 @@ import click
|
|
27
27
|
import typer
|
28
28
|
|
29
29
|
import peak.config
|
30
|
-
from peak._metadata import command_metadata
|
30
|
+
from peak._metadata import command_metadata, command_parameter
|
31
31
|
from peak.constants import OutputTypes
|
32
32
|
from peak.output import Writer
|
33
33
|
|
@@ -44,6 +44,20 @@ def paging(*, enable_paging: bool) -> None:
|
|
44
44
|
peak.config.ENABLE_PAGING = enable_paging
|
45
45
|
|
46
46
|
|
47
|
+
def update_command(ctx: typer.Context, command: str) -> str:
|
48
|
+
"""Callback to update the command based on the command parameter."""
|
49
|
+
if not ctx or not hasattr(ctx, "params") or command not in command_parameter:
|
50
|
+
return command
|
51
|
+
|
52
|
+
param = command_parameter[command]
|
53
|
+
param_value = ctx.params.get(param)
|
54
|
+
if param_value:
|
55
|
+
command_with_params = f"{command}>{param_value}"
|
56
|
+
if command_with_params in command_metadata and "table_params" in command_metadata[command_with_params]:
|
57
|
+
return command_with_params
|
58
|
+
return command
|
59
|
+
|
60
|
+
|
47
61
|
def get_full_command_name(ctx: typer.Context | click.core.Context | None) -> str:
|
48
62
|
"""Callback to get the full command name."""
|
49
63
|
if ctx:
|
@@ -66,6 +80,7 @@ def handle_output(output_type: OutputTypes, ctx: typer.Context) -> None:
|
|
66
80
|
peak.config.OUTPUT_TYPE = output_type
|
67
81
|
|
68
82
|
command = get_command_name(ctx)
|
83
|
+
command = update_command(ctx, command)
|
69
84
|
|
70
85
|
if (command not in command_metadata) or ("table_params" not in command_metadata[command]):
|
71
86
|
return
|
@@ -76,8 +91,13 @@ def handle_output(output_type: OutputTypes, ctx: typer.Context) -> None:
|
|
76
91
|
def generate_yaml(ctx: typer.Context, generate_yaml: bool) -> None: # noqa: FBT001 # pragma: no cover
|
77
92
|
"""Callback to generate yaml file."""
|
78
93
|
command = get_command_name(ctx)
|
94
|
+
output_type = peak.config.OUTPUT_TYPE
|
79
95
|
|
80
|
-
if (
|
96
|
+
if (
|
97
|
+
(command not in command_metadata)
|
98
|
+
or ("request_body_yaml_path" not in command_metadata[command])
|
99
|
+
or output_type == "table"
|
100
|
+
):
|
81
101
|
return
|
82
102
|
|
83
103
|
if generate_yaml:
|
@@ -24,6 +24,7 @@ import sys
|
|
24
24
|
import peak.config
|
25
25
|
import typer
|
26
26
|
from peak.cli import args, helpers
|
27
|
+
from peak.cli.metrics import metrics
|
27
28
|
from peak.cli.press import apps, blocks, deployments, specs
|
28
29
|
from peak.cli.resources import alerts, artifacts, images, services, tenants, users, webapps, workflows
|
29
30
|
from peak.constants import Sources
|
@@ -34,6 +35,7 @@ typer.rich_utils.STYLE_HELPTEXT = ""
|
|
34
35
|
|
35
36
|
typer_app = typer.Typer(rich_markup_mode="markdown", help="Create and Manage Peak Resources")
|
36
37
|
typer_app.add_typer(images.app, name="images")
|
38
|
+
typer_app.add_typer(metrics.app, name="metrics")
|
37
39
|
typer_app.add_typer(alerts.app, name="alerts")
|
38
40
|
typer_app.add_typer(artifacts.app, name="artifacts")
|
39
41
|
typer_app.add_typer(workflows.app, name="workflows")
|
@@ -31,6 +31,7 @@ import yaml
|
|
31
31
|
from peak import base_client, press, resources
|
32
32
|
from peak.exceptions import BadParameterException
|
33
33
|
from peak.helpers import format_date, remove_none_values
|
34
|
+
from peak.metrics import metrics
|
34
35
|
from peak.template import load_template
|
35
36
|
from rich.console import Console
|
36
37
|
|
@@ -257,5 +258,6 @@ def get_client(command: str) -> base_client.BaseClient:
|
|
257
258
|
"tenants": resources.tenants,
|
258
259
|
"users": resources.users,
|
259
260
|
"alerts": resources.alerts,
|
261
|
+
"metrics": metrics,
|
260
262
|
}
|
261
263
|
return command_client_map[command].get_client() # type: ignore[no-any-return]
|
@@ -0,0 +1,21 @@
|
|
1
|
+
#
|
2
|
+
# # Copyright © 2024 Peak AI Limited. or its affiliates. All Rights Reserved.
|
3
|
+
# #
|
4
|
+
# # Licensed under the Apache License, Version 2.0 (the "License"). You
|
5
|
+
# # may not use this file except in compliance with the License. A copy of
|
6
|
+
# # the License is located at:
|
7
|
+
# #
|
8
|
+
# # https://github.com/PeakBI/peak-sdk/blob/main/LICENSE
|
9
|
+
# #
|
10
|
+
# # or in the "license" file accompanying this file. This file is
|
11
|
+
# # distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF
|
12
|
+
# # ANY KIND, either express or implied. See the License for the specific
|
13
|
+
# # language governing permissions and limitations under the License.
|
14
|
+
# #
|
15
|
+
# # This file is part of the peak-sdk.
|
16
|
+
# # see (https://github.com/PeakBI/peak-sdk)
|
17
|
+
# #
|
18
|
+
# # You should have received a copy of the APACHE LICENSE, VERSION 2.0
|
19
|
+
# # along with this program. If not, see <https://apache.org/licenses/LICENSE-2.0>
|
20
|
+
#
|
21
|
+
"""CLI module for Peak Metrics."""
|