Skip to content

Commit 4007a8a

Browse files
authored
[DevCenter] azure-developer-devcenter 1.0.0b2 (Azure#28530)
# Description This pull request includes changes to the azure-developer-devcenter SDK that constitute version 1.0.0b2. This SDK version is built around version **2022-11-11-preview** of our Data Plane API. The most notable change from 1.0.0b1 is the use of an endpoint URI to construct clients, rather than tenant ID + dev center name, which was the architecture board's largest point of feedback for us in our initial review. # All SDK Contribution checklist: - [x] **The pull request does not introduce [breaking changes]** - [x] **CHANGELOG is updated for new features, bug fixes or other significant changes.** - [x] **I have read the [contribution guidelines](https://github.com/Azure/azure-sdk-for-python/blob/main/CONTRIBUTING.md).** ## General Guidelines and Best Practices - [x] Title of the pull request is clear and informative. - [x] There are a small number of commits, each of which have an informative message. This means that previously merged commits do not appear in the history of the PR. For more information on cleaning up the commits in your PR, [see this page](https://github.com/Azure/azure-powershell/blob/master/documentation/development-docs/cleaning-up-commits.md). ### [Testing Guidelines](https://github.com/Azure/azure-sdk-for-python/blob/main/CONTRIBUTING.md##building-and-testing) - [x] Pull request includes test coverage for the included changes.
1 parent 80cd460 commit 4007a8a

24 files changed

+3022
-3752
lines changed

sdk/devcenter/azure-developer-devcenter/CHANGELOG.md

Lines changed: 15 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,26 @@
11
# Release History
22

3-
## 1.0.0b2 (Unreleased)
3+
## 1.0.0b2 (2023-02-07)
44

5-
### Features Added
5+
This release updates the Azure DevCenter library to use the 2022-11-11-preview API.
66

77
### Breaking Changes
88

9+
- `DevCenterClient` now accepts an endpoint URI on construction rather than tenant ID + dev center name.
10+
11+
### Features Added
12+
13+
- Added upcoming actions APIs to dev boxes.
14+
- `delay_upcoming_action`
15+
- `get_upcoming_action`
16+
- `list_upcoming_actions`
17+
- `skip_upcoming_action`
18+
919
### Bugs Fixed
1020

11-
### Other Changes
21+
- Invalid response types removed from `begin_delete_dev_box`, `begin_start_dev_box`, and `begin_stop_dev_box` APIs.
22+
- Invalid `begin_delete_environment_action` API removed from `DevCenterClient`.
23+
- Unimplemented artifacts APIs removed from `DevCenterClient`.
1224

1325
## 1.0.0b1 (2022-11-11)
1426

sdk/devcenter/azure-developer-devcenter/azure/developer/devcenter/__init__.py

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,12 +13,14 @@
1313

1414
try:
1515
from ._patch import __all__ as _patch_all
16-
from ._patch import * # type: ignore # pylint: disable=unused-wildcard-import
16+
from ._patch import * # pylint: disable=unused-wildcard-import
1717
except ImportError:
1818
_patch_all = []
1919
from ._patch import patch_sdk as _patch_sdk
2020

21-
__all__ = ["DevCenterClient"]
21+
__all__ = [
22+
"DevCenterClient",
23+
]
2224
__all__.extend([p for p in _patch_all if p not in __all__])
2325

2426
_patch_sdk()

sdk/devcenter/azure-developer-devcenter/azure/developer/devcenter/_client.py

Lines changed: 10 additions & 39 deletions
Original file line numberDiff line numberDiff line change
@@ -18,8 +18,6 @@
1818

1919
if TYPE_CHECKING:
2020
# pylint: disable=unused-import,ungrouped-imports
21-
from typing import Dict
22-
2321
from azure.core.credentials import TokenCredential
2422

2523

@@ -32,38 +30,20 @@ class DevCenterClient: # pylint: disable=client-accepts-api-version-keyword
3230
:vartype dev_boxes: azure.developer.devcenter.operations.DevBoxesOperations
3331
:ivar environments: EnvironmentsOperations operations
3432
:vartype environments: azure.developer.devcenter.operations.EnvironmentsOperations
35-
:param tenant_id: The tenant to operate on. Required.
36-
:type tenant_id: str
37-
:param dev_center: The DevCenter to operate on. Required.
38-
:type dev_center: str
33+
:param endpoint: The DevCenter-specific URI to operate on. Required.
34+
:type endpoint: str
3935
:param credential: Credential needed for the client to connect to Azure. Required.
4036
:type credential: ~azure.core.credentials.TokenCredential
41-
:param dev_center_dns_suffix: The DNS suffix used as the base for all devcenter requests.
42-
Default value is "devcenter.azure.com".
43-
:type dev_center_dns_suffix: str
44-
:keyword api_version: Api Version. Default value is "2022-03-01-preview". Note that overriding
37+
:keyword api_version: Api Version. Default value is "2022-11-11-preview". Note that overriding
4538
this default value may result in unsupported behavior.
4639
:paramtype api_version: str
4740
:keyword int polling_interval: Default waiting time between two polls for LRO operations if no
4841
Retry-After header is present.
4942
"""
5043

51-
def __init__(
52-
self,
53-
tenant_id: str,
54-
dev_center: str,
55-
credential: "TokenCredential",
56-
dev_center_dns_suffix: str = "devcenter.azure.com",
57-
**kwargs: Any
58-
) -> None:
59-
_endpoint = "https://{tenantId}-{devCenter}.{devCenterDnsSuffix}"
60-
self._config = DevCenterClientConfiguration(
61-
tenant_id=tenant_id,
62-
dev_center=dev_center,
63-
credential=credential,
64-
dev_center_dns_suffix=dev_center_dns_suffix,
65-
**kwargs
66-
)
44+
def __init__(self, endpoint: str, credential: "TokenCredential", **kwargs: Any) -> None:
45+
_endpoint = "{endpoint}"
46+
self._config = DevCenterClientConfiguration(endpoint=endpoint, credential=credential, **kwargs)
6747
self._client = PipelineClient(base_url=_endpoint, config=self._config, **kwargs)
6848

6949
self._serialize = Serializer()
@@ -93,27 +73,18 @@ def send_request(self, request: HttpRequest, **kwargs: Any) -> HttpResponse:
9373

9474
request_copy = deepcopy(request)
9575
path_format_arguments = {
96-
"tenantId": self._serialize.url("self._config.tenant_id", self._config.tenant_id, "str", skip_quote=True),
97-
"devCenter": self._serialize.url(
98-
"self._config.dev_center", self._config.dev_center, "str", skip_quote=True
99-
),
100-
"devCenterDnsSuffix": self._serialize.url(
101-
"self._config.dev_center_dns_suffix", self._config.dev_center_dns_suffix, "str", skip_quote=True
102-
),
76+
"endpoint": self._serialize.url("self._config.endpoint", self._config.endpoint, "str", skip_quote=True),
10377
}
10478

10579
request_copy.url = self._client.format_url(request_copy.url, **path_format_arguments)
10680
return self._client.send_request(request_copy, **kwargs)
10781

108-
def close(self):
109-
# type: () -> None
82+
def close(self) -> None:
11083
self._client.close()
11184

112-
def __enter__(self):
113-
# type: () -> DevCenterClient
85+
def __enter__(self) -> "DevCenterClient":
11486
self._client.__enter__()
11587
return self
11688

117-
def __exit__(self, *exc_details):
118-
# type: (Any) -> None
89+
def __exit__(self, *exc_details) -> None:
11990
self._client.__exit__(*exc_details)

sdk/devcenter/azure-developer-devcenter/azure/developer/devcenter/_configuration.py

Lines changed: 15 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -6,13 +6,19 @@
66
# Changes may cause incorrect behavior and will be lost if the code is regenerated.
77
# --------------------------------------------------------------------------
88

9+
import sys
910
from typing import Any, TYPE_CHECKING
1011

1112
from azure.core.configuration import Configuration
1213
from azure.core.pipeline import policies
1314

1415
from ._version import VERSION
1516

17+
if sys.version_info >= (3, 8):
18+
from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports
19+
else:
20+
from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports
21+
1622
if TYPE_CHECKING:
1723
# pylint: disable=unused-import,ungrouped-imports
1824
from azure.core.credentials import TokenCredential
@@ -24,53 +30,32 @@ class DevCenterClientConfiguration(Configuration): # pylint: disable=too-many-i
2430
Note that all parameters used to create this instance are saved as instance
2531
attributes.
2632
27-
:param tenant_id: The tenant to operate on. Required.
28-
:type tenant_id: str
29-
:param dev_center: The DevCenter to operate on. Required.
30-
:type dev_center: str
33+
:param endpoint: The DevCenter-specific URI to operate on. Required.
34+
:type endpoint: str
3135
:param credential: Credential needed for the client to connect to Azure. Required.
3236
:type credential: ~azure.core.credentials.TokenCredential
33-
:param dev_center_dns_suffix: The DNS suffix used as the base for all devcenter requests.
34-
Default value is "devcenter.azure.com".
35-
:type dev_center_dns_suffix: str
36-
:keyword api_version: Api Version. Default value is "2022-03-01-preview". Note that overriding
37+
:keyword api_version: Api Version. Default value is "2022-11-11-preview". Note that overriding
3738
this default value may result in unsupported behavior.
3839
:paramtype api_version: str
3940
"""
4041

41-
def __init__(
42-
self,
43-
tenant_id: str,
44-
dev_center: str,
45-
credential: "TokenCredential",
46-
dev_center_dns_suffix: str = "devcenter.azure.com",
47-
**kwargs: Any
48-
) -> None:
42+
def __init__(self, endpoint: str, credential: "TokenCredential", **kwargs: Any) -> None:
4943
super(DevCenterClientConfiguration, self).__init__(**kwargs)
50-
api_version = kwargs.pop("api_version", "2022-03-01-preview") # type: str
44+
api_version: Literal["2022-11-11-preview"] = kwargs.pop("api_version", "2022-11-11-preview")
5145

52-
if tenant_id is None:
53-
raise ValueError("Parameter 'tenant_id' must not be None.")
54-
if dev_center is None:
55-
raise ValueError("Parameter 'dev_center' must not be None.")
46+
if endpoint is None:
47+
raise ValueError("Parameter 'endpoint' must not be None.")
5648
if credential is None:
5749
raise ValueError("Parameter 'credential' must not be None.")
58-
if dev_center_dns_suffix is None:
59-
raise ValueError("Parameter 'dev_center_dns_suffix' must not be None.")
6050

61-
self.tenant_id = tenant_id
62-
self.dev_center = dev_center
51+
self.endpoint = endpoint
6352
self.credential = credential
64-
self.dev_center_dns_suffix = dev_center_dns_suffix
6553
self.api_version = api_version
6654
self.credential_scopes = kwargs.pop("credential_scopes", ["https://devcenter.azure.com/.default"])
6755
kwargs.setdefault("sdk_moniker", "developer-devcenter/{}".format(VERSION))
6856
self._configure(**kwargs)
6957

70-
def _configure(
71-
self, **kwargs # type: Any
72-
):
73-
# type: (...) -> None
58+
def _configure(self, **kwargs: Any) -> None:
7459
self.user_agent_policy = kwargs.get("user_agent_policy") or policies.UserAgentPolicy(**kwargs)
7560
self.headers_policy = kwargs.get("headers_policy") or policies.HeadersPolicy(**kwargs)
7661
self.proxy_policy = kwargs.get("proxy_policy") or policies.ProxyPolicy(**kwargs)

0 commit comments

Comments
 (0)