Skip to content
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

[AutoPR track2_azure-mgmt-avs] Azure VMware Solution 2023-09-01 in TypeSpec #6354

Closed
wants to merge 1 commit into from
Closed
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
8 changes: 4 additions & 4 deletions sdk/compute/azure-mgmt-avs/_meta.json
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
{
"commit": "a5e7ff51c8af3781e7f6dd3b82a3fc922e2f6f93",
"commit": "1a27ea3e556c7ab530547d79f4880bd369d8b330",
"repository_url": "https://github.com/Azure/azure-rest-api-specs",
"autorest": "3.9.7",
"use": [
"@autorest/python@6.7.1",
"@autorest/modelerfour@4.26.2"
"@autorest/python@6.13.7",
"@autorest/modelerfour@4.27.0"
],
"autorest_command": "autorest specification/vmware/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.7.1 --use=@autorest/modelerfour@4.26.2 --version=3.9.7 --version-tolerant=False",
"autorest_command": "autorest specification/vmware/resource-manager/readme.md --generate-sample=True --include-x-ms-examples-original-file=True --python --python-sdks-folder=/mnt/vss/_work/1/s/azure-sdk-for-python/sdk --use=@autorest/python@6.13.7 --use=@autorest/modelerfour@4.27.0 --version=3.9.7 --version-tolerant=False",
"readme": "specification/vmware/resource-manager/readme.md"
}
84 changes: 54 additions & 30 deletions sdk/compute/azure-mgmt-avs/azure/mgmt/avs/_avs_client.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,10 @@
from copy import deepcopy
from typing import Any, TYPE_CHECKING

from azure.core.pipeline import policies
from azure.core.rest import HttpRequest, HttpResponse
from azure.mgmt.core import ARMPipelineClient
from azure.mgmt.core.policies import ARMAutoResourceProviderRegistrationPolicy

