Skip to content

Commit

Permalink
[AutoRelease] t2-batch-2021-07-30-27488 (#19996)
Browse files Browse the repository at this point in the history
* CodeGen from PR 15424 in Azure/azure-rest-api-specs
[Batch] Make readme.md and swagger titles consistent (#15424)

* [Batch] Changed "title" from BatchManagement to BatchManagementClient

Autorest is using this to generate the name of the client class. Changing this will avoid a breaking change in the Java SDK that is about to be released.

* Make readme.md titles consistent with swagger

* version,CHANGELOG

* test

* test

* Update shared_requirements.txt

Co-authored-by: SDKAuto <sdkautomation@microsoft.com>
Co-authored-by: PythonSdkPipelines <PythonSdkPipelines>
Co-authored-by: msyyc <70930885+msyyc@users.noreply.github.com>
  • Loading branch information
3 people authored Jul 30, 2021
1 parent 97a6b81 commit 05008ae
Show file tree
Hide file tree
Showing 47 changed files with 2,670 additions and 1,151 deletions.
2 changes: 1 addition & 1 deletion sdk/batch/azure-batch/setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@
'azure',
]),
install_requires=[
'msrest>=0.5.0',
'msrest>=0.6.21',
'msrestazure>=0.4.32,<2.0.0',
'azure-common~=1.1',
],
Expand Down
24 changes: 24 additions & 0 deletions sdk/batch/azure-mgmt-batch/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,29 @@
# Release History

## 16.0.0 (2021-07-30)

**Features**

- Model BatchAccount has a new parameter allowed_authentication_modes
- Model AutoStorageBaseProperties has a new parameter node_identity_reference
- Model AutoStorageBaseProperties has a new parameter authentication_mode
- Model AzureBlobFileSystemConfiguration has a new parameter identity_reference
- Model BatchAccountUpdateParameters has a new parameter allowed_authentication_modes
- Model ContainerRegistry has a new parameter identity_reference
- Model Operation has a new parameter is_data_action
- Model BatchAccountCreateParameters has a new parameter allowed_authentication_modes
- Model AutoStorageProperties has a new parameter node_identity_reference
- Model AutoStorageProperties has a new parameter authentication_mode
- Model ResourceFile has a new parameter identity_reference
- Model VirtualMachineConfiguration has a new parameter os_disk
- Added operation BatchAccountOperations.list_outbound_network_dependencies_endpoints
- Added operation LocationOperations.list_supported_cloud_service_skus
- Added operation LocationOperations.list_supported_virtual_machine_skus

**Breaking changes**

- Rename `BatchManagement` to `BatchManagementClient`

## 15.0.0 (2021-02-01)

- Fix changelog
Expand Down
1 change: 1 addition & 0 deletions sdk/batch/azure-mgmt-batch/MANIFEST.in
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
include _meta.json
recursive-include tests *.py *.yaml
include *.md
include azure/__init__.py
Expand Down
11 changes: 11 additions & 0 deletions sdk/batch/azure-mgmt-batch/_meta.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
{
"autorest": "3.4.5",
"use": [
"@autorest/python@5.8.4",
"@autorest/modelerfour@4.19.2"
],
"commit": "d81e31601e4bcc061ac6436de40d97b7db5e4dd3",
"repository_url": "https://github.com/Azure/azure-rest-api-specs",
"autorest_command": "autorest specification/batch/resource-manager/readme.md --multiapi --python --python-mode=update --python-sdks-folder=/home/vsts/work/1/s/azure-sdk-for-python/sdk --track2 --use=@autorest/python@5.8.4 --use=@autorest/modelerfour@4.19.2 --version=3.4.5",
"readme": "specification/batch/resource-manager/readme.md"
}
4 changes: 2 additions & 2 deletions sdk/batch/azure-mgmt-batch/azure/mgmt/batch/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,11 +6,11 @@
# Changes may cause incorrect behavior and will be lost if the code is regenerated.
# --------------------------------------------------------------------------

from ._batch_management import BatchManagement
from ._batch_management_client import BatchManagementClient
from ._version import VERSION

__version__ = VERSION
__all__ = ['BatchManagement']
__all__ = ['BatchManagementClient']

try:
from ._patch import patch_sdk # type: ignore
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,9 @@
from typing import Any, Optional

from azure.core.credentials import TokenCredential
from azure.core.pipeline.transport import HttpRequest, HttpResponse

