sap-ai-sdk-core 2.9.9__py3-none-any.whl → 3.0.3__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.
Files changed (87) hide show
  1. ai_core_sdk/ai_core_v2_client.py +157 -0
  2. ai_core_sdk/cli.py +172 -0
  3. ai_core_sdk/credentials.py +196 -0
  4. ai_core_sdk/exception.py +11 -0
  5. ai_core_sdk/helpers/__init__.py +39 -0
  6. ai_core_sdk/helpers/constants.py +18 -0
  7. ai_core_sdk/helpers/logging.py +23 -0
  8. ai_core_sdk/models/__init__.py +33 -0
  9. ai_core_sdk/models/application.py +37 -0
  10. ai_core_sdk/models/application_query_response.py +30 -0
  11. ai_core_sdk/models/application_resource_sync_status.py +34 -0
  12. ai_core_sdk/models/application_source.py +34 -0
  13. ai_core_sdk/models/application_status.py +66 -0
  14. ai_core_sdk/models/base_models.py +62 -0
  15. ai_core_sdk/models/docker_registry_secret.py +23 -0
  16. ai_core_sdk/models/docker_registry_secret_query_response.py +30 -0
  17. ai_core_sdk/models/kpi.py +25 -0
  18. ai_core_sdk/models/object_store_secret.py +32 -0
  19. ai_core_sdk/models/object_store_secret_query_response.py +30 -0
  20. ai_core_sdk/models/repository.py +36 -0
  21. ai_core_sdk/models/repository_query_response.py +30 -0
  22. ai_core_sdk/models/repository_status.py +9 -0
  23. ai_core_sdk/models/resource_group.py +50 -0
  24. ai_core_sdk/models/resource_group_query_response.py +31 -0
  25. ai_core_sdk/models/resource_group_status.py +9 -0
  26. ai_core_sdk/models/secret.py +30 -0
  27. ai_core_sdk/models/secret_query_response.py +30 -0
  28. ai_core_sdk/resource_clients/__init__.py +13 -0
  29. ai_core_sdk/resource_clients/applications_client.py +173 -0
  30. ai_core_sdk/resource_clients/docker_registry_secrets_client.py +117 -0
  31. ai_core_sdk/resource_clients/internal_rest_client.py +52 -0
  32. ai_core_sdk/resource_clients/kpi_client.py +26 -0
  33. ai_core_sdk/resource_clients/metrics_client.py +131 -0
  34. ai_core_sdk/resource_clients/object_store_secrets_client.py +215 -0
  35. ai_core_sdk/resource_clients/repositories_client.py +116 -0
  36. ai_core_sdk/resource_clients/secrets_client.py +148 -0
  37. ai_core_sdk/tracking/__init__.py +2 -0
  38. ai_core_sdk/tracking/tracking.py +215 -0
  39. sap_ai_sdk_core-3.0.3.data/data/docs/ai_core_sdk.ai_core_v2_client.html +127 -0
  40. sap_ai_sdk_core-3.0.3.data/data/docs/ai_core_sdk.cli.html +59 -0
  41. sap_ai_sdk_core-3.0.3.data/data/docs/ai_core_sdk.credentials.html +209 -0
  42. sap_ai_sdk_core-3.0.3.data/data/docs/ai_core_sdk.exception.html +161 -0
  43. sap_ai_sdk_core-3.0.3.data/data/docs/ai_core_sdk.helpers.constants.html +90 -0
  44. sap_ai_sdk_core-3.0.3.data/data/docs/ai_core_sdk.helpers.html +52 -0
  45. sap_ai_sdk_core-3.0.3.data/data/docs/ai_core_sdk.helpers.logging.html +41 -0
  46. sap_ai_sdk_core-3.0.3.data/data/docs/ai_core_sdk.html +29 -0
  47. sap_ai_sdk_core-3.0.3.data/data/docs/ai_core_sdk.models.application.html +79 -0
  48. sap_ai_sdk_core-3.0.3.data/data/docs/ai_core_sdk.models.application_query_response.html +86 -0
  49. sap_ai_sdk_core-3.0.3.data/data/docs/ai_core_sdk.models.application_resource_sync_status.html +77 -0
  50. sap_ai_sdk_core-3.0.3.data/data/docs/ai_core_sdk.models.application_source.html +77 -0
  51. sap_ai_sdk_core-3.0.3.data/data/docs/ai_core_sdk.models.application_status.html +90 -0
  52. sap_ai_sdk_core-3.0.3.data/data/docs/ai_core_sdk.models.base_models.html +120 -0
  53. sap_ai_sdk_core-3.0.3.data/data/docs/ai_core_sdk.models.docker_registry_secret.html +85 -0
  54. sap_ai_sdk_core-3.0.3.data/data/docs/ai_core_sdk.models.docker_registry_secret_query_response.html +86 -0
  55. sap_ai_sdk_core-3.0.3.data/data/docs/ai_core_sdk.models.html +40 -0
  56. sap_ai_sdk_core-3.0.3.data/data/docs/ai_core_sdk.models.kpi.html +73 -0
  57. sap_ai_sdk_core-3.0.3.data/data/docs/ai_core_sdk.models.object_store_secret.html +71 -0
  58. sap_ai_sdk_core-3.0.3.data/data/docs/ai_core_sdk.models.object_store_secret_query_response.html +86 -0
  59. sap_ai_sdk_core-3.0.3.data/data/docs/ai_core_sdk.models.repository.html +77 -0
  60. sap_ai_sdk_core-3.0.3.data/data/docs/ai_core_sdk.models.repository_query_response.html +86 -0
  61. sap_ai_sdk_core-3.0.3.data/data/docs/ai_core_sdk.models.repository_status.html +69 -0
  62. sap_ai_sdk_core-3.0.3.data/data/docs/ai_core_sdk.models.resource_group.html +85 -0
  63. sap_ai_sdk_core-3.0.3.data/data/docs/ai_core_sdk.models.resource_group_query_response.html +86 -0
  64. sap_ai_sdk_core-3.0.3.data/data/docs/ai_core_sdk.models.resource_group_status.html +69 -0
  65. sap_ai_sdk_core-3.0.3.data/data/docs/ai_core_sdk.models.secret.html +76 -0
  66. sap_ai_sdk_core-3.0.3.data/data/docs/ai_core_sdk.models.secret_query_response.html +86 -0
  67. sap_ai_sdk_core-3.0.3.data/data/docs/ai_core_sdk.resource_clients.applications_client.html +186 -0
  68. sap_ai_sdk_core-3.0.3.data/data/docs/ai_core_sdk.resource_clients.docker_registry_secrets_client.html +147 -0
  69. sap_ai_sdk_core-3.0.3.data/data/docs/ai_core_sdk.resource_clients.html +29 -0
  70. sap_ai_sdk_core-3.0.3.data/data/docs/ai_core_sdk.resource_clients.internal_rest_client.html +181 -0
  71. sap_ai_sdk_core-3.0.3.data/data/docs/ai_core_sdk.resource_clients.kpi_client.html +87 -0
  72. sap_ai_sdk_core-3.0.3.data/data/docs/ai_core_sdk.resource_clients.metrics_client.html +189 -0
  73. sap_ai_sdk_core-3.0.3.data/data/docs/ai_core_sdk.resource_clients.object_store_secrets_client.html +205 -0
  74. sap_ai_sdk_core-3.0.3.data/data/docs/ai_core_sdk.resource_clients.repositories_client.html +148 -0
  75. sap_ai_sdk_core-3.0.3.data/data/docs/ai_core_sdk.resource_clients.resource_groups_client.html +156 -0
  76. sap_ai_sdk_core-3.0.3.data/data/docs/ai_core_sdk.resource_clients.secrets_client.html +165 -0
  77. sap_ai_sdk_core-3.0.3.data/data/docs/ai_core_sdk.tracking.html +22 -0
  78. sap_ai_sdk_core-3.0.3.data/data/docs/ai_core_sdk.tracking.tracking.html +224 -0
  79. sap_ai_sdk_core-3.0.3.dist-info/METADATA +253 -0
  80. sap_ai_sdk_core-3.0.3.dist-info/RECORD +84 -0
  81. {sap_ai_sdk_core-2.9.9.dist-info → sap_ai_sdk_core-3.0.3.dist-info}/WHEEL +1 -1
  82. sap_ai_sdk_core-3.0.3.dist-info/top_level.txt +1 -0
  83. sap_ai_sdk_core-2.9.9.dist-info/METADATA +0 -43
  84. sap_ai_sdk_core-2.9.9.dist-info/RECORD +0 -6
  85. sap_ai_sdk_core-2.9.9.dist-info/top_level.txt +0 -1
  86. {sap-ai-sdk-core → ai_core_sdk}/__init__.py +0 -0
  87. {sap_ai_sdk_core-2.9.9.dist-info/licenses → sap_ai_sdk_core-3.0.3.dist-info}/LICENSE +0 -0
