Skip to content

Commit

Permalink
CodeGen from PR 26934 in Azure/azure-rest-api-specs
Browse files Browse the repository at this point in the history
Merge 301e0917f862ed63ab9811e2e98dd5cfe18eb911 into 30688b39000e73d88177d528bd9bf7ec0e1263dc
  • Loading branch information
SDKAuto committed Dec 6, 2023
1 parent a3aa35e commit 7119d0c
Show file tree
Hide file tree
Showing 61 changed files with 455 additions and 89 deletions.
4 changes: 2 additions & 2 deletions sdk/maintenance/azure-mgmt-maintenance/_meta.json
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
{
"commit": "e6d90862a97c4f04f0c26a8869602bbfd8b10280",
"commit": "030e84f63f2ca6f401ae3f35d6e70832f835c1c8",
"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_command": "autorest specification/maintenance/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/maintenance/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.7.1 --use=@autorest/modelerfour@4.26.2 --version=3.9.7 --version-tolerant=False",
"readme": "specification/maintenance/resource-manager/readme.md"
}
Original file line number Diff line number Diff line change
Expand Up @@ -27,17 +27,16 @@ class MaintenanceManagementClientConfiguration(Configuration): # pylint: disabl
:param credential: Credential needed for the client to connect to Azure. Required.
:type credential: ~azure.core.credentials.TokenCredential
:param subscription_id: Subscription credentials that uniquely identify a Microsoft Azure
subscription. The subscription ID forms part of the URI for every service call. 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-09-01-preview". Note that overriding
:keyword api_version: Api Version. Default value is "2023-10-01-preview". 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(MaintenanceManagementClientConfiguration, self).__init__(**kwargs)
api_version: str = kwargs.pop("api_version", "2023-09-01-preview")
api_version: str = kwargs.pop("api_version", "2023-10-01-preview")

if credential is None:
raise ValueError("Parameter 'credential' must not be None.")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@
MaintenanceConfigurationsOperations,
Operations,
PublicMaintenanceConfigurationsOperations,
ScheduledEventOperations,
UpdatesOperations,
)