from . import models as _models
from ._configuration import AVSClientConfiguration
Expand All @@ -23,6 +25,7 @@
DatastoresOperations,
GlobalReachConnectionsOperations,
HcxEnterpriseSitesOperations,
IscsiPathsOperations,
LocationsOperations,
Operations,
PlacementPoliciesOperations,
Expand All @@ -48,39 +51,41 @@ class AVSClient: # pylint: disable=client-accepts-api-version-keyword,too-many-
:vartype locations: azure.mgmt.avs.operations.LocationsOperations
:ivar private_clouds: PrivateCloudsOperations operations
:vartype private_clouds: azure.mgmt.avs.operations.PrivateCloudsOperations
:ivar clusters: ClustersOperations operations
:vartype clusters: azure.mgmt.avs.operations.ClustersOperations
:ivar datastores: DatastoresOperations operations
:vartype datastores: azure.mgmt.avs.operations.DatastoresOperations
:ivar hcx_enterprise_sites: HcxEnterpriseSitesOperations operations
:vartype hcx_enterprise_sites: azure.mgmt.avs.operations.HcxEnterpriseSitesOperations
:ivar addons: AddonsOperations operations
:vartype addons: azure.mgmt.avs.operations.AddonsOperations
:ivar authorizations: AuthorizationsOperations operations
:vartype authorizations: azure.mgmt.avs.operations.AuthorizationsOperations
:ivar global_reach_connections: GlobalReachConnectionsOperations operations
:vartype global_reach_connections: azure.mgmt.avs.operations.GlobalReachConnectionsOperations
:ivar workload_networks: WorkloadNetworksOperations operations
:vartype workload_networks: azure.mgmt.avs.operations.WorkloadNetworksOperations
:ivar cloud_links: CloudLinksOperations operations
:vartype cloud_links: azure.mgmt.avs.operations.CloudLinksOperations
:ivar addons: AddonsOperations operations
:vartype addons: azure.mgmt.avs.operations.AddonsOperations
:ivar virtual_machines: VirtualMachinesOperations operations
:vartype virtual_machines: azure.mgmt.avs.operations.VirtualMachinesOperations
:ivar clusters: ClustersOperations operations
:vartype clusters: azure.mgmt.avs.operations.ClustersOperations
:ivar datastores: DatastoresOperations operations
:vartype datastores: azure.mgmt.avs.operations.DatastoresOperations
:ivar placement_policies: PlacementPoliciesOperations operations
:vartype placement_policies: azure.mgmt.avs.operations.PlacementPoliciesOperations
:ivar virtual_machines: VirtualMachinesOperations operations
:vartype virtual_machines: azure.mgmt.avs.operations.VirtualMachinesOperations
:ivar global_reach_connections: GlobalReachConnectionsOperations operations
:vartype global_reach_connections: azure.mgmt.avs.operations.GlobalReachConnectionsOperations
:ivar hcx_enterprise_sites: HcxEnterpriseSitesOperations operations
:vartype hcx_enterprise_sites: azure.mgmt.avs.operations.HcxEnterpriseSitesOperations
:ivar iscsi_paths: IscsiPathsOperations operations
:vartype iscsi_paths: azure.mgmt.avs.operations.IscsiPathsOperations
:ivar script_executions: ScriptExecutionsOperations operations
:vartype script_executions: azure.mgmt.avs.operations.ScriptExecutionsOperations
:ivar script_packages: ScriptPackagesOperations operations
:vartype script_packages: azure.mgmt.avs.operations.ScriptPackagesOperations
:ivar script_cmdlets: ScriptCmdletsOperations operations
:vartype script_cmdlets: azure.mgmt.avs.operations.ScriptCmdletsOperations
:ivar script_executions: ScriptExecutionsOperations operations
:vartype script_executions: azure.mgmt.avs.operations.ScriptExecutionsOperations
:ivar workload_networks: WorkloadNetworksOperations operations
:vartype workload_networks: azure.mgmt.avs.operations.WorkloadNetworksOperations
:param credential: Credential needed for the client to connect to Azure. Required.
:type credential: ~azure.core.credentials.TokenCredential
:param subscription_id: The ID of the target subscription. Required.
:param subscription_id: The ID of the target subscription. The value must be an UUID. 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 "2023-03-01". Note that overriding this
:keyword api_version: Api Version. Default value is "2023-09-01". 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 @@ -95,7 +100,25 @@ def __init__(
**kwargs: Any
) -> None:
self._config = AVSClientConfiguration(credential=credential, subscription_id=subscription_id, **kwargs)
self._client: ARMPipelineClient = ARMPipelineClient(base_url=base_url, config=self._config, **kwargs)
_policies = kwargs.pop("policies", None)
if _policies is None:
_policies = [
policies.RequestIdPolicy(**kwargs),
self._config.headers_policy,
self._config.user_agent_policy,
self._config.proxy_policy,
policies.ContentDecodePolicy(**kwargs),
ARMAutoResourceProviderRegistrationPolicy(),
self._config.redirect_policy,
self._config.retry_policy,
self._config.authentication_policy,
self._config.custom_hook_policy,
self._config.logging_policy,
policies.DistributedTracingPolicy(**kwargs),
policies.SensitiveHeaderCleanupPolicy(**kwargs) if self._config.redirect_policy else None,
self._config.http_logging_policy,
]
self._client: ARMPipelineClient = ARMPipelineClient(base_url=base_url, policies=_policies, **kwargs)