@@ -0,0 +1,215 @@
1
+ # pylint: disable=C0114
2
+ import os
3
+ from typing import Callable, List
4
+
5
+ from ai_api_client_sdk.helpers.authenticator import Authenticator
6
+ from ai_core_sdk.exception import AIAPIAuthenticatorException
7
+ from ai_core_sdk.helpers import is_within_aicore
8
+ from ai_core_sdk.models import Metric, MetricCustomInfo, MetricsQueryResponse, MetricTag
9
+ from ai_core_sdk.resource_clients import AIAPIV2Client
10
+ from ai_core_sdk.resource_clients.internal_rest_client import InternalRestClient
11
+ from ai_core_sdk.resource_clients.metrics_client import MetricsCoreClient
12
+
13
+
14
+ class Tracking(MetricsCoreClient): # pylint: disable=W0223
15
+ """Tracking is a class implemented for interacting with the metrics related
16
+ endpoints of the server. It is a wrapper around the base class
17
+ :class:`ai_core_sdk.resource_clients.metrics_client.MetricsCoreClient`
18
+
19
+ :param base_url: Base URL of the AI Core. Should include the base path as well. (i.e., "<base_url>/lm/scenarios"
20
+ should work)
21
+ :type base_url: str
22
+ :param auth_url: URL of the authorization endpoint. Should be the full URL (including /oauth/token), defaults to
23
+ None
24
+ :type auth_url: str, optional
25
+ :param client_id: client id to be used for authorization, defaults to None
26
+ :type client_id: str, optional
27
+ :param client_secret: client secret to be used for authorization, defaults to None
28
+ :type client_secret: str, optional
29
+ :param cert_str: certificate file content, needs to be provided alongside the key_str parameter, defaults to None
30
+ :type cert_str: str, optional
31
+ :param key_str: key file content, needs to be provided alongside the cert_str parameter, defaults to None
32
+ :type key_str: str, optional
33
+ :param cert_file_path: path to the certificate file, needs to be provided alongside the key_file_path parameter,
34
+ defaults to None
35
+ :type cert_file_path: str, optional
36
+ :param key_file_path: path to the key file, needs to be provided alongside the cert_file_path parameter,
37
+ defaults to None
38
+ :type key_file_path: str, optional
39
+ :param token_creator: the function which returns the Bearer token, when called. Either this, or
40
+ auth_url & client_id & client_secret should be specified, defaults to None
41
+ :type token_creator: Callable[[], str], optional
42
+ :param resource_group: The default resource group which will be used while sending the requests to the server. If
43
+ not set, the resource_group should be specified with every request to the server, defaults to None
44
+ :type resource_group: str, optional
45
+ """
46
+ def __init__(self, base_url: str = None, auth_url: str = None, client_id: str = None, client_secret: str = None, # pylint: disable=W0231,R0913
47
+ cert_str: str = None, key_str: str = None, cert_file_path: str = None, key_file_path: str = None,
48
+ token_creator: Callable[[], str] = None, resource_group: str = None):
49
+ self.base_url: str = base_url
50
+ self.metrics_path = '/metrics'
51
+ self.local_experimentation = False
52
+ ai_api_base_url = f'{base_url}/lm'
53
+
54
+ if base_url:
55
+ token_creator = AIAPIV2Client._create_token_creator_if_does_not_exist(
56
+ token_creator=token_creator, auth_url=auth_url, client_id=client_id, client_secret=client_secret,
57
+ cert_str=cert_str, key_str=key_str, cert_file_path=cert_file_path, key_file_path=key_file_path)
58
+ ai_api_v2_client = AIAPIV2Client(base_url=ai_api_base_url, token_creator=token_creator,
59
+ resource_group=resource_group)
60
+ self.metrics_core_client = MetricsCoreClient(rest_client = ai_api_v2_client.rest_client)
61
+ elif is_within_aicore():
62
+ self.metrics_core_client = MetricsCoreClient(
63
+ rest_client=InternalRestClient(),
64
+ execution_id=os.getenv("AICORE_EXECUTION_ID"),
65
+ )
66
+ else:
67
+ print('Warning: Enabling local experimentation. Metrics logged will not be persisted anywhere.')
68
+ self.local_experimentation = True
69
+
70
+ def modify(self, execution_id: str = '', metrics: List[Metric] = None, tags: List[MetricTag] = None, # pylint: disable=R0913
71
+ custom_info: List[MetricCustomInfo] = None, resource_group: str = None) -> None:
72
+ """Creates or updates the metrics for an execution.
73
+
74
+ :param execution_id: ID of the execution, of which the metrics should be modified.
75
+ :type execution_id: str
76
+ :param metrics: List of the metrics related to the execution, defaults to None
77
+ :type metrics: List[class:`ai_api_client_sdk.metric.Metric`], optional
78
+ :param tags: List of the tags related to the execution, defaults to None
79
+ :type tags: List[class:'ai_api_client_sdk.models.metric_tag.MetricTag'], optional
80
+ :param custom_info: List of custom info related to the execution, defaults to None
81
+ :type custom_info: List[class:`ai_api_client_sdk.models.metric_custom_info.MetricCustomInfo`], optional
82
+ :param resource_group: Resource Group which the request should be sent on behalf. Either this or a default
83
+ resource group in the :class:`ai_api_client_sdk.ai_api_v2_client.AIAPIV2Client` should be specified,
84
+ defaults to None
85
+ :type resource_group: str
86
+ :raises: class:`ai_api_client_sdk.exception.AIAPIInvalidRequestException` if a 400 response is received from the
87
+ server
88
+ :raises: class:`ai_api_client_sdk.exception.AIAPIServerException` if a non-2XX response is received from the
89
+ server
90
+ """
91
+ if not self.local_experimentation:
92
+ self.metrics_core_client.modify(execution_id=execution_id, metrics=metrics, tags=tags,
93
+ custom_info=custom_info, resource_group=resource_group)
94
+
95
+ def log_metrics(self, metrics: List[Metric], execution_id: str = '', artifact_name: str = None,
96
+ resource_group: str = None) -> None:
97
+ """Creates or updates the metrics for an execution.
98
+
99
+ :param metrics: List of the metrics related to the execution,
100
+ :type metrics: List[class:`ai_api_client_sdk.metric.Metric`]
101
+ :param execution_id: ID of the execution, of which the metrics should be modified.
102
+ :type execution_id: str
103
+ :param artifact_name: Name of the artifact to associate with a metric, defaults to None
104
+ :type artifact_name: str
105
+ :param resource_group: Resource Group which the request should be sent on behalf. Either this or a default
106
+ resource group in the :class:`ai_api_client_sdk.ai_api_v2_client.AIAPIV2Client` should be specified,
107
+ defaults to None
108
+ :type resource_group: str
109
+ :raises: class:`ai_api_client_sdk.exception.AIAPIInvalidRequestException` if a 400 response is received from the
110
+ server
111
+ :raises: class:`ai_api_client_sdk.exception.AIAPIServerException` if a non-2XX response is received from the
112
+ server
113
+ """
114
+ if not self.local_experimentation:
115
+ self.metrics_core_client.log_metrics(metrics=metrics,
116
+ execution_id=execution_id,
117
+ artifact_name=artifact_name,
118
+ resource_group=resource_group)
119
+
120
+ def set_custom_info(self, custom_info: List[MetricCustomInfo], execution_id: str = '',
121
+ resource_group: str = None) -> None:
122
+ """log custom info against the given execution
123
+ captures consumption semantics for the metrics or complex metric in JSON format.
124
+
125
+
126
+ :param custom_info: List of custom info related to the execution
127
+ :type custom_info: List[class:`ai_api_client_sdk.models.metric_custom_info.MetricCustomInfo`], optional
128
+ :param execution_id: ID of the execution, of which the metrics should be modified.
129
+ :type execution_id: str
130
+ :param resource_group: Resource Group which the request should be sent on behalf. Either this or a default
131
+ resource group in the :class:`ai_api_client_sdk.ai_api_v2_client.AIAPIV2Client` should be specified,
132
+ defaults to None
133
+ :type resource_group: str
134
+ :raises: class:`ai_api_client_sdk.exception.AIAPIInvalidRequestException` if a 400 response is received from the
135
+ server
136
+ :raises: class:`ai_api_client_sdk.exception.AIAPIServerException` if a non-2XX response is received from the
137
+ server
138
+ """
139
+ if not self.local_experimentation:
140
+ self.metrics_core_client.set_custom_info(custom_info=custom_info, execution_id=execution_id,
141
+ resource_group=resource_group)
142
+
143
+ def set_tags(self, tags: List[MetricTag], execution_id: str = '', resource_group: str = None) -> None:
144
+ """log tags against the given execution
145
+
146
+ :param tags: List of the tags related to the execution, defaults to None
147
+ :type tags: List[class:'ai_api_client_sdk.models.metric_tag.MetricTag']
148
+ :param execution_id: ID of the execution, of which the metrics should be modified.
149
+ :type execution_id: str
150
+ :param resource_group: Resource Group which the request should be sent on behalf. Either this or a default
151
+ resource group in the :class:`ai_api_client_sdk.ai_api_v2_client.AIAPIV2Client` should be specified,
152
+ defaults to None
153
+ :type resource_group: str
154
+ :raises: class:`ai_api_client_sdk.exception.AIAPIInvalidRequestException` if a 400 response is received from the
155
+ server
156
+ :raises: class:`ai_api_client_sdk.exception.AIAPIServerException` if a non-2XX response is received from the
157
+ server
158
+ """
159
+ if not self.local_experimentation:
160
+ self.metrics_core_client.set_tags(tags=tags, execution_id=execution_id, resource_group=resource_group)
161
+
162
+ def query(self, filter: str = None, execution_ids: List[str] = None, # pylint: disable=W0622
163
+ select: List[str] = None, resource_group: str = None) -> \
164
+ MetricsQueryResponse:
165
+ """Creates or updates the metrics for an execution.
166
+
167
+ :param filter: Deprecated. Use parameter execution_ids instead. A filter expression that filters the metric
168
+ resources using execution IDs. User can only use in, eq operators in filter expression, defaults to None
169
+ :type filter: str, optional
170
+ :param execution_ids: IDs of the executions, of which the metrics should be retrieved, defaults to None
171
+ :type execution_ids: List[str], optional
172
+ :param select: Values of select can be metrics,tags,customInfo or any of the combinations of these or *.
173
+ Can be used to select(project) only the resources specified
174
+ :type select: List[str], optional
175
+ :param resource_group: Resource Group which the request should be sent on behalf. Either this or a default
176
+ resource group in the :class:`ai_api_client_sdk.ai_api_v2_client.AIAPIV2Client` should be specified,
177
+ defaults to None
178
+ :type resource_group: str
179
+ :raises: class:`ai_api_client_sdk.exception.AIAPIInvalidRequestException` if a 400 response is received from the
180
+ server
181
+ :raises: class:`ai_api_client_sdk.exception.AIAPIAuthorizationException` if a 401 response is received from the
182
+ server
183
+ :raises: class:`ai_api_client_sdk.exception.AIAPIServerException` if a non-2XX response is received from the
184
+ server
185
+ :return: An object representing the response from the server
186
+ :rtype: class:`ai_api_client_sdk.models.metrics_query_response.MetricsQueryResponse`
187
+ """
188
+ if self.local_experimentation:
189
+ print('Warning: Response will be always empty')
190
+ return MetricsQueryResponse.from_dict({"count":0,"resources":[]})
191
+ return self.metrics_core_client.query(filter=filter,
192
+ execution_ids=execution_ids,
193
+ select=select,
194
+ resource_group=resource_group)
195
+
196
+ def delete(self, execution_id: str, resource_group: str = None) -> None:
197
+ """Deletes the metrics.
198
+
199
+ :param execution_id: ID of the execution, of which the metrics should be deleted.
200
+ :type execution_id: str
201
+ :param resource_group: Resource Group which the request should be sent on behalf. Either this or a default
202
+ resource group in the :class:`ai_api_client_sdk.ai_api_v2_client.AIAPIV2Client` should be specified,
203
+ defaults to None
204
+ :type resource_group: str
205
+ :raises: class:`ai_api_client_sdk.exception.AIAPIInvalidRequestException` if a 400 response is received from the
206
+ server
207
+ :raises: class:`ai_api_client_sdk.exception.AIAPIAuthorizationException` if a 401 response is received from the
208
+ server
209
+ :raises: class:`ai_api_client_sdk.exception.AIAPINotFoundException` if a 404 response is received from the
210
+ server
211
+ :raises: class:`ai_api_client_sdk.exception.AIAPIServerException` if a non-2XX response is received from the
212
+ server
213
+ """
214
+ if not self.local_experimentation:
215
+ self.metrics_core_client.delete(execution_id=execution_id, resource_group=resource_group)
@@ -0,0 +1,127 @@
1
+ <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
2
+ <html><head><title>Python: module ai_core_sdk.ai_core_v2_client</title>
3
+ <meta http-equiv="Content-Type" content="text/html; charset=utf-8">
4
+ </head><body bgcolor="#f0f0f8">
5
+
6
+ <table width="100%" cellspacing=0 cellpadding=2 border=0 summary="heading">
7
+ <tr bgcolor="#7799ee">
8
+ <td valign=bottom>&nbsp;<br>
9
+ <font color="#ffffff" face="helvetica, arial">&nbsp;<br><big><big><strong><a href="ai_core_sdk.html"><font color="#ffffff">ai_core_sdk</font></a>.ai_core_v2_client</strong></big></big></font></td
10
+ ><td align=right valign=bottom
11
+ ><font color="#ffffff" face="helvetica, arial"><a href=".">index</a><br><a href="file:/home/jenkins/agent/workspace/AI-Foundation_ai-core-sdk_master/ai_core_sdk/ai_core_v2_client.py">/home/jenkins/agent/workspace/AI-Foundation_ai-core-sdk_master/ai_core_sdk/ai_core_v2_client.py</a></font></td></tr></table>
12
+ <p></p>
13
+ <p>
14
+ <table width="100%" cellspacing=0 cellpadding=2 border=0 summary="section">
15
+ <tr bgcolor="#aa55cc">
16
+ <td colspan=3 valign=bottom>&nbsp;<br>
17
+ <font color="#ffffff" face="helvetica, arial"><big><strong>Modules</strong></big></font></td></tr>
18
+
19
+ <tr><td bgcolor="#aa55cc"><tt>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</tt></td><td>&nbsp;</td>
20
+ <td width="100%"><table width="100%" summary="list"><tr><td width="25%" valign=top><a href="os.html">os</a><br>
21
+ </td><td width="25%" valign=top></td><td width="25%" valign=top></td><td width="25%" valign=top></td></tr></table></td></tr></table><p>
22
+ <table width="100%" cellspacing=0 cellpadding=2 border=0 summary="section">
23
+ <tr bgcolor="#ee77aa">
24
+ <td colspan=3 valign=bottom>&nbsp;<br>
25
+ <font color="#ffffff" face="helvetica, arial"><big><strong>Classes</strong></big></font></td></tr>
26
+
27
+ <tr><td bgcolor="#ee77aa"><tt>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</tt></td><td>&nbsp;</td>
28
+ <td width="100%"><dl>
29
+ <dt><font face="helvetica, arial"><a href="builtins.html#object">builtins.object</a>
30
+ </font></dt><dd>
31
+ <dl>
32
+ <dt><font face="helvetica, arial"><a href="ai_core_sdk.ai_core_v2_client.html#AICoreV2Client">AICoreV2Client</a>
33
+ </font></dt></dl>
34
+ </dd>
35
+ </dl>
36
+ <p>
37
+ <table width="100%" cellspacing=0 cellpadding=2 border=0 summary="section">
38
+ <tr bgcolor="#ffc8d8">
39
+ <td colspan=3 valign=bottom>&nbsp;<br>
40
+ <font color="#000000" face="helvetica, arial"><a name="AICoreV2Client">class <strong>AICoreV2Client</strong></a>(<a href="builtins.html#object">builtins.object</a>)</font></td></tr>
41
+
42
+ <tr bgcolor="#ffc8d8"><td rowspan=2><tt>&nbsp;&nbsp;&nbsp;</tt></td>
43
+ <td colspan=2><tt><a href="#AICoreV2Client">AICoreV2Client</a>(base_url:&nbsp;str,&nbsp;auth_url:&nbsp;str&nbsp;=&nbsp;None,&nbsp;client_id:&nbsp;str&nbsp;=&nbsp;None,&nbsp;client_secret:&nbsp;str&nbsp;=&nbsp;None,&nbsp;cert_str:&nbsp;str&nbsp;=&nbsp;None,&nbsp;key_str:&nbsp;str&nbsp;=&nbsp;None,&nbsp;cert_file_path:&nbsp;str&nbsp;=&nbsp;None,&nbsp;key_file_path:&nbsp;str&nbsp;=&nbsp;None,&nbsp;token_creator:&nbsp;Callable[[],&nbsp;str]&nbsp;=&nbsp;None,&nbsp;resource_group:&nbsp;str&nbsp;=&nbsp;None,&nbsp;read_timeout=60,&nbsp;connect_timeout=60,&nbsp;num_request_retries=3)<br>
44
+ &nbsp;<br>
45
+ The&nbsp;<a href="#AICoreV2Client">AICoreV2Client</a>&nbsp;is&nbsp;the&nbsp;class&nbsp;implemented&nbsp;to&nbsp;interact&nbsp;with&nbsp;the&nbsp;AI&nbsp;Core&nbsp;endpoints.&nbsp;The&nbsp;user&nbsp;can&nbsp;use&nbsp;its<br>
46
+ attributes&nbsp;corresponding&nbsp;to&nbsp;the&nbsp;resources,&nbsp;for&nbsp;interacting&nbsp;with&nbsp;endpoints&nbsp;related&nbsp;to&nbsp;that&nbsp;resource.&nbsp;(i.e.,<br>
47
+ aicoreclient.scenario)<br>
48
+ &nbsp;<br>
49
+ :param&nbsp;base_url:&nbsp;Base&nbsp;URL&nbsp;of&nbsp;the&nbsp;AI&nbsp;Core.&nbsp;Should&nbsp;include&nbsp;the&nbsp;base&nbsp;path&nbsp;as&nbsp;well.&nbsp;(i.e.,&nbsp;"&lt;base_url&gt;/lm/scenarios"<br>
50
+ &nbsp;&nbsp;&nbsp;&nbsp;should&nbsp;work)<br>
51
+ :type&nbsp;base_url:&nbsp;str<br>
52
+ :param&nbsp;auth_url:&nbsp;URL&nbsp;of&nbsp;the&nbsp;authorization&nbsp;endpoint.&nbsp;Should&nbsp;be&nbsp;the&nbsp;full&nbsp;URL&nbsp;(including&nbsp;/oauth/token),&nbsp;defaults&nbsp;to<br>
53
+ &nbsp;&nbsp;&nbsp;&nbsp;None<br>
54
+ :type&nbsp;auth_url:&nbsp;str,&nbsp;optional<br>
55
+ :param&nbsp;client_id:&nbsp;client&nbsp;id&nbsp;to&nbsp;be&nbsp;used&nbsp;for&nbsp;authorization,&nbsp;defaults&nbsp;to&nbsp;None<br>
56
+ :type&nbsp;client_id:&nbsp;str,&nbsp;optional<br>
57
+ :param&nbsp;client_secret:&nbsp;client&nbsp;secret&nbsp;to&nbsp;be&nbsp;used&nbsp;for&nbsp;authorization,&nbsp;defaults&nbsp;to&nbsp;None<br>
58
+ :type&nbsp;client_secret:&nbsp;str,&nbsp;optional<br>
59
+ :param&nbsp;cert_str:&nbsp;certificate&nbsp;file&nbsp;content,&nbsp;needs&nbsp;to&nbsp;be&nbsp;provided&nbsp;alongside&nbsp;the&nbsp;key_str&nbsp;parameter,&nbsp;defaults&nbsp;to&nbsp;None<br>
60
+ :type&nbsp;cert_str:&nbsp;str,&nbsp;optional<br>
61
+ :param&nbsp;key_str:&nbsp;key&nbsp;file&nbsp;content,&nbsp;needs&nbsp;to&nbsp;be&nbsp;provided&nbsp;alongside&nbsp;the&nbsp;cert_str&nbsp;parameter,&nbsp;defaults&nbsp;to&nbsp;None<br>
62
+ :type&nbsp;key_str:&nbsp;str,&nbsp;optional<br>
63
+ :param&nbsp;cert_file_path:&nbsp;path&nbsp;to&nbsp;the&nbsp;certificate&nbsp;file,&nbsp;needs&nbsp;to&nbsp;be&nbsp;provided&nbsp;alongside&nbsp;the&nbsp;key_file_path&nbsp;parameter,<br>
64
+ &nbsp;&nbsp;&nbsp;&nbsp;defaults&nbsp;to&nbsp;None<br>
65
+ :type&nbsp;cert_file_path:&nbsp;str,&nbsp;optional<br>
66
+ :param&nbsp;key_file_path:&nbsp;path&nbsp;to&nbsp;the&nbsp;key&nbsp;file,&nbsp;needs&nbsp;to&nbsp;be&nbsp;provided&nbsp;alongside&nbsp;the&nbsp;cert_file_path&nbsp;parameter,<br>
67
+ &nbsp;&nbsp;&nbsp;&nbsp;defaults&nbsp;to&nbsp;None<br>
68
+ :type&nbsp;key_file_path:&nbsp;str,&nbsp;optional<br>
69
+ :param&nbsp;token_creator:&nbsp;the&nbsp;function&nbsp;which&nbsp;returns&nbsp;the&nbsp;Bearer&nbsp;token,&nbsp;when&nbsp;called.&nbsp;Either&nbsp;this,&nbsp;or<br>
70
+ &nbsp;&nbsp;&nbsp;&nbsp;auth_url&nbsp;&amp;&nbsp;client_id&nbsp;&amp;&nbsp;client_secret&nbsp;should&nbsp;be&nbsp;specified,&nbsp;defaults&nbsp;to&nbsp;None<br>
71
+ :type&nbsp;token_creator:&nbsp;Callable[[],&nbsp;str],&nbsp;optional<br>
72
+ :param&nbsp;resource_group:&nbsp;The&nbsp;default&nbsp;resource&nbsp;group&nbsp;which&nbsp;will&nbsp;be&nbsp;used&nbsp;while&nbsp;sending&nbsp;the&nbsp;requests&nbsp;to&nbsp;the&nbsp;server.&nbsp;If<br>
73
+ &nbsp;&nbsp;&nbsp;&nbsp;not&nbsp;set,&nbsp;the&nbsp;resource_group&nbsp;should&nbsp;be&nbsp;specified&nbsp;with&nbsp;every&nbsp;request&nbsp;to&nbsp;the&nbsp;server,&nbsp;defaults&nbsp;to&nbsp;None<br>
74
+ :type&nbsp;resource_group:&nbsp;str,&nbsp;optional<br>
75
+ :param&nbsp;read_timeout:&nbsp;Read&nbsp;timeout&nbsp;for&nbsp;requests&nbsp;in&nbsp;seconds,&nbsp;defaults&nbsp;to&nbsp;60s<br>
76
+ :type&nbsp;read_timeout:&nbsp;int<br>
77
+ :param&nbsp;connect_timeout:&nbsp;Connect&nbsp;timeout&nbsp;for&nbsp;requests&nbsp;in&nbsp;seconds,&nbsp;defaults&nbsp;to&nbsp;60s<br>
78
+ :type&nbsp;connect_timeout:&nbsp;int<br>
79
+ :param&nbsp;num_request_retries:&nbsp;Number&nbsp;of&nbsp;retries&nbsp;for&nbsp;failing&nbsp;requests&nbsp;with&nbsp;http&nbsp;status&nbsp;code&nbsp;429,&nbsp;500,&nbsp;502,&nbsp;503&nbsp;or&nbsp;504,<br>
80
+ &nbsp;&nbsp;&nbsp;&nbsp;defaults&nbsp;to&nbsp;60s<br>
81
+ :type&nbsp;num_request_retries:&nbsp;int<br>&nbsp;</tt></td></tr>
82
+ <tr><td>&nbsp;</td>
83
+ <td width="100%">Methods defined here:<br>
84
+ <dl><dt><a name="AICoreV2Client-__init__"><strong>__init__</strong></a>(self, base_url: str, auth_url: str = None, client_id: str = None, client_secret: str = None, cert_str: str = None, key_str: str = None, cert_file_path: str = None, key_file_path: str = None, token_creator: Callable[[], str] = None, resource_group: str = None, read_timeout=60, connect_timeout=60, num_request_retries=3)</dt><dd><tt>Initialize&nbsp;self.&nbsp;&nbsp;See&nbsp;help(type(self))&nbsp;for&nbsp;accurate&nbsp;signature.</tt></dd></dl>
85
+
86
+ <hr>
87
+ Static methods defined here:<br>
88
+ <dl><dt><a name="AICoreV2Client-from_env"><strong>from_env</strong></a>(profile_name: str = None, **kwargs)</dt><dd><tt>Alternative&nbsp;way&nbsp;to&nbsp;create&nbsp;an&nbsp;<a href="#AICoreV2Client">AICoreV2Client</a>&nbsp;<a href="builtins.html#object">object</a>.<br>
89
+ Parameters&nbsp;for&nbsp;base_url,&nbsp;auth_url,&nbsp;client_id,&nbsp;client_secret,&nbsp;x.509&nbsp;credentials&nbsp;(either&nbsp;as&nbsp;file&nbsp;path&nbsp;or&nbsp;string)<br>
90
+ and&nbsp;resource_group&nbsp;can&nbsp;be&nbsp;passed&nbsp;as&nbsp;keyword&nbsp;or&nbsp;are&nbsp;pulled&nbsp;from&nbsp;environment&nbsp;variables.<br>
91
+ It&nbsp;is&nbsp;also&nbsp;possible&nbsp;to&nbsp;use&nbsp;a&nbsp;profile,&nbsp;which&nbsp;is&nbsp;a&nbsp;json&nbsp;file&nbsp;in&nbsp;the&nbsp;config&nbsp;directory.&nbsp;The&nbsp;profile&nbsp;name&nbsp;can&nbsp;be<br>
92
+ passed&nbsp;as&nbsp;keyword&nbsp;or&nbsp;is&nbsp;pulled&nbsp;from&nbsp;the&nbsp;environment&nbsp;variable&nbsp;AICORE_PROFILE.&nbsp;If&nbsp;no&nbsp;profile&nbsp;is&nbsp;specified,<br>
93
+ the&nbsp;default&nbsp;profile&nbsp;is&nbsp;used.<br>
94
+ A&nbsp;specific&nbsp;path&nbsp;to&nbsp;a&nbsp;config,&nbsp;that&nbsp;should&nbsp;be&nbsp;used,&nbsp;can&nbsp;be&nbsp;set&nbsp;via&nbsp;the&nbsp;environment&nbsp;variable&nbsp;AICORE_CONFIG.<br>
95
+ The&nbsp;hierarchy&nbsp;of&nbsp;precedence&nbsp;is:<br>
96
+ 1.&nbsp;keyword&nbsp;argument<br>
97
+ 2.&nbsp;environment&nbsp;variable<br>
98
+ 3.&nbsp;configuration&nbsp;file<br>
99
+ 4.&nbsp;value&nbsp;from&nbsp;VCAP_SERVICES&nbsp;environment&nbsp;variable,&nbsp;if&nbsp;exists<br>
100
+ &nbsp;<br>
101
+ :param&nbsp;profile_name:&nbsp;name&nbsp;of&nbsp;the&nbsp;profile&nbsp;to&nbsp;use,&nbsp;defaults&nbsp;to&nbsp;None.&nbsp;If&nbsp;None&nbsp;is&nbsp;passed,&nbsp;the&nbsp;profile&nbsp;is&nbsp;read&nbsp;from<br>
102
+ &nbsp;&nbsp;&nbsp;&nbsp;the&nbsp;environment&nbsp;variable&nbsp;AICORE_PROFILE.&nbsp;If&nbsp;this&nbsp;is&nbsp;not&nbsp;set,&nbsp;the&nbsp;default&nbsp;profile&nbsp;is&nbsp;used.<br>
103
+ &nbsp;&nbsp;&nbsp;&nbsp;The&nbsp;default&nbsp;profile&nbsp;is&nbsp;read&nbsp;from&nbsp;$AICORE_HOME/config.json.<br>
104
+ :type&nbsp;profile_name:&nbsp;optional,&nbsp;str<br>
105
+ **kwargs:&nbsp;check&nbsp;the&nbsp;parameters&nbsp;of&nbsp;the&nbsp;class&nbsp;constructor</tt></dd></dl>
106
+
107
+ <hr>
108
+ Data descriptors defined here:<br>
109
+ <dl><dt><strong>__dict__</strong></dt>
110
+ <dd><tt>dictionary&nbsp;for&nbsp;instance&nbsp;variables&nbsp;(if&nbsp;defined)</tt></dd>
111
+ </dl>
112
+ <dl><dt><strong>__weakref__</strong></dt>
113
+ <dd><tt>list&nbsp;of&nbsp;weak&nbsp;references&nbsp;to&nbsp;the&nbsp;object&nbsp;(if&nbsp;defined)</tt></dd>
114
+ </dl>
115
+ <hr>
116
+ Data and other attributes defined here:<br>
117
+ <dl><dt><strong>logger</strong> = &lt;Logger ai_core_sdk (INFO)&gt;</dl>
118
+
119
+ </td></tr></table></td></tr></table><p>
120
+ <table width="100%" cellspacing=0 cellpadding=2 border=0 summary="section">
121
+ <tr bgcolor="#55aa55">
122
+ <td colspan=3 valign=bottom>&nbsp;<br>
123
+ <font color="#ffffff" face="helvetica, arial"><big><strong>Data</strong></big></font></td></tr>
124
+
125
+ <tr><td bgcolor="#55aa55"><tt>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</tt></td><td>&nbsp;</td>
126
+ <td width="100%"><strong>Callable</strong> = typing.Callable</td></tr></table>
127
+ </body></html>
@@ -0,0 +1,59 @@
1
+ <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
2
+ <html><head><title>Python: module ai_core_sdk.cli</title>
3
+ <meta http-equiv="Content-Type" content="text/html; charset=utf-8">
4
+ </head><body bgcolor="#f0f0f8">
5
+
6
+ <table width="100%" cellspacing=0 cellpadding=2 border=0 summary="heading">
7
+ <tr bgcolor="#7799ee">
8
+ <td valign=bottom>&nbsp;<br>
9
+ <font color="#ffffff" face="helvetica, arial">&nbsp;<br><big><big><strong><a href="ai_core_sdk.html"><font color="#ffffff">ai_core_sdk</font></a>.cli</strong></big></big></font></td
10
+ ><td align=right valign=bottom
11
+ ><font color="#ffffff" face="helvetica, arial"><a href=".">index</a><br><a href="file:/home/jenkins/agent/workspace/AI-Foundation_ai-core-sdk_master/ai_core_sdk/cli.py">/home/jenkins/agent/workspace/AI-Foundation_ai-core-sdk_master/ai_core_sdk/cli.py</a></font></td></tr></table>
12
+ <p></p>
13
+ <p>
14
+ <table width="100%" cellspacing=0 cellpadding=2 border=0 summary="section">
15
+ <tr bgcolor="#aa55cc">
16
+ <td colspan=3 valign=bottom>&nbsp;<br>
17
+ <font color="#ffffff" face="helvetica, arial"><big><strong>Modules</strong></big></font></td></tr>
18
+
19
+ <tr><td bgcolor="#aa55cc"><tt>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</tt></td><td>&nbsp;</td>
20
+ <td width="100%"><table width="100%" summary="list"><tr><td width="25%" valign=top><a href="click.html">click</a><br>
21
+ </td><td width="25%" valign=top><a href="json.html">json</a><br>
22
+ </td><td width="25%" valign=top><a href="pathlib.html">pathlib</a><br>
23
+ </td><td width="25%" valign=top></td></tr></table></td></tr></table><p>
24
+ <table width="100%" cellspacing=0 cellpadding=2 border=0 summary="section">
25
+ <tr bgcolor="#eeaa77">
26
+ <td colspan=3 valign=bottom>&nbsp;<br>
27
+ <font color="#ffffff" face="helvetica, arial"><big><strong>Functions</strong></big></font></td></tr>
28
+
29
+ <tr><td bgcolor="#eeaa77"><tt>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</tt></td><td>&nbsp;</td>
30
+ <td width="100%"><dl><dt><a name="-confirm_resource_group"><strong>confirm_resource_group</strong></a>(resource_group: 'Optional[str]' = None)</dt></dl>
31
+ <dl><dt><a name="-create_config"><strong>create_config</strong></a>(**kwargs)</dt><dd><tt>#&nbsp;Utility&nbsp;Functions</tt></dd></dl>
32
+ <dl><dt><a name="-create_config_file"><strong>create_config_file</strong></a>(config_path: 'pathlib.Path', auth_url: 'str', client_id: 'str', client_secret: 'str', cert_file_path: 'pathlib.Path', key_file_path: 'pathlib.Path', base_url: 'str', resource_group: 'str')</dt></dl>
33
+ <dl><dt><a name="-get_auth_url"><strong>get_auth_url</strong></a>(auth_url: 'Optional[str]' = None)</dt></dl>
34
+ <dl><dt><a name="-get_base_url"><strong>get_base_url</strong></a>(base_url: 'Optional[str]' = None)</dt></dl>
35
+ <dl><dt><a name="-get_profile_config_path"><strong>get_profile_config_path</strong></a>(profile: 'str')</dt></dl>
36
+ <dl><dt><a name="-get_str_value"><strong>get_str_value</strong></a>(msg: 'str', value: 'Optional[str]' = None)</dt></dl>
37
+ <dl><dt><a name="-is_valid_url"><strong>is_valid_url</strong></a>(url, path_forbidden=True)</dt></dl>
38
+ <dl><dt><a name="-load_service_key"><strong>load_service_key</strong></a>(service_key_json: 'str')</dt></dl>
39
+ <dl><dt><a name="-prompt_for_input"><strong>prompt_for_input</strong></a>(prompt_text, is_url=False, path_forbidden=True)</dt></dl>
40
+ </td></tr></table><p>
41
+ <table width="100%" cellspacing=0 cellpadding=2 border=0 summary="section">
42
+ <tr bgcolor="#55aa55">
43
+ <td colspan=3 valign=bottom>&nbsp;<br>
44
+ <font color="#ffffff" face="helvetica, arial"><big><strong>Data</strong></big></font></td></tr>
45
+
46
+ <tr><td bgcolor="#55aa55"><tt>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</tt></td><td>&nbsp;</td>
47
+ <td width="100%"><strong>AI_CORE_PREFIX</strong> = 'AICORE'<br>
48
+ <strong>API_V2_SUFFIX</strong> = '/v2'<br>
49
+ <strong>CREDENTIAL_VALUES</strong> = [CredentialsValue(name='client_id', vcap_key=('cr...s', 'clientid'), default=None, transform_fn=None), CredentialsValue(name='client_secret', vcap_key=...'clientsecret'), default=None, transform_fn=None), CredentialsValue(name='auth_url', vcap_key=('cre...ansform_fn=&lt;function &lt;lambda&gt; at 0x7fadc40fd120&gt;), CredentialsValue(name='base_url', vcap_key=('cre...ansform_fn=&lt;function &lt;lambda&gt; at 0x7fadc40fdc60&gt;), CredentialsValue(name='resource_group', vcap_key=None, default=None, transform_fn=None), CredentialsValue(name='cert_url', vcap_key=('cre...ansform_fn=&lt;function &lt;lambda&gt; at 0x7fadc40fdd80&gt;), CredentialsValue(name='cert_file_path', vcap_key=None, default=None, transform_fn=None), CredentialsValue(name='key_file_path', vcap_key=None, default=None, transform_fn=None), CredentialsValue(name='cert_str', vcap_key=('cre...ansform_fn=&lt;function &lt;lambda&gt; at 0x7fadc40fde10&gt;), CredentialsValue(name='key_str', vcap_key=('cred...ansform_fn=&lt;function &lt;lambda&gt; at 0x7fadc40fdea0&gt;)]<br>
50
+ <strong>DEFAULT_CONFIG</strong> = 'config.json'<br>
51
+ <strong>DEFAULT_PROFILE</strong> = 'default'<br>
52
+ <strong>DEFAULT_RESOURCE_GROUP</strong> = 'default'<br>
53
+ <strong>MAX_TRIES</strong> = 5<br>
54
+ <strong>OAUTH_TOKEN_SUFFIX</strong> = '/oauth/token'<br>
55
+ <strong>Optional</strong> = typing.Optional<br>
56
+ <strong>annotations</strong> = _Feature((3, 7, 0, 'beta', 1), (3, 11, 0, 'alpha', 0), 16777216)<br>
57
+ <strong>cli</strong> = &lt;Group cli&gt;<br>
58
+ <strong>configure</strong> = &lt;Command configure&gt;</td></tr></table>
59
+ </body></html>