Skip to content
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
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
---
changeKind: feature
packages:
- "@autorest/python"
- "@azure-tools/typespec-python"
---

Support move method level signature to client level
4 changes: 2 additions & 2 deletions packages/autorest.python/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@
},
"homepage": "https://github.com/Azure/autorest.python/blob/main/README.md",
"dependencies": {
"@typespec/http-client-python": "~0.18.1",
"@typespec/http-client-python": "https://artprodcus3.artifacts.visualstudio.com/A0fb41ef4-5012-48a9-bf39-4ee3de03ee35/29ec6040-b234-4e31-b139-33dc4287b756/_apis/artifact/cGlwZWxpbmVhcnRpZmFjdDovL2F6dXJlLXNkay9wcm9qZWN0SWQvMjllYzYwNDAtYjIzNC00ZTMxLWIxMzktMzNkYzQyODdiNzU2L2J1aWxkSWQvNTM4Nzg0Ni9hcnRpZmFjdE5hbWUvYnVpbGRfYXJ0aWZhY3RzX3B5dGhvbg2/content?format=file&subPath=%2Fpackages%2Ftypespec-http-client-python-0.18.1.tgz",
"@autorest/system-requirements": "~1.0.2",
"fs-extra": "~11.2.0",
"tsx": "~4.19.1"
Expand All @@ -47,4 +47,4 @@
"requirements.txt",
"generator/"
]
}
}
6 changes: 3 additions & 3 deletions packages/typespec-python/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@
"js-yaml": "~4.1.0",
"semver": "~7.6.2",
"tsx": "~4.19.1",
"@typespec/http-client-python": "~0.18.1",
"@typespec/http-client-python": "https://artprodcus3.artifacts.visualstudio.com/A0fb41ef4-5012-48a9-bf39-4ee3de03ee35/29ec6040-b234-4e31-b139-33dc4287b756/_apis/artifact/cGlwZWxpbmVhcnRpZmFjdDovL2F6dXJlLXNkay9wcm9qZWN0SWQvMjllYzYwNDAtYjIzNC00ZTMxLWIxMzktMzNkYzQyODdiNzU2L2J1aWxkSWQvNTM4Nzg0Ni9hcnRpZmFjdE5hbWUvYnVpbGRfYXJ0aWZhY3RzX3B5dGhvbg2/content?format=file&subPath=%2Fpackages%2Ftypespec-http-client-python-0.18.1.tgz",
"fs-extra": "~11.2.0"
},
"devDependencies": {
Expand All @@ -86,7 +86,7 @@
"@azure-tools/typespec-azure-rulesets": "~0.60.0",
"@azure-tools/typespec-autorest": "~0.60.0",
"@azure-tools/typespec-client-generator-core": "~0.60.2",
"@azure-tools/azure-http-specs": "0.1.0-alpha.28",
"@azure-tools/azure-http-specs": "0.1.0-alpha.29",
"@typespec/http-specs": "0.1.0-alpha.26",
"@typespec/spector": "0.1.0-alpha.18",
"@typespec/spec-api": "0.1.0-alpha.9",
Expand All @@ -103,4 +103,4 @@
"chalk": "5.3.0",
"@types/fs-extra": "11.0.4"
}
}
}
3 changes: 3 additions & 0 deletions packages/typespec-python/scripts/eng/regenerate.ts
Original file line number Diff line number Diff line change
Expand Up @@ -80,6 +80,9 @@ const AZURE_EMITTER_OPTIONS: Record<string, Record<string, string> | Record<stri
"azure/payload/pageable": {
namespace: "specs.azure.payload.pageable",
},
"azure/versioning/previewVersion": {
namespace: "specs.azure.versioning.previewversion",
},
"client/structure/default": {
namespace: "client.structure.service",
},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -421,15 +421,18 @@ class ParentClient: # pylint: disable=client-accepts-api-version-keyword
:ivar child_client: ChildClientOperations operations
:vartype child_client:
specs.azure.clientgenerator.core.clientinitialization.operations.ChildClientOperations
:param blob_name: The name of the blob. This parameter is used as a path parameter in all
operations. Required.
:type blob_name: str
:keyword endpoint: Service host. Default value is "http://localhost:3000".
:paramtype endpoint: str
"""

def __init__( # pylint: disable=missing-client-constructor-parameter-credential
self, *, endpoint: str = "http://localhost:3000", **kwargs: Any
self, blob_name: str, *, endpoint: str = "http://localhost:3000", **kwargs: Any
) -> None:
_endpoint = "{endpoint}"
self._config = ParentClientConfiguration(endpoint=endpoint, **kwargs)
self._config = ParentClientConfiguration(blob_name=blob_name, endpoint=endpoint, **kwargs)

_policies = kwargs.pop("policies", None)
if _policies is None:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -199,12 +199,18 @@ class ParentClientConfiguration: # pylint: disable=too-many-instance-attributes
Note that all parameters used to create this instance are saved as instance
attributes.

:param blob_name: The name of the blob. This parameter is used as a path parameter in all
operations. Required.
:type blob_name: str
:param endpoint: Service host. Default value is "http://localhost:3000".
:type endpoint: str
"""

