Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update to new api version 2023-06-30 #30330

Merged
merged 5 commits into from
Jun 13, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions sdk/digitaltwins/azure-digitaltwins-core/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,10 @@
# Release History

## 1.3.0b1 (2023-06-01)
### Features added
- Updated service API version to use API version 2023-06-30 by default.
- Added support for the new import job. You can now use a blob file in your storage account to import multiple models, twins and relationships at once.

## 1.2.1 (Unreleased)

### Features Added
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -657,3 +657,93 @@ def get_next(continuation_token=None):
get_next,
extract_data
)

@distributed_trace
def get_import_jobs(self, import_job_id, **kwargs):
# type: (str, **Any) -> ImportJob
"""Get an import job.

:param str import_job_id: The ID of the import job.
:return: The import job object.
:rtype: ~azure.digitaltwins.core.models.ImportJob
:raises ~azure.core.exceptions.HttpResponseError:
:raises ~azure.core.exceptions.ResourceNotFoundError: There is no
import job with the provided ID.
"""
return self._client.import_jobs.get_by_id(
import_job_id,
**kwargs
)

@distributed_trace
def list_import_jobs(self, **kwargs):
# type: (**Any) -> ItemPaged[ImportJobCollection]
"""Retrieves all import jobs.

:keyword int results_per_page: The maximum number of items to retrieve per request.
The server may choose to return less than the requested max.
:return: An iterator instance of either ImportJobCollection
:rtype: ~azure.core.paging.ItemPaged[~azure.digitaltwins.core.models.ImportJobCollection]
:raises: ~azure.core.exceptions.HttpResponseError
"""
import_jobs_list_options = None
results_per_page = kwargs.pop('results_per_page', None)
if results_per_page is not None:
import_jobs_list_options = {'max_item_count': results_per_page}

return self._client.import_jobs.list(
import_jobs_list_options=import_jobs_list_options,
**kwargs
)

@distributed_trace
def upsert_import_job(self, import_job_id, import_job, **kwargs):
# type: (str, ImportJob, **Any) -> None
"""Create or update an import job.

:param str import_job_id: The ID of the import job to create or update.
:param ~azure.digitaltwins.core.models.ImportJob import_job: The import job data.
:return: None
:rtype: None
:raises ~azure.core.exceptions.HttpResponseError:
"""
return self._client.import_jobs.add(
import_job_id,
import_job=import_job,
**kwargs
)

@distributed_trace
def delete_import_job(self, import_job_id, **kwargs):
# type: (str, **Any) -> None
"""Delete an import job.

:param str import_job_id: The ID of the import job to delete.
:return: None
:rtype: None
:raises ~azure.core.exceptions.HttpResponseError:
:raises ~azure.core.exceptions.ResourceNotFoundError: There is no
import job with the provided ID.
"""
return self._client.import_jobs.delete(
import_job_id,
**kwargs
)

@distributed_trace
def cancel_import_job(self, import_job_id, **kwargs):
# type: (str, **Any) -> ImportJob
"""Cancel an import job.

:param str import_job_id: The ID of the import job to cancel.
:return: None
:rtype: None
:raises ~azure.core.exceptions.HttpResponseError:
:raises ~azure.core.exceptions.ResourceNotFoundError: There is no
import job with the provided ID.
"""
return self._client.import_jobs.cancel(
import_job_id,
**kwargs
)

Original file line number Diff line number Diff line change
Expand Up @@ -7,12 +7,14 @@
# --------------------------------------------------------------------------

from ._azure_digital_twins_api import AzureDigitalTwinsAPI
from ._version import VERSION

__version__ = VERSION
try:
from ._patch import __all__ as _patch_all
from ._patch import * # type: ignore # pylint: disable=unused-wildcard-import
except ImportError:
_patch_all = []
from ._patch import patch_sdk as _patch_sdk
__all__ = ['AzureDigitalTwinsAPI']
__all__.extend([p for p in _patch_all if p not in __all__])

# `._patch.py` is used for handwritten extensions to the generated code
# Example: https://github.com/Azure/azure-sdk-for-python/blob/main/doc/dev/customize_code/how-to-patch-sdk-code.md
from ._patch import patch_sdk
patch_sdk()
_patch_sdk()
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@

from . import models
from ._configuration import AzureDigitalTwinsAPIConfiguration
from .operations import DigitalTwinModelsOperations, DigitalTwinsOperations, EventRoutesOperations, QueryOperations
from .operations import DigitalTwinModelsOperations, DigitalTwinsOperations, EventRoutesOperations, ImportJobsOperations, QueryOperations