from ._configuration import BatchManagementConfiguration
from ._configuration import BatchManagementClientConfiguration
from .operations import BatchAccountOperations
from .operations import ApplicationPackageOperations
from .operations import ApplicationOperations
Expand All @@ -30,8 +31,8 @@
from . import models


class BatchManagement(object):
"""BatchManagement.
class BatchManagementClient(object):
"""Batch Client.
:ivar batch_account: BatchAccountOperations operations
:vartype batch_account: azure.mgmt.batch.operations.BatchAccountOperations
Expand Down Expand Up @@ -69,11 +70,12 @@ def __init__(
# type: (...) -> None
if not base_url:
base_url = 'https://management.azure.com'
self._config = BatchManagementConfiguration(credential, subscription_id, **kwargs)
self._config = BatchManagementClientConfiguration(credential, 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)}
self._serialize = Serializer(client_models)
self._serialize.client_side_validation = False
self._deserialize = Deserializer(client_models)

self.batch_account = BatchAccountOperations(
Expand All @@ -95,12 +97,30 @@ def __init__(
self.pool = PoolOperations(
self._client, self._config, self._serialize, self._deserialize)

def _send_request(self, http_request, **kwargs):
# type: (HttpRequest, Any) -> HttpResponse
"""Runs the network request through the client's chained policies.
:param http_request: The network request you want to make. Required.
:type http_request: ~azure.core.pipeline.transport.HttpRequest
:keyword bool stream: Whether the response payload will be streamed. Defaults to True.
:return: The response of your network call. Does not do error handling on your response.
:rtype: ~azure.core.pipeline.transport.HttpResponse
"""
path_format_arguments = {
'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'),
}
http_request.url = self._client.format_url(http_request.url, **path_format_arguments)
stream = kwargs.pop("stream", True)
pipeline_response = self._client._pipeline.run(http_request, stream=stream, **kwargs)
return pipeline_response.http_response

def close(self):
# type: () -> None
self._client.close()

def __enter__(self):
# type: () -> BatchManagement
# type: () -> BatchManagementClient
self._client.__enter__()
return self

Expand Down
8 changes: 4 additions & 4 deletions sdk/batch/azure-mgmt-batch/azure/mgmt/batch/_configuration.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,8 @@
from azure.core.credentials import TokenCredential


class BatchManagementConfiguration(Configuration):
"""Configuration for BatchManagement.
class BatchManagementClientConfiguration(Configuration):
"""Configuration for BatchManagementClient.
Note that all parameters used to create this instance are saved as instance
attributes.
Expand All @@ -44,11 +44,11 @@ def __init__(
raise ValueError("Parameter 'credential' must not be None.")
if subscription_id is None:
raise ValueError("Parameter 'subscription_id' must not be None.")
super(BatchManagementConfiguration, self).__init__(**kwargs)
super(BatchManagementClientConfiguration, self).__init__(**kwargs)

self.credential = credential
self.subscription_id = subscription_id
self.api_version = "2021-01-01"
self.api_version = "2021-06-01"
self.credential_scopes = kwargs.pop('credential_scopes', ['https://management.azure.com/.default'])
kwargs.setdefault('sdk_moniker', 'mgmt-batch/{}'.format(VERSION))
self._configure(**kwargs)
Expand Down
72 changes: 57 additions & 15 deletions sdk/batch/azure-mgmt-batch/azure/mgmt/batch/_metadata.json
Original file line number Diff line number Diff line change
@@ -1,15 +1,17 @@
{
"chosen_version": "2021-01-01",
"total_api_version_list": ["2021-01-01"],
"chosen_version": "2021-06-01",
"total_api_version_list": ["2021-06-01"],
"client": {
"name": "BatchManagement",
"filename": "_batch_management",
"description": "BatchManagement.",
"name": "BatchManagementClient",
"filename": "_batch_management_client",
"description": "Batch Client.",
"base_url": "\u0027https://management.azure.com\u0027",
"custom_base_url": null,
"azure_arm": true,
"has_lro_operations": true,
"client_side_validation": true
"client_side_validation": false,
"sync_imports": "{\"typing\": {\"azurecore\": {\"azure.core.credentials\": [\"TokenCredential\"]}}, \"regular\": {\"azurecore\": {\"azure.profiles\": [\"KnownProfiles\", \"ProfileDefinition\"], \"azure.profiles.multiapiclient\": [\"MultiApiClientMixin\"], \"msrest\": [\"Deserializer\", \"Serializer\"], \"azure.mgmt.core\": [\"ARMPipelineClient\"]}, \"local\": {\"._configuration\": [\"BatchManagementClientConfiguration\"]}}, \"conditional\": {\"stdlib\": {\"typing\": [\"Any\", \"Optional\"]}, \"azurecore\": {\"azure.core.pipeline.transport\": [\"HttpRequest\", \"HttpResponse\"]}}}",
"async_imports": "{\"typing\": {\"azurecore\": {\"azure.core.credentials_async\": [\"AsyncTokenCredential\"]}}, \"regular\": {\"azurecore\": {\"azure.profiles\": [\"KnownProfiles\", \"ProfileDefinition\"], \"azure.profiles.multiapiclient\": [\"MultiApiClientMixin\"], \"msrest\": [\"Deserializer\", \"Serializer\"], \"azure.mgmt.core\": [\"AsyncARMPipelineClient\"]}, \"local\": {\"._configuration\": [\"BatchManagementClientConfiguration\"]}}, \"conditional\": {\"stdlib\": {\"typing\": [\"Any\", \"Optional\"]}, \"azurecore\": {\"azure.core.pipeline.transport\": [\"AsyncHttpResponse\", \"HttpRequest\"]}}}"
},
"global_parameters": {
"sync": {
Expand All @@ -28,28 +30,72 @@
},
"async": {
"credential": {
"signature": "credential, # type: \"AsyncTokenCredential\"",
"signature": "credential: \"AsyncTokenCredential\",",
"description": "Credential needed for the client to connect to Azure.",
"docstring_type": "~azure.core.credentials_async.AsyncTokenCredential",
"required": true
},
"subscription_id": {
"signature": "subscription_id, # type: str",
"signature": "subscription_id: str,",
"description": "The Azure subscription ID. This is a GUID-formatted string (e.g. 00000000-0000-0000-0000-000000000000).",
"docstring_type": "str",
"required": true
}
},
"constant": {
},
"call": "credential, subscription_id"
"call": "credential, subscription_id",
"service_client_specific": {
"sync": {
"api_version": {
"signature": "api_version=None, # type: Optional[str]",
"description": "API version to use if no profile is provided, or if missing in profile.",
"docstring_type": "str",
"required": false
},
"base_url": {
"signature": "base_url=None, # type: Optional[str]",
"description": "Service URL",
"docstring_type": "str",
"required": false
},
"profile": {
"signature": "profile=KnownProfiles.default, # type: KnownProfiles",
"description": "A profile definition, from KnownProfiles to dict.",
"docstring_type": "azure.profiles.KnownProfiles",
"required": false
}
},
"async": {
"api_version": {
"signature": "api_version: Optional[str] = None,",
"description": "API version to use if no profile is provided, or if missing in profile.",
"docstring_type": "str",
"required": false
},
"base_url": {
"signature": "base_url: Optional[str] = None,",
"description": "Service URL",
"docstring_type": "str",
"required": false
},
"profile": {
"signature": "profile: KnownProfiles = KnownProfiles.default,",
"description": "A profile definition, from KnownProfiles to dict.",
"docstring_type": "azure.profiles.KnownProfiles",
"required": false
}
}
}
},
"config": {
"credential": true,
"credential_scopes": ["https://management.azure.com/.default"],
"credential_default_policy_type": "BearerTokenCredentialPolicy",
"credential_default_policy_type_has_async_version": true,
"credential_key_header_name": null
"credential_key_header_name": null,
"sync_imports": "{\"regular\": {\"azurecore\": {\"azure.core.configuration\": [\"Configuration\"], \"azure.core.pipeline\": [\"policies\"], \"azure.mgmt.core.policies\": [\"ARMHttpLoggingPolicy\"]}, \"local\": {\"._version\": [\"VERSION\"]}}, \"conditional\": {\"stdlib\": {\"typing\": [\"Any\"]}}, \"typing\": {\"azurecore\": {\"azure.core.credentials\": [\"TokenCredential\"]}}}",
"async_imports": "{\"regular\": {\"azurecore\": {\"azure.core.configuration\": [\"Configuration\"], \"azure.core.pipeline\": [\"policies\"], \"azure.mgmt.core.policies\": [\"ARMHttpLoggingPolicy\"]}, \"local\": {\".._version\": [\"VERSION\"]}}, \"conditional\": {\"stdlib\": {\"typing\": [\"Any\"]}}, \"typing\": {\"azurecore\": {\"azure.core.credentials_async\": [\"AsyncTokenCredential\"]}}}"
},
"operation_groups": {
"batch_account": "BatchAccountOperations",
Expand All @@ -61,9 +107,5 @@
"private_link_resource": "PrivateLinkResourceOperations",
"private_endpoint_connection": "PrivateEndpointConnectionOperations",
"pool": "PoolOperations"
},
"operation_mixins": {
},
"sync_imports": "None",
"async_imports": "None"
}
}
2 changes: 1 addition & 1 deletion sdk/batch/azure-mgmt-batch/azure/mgmt/batch/_version.py
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 = "15.0.0"
VERSION = "16.0.0"
4 changes: 2 additions & 2 deletions sdk/batch/azure-mgmt-batch/azure/mgmt/batch/aio/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,5 +6,5 @@
# Changes may cause incorrect behavior and will be lost if the code is regenerated.
# --------------------------------------------------------------------------

from ._batch_management import BatchManagement
__all__ = ['BatchManagement']
from ._batch_management_client import BatchManagementClient
__all__ = ['BatchManagementClient']
Original file line number Diff line number Diff line change
Expand Up @@ -8,14 +8,15 @@

from typing import Any, Optional, TYPE_CHECKING

from azure.core.pipeline.transport import AsyncHttpResponse, HttpRequest
from azure.mgmt.core import AsyncARMPipelineClient
from msrest import Deserializer, Serializer

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

from ._configuration import BatchManagementConfiguration
from ._configuration import BatchManagementClientConfiguration
from .operations import BatchAccountOperations
from .operations import ApplicationPackageOperations
from .operations import ApplicationOperations
Expand All @@ -28,8 +29,8 @@
from .. import models


class BatchManagement(object):
"""BatchManagement.
class BatchManagementClient(object):
"""Batch Client.
:ivar batch_account: BatchAccountOperations operations
:vartype batch_account: azure.mgmt.batch.aio.operations.BatchAccountOperations
Expand Down Expand Up @@ -66,11 +67,12 @@ def __init__(
) -> None:
if not base_url:
base_url = 'https://management.azure.com'
self._config = BatchManagementConfiguration(credential, subscription_id, **kwargs)
self._config = BatchManagementClientConfiguration(credential, 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)}
self._serialize = Serializer(client_models)
self._serialize.client_side_validation = False
self._deserialize = Deserializer(client_models)