def __init__(self, endpoint: str = "http://localhost:3000", **kwargs: Any) -> None:
def __init__(self, blob_name: str, endpoint: str = "http://localhost:3000", **kwargs: Any) -> None:
if blob_name is None:
raise ValueError("Parameter 'blob_name' must not be None.")

self.blob_name = blob_name
self.endpoint = endpoint
kwargs.setdefault("sdk_moniker", "specs-azure-clientgenerator-core-clientinitialization/{}".format(VERSION))
self.polling_interval = kwargs.get("polling_interval", 30)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -431,15 +431,18 @@ class ParentClient: # pylint: disable=client-accepts-api-version-keyword
:ivar child_client: ChildClientOperations operations
:vartype child_client:
specs.azure.clientgenerator.core.clientinitialization.aio.operations.ChildClientOperations
:param blob_name: The name of the blob. This parameter is used as a path parameter in all
operations. Required.
:type blob_name: str
:keyword endpoint: Service host. Default value is "http://localhost:3000".
:paramtype endpoint: str
"""

def __init__( # pylint: disable=missing-client-constructor-parameter-credential
self, *, endpoint: str = "http://localhost:3000", **kwargs: Any
self, blob_name: str, *, endpoint: str = "http://localhost:3000", **kwargs: Any
) -> None:
_endpoint = "{endpoint}"
self._config = ParentClientConfiguration(endpoint=endpoint, **kwargs)
self._config = ParentClientConfiguration(blob_name=blob_name, endpoint=endpoint, **kwargs)

_policies = kwargs.pop("policies", None)
if _policies is None:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -199,12 +199,18 @@ class ParentClientConfiguration: # pylint: disable=too-many-instance-attributes
Note that all parameters used to create this instance are saved as instance
attributes.

:param blob_name: The name of the blob. This parameter is used as a path parameter in all
operations. Required.
:type blob_name: str
:param endpoint: Service host. Default value is "http://localhost:3000".
:type endpoint: str
"""

def __init__(self, endpoint: str = "http://localhost:3000", **kwargs: Any) -> None:
def __init__(self, blob_name: str, endpoint: str = "http://localhost:3000", **kwargs: Any) -> None:
if blob_name is None:
raise ValueError("Parameter 'blob_name' must not be None.")