if TYPE_CHECKING:
# pylint: disable=unused-import,ungrouped-imports
Expand All @@ -35,12 +35,14 @@ class AzureDigitalTwinsAPI(object):
:vartype digital_twins: azure.digitaltwins.core.operations.DigitalTwinsOperations
:ivar event_routes: EventRoutesOperations operations
:vartype event_routes: azure.digitaltwins.core.operations.EventRoutesOperations
:ivar import_jobs: ImportJobsOperations operations
:vartype import_jobs: azure.digitaltwins.core.operations.ImportJobsOperations
:param credential: Credential needed for the client to connect to Azure.
:type credential: ~azure.core.credentials.TokenCredential
:param base_url: Service URL. Default value is "https://digitaltwins-hostname".
:type base_url: str
:keyword api_version: Api Version. Default value is "2022-05-31". Note that overriding
this default value may result in unsupported behavior.
:keyword api_version: Api Version. Default value is "2023-06-30". Note that overriding this
default value may result in unsupported behavior.
:paramtype api_version: str
"""

Expand All @@ -58,10 +60,21 @@ def __init__(
self._serialize = Serializer(client_models)
self._deserialize = Deserializer(client_models)
self._serialize.client_side_validation = False
self.digital_twin_models = DigitalTwinModelsOperations(self._client, self._config, self._serialize, self._deserialize)
self.query = QueryOperations(self._client, self._config, self._serialize, self._deserialize)
self.digital_twins = DigitalTwinsOperations(self._client, self._config, self._serialize, self._deserialize)
self.event_routes = EventRoutesOperations(self._client, self._config, self._serialize, self._deserialize)
self.digital_twin_models = DigitalTwinModelsOperations(
self._client, self._config, self._serialize, self._deserialize
)
self.query = QueryOperations(
self._client, self._config, self._serialize, self._deserialize
)
self.digital_twins = DigitalTwinsOperations(
self._client, self._config, self._serialize, self._deserialize
)
self.event_routes = EventRoutesOperations(
self._client, self._config, self._serialize, self._deserialize
)
self.import_jobs = ImportJobsOperations(
self._client, self._config, self._serialize, self._deserialize
)


def _send_request(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,14 +11,13 @@
from azure.core.configuration import Configuration
from azure.core.pipeline import policies

from ._version import VERSION

if TYPE_CHECKING:
# pylint: disable=unused-import,ungrouped-imports
from typing import Any

from azure.core.credentials import TokenCredential

VERSION = "unknown"

class AzureDigitalTwinsAPIConfiguration(Configuration): # pylint: disable=too-many-instance-attributes
"""Configuration for AzureDigitalTwinsAPI.
Expand All @@ -28,8 +27,8 @@ class AzureDigitalTwinsAPIConfiguration(Configuration): # pylint: disable=too-m

:param credential: Credential needed for the client to connect to Azure.
:type credential: ~azure.core.credentials.TokenCredential
:keyword api_version: Api Version. Default value is "2022-05-31". Note that overriding
this default value may result in unsupported behavior.
:keyword api_version: Api Version. Default value is "2023-06-30". Note that overriding this
default value may result in unsupported behavior.
:paramtype api_version: str
"""

Expand All @@ -40,7 +39,7 @@ def __init__(
):
# type: (...) -> None
super(AzureDigitalTwinsAPIConfiguration, self).__init__(**kwargs)
api_version = kwargs.pop('api_version', "2022-05-31") # type: str
api_version = kwargs.pop('api_version', "2023-06-30") # type: str

if credential is None:
raise ValueError("Parameter 'credential' must not be None.")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,4 +28,4 @@
# This file is used for handwritten extensions to the generated code. Example:
# https://github.com/Azure/azure-sdk-for-python/blob/main/doc/dev/customize_code/how-to-patch-sdk-code.md
def patch_sdk():
pass
pass
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,14 @@
# --------------------------------------------------------------------------

from ._azure_digital_twins_api import AzureDigitalTwinsAPI

try:
from ._patch import __all__ as _patch_all
from ._patch import * # type: ignore # pylint: disable=unused-wildcard-import
except ImportError:
_patch_all = []
from ._patch import patch_sdk as _patch_sdk
__all__ = ['AzureDigitalTwinsAPI']
__all__.extend([p for p in _patch_all if p not in __all__])

# `._patch.py` is used for handwritten extensions to the generated code
# Example: https://github.com/Azure/azure-sdk-for-python/blob/main/doc/dev/customize_code/how-to-patch-sdk-code.md
from ._patch import patch_sdk
patch_sdk()
_patch_sdk()
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@

from .. import models
from ._configuration import AzureDigitalTwinsAPIConfiguration
from .operations import DigitalTwinModelsOperations, DigitalTwinsOperations, EventRoutesOperations, QueryOperations
from .operations import DigitalTwinModelsOperations, DigitalTwinsOperations, EventRoutesOperations, ImportJobsOperations, QueryOperations

if TYPE_CHECKING:
# pylint: disable=unused-import,ungrouped-imports
Expand All @@ -34,12 +34,14 @@ class AzureDigitalTwinsAPI:
:vartype digital_twins: azure.digitaltwins.core.aio.operations.DigitalTwinsOperations
:ivar event_routes: EventRoutesOperations operations
:vartype event_routes: azure.digitaltwins.core.aio.operations.EventRoutesOperations
:ivar import_jobs: ImportJobsOperations operations
:vartype import_jobs: azure.digitaltwins.core.aio.operations.ImportJobsOperations
:param credential: Credential needed for the client to connect to Azure.
:type credential: ~azure.core.credentials_async.AsyncTokenCredential
:param base_url: Service URL. Default value is "https://digitaltwins-hostname".
:type base_url: str
:keyword api_version: Api Version. Default value is "2022-05-31". Note that overriding
this default value may result in unsupported behavior.
:keyword api_version: Api Version. Default value is "2023-06-30". Note that overriding this
default value may result in unsupported behavior.
:paramtype api_version: str
"""

