Skip to content

Commit

Permalink
code and test (Azure#27356)
Browse files Browse the repository at this point in the history
Co-authored-by: PythonSdkPipelines <PythonSdkPipelines>
  • Loading branch information
azure-sdk authored Nov 8, 2022
1 parent 461dff5 commit 4c09853
Show file tree
Hide file tree
Showing 127 changed files with 6,007 additions and 991 deletions.
14 changes: 14 additions & 0 deletions sdk/devcenter/azure-mgmt-devcenter/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,19 @@
# Release History

## 1.0.0b3 (2022-11-08)

### Features Added

- Model Catalog has a new parameter sync_state
- Model CatalogProperties has a new parameter sync_state
- Model OperationStatus has a new parameter operations
- Model OperationStatus has a new parameter resource_id

### Breaking Changes

- Client name is changed from `DevCenterClient` to `DevCenterMgmtClient`
- Parameter status of model OperationStatus is now required

## 1.0.0b2 (2022-09-29)

### Features Added
Expand Down
8 changes: 4 additions & 4 deletions sdk/devcenter/azure-mgmt-devcenter/_meta.json
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
{
"commit": "4903b1ed79e30f689d7c469cfa06734cfcd106d6",
"repository_url": "https://github.com/Azure/azure-rest-api-specs",
"autorest": "3.9.2",
"use": [
"@autorest/python@6.1.6",
"@autorest/python@6.2.1",
"@autorest/modelerfour@4.24.3"
],
"commit": "14677ba21f6b5676e79b33d699f7a103dd8f255f",
"repository_url": "https://github.com/Azure/azure-rest-api-specs",
"autorest_command": "autorest specification/devcenter/resource-manager/readme.md --python --python-sdks-folder=/home/vsts/work/1/azure-sdk-for-python/sdk --use=@autorest/python@6.1.6 --use=@autorest/modelerfour@4.24.3 --version=3.9.2 --version-tolerant=False",
"autorest_command": "autorest specification/devcenter/resource-manager/readme.md --generate-sample=True --include-x-ms-examples-original-file=True --python --python-sdks-folder=/home/vsts/work/1/azure-sdk-for-python/sdk --use=@autorest/python@6.2.1 --use=@autorest/modelerfour@4.24.3 --version=3.9.2 --version-tolerant=False",
"readme": "specification/devcenter/resource-manager/readme.md"
}
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
# Changes may cause incorrect behavior and will be lost if the code is regenerated.
# --------------------------------------------------------------------------

from ._dev_center_client import DevCenterClient
from ._dev_center_mgmt_client import DevCenterMgmtClient
from ._version import VERSION

__version__ = VERSION
Expand All @@ -18,7 +18,9 @@
_patch_all = []
from ._patch import patch_sdk as _patch_sdk

__all__ = ["DevCenterClient"]
__all__ = [
"DevCenterMgmtClient",
]
__all__.extend([p for p in _patch_all if p not in __all__])

_patch_sdk()
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
# Changes may cause incorrect behavior and will be lost if the code is regenerated.
# --------------------------------------------------------------------------

import sys
from typing import Any, TYPE_CHECKING

from azure.core.configuration import Configuration
Expand All @@ -14,30 +15,34 @@

from ._version import VERSION

if sys.version_info >= (3, 8):
from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports
else:
from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports

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


class DevCenterClientConfiguration(Configuration): # pylint: disable=too-many-instance-attributes
"""Configuration for DevCenterClient.
class DevCenterMgmtClientConfiguration(Configuration): # pylint: disable=too-many-instance-attributes
"""Configuration for DevCenterMgmtClient.
Note that all parameters used to create this instance are saved as instance
attributes.
:param credential: Credential needed for the client to connect to Azure. Required.
:type credential: ~azure.core.credentials.TokenCredential
:param subscription_id: Unique identifier of the Azure subscription. This is a GUID-formatted
string (e.g. 00000000-0000-0000-0000-000000000000). Required.
:param subscription_id: The ID of the target subscription. Required.
:type subscription_id: str
:keyword api_version: Api Version. Default value is "2022-09-01-preview". Note that overriding
:keyword api_version: Api Version. Default value is "2022-10-12-preview". Note that overriding
this default value may result in unsupported behavior.
:paramtype api_version: str
"""

def __init__(self, credential: "TokenCredential", subscription_id: str, **kwargs: Any) -> None:
super(DevCenterClientConfiguration, self).__init__(**kwargs)
api_version = kwargs.pop("api_version", "2022-09-01-preview") # type: str
super(DevCenterMgmtClientConfiguration, self).__init__(**kwargs)
api_version = kwargs.pop("api_version", "2022-10-12-preview") # type: Literal["2022-10-12-preview"]

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 @@ -13,7 +13,7 @@
from azure.mgmt.core import ARMPipelineClient

from . import models
from ._configuration import DevCenterClientConfiguration
from ._configuration import DevCenterMgmtClientConfiguration
from ._serialization import Deserializer, Serializer
from .operations import (
AttachedNetworksOperations,
Expand Down Expand Up @@ -41,7 +41,7 @@
from azure.core.credentials import TokenCredential


class DevCenterClient: # pylint: disable=client-accepts-api-version-keyword,too-many-instance-attributes
class DevCenterMgmtClient: # pylint: disable=client-accepts-api-version-keyword,too-many-instance-attributes
"""DevCenter Management API.
:ivar dev_centers: DevCentersOperations operations
Expand Down Expand Up @@ -84,12 +84,11 @@ class DevCenterClient: # pylint: disable=client-accepts-api-version-keyword,too
:vartype network_connections: azure.mgmt.devcenter.operations.NetworkConnectionsOperations
:param credential: Credential needed for the client to connect to Azure. Required.
:type credential: ~azure.core.credentials.TokenCredential
:param subscription_id: Unique identifier of the Azure subscription. This is a GUID-formatted
string (e.g. 00000000-0000-0000-0000-000000000000). Required.
:param subscription_id: The ID of the target subscription. Required.
:type subscription_id: str
:param base_url: Service URL. Default value is "https://management.azure.com".
:type base_url: str
:keyword api_version: Api Version. Default value is "2022-09-01-preview". Note that overriding
:keyword api_version: Api Version. Default value is "2022-10-12-preview". Note that overriding
this default value may result in unsupported behavior.
:paramtype api_version: str
:keyword int polling_interval: Default waiting time between two polls for LRO operations if no
Expand All @@ -103,7 +102,9 @@ def __init__(
base_url: str = "https://management.azure.com",
**kwargs: Any
) -> None:
self._config = DevCenterClientConfiguration(credential=credential, subscription_id=subscription_id, **kwargs)
self._config = DevCenterMgmtClientConfiguration(
credential=credential, subscription_id=subscription_id, **kwargs
)
self._client = ARMPipelineClient(base_url=base_url, config=self._config, **kwargs)

client_models = {k: v for k, v in models.__dict__.items() if isinstance(v, type)}
Expand Down Expand Up @@ -170,7 +171,7 @@ def close(self):
self._client.close()

def __enter__(self):
# type: () -> DevCenterClient
# type: () -> DevCenterMgmtClient
self._client.__enter__()
return self

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.0b2"
VERSION = "1.0.0b3"
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
# Changes may cause incorrect behavior and will be lost if the code is regenerated.
# --------------------------------------------------------------------------

from ._dev_center_client import DevCenterClient
from ._dev_center_mgmt_client import DevCenterMgmtClient

try:
from ._patch import __all__ as _patch_all
Expand All @@ -15,7 +15,9 @@
_patch_all = []
from ._patch import patch_sdk as _patch_sdk

__all__ = ["DevCenterClient"]
__all__ = [
"DevCenterMgmtClient",
]
__all__.extend([p for p in _patch_all if p not in __all__])

_patch_sdk()
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
# Changes may cause incorrect behavior and will be lost if the code is regenerated.
# --------------------------------------------------------------------------

import sys
from typing import Any, TYPE_CHECKING

from azure.core.configuration import Configuration
Expand All @@ -14,30 +15,34 @@

from .._version import VERSION

if sys.version_info >= (3, 8):
from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports
else:
from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports

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


class DevCenterClientConfiguration(Configuration): # pylint: disable=too-many-instance-attributes
"""Configuration for DevCenterClient.
class DevCenterMgmtClientConfiguration(Configuration): # pylint: disable=too-many-instance-attributes
"""Configuration for DevCenterMgmtClient.
Note that all parameters used to create this instance are saved as instance
attributes.
:param credential: Credential needed for the client to connect to Azure. Required.
:type credential: ~azure.core.credentials_async.AsyncTokenCredential
:param subscription_id: Unique identifier of the Azure subscription. This is a GUID-formatted
string (e.g. 00000000-0000-0000-0000-000000000000). Required.
:param subscription_id: The ID of the target subscription. Required.
:type subscription_id: str
:keyword api_version: Api Version. Default value is "2022-09-01-preview". Note that overriding
:keyword api_version: Api Version. Default value is "2022-10-12-preview". Note that overriding
this default value may result in unsupported behavior.
:paramtype api_version: str
"""

def __init__(self, credential: "AsyncTokenCredential", subscription_id: str, **kwargs: Any) -> None:
super(DevCenterClientConfiguration, self).__init__(**kwargs)
api_version = kwargs.pop("api_version", "2022-09-01-preview") # type: str
super(DevCenterMgmtClientConfiguration, self).__init__(**kwargs)
api_version = kwargs.pop("api_version", "2022-10-12-preview") # type: Literal["2022-10-12-preview"]

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 @@ -14,7 +14,7 @@

from .. import models
from .._serialization import Deserializer, Serializer
from ._configuration import DevCenterClientConfiguration
from ._configuration import DevCenterMgmtClientConfiguration
from .operations import (
AttachedNetworksOperations,
CatalogsOperations,
Expand All @@ -41,7 +41,7 @@
from azure.core.credentials_async import AsyncTokenCredential


class DevCenterClient: # pylint: disable=client-accepts-api-version-keyword,too-many-instance-attributes
class DevCenterMgmtClient: # pylint: disable=client-accepts-api-version-keyword,too-many-instance-attributes
"""DevCenter Management API.
:ivar dev_centers: DevCentersOperations operations
Expand Down Expand Up @@ -84,12 +84,11 @@ class DevCenterClient: # pylint: disable=client-accepts-api-version-keyword,too
:vartype network_connections: azure.mgmt.devcenter.aio.operations.NetworkConnectionsOperations
:param credential: Credential needed for the client to connect to Azure. Required.
:type credential: ~azure.core.credentials_async.AsyncTokenCredential
:param subscription_id: Unique identifier of the Azure subscription. This is a GUID-formatted
string (e.g. 00000000-0000-0000-0000-000000000000). Required.
:param subscription_id: The ID of the target subscription. Required.
:type subscription_id: str
:param base_url: Service URL. Default value is "https://management.azure.com".
:type base_url: str
:keyword api_version: Api Version. Default value is "2022-09-01-preview". Note that overriding
:keyword api_version: Api Version. Default value is "2022-10-12-preview". Note that overriding
this default value may result in unsupported behavior.
:paramtype api_version: str
:keyword int polling_interval: Default waiting time between two polls for LRO operations if no
Expand All @@ -103,7 +102,9 @@ def __init__(
base_url: str = "https://management.azure.com",
**kwargs: Any
) -> None:
self._config = DevCenterClientConfiguration(credential=credential, subscription_id=subscription_id, **kwargs)
self._config = DevCenterMgmtClientConfiguration(
credential=credential, subscription_id=subscription_id, **kwargs
)
self._client = AsyncARMPipelineClient(base_url=base_url, config=self._config, **kwargs)

client_models = {k: v for k, v in models.__dict__.items() if isinstance(v, type)}
Expand Down Expand Up @@ -168,7 +169,7 @@ def _send_request(self, request: HttpRequest, **kwargs: Any) -> Awaitable[AsyncH
async def close(self) -> None:
await self._client.close()

async def __aenter__(self) -> "DevCenterClient":
async def __aenter__(self) -> "DevCenterMgmtClient":
await self._client.__aenter__()
return self

Expand Down
Loading

0 comments on commit 4c09853

Please sign in to comment.