Skip to content

Commit

Permalink
[MixedReality] Migrate to track2 (Azure#3312)
Browse files Browse the repository at this point in the history
  • Loading branch information
00Kai0 authored May 13, 2021
1 parent 1f29b7c commit a3f83b6
Show file tree
Hide file tree
Showing 17 changed files with 264 additions and 216 deletions.
10 changes: 7 additions & 3 deletions src/mixed-reality/HISTORY.rst
Original file line number Diff line number Diff line change
Expand Up @@ -3,14 +3,18 @@
Release History
===============

0.0.4
++++++
* Migrate to track2 SDK

0.0.3
++++++
Add new command `az remote-rendering-account`
Add new command for `az spatial-anchors-account`
* Add new command `az remote-rendering-account`
* Add new command for `az spatial-anchors-account`

0.0.2
++++++
Add azext_metadata.json in package
* Add azext_metadata.json in package

0.0.1
++++++
Expand Down

Large diffs are not rendered by default.

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@
from typing import Any, Optional

from azure.core.credentials import TokenCredential
from azure.core.pipeline.transport import HttpRequest, HttpResponse

from ._configuration import MixedRealityClientConfiguration
from .operations import Operations
Expand Down Expand Up @@ -66,6 +67,24 @@ def __init__(
self.remote_rendering_accounts = RemoteRenderingAccountsOperations(
self._client, self._config, self._serialize, self._deserialize)

def _send_request(self, http_request, **kwargs):
# type: (HttpRequest, Any) -> HttpResponse
"""Runs the network request through the client's chained policies.
:param http_request: The network request you want to make. Required.
:type http_request: ~azure.core.pipeline.transport.HttpRequest
:keyword bool stream: Whether the response payload will be streamed. Defaults to True.
:return: The response of your network call. Does not do error handling on your response.
:rtype: ~azure.core.pipeline.transport.HttpResponse
"""
path_format_arguments = {
'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'),
}
http_request.url = self._client.format_url(http_request.url, **path_format_arguments)
stream = kwargs.pop("stream", True)
pipeline_response = self._client._pipeline.run(http_request, stream=stream, **kwargs)
return pipeline_response.http_response

def close(self):
# type: () -> None
self._client.close()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,4 +6,4 @@
# Changes may cause incorrect behavior and will be lost if the code is regenerated.
# --------------------------------------------------------------------------

VERSION = "1.0.0b1"
VERSION = "0.0.1"
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@

from typing import Any, Optional, TYPE_CHECKING

from azure.core.pipeline.transport import AsyncHttpResponse, HttpRequest
from azure.mgmt.core import AsyncARMPipelineClient
from msrest import Deserializer, Serializer

Expand Down Expand Up @@ -63,6 +64,23 @@ def __init__(
self.remote_rendering_accounts = RemoteRenderingAccountsOperations(
self._client, self._config, self._serialize, self._deserialize)

async def _send_request(self, http_request: HttpRequest, **kwargs: Any) -> AsyncHttpResponse:
"""Runs the network request through the client's chained policies.
:param http_request: The network request you want to make. Required.
:type http_request: ~azure.core.pipeline.transport.HttpRequest
:keyword bool stream: Whether the response payload will be streamed. Defaults to True.
:return: The response of your network call. Does not do error handling on your response.
:rtype: ~azure.core.pipeline.transport.AsyncHttpResponse
"""
path_format_arguments = {
'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'),
}
http_request.url = self._client.format_url(http_request.url, **path_format_arguments)
stream = kwargs.pop("stream", True)
pipeline_response = await self._client._pipeline.run(http_request, stream=stream, **kwargs)
return pipeline_response.http_response

async def close(self) -> None:
await self._client.close()

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
from azure.core.pipeline.transport import AsyncHttpResponse, HttpRequest
from azure.mgmt.core.exceptions import ARMErrorFormat

from ... import models
from ... import models as _models

T = TypeVar('T')
ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]]
Expand All @@ -23,9 +23,9 @@ class MixedRealityClientOperationsMixin:
async def check_name_availability_local(
self,
location: str,
check_name_availability: "models.CheckNameAvailabilityRequest",
check_name_availability: "_models.CheckNameAvailabilityRequest",
**kwargs
) -> "models.CheckNameAvailabilityResponse":
) -> "_models.CheckNameAvailabilityResponse":
"""Check Name Availability for local uniqueness.
:param location: The location in which uniqueness will be verified.
Expand All @@ -37,7 +37,7 @@ async def check_name_availability_local(
:rtype: ~azure.mgmt.mixedreality.models.CheckNameAvailabilityResponse
:raises: ~azure.core.exceptions.HttpResponseError
"""
cls = kwargs.pop('cls', None) # type: ClsType["models.CheckNameAvailabilityResponse"]
cls = kwargs.pop('cls', None) # type: ClsType["_models.CheckNameAvailabilityResponse"]
error_map = {
401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
from azure.core.pipeline.transport import AsyncHttpResponse, HttpRequest
from azure.mgmt.core.exceptions import ARMErrorFormat

from ... import models
from ... import models as _models

T = TypeVar('T')
ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]]
Expand All @@ -33,7 +33,7 @@ class Operations:
:param deserializer: An object model deserializer.
"""

models = models
models = _models

def __init__(self, client, config, serializer, deserializer) -> None:
self._client = client
Expand All @@ -44,15 +44,15 @@ def __init__(self, client, config, serializer, deserializer) -> None:
def list(
self,
**kwargs
) -> AsyncIterable["models.OperationPage"]:
) -> AsyncIterable["_models.OperationPage"]:
"""Exposing Available Operations.
:keyword callable cls: A custom type or function that will be passed the direct response
:return: An iterator like instance of either OperationPage or the result of cls(response)
:rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.mixedreality.models.OperationPage]
:raises: ~azure.core.exceptions.HttpResponseError
"""
cls = kwargs.pop('cls', None) # type: ClsType["models.OperationPage"]
cls = kwargs.pop('cls', None) # type: ClsType["_models.OperationPage"]
error_map = {
401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
from azure.core.pipeline.transport import AsyncHttpResponse, HttpRequest
from azure.mgmt.core.exceptions import ARMErrorFormat

from ... import models
from ... import models as _models

T = TypeVar('T')
ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]]
Expand All @@ -33,7 +33,7 @@ class RemoteRenderingAccountsOperations:
:param deserializer: An object model deserializer.
"""