Expand All @@ -56,10 +58,21 @@ def __init__(
self._serialize = Serializer(client_models)
self._deserialize = Deserializer(client_models)
self._serialize.client_side_validation = False
self.digital_twin_models = DigitalTwinModelsOperations(self._client, self._config, self._serialize, self._deserialize)
self.query = QueryOperations(self._client, self._config, self._serialize, self._deserialize)
self.digital_twins = DigitalTwinsOperations(self._client, self._config, self._serialize, self._deserialize)
self.event_routes = EventRoutesOperations(self._client, self._config, self._serialize, self._deserialize)
self.digital_twin_models = DigitalTwinModelsOperations(
self._client, self._config, self._serialize, self._deserialize
)
self.query = QueryOperations(
self._client, self._config, self._serialize, self._deserialize
)
self.digital_twins = DigitalTwinsOperations(
self._client, self._config, self._serialize, self._deserialize
)
self.event_routes = EventRoutesOperations(
self._client, self._config, self._serialize, self._deserialize
)
self.import_jobs = ImportJobsOperations(
self._client, self._config, self._serialize, self._deserialize
)


def _send_request(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,12 +11,11 @@
from azure.core.configuration import Configuration
from azure.core.pipeline import policies

from .._version import VERSION

if TYPE_CHECKING:
# pylint: disable=unused-import,ungrouped-imports
from azure.core.credentials_async import AsyncTokenCredential

VERSION = "unknown"

class AzureDigitalTwinsAPIConfiguration(Configuration): # pylint: disable=too-many-instance-attributes
"""Configuration for AzureDigitalTwinsAPI.
Expand All @@ -26,8 +25,8 @@ class AzureDigitalTwinsAPIConfiguration(Configuration): # pylint: disable=too-m

:param credential: Credential needed for the client to connect to Azure.
:type credential: ~azure.core.credentials_async.AsyncTokenCredential
:keyword api_version: Api Version. Default value is "2022-05-31". Note that overriding
this default value may result in unsupported behavior.
:keyword api_version: Api Version. Default value is "2023-06-30". Note that overriding this
default value may result in unsupported behavior.
:paramtype api_version: str
"""

Expand All @@ -37,7 +36,7 @@ def __init__(
**kwargs: Any
) -> None:
super(AzureDigitalTwinsAPIConfiguration, self).__init__(**kwargs)
api_version = kwargs.pop('api_version', "2022-05-31") # type: str
api_version = kwargs.pop('api_version', "2023-06-30") # type: str

if credential is None:
raise ValueError("Parameter 'credential' must not be None.")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,4 +28,4 @@
# This file is used for handwritten extensions to the generated code. Example:
# https://github.com/Azure/azure-sdk-for-python/blob/main/doc/dev/customize_code/how-to-patch-sdk-code.md
def patch_sdk():
pass
pass
Original file line number Diff line number Diff line change
Expand Up @@ -10,10 +10,17 @@
from ._query_operations import QueryOperations
from ._digital_twins_operations import DigitalTwinsOperations
from ._event_routes_operations import EventRoutesOperations
from ._import_jobs_operations import ImportJobsOperations

from ._patch import __all__ as _patch_all
from ._patch import * # type: ignore # pylint: disable=unused-wildcard-import
from ._patch import patch_sdk as _patch_sdk
__all__ = [
'DigitalTwinModelsOperations',
'QueryOperations',
'DigitalTwinsOperations',
'EventRoutesOperations',
'ImportJobsOperations',
]
__all__.extend([p for p in _patch_all if p not in __all__])
_patch_sdk()
Loading