self.blob_name = blob_name
self.endpoint = endpoint
kwargs.setdefault("sdk_moniker", "specs-azure-clientgenerator-core-clientinitialization/{}".format(VERSION))
self.polling_interval = kwargs.get("polling_interval", 30)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@ class TestLocationMoveMethodParameterToClientOperations(ClientLocationClientTest
def test_move_method_parameter_to_client_blob_operations_get_blob(self, location_endpoint):
client = self.create_client(endpoint=location_endpoint)
response = client.move_method_parameter_to_client.blob_operations.get_blob(
storage_account="str",
container="str",
blob="str",
)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,6 @@ class TestLocationMoveMethodParameterToClientOperationsAsync(ClientLocationClien
async def test_move_method_parameter_to_client_blob_operations_get_blob(self, location_endpoint):
client = self.create_async_client(endpoint=location_endpoint)
response = await client.move_method_parameter_to_client.blob_operations.get_blob(
storage_account="str",
container="str",
blob="str",
)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -44,15 +44,17 @@ class ClientLocationClient(_ClientLocationClientOperationsMixin): # pylint: dis
:ivar archive_operations: ArchiveOperationsOperations operations
:vartype archive_operations:
specs.azure.clientgenerator.core.clientlocation.operations.ArchiveOperationsOperations
:param storage_account: Required.
:type storage_account: str
:keyword endpoint: Service host. Default value is "http://localhost:3000".
:paramtype endpoint: str
"""

def __init__( # pylint: disable=missing-client-constructor-parameter-credential
self, *, endpoint: str = "http://localhost:3000", **kwargs: Any
self, storage_account: str, *, endpoint: str = "http://localhost:3000", **kwargs: Any
) -> None:
_endpoint = "{endpoint}"
self._config = ClientLocationClientConfiguration(endpoint=endpoint, **kwargs)
self._config = ClientLocationClientConfiguration(storage_account=storage_account, endpoint=endpoint, **kwargs)

_policies = kwargs.pop("policies", None)
if _policies is None:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,12 +19,17 @@ class ClientLocationClientConfiguration: # pylint: disable=too-many-instance-at
Note that all parameters used to create this instance are saved as instance
attributes.

:param storage_account: Required.
:type storage_account: str
:param endpoint: Service host. Default value is "http://localhost:3000".
:type endpoint: str
"""

def __init__(self, endpoint: str = "http://localhost:3000", **kwargs: Any) -> None:
def __init__(self, storage_account: str, endpoint: str = "http://localhost:3000", **kwargs: Any) -> None:
if storage_account is None:
raise ValueError("Parameter 'storage_account' must not be None.")

self.storage_account = storage_account
self.endpoint = endpoint
kwargs.setdefault("sdk_moniker", "specs-azure-clientgenerator-core-clientlocation/{}".format(VERSION))
self.polling_interval = kwargs.get("polling_interval", 30)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -44,15 +44,17 @@ class ClientLocationClient(_ClientLocationClientOperationsMixin): # pylint: dis
:ivar archive_operations: ArchiveOperationsOperations operations
:vartype archive_operations:
specs.azure.clientgenerator.core.clientlocation.aio.operations.ArchiveOperationsOperations
:param storage_account: Required.
:type storage_account: str
:keyword endpoint: Service host. Default value is "http://localhost:3000".
:paramtype endpoint: str
"""

def __init__( # pylint: disable=missing-client-constructor-parameter-credential
self, *, endpoint: str = "http://localhost:3000", **kwargs: Any
self, storage_account: str, *, endpoint: str = "http://localhost:3000", **kwargs: Any
) -> None:
_endpoint = "{endpoint}"
self._config = ClientLocationClientConfiguration(endpoint=endpoint, **kwargs)
self._config = ClientLocationClientConfiguration(storage_account=storage_account, endpoint=endpoint, **kwargs)

_policies = kwargs.pop("policies", None)
if _policies is None:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,12 +19,17 @@ class ClientLocationClientConfiguration: # pylint: disable=too-many-instance-at
Note that all parameters used to create this instance are saved as instance
attributes.

:param storage_account: Required.
:type storage_account: str
:param endpoint: Service host. Default value is "http://localhost:3000".
:type endpoint: str
"""

def __init__(self, endpoint: str = "http://localhost:3000", **kwargs: Any) -> None:
def __init__(self, storage_account: str, endpoint: str = "http://localhost:3000", **kwargs: Any) -> None:
if storage_account is None:
raise ValueError("Parameter 'storage_account' must not be None.")

self.storage_account = storage_account
self.endpoint = endpoint
kwargs.setdefault("sdk_moniker", "specs-azure-clientgenerator-core-clientlocation/{}".format(VERSION))
self.polling_interval = kwargs.get("polling_interval", 30)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -556,11 +556,9 @@ def __init__(self, *args, **kwargs) -> None:
self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer")

@distributed_trace_async
async def get_blob(self, *, storage_account: str, container: str, blob: str, **kwargs: Any) -> _models.Blob:
async def get_blob(self, *, container: str, blob: str, **kwargs: Any) -> _models.Blob:
"""get_blob.

:keyword storage_account: Required.
:paramtype storage_account: str
:keyword container: Required.
:paramtype container: str
:keyword blob: Required.
Expand All @@ -583,9 +581,9 @@ async def get_blob(self, *, storage_account: str, container: str, blob: str, **k
cls: ClsType[_models.Blob] = kwargs.pop("cls", None)

_request = build_move_method_parameter_to_client_blob_operations_get_blob_request(
storage_account=storage_account,
container=container,
blob=blob,
storage_account=self._config.storage_account,
headers=_headers,
params=_params,
)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,7 @@ def build_move_to_root_client_resource_operations_get_resource_request( # pylin


def build_move_method_parameter_to_client_blob_operations_get_blob_request( # pylint: disable=name-too-long
*, storage_account: str, container: str, blob: str, **kwargs: Any
*, container: str, blob: str, storage_account: str, **kwargs: Any
) -> HttpRequest:
_headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
Expand Down Expand Up @@ -630,11 +630,9 @@ def __init__(self, *args, **kwargs) -> None:
self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer")

@distributed_trace
def get_blob(self, *, storage_account: str, container: str, blob: str, **kwargs: Any) -> _models.Blob:
def get_blob(self, *, container: str, blob: str, **kwargs: Any) -> _models.Blob:
"""get_blob.

:keyword storage_account: Required.
:paramtype storage_account: str
:keyword container: Required.
:paramtype container: str
:keyword blob: Required.
Expand All @@ -657,9 +655,9 @@ def get_blob(self, *, storage_account: str, container: str, blob: str, **kwargs:
cls: ClsType[_models.Blob] = kwargs.pop("cls", None)

_request = build_move_method_parameter_to_client_blob_operations_get_blob_request(
storage_account=storage_account,
container=container,
blob=blob,
storage_account=self._config.storage_account,
headers=_headers,
params=_params,
)
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
# Release History

## 1.0.0b1 (1970-01-01)

### Other Changes

- Initial version
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
Copyright (c) Microsoft Corporation.

MIT License

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED *AS IS*, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
include *.md
include LICENSE
include specs/azure/versioning/previewversion/py.typed
recursive-include tests *.py
recursive-include samples *.py *.md
include specs/__init__.py
include specs/azure/__init__.py
include specs/azure/versioning/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
# Specs Azure Versioning Previewversion client library for Python
<!-- write necessary description of service -->

## Getting started

### Install the package

```bash
python -m pip install specs-azure-versioning-previewversion
```

#### Prequisites

- Python 3.9 or later is required to use this package.
- You need an [Azure subscription][azure_sub] to use this package.
- An existing Specs Azure Versioning Previewversion instance.


## Contributing

This project welcomes contributions and suggestions. Most contributions require
you to agree to a Contributor License Agreement (CLA) declaring that you have
the right to, and actually do, grant us the rights to use your contribution.
For details, visit https://cla.microsoft.com.

When you submit a pull request, a CLA-bot will automatically determine whether
you need to provide a CLA and decorate the PR appropriately (e.g., label,
comment). Simply follow the instructions provided by the bot. You will only
need to do this once across all repos using our CLA.

This project has adopted the
[Microsoft Open Source Code of Conduct][code_of_conduct]. For more information,
see the Code of Conduct FAQ or contact opencode@microsoft.com with any
additional questions or comments.

<!-- LINKS -->
[code_of_conduct]: https://opensource.microsoft.com/codeofconduct/
[authenticate_with_token]: https://docs.microsoft.com/azure/cognitive-services/authentication?tabs=powershell#authenticate-with-an-authentication-token
[azure_identity_credentials]: https://github.com/Azure/azure-sdk-for-python/tree/main/sdk/identity/azure-identity#credentials
[azure_identity_pip]: https://pypi.org/project/azure-identity/
[default_azure_credential]: https://github.com/Azure/azure-sdk-for-python/tree/main/sdk/identity/azure-identity#defaultazurecredential
[pip]: https://pypi.org/project/pip/
[azure_sub]: https://azure.microsoft.com/free/
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
{
"apiVersion": "2024-12-01-preview"
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
{
"CrossLanguagePackageId": "_Specs_.Azure.Versioning.PreviewVersion",
"CrossLanguageDefinitionId": {
"specs.azure.versioning.previewversion.models.ListWidgetsResponse": "_Specs_.Azure.Versioning.PreviewVersion.listWidgets.Response.anonymous",
"specs.azure.versioning.previewversion.models.UpdateWidgetColorRequest": "_Specs_.Azure.Versioning.PreviewVersion.UpdateWidgetColorRequest",
"specs.azure.versioning.previewversion.models.Widget": "_Specs_.Azure.Versioning.PreviewVersion.Widget",
"specs.azure.versioning.previewversion.PreviewVersionClient.get_widget": "_Specs_.Azure.Versioning.PreviewVersion.getWidget",
"specs.azure.versioning.previewversion.aio.PreviewVersionClient.get_widget": "_Specs_.Azure.Versioning.PreviewVersion.getWidget",
"specs.azure.versioning.previewversion.PreviewVersionClient.update_widget_color": "_Specs_.Azure.Versioning.PreviewVersion.updateWidgetColor",
"specs.azure.versioning.previewversion.aio.PreviewVersionClient.update_widget_color": "_Specs_.Azure.Versioning.PreviewVersion.updateWidgetColor",
"specs.azure.versioning.previewversion.PreviewVersionClient.list_widgets": "_Specs_.Azure.Versioning.PreviewVersion.listWidgets",
"specs.azure.versioning.previewversion.aio.PreviewVersionClient.list_widgets": "_Specs_.Azure.Versioning.PreviewVersion.listWidgets"
}
}
Loading
Loading