Skip to content

Commit

Permalink
CodeGen from PR 13597 in Azure/azure-rest-api-specs
Browse files Browse the repository at this point in the history
[Databox] Added mitigate api to resolve errors raised by job (Azure#13597)

* updating examples and get job json

* fixing checks

* removing white spaces from example

* ran prettier fix
  • Loading branch information
SDKAuto committed Mar 29, 2021
1 parent e1a2f6e commit 84dc376
Show file tree
Hide file tree
Showing 38 changed files with 13,186 additions and 314 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -15,15 +15,15 @@
from azure.profiles import KnownProfiles, ProfileDefinition
from azure.profiles.multiapiclient import MultiApiClientMixin
from ._configuration import DataBoxManagementClientConfiguration

from ._operations_mixin import DataBoxManagementClientOperationsMixin
class _SDKClient(object):
def __init__(self, *args, **kwargs):
"""This is a fake class to support current implemetation of MultiApiClientMixin."
Will be removed in final version of multiapi azure-core based client
"""
pass

class DataBoxManagementClient(MultiApiClientMixin, _SDKClient):
class DataBoxManagementClient(DataBoxManagementClientOperationsMixin, MultiApiClientMixin, _SDKClient):
"""The DataBox Client.
This ready contains multiple API versions, to help you deal with all of the Azure clouds
Expand All @@ -46,7 +46,7 @@ class DataBoxManagementClient(MultiApiClientMixin, _SDKClient):
:keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present.
"""

DEFAULT_API_VERSION = '2020-11-01'
DEFAULT_API_VERSION = '2021-03-01'
_PROFILE_TAG = "azure.mgmt.databox.DataBoxManagementClient"
LATEST_PROFILE = ProfileDefinition({
_PROFILE_TAG: {
Expand Down Expand Up @@ -85,6 +85,7 @@ def models(cls, api_version=DEFAULT_API_VERSION):
* 2019-09-01: :mod:`v2019_09_01.models<azure.mgmt.databox.v2019_09_01.models>`
* 2020-04-01: :mod:`v2020_04_01.models<azure.mgmt.databox.v2020_04_01.models>`
* 2020-11-01: :mod:`v2020_11_01.models<azure.mgmt.databox.v2020_11_01.models>`
* 2021-03-01: :mod:`v2021_03_01.models<azure.mgmt.databox.v2021_03_01.models>`
"""
if api_version == '2018-01-01':
from .v2018_01_01 import models
Expand All @@ -98,6 +99,9 @@ def models(cls, api_version=DEFAULT_API_VERSION):
elif api_version == '2020-11-01':
from .v2020_11_01 import models
return models
elif api_version == '2021-03-01':
from .v2021_03_01 import models
return models
raise ValueError("API version {} is not available".format(api_version))

@property
Expand All @@ -108,6 +112,7 @@ def jobs(self):
* 2019-09-01: :class:`JobsOperations<azure.mgmt.databox.v2019_09_01.operations.JobsOperations>`
* 2020-04-01: :class:`JobsOperations<azure.mgmt.databox.v2020_04_01.operations.JobsOperations>`
* 2020-11-01: :class:`JobsOperations<azure.mgmt.databox.v2020_11_01.operations.JobsOperations>`
* 2021-03-01: :class:`JobsOperations<azure.mgmt.databox.v2021_03_01.operations.JobsOperations>`
"""
api_version = self._get_api_version('jobs')
if api_version == '2018-01-01':
Expand All @@ -118,6 +123,8 @@ def jobs(self):
from .v2020_04_01.operations import JobsOperations as OperationClass
elif api_version == '2020-11-01':
from .v2020_11_01.operations import JobsOperations as OperationClass
elif api_version == '2021-03-01':
from .v2021_03_01.operations import JobsOperations as OperationClass
else:
raise ValueError("API version {} does not have operation group 'jobs'".format(api_version))
return OperationClass(self._client, self._config, Serializer(self._models_dict(api_version)), Deserializer(self._models_dict(api_version)))
Expand All @@ -130,6 +137,7 @@ def operations(self):
* 2019-09-01: :class:`Operations<azure.mgmt.databox.v2019_09_01.operations.Operations>`
* 2020-04-01: :class:`Operations<azure.mgmt.databox.v2020_04_01.operations.Operations>`
* 2020-11-01: :class:`Operations<azure.mgmt.databox.v2020_11_01.operations.Operations>`
* 2021-03-01: :class:`Operations<azure.mgmt.databox.v2021_03_01.operations.Operations>`
"""
api_version = self._get_api_version('operations')
if api_version == '2018-01-01':
Expand All @@ -140,6 +148,8 @@ def operations(self):
from .v2020_04_01.operations import Operations as OperationClass
elif api_version == '2020-11-01':
from .v2020_11_01.operations import Operations as OperationClass
elif api_version == '2021-03-01':
from .v2021_03_01.operations import Operations as OperationClass
else:
raise ValueError("API version {} does not have operation group 'operations'".format(api_version))
return OperationClass(self._client, self._config, Serializer(self._models_dict(api_version)), Deserializer(self._models_dict(api_version)))
Expand All @@ -152,6 +162,7 @@ def service(self):
* 2019-09-01: :class:`ServiceOperations<azure.mgmt.databox.v2019_09_01.operations.ServiceOperations>`
* 2020-04-01: :class:`ServiceOperations<azure.mgmt.databox.v2020_04_01.operations.ServiceOperations>`
* 2020-11-01: :class:`ServiceOperations<azure.mgmt.databox.v2020_11_01.operations.ServiceOperations>`
* 2021-03-01: :class:`ServiceOperations<azure.mgmt.databox.v2021_03_01.operations.ServiceOperations>`
"""
api_version = self._get_api_version('service')
if api_version == '2018-01-01':
Expand All @@ -162,6 +173,8 @@ def service(self):
from .v2020_04_01.operations import ServiceOperations as OperationClass
elif api_version == '2020-11-01':
from .v2020_11_01.operations import ServiceOperations as OperationClass
elif api_version == '2021-03-01':
from .v2021_03_01.operations import ServiceOperations as OperationClass
else:
raise ValueError("API version {} does not have operation group 'service'".format(api_version))
return OperationClass(self._client, self._config, Serializer(self._models_dict(api_version)), Deserializer(self._models_dict(api_version)))
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,59 @@
# coding=utf-8
# --------------------------------------------------------------------------
# Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License. See License.txt in the project root for
# license information.
#
# Code generated by Microsoft (R) AutoRest Code Generator.
# Changes may cause incorrect behavior and will be lost if the code is
# regenerated.
# --------------------------------------------------------------------------
from msrest import Serializer, Deserializer
from typing import TYPE_CHECKING
import warnings

from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error
from azure.core.pipeline import PipelineResponse
from azure.core.pipeline.transport import HttpRequest, HttpResponse
from azure.mgmt.core.exceptions import ARMErrorFormat

if TYPE_CHECKING:
# pylint: disable=unused-import,ungrouped-imports
from typing import Any, Callable, Dict, Generic, Optional, TypeVar


class DataBoxManagementClientOperationsMixin(object):

def mitigate(
self,
job_name, # type: str
resource_group_name, # type: str
mitigate_job_request, # type: "_models.MitigateJobRequest"
**kwargs # type: Any
):
"""Request to mitigate for a given job.
:param job_name: The name of the job Resource within the specified resource group. job names
must be between 3 and 24 characters in length and use any alphanumeric and underscore only.
:type job_name: str
:param resource_group_name: The Resource Group Name.
:type resource_group_name: str
:param mitigate_job_request: Mitigation Request.
:type mitigate_job_request: ~azure.mgmt.databox.models.MitigateJobRequest
:keyword callable cls: A custom type or function that will be passed the direct response
:return: None, or the result of cls(response)
:rtype: None
:raises: ~azure.core.exceptions.HttpResponseError
"""
api_version = self._get_api_version('mitigate')
if api_version == '2021-03-01':
from .v2021_03_01.operations import DataBoxManagementClientOperationsMixin as OperationClass
else:
raise ValueError("API version {} does not have operation 'mitigate'".format(api_version))
mixin_instance = OperationClass()
mixin_instance._client = self._client
mixin_instance._config = self._config
mixin_instance._serialize = Serializer(self._models_dict(api_version))
mixin_instance._serialize.client_side_validation = False
mixin_instance._deserialize = Deserializer(self._models_dict(api_version))
return mixin_instance.mitigate(job_name, resource_group_name, mitigate_job_request, **kwargs)
Original file line number Diff line number Diff line change
Expand Up @@ -15,15 +15,15 @@
from azure.profiles import KnownProfiles, ProfileDefinition
from azure.profiles.multiapiclient import MultiApiClientMixin
from ._configuration import DataBoxManagementClientConfiguration

from ._operations_mixin import DataBoxManagementClientOperationsMixin
class _SDKClient(object):
def __init__(self, *args, **kwargs):
"""This is a fake class to support current implemetation of MultiApiClientMixin."
Will be removed in final version of multiapi azure-core based client
"""
pass

class DataBoxManagementClient(MultiApiClientMixin, _SDKClient):
class DataBoxManagementClient(DataBoxManagementClientOperationsMixin, MultiApiClientMixin, _SDKClient):
"""The DataBox Client.
This ready contains multiple API versions, to help you deal with all of the Azure clouds
Expand All @@ -46,7 +46,7 @@ class DataBoxManagementClient(MultiApiClientMixin, _SDKClient):
:keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present.
"""

DEFAULT_API_VERSION = '2020-11-01'
DEFAULT_API_VERSION = '2021-03-01'
_PROFILE_TAG = "azure.mgmt.databox.DataBoxManagementClient"
LATEST_PROFILE = ProfileDefinition({
_PROFILE_TAG: {
Expand Down Expand Up @@ -85,6 +85,7 @@ def models(cls, api_version=DEFAULT_API_VERSION):
* 2019-09-01: :mod:`v2019_09_01.models<azure.mgmt.databox.v2019_09_01.models>`
* 2020-04-01: :mod:`v2020_04_01.models<azure.mgmt.databox.v2020_04_01.models>`
* 2020-11-01: :mod:`v2020_11_01.models<azure.mgmt.databox.v2020_11_01.models>`
* 2021-03-01: :mod:`v2021_03_01.models<azure.mgmt.databox.v2021_03_01.models>`
"""
if api_version == '2018-01-01':
from ..v2018_01_01 import models
Expand All @@ -98,6 +99,9 @@ def models(cls, api_version=DEFAULT_API_VERSION):
elif api_version == '2020-11-01':
from ..v2020_11_01 import models
return models
elif api_version == '2021-03-01':
from ..v2021_03_01 import models
return models
raise ValueError("API version {} is not available".format(api_version))

@property
Expand All @@ -108,6 +112,7 @@ def jobs(self):
* 2019-09-01: :class:`JobsOperations<azure.mgmt.databox.v2019_09_01.aio.operations.JobsOperations>`
* 2020-04-01: :class:`JobsOperations<azure.mgmt.databox.v2020_04_01.aio.operations.JobsOperations>`
* 2020-11-01: :class:`JobsOperations<azure.mgmt.databox.v2020_11_01.aio.operations.JobsOperations>`
* 2021-03-01: :class:`JobsOperations<azure.mgmt.databox.v2021_03_01.aio.operations.JobsOperations>`
"""
api_version = self._get_api_version('jobs')
if api_version == '2018-01-01':
Expand All @@ -118,6 +123,8 @@ def jobs(self):
from ..v2020_04_01.aio.operations import JobsOperations as OperationClass
elif api_version == '2020-11-01':
from ..v2020_11_01.aio.operations import JobsOperations as OperationClass
elif api_version == '2021-03-01':
from ..v2021_03_01.aio.operations import JobsOperations as OperationClass
else:
raise ValueError("API version {} does not have operation group 'jobs'".format(api_version))
return OperationClass(self._client, self._config, Serializer(self._models_dict(api_version)), Deserializer(self._models_dict(api_version)))
Expand All @@ -130,6 +137,7 @@ def operations(self):
* 2019-09-01: :class:`Operations<azure.mgmt.databox.v2019_09_01.aio.operations.Operations>`
* 2020-04-01: :class:`Operations<azure.mgmt.databox.v2020_04_01.aio.operations.Operations>`
* 2020-11-01: :class:`Operations<azure.mgmt.databox.v2020_11_01.aio.operations.Operations>`
* 2021-03-01: :class:`Operations<azure.mgmt.databox.v2021_03_01.aio.operations.Operations>`
"""
api_version = self._get_api_version('operations')
if api_version == '2018-01-01':
Expand All @@ -140,6 +148,8 @@ def operations(self):
from ..v2020_04_01.aio.operations import Operations as OperationClass
elif api_version == '2020-11-01':
from ..v2020_11_01.aio.operations import Operations as OperationClass
elif api_version == '2021-03-01':
from ..v2021_03_01.aio.operations import Operations as OperationClass
else:
raise ValueError("API version {} does not have operation group 'operations'".format(api_version))
return OperationClass(self._client, self._config, Serializer(self._models_dict(api_version)), Deserializer(self._models_dict(api_version)))
Expand All @@ -152,6 +162,7 @@ def service(self):
* 2019-09-01: :class:`ServiceOperations<azure.mgmt.databox.v2019_09_01.aio.operations.ServiceOperations>`
* 2020-04-01: :class:`ServiceOperations<azure.mgmt.databox.v2020_04_01.aio.operations.ServiceOperations>`
* 2020-11-01: :class:`ServiceOperations<azure.mgmt.databox.v2020_11_01.aio.operations.ServiceOperations>`
* 2021-03-01: :class:`ServiceOperations<azure.mgmt.databox.v2021_03_01.aio.operations.ServiceOperations>`
"""
api_version = self._get_api_version('service')
if api_version == '2018-01-01':
Expand All @@ -162,6 +173,8 @@ def service(self):
from ..v2020_04_01.aio.operations import ServiceOperations as OperationClass
elif api_version == '2020-11-01':
from ..v2020_11_01.aio.operations import ServiceOperations as OperationClass
elif api_version == '2021-03-01':
from ..v2021_03_01.aio.operations import ServiceOperations as OperationClass
else:
raise ValueError("API version {} does not have operation group 'service'".format(api_version))
return OperationClass(self._client, self._config, Serializer(self._models_dict(api_version)), Deserializer(self._models_dict(api_version)))
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
# coding=utf-8
# --------------------------------------------------------------------------
# Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License. See License.txt in the project root for
# license information.
#
# Code generated by Microsoft (R) AutoRest Code Generator.
# Changes may cause incorrect behavior and will be lost if the code is
# regenerated.
# --------------------------------------------------------------------------
from msrest import Serializer, Deserializer
from typing import Any, Callable, Dict, Generic, Optional, TypeVar
import warnings

from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error
from azure.core.pipeline import PipelineResponse
from azure.core.pipeline.transport import AsyncHttpResponse, HttpRequest
from azure.mgmt.core.exceptions import ARMErrorFormat


class DataBoxManagementClientOperationsMixin(object):

async def mitigate(
self,
job_name: str,
resource_group_name: str,
mitigate_job_request: "_models.MitigateJobRequest",
**kwargs
) -> None:
"""Request to mitigate for a given job.
:param job_name: The name of the job Resource within the specified resource group. job names
must be between 3 and 24 characters in length and use any alphanumeric and underscore only.
:type job_name: str
:param resource_group_name: The Resource Group Name.
:type resource_group_name: str
:param mitigate_job_request: Mitigation Request.
:type mitigate_job_request: ~azure.mgmt.databox.models.MitigateJobRequest
:keyword callable cls: A custom type or function that will be passed the direct response
:return: None, or the result of cls(response)
:rtype: None
:raises: ~azure.core.exceptions.HttpResponseError
"""
api_version = self._get_api_version('mitigate')
if api_version == '2021-03-01':
from ..v2021_03_01.aio.operations import DataBoxManagementClientOperationsMixin as OperationClass
else:
raise ValueError("API version {} does not have operation 'mitigate'".format(api_version))
mixin_instance = OperationClass()
mixin_instance._client = self._client
mixin_instance._config = self._config
mixin_instance._serialize = Serializer(self._models_dict(api_version))
mixin_instance._serialize.client_side_validation = False
mixin_instance._deserialize = Deserializer(self._models_dict(api_version))
return await mixin_instance.mitigate(job_name, resource_group_name, mitigate_job_request, **kwargs)
Original file line number Diff line number Diff line change
Expand Up @@ -4,4 +4,4 @@
# Licensed under the MIT License. See License.txt in the project root for
# license information.
# --------------------------------------------------------------------------
from .v2020_11_01.models import *
from .v2021_03_01.models import *
Loading

0 comments on commit 84dc376

Please sign in to comment.