-
Notifications
You must be signed in to change notification settings - Fork 3.2k
[AutoPR azure-mgmt-edgeactions]-generated-from-SDK Generation - Python-5730146 #44582
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
base: main
Are you sure you want to change the base?
[AutoPR azure-mgmt-edgeactions]-generated-from-SDK Generation - Python-5730146 #44582
Conversation
…eActions/tspconfig.yaml', API Version: 2025-12-01-preview, SDK Release Type: beta, and CommitSHA: 'ccea12be6cd5e64743499d46f7a9c8b60df52db1' in SpecRepo: 'https://github.com/Azure/azure-rest-api-specs' Pipeline run: https://dev.azure.com/azure-sdk/internal/_build/results?buildId=5730146 Refer to https://eng.ms/docs/products/azure-developer-experience/develop/sdk-release/sdk-release-prerequisites to prepare for SDK release.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull request overview
This is an auto-generated SDK pull request for the Azure Edge Actions Management service, generated from TypeSpec specifications. The PR introduces a new Python SDK package azure-mgmt-edgeactions (version 1.0.0b1) for managing Edge Actions resources in Azure CDN, targeting API version 2025-12-01-preview.
Key changes:
- Complete new SDK package with client implementation for sync and async operations
- Three main operation groups: EdgeActions, EdgeActionVersions, and EdgeActionExecutionFilters
- Full set of CRUD operations, long-running operations (LRO), and paginated list operations
- Generated test files and code samples
- CI/CD pipeline configuration
Reviewed changes
Copilot reviewed 59 out of 61 changed files in this pull request and generated no comments.
Show a summary per file
| File | Description |
|---|---|
| sdk/edgeactions/ci.yml | Azure Pipelines CI/CD configuration for the edgeactions service |
| sdk/edgeactions/azure-mgmt-edgeactions/pyproject.toml | Package configuration with dependencies and build settings |
| sdk/edgeactions/azure-mgmt-edgeactions/tsp-location.yaml | TypeSpec source location metadata |
| sdk/edgeactions/azure-mgmt-edgeactions/_metadata.json | Generation metadata with API version and commit info |
| sdk/edgeactions/azure-mgmt-edgeactions/README.md | Package documentation and usage examples |
| sdk/edgeactions/azure-mgmt-edgeactions/CHANGELOG.md | Initial release notes for version 1.0.0b1 |
| sdk/edgeactions/azure-mgmt-edgeactions/azure/mgmt/edgeactions/_client.py | Sync client implementation for CdnClient |
| sdk/edgeactions/azure-mgmt-edgeactions/azure/mgmt/edgeactions/aio/_client.py | Async client implementation |
| sdk/edgeactions/azure-mgmt-edgeactions/azure/mgmt/edgeactions/operations/_operations.py | Core operations implementations for all three operation groups |
| sdk/edgeactions/azure-mgmt-edgeactions/azure/mgmt/edgeactions/models/_models.py | Model definitions for SDK resources |
| sdk/edgeactions/azure-mgmt-edgeactions/azure/mgmt/edgeactions/models/_enums.py | Enum definitions for SDK |
| sdk/edgeactions/azure-mgmt-edgeactions/generated_tests/*.py | Auto-generated test files for all operations |
| sdk/edgeactions/azure-mgmt-edgeactions/generated_samples/*.py | Auto-generated code samples |
…eActions/tspconfig.yaml', API Version: 2025-12-01-preview, SDK Release Type: beta, and CommitSHA: '1864d2ef7798c8d436322c803eb870e9e0bc8680' in SpecRepo: 'https://github.com/Azure/azure-rest-api-specs' Pipeline run: https://dev.azure.com/azure-sdk/internal/_build/results?buildId=5745141 Refer to https://eng.ms/docs/products/azure-developer-experience/develop/sdk-release/sdk-release-prerequisites to prepare for SDK release.
|
@ChenxiJiang333 We need regenerate again after Azure/azure-rest-api-specs#39517 merged. |
got it |
…eActions/tspconfig.yaml', API Version: 2025-12-01-preview, SDK Release Type: beta, and CommitSHA: '0b05eba33bd579dd10546b02744349f820d31736' in SpecRepo: 'https://github.com/Azure/azure-rest-api-specs' Pipeline run: https://dev.azure.com/azure-sdk/internal/_build/results?buildId=5755327 Refer to https://eng.ms/docs/products/azure-developer-experience/develop/sdk-release/sdk-release-prerequisites to prepare for SDK release.
|
@msyyc, pr ready, please help review |
…eActions/tspconfig.yaml', API Version: 2025-12-01-preview, SDK Release Type: beta, and CommitSHA: '3fc43b6c80d8fce282a242b1f34fecced80ddcb5' in SpecRepo: 'https://github.com/Azure/azure-rest-api-specs' Pipeline run: https://dev.azure.com/azure-sdk/internal/_build/results?buildId=5759844 Refer to https://eng.ms/docs/products/azure-developer-experience/develop/sdk-release/sdk-release-prerequisites to prepare for SDK release.
…eActions/tspconfig.yaml', API Version: 2025-12-01-preview, SDK Release Type: beta, and CommitSHA: '94163c6500a285791aa985a9b3b61b2157967d2c' in SpecRepo: 'https://github.com/Azure/azure-rest-api-specs' Pipeline run: https://dev.azure.com/azure-sdk/internal/_build/results?buildId=5760861 Refer to https://eng.ms/docs/products/azure-developer-experience/develop/sdk-release/sdk-release-prerequisites to prepare for SDK release.
|
@msyyc regenerated, please help review |
…eActions/tspconfig.yaml', API Version: 2025-12-01-preview, SDK Release Type: beta, and CommitSHA: '0096f35d30b40bc98232b753ab100860ce2aa3ae' in SpecRepo: 'https://github.com/Azure/azure-rest-api-specs' Pipeline run: https://dev.azure.com/azure-sdk/internal/_build/results?buildId=5761271 Refer to https://eng.ms/docs/products/azure-developer-experience/develop/sdk-release/sdk-release-prerequisites to prepare for SDK release.
…osoft.ContainerService/aks/tspconfig.yaml', API Version: 2025-10-02-preview, SDK Release Type: beta, and CommitSHA: '49c01c8ca5ac61de4e4f238d76a77b3e0fd7ac2d' in SpecRepo: 'https://github.com/Azure/azure-rest-api-specs' Pipeline run: https://dev.azure.com/azure-sdk/internal/_build/results?buildId=5761630 Refer to https://eng.ms/docs/products/azure-developer-experience/develop/sdk-release/sdk-release-prerequisites to prepare for SDK release.
…into sdkauto/azure-mgmt-edgeactions-5730146
…eActions/tspconfig.yaml', API Version: 2025-12-01-preview, SDK Release Type: beta, and CommitSHA: '24f1ecdc02b2dc41b0dff65d28bdd861cffa4fdb' in SpecRepo: 'https://github.com/Azure/azure-rest-api-specs' Pipeline run: https://dev.azure.com/azure-sdk/internal/_build/results?buildId=5772167 Refer to https://eng.ms/docs/products/azure-developer-experience/develop/sdk-release/sdk-release-prerequisites to prepare for SDK release.
dismiss for pr might not be ready
|
|
||
| cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) | ||
|
|
||
| _request = build_edge_action_versions_swap_default_request( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@ChenxiJiang333 @msyyc. I ran tests locally for all operations and found this issue. POST Actions Fail with HTTP 415 Unsupported Media Type
Issue: get version code and swap default POST operations return HTTP 415 because the SDK sends no body/Content-Type header.
Root cause: These operations take void input in TypeSpec, so the generated SDK sends no body. However:
- ARM requires POST operations to have a body (even if empty)
- ASP.NET Core middleware requires
Content-Typewhen body is present
Fix (already applied in CLI extension):
# Add header
"Content-Type": "application/json"
# Send empty body
content = b'{}'
Here is the fix i had made on cli
https://github.com/Azure/azure-cli-extensions/pull/9445/files#diff-b0df0ac3bc33b73181a7ce20fd81808cb3fef0cd9ee041f50f7a171e01a8eb57There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@tundwed ARM requires POST operations to have a body (even if empty), could you show the ARM guideline link? I don't know this kind of restriction. For example,
Lines 1258 to 1307 in 847e66c
| def begin_start(self, resource_group_name: str, cloud_service_name: str, **kwargs: Any) -> LROPoller[None]: | |
| """Starts the cloud service. | |
| :param resource_group_name: Name of the resource group. Required. | |
| :type resource_group_name: str | |
| :param cloud_service_name: Name of the cloud service. Required. | |
| :type cloud_service_name: str | |
| :return: An instance of LROPoller that returns either None or the result of cls(response) | |
| :rtype: ~azure.core.polling.LROPoller[None] | |
| :raises ~azure.core.exceptions.HttpResponseError: | |
| """ | |
| _headers = kwargs.pop("headers", {}) or {} | |
| _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) | |
| api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-11-04")) | |
| cls: ClsType[None] = kwargs.pop("cls", None) | |
| polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) | |
| lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) | |
| cont_token: Optional[str] = kwargs.pop("continuation_token", None) | |
| if cont_token is None: | |
| raw_result = self._start_initial( | |
| resource_group_name=resource_group_name, | |
| cloud_service_name=cloud_service_name, | |
| api_version=api_version, | |
| cls=lambda x, y, z: x, | |
| headers=_headers, | |
| params=_params, | |
| **kwargs | |
| ) | |
| raw_result.http_response.read() # type: ignore | |
| kwargs.pop("error_map", None) | |
| def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements | |
| if cls: | |
| return cls(pipeline_response, None, {}) # type: ignore | |
| if polling is True: | |
| polling_method: PollingMethod = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) | |
| elif polling is False: | |
| polling_method = cast(PollingMethod, NoPolling()) | |
| else: | |
| polling_method = polling | |
| if cont_token: | |
| return LROPoller[None].from_continuation_token( | |
| polling_method=polling_method, | |
| continuation_token=cont_token, | |
| client=self._client, | |
| deserialization_callback=get_long_running_output, | |
| ) | |
| return LROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore |
start operation of compute is also POST operation without body, but it could work.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@msyyc i can't seem to find the doc, but I think it was in the lint error or avocado error when creating the spec.
Similar issue was discussed in detail here. ARM accepts a request with void body and considers content type as optional, but on the service side, the ASP.NET core middleware requires content type to be specified.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@tundwed the example of compute shows that your guess may not be right, at least compute service could work in this scenario. So I advise you update the service code to allow empty body and empty content-type for POST.
NOTE:
If it is hard to change service code in short time, there are 2 workarounds and you can choose any one:
(1) python sdk accept users input customized header like client.operation(..., headers={"Content-Type": "xxx"})
(2) you could update tsp definition like
@post
op extensibleEnumNewlineDelimited(
@header("Content-Type") contentType: "application/json",
): void;
Then generated Python SDK will set default value for content-type like:

|
|
||
| response = pipeline_response.http_response | ||
|
|
||
| if response.status_code not in [202, 204]: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@ChenxiJiang333 @msyyc Delete Operations Fail with JSONDecodeError
Issue: All (edge actions, versions, execution filters) Delete operations fail with JSONDecodeError: Expecting value: line 1 column 1 (char 0)
Root Cause:
- Service returns HTTP 200 with empty body for successful deletes (since this is a synchronous delete). According to ARM docs, we should return 200. See screenshot below.
- SDK only accepts 202/204 as success codes (line 1171:
if response.status_code not in [202, 204]) - When 200 is received, SDK tries to parse empty body as error JSON →
JSONDecodeError
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hi @tundwed, according to the tsp definition, the delete method here seems to be an asynchronous method.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@ChenxiJiang333 , you are right, we use and async function. At the moment though, the RP service returns 200.
We will look to migrate to return 202. But in the meantime, can we make a change to consider 200 a success and not failure here. We can add it to the array of accepted responses
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@tundwed Here is your tsp definition and here is generated swagger. Then we could see only [202,204] is valid. Since SDK is generated from Typespec with codegen tool automatically instead of manually, we can't change the SDK code manually. Now that service returns 200, you should update tsp definition to make it follow service behavior.
NOTE: When the tsp definition is updated, all language SDKs (Java, Python, JavaScript, .NET, Go, etc.) can be updated automatically without requiring manual coding. However, if you update the SDK directly, you must apply the same changes to each language SDK individually, resulting in at least five instances of duplicated effort.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@msyyc @ChenxiJiang333 I have this pr to handle both issues. Please have a look
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@tundwed I will also ping other language owners to take a review for your PR
Configurations: 'specification/cdn/resource-manager/Microsoft.Cdn/EdgeActions/tspconfig.yaml', API Version: 2025-12-01-preview, SDK Release Type: beta, and CommitSHA: 'ccea12be6cd5e64743499d46f7a9c8b60df52db1' in SpecRepo: 'https://github.com/Azure/azure-rest-api-specs' Pipeline run: https://dev.azure.com/azure-sdk/internal/_build/results?buildId=5730146 Refer to https://eng.ms/docs/products/azure-developer-experience/develop/sdk-release/sdk-release-prerequisites to prepare for SDK release. Release plan link: https://web.powerapps.com/apps/821ab569-ae60-420d-8264-d7b5d5ef734c?release-plan-id=9e03d787-20ec-f011-8544-000d3a5b5a24 Submitted by: [email protected]
Release Plan Details
Spec pull request: Edge actions api 2025 12 01 preview - Remove addAttachment and deleteAttachment operations from the public EdgeActions API azure-rest-api-specs#38775
Spec API version: 2025-12-01-preview