models = models
models = _models

def __init__(self, client, config, serializer, deserializer) -> None:
self._client = client
Expand All @@ -44,15 +44,15 @@ def __init__(self, client, config, serializer, deserializer) -> None:
def list_by_subscription(
self,
**kwargs
) -> AsyncIterable["models.RemoteRenderingAccountPage"]:
) -> AsyncIterable["_models.RemoteRenderingAccountPage"]:
"""List Remote Rendering Accounts by Subscription.
:keyword callable cls: A custom type or function that will be passed the direct response
:return: An iterator like instance of either RemoteRenderingAccountPage or the result of cls(response)
:rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.mixedreality.models.RemoteRenderingAccountPage]
:raises: ~azure.core.exceptions.HttpResponseError
"""
cls = kwargs.pop('cls', None) # type: ClsType["models.RemoteRenderingAccountPage"]
cls = kwargs.pop('cls', None) # type: ClsType["_models.RemoteRenderingAccountPage"]
error_map = {
401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError
}
Expand Down Expand Up @@ -111,7 +111,7 @@ def list_by_resource_group(
self,
resource_group_name: str,
**kwargs
) -> AsyncIterable["models.RemoteRenderingAccountPage"]:
) -> AsyncIterable["_models.RemoteRenderingAccountPage"]:
"""List Resources by Resource Group.
:param resource_group_name: Name of an Azure resource group.
Expand All @@ -121,7 +121,7 @@ def list_by_resource_group(
:rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.mixedreality.models.RemoteRenderingAccountPage]
:raises: ~azure.core.exceptions.HttpResponseError
"""
cls = kwargs.pop('cls', None) # type: ClsType["models.RemoteRenderingAccountPage"]
cls = kwargs.pop('cls', None) # type: ClsType["_models.RemoteRenderingAccountPage"]
error_map = {
401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError
}
Expand Down Expand Up @@ -237,7 +237,7 @@ async def get(
resource_group_name: str,
account_name: str,
**kwargs
) -> "models.RemoteRenderingAccount":
) -> "_models.RemoteRenderingAccount":
"""Retrieve a Remote Rendering Account.
:param resource_group_name: Name of an Azure resource group.
Expand All @@ -249,7 +249,7 @@ async def get(
:rtype: ~azure.mgmt.mixedreality.models.RemoteRenderingAccount
:raises: ~azure.core.exceptions.HttpResponseError
"""
cls = kwargs.pop('cls', None) # type: ClsType["models.RemoteRenderingAccount"]
cls = kwargs.pop('cls', None) # type: ClsType["_models.RemoteRenderingAccount"]
error_map = {
401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError
}
Expand Down Expand Up @@ -294,9 +294,9 @@ async def update(
self,
resource_group_name: str,
account_name: str,
remote_rendering_account: "models.RemoteRenderingAccount",
remote_rendering_account: "_models.RemoteRenderingAccount",
**kwargs
) -> "models.RemoteRenderingAccount":
) -> "_models.RemoteRenderingAccount":
"""Updating a Remote Rendering Account.
:param resource_group_name: Name of an Azure resource group.
Expand All @@ -310,7 +310,7 @@ async def update(
:rtype: ~azure.mgmt.mixedreality.models.RemoteRenderingAccount
:raises: ~azure.core.exceptions.HttpResponseError
"""
cls = kwargs.pop('cls', None) # type: ClsType["models.RemoteRenderingAccount"]
cls = kwargs.pop('cls', None) # type: ClsType["_models.RemoteRenderingAccount"]
error_map = {
401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError
}
Expand Down Expand Up @@ -360,9 +360,9 @@ async def create(
self,
resource_group_name: str,
account_name: str,
remote_rendering_account: "models.RemoteRenderingAccount",
remote_rendering_account: "_models.RemoteRenderingAccount",
**kwargs
) -> "models.RemoteRenderingAccount":
) -> "_models.RemoteRenderingAccount":
"""Creating or Updating a Remote Rendering Account.
:param resource_group_name: Name of an Azure resource group.
Expand All @@ -376,7 +376,7 @@ async def create(
:rtype: ~azure.mgmt.mixedreality.models.RemoteRenderingAccount
:raises: ~azure.core.exceptions.HttpResponseError
"""
cls = kwargs.pop('cls', None) # type: ClsType["models.RemoteRenderingAccount"]
cls = kwargs.pop('cls', None) # type: ClsType["_models.RemoteRenderingAccount"]
error_map = {
401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError
}
Expand Down Expand Up @@ -431,7 +431,7 @@ async def list_keys(
resource_group_name: str,
account_name: str,
**kwargs
) -> "models.AccountKeys":
) -> "_models.AccountKeys":
"""List Both of the 2 Keys of a Remote Rendering Account.
:param resource_group_name: Name of an Azure resource group.
Expand All @@ -443,7 +443,7 @@ async def list_keys(
:rtype: ~azure.mgmt.mixedreality.models.AccountKeys
:raises: ~azure.core.exceptions.HttpResponseError
"""
cls = kwargs.pop('cls', None) # type: ClsType["models.AccountKeys"]
cls = kwargs.pop('cls', None) # type: ClsType["_models.AccountKeys"]
error_map = {
401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError
}
Expand Down Expand Up @@ -488,9 +488,9 @@ async def regenerate_keys(
self,
resource_group_name: str,
account_name: str,
regenerate: "models.AccountKeyRegenerateRequest",
regenerate: "_models.AccountKeyRegenerateRequest",
**kwargs
) -> "models.AccountKeys":
) -> "_models.AccountKeys":
"""Regenerate specified Key of a Remote Rendering Account.
:param resource_group_name: Name of an Azure resource group.
Expand All @@ -504,7 +504,7 @@ async def regenerate_keys(
:rtype: ~azure.mgmt.mixedreality.models.AccountKeys
:raises: ~azure.core.exceptions.HttpResponseError
"""
cls = kwargs.pop('cls', None) # type: ClsType["models.AccountKeys"]
cls = kwargs.pop('cls', None) # type: ClsType["_models.AccountKeys"]
error_map = {
401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError
}
Expand Down
Loading

0 comments on commit a3f83b6

Please sign in to comment.