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
+ from ai_core_sdk.helpers import form_top_skip_params
2
+ from ai_core_sdk.models import BasicResponse
3
+ from ai_core_sdk.models.base_models import Message
4
+ from ai_core_sdk.models.object_store_secret import ObjectStoreSecret
5
+ from ai_core_sdk.models.object_store_secret_query_response import ObjectStoreSecretQueryResponse
6
+ from ai_core_sdk.resource_clients import BaseClient
7
+
8
+
9
+ class ObjectStoreSecretsClient(BaseClient):
10
+ """ObjectStoreSecretsClient is a class implemented for interacting with the object store secret related
11
+ endpoints of the server. It implements the base class
12
+ :class:`ai_api_client_sdk.resource_clients.base_client.BaseClient`
13
+ """
14
+ __PATH = '/admin/objectStoreSecrets'
15
+
16
+ def create(self, name: str, type: str, data: dict, bucket: str = None, endpoint: str = None, region: str = None,
17
+ path_prefix: str = None, verifyssl: str = None, usehttps: str = None,
18
+ resource_group: str = None) -> Message:
19
+ """Creates an object store secret.
20
+
21
+ :param name: name of the object store secret
22
+ :type name: str
23
+ :param type: type of object storage
24
+ :type type: str
25
+ :param data: data to be posted
26
+ :type data: str
27
+ :param bucket: name of the bucket
28
+ :type bucket: str
29
+ :param endpoint: endpoint of object storage
30
+ :type endpoint: str
31
+ :param region: region of object storage
32
+ :type region: str
33
+ :param path_prefix: path prefix
34
+ :type path_prefix: str
35
+ :param verifyssl: verify ssl
36
+ :type verifyssl: str
37
+ :param usehttps: use https
38
+ :type usehttps: str
39
+ :param resource_group: Resource Group which the request should be sent on behalf. Either this or a default
40
+ resource group in the :class:`ai_core_sdk.ai_core_v2_client.AICoreV2Client` should be specified,
41
+ defaults to None
42
+ :type resource_group: str
43
+ :raises: class:`ai_api_client_sdk.exception.AIAPIInvalidRequestException` if a 400 response is received from the
44
+ server
45
+ :raises: class:`ai_api_client_sdk.exception.AIAPIAuthorizationException` if a 401 response is received from the
46
+ server
47
+ :raises: class:`ai_api_client_sdk.exception.AIAPIForbiddenException` if a 403 response is received from the
48
+ server
49
+ :raises: class:`ai_api_client_sdk.exception.AIAPIConflictException` if a 409 response is received from the
50
+ server
51
+ :raises: class:`ai_api_client_sdk.exception.AIAPIServerException` if a non-2XX response is received from the
52
+ server
53
+ :return: A list of metadata of available secrets
54
+ :rtype: class:`ai_core_sdk.models.base_models.BasicNameResponse`
55
+ """
56
+ body = {
57
+ 'name': name,
58
+ 'type': type,
59
+ 'data': data,
60
+ }
61
+
62
+ if bucket:
63
+ body['bucket'] = bucket
64
+ if endpoint:
65
+ body['endpoint'] = endpoint
66
+ if region:
67
+ body['region'] = region
68
+ if path_prefix:
69
+ body['path_prefix'] = path_prefix
70
+ if verifyssl:
71
+ body['verifyssl'] = verifyssl
72
+ if usehttps:
73
+ body['usehttps'] = usehttps
74
+
75
+ response_dict = self.rest_client.post(path=f'{self.__PATH}', body=body, resource_group=resource_group)
76
+ return Message.from_dict(response_dict)
77
+
78
+ def delete(self, name: str, resource_group: str = None) -> BasicResponse:
79
+ """Deletes the object store secret.
80
+
81
+ :param name: name of the object store secret to be deleted
82
+ :type name: str
83
+ :param resource_group: Resource Group which the request should be sent on behalf. Either this or a default
84
+ resource group in the :class:`ai_core_sdk.ai_core_v2_client.AICoreV2Client` should be specified,
85
+ defaults to None
86
+ :type resource_group: str
87
+ :raises: class:`ai_api_client_sdk.exception.AIAPIInvalidRequestException` if a 400 response is received from the
88
+ server
89
+ :raises: class:`ai_api_client_sdk.exception.AIAPIAuthorizationException` if a 401 response is received from the
90
+ server
91
+ :raises: class:`ai_api_client_sdk.exception.AIAPIForbiddenException` if a 403 response is received from the
92
+ server
93
+ :raises: class:`ai_api_client_sdk.exception.AIAPINotFoundException` if a 404 response is received from the
94
+ server
95
+ :raises: class:`ai_api_client_sdk.exception.AIAPIServerException` if a non-2XX response is received from the
96
+ server
97
+ :return: An object representing the response from the server
98
+ :rtype: class:`ai_api_client_sdk.models.base_models.BasicResponse`
99
+ """
100
+ response_dict = self.rest_client.delete(path=f'{self.__PATH}/{name}', resource_group=resource_group)
101
+ return BasicResponse.from_dict(response_dict)
102
+
103
+ def get(self, name: str, resource_group: str = None) -> ObjectStoreSecret:
104
+ """Retrieves the object store secret from the server.
105
+
106
+ :param name: name of the object store secret to be retrieved
107
+ :type name: str
108
+ :param resource_group: Resource Group which the request should be sent on behalf. Either this or a default
109
+ resource group in the :class:`ai_core_sdk.ai_core_v2_client.AICoreV2Client` should be specified,
110
+ defaults to None
111
+ :type resource_group: str
112
+ :raises: class:`ai_api_client_sdk.exception.AIAPIInvalidRequestException` if a 400 response is received from the
113
+ server
114
+ :raises: class:`ai_api_client_sdk.exception.AIAPIAuthorizationException` if a 401 response is received from the
115
+ server
116
+ :raises: class:`ai_api_client_sdk.exception.AIAPIForbiddenException` if a 403 response is received from the
117
+ server
118
+ :raises: class:`ai_api_client_sdk.exception.AIAPINotFoundException` if a 404 response is received from the
119
+ server
120
+ :raises: class:`ai_api_client_sdk.exception.AIAPIServerException` if a non-2XX response is received from the
121
+ server
122
+ :return: The retrieved object store secret
123
+ :rtype: class:`ai_core_sdk.models.object_store_secret.ObjectStoreSecret`
124
+ """
125
+ response_dict = self.rest_client.get(path=f'{self.__PATH}/{name}', resource_group=resource_group)
126
+ return ObjectStoreSecret.from_dict(response_dict)
127
+
128
+ def modify(self, name: str, type: str, data: dict, bucket: str = None, endpoint: str = None, region: str = None,
129
+ path_prefix: str = None, verifyssl: str = None, usehttps: str = None,
130
+ resource_group: str = None) -> BasicResponse:
131
+ """Modifies the object store secret
132
+
133
+ :param name: name of the object store secret to be modified
134
+ :type name: str
135
+ :param type: type of object storage
136
+ :type type: str
137
+ :param data: data to be posted
138
+ :type data: str
139
+ :param bucket: name of the bucket
140
+ :type bucket: str
141
+ :param endpoint: endpoint of object storage
142
+ :type endpoint: str
143
+ :param region: region of object storage
144
+ :type region: str
145
+ :param path_prefix: path prefix
146
+ :type path_prefix: str
147
+ :param verifyssl: verify ssl
148
+ :type verifyssl: str
149
+ :param usehttps: use https
150
+ :type usehttps: str
151
+ :param resource_group: Resource Group which the request should be sent on behalf. Either this or a default
152
+ resource group in the :class:`ai_core_sdk.ai_core_v2_client.AICoreV2Client` should be specified,
153
+ defaults to None
154
+ :type resource_group: str
155
+ :raises: class:`ai_api_client_sdk.exception.AIAPIInvalidRequestException` if a 400 response is received from the
156
+ server
157
+ :raises: class:`ai_api_client_sdk.exception.AIAPIAuthorizationException` if a 401 response is received from the
158
+ server
159
+ :raises: class:`ai_api_client_sdk.exception.AIAPIForbiddenException` if a 403 response is received from the
160
+ server
161
+ :raises: class:`ai_api_client_sdk.exception.AIAPINotFoundException` if a 404 response is received from the
162
+ server
163
+ :raises: class:`ai_api_client_sdk.exception.AIAPIPreconditionFailedException` if a 412 response is received from
164
+ the server
165
+ :return: An object representing the response from the server
166
+ :rtype: class:`ai_api_client_sdk.models.base_models.BasicResponse`
167
+ """
168
+ body = {
169
+ 'name': name,
170
+ 'type': type,
171
+ 'data': data,
172
+ }
173
+
174
+ if bucket:
175
+ body['bucket'] = bucket
176
+ if endpoint:
177
+ body['endpoint'] = endpoint
178
+ if region:
179
+ body['region'] = region
180
+ if path_prefix:
181
+ body['path_prefix'] = path_prefix
182
+ if verifyssl:
183
+ body['verifyssl'] = verifyssl
184
+ if usehttps:
185
+ body['usehttps'] = usehttps
186
+
187
+ response_dict = self.rest_client.patch(path=f'{self.__PATH}/{name}', body=body, resource_group=resource_group)
188
+ return BasicResponse.from_dict(response_dict)
189
+
190
+ def query(self, top: int = None, skip: int = None, resource_group: str = None) -> ObjectStoreSecretQueryResponse:
191
+ """Returns the object store secrets.
192
+
193
+ :param top: Number of object store secrets to be retrieved, defaults to None
194
+ :type top: int, optional
195
+ :param skip: Number of object store secrets to be skipped, from the list of the queried object store
196
+ secrets, defaults to None
197
+ :type skip: int, optional
198
+ :param resource_group: Resource Group which the request should be sent on behalf. Either this or a default
199
+ resource group in the :class:`ai_core_sdk.ai_core_v2_client.AICoreV2Client` should be specified,
200
+ defaults to None
201
+ :type resource_group: str
202
+ :raises: class:`ai_api_client_sdk.exception.AIAPIInvalidRequestException` if a 400 response is received from the
203
+ server
204
+ :raises: class:`ai_api_client_sdk.exception.AIAPIAuthorizationException` if a 401 response is received from the
205
+ server
206
+ :raises: class:`ai_api_client_sdk.exception.AIAPIForbiddenException` if a 403 response is received from the
207
+ server
208
+ :raises: class:`ai_api_client_sdk.exception.AIAPIServerException` if a non-2XX response is received from the
209
+ server
210
+ :return: A list of object store secrets
211
+ :rtype: class:`ai_core_sdk.models.object_store_secret_query_response.ObjectStoreSecretQueryResponse`
212
+ """
213
+ params = form_top_skip_params(top, skip)
214
+ response_dict = self.rest_client.get(path=f'{self.__PATH}', params=params, resource_group=resource_group)
215
+ return ObjectStoreSecretQueryResponse.from_dict(response_dict)
@@ -0,0 +1,116 @@
1
+ from ai_core_sdk.models import BasicResponse
2
+ from ai_core_sdk.models.base_models import Message
3
+ from ai_core_sdk.models.repository import Repository
4
+ from ai_core_sdk.models.repository_query_response import RepositoryQueryResponse
5
+ from ai_core_sdk.resource_clients import BaseClient
6
+
7
+
8
+ class RepositoriesClient(BaseClient):
9
+ """RepositoriesClient is a class implemented for interacting with the repositories related
10
+ endpoints of the server. It implements the base class
11
+ :class:`ai_api_client_sdk.resource_clients.base_client.BaseClient`
12
+ """
13
+ __PATH = '/admin/repositories'
14
+
15
+ def create(self, name: str, url: str, username: str, password: str) -> Message:
16
+ """On-boards a new GitOps repository
17
+
18
+ :param name: name of the GitOps repository
19
+ :type name: str
20
+ :param url: url of the GitOps repository
21
+ :type url: str
22
+ :param username: username to the GitOps repository
23
+ :type username: str
24
+ :param password: password to the GitOps repository
25
+ :type password: str
26
+ :raises: class:`ai_api_client_sdk.exception.AIAPIInvalidRequestException` if a 400 response is received from the
27
+ server
28
+ :raises: class:`ai_api_client_sdk.exception.AIAPIAuthorizationException` if a 401 response is received from the
29
+ server
30
+ :raises: class:`ai_api_client_sdk.exception.AIAPIServerException` if a non-2XX response is received from the
31
+ server
32
+ :return: An object representing the response from the server
33
+ :rtype: class:`ai_core_sdk.models.base_models.BasicNameResponse`
34
+ """
35
+ body = {'name': name, 'url': url, 'username': username, 'password': password}
36
+ response_dict = self.rest_client.post(path=self.__PATH, body=body)
37
+ return Message.from_dict(response_dict)
38
+
39
+ def delete(self, name: str) -> BasicResponse:
40
+ """Off-boards a GitOps repository.
41
+
42
+ :param name: name of the repository to be deleted
43
+ :type name: str
44
+ :raises: class:`ai_api_client_sdk.exception.AIAPIInvalidRequestException` if a 400 response is received from the
45
+ server
46
+ :raises: class:`ai_api_client_sdk.exception.AIAPIAuthorizationException` if a 401 response is received from the
47
+ server
48
+ :raises: class:`ai_api_client_sdk.exception.AIAPINotFoundException` if a 404 response is received from the
49
+ server
50
+ :raises: class:`ai_api_client_sdk.exception.AIAPIPreconditionFailedException` if a 412 response is received from
51
+ the server
52
+ :raises: class:`ai_api_client_sdk.exception.AIAPIServerException` if a non-2XX response is received from the
53
+ server
54
+ :return: An object representing the response from the server
55
+ :rtype: class:`ai_api_client_sdk.models.base_models.BasicResponse`
56
+ """
57
+ response_dict = self.rest_client.delete(path=f'{self.__PATH}/{name}')
58
+ return BasicResponse.from_dict(response_dict)
59
+
60
+ def get(self, name: str) -> Repository:
61
+ """Retrieves the access details for a repository if it exists.
62
+
63
+ :param name: name of the repository to be retrieved
64
+ :type name: str
65
+ :raises: class:`ai_api_client_sdk.exception.AIAPIInvalidRequestException` if a 400 response is received from the
66
+ server
67
+ :raises: class:`ai_api_client_sdk.exception.AIAPIAuthorizationException` if a 401 response is received from the
68
+ server
69
+ :raises: class:`ai_api_client_sdk.exception.AIAPINotFoundException` if a 404 response is received from the
70
+ server
71
+ :raises: class:`ai_api_client_sdk.exception.AIAPIServerException` if a non-2XX response is received from the
72
+ server
73
+ :return: The access details for a repository
74
+ :rtype: class:`ai_core_client_sdk.models.docker_registry_secret.DockerRegistrySecret`
75
+ """
76
+ response_dict = self.rest_client.get(path=f'{self.__PATH}/{name}')
77
+ return Repository.from_dict(response_dict)
78
+
79
+ def modify(self, name: str, username: str, password: str) -> BasicResponse:
80
+ """Updates the referenced repository credentials to synchronize repository.
81
+
82
+ :param name: name of the repository to be modified
83
+ :type name: str
84
+ :param username: username to the repository
85
+ :type username: str
86
+ :param password: password to the repository
87
+ :type password: str
88
+ :raises: class:`ai_api_client_sdk.exception.AIAPIInvalidRequestException` if a 400 response is received from the
89
+ server
90
+ :raises: class:`ai_api_client_sdk.exception.AIAPIAuthorizationException` if a 401 response is received from the
91
+ server
92
+ :raises: class:`ai_api_client_sdk.exception.AIAPINotFoundException` if a 404 response is received from the
93
+ server
94
+ :raises: class:`ai_api_client_sdk.exception.AIAPIPreconditionFailedException` if a 412 response is received from
95
+ the server
96
+ :return: An object representing the response from the server
97
+ :rtype: class:`ai_api_client_sdk.models.base_models.BasicResponse`
98
+ """
99
+ body = {'username': username, 'password': password}
100
+ response_dict = self.rest_client.patch(path=f'{self.__PATH}/{name}', body=body)
101
+ return BasicResponse.from_dict(response_dict)
102
+
103
+ def query(self) -> RepositoryQueryResponse:
104
+ """Retrieves a list of all GitOps repositories for a tenant.
105
+
106
+ :raises: class:`ai_api_client_sdk.exception.AIAPIInvalidRequestException` if a 400 response is received from the
107
+ server
108
+ :raises: class:`ai_api_client_sdk.exception.AIAPIAuthorizationException` if a 401 response is received from the
109
+ server
110
+ :raises: class:`ai_api_client_sdk.exception.AIAPIServerException` if a non-2XX response is received from the
111
+ server
112
+ :return: A list all GitOps repositories for a tenant
113
+ :rtype: class:`ai_core_client_sdk.models.repository_query_response.RepositoryQueryResponse`
114
+ """
115
+ response_dict = self.rest_client.get(path=self.__PATH)
116
+ return RepositoryQueryResponse.from_dict(response_dict)
@@ -0,0 +1,148 @@
1
+ from ai_core_sdk.helpers import form_top_skip_params
2
+ from ai_core_sdk.models import BasicResponse
3
+ from ai_core_sdk.models.base_models import Message
4
+ from ai_core_sdk.models.secret_query_response import SecretQueryResponse
5
+ from ai_core_sdk.resource_clients import BaseClient
6
+
7
+
8
+ class SecretsClient(BaseClient):
9
+ """SecretsClient is a class implemented for interacting with the secret related
10
+ endpoints of the server. It implements the base class
11
+ :class:`ai_api_client_sdk.resource_clients.base_client.BaseClient`
12
+ """
13
+ __PATH = '/admin/secrets'
14
+
15
+ def create(self, name: str, data: dict, resource_group: str = None, ai_tenant_scope=True) -> Message:
16
+ """Creates a secret.
17
+
18
+ :param name: name of the secret
19
+ :type name: str
20
+ :param data: data of secret
21
+ :type data: dict
22
+ :param resource_group: Resource Group which the request should be sent on behalf. Either this or a default
23
+ resource group in the :class:`ai_core_sdk.ai_core_v2_client.AICoreV2Client` should be specified,
24
+ defaults to None
25
+ :type resource_group: str
26
+ :param ai_tenant_scope: Specify whether the main tenant scope is to be used
27
+ :type ai_tenant_scope: bool
28
+ :raises: class:`ai_api_client_sdk.exception.AIAPIInvalidRequestException` if a 400 response is received from the
29
+ server
30
+ :raises: class:`ai_api_client_sdk.exception.AIAPIAuthorizationException` if a 401 response is received from the
31
+ server
32
+ :raises: class:`ai_api_client_sdk.exception.AIAPIForbiddenException` if a 403 response is received from the
33
+ server
34
+ :raises: class:`ai_api_client_sdk.exception.AIAPIConflictException` if a 409 response is received from the
35
+ server
36
+ :raises: class:`ai_api_client_sdk.exception.AIAPIServerException` if a non-2XX response is received from the
37
+ server
38
+ :return: A list of metadata of available secrets
39
+ :rtype: class:`ai_core_sdk.models.base_models.Message`
40
+ """
41
+ body = {
42
+ 'name': name,
43
+ 'data': data,
44
+ }
45
+ headers = {'AI-Tenant-Scope': str(ai_tenant_scope).lower()}
46
+
47
+ response_dict = self.rest_client.post(path=f'{self.__PATH}', body=body, resource_group=resource_group,
48
+ headers=headers)
49
+ return Message.from_dict(response_dict)
50
+
51
+ def delete(self, name: str, resource_group: str = None, ai_tenant_scope=True) -> Message:
52
+ """Deletes the secret.
53
+
54
+ :param name: name of the secret to be deleted
55
+ :type name: str
56
+ :param resource_group: Resource Group which the request should be sent on behalf. Either this or a default
57
+ resource group in the :class:`ai_core_sdk.ai_core_v2_client.AICoreV2Client` should be specified,
58
+ defaults to None
59
+ :type resource_group: str
60
+ :param ai_tenant_scope: Specify whether the main tenant scope is to be used
61
+ :type ai_tenant_scope: bool
62
+ :raises: class:`ai_api_client_sdk.exception.AIAPIInvalidRequestException` if a 400 response is received from the
63
+ server
64
+ :raises: class:`ai_api_client_sdk.exception.AIAPIAuthorizationException` if a 401 response is received from the
65
+ server
66
+ :raises: class:`ai_api_client_sdk.exception.AIAPIForbiddenException` if a 403 response is received from the
67
+ server
68
+ :raises: class:`ai_api_client_sdk.exception.AIAPINotFoundException` if a 404 response is received from the
69
+ server
70
+ :raises: class:`ai_api_client_sdk.exception.AIAPIServerException` if a non-2XX response is received from the
71
+ server
72
+ :return: An object representing the response from the server
73
+ :rtype: class:`ai_api_client_sdk.models.base_models.Message`
74
+ """
75
+ headers = {'AI-Tenant-Scope': str(ai_tenant_scope).lower()}
76
+
77
+ response_dict = self.rest_client.delete(path=f'{self.__PATH}/{name}', resource_group=resource_group,
78
+ headers=headers)
79
+ if response_dict == 200:
80
+ response_dict = { "message": "Secret has been deleted" }
81
+ return Message.from_dict(response_dict)
82
+
83
+ def modify(self, name: str, data: dict, resource_group: str = None, ai_tenant_scope=True) -> Message:
84
+ """Modifies the secret.
85
+
86
+ :param name: name of the secret to be modified
87
+ :type name: str
88
+ :param data: data of secret
89
+ :type data: dict
90
+ :param resource_group: Resource Group which the request should be sent on behalf. Either this or a default
91
+ resource group in the :class:`ai_core_sdk.ai_core_v2_client.AICoreV2Client` should be specified,
92
+ defaults to None
93
+ :type resource_group: str
94
+ :param ai_tenant_scope: Specify whether the main tenant scope is to be used
95
+ :type ai_tenant_scope: bool
96
+ :raises: class:`ai_api_client_sdk.exception.AIAPIInvalidRequestException` if a 400 response is received from the
97
+ server
98
+ :raises: class:`ai_api_client_sdk.exception.AIAPIAuthorizationException` if a 401 response is received from the
99
+ server
100
+ :raises: class:`ai_api_client_sdk.exception.AIAPIForbiddenException` if a 403 response is received from the
101
+ server
102
+ :raises: class:`ai_api_client_sdk.exception.AIAPINotFoundException` if a 404 response is received from the
103
+ server
104
+ :raises: class:`ai_api_client_sdk.exception.AIAPIPreconditionFailedException` if a 412 response is received from
105
+ the server
106
+ :return: An object representing the response from the server
107
+ :rtype: class:`ai_api_client_sdk.models.base_models.Message`
108
+ """
109
+ body = {
110
+ 'data': data,
111
+ }
112
+ headers = {'AI-Tenant-Scope': str(ai_tenant_scope).lower()}
113
+
114
+ response_dict = self.rest_client.patch(path=f'{self.__PATH}/{name}', body=body, resource_group=resource_group,
115
+ headers=headers)
116
+ return Message.from_dict(response_dict)
117
+
118
+ def query(self, top: int = None, skip: int = None, resource_group: str = None,
119
+ ai_tenant_scope: bool = True) -> SecretQueryResponse:
120
+ """Returns the secrets.
121
+
122
+ :param top: Number of secrets to be retrieved, defaults to None
123
+ :type top: int, optional
124
+ :param skip: Number of secrets to be skipped, from the list of the queried secrets, defaults to None
125
+ :type skip: int, optional
126
+ :param resource_group: Resource Group which the request should be sent on behalf. Either this or a default
127
+ resource group in the :class:`ai_core_sdk.ai_core_v2_client.AICoreV2Client` should be specified,
128
+ defaults to None
129
+ :type resource_group: str
130
+ :param ai_tenant_scope: Specify whether the main tenant scope is to be used
131
+ :type ai_tenant_scope: bool
132
+ :raises: class:`ai_api_client_sdk.exception.AIAPIInvalidRequestException` if a 400 response is received from the
133
+ server
134
+ :raises: class:`ai_api_client_sdk.exception.AIAPIAuthorizationException` if a 401 response is received from the
135
+ server
136
+ :raises: class:`ai_api_client_sdk.exception.AIAPIForbiddenException` if a 403 response is received from the
137
+ server
138
+ :raises: class:`ai_api_client_sdk.exception.AIAPIServerException` if a non-2XX response is received from the
139
+ server
140
+ :return: A list of secrets
141
+ :rtype: class:`ai_core_sdk.models.secret_query_response.SecretQueryResponse`
142
+ """
143
+ params = form_top_skip_params(top, skip)
144
+ headers = {'AI-Tenant-Scope': str(ai_tenant_scope).lower()}
145
+
146
+ response_dict = self.rest_client.get(path=f'{self.__PATH}', params=params, headers=headers,
147
+ resource_group=resource_group)
148
+ return SecretQueryResponse.from_dict(response_dict)
@@ -0,0 +1,2 @@
1
+ # pylint: disable=C0114
2
+ from ai_core_sdk.tracking.tracking import Tracking