Skip to content

Commit e324797

Browse files
author
SDKAuto
committed
CodeGen from PR 33130 in Azure/azure-rest-api-specs
Merge ad7c697d7621201c249932b1be99a81942c1fdba into 2fceb3a72510cdbeb1dec8b36cb6a0ee709a9876
1 parent f1d300a commit e324797

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

52 files changed

+12978
-0
lines changed
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
# Release History
2+
3+
## 1.0.0b1 (1970-01-01)
4+
5+
- Initial version
Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
Copyright (c) Microsoft Corporation.
2+
3+
MIT License
4+
5+
Permission is hereby granted, free of charge, to any person obtaining a copy
6+
of this software and associated documentation files (the "Software"), to deal
7+
in the Software without restriction, including without limitation the rights
8+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9+
copies of the Software, and to permit persons to whom the Software is
10+
furnished to do so, subject to the following conditions:
11+
12+
The above copyright notice and this permission notice shall be included in all
13+
copies or substantial portions of the Software.
14+
15+
THE SOFTWARE IS PROVIDED *AS IS*, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21+
SOFTWARE.
Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
include *.md
2+
include LICENSE
3+
include azure/ai/projects/onedp/py.typed
4+
recursive-include tests *.py
5+
recursive-include samples *.py *.md
6+
include azure/__init__.py
7+
include azure/ai/__init__.py
8+
include azure/ai/projects/__init__.py
Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,43 @@
1+
# Azure Ai Projects Onedp client library for Python
2+
<!-- write necessary description of service -->
3+
4+
## Getting started
5+
6+
### Install the package
7+
8+
```bash
9+
python -m pip install azure-ai-projects-onedp
10+
```
11+
12+
#### Prequisites
13+
14+
- Python 3.9 or later is required to use this package.
15+
- You need an [Azure subscription][azure_sub] to use this package.
16+
- An existing Azure Ai Projects Onedp instance.
17+
18+
19+
## Contributing
20+
21+
This project welcomes contributions and suggestions. Most contributions require
22+
you to agree to a Contributor License Agreement (CLA) declaring that you have
23+
the right to, and actually do, grant us the rights to use your contribution.
24+
For details, visit https://cla.microsoft.com.
25+
26+
When you submit a pull request, a CLA-bot will automatically determine whether
27+
you need to provide a CLA and decorate the PR appropriately (e.g., label,
28+
comment). Simply follow the instructions provided by the bot. You will only
29+
need to do this once across all repos using our CLA.
30+
31+
This project has adopted the
32+
[Microsoft Open Source Code of Conduct][code_of_conduct]. For more information,
33+
see the Code of Conduct FAQ or contact [email protected] with any
34+
additional questions or comments.
35+
36+
<!-- LINKS -->
37+
[code_of_conduct]: https://opensource.microsoft.com/codeofconduct/
38+
[authenticate_with_token]: https://docs.microsoft.com/azure/cognitive-services/authentication?tabs=powershell#authenticate-with-an-authentication-token
39+
[azure_identity_credentials]: https://github.com/Azure/azure-sdk-for-python/tree/main/sdk/identity/azure-identity#credentials
40+
[azure_identity_pip]: https://pypi.org/project/azure-identity/
41+
[default_azure_credential]: https://github.com/Azure/azure-sdk-for-python/tree/main/sdk/identity/azure-identity#defaultazurecredential
42+
[pip]: https://pypi.org/project/pip/
43+
[azure_sub]: https://azure.microsoft.com/free/
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
{
2+
"commit": "250311b67a4742bfc3f515502baa876afe0cd867",
3+
"repository_url": "https://github.com/Azure/azure-rest-api-specs",
4+
"typespec_src": "specification/ai/Azure.AI.Projects",
5+
"@azure-tools/typespec-python": "0.43.0"
6+
}
Lines changed: 68 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,68 @@
1+
{
2+
"CrossLanguagePackageId": "Azure.AI.Projects",
3+
"CrossLanguageDefinitionId": {
4+
"azure.ai.projects.onedp.models.BaseCredentials": "Azure.AI.Projects.BaseCredentials",
5+
"azure.ai.projects.onedp.models.ApiKeyCredentials": "Azure.AI.Projects.ApiKeyCredentials",
6+
"azure.ai.projects.onedp.models.AssetCredentialResponse": "Azure.AI.Projects.AssetCredentialResponse",
7+
"azure.ai.projects.onedp.models.Index": "Azure.AI.Projects.Index",
8+
"azure.ai.projects.onedp.models.AzureAISearchIndex": "Azure.AI.Projects.AzureAISearchIndex",
9+
"azure.ai.projects.onedp.models.BlobReferenceForConsumption": "Azure.AI.Projects.BlobReferenceForConsumption",
10+
"azure.ai.projects.onedp.models.Connection": "Azure.AI.Projects.Connection",
11+
"azure.ai.projects.onedp.models.CosmosDBIndex": "Azure.AI.Projects.CosmosDBIndex",
12+
"azure.ai.projects.onedp.models.CustomCredential": "Azure.AI.Projects.CustomCredential",
13+
"azure.ai.projects.onedp.models.DatasetVersion": "Azure.AI.Projects.DatasetVersion",
14+
"azure.ai.projects.onedp.models.Deployment": "Azure.AI.Projects.Deployment",
15+
"azure.ai.projects.onedp.models.EmbeddingConfiguration": "Azure.AI.Projects.EmbeddingConfiguration",
16+
"azure.ai.projects.onedp.models.EntraIDCredentials": "Azure.AI.Projects.EntraIDCredentials",
17+
"azure.ai.projects.onedp.models.Evaluation": "Azure.AI.Projects.Evaluation",
18+
"azure.ai.projects.onedp.models.EvaluatorConfiguration": "Azure.AI.Projects.EvaluatorConfiguration",
19+
"azure.ai.projects.onedp.models.FileDatasetVersion": "Azure.AI.Projects.FileDatasetVersion",
20+
"azure.ai.projects.onedp.models.FolderDatasetVersion": "Azure.AI.Projects.FolderDatasetVersion",
21+
"azure.ai.projects.onedp.models.InputData": "Azure.AI.Projects.InputData",
22+
"azure.ai.projects.onedp.models.InputDataset": "Azure.AI.Projects.InputDataset",
23+
"azure.ai.projects.onedp.models.ManagedAzureAISearchIndex": "Azure.AI.Projects.ManagedAzureAISearchIndex",
24+
"azure.ai.projects.onedp.models.ModelDeployment": "Azure.AI.Projects.ModelDeployment",
25+
"azure.ai.projects.onedp.models.NoAuthenticationCredentials": "Azure.AI.Projects.NoAuthenticationCredentials",
26+
"azure.ai.projects.onedp.models.PendingUploadRequest": "Azure.AI.Projects.PendingUploadRequest",
27+
"azure.ai.projects.onedp.models.PendingUploadResponse": "Azure.AI.Projects.PendingUploadResponse",
28+
"azure.ai.projects.onedp.models.RedTeam": "Azure.AI.Projects.RedTeam",
29+
"azure.ai.projects.onedp.models.SasCredential": "Azure.AI.Projects.SasCredential",
30+
"azure.ai.projects.onedp.models.SASCredentials": "Azure.AI.Projects.SASCredentials",
31+
"azure.ai.projects.onedp.models.Sku": "Azure.AI.Projects.Sku",
32+
"azure.ai.projects.onedp.models.ConnectionType": "Azure.AI.Projects.ConnectionType",
33+
"azure.ai.projects.onedp.models.CredentialType": "Azure.AI.Projects.CredentialType",
34+
"azure.ai.projects.onedp.models.DatasetType": "Azure.AI.Projects.DatasetType",
35+
"azure.ai.projects.onedp.models.ListViewType": "Azure.AI.Projects.ListViewType",
36+
"azure.ai.projects.onedp.models.PendingUploadType": "Azure.AI.Projects.PendingUploadType",
37+
"azure.ai.projects.onedp.models.IndexType": "Azure.AI.Projects.IndexType",
38+
"azure.ai.projects.onedp.models.DeploymentType": "Azure.AI.Projects.DeploymentType",
39+
"azure.ai.projects.onedp.models.AttackStrategy": "Azure.AI.Projects.AttackStrategy",
40+
"azure.ai.projects.onedp.models.RiskCategory": "Azure.AI.Projects.RiskCategory",
41+
"azure.ai.projects.onedp.AIProjectClient.connections.get": "Azure.AI.Projects.Connections.get",
42+
"azure.ai.projects.onedp.AIProjectClient.connections.get_with_credentials": "Azure.AI.Projects.Connections.getWithCredentials",
43+
"azure.ai.projects.onedp.AIProjectClient.connections.list": "Azure.AI.Projects.Connections.list",
44+
"azure.ai.projects.onedp.AIProjectClient.connections.list_with_credentials": "Azure.AI.Projects.Connections.listWithCredentials",
45+
"azure.ai.projects.onedp.AIProjectClient.evaluations.get": "Azure.AI.Projects.Evaluations.get",
46+
"azure.ai.projects.onedp.AIProjectClient.evaluations.list": "Azure.AI.Projects.Evaluations.list",
47+
"azure.ai.projects.onedp.AIProjectClient.evaluations.create_run": "Azure.AI.Projects.Evaluations.createRun",
48+
"azure.ai.projects.onedp.AIProjectClient.datasets.list_versions": "Azure.AI.Projects.ServicePatterns.Datasets.listVersions",
49+
"azure.ai.projects.onedp.AIProjectClient.datasets.list_latest": "Azure.AI.Projects.ServicePatterns.Datasets.listLatest",
50+
"azure.ai.projects.onedp.AIProjectClient.datasets.get_version": "Azure.AI.Projects.ServicePatterns.Datasets.getVersion",
51+
"azure.ai.projects.onedp.AIProjectClient.datasets.delete_version": "Azure.AI.Projects.ServicePatterns.Datasets.deleteVersion",
52+
"azure.ai.projects.onedp.AIProjectClient.datasets.create_version": "Azure.AI.Projects.ServicePatterns.Datasets.createVersion",
53+
"azure.ai.projects.onedp.AIProjectClient.datasets.create_or_update_version": "Azure.AI.Projects.ServicePatterns.Datasets.createOrUpdateVersion",
54+
"azure.ai.projects.onedp.AIProjectClient.datasets.start_pending_upload_version": "Azure.AI.Projects.Datasets.startPendingUploadVersion",
55+
"azure.ai.projects.onedp.AIProjectClient.datasets.get_credentials": "Azure.AI.Projects.Datasets.getCredentials",
56+
"azure.ai.projects.onedp.AIProjectClient.indexes.list_versions": "Azure.AI.Projects.ServicePatterns.Indexes.listVersions",
57+
"azure.ai.projects.onedp.AIProjectClient.indexes.list_latest": "Azure.AI.Projects.ServicePatterns.Indexes.listLatest",
58+
"azure.ai.projects.onedp.AIProjectClient.indexes.get_version": "Azure.AI.Projects.ServicePatterns.Indexes.getVersion",
59+
"azure.ai.projects.onedp.AIProjectClient.indexes.delete_version": "Azure.AI.Projects.ServicePatterns.Indexes.deleteVersion",
60+
"azure.ai.projects.onedp.AIProjectClient.indexes.create_version": "Azure.AI.Projects.ServicePatterns.Indexes.createVersion",
61+
"azure.ai.projects.onedp.AIProjectClient.indexes.create_or_update_version": "Azure.AI.Projects.ServicePatterns.Indexes.createOrUpdateVersion",
62+
"azure.ai.projects.onedp.AIProjectClient.deployments.get": "Azure.AI.Projects.Deployments.get",
63+
"azure.ai.projects.onedp.AIProjectClient.deployments.list": "Azure.AI.Projects.Deployments.list",
64+
"azure.ai.projects.onedp.AIProjectClient.red_teams.get": "Azure.AI.Projects.RedTeams.get",
65+
"azure.ai.projects.onedp.AIProjectClient.red_teams.list": "Azure.AI.Projects.RedTeams.list",
66+
"azure.ai.projects.onedp.AIProjectClient.red_teams.create_run": "Azure.AI.Projects.RedTeams.createRun"
67+
}
68+
}
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
__path__ = __import__("pkgutil").extend_path(__path__, __name__) # type: ignore
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
__path__ = __import__("pkgutil").extend_path(__path__, __name__) # type: ignore
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
__path__ = __import__("pkgutil").extend_path(__path__, __name__) # type: ignore
Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
# coding=utf-8
2+
# --------------------------------------------------------------------------
3+
# Copyright (c) Microsoft Corporation. All rights reserved.
4+
# Licensed under the MIT License. See License.txt in the project root for license information.
5+
# Code generated by Microsoft (R) Python Code Generator.
6+
# Changes may cause incorrect behavior and will be lost if the code is regenerated.
7+
# --------------------------------------------------------------------------
8+
# pylint: disable=wrong-import-position
9+
10+
from typing import TYPE_CHECKING
11+
12+
if TYPE_CHECKING:
13+
from ._patch import * # pylint: disable=unused-wildcard-import
14+
15+
from ._client import AIProjectClient # type: ignore
16+
from ._version import VERSION
17+
18+
__version__ = VERSION
19+
20+
try:
21+
from ._patch import __all__ as _patch_all
22+
from ._patch import *
23+
except ImportError:
24+
_patch_all = []
25+
from ._patch import patch_sdk as _patch_sdk
26+
27+
__all__ = [
28+
"AIProjectClient",
29+
]
30+
__all__.extend([p for p in _patch_all if p not in __all__]) # pyright: ignore
31+
32+
_patch_sdk()
Lines changed: 143 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,143 @@
1+
# coding=utf-8
2+
# --------------------------------------------------------------------------
3+
# Copyright (c) Microsoft Corporation. All rights reserved.
4+
# Licensed under the MIT License. See License.txt in the project root for license information.
5+
# Code generated by Microsoft (R) Python Code Generator.
6+
# Changes may cause incorrect behavior and will be lost if the code is regenerated.
7+
# --------------------------------------------------------------------------
8+
9+
from copy import deepcopy
10+
from typing import Any, TYPE_CHECKING, Union
11+
from typing_extensions import Self
12+
13+
from azure.core import PipelineClient
14+
from azure.core.credentials import AzureKeyCredential
15+
from azure.core.pipeline import policies
16+
from azure.core.rest import HttpRequest, HttpResponse
17+
18+
from ._configuration import AIProjectClientConfiguration
19+
from ._serialization import Deserializer, Serializer
20+
from .operations import (
21+
ConnectionsOperations,
22+
DatasetsOperations,
23+
DeploymentsOperations,
24+
EvaluationsOperations,
25+
IndexesOperations,
26+
InternalOperations,
27+
RedTeamsOperations,
28+
ServicePatternsOperations,
29+
)
30+
31+
if TYPE_CHECKING:
32+
from azure.core.credentials import TokenCredential
33+
34+
35+
class AIProjectClient: # pylint: disable=too-many-instance-attributes
36+
"""AIProjectClient.
37+
38+
:ivar internal: InternalOperations operations
39+
:vartype internal: azure.ai.projects.onedp.operations.InternalOperations
40+
:ivar service_patterns: ServicePatternsOperations operations
41+
:vartype service_patterns: azure.ai.projects.onedp.operations.ServicePatternsOperations
42+
:ivar connections: ConnectionsOperations operations
43+
:vartype connections: azure.ai.projects.onedp.operations.ConnectionsOperations
44+
:ivar evaluations: EvaluationsOperations operations
45+
:vartype evaluations: azure.ai.projects.onedp.operations.EvaluationsOperations
46+
:ivar datasets: DatasetsOperations operations
47+
:vartype datasets: azure.ai.projects.onedp.operations.DatasetsOperations
48+
:ivar indexes: IndexesOperations operations
49+
:vartype indexes: azure.ai.projects.onedp.operations.IndexesOperations
50+
:ivar deployments: DeploymentsOperations operations
51+
:vartype deployments: azure.ai.projects.onedp.operations.DeploymentsOperations
52+
:ivar red_teams: RedTeamsOperations operations
53+
:vartype red_teams: azure.ai.projects.onedp.operations.RedTeamsOperations
54+
:param endpoint: Project endpoint. In the form
55+
"https://<your-ai-services-account-name>.services.ai.azure.com/api/projects/_project"
56+
if your Foundry Hub has only one Project, or to use the default Project in your Hub. Or in the
57+
form
58+
"https://<your-ai-services-account-name>.services.ai.azure.com/api/projects/<your-project-name>"
59+
if you want to explicitly
60+
specify the Foundry Project name. Required.
61+
:type endpoint: str
62+
:param credential: Credential used to authenticate requests to the service. Is either a key
63+
credential type or a token credential type. Required.
64+
:type credential: ~azure.core.credentials.AzureKeyCredential or
65+
~azure.core.credentials.TokenCredential
66+
:keyword api_version: The API version to use for this operation. Default value is
67+
"2025-05-15-preview". Note that overriding this default value may result in unsupported
68+
behavior.
69+
:paramtype api_version: str
70+
"""
71+
72+
def __init__(self, endpoint: str, credential: Union[AzureKeyCredential, "TokenCredential"], **kwargs: Any) -> None:
73+
_endpoint = "{endpoint}"
74+
self._config = AIProjectClientConfiguration(endpoint=endpoint, credential=credential, **kwargs)
75+
76+
_policies = kwargs.pop("policies", None)
77+
if _policies is None:
78+
_policies = [
79+
policies.RequestIdPolicy(**kwargs),
80+
self._config.headers_policy,
81+
self._config.user_agent_policy,
82+
self._config.proxy_policy,
83+
policies.ContentDecodePolicy(**kwargs),
84+
self._config.redirect_policy,
85+
self._config.retry_policy,
86+
self._config.authentication_policy,
87+
self._config.custom_hook_policy,
88+
self._config.logging_policy,
89+
policies.DistributedTracingPolicy(**kwargs),
90+
policies.SensitiveHeaderCleanupPolicy(**kwargs) if self._config.redirect_policy else None,
91+
self._config.http_logging_policy,
92+
]
93+
self._client: PipelineClient = PipelineClient(base_url=_endpoint, policies=_policies, **kwargs)
94+
95+
self._serialize = Serializer()
96+
self._deserialize = Deserializer()
97+
self._serialize.client_side_validation = False
98+
self.internal = InternalOperations(self._client, self._config, self._serialize, self._deserialize)
99+
self.service_patterns = ServicePatternsOperations(
100+
self._client, self._config, self._serialize, self._deserialize
101+
)
102+
self.connections = ConnectionsOperations(self._client, self._config, self._serialize, self._deserialize)
103+
self.evaluations = EvaluationsOperations(self._client, self._config, self._serialize, self._deserialize)
104+
self.datasets = DatasetsOperations(self._client, self._config, self._serialize, self._deserialize)
105+
self.indexes = IndexesOperations(self._client, self._config, self._serialize, self._deserialize)
106+
self.deployments = DeploymentsOperations(self._client, self._config, self._serialize, self._deserialize)
107+
self.red_teams = RedTeamsOperations(self._client, self._config, self._serialize, self._deserialize)
108+
109+
def send_request(self, request: HttpRequest, *, stream: bool = False, **kwargs: Any) -> HttpResponse:
110+
"""Runs the network request through the client's chained policies.
111+
112+
>>> from azure.core.rest import HttpRequest
113+
>>> request = HttpRequest("GET", "https://www.example.org/")
114+
<HttpRequest [GET], url: 'https://www.example.org/'>
115+
>>> response = client.send_request(request)
116+
<HttpResponse: 200 OK>
117+
118+
For more information on this code flow, see https://aka.ms/azsdk/dpcodegen/python/send_request
119+
120+
:param request: The network request you want to make. Required.
121+
:type request: ~azure.core.rest.HttpRequest
122+
:keyword bool stream: Whether the response payload will be streamed. Defaults to False.
123+
:return: The response of your network call. Does not do error handling on your response.
124+
:rtype: ~azure.core.rest.HttpResponse
125+
"""
126+
127+
request_copy = deepcopy(request)
128+
path_format_arguments = {
129+
"endpoint": self._serialize.url("self._config.endpoint", self._config.endpoint, "str", skip_quote=True),
130+
}
131+
132+
request_copy.url = self._client.format_url(request_copy.url, **path_format_arguments)
133+
return self._client.send_request(request_copy, stream=stream, **kwargs) # type: ignore
134+
135+
def close(self) -> None:
136+
self._client.close()
137+
138+
def __enter__(self) -> Self:
139+
self._client.__enter__()
140+
return self
141+
142+
def __exit__(self, *exc_details: Any) -> None:
143+
self._client.__exit__(*exc_details)

0 commit comments

Comments
 (0)