self.batch_account = BatchAccountOperations(
Expand All @@ -92,10 +94,27 @@ def __init__(
self.pool = PoolOperations(
self._client, self._config, self._serialize, self._deserialize)

async def _send_request(self, http_request: HttpRequest, **kwargs: Any) -> AsyncHttpResponse:
"""Runs the network request through the client's chained policies.
:param http_request: The network request you want to make. Required.
:type http_request: ~azure.core.pipeline.transport.HttpRequest
:keyword bool stream: Whether the response payload will be streamed. Defaults to True.
:return: The response of your network call. Does not do error handling on your response.
:rtype: ~azure.core.pipeline.transport.AsyncHttpResponse
"""
path_format_arguments = {
'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'),
}
http_request.url = self._client.format_url(http_request.url, **path_format_arguments)
stream = kwargs.pop("stream", True)
pipeline_response = await self._client._pipeline.run(http_request, stream=stream, **kwargs)
return pipeline_response.http_response

async def close(self) -> None:
await self._client.close()

async def __aenter__(self) -> "BatchManagement":
async def __aenter__(self) -> "BatchManagementClient":
await self._client.__aenter__()
return self

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,8 @@
from azure.core.credentials_async import AsyncTokenCredential


class BatchManagementConfiguration(Configuration):
"""Configuration for BatchManagement.
class BatchManagementClientConfiguration(Configuration):
"""Configuration for BatchManagementClient.
Note that all parameters used to create this instance are saved as instance
attributes.
Expand All @@ -41,11 +41,11 @@ def __init__(
raise ValueError("Parameter 'credential' must not be None.")
if subscription_id is None:
raise ValueError("Parameter 'subscription_id' must not be None.")
super(BatchManagementConfiguration, self).__init__(**kwargs)
super(BatchManagementClientConfiguration, self).__init__(**kwargs)

self.credential = credential
self.subscription_id = subscription_id
self.api_version = "2021-01-01"
self.api_version = "2021-06-01"
self.credential_scopes = kwargs.pop('credential_scopes', ['https://management.azure.com/.default'])
kwargs.setdefault('sdk_moniker', 'mgmt-batch/{}'.format(VERSION))
self._configure(**kwargs)
Expand Down
Loading

0 comments on commit 05008ae

Please sign in to comment.