client_models = {k: v for k, v in _models.__dict__.items() if isinstance(v, type)}
self._serialize = Serializer(client_models)
Expand All @@ -104,33 +127,34 @@ def __init__(
self.operations = Operations(self._client, self._config, self._serialize, self._deserialize)
self.locations = LocationsOperations(self._client, self._config, self._serialize, self._deserialize)
self.private_clouds = PrivateCloudsOperations(self._client, self._config, self._serialize, self._deserialize)
self.addons = AddonsOperations(self._client, self._config, self._serialize, self._deserialize)
self.authorizations = AuthorizationsOperations(self._client, self._config, self._serialize, self._deserialize)
self.cloud_links = CloudLinksOperations(self._client, self._config, self._serialize, self._deserialize)
self.clusters = ClustersOperations(self._client, self._config, self._serialize, self._deserialize)
self.datastores = DatastoresOperations(self._client, self._config, self._serialize, self._deserialize)
self.hcx_enterprise_sites = HcxEnterpriseSitesOperations(
self.placement_policies = PlacementPoliciesOperations(
self._client, self._config, self._serialize, self._deserialize
)
self.authorizations = AuthorizationsOperations(self._client, self._config, self._serialize, self._deserialize)
self.global_reach_connections = GlobalReachConnectionsOperations(
self.virtual_machines = VirtualMachinesOperations(
self._client, self._config, self._serialize, self._deserialize
)
self.workload_networks = WorkloadNetworksOperations(
self.global_reach_connections = GlobalReachConnectionsOperations(
self._client, self._config, self._serialize, self._deserialize
)
self.cloud_links = CloudLinksOperations(self._client, self._config, self._serialize, self._deserialize)
self.addons = AddonsOperations(self._client, self._config, self._serialize, self._deserialize)
self.virtual_machines = VirtualMachinesOperations(
self.hcx_enterprise_sites = HcxEnterpriseSitesOperations(
self._client, self._config, self._serialize, self._deserialize
)
self.placement_policies = PlacementPoliciesOperations(
self.iscsi_paths = IscsiPathsOperations(self._client, self._config, self._serialize, self._deserialize)
self.script_executions = ScriptExecutionsOperations(
self._client, self._config, self._serialize, self._deserialize
)
self.script_packages = ScriptPackagesOperations(self._client, self._config, self._serialize, self._deserialize)
self.script_cmdlets = ScriptCmdletsOperations(self._client, self._config, self._serialize, self._deserialize)
self.script_executions = ScriptExecutionsOperations(
self.workload_networks = WorkloadNetworksOperations(
self._client, self._config, self._serialize, self._deserialize
)

def _send_request(self, request: HttpRequest, **kwargs: Any) -> HttpResponse:
def _send_request(self, request: HttpRequest, *, stream: bool = False, **kwargs: Any) -> HttpResponse:
"""Runs the network request through the client's chained policies.

>>> from azure.core.rest import HttpRequest
Expand All @@ -150,7 +174,7 @@ def _send_request(self, request: HttpRequest, **kwargs: Any) -> HttpResponse:

request_copy = deepcopy(request)
request_copy.url = self._client.format_url(request_copy.url)
return self._client.send_request(request_copy, **kwargs)
return self._client.send_request(request_copy, stream=stream, **kwargs) # type: ignore

def close(self) -> None:
self._client.close()
Expand Down
13 changes: 6 additions & 7 deletions sdk/compute/azure-mgmt-avs/azure/mgmt/avs/_configuration.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@

from typing import Any, TYPE_CHECKING

from azure.core.configuration import Configuration
from azure.core.pipeline import policies
from azure.mgmt.core.policies import ARMChallengeAuthenticationPolicy, ARMHttpLoggingPolicy

Expand All @@ -19,24 +18,23 @@
from azure.core.credentials import TokenCredential


class AVSClientConfiguration(Configuration): # pylint: disable=too-many-instance-attributes
class AVSClientConfiguration: # pylint: disable=too-many-instance-attributes
"""Configuration for AVSClient.

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: The ID of the target subscription. Required.
:param subscription_id: The ID of the target subscription. The value must be an UUID. Required.
:type subscription_id: str
:keyword api_version: Api Version. Default value is "2023-03-01". Note that overriding this
:keyword api_version: Api Version. Default value is "2023-09-01". 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(AVSClientConfiguration, self).__init__(**kwargs)
api_version: str = kwargs.pop("api_version", "2023-03-01")
api_version: str = kwargs.pop("api_version", "2023-09-01")

if credential is None:
raise ValueError("Parameter 'credential' must not be None.")
Expand All @@ -48,6 +46,7 @@ def __init__(self, credential: "TokenCredential", subscription_id: str, **kwargs
self.api_version = api_version
self.credential_scopes = kwargs.pop("credential_scopes", ["https://management.azure.com/.default"])
kwargs.setdefault("sdk_moniker", "mgmt-avs/{}".format(VERSION))
self.polling_interval = kwargs.get("polling_interval", 30)
self._configure(**kwargs)

def _configure(self, **kwargs: Any) -> None:
Expand All @@ -56,9 +55,9 @@ def _configure(self, **kwargs: Any) -> None:
self.proxy_policy = kwargs.get("proxy_policy") or policies.ProxyPolicy(**kwargs)
self.logging_policy = kwargs.get("logging_policy") or policies.NetworkTraceLoggingPolicy(**kwargs)
self.http_logging_policy = kwargs.get("http_logging_policy") or ARMHttpLoggingPolicy(**kwargs)
self.retry_policy = kwargs.get("retry_policy") or policies.RetryPolicy(**kwargs)
self.custom_hook_policy = kwargs.get("custom_hook_policy") or policies.CustomHookPolicy(**kwargs)
self.redirect_policy = kwargs.get("redirect_policy") or policies.RedirectPolicy(**kwargs)
self.retry_policy = kwargs.get("retry_policy") or policies.RetryPolicy(**kwargs)
self.authentication_policy = kwargs.get("authentication_policy")
if self.credential and not self.authentication_policy:
self.authentication_policy = ARMChallengeAuthenticationPolicy(
Expand Down
Loading