Expand All @@ -37,6 +38,8 @@
class MaintenanceManagementClient: # pylint: disable=client-accepts-api-version-keyword,too-many-instance-attributes
"""Azure Maintenance Management Client.
:ivar scheduled_event: ScheduledEventOperations operations
:vartype scheduled_event: azure.mgmt.maintenance.operations.ScheduledEventOperations
:ivar public_maintenance_configurations: PublicMaintenanceConfigurationsOperations operations
:vartype public_maintenance_configurations:
azure.mgmt.maintenance.operations.PublicMaintenanceConfigurationsOperations
Expand Down Expand Up @@ -73,12 +76,11 @@ class MaintenanceManagementClient: # pylint: disable=client-accepts-api-version
:vartype updates: azure.mgmt.maintenance.operations.UpdatesOperations
:param credential: Credential needed for the client to connect to Azure. Required.
:type credential: ~azure.core.credentials.TokenCredential
:param subscription_id: Subscription credentials that uniquely identify a Microsoft Azure
subscription. The subscription ID forms part of the URI for every service call. 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-09-01-preview". Note that overriding
:keyword api_version: Api Version. Default value is "2023-10-01-preview". Note that overriding
this default value may result in unsupported behavior.
:paramtype api_version: str
"""
Expand All @@ -99,6 +101,7 @@ def __init__(
self._serialize = Serializer(client_models)
self._deserialize = Deserializer(client_models)
self._serialize.client_side_validation = False
self.scheduled_event = ScheduledEventOperations(self._client, self._config, self._serialize, self._deserialize)
self.public_maintenance_configurations = PublicMaintenanceConfigurationsOperations(
self._client, self._config, self._serialize, self._deserialize
)
Expand Down
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 = "2.2.0b1"
VERSION = "1.0.0b1"
Original file line number Diff line number Diff line change
Expand Up @@ -27,17 +27,16 @@ class MaintenanceManagementClientConfiguration(Configuration): # pylint: disabl
:param credential: Credential needed for the client to connect to Azure. Required.
:type credential: ~azure.core.credentials_async.AsyncTokenCredential
:param subscription_id: Subscription credentials that uniquely identify a Microsoft Azure
subscription. The subscription ID forms part of the URI for every service call. 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-09-01-preview". Note that overriding
:keyword api_version: Api Version. Default value is "2023-10-01-preview". Note that overriding
this default value may result in unsupported behavior.
:paramtype api_version: str
"""

def __init__(self, credential: "AsyncTokenCredential", subscription_id: str, **kwargs: Any) -> None:
super(MaintenanceManagementClientConfiguration, self).__init__(**kwargs)
api_version: str = kwargs.pop("api_version", "2023-09-01-preview")
api_version: str = kwargs.pop("api_version", "2023-10-01-preview")

if credential is None:
raise ValueError("Parameter 'credential' must not be None.")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@
MaintenanceConfigurationsOperations,
Operations,
PublicMaintenanceConfigurationsOperations,
ScheduledEventOperations,
UpdatesOperations,
)

Expand All @@ -37,6 +38,8 @@
class MaintenanceManagementClient: # pylint: disable=client-accepts-api-version-keyword,too-many-instance-attributes
"""Azure Maintenance Management Client.
:ivar scheduled_event: ScheduledEventOperations operations
:vartype scheduled_event: azure.mgmt.maintenance.aio.operations.ScheduledEventOperations
:ivar public_maintenance_configurations: PublicMaintenanceConfigurationsOperations operations
:vartype public_maintenance_configurations:
azure.mgmt.maintenance.aio.operations.PublicMaintenanceConfigurationsOperations
Expand Down Expand Up @@ -73,12 +76,11 @@ class MaintenanceManagementClient: # pylint: disable=client-accepts-api-version
:vartype updates: azure.mgmt.maintenance.aio.operations.UpdatesOperations
:param credential: Credential needed for the client to connect to Azure. Required.
:type credential: ~azure.core.credentials_async.AsyncTokenCredential
:param subscription_id: Subscription credentials that uniquely identify a Microsoft Azure
subscription. The subscription ID forms part of the URI for every service call. 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-09-01-preview". Note that overriding
:keyword api_version: Api Version. Default value is "2023-10-01-preview". Note that overriding
this default value may result in unsupported behavior.
:paramtype api_version: str
"""
Expand All @@ -99,6 +101,7 @@ def __init__(
self._serialize = Serializer(client_models)
self._deserialize = Deserializer(client_models)
self._serialize.client_side_validation = False
self.scheduled_event = ScheduledEventOperations(self._client, self._config, self._serialize, self._deserialize)
self.public_maintenance_configurations = PublicMaintenanceConfigurationsOperations(
self._client, self._config, self._serialize, self._deserialize
)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
# Changes may cause incorrect behavior and will be lost if the code is regenerated.
# --------------------------------------------------------------------------

from ._scheduled_event_operations import ScheduledEventOperations
from ._public_maintenance_configurations_operations import PublicMaintenanceConfigurationsOperations
from ._apply_updates_operations import ApplyUpdatesOperations
from ._configuration_assignments_operations import ConfigurationAssignmentsOperations
Expand All @@ -27,6 +28,7 @@
from ._patch import patch_sdk as _patch_sdk

__all__ = [
"ScheduledEventOperations",
"PublicMaintenanceConfigurationsOperations",
"ApplyUpdatesOperations",
"ConfigurationAssignmentsOperations",
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,125 @@
# pylint: disable=too-many-lines
# 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 typing import Any, Callable, Dict, Optional, TypeVar

from azure.core.exceptions import (
ClientAuthenticationError,
HttpResponseError,
ResourceExistsError,
ResourceNotFoundError,
ResourceNotModifiedError,
map_error,
)
from azure.core.pipeline import PipelineResponse
from azure.core.pipeline.transport import AsyncHttpResponse
from azure.core.rest import HttpRequest
from azure.core.tracing.decorator_async import distributed_trace_async
from azure.core.utils import case_insensitive_dict
from azure.mgmt.core.exceptions import ARMErrorFormat

from ... import models as _models
from ..._vendor import _convert_request
from ...operations._scheduled_event_operations import build_acknowledge_request

T = TypeVar("T")
ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]]


class ScheduledEventOperations:
"""
.. warning::
**DO NOT** instantiate this class directly.
Instead, you should access the following operations through
:class:`~azure.mgmt.maintenance.aio.MaintenanceManagementClient`'s
:attr:`scheduled_event` attribute.
"""

models = _models

def __init__(self, *args, **kwargs) -> None:
input_args = list(args)
self._client = input_args.pop(0) if input_args else kwargs.pop("client")
self._config = input_args.pop(0) if input_args else kwargs.pop("config")
self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer")
self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer")

@distributed_trace_async
async def acknowledge(
self, resource_group_name: str, resource_type: str, resource_name: str, scheduled_event_id: str, **kwargs: Any
) -> _models.ScheduledEventApproveResponse:
"""Post Scheduled Event Acknowledgement.
Post Scheduled Event Acknowledgement.
:param resource_group_name: The name of the resource group. The name is case insensitive.
Required.
:type resource_group_name: str
:param resource_type: Resource type. Required.
:type resource_type: str
:param resource_name: Resource Name. Required.
:type resource_name: str
:param scheduled_event_id: Scheduled Event Id. This is a GUID-formatted string (e.g.
00000000-0000-0000-0000-000000000000). Required.
:type scheduled_event_id: str
:keyword callable cls: A custom type or function that will be passed the direct response
:return: ScheduledEventApproveResponse or the result of cls(response)
:rtype: ~azure.mgmt.maintenance.models.ScheduledEventApproveResponse
:raises ~azure.core.exceptions.HttpResponseError:
"""
error_map = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
304: ResourceNotModifiedError,
}
error_map.update(kwargs.pop("error_map", {}) or {})

_headers = kwargs.pop("headers", {}) or {}
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})

api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version))
cls: ClsType[_models.ScheduledEventApproveResponse] = kwargs.pop("cls", None)

request = build_acknowledge_request(
resource_group_name=resource_group_name,
resource_type=resource_type,
resource_name=resource_name,
scheduled_event_id=scheduled_event_id,
subscription_id=self._config.subscription_id,
api_version=api_version,
template_url=self.acknowledge.metadata["url"],
headers=_headers,
params=_params,
)
request = _convert_request(request)
request.url = self._client.format_url(request.url)

_stream = False
pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access
request, stream=_stream, **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)
error = self._deserialize.failsafe_deserialize(_models.MaintenanceError, pipeline_response)
raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat)

deserialized = self._deserialize("ScheduledEventApproveResponse", pipeline_response)

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

return deserialized

acknowledge.metadata = {
"url": "/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.Compute/{resourceType}/{resourceName}/providers/Microsoft.Maintenance/scheduledevents/{scheduledEventId}/acknowledge"
}
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@
from ._models_py3 import OperationInfo
from ._models_py3 import OperationsListResult
from ._models_py3 import Resource
from ._models_py3 import ScheduledEventApproveResponse
from ._models_py3 import SystemData
from ._models_py3 import TagSettingsProperties
from ._models_py3 import Update
Expand Down Expand Up @@ -56,6 +57,7 @@
"OperationInfo",
"OperationsListResult",
"Resource",
"ScheduledEventApproveResponse",
"SystemData",
"TagSettingsProperties",
"Update",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -796,6 +796,26 @@ def __init__(self, *, value: Optional[List["_models.Operation"]] = None, **kwarg
self.value = value


class ScheduledEventApproveResponse(_serialization.Model):
"""Response of scheduled event acknowledge.
:ivar value: Successfully Approved.
:vartype value: str
"""

_attribute_map = {
"value": {"key": "value", "type": "str"},
}

def __init__(self, *, value: Optional[str] = None, **kwargs: Any) -> None:
"""
:keyword value: Successfully Approved.
:paramtype value: str
"""
super().__init__(**kwargs)
self.value = value


class SystemData(_serialization.Model):
"""Metadata pertaining to creation and last modification of the resource.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
# Changes may cause incorrect behavior and will be lost if the code is regenerated.
# --------------------------------------------------------------------------

from ._scheduled_event_operations import ScheduledEventOperations
from ._public_maintenance_configurations_operations import PublicMaintenanceConfigurationsOperations
from ._apply_updates_operations import ApplyUpdatesOperations
from ._configuration_assignments_operations import ConfigurationAssignmentsOperations
Expand All @@ -27,6 +28,7 @@
from ._patch import patch_sdk as _patch_sdk

__all__ = [
"ScheduledEventOperations",
"PublicMaintenanceConfigurationsOperations",
"ApplyUpdatesOperations",
"ConfigurationAssignmentsOperations",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ def build_list_request(resource_group_name: str, subscription_id: str, **kwargs:
_headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})

api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-09-01-preview"))
api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-10-01-preview"))
accept = _headers.pop("Accept", "application/json")

# Construct URL
Expand Down
Loading

0 comments on commit 7119d0c

Please sign in to comment.