Skip to content

Commit

Permalink
CodeGen from PR 13396 in Azure/azure-rest-api-specs
Browse files Browse the repository at this point in the history
track2 configure (Azure#13396)

Co-authored-by: Yan Zhang (WICRESOFT NORTH AMERICA LTD) <v-yanzhang@microsoft.com>
  • Loading branch information
SDKAuto and Yan Zhang (WICRESOFT NORTH AMERICA LTD) committed Mar 15, 2021
1 parent ae427fd commit 089a47e
Show file tree
Hide file tree
Showing 17 changed files with 366 additions and 37 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ def __init__(

self.credential = credential
self.subscription_id = subscription_id
self.api_version = "2019-12-01"
self.api_version = "2021-03-01"
self.credential_scopes = kwargs.pop('credential_scopes', ['https://management.azure.com/.default'])
kwargs.setdefault('sdk_moniker', 'mgmt-containerinstance/{}'.format(VERSION))
self._configure(**kwargs)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,6 @@ def __init__(

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.container_groups = ContainerGroupsOperations(
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,64 @@
{
"chosen_version": "2021-03-01",
"total_api_version_list": ["2021-03-01"],
"client": {
"name": "ContainerInstanceManagementClient",
"filename": "_container_instance_management_client",
"description": "ContainerInstanceManagementClient.",
"base_url": "\u0027https://management.azure.com\u0027",
"custom_base_url": null,
"azure_arm": true,
"has_lro_operations": true,
"client_side_validation": true
},
"global_parameters": {
"sync": {
"credential": {
"signature": "credential, # type: \"TokenCredential\"",
"description": "Credential needed for the client to connect to Azure.",
"docstring_type": "~azure.core.credentials.TokenCredential",
"required": true
},
"subscription_id": {
"signature": "subscription_id, # type: str",
"description": "Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms part of the URI for every service call.",
"docstring_type": "str",
"required": true
}
},
"async": {
"credential": {
"signature": "credential, # type: \"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",
"description": "Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms part of the URI for every service call.",
"docstring_type": "str",
"required": true
}
},
"constant": {
},
"call": "credential, subscription_id"
},
"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
},
"operation_groups": {
"container_groups": "ContainerGroupsOperations",
"operations": "Operations",
"location": "LocationOperations",
"containers": "ContainersOperations"
},
"operation_mixins": {
},
"sync_imports": "None",
"async_imports": "None"
}
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 = "7.0.0"
VERSION = "1.0.0"
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ def __init__(

self.credential = credential
self.subscription_id = subscription_id
self.api_version = "2019-12-01"
self.api_version = "2021-03-01"
self.credential_scopes = kwargs.pop('credential_scopes', ['https://management.azure.com/.default'])
kwargs.setdefault('sdk_moniker', 'mgmt-containerinstance/{}'.format(VERSION))
self._configure(**kwargs)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,6 @@ def __init__(

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.container_groups = ContainerGroupsOperations(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ def list(
401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError
}
error_map.update(kwargs.pop('error_map', {}))
api_version = "2019-12-01"
api_version = "2021-03-01"
accept = "application/json"

def prepare_request(next_link=None):
Expand Down Expand Up @@ -136,7 +136,7 @@ def list_by_resource_group(
401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError
}
error_map.update(kwargs.pop('error_map', {}))
api_version = "2019-12-01"
api_version = "2021-03-01"
accept = "application/json"

def prepare_request(next_link=None):
Expand Down Expand Up @@ -213,7 +213,7 @@ async def get(
401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError
}
error_map.update(kwargs.pop('error_map', {}))
api_version = "2019-12-01"
api_version = "2021-03-01"
accept = "application/json"

# Construct URL
Expand Down Expand Up @@ -261,7 +261,7 @@ async def _create_or_update_initial(
401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError
}
error_map.update(kwargs.pop('error_map', {}))
api_version = "2019-12-01"
api_version = "2021-03-01"
content_type = kwargs.pop("content_type", "application/json")
accept = "application/json"

Expand Down Expand Up @@ -406,7 +406,7 @@ async def update(
401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError
}
error_map.update(kwargs.pop('error_map', {}))
api_version = "2019-12-01"
api_version = "2021-03-01"
content_type = kwargs.pop("content_type", "application/json")
accept = "application/json"

Expand Down Expand Up @@ -458,7 +458,7 @@ async def _delete_initial(
401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError
}
error_map.update(kwargs.pop('error_map', {}))
api_version = "2019-12-01"
api_version = "2021-03-01"
accept = "application/json"

# Construct URL
Expand Down Expand Up @@ -577,7 +577,7 @@ async def _restart_initial(
401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError
}
error_map.update(kwargs.pop('error_map', {}))
api_version = "2019-12-01"
api_version = "2021-03-01"
accept = "application/json"

# Construct URL
Expand Down Expand Up @@ -702,7 +702,7 @@ async def stop(
401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError
}
error_map.update(kwargs.pop('error_map', {}))
api_version = "2019-12-01"
api_version = "2021-03-01"
accept = "application/json"

# Construct URL
Expand Down Expand Up @@ -746,7 +746,7 @@ async def _start_initial(
401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError
}
error_map.update(kwargs.pop('error_map', {}))
api_version = "2019-12-01"
api_version = "2021-03-01"
accept = "application/json"

# Construct URL
Expand All @@ -770,7 +770,7 @@ async def _start_initial(
pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs)
response = pipeline_response.http_response

if response.status_code not in [204]:
if response.status_code not in [202]:
map_error(status_code=response.status_code, response=response, error_map=error_map)
raise HttpResponseError(response=response, error_format=ARMErrorFormat)

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,7 @@ async def list_logs(
container_group_name: str,
container_name: str,
tail: Optional[int] = None,
timestamps: Optional[bool] = None,
**kwargs
) -> "_models.Logs":
"""Get the logs for a specified container instance.
Expand All @@ -62,6 +63,9 @@ async def list_logs(
:param tail: The number of lines to show from the tail of the container instance log. If not
provided, all available logs are shown up to 4mb.
:type tail: int
:param timestamps: If true, adds a timestamp at the beginning of every line of log output. If
not provided, defaults to false.
:type timestamps: bool
:keyword callable cls: A custom type or function that will be passed the direct response
:return: Logs, or the result of cls(response)
:rtype: ~azure.mgmt.containerinstance.models.Logs
Expand All @@ -72,7 +76,7 @@ async def list_logs(
401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError
}
error_map.update(kwargs.pop('error_map', {}))
api_version = "2019-12-01"
api_version = "2021-03-01"
accept = "application/json"

# Construct URL
Expand All @@ -90,6 +94,8 @@ async def list_logs(
query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str')
if tail is not None:
query_parameters['tail'] = self._serialize.query("tail", tail, 'int')
if timestamps is not None:
query_parameters['timestamps'] = self._serialize.query("timestamps", timestamps, 'bool')

# Construct headers
header_parameters = {} # type: Dict[str, Any]
Expand Down Expand Up @@ -142,7 +148,7 @@ async def execute_command(
401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError
}
error_map.update(kwargs.pop('error_map', {}))
api_version = "2019-12-01"
api_version = "2021-03-01"
content_type = kwargs.pop("content_type", "application/json")
accept = "application/json"

Expand Down Expand Up @@ -183,3 +189,68 @@ async def execute_command(

return deserialized
execute_command.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerInstance/containerGroups/{containerGroupName}/containers/{containerName}/exec'} # type: ignore

async def attach(
self,
resource_group_name: str,
container_group_name: str,
container_name: str,
**kwargs
) -> "_models.ContainerAttachResponse":
"""Attach to the output of a specific container instance.
Attach to the output stream of a specific container instance in a specified resource group and
container group.
:param resource_group_name: The name of the resource group.
:type resource_group_name: str
:param container_group_name: The name of the container group.
:type container_group_name: str
:param container_name: The name of the container instance.
:type container_name: str
:keyword callable cls: A custom type or function that will be passed the direct response
:return: ContainerAttachResponse, or the result of cls(response)
:rtype: ~azure.mgmt.containerinstance.models.ContainerAttachResponse
:raises: ~azure.core.exceptions.HttpResponseError
"""
cls = kwargs.pop('cls', None) # type: ClsType["_models.ContainerAttachResponse"]
error_map = {
401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError
}
error_map.update(kwargs.pop('error_map', {}))
api_version = "2021-03-01"
accept = "application/json"

# Construct URL
url = self.attach.metadata['url'] # type: ignore
path_format_arguments = {
'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'),
'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'),
'containerGroupName': self._serialize.url("container_group_name", container_group_name, 'str'),
'containerName': self._serialize.url("container_name", container_name, 'str'),
}
url = self._client.format_url(url, **path_format_arguments)

# Construct parameters
query_parameters = {} # type: Dict[str, Any]
query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str')

# Construct headers
header_parameters = {} # type: Dict[str, Any]
header_parameters['Accept'] = self._serialize.header("accept", accept, 'str')

request = self._client.post(url, query_parameters, header_parameters)
pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs)
response = pipeline_response.http_response

if response.status_code not in [200]:
map_error(status_code=response.status_code, response=response, error_map=error_map)
raise HttpResponseError(response=response, error_format=ARMErrorFormat)

deserialized = self._deserialize('ContainerAttachResponse', pipeline_response)

if cls:
return cls(pipeline_response, deserialized, {})

return deserialized
attach.metadata = {'url': '/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.ContainerInstance/containerGroups/{containerGroupName}/containers/{containerName}/attach'} # type: ignore
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ def list_usage(
401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError
}
error_map.update(kwargs.pop('error_map', {}))
api_version = "2019-12-01"
api_version = "2021-03-01"
accept = "application/json"

def prepare_request(next_link=None):
Expand Down Expand Up @@ -132,7 +132,7 @@ def list_cached_images(
401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError
}
error_map.update(kwargs.pop('error_map', {}))
api_version = "2019-12-01"
api_version = "2021-03-01"
accept = "application/json"

def prepare_request(next_link=None):
Expand Down Expand Up @@ -204,7 +204,7 @@ def list_capabilities(
401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError
}
error_map.update(kwargs.pop('error_map', {}))
api_version = "2019-12-01"
api_version = "2021-03-01"
accept = "application/json"

def prepare_request(next_link=None):
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ def list(
401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError
}
error_map.update(kwargs.pop('error_map', {}))
api_version = "2019-12-01"
api_version = "2021-03-01"
accept = "application/json"

def prepare_request(next_link=None):
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@
from ._models_py3 import CloudErrorBody
from ._models_py3 import Components10Wh5UdSchemasContainergroupidentityPropertiesUserassignedidentitiesAdditionalproperties
from ._models_py3 import Container
from ._models_py3 import ContainerAttachResponse
from ._models_py3 import ContainerExec
from ._models_py3 import ContainerExecRequest
from ._models_py3 import ContainerExecRequestTerminalSize
Expand All @@ -37,6 +38,7 @@
from ._models_py3 import Event
from ._models_py3 import GitRepoVolume
from ._models_py3 import GpuResource
from ._models_py3 import HttpHeaders
from ._models_py3 import ImageRegistryCredential
from ._models_py3 import InitContainerDefinition
from ._models_py3 import InitContainerPropertiesDefinitionInstanceView
Expand Down Expand Up @@ -66,6 +68,7 @@
from ._models import CloudErrorBody # type: ignore
from ._models import Components10Wh5UdSchemasContainergroupidentityPropertiesUserassignedidentitiesAdditionalproperties # type: ignore
from ._models import Container # type: ignore
from ._models import ContainerAttachResponse # type: ignore
from ._models import ContainerExec # type: ignore
from ._models import ContainerExecRequest # type: ignore
from ._models import ContainerExecRequestTerminalSize # type: ignore
Expand All @@ -87,6 +90,7 @@
from ._models import Event # type: ignore
from ._models import GitRepoVolume # type: ignore
from ._models import GpuResource # type: ignore
from ._models import HttpHeaders # type: ignore
from ._models import ImageRegistryCredential # type: ignore
from ._models import InitContainerDefinition # type: ignore
from ._models import InitContainerPropertiesDefinitionInstanceView # type: ignore
Expand Down Expand Up @@ -131,6 +135,7 @@
'CloudErrorBody',
'Components10Wh5UdSchemasContainergroupidentityPropertiesUserassignedidentitiesAdditionalproperties',
'Container',
'ContainerAttachResponse',
'ContainerExec',
'ContainerExecRequest',
'ContainerExecRequestTerminalSize',
Expand All @@ -152,6 +157,7 @@
'Event',
'GitRepoVolume',
'GpuResource',
'HttpHeaders',
'ImageRegistryCredential',
'InitContainerDefinition',
'InitContainerPropertiesDefinitionInstanceView',
Expand Down
Loading

0 comments on commit 089a47e

Please sign in to comment.