diff --git a/sdk/computeschedule/azure-mgmt-computeschedule/CHANGELOG.md b/sdk/computeschedule/azure-mgmt-computeschedule/CHANGELOG.md index 4bb4f1bfd507..6007a1e4f92b 100644 --- a/sdk/computeschedule/azure-mgmt-computeschedule/CHANGELOG.md +++ b/sdk/computeschedule/azure-mgmt-computeschedule/CHANGELOG.md @@ -1,5 +1,33 @@ # Release History +## 1.1.0 (2025-05-13) + +### Features Added + + - Added model `CreateResourceOperationResponse` + - Added model `DeleteResourceOperationResponse` + - Added model `ExecuteCreateRequest` + - Added model `ExecuteDeleteRequest` + - Added model `ResourceProvisionPayload` + - Model `ScheduledActionsOperations` added method `virtual_machines_execute_create` + - Model `ScheduledActionsOperations` added method `virtual_machines_execute_delete` + - Method `CreateResourceOperationResponse.__init__` has a new overload `def __init__(self: None, description: str, type: str, location: str, results: Optional[List[_models.ResourceOperation]])` + - Method `CreateResourceOperationResponse.__init__` has a new overload `def __init__(self: None, mapping: Mapping[str, Any])` + - Method `DeleteResourceOperationResponse.__init__` has a new overload `def __init__(self: None, description: str, type: str, location: str, results: Optional[List[_models.ResourceOperation]])` + - Method `DeleteResourceOperationResponse.__init__` has a new overload `def __init__(self: None, mapping: Mapping[str, Any])` + - Method `ExecuteCreateRequest.__init__` has a new overload `def __init__(self: None, resource_config_parameters: _models.ResourceProvisionPayload, execution_parameters: _models.ExecutionParameters, correlationid: Optional[str])` + - Method `ExecuteCreateRequest.__init__` has a new overload `def __init__(self: None, mapping: Mapping[str, Any])` + - Method `ExecuteDeleteRequest.__init__` has a new overload `def __init__(self: None, execution_parameters: _models.ExecutionParameters, resources: _models.Resources, correlationid: Optional[str], force_deletion: Optional[bool])` + - Method `ExecuteDeleteRequest.__init__` has a new overload `def __init__(self: None, mapping: Mapping[str, Any])` + - Method `ResourceProvisionPayload.__init__` has a new overload `def __init__(self: None, resource_count: int, base_profile: Optional[bytes], resource_overrides: Optional[List[bytes]], resource_prefix: Optional[str])` + - Method `ResourceProvisionPayload.__init__` has a new overload `def __init__(self: None, mapping: Mapping[str, Any])` + - Method `ScheduledActionsOperations.virtual_machines_execute_create` has a new overload `def virtual_machines_execute_create(self: None, locationparameter: str, request_body: ExecuteCreateRequest, content_type: str)` + - Method `ScheduledActionsOperations.virtual_machines_execute_create` has a new overload `def virtual_machines_execute_create(self: None, locationparameter: str, request_body: JSON, content_type: str)` + - Method `ScheduledActionsOperations.virtual_machines_execute_create` has a new overload `def virtual_machines_execute_create(self: None, locationparameter: str, request_body: IO[bytes], content_type: str)` + - Method `ScheduledActionsOperations.virtual_machines_execute_delete` has a new overload `def virtual_machines_execute_delete(self: None, locationparameter: str, request_body: ExecuteDeleteRequest, content_type: str)` + - Method `ScheduledActionsOperations.virtual_machines_execute_delete` has a new overload `def virtual_machines_execute_delete(self: None, locationparameter: str, request_body: JSON, content_type: str)` + - Method `ScheduledActionsOperations.virtual_machines_execute_delete` has a new overload `def virtual_machines_execute_delete(self: None, locationparameter: str, request_body: IO[bytes], content_type: str)` + ## 1.0.0 (2025-01-20) ### Features Added diff --git a/sdk/computeschedule/azure-mgmt-computeschedule/README.md b/sdk/computeschedule/azure-mgmt-computeschedule/README.md index e72b0056df7c..a94de05d4902 100644 --- a/sdk/computeschedule/azure-mgmt-computeschedule/README.md +++ b/sdk/computeschedule/azure-mgmt-computeschedule/README.md @@ -1,7 +1,7 @@ # Microsoft Azure SDK for Python This is the Microsoft Azure Computeschedule Management Client Library. -This package has been tested with Python 3.8+. +This package has been tested with Python 3.9+. For a more complete view of Azure libraries, see the [azure sdk python release](https://aka.ms/azsdk/python/all). ## _Disclaimer_ @@ -12,7 +12,7 @@ _Azure SDK Python packages support for Python 2.7 has ended 01 January 2022. For ### Prerequisites -- Python 3.8+ is required to use this package. +- Python 3.9+ is required to use this package. - [Azure subscription](https://azure.microsoft.com/free/) ### Install the package @@ -24,7 +24,7 @@ pip install azure-identity ### Authentication -By default, [Azure Active Directory](https://aka.ms/awps/aad) token authentication depends on correct configure of following environment variables. +By default, [Azure Active Directory](https://aka.ms/awps/aad) token authentication depends on correct configuration of the following environment variables. - `AZURE_CLIENT_ID` for Azure client ID. - `AZURE_TENANT_ID` for Azure tenant ID. diff --git a/sdk/computeschedule/azure-mgmt-computeschedule/_meta.json b/sdk/computeschedule/azure-mgmt-computeschedule/_meta.json index a6070dd43671..58856ef1ca79 100644 --- a/sdk/computeschedule/azure-mgmt-computeschedule/_meta.json +++ b/sdk/computeschedule/azure-mgmt-computeschedule/_meta.json @@ -1,6 +1,6 @@ { - "commit": "b6075dbc2321933382ea91c787ee62c6bdb87e5d", + "commit": "88d4bd5b8ba24d0a1ea4c1fdd0e19820201d242a", "repository_url": "https://github.com/Azure/azure-rest-api-specs", "typespec_src": "specification/computeschedule/ComputeSchedule.Management", - "@azure-tools/typespec-python": "0.37.3" + "@azure-tools/typespec-python": "0.44.2" } \ No newline at end of file diff --git a/sdk/computeschedule/azure-mgmt-computeschedule/apiview-properties.json b/sdk/computeschedule/azure-mgmt-computeschedule/apiview-properties.json new file mode 100644 index 000000000000..980169ced379 --- /dev/null +++ b/sdk/computeschedule/azure-mgmt-computeschedule/apiview-properties.json @@ -0,0 +1,69 @@ +{ + "CrossLanguagePackageId": "Microsoft.ComputeSchedule", + "CrossLanguageDefinitionId": { + "azure.mgmt.computeschedule.models.CancelOperationsRequest": "Microsoft.ComputeSchedule.CancelOperationsRequest", + "azure.mgmt.computeschedule.models.CancelOperationsResponse": "Microsoft.ComputeSchedule.CancelOperationsResponse", + "azure.mgmt.computeschedule.models.CreateResourceOperationResponse": "Microsoft.ComputeSchedule.CreateResourceOperationResponse", + "azure.mgmt.computeschedule.models.DeallocateResourceOperationResponse": "Microsoft.ComputeSchedule.DeallocateResourceOperationResponse", + "azure.mgmt.computeschedule.models.DeleteResourceOperationResponse": "Microsoft.ComputeSchedule.DeleteResourceOperationResponse", + "azure.mgmt.computeschedule.models.ErrorAdditionalInfo": "Azure.ResourceManager.CommonTypes.ErrorAdditionalInfo", + "azure.mgmt.computeschedule.models.ErrorDetail": "Azure.ResourceManager.CommonTypes.ErrorDetail", + "azure.mgmt.computeschedule.models.ErrorResponse": "Azure.ResourceManager.CommonTypes.ErrorResponse", + "azure.mgmt.computeschedule.models.ExecuteCreateRequest": "Microsoft.ComputeSchedule.ExecuteCreateRequest", + "azure.mgmt.computeschedule.models.ExecuteDeallocateRequest": "Microsoft.ComputeSchedule.ExecuteDeallocateRequest", + "azure.mgmt.computeschedule.models.ExecuteDeleteRequest": "Microsoft.ComputeSchedule.ExecuteDeleteRequest", + "azure.mgmt.computeschedule.models.ExecuteHibernateRequest": "Microsoft.ComputeSchedule.ExecuteHibernateRequest", + "azure.mgmt.computeschedule.models.ExecuteStartRequest": "Microsoft.ComputeSchedule.ExecuteStartRequest", + "azure.mgmt.computeschedule.models.ExecutionParameters": "Microsoft.ComputeSchedule.ExecutionParameters", + "azure.mgmt.computeschedule.models.GetOperationErrorsRequest": "Microsoft.ComputeSchedule.GetOperationErrorsRequest", + "azure.mgmt.computeschedule.models.GetOperationErrorsResponse": "Microsoft.ComputeSchedule.GetOperationErrorsResponse", + "azure.mgmt.computeschedule.models.GetOperationStatusRequest": "Microsoft.ComputeSchedule.GetOperationStatusRequest", + "azure.mgmt.computeschedule.models.GetOperationStatusResponse": "Microsoft.ComputeSchedule.GetOperationStatusResponse", + "azure.mgmt.computeschedule.models.HibernateResourceOperationResponse": "Microsoft.ComputeSchedule.HibernateResourceOperationResponse", + "azure.mgmt.computeschedule.models.Operation": "Azure.ResourceManager.CommonTypes.Operation", + "azure.mgmt.computeschedule.models.OperationDisplay": "Azure.ResourceManager.CommonTypes.OperationDisplay", + "azure.mgmt.computeschedule.models.OperationErrorDetails": "Microsoft.ComputeSchedule.OperationErrorDetails", + "azure.mgmt.computeschedule.models.OperationErrorsResult": "Microsoft.ComputeSchedule.OperationErrorsResult", + "azure.mgmt.computeschedule.models.ResourceOperation": "Microsoft.ComputeSchedule.ResourceOperation", + "azure.mgmt.computeschedule.models.ResourceOperationDetails": "Microsoft.ComputeSchedule.ResourceOperationDetails", + "azure.mgmt.computeschedule.models.ResourceOperationError": "Microsoft.ComputeSchedule.ResourceOperationError", + "azure.mgmt.computeschedule.models.ResourceProvisionPayload": "Microsoft.ComputeSchedule.ResourceProvisionPayload", + "azure.mgmt.computeschedule.models.Resources": "Microsoft.ComputeSchedule.Resources", + "azure.mgmt.computeschedule.models.RetryPolicy": "Microsoft.ComputeSchedule.RetryPolicy", + "azure.mgmt.computeschedule.models.Schedule": "Microsoft.ComputeSchedule.Schedule", + "azure.mgmt.computeschedule.models.StartResourceOperationResponse": "Microsoft.ComputeSchedule.StartResourceOperationResponse", + "azure.mgmt.computeschedule.models.SubmitDeallocateRequest": "Microsoft.ComputeSchedule.SubmitDeallocateRequest", + "azure.mgmt.computeschedule.models.SubmitHibernateRequest": "Microsoft.ComputeSchedule.SubmitHibernateRequest", + "azure.mgmt.computeschedule.models.SubmitStartRequest": "Microsoft.ComputeSchedule.SubmitStartRequest", + "azure.mgmt.computeschedule.models.Origin": "Azure.ResourceManager.CommonTypes.Origin", + "azure.mgmt.computeschedule.models.ActionType": "Azure.ResourceManager.CommonTypes.ActionType", + "azure.mgmt.computeschedule.models.ResourceOperationType": "Microsoft.ComputeSchedule.ResourceOperationType", + "azure.mgmt.computeschedule.models.DeadlineType": "Microsoft.ComputeSchedule.DeadlineType", + "azure.mgmt.computeschedule.models.OperationState": "Microsoft.ComputeSchedule.OperationState", + "azure.mgmt.computeschedule.models.OptimizationPreference": "Microsoft.ComputeSchedule.OptimizationPreference", + "azure.mgmt.computeschedule.operations.Operations.list": "Azure.ResourceManager.Operations.list", + "azure.mgmt.computeschedule.aio.operations.Operations.list": "Azure.ResourceManager.Operations.list", + "azure.mgmt.computeschedule.operations.ScheduledActionsOperations.virtual_machines_submit_deallocate": "Microsoft.ComputeSchedule.ScheduledActions.virtualMachinesSubmitDeallocate", + "azure.mgmt.computeschedule.aio.operations.ScheduledActionsOperations.virtual_machines_submit_deallocate": "Microsoft.ComputeSchedule.ScheduledActions.virtualMachinesSubmitDeallocate", + "azure.mgmt.computeschedule.operations.ScheduledActionsOperations.virtual_machines_submit_hibernate": "Microsoft.ComputeSchedule.ScheduledActions.virtualMachinesSubmitHibernate", + "azure.mgmt.computeschedule.aio.operations.ScheduledActionsOperations.virtual_machines_submit_hibernate": "Microsoft.ComputeSchedule.ScheduledActions.virtualMachinesSubmitHibernate", + "azure.mgmt.computeschedule.operations.ScheduledActionsOperations.virtual_machines_submit_start": "Microsoft.ComputeSchedule.ScheduledActions.virtualMachinesSubmitStart", + "azure.mgmt.computeschedule.aio.operations.ScheduledActionsOperations.virtual_machines_submit_start": "Microsoft.ComputeSchedule.ScheduledActions.virtualMachinesSubmitStart", + "azure.mgmt.computeschedule.operations.ScheduledActionsOperations.virtual_machines_execute_deallocate": "Microsoft.ComputeSchedule.ScheduledActions.virtualMachinesExecuteDeallocate", + "azure.mgmt.computeschedule.aio.operations.ScheduledActionsOperations.virtual_machines_execute_deallocate": "Microsoft.ComputeSchedule.ScheduledActions.virtualMachinesExecuteDeallocate", + "azure.mgmt.computeschedule.operations.ScheduledActionsOperations.virtual_machines_execute_hibernate": "Microsoft.ComputeSchedule.ScheduledActions.virtualMachinesExecuteHibernate", + "azure.mgmt.computeschedule.aio.operations.ScheduledActionsOperations.virtual_machines_execute_hibernate": "Microsoft.ComputeSchedule.ScheduledActions.virtualMachinesExecuteHibernate", + "azure.mgmt.computeschedule.operations.ScheduledActionsOperations.virtual_machines_execute_start": "Microsoft.ComputeSchedule.ScheduledActions.virtualMachinesExecuteStart", + "azure.mgmt.computeschedule.aio.operations.ScheduledActionsOperations.virtual_machines_execute_start": "Microsoft.ComputeSchedule.ScheduledActions.virtualMachinesExecuteStart", + "azure.mgmt.computeschedule.operations.ScheduledActionsOperations.virtual_machines_execute_create": "Microsoft.ComputeSchedule.ScheduledActions.virtualMachinesExecuteCreate", + "azure.mgmt.computeschedule.aio.operations.ScheduledActionsOperations.virtual_machines_execute_create": "Microsoft.ComputeSchedule.ScheduledActions.virtualMachinesExecuteCreate", + "azure.mgmt.computeschedule.operations.ScheduledActionsOperations.virtual_machines_execute_delete": "Microsoft.ComputeSchedule.ScheduledActions.virtualMachinesExecuteDelete", + "azure.mgmt.computeschedule.aio.operations.ScheduledActionsOperations.virtual_machines_execute_delete": "Microsoft.ComputeSchedule.ScheduledActions.virtualMachinesExecuteDelete", + "azure.mgmt.computeschedule.operations.ScheduledActionsOperations.virtual_machines_get_operation_status": "Microsoft.ComputeSchedule.ScheduledActions.virtualMachinesGetOperationStatus", + "azure.mgmt.computeschedule.aio.operations.ScheduledActionsOperations.virtual_machines_get_operation_status": "Microsoft.ComputeSchedule.ScheduledActions.virtualMachinesGetOperationStatus", + "azure.mgmt.computeschedule.operations.ScheduledActionsOperations.virtual_machines_cancel_operations": "Microsoft.ComputeSchedule.ScheduledActions.virtualMachinesCancelOperations", + "azure.mgmt.computeschedule.aio.operations.ScheduledActionsOperations.virtual_machines_cancel_operations": "Microsoft.ComputeSchedule.ScheduledActions.virtualMachinesCancelOperations", + "azure.mgmt.computeschedule.operations.ScheduledActionsOperations.virtual_machines_get_operation_errors": "Microsoft.ComputeSchedule.ScheduledActions.virtualMachinesGetOperationErrors", + "azure.mgmt.computeschedule.aio.operations.ScheduledActionsOperations.virtual_machines_get_operation_errors": "Microsoft.ComputeSchedule.ScheduledActions.virtualMachinesGetOperationErrors" + } +} \ No newline at end of file diff --git a/sdk/computeschedule/azure-mgmt-computeschedule/azure/mgmt/computeschedule/_client.py b/sdk/computeschedule/azure-mgmt-computeschedule/azure/mgmt/computeschedule/_client.py index 3847c339c628..77ee17cc6845 100644 --- a/sdk/computeschedule/azure-mgmt-computeschedule/azure/mgmt/computeschedule/_client.py +++ b/sdk/computeschedule/azure-mgmt-computeschedule/azure/mgmt/computeschedule/_client.py @@ -7,16 +7,18 @@ # -------------------------------------------------------------------------- from copy import deepcopy -from typing import Any, TYPE_CHECKING +from typing import Any, Optional, TYPE_CHECKING, cast from typing_extensions import Self from azure.core.pipeline import policies from azure.core.rest import HttpRequest, HttpResponse +from azure.core.settings import settings from azure.mgmt.core import ARMPipelineClient from azure.mgmt.core.policies import ARMAutoResourceProviderRegistrationPolicy +from azure.mgmt.core.tools import get_arm_endpoints from ._configuration import ComputeScheduleMgmtClientConfiguration -from ._serialization import Deserializer, Serializer +from ._utils.serialization import Deserializer, Serializer from .operations import Operations, ScheduledActionsOperations if TYPE_CHECKING: @@ -34,24 +36,30 @@ class ComputeScheduleMgmtClient: :type credential: ~azure.core.credentials.TokenCredential :param subscription_id: The ID of the target subscription. The value must be an UUID. Required. :type subscription_id: str - :param base_url: Service host. Default value is "https://management.azure.com". + :param base_url: Service host. Default value is None. :type base_url: str - :keyword api_version: The API version to use for this operation. Default value is "2024-10-01". + :keyword api_version: The API version to use for this operation. Default value is "2025-05-01". Note that overriding this default value may result in unsupported behavior. :paramtype api_version: str """ def __init__( - self, - credential: "TokenCredential", - subscription_id: str, - base_url: str = "https://management.azure.com", - **kwargs: Any + self, credential: "TokenCredential", subscription_id: str, base_url: Optional[str] = None, **kwargs: Any ) -> None: _endpoint = "{endpoint}" + _cloud = kwargs.pop("cloud_setting", None) or settings.current.azure_cloud # type: ignore + _endpoints = get_arm_endpoints(_cloud) + if not base_url: + base_url = _endpoints["resource_manager"] + credential_scopes = kwargs.pop("credential_scopes", _endpoints["credential_scopes"]) self._config = ComputeScheduleMgmtClientConfiguration( - credential=credential, subscription_id=subscription_id, base_url=base_url, **kwargs + credential=credential, + subscription_id=subscription_id, + base_url=cast(str, base_url), + credential_scopes=credential_scopes, + **kwargs ) + _policies = kwargs.pop("policies", None) if _policies is None: _policies = [ @@ -70,7 +78,7 @@ def __init__( policies.SensitiveHeaderCleanupPolicy(**kwargs) if self._config.redirect_policy else None, self._config.http_logging_policy, ] - self._client: ARMPipelineClient = ARMPipelineClient(base_url=_endpoint, policies=_policies, **kwargs) + self._client: ARMPipelineClient = ARMPipelineClient(base_url=cast(str, _endpoint), policies=_policies, **kwargs) self._serialize = Serializer() self._deserialize = Deserializer() diff --git a/sdk/computeschedule/azure-mgmt-computeschedule/azure/mgmt/computeschedule/_configuration.py b/sdk/computeschedule/azure-mgmt-computeschedule/azure/mgmt/computeschedule/_configuration.py index bc325d903761..c4c4960c4644 100644 --- a/sdk/computeschedule/azure-mgmt-computeschedule/azure/mgmt/computeschedule/_configuration.py +++ b/sdk/computeschedule/azure-mgmt-computeschedule/azure/mgmt/computeschedule/_configuration.py @@ -29,7 +29,7 @@ class ComputeScheduleMgmtClientConfiguration: # pylint: disable=too-many-instan :type subscription_id: str :param base_url: Service host. Default value is "https://management.azure.com". :type base_url: str - :keyword api_version: The API version to use for this operation. Default value is "2024-10-01". + :keyword api_version: The API version to use for this operation. Default value is "2025-05-01". Note that overriding this default value may result in unsupported behavior. :paramtype api_version: str """ @@ -41,7 +41,7 @@ def __init__( base_url: str = "https://management.azure.com", **kwargs: Any ) -> None: - api_version: str = kwargs.pop("api_version", "2024-10-01") + api_version: str = kwargs.pop("api_version", "2025-05-01") if credential is None: raise ValueError("Parameter 'credential' must not be None.") diff --git a/sdk/computeschedule/azure-mgmt-computeschedule/azure/mgmt/computeschedule/_patch.py b/sdk/computeschedule/azure-mgmt-computeschedule/azure/mgmt/computeschedule/_patch.py index f7dd32510333..8bcb627aa475 100644 --- a/sdk/computeschedule/azure-mgmt-computeschedule/azure/mgmt/computeschedule/_patch.py +++ b/sdk/computeschedule/azure-mgmt-computeschedule/azure/mgmt/computeschedule/_patch.py @@ -1,7 +1,8 @@ -# ------------------------------------ -# Copyright (c) Microsoft Corporation. -# Licensed under the MIT License. -# ------------------------------------ +# 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. +# -------------------------------------------------------------------------- """Customize generated code here. Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize diff --git a/sdk/computeschedule/azure-mgmt-computeschedule/azure/mgmt/computeschedule/_utils/__init__.py b/sdk/computeschedule/azure-mgmt-computeschedule/azure/mgmt/computeschedule/_utils/__init__.py new file mode 100644 index 000000000000..8026245c2abc --- /dev/null +++ b/sdk/computeschedule/azure-mgmt-computeschedule/azure/mgmt/computeschedule/_utils/__init__.py @@ -0,0 +1,6 @@ +# -------------------------------------------------------------------------- +# 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) Python Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- diff --git a/sdk/computeschedule/azure-mgmt-computeschedule/azure/mgmt/computeschedule/_model_base.py b/sdk/computeschedule/azure-mgmt-computeschedule/azure/mgmt/computeschedule/_utils/model_base.py similarity index 94% rename from sdk/computeschedule/azure-mgmt-computeschedule/azure/mgmt/computeschedule/_model_base.py rename to sdk/computeschedule/azure-mgmt-computeschedule/azure/mgmt/computeschedule/_utils/model_base.py index 7f73b97b23ef..49d5c7259389 100644 --- a/sdk/computeschedule/azure-mgmt-computeschedule/azure/mgmt/computeschedule/_model_base.py +++ b/sdk/computeschedule/azure-mgmt-computeschedule/azure/mgmt/computeschedule/_utils/model_base.py @@ -2,8 +2,9 @@ # 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. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) Python Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- # pylint: disable=protected-access, broad-except @@ -21,6 +22,7 @@ from datetime import datetime, date, time, timedelta, timezone from json import JSONEncoder import xml.etree.ElementTree as ET +from collections.abc import MutableMapping from typing_extensions import Self import isodate from azure.core.exceptions import DeserializationError @@ -28,11 +30,6 @@ from azure.core.pipeline import PipelineResponse from azure.core.serialization import _Null -if sys.version_info >= (3, 9): - from collections.abc import MutableMapping -else: - from typing import MutableMapping - _LOGGER = logging.getLogger(__name__) __all__ = ["SdkJSONEncoder", "Model", "rest_field", "rest_discriminator"] @@ -347,7 +344,7 @@ def _get_model(module_name: str, model_name: str): _UNSET = object() -class _MyMutableMapping(MutableMapping[str, typing.Any]): # pylint: disable=unsubscriptable-object +class _MyMutableMapping(MutableMapping[str, typing.Any]): def __init__(self, data: typing.Dict[str, typing.Any]) -> None: self._data = data @@ -373,50 +370,97 @@ def __ne__(self, other: typing.Any) -> bool: return not self.__eq__(other) def keys(self) -> typing.KeysView[str]: + """ + :returns: a set-like object providing a view on D's keys + :rtype: ~typing.KeysView + """ return self._data.keys() def values(self) -> typing.ValuesView[typing.Any]: + """ + :returns: an object providing a view on D's values + :rtype: ~typing.ValuesView + """ return self._data.values() def items(self) -> typing.ItemsView[str, typing.Any]: + """ + :returns: set-like object providing a view on D's items + :rtype: ~typing.ItemsView + """ return self._data.items() def get(self, key: str, default: typing.Any = None) -> typing.Any: + """ + Get the value for key if key is in the dictionary, else default. + :param str key: The key to look up. + :param any default: The value to return if key is not in the dictionary. Defaults to None + :returns: D[k] if k in D, else d. + :rtype: any + """ try: return self[key] except KeyError: return default @typing.overload - def pop(self, key: str) -> typing.Any: ... + def pop(self, key: str) -> typing.Any: ... # pylint: disable=arguments-differ @typing.overload - def pop(self, key: str, default: _T) -> _T: ... + def pop(self, key: str, default: _T) -> _T: ... # pylint: disable=signature-differs @typing.overload - def pop(self, key: str, default: typing.Any) -> typing.Any: ... + def pop(self, key: str, default: typing.Any) -> typing.Any: ... # pylint: disable=signature-differs def pop(self, key: str, default: typing.Any = _UNSET) -> typing.Any: + """ + Removes specified key and return the corresponding value. + :param str key: The key to pop. + :param any default: The value to return if key is not in the dictionary + :returns: The value corresponding to the key. + :rtype: any + :raises KeyError: If key is not found and default is not given. + """ if default is _UNSET: return self._data.pop(key) return self._data.pop(key, default) def popitem(self) -> typing.Tuple[str, typing.Any]: + """ + Removes and returns some (key, value) pair + :returns: The (key, value) pair. + :rtype: tuple + :raises KeyError: if D is empty. + """ return self._data.popitem() def clear(self) -> None: + """ + Remove all items from D. + """ self._data.clear() - def update(self, *args: typing.Any, **kwargs: typing.Any) -> None: + def update(self, *args: typing.Any, **kwargs: typing.Any) -> None: # pylint: disable=arguments-differ + """ + Updates D from mapping/iterable E and F. + :param any args: Either a mapping object or an iterable of key-value pairs. + """ self._data.update(*args, **kwargs) @typing.overload def setdefault(self, key: str, default: None = None) -> None: ... @typing.overload - def setdefault(self, key: str, default: typing.Any) -> typing.Any: ... + def setdefault(self, key: str, default: typing.Any) -> typing.Any: ... # pylint: disable=signature-differs def setdefault(self, key: str, default: typing.Any = _UNSET) -> typing.Any: + """ + Same as calling D.get(k, d), and setting D[k]=d if k not found + :param str key: The key to look up. + :param any default: The value to set if key is not in the dictionary + :returns: D[k] if k in D, else d. + :rtype: any + """ if default is _UNSET: return self._data.setdefault(key) return self._data.setdefault(key, default) @@ -597,7 +641,7 @@ def __new__(cls, *args: typing.Any, **kwargs: typing.Any) -> Self: cls._attr_to_rest_field: typing.Dict[str, _RestField] = dict(attr_to_rest_field.items()) cls._calculated.add(f"{cls.__module__}.{cls.__qualname__}") - return super().__new__(cls) # pylint: disable=no-value-for-parameter + return super().__new__(cls) def __init_subclass__(cls, discriminator: typing.Optional[str] = None) -> None: for base in cls.__bases__: @@ -633,7 +677,7 @@ def _deserialize(cls, data, exist_discriminators): discriminator_value = data.find(xml_name).text # pyright: ignore else: discriminator_value = data.get(discriminator._rest_name) - mapped_cls = cls.__mapping__.get(discriminator_value, cls) # pyright: ignore + mapped_cls = cls.__mapping__.get(discriminator_value, cls) # pyright: ignore # pylint: disable=no-member return mapped_cls._deserialize(data, exist_discriminators) def as_dict(self, *, exclude_readonly: bool = False) -> typing.Dict[str, typing.Any]: @@ -910,6 +954,19 @@ def _failsafe_deserialize( return None +def _failsafe_deserialize_xml( + deserializer: typing.Any, + value: typing.Any, +) -> typing.Any: + try: + return _deserialize_xml(deserializer, value) + except DeserializationError: + _LOGGER.warning( + "Ran into a deserialization error. Ignoring since this is failsafe deserialization", exc_info=True + ) + return None + + class _RestField: def __init__( self, diff --git a/sdk/computeschedule/azure-mgmt-computeschedule/azure/mgmt/computeschedule/_serialization.py b/sdk/computeschedule/azure-mgmt-computeschedule/azure/mgmt/computeschedule/_utils/serialization.py similarity index 94% rename from sdk/computeschedule/azure-mgmt-computeschedule/azure/mgmt/computeschedule/_serialization.py rename to sdk/computeschedule/azure-mgmt-computeschedule/azure/mgmt/computeschedule/_utils/serialization.py index b24ab2885450..eb86ea23c965 100644 --- a/sdk/computeschedule/azure-mgmt-computeschedule/azure/mgmt/computeschedule/_serialization.py +++ b/sdk/computeschedule/azure-mgmt-computeschedule/azure/mgmt/computeschedule/_utils/serialization.py @@ -1,28 +1,10 @@ -# pylint: disable=too-many-lines +# pylint: disable=line-too-long,useless-suppression,too-many-lines +# coding=utf-8 # -------------------------------------------------------------------------- -# # Copyright (c) Microsoft Corporation. All rights reserved. -# -# The MIT License (MIT) -# -# Permission is hereby granted, free of charge, to any person obtaining a copy -# of this software and associated documentation files (the ""Software""), to -# deal in the Software without restriction, including without limitation the -# rights to use, copy, modify, merge, publish, distribute, sublicense, and/or -# sell copies of the Software, and to permit persons to whom the Software is -# furnished to do so, subject to the following conditions: -# -# The above copyright notice and this permission notice shall be included in -# all copies or substantial portions of the Software. -# -# THE SOFTWARE IS PROVIDED *AS IS*, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING -# FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS -# IN THE SOFTWARE. -# +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) Python Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- # pyright: reportUnnecessaryTypeIgnoreComment=false @@ -48,9 +30,7 @@ IO, Mapping, Callable, - TypeVar, MutableMapping, - Type, List, ) @@ -61,13 +41,13 @@ import xml.etree.ElementTree as ET import isodate # type: ignore +from typing_extensions import Self from azure.core.exceptions import DeserializationError, SerializationError from azure.core.serialization import NULL as CoreNull _BOM = codecs.BOM_UTF8.decode(encoding="utf-8") -ModelType = TypeVar("ModelType", bound="Model") JSON = MutableMapping[str, Any] @@ -185,73 +165,7 @@ def deserialize_from_http_generics(cls, body_bytes: Optional[Union[AnyStr, IO]], except NameError: _long_type = int - -class UTC(datetime.tzinfo): - """Time Zone info for handling UTC""" - - def utcoffset(self, dt): - """UTF offset for UTC is 0. - - :param datetime.datetime dt: The datetime - :returns: The offset - :rtype: datetime.timedelta - """ - return datetime.timedelta(0) - - def tzname(self, dt): - """Timestamp representation. - - :param datetime.datetime dt: The datetime - :returns: The timestamp representation - :rtype: str - """ - return "Z" - - def dst(self, dt): - """No daylight saving for UTC. - - :param datetime.datetime dt: The datetime - :returns: The daylight saving time - :rtype: datetime.timedelta - """ - return datetime.timedelta(hours=1) - - -try: - from datetime import timezone as _FixedOffset # type: ignore -except ImportError: # Python 2.7 - - class _FixedOffset(datetime.tzinfo): # type: ignore - """Fixed offset in minutes east from UTC. - Copy/pasted from Python doc - :param datetime.timedelta offset: offset in timedelta format - """ - - def __init__(self, offset) -> None: - self.__offset = offset - - def utcoffset(self, dt): - return self.__offset - - def tzname(self, dt): - return str(self.__offset.total_seconds() / 3600) - - def __repr__(self): - return "".format(self.tzname(None)) - - def dst(self, dt): - return datetime.timedelta(0) - - def __getinitargs__(self): - return (self.__offset,) - - -try: - from datetime import timezone - - TZ_UTC = timezone.utc -except ImportError: - TZ_UTC = UTC() # type: ignore +TZ_UTC = datetime.timezone.utc _FLATTEN = re.compile(r"(? ModelType: + def deserialize(cls, data: Any, content_type: Optional[str] = None) -> Self: """Parse a str using the RestAPI syntax and return a model. :param str data: A str using RestAPI structure. JSON by default. :param str content_type: JSON by default, set application/xml if XML. :returns: An instance of this model - :raises: DeserializationError if something went wrong - :rtype: ModelType + :raises DeserializationError: if something went wrong + :rtype: Self """ deserializer = Deserializer(cls._infer_class_models()) return deserializer(cls.__name__, data, content_type=content_type) # type: ignore @classmethod def from_dict( - cls: Type[ModelType], + cls, data: Any, key_extractors: Optional[Callable[[str, Dict[str, Any], Any], Any]] = None, content_type: Optional[str] = None, - ) -> ModelType: + ) -> Self: """Parse a dict using given key extractor return a model. By default consider key @@ -479,8 +393,8 @@ def from_dict( :param function key_extractors: A key extractor function. :param str content_type: JSON by default, set application/xml if XML. :returns: An instance of this model - :raises: DeserializationError if something went wrong - :rtype: ModelType + :raises DeserializationError: if something went wrong + :rtype: Self """ deserializer = Deserializer(cls._infer_class_models()) deserializer.key_extractors = ( # type: ignore @@ -626,7 +540,7 @@ def _serialize( # pylint: disable=too-many-nested-blocks, too-many-branches, to :param object target_obj: The data to be serialized. :param str data_type: The type to be serialized from. :rtype: str, dict - :raises: SerializationError if serialization fails. + :raises SerializationError: if serialization fails. :returns: The serialized data. """ key_transformer = kwargs.get("key_transformer", self.key_transformer) @@ -736,8 +650,8 @@ def body(self, data, data_type, **kwargs): :param object data: The data to be serialized. :param str data_type: The type to be serialized from. :rtype: dict - :raises: SerializationError if serialization fails. - :raises: ValueError if data is None + :raises SerializationError: if serialization fails. + :raises ValueError: if data is None :returns: The serialized request body """ @@ -781,8 +695,8 @@ def url(self, name, data, data_type, **kwargs): :param str data_type: The type to be serialized from. :rtype: str :returns: The serialized URL path - :raises: TypeError if serialization fails. - :raises: ValueError if data is None + :raises TypeError: if serialization fails. + :raises ValueError: if data is None """ try: output = self.serialize_data(data, data_type, **kwargs) @@ -805,8 +719,8 @@ def query(self, name, data, data_type, **kwargs): :param object data: The data to be serialized. :param str data_type: The type to be serialized from. :rtype: str, list - :raises: TypeError if serialization fails. - :raises: ValueError if data is None + :raises TypeError: if serialization fails. + :raises ValueError: if data is None :returns: The serialized query parameter """ try: @@ -835,8 +749,8 @@ def header(self, name, data, data_type, **kwargs): :param object data: The data to be serialized. :param str data_type: The type to be serialized from. :rtype: str - :raises: TypeError if serialization fails. - :raises: ValueError if data is None + :raises TypeError: if serialization fails. + :raises ValueError: if data is None :returns: The serialized header """ try: @@ -855,9 +769,9 @@ def serialize_data(self, data, data_type, **kwargs): :param object data: The data to be serialized. :param str data_type: The type to be serialized from. - :raises: AttributeError if required data is None. - :raises: ValueError if data is None - :raises: SerializationError if serialization fails. + :raises AttributeError: if required data is None. + :raises ValueError: if data is None + :raises SerializationError: if serialization fails. :returns: The serialized data. :rtype: str, int, float, bool, dict, list """ @@ -1192,7 +1106,7 @@ def serialize_rfc(attr, **kwargs): # pylint: disable=unused-argument :param Datetime attr: Object to be serialized. :rtype: str - :raises: TypeError if format invalid. + :raises TypeError: if format invalid. :return: serialized rfc """ try: @@ -1218,7 +1132,7 @@ def serialize_iso(attr, **kwargs): # pylint: disable=unused-argument :param Datetime attr: Object to be serialized. :rtype: str - :raises: SerializationError if format invalid. + :raises SerializationError: if format invalid. :return: serialized iso """ if isinstance(attr, str): @@ -1251,7 +1165,7 @@ def serialize_unix(attr, **kwargs): # pylint: disable=unused-argument :param Datetime attr: Object to be serialized. :rtype: int - :raises: SerializationError if format invalid + :raises SerializationError: if format invalid :return: serialied unix """ if isinstance(attr, int): @@ -1429,7 +1343,7 @@ def xml_key_extractor(attr, attr_desc, data): # pylint: disable=unused-argument # Iter and wrapped, should have found one node only (the wrap one) if len(children) != 1: raise DeserializationError( - "Tried to deserialize an array not wrapped, and found several nodes '{}'. Maybe you should declare this array as wrapped?".format( # pylint: disable=line-too-long + "Tried to deserialize an array not wrapped, and found several nodes '{}'. Maybe you should declare this array as wrapped?".format( xml_name ) ) @@ -1488,7 +1402,7 @@ def __call__(self, target_obj, response_data, content_type=None): :param str target_obj: Target data type to deserialize to. :param requests.Response response_data: REST response object. :param str content_type: Swagger "produces" if available. - :raises: DeserializationError if deserialization fails. + :raises DeserializationError: if deserialization fails. :return: Deserialized object. :rtype: object """ @@ -1502,7 +1416,7 @@ def _deserialize(self, target_obj, data): # pylint: disable=inconsistent-return :param str target_obj: Target data type to deserialize to. :param object data: Object to deserialize. - :raises: DeserializationError if deserialization fails. + :raises DeserializationError: if deserialization fails. :return: Deserialized object. :rtype: object """ @@ -1717,7 +1631,7 @@ def deserialize_data(self, data, data_type): # pylint: disable=too-many-return- :param str data: The response string to be deserialized. :param str data_type: The type to deserialize to. - :raises: DeserializationError if deserialization fails. + :raises DeserializationError: if deserialization fails. :return: Deserialized object. :rtype: object """ @@ -1799,7 +1713,7 @@ def deserialize_object(self, attr, **kwargs): # pylint: disable=too-many-return :param dict attr: Dictionary to be deserialized. :return: Deserialized object. :rtype: dict - :raises: TypeError if non-builtin datatype encountered. + :raises TypeError: if non-builtin datatype encountered. """ if attr is None: return None @@ -1845,7 +1759,7 @@ def deserialize_basic(self, attr, data_type): # pylint: disable=too-many-return :param str data_type: deserialization data type. :return: Deserialized basic type. :rtype: str, int, float or bool - :raises: TypeError if string format is not valid. + :raises TypeError: if string format is not valid. """ # If we're here, data is supposed to be a basic type. # If it's still an XML node, take the text @@ -1936,7 +1850,7 @@ def deserialize_bytearray(attr): :param str attr: response string to be deserialized. :return: Deserialized bytearray :rtype: bytearray - :raises: TypeError if string format invalid. + :raises TypeError: if string format invalid. """ if isinstance(attr, ET.Element): attr = attr.text @@ -1949,7 +1863,7 @@ def deserialize_base64(attr): :param str attr: response string to be deserialized. :return: Deserialized base64 string :rtype: bytearray - :raises: TypeError if string format invalid. + :raises TypeError: if string format invalid. """ if isinstance(attr, ET.Element): attr = attr.text @@ -1964,7 +1878,7 @@ def deserialize_decimal(attr): :param str attr: response string to be deserialized. :return: Deserialized decimal - :raises: DeserializationError if string format invalid. + :raises DeserializationError: if string format invalid. :rtype: decimal """ if isinstance(attr, ET.Element): @@ -1982,7 +1896,7 @@ def deserialize_long(attr): :param str attr: response string to be deserialized. :return: Deserialized int :rtype: long or int - :raises: ValueError if string format invalid. + :raises ValueError: if string format invalid. """ if isinstance(attr, ET.Element): attr = attr.text @@ -1995,7 +1909,7 @@ def deserialize_duration(attr): :param str attr: response string to be deserialized. :return: Deserialized duration :rtype: TimeDelta - :raises: DeserializationError if string format invalid. + :raises DeserializationError: if string format invalid. """ if isinstance(attr, ET.Element): attr = attr.text @@ -2013,7 +1927,7 @@ def deserialize_date(attr): :param str attr: response string to be deserialized. :return: Deserialized date :rtype: Date - :raises: DeserializationError if string format invalid. + :raises DeserializationError: if string format invalid. """ if isinstance(attr, ET.Element): attr = attr.text @@ -2029,7 +1943,7 @@ def deserialize_time(attr): :param str attr: response string to be deserialized. :return: Deserialized time :rtype: datetime.time - :raises: DeserializationError if string format invalid. + :raises DeserializationError: if string format invalid. """ if isinstance(attr, ET.Element): attr = attr.text @@ -2044,14 +1958,14 @@ def deserialize_rfc(attr): :param str attr: response string to be deserialized. :return: Deserialized RFC datetime :rtype: Datetime - :raises: DeserializationError if string format invalid. + :raises DeserializationError: if string format invalid. """ if isinstance(attr, ET.Element): attr = attr.text try: parsed_date = email.utils.parsedate_tz(attr) # type: ignore date_obj = datetime.datetime( - *parsed_date[:6], tzinfo=_FixedOffset(datetime.timedelta(minutes=(parsed_date[9] or 0) / 60)) + *parsed_date[:6], tzinfo=datetime.timezone(datetime.timedelta(minutes=(parsed_date[9] or 0) / 60)) ) if not date_obj.tzinfo: date_obj = date_obj.astimezone(tz=TZ_UTC) @@ -2067,7 +1981,7 @@ def deserialize_iso(attr): :param str attr: response string to be deserialized. :return: Deserialized ISO datetime :rtype: Datetime - :raises: DeserializationError if string format invalid. + :raises DeserializationError: if string format invalid. """ if isinstance(attr, ET.Element): attr = attr.text @@ -2105,7 +2019,7 @@ def deserialize_unix(attr): :param int attr: Object to be serialized. :return: Deserialized datetime :rtype: Datetime - :raises: DeserializationError if format invalid + :raises DeserializationError: if format invalid """ if isinstance(attr, ET.Element): attr = int(attr.text) # type: ignore diff --git a/sdk/computeschedule/azure-mgmt-computeschedule/azure/mgmt/computeschedule/_validation.py b/sdk/computeschedule/azure-mgmt-computeschedule/azure/mgmt/computeschedule/_validation.py new file mode 100644 index 000000000000..752b2822f9d3 --- /dev/null +++ b/sdk/computeschedule/azure-mgmt-computeschedule/azure/mgmt/computeschedule/_validation.py @@ -0,0 +1,50 @@ +# -------------------------------------------------------------------------- +# 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) Python Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +import functools + + +def api_version_validation(**kwargs): + params_added_on = kwargs.pop("params_added_on", {}) + method_added_on = kwargs.pop("method_added_on", "") + + def decorator(func): + @functools.wraps(func) + def wrapper(*args, **kwargs): + try: + # this assumes the client has an _api_version attribute + client = args[0] + client_api_version = client._config.api_version # pylint: disable=protected-access + except AttributeError: + return func(*args, **kwargs) + + if method_added_on > client_api_version: + raise ValueError( + f"'{func.__name__}' is not available in API version " + f"{client_api_version}. Pass service API version {method_added_on} or newer to your client." + ) + + unsupported = { + parameter: api_version + for api_version, parameters in params_added_on.items() + for parameter in parameters + if parameter in kwargs and api_version > client_api_version + } + if unsupported: + raise ValueError( + "".join( + [ + f"'{param}' is not available in API version {client_api_version}. " + f"Use service API version {version} or newer.\n" + for param, version in unsupported.items() + ] + ) + ) + return func(*args, **kwargs) + + return wrapper + + return decorator diff --git a/sdk/computeschedule/azure-mgmt-computeschedule/azure/mgmt/computeschedule/_version.py b/sdk/computeschedule/azure-mgmt-computeschedule/azure/mgmt/computeschedule/_version.py index 0ec13ea52bbf..ed0855dea5e6 100644 --- a/sdk/computeschedule/azure-mgmt-computeschedule/azure/mgmt/computeschedule/_version.py +++ b/sdk/computeschedule/azure-mgmt-computeschedule/azure/mgmt/computeschedule/_version.py @@ -6,4 +6,4 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -VERSION = "1.0.0" +VERSION = "1.1.0" diff --git a/sdk/computeschedule/azure-mgmt-computeschedule/azure/mgmt/computeschedule/aio/_client.py b/sdk/computeschedule/azure-mgmt-computeschedule/azure/mgmt/computeschedule/aio/_client.py index e26f96eccb14..dbe1ecb8c65e 100644 --- a/sdk/computeschedule/azure-mgmt-computeschedule/azure/mgmt/computeschedule/aio/_client.py +++ b/sdk/computeschedule/azure-mgmt-computeschedule/azure/mgmt/computeschedule/aio/_client.py @@ -7,15 +7,17 @@ # -------------------------------------------------------------------------- from copy import deepcopy -from typing import Any, Awaitable, TYPE_CHECKING +from typing import Any, Awaitable, Optional, TYPE_CHECKING, cast from typing_extensions import Self from azure.core.pipeline import policies from azure.core.rest import AsyncHttpResponse, HttpRequest +from azure.core.settings import settings from azure.mgmt.core import AsyncARMPipelineClient from azure.mgmt.core.policies import AsyncARMAutoResourceProviderRegistrationPolicy +from azure.mgmt.core.tools import get_arm_endpoints -from .._serialization import Deserializer, Serializer +from .._utils.serialization import Deserializer, Serializer from ._configuration import ComputeScheduleMgmtClientConfiguration from .operations import Operations, ScheduledActionsOperations @@ -35,24 +37,30 @@ class ComputeScheduleMgmtClient: :type credential: ~azure.core.credentials_async.AsyncTokenCredential :param subscription_id: The ID of the target subscription. The value must be an UUID. Required. :type subscription_id: str - :param base_url: Service host. Default value is "https://management.azure.com". + :param base_url: Service host. Default value is None. :type base_url: str - :keyword api_version: The API version to use for this operation. Default value is "2024-10-01". + :keyword api_version: The API version to use for this operation. Default value is "2025-05-01". Note that overriding this default value may result in unsupported behavior. :paramtype api_version: str """ def __init__( - self, - credential: "AsyncTokenCredential", - subscription_id: str, - base_url: str = "https://management.azure.com", - **kwargs: Any + self, credential: "AsyncTokenCredential", subscription_id: str, base_url: Optional[str] = None, **kwargs: Any ) -> None: _endpoint = "{endpoint}" + _cloud = kwargs.pop("cloud_setting", None) or settings.current.azure_cloud # type: ignore + _endpoints = get_arm_endpoints(_cloud) + if not base_url: + base_url = _endpoints["resource_manager"] + credential_scopes = kwargs.pop("credential_scopes", _endpoints["credential_scopes"]) self._config = ComputeScheduleMgmtClientConfiguration( - credential=credential, subscription_id=subscription_id, base_url=base_url, **kwargs + credential=credential, + subscription_id=subscription_id, + base_url=cast(str, base_url), + credential_scopes=credential_scopes, + **kwargs ) + _policies = kwargs.pop("policies", None) if _policies is None: _policies = [ @@ -71,7 +79,9 @@ def __init__( policies.SensitiveHeaderCleanupPolicy(**kwargs) if self._config.redirect_policy else None, self._config.http_logging_policy, ] - self._client: AsyncARMPipelineClient = AsyncARMPipelineClient(base_url=_endpoint, policies=_policies, **kwargs) + self._client: AsyncARMPipelineClient = AsyncARMPipelineClient( + base_url=cast(str, _endpoint), policies=_policies, **kwargs + ) self._serialize = Serializer() self._deserialize = Deserializer() diff --git a/sdk/computeschedule/azure-mgmt-computeschedule/azure/mgmt/computeschedule/aio/_configuration.py b/sdk/computeschedule/azure-mgmt-computeschedule/azure/mgmt/computeschedule/aio/_configuration.py index 8518e2689031..b5c947c4358a 100644 --- a/sdk/computeschedule/azure-mgmt-computeschedule/azure/mgmt/computeschedule/aio/_configuration.py +++ b/sdk/computeschedule/azure-mgmt-computeschedule/azure/mgmt/computeschedule/aio/_configuration.py @@ -29,7 +29,7 @@ class ComputeScheduleMgmtClientConfiguration: # pylint: disable=too-many-instan :type subscription_id: str :param base_url: Service host. Default value is "https://management.azure.com". :type base_url: str - :keyword api_version: The API version to use for this operation. Default value is "2024-10-01". + :keyword api_version: The API version to use for this operation. Default value is "2025-05-01". Note that overriding this default value may result in unsupported behavior. :paramtype api_version: str """ @@ -41,7 +41,7 @@ def __init__( base_url: str = "https://management.azure.com", **kwargs: Any ) -> None: - api_version: str = kwargs.pop("api_version", "2024-10-01") + api_version: str = kwargs.pop("api_version", "2025-05-01") if credential is None: raise ValueError("Parameter 'credential' must not be None.") diff --git a/sdk/computeschedule/azure-mgmt-computeschedule/azure/mgmt/computeschedule/aio/_patch.py b/sdk/computeschedule/azure-mgmt-computeschedule/azure/mgmt/computeschedule/aio/_patch.py index f7dd32510333..8bcb627aa475 100644 --- a/sdk/computeschedule/azure-mgmt-computeschedule/azure/mgmt/computeschedule/aio/_patch.py +++ b/sdk/computeschedule/azure-mgmt-computeschedule/azure/mgmt/computeschedule/aio/_patch.py @@ -1,7 +1,8 @@ -# ------------------------------------ -# Copyright (c) Microsoft Corporation. -# Licensed under the MIT License. -# ------------------------------------ +# 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. +# -------------------------------------------------------------------------- """Customize generated code here. Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize diff --git a/sdk/computeschedule/azure-mgmt-computeschedule/azure/mgmt/computeschedule/aio/operations/_operations.py b/sdk/computeschedule/azure-mgmt-computeschedule/azure/mgmt/computeschedule/aio/operations/_operations.py index 7408944cf3a3..03e8428c9d1d 100644 --- a/sdk/computeschedule/azure-mgmt-computeschedule/azure/mgmt/computeschedule/aio/operations/_operations.py +++ b/sdk/computeschedule/azure-mgmt-computeschedule/azure/mgmt/computeschedule/aio/operations/_operations.py @@ -6,12 +6,13 @@ # Code generated by Microsoft (R) Python Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +from collections.abc import MutableMapping from io import IOBase import json -import sys from typing import Any, AsyncIterable, Callable, Dict, IO, List, Optional, TypeVar, Union, overload import urllib.parse +from azure.core import AsyncPipelineClient from azure.core.async_paging import AsyncItemPaged, AsyncList from azure.core.exceptions import ( ClientAuthenticationError, @@ -31,11 +32,15 @@ from azure.mgmt.core.exceptions import ARMErrorFormat from ... import models as _models -from ..._model_base import SdkJSONEncoder, _deserialize, _failsafe_deserialize +from ..._utils.model_base import SdkJSONEncoder, _deserialize, _failsafe_deserialize +from ..._utils.serialization import Deserializer, Serializer +from ..._validation import api_version_validation from ...operations._operations import ( build_operations_list_request, build_scheduled_actions_virtual_machines_cancel_operations_request, + build_scheduled_actions_virtual_machines_execute_create_request, build_scheduled_actions_virtual_machines_execute_deallocate_request, + build_scheduled_actions_virtual_machines_execute_delete_request, build_scheduled_actions_virtual_machines_execute_hibernate_request, build_scheduled_actions_virtual_machines_execute_start_request, build_scheduled_actions_virtual_machines_get_operation_errors_request, @@ -44,14 +49,11 @@ build_scheduled_actions_virtual_machines_submit_hibernate_request, build_scheduled_actions_virtual_machines_submit_start_request, ) +from .._configuration import ComputeScheduleMgmtClientConfiguration -if sys.version_info >= (3, 9): - from collections.abc import MutableMapping -else: - from typing import MutableMapping # type: ignore T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] -JSON = MutableMapping[str, Any] # pylint: disable=unsubscriptable-object +JSON = MutableMapping[str, Any] class Operations: @@ -66,10 +68,10 @@ class Operations: 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") + self._client: AsyncPipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") + self._config: ComputeScheduleMgmtClientConfiguration = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") @distributed_trace def list(self, **kwargs: Any) -> AsyncIterable["_models.Operation"]: @@ -131,7 +133,7 @@ def prepare_request(next_link=None): async def extract_data(pipeline_response): deserialized = pipeline_response.http_response.json() - list_of_elem = _deserialize(List[_models.Operation], deserialized["value"]) + list_of_elem = _deserialize(List[_models.Operation], deserialized.get("value", [])) if cls: list_of_elem = cls(list_of_elem) # type: ignore return deserialized.get("nextLink") or None, AsyncList(list_of_elem) @@ -167,10 +169,10 @@ class ScheduledActionsOperations: 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") + self._client: AsyncPipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") + self._config: ComputeScheduleMgmtClientConfiguration = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") @overload async def virtual_machines_submit_deallocate( @@ -1052,6 +1054,308 @@ async def virtual_machines_execute_start( return deserialized # type: ignore + @overload + async def virtual_machines_execute_create( + self, + locationparameter: str, + request_body: _models.ExecuteCreateRequest, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.CreateResourceOperationResponse: + """VirtualMachinesExecuteCreate: Execute create operation for a batch of virtual machines, this + operation is triggered as soon as Computeschedule receives it. + + :param locationparameter: The location name. Required. + :type locationparameter: str + :param request_body: The request body. Required. + :type request_body: ~azure.mgmt.computeschedule.models.ExecuteCreateRequest + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: CreateResourceOperationResponse. The CreateResourceOperationResponse is compatible + with MutableMapping + :rtype: ~azure.mgmt.computeschedule.models.CreateResourceOperationResponse + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def virtual_machines_execute_create( + self, locationparameter: str, request_body: JSON, *, content_type: str = "application/json", **kwargs: Any + ) -> _models.CreateResourceOperationResponse: + """VirtualMachinesExecuteCreate: Execute create operation for a batch of virtual machines, this + operation is triggered as soon as Computeschedule receives it. + + :param locationparameter: The location name. Required. + :type locationparameter: str + :param request_body: The request body. Required. + :type request_body: JSON + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: CreateResourceOperationResponse. The CreateResourceOperationResponse is compatible + with MutableMapping + :rtype: ~azure.mgmt.computeschedule.models.CreateResourceOperationResponse + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def virtual_machines_execute_create( + self, locationparameter: str, request_body: IO[bytes], *, content_type: str = "application/json", **kwargs: Any + ) -> _models.CreateResourceOperationResponse: + """VirtualMachinesExecuteCreate: Execute create operation for a batch of virtual machines, this + operation is triggered as soon as Computeschedule receives it. + + :param locationparameter: The location name. Required. + :type locationparameter: str + :param request_body: The request body. Required. + :type request_body: IO[bytes] + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :return: CreateResourceOperationResponse. The CreateResourceOperationResponse is compatible + with MutableMapping + :rtype: ~azure.mgmt.computeschedule.models.CreateResourceOperationResponse + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace_async + @api_version_validation( + method_added_on="2025-05-01", + params_added_on={ + "2025-05-01": ["api_version", "subscription_id", "locationparameter", "content_type", "accept"] + }, + ) + async def virtual_machines_execute_create( + self, locationparameter: str, request_body: Union[_models.ExecuteCreateRequest, JSON, IO[bytes]], **kwargs: Any + ) -> _models.CreateResourceOperationResponse: + """VirtualMachinesExecuteCreate: Execute create operation for a batch of virtual machines, this + operation is triggered as soon as Computeschedule receives it. + + :param locationparameter: The location name. Required. + :type locationparameter: str + :param request_body: The request body. Is one of the following types: ExecuteCreateRequest, + JSON, IO[bytes] Required. + :type request_body: ~azure.mgmt.computeschedule.models.ExecuteCreateRequest or JSON or + IO[bytes] + :return: CreateResourceOperationResponse. The CreateResourceOperationResponse is compatible + with MutableMapping + :rtype: ~azure.mgmt.computeschedule.models.CreateResourceOperationResponse + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = kwargs.pop("params", {}) or {} + + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.CreateResourceOperationResponse] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _content = None + if isinstance(request_body, (IOBase, bytes)): + _content = request_body + else: + _content = json.dumps(request_body, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore + + _request = build_scheduled_actions_virtual_machines_execute_create_request( + locationparameter=locationparameter, + subscription_id=self._config.subscription_id, + content_type=content_type, + api_version=self._config.api_version, + content=_content, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _stream = kwargs.pop("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]: + if _stream: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize(_models.ErrorResponse, response.json()) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if _stream: + deserialized = response.iter_bytes() + else: + deserialized = _deserialize(_models.CreateResourceOperationResponse, response.json()) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + @overload + async def virtual_machines_execute_delete( + self, + locationparameter: str, + request_body: _models.ExecuteDeleteRequest, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.DeleteResourceOperationResponse: + """VirtualMachinesExecuteDelete: Execute delete operation for a batch of virtual machines, this + operation is triggered as soon as Computeschedule receives it. + + :param locationparameter: The location name. Required. + :type locationparameter: str + :param request_body: The request body. Required. + :type request_body: ~azure.mgmt.computeschedule.models.ExecuteDeleteRequest + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: DeleteResourceOperationResponse. The DeleteResourceOperationResponse is compatible + with MutableMapping + :rtype: ~azure.mgmt.computeschedule.models.DeleteResourceOperationResponse + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def virtual_machines_execute_delete( + self, locationparameter: str, request_body: JSON, *, content_type: str = "application/json", **kwargs: Any + ) -> _models.DeleteResourceOperationResponse: + """VirtualMachinesExecuteDelete: Execute delete operation for a batch of virtual machines, this + operation is triggered as soon as Computeschedule receives it. + + :param locationparameter: The location name. Required. + :type locationparameter: str + :param request_body: The request body. Required. + :type request_body: JSON + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: DeleteResourceOperationResponse. The DeleteResourceOperationResponse is compatible + with MutableMapping + :rtype: ~azure.mgmt.computeschedule.models.DeleteResourceOperationResponse + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def virtual_machines_execute_delete( + self, locationparameter: str, request_body: IO[bytes], *, content_type: str = "application/json", **kwargs: Any + ) -> _models.DeleteResourceOperationResponse: + """VirtualMachinesExecuteDelete: Execute delete operation for a batch of virtual machines, this + operation is triggered as soon as Computeschedule receives it. + + :param locationparameter: The location name. Required. + :type locationparameter: str + :param request_body: The request body. Required. + :type request_body: IO[bytes] + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :return: DeleteResourceOperationResponse. The DeleteResourceOperationResponse is compatible + with MutableMapping + :rtype: ~azure.mgmt.computeschedule.models.DeleteResourceOperationResponse + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace_async + @api_version_validation( + method_added_on="2025-05-01", + params_added_on={ + "2025-05-01": ["api_version", "subscription_id", "locationparameter", "content_type", "accept"] + }, + ) + async def virtual_machines_execute_delete( + self, locationparameter: str, request_body: Union[_models.ExecuteDeleteRequest, JSON, IO[bytes]], **kwargs: Any + ) -> _models.DeleteResourceOperationResponse: + """VirtualMachinesExecuteDelete: Execute delete operation for a batch of virtual machines, this + operation is triggered as soon as Computeschedule receives it. + + :param locationparameter: The location name. Required. + :type locationparameter: str + :param request_body: The request body. Is one of the following types: ExecuteDeleteRequest, + JSON, IO[bytes] Required. + :type request_body: ~azure.mgmt.computeschedule.models.ExecuteDeleteRequest or JSON or + IO[bytes] + :return: DeleteResourceOperationResponse. The DeleteResourceOperationResponse is compatible + with MutableMapping + :rtype: ~azure.mgmt.computeschedule.models.DeleteResourceOperationResponse + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = kwargs.pop("params", {}) or {} + + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.DeleteResourceOperationResponse] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _content = None + if isinstance(request_body, (IOBase, bytes)): + _content = request_body + else: + _content = json.dumps(request_body, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore + + _request = build_scheduled_actions_virtual_machines_execute_delete_request( + locationparameter=locationparameter, + subscription_id=self._config.subscription_id, + content_type=content_type, + api_version=self._config.api_version, + content=_content, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _stream = kwargs.pop("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]: + if _stream: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize(_models.ErrorResponse, response.json()) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if _stream: + deserialized = response.iter_bytes() + else: + deserialized = _deserialize(_models.DeleteResourceOperationResponse, response.json()) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + @overload async def virtual_machines_get_operation_status( self, diff --git a/sdk/computeschedule/azure-mgmt-computeschedule/azure/mgmt/computeschedule/aio/operations/_patch.py b/sdk/computeschedule/azure-mgmt-computeschedule/azure/mgmt/computeschedule/aio/operations/_patch.py index f7dd32510333..8bcb627aa475 100644 --- a/sdk/computeschedule/azure-mgmt-computeschedule/azure/mgmt/computeschedule/aio/operations/_patch.py +++ b/sdk/computeschedule/azure-mgmt-computeschedule/azure/mgmt/computeschedule/aio/operations/_patch.py @@ -1,7 +1,8 @@ -# ------------------------------------ -# Copyright (c) Microsoft Corporation. -# Licensed under the MIT License. -# ------------------------------------ +# 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. +# -------------------------------------------------------------------------- """Customize generated code here. Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize diff --git a/sdk/computeschedule/azure-mgmt-computeschedule/azure/mgmt/computeschedule/models/__init__.py b/sdk/computeschedule/azure-mgmt-computeschedule/azure/mgmt/computeschedule/models/__init__.py index 9db04f67ddae..2cd76795defa 100644 --- a/sdk/computeschedule/azure-mgmt-computeschedule/azure/mgmt/computeschedule/models/__init__.py +++ b/sdk/computeschedule/azure-mgmt-computeschedule/azure/mgmt/computeschedule/models/__init__.py @@ -16,11 +16,15 @@ from ._models import ( # type: ignore CancelOperationsRequest, CancelOperationsResponse, + CreateResourceOperationResponse, DeallocateResourceOperationResponse, + DeleteResourceOperationResponse, ErrorAdditionalInfo, ErrorDetail, ErrorResponse, + ExecuteCreateRequest, ExecuteDeallocateRequest, + ExecuteDeleteRequest, ExecuteHibernateRequest, ExecuteStartRequest, ExecutionParameters, @@ -36,6 +40,7 @@ ResourceOperation, ResourceOperationDetails, ResourceOperationError, + ResourceProvisionPayload, Resources, RetryPolicy, Schedule, @@ -60,11 +65,15 @@ __all__ = [ "CancelOperationsRequest", "CancelOperationsResponse", + "CreateResourceOperationResponse", "DeallocateResourceOperationResponse", + "DeleteResourceOperationResponse", "ErrorAdditionalInfo", "ErrorDetail", "ErrorResponse", + "ExecuteCreateRequest", "ExecuteDeallocateRequest", + "ExecuteDeleteRequest", "ExecuteHibernateRequest", "ExecuteStartRequest", "ExecutionParameters", @@ -80,6 +89,7 @@ "ResourceOperation", "ResourceOperationDetails", "ResourceOperationError", + "ResourceProvisionPayload", "Resources", "RetryPolicy", "Schedule", diff --git a/sdk/computeschedule/azure-mgmt-computeschedule/azure/mgmt/computeschedule/models/_models.py b/sdk/computeschedule/azure-mgmt-computeschedule/azure/mgmt/computeschedule/models/_models.py index 8524abc67d85..bb606b530853 100644 --- a/sdk/computeschedule/azure-mgmt-computeschedule/azure/mgmt/computeschedule/models/_models.py +++ b/sdk/computeschedule/azure-mgmt-computeschedule/azure/mgmt/computeschedule/models/_models.py @@ -11,27 +11,26 @@ import datetime from typing import Any, List, Mapping, Optional, TYPE_CHECKING, Union, overload -from .. import _model_base -from .._model_base import rest_field +from .._utils.model_base import Model as _Model, rest_field if TYPE_CHECKING: from .. import models as _models -class CancelOperationsRequest(_model_base.Model): +class CancelOperationsRequest(_Model): """This is the request to cancel running operations in scheduled actions using the operation ids. - All required parameters must be populated in order to send to server. - :ivar operation_ids: The list of operation ids to cancel operations on. Required. :vartype operation_ids: list[str] :ivar correlationid: CorrelationId item. Required. :vartype correlationid: str """ - operation_ids: List[str] = rest_field(name="operationIds") + operation_ids: List[str] = rest_field( + name="operationIds", visibility=["read", "create", "update", "delete", "query"] + ) """The list of operation ids to cancel operations on. Required.""" - correlationid: str = rest_field() + correlationid: str = rest_field(visibility=["read", "create", "update", "delete", "query"]) """CorrelationId item. Required.""" @overload @@ -53,15 +52,14 @@ def __init__(self, *args: Any, **kwargs: Any) -> None: super().__init__(*args, **kwargs) -class CancelOperationsResponse(_model_base.Model): +class CancelOperationsResponse(_Model): """This is the response from a cancel operations request. - :ivar results: An array of resource operations that were successfully cancelled. Required. :vartype results: list[~azure.mgmt.computeschedule.models.ResourceOperation] """ - results: List["_models.ResourceOperation"] = rest_field() + results: List["_models.ResourceOperation"] = rest_field(visibility=["read", "create", "update", "delete", "query"]) """An array of resource operations that were successfully cancelled. Required.""" @overload @@ -82,9 +80,53 @@ def __init__(self, *args: Any, **kwargs: Any) -> None: super().__init__(*args, **kwargs) -class DeallocateResourceOperationResponse(_model_base.Model): - """The response from a deallocate request. +class CreateResourceOperationResponse(_Model): + """The response from a create request. + :ivar description: The description of the operation response. Required. + :vartype description: str + :ivar type: The type of resources used in the create request eg virtual machines. Required. + :vartype type: str + :ivar location: The location of the start request eg westus. Required. + :vartype location: str + :ivar results: The results from the start request if no errors exist. + :vartype results: list[~azure.mgmt.computeschedule.models.ResourceOperation] + """ + + description: str = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """The description of the operation response. Required.""" + type: str = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """The type of resources used in the create request eg virtual machines. Required.""" + location: str = rest_field(visibility=["read", "create"]) + """The location of the start request eg westus. Required.""" + results: Optional[List["_models.ResourceOperation"]] = rest_field( + visibility=["read", "create", "update", "delete", "query"] + ) + """The results from the start request if no errors exist.""" + + @overload + def __init__( + self, + *, + description: str, + type: str, + location: str, + results: Optional[List["_models.ResourceOperation"]] = None, + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + super().__init__(*args, **kwargs) + + +class DeallocateResourceOperationResponse(_Model): + """The response from a deallocate request. :ivar description: The description of the operation response. Required. :vartype description: str @@ -96,13 +138,15 @@ class DeallocateResourceOperationResponse(_model_base.Model): :vartype results: list[~azure.mgmt.computeschedule.models.ResourceOperation] """ - description: str = rest_field() + description: str = rest_field(visibility=["read", "create", "update", "delete", "query"]) """The description of the operation response. Required.""" - type: str = rest_field() + type: str = rest_field(visibility=["read", "create", "update", "delete", "query"]) """The type of resources used in the deallocate request eg virtual machines. Required.""" location: str = rest_field(visibility=["read", "create"]) """The location of the deallocate request eg westus. Required.""" - results: Optional[List["_models.ResourceOperation"]] = rest_field() + results: Optional[List["_models.ResourceOperation"]] = rest_field( + visibility=["read", "create", "update", "delete", "query"] + ) """The results from the deallocate request if no errors exist.""" @overload @@ -126,10 +170,53 @@ def __init__(self, *args: Any, **kwargs: Any) -> None: super().__init__(*args, **kwargs) -class ErrorAdditionalInfo(_model_base.Model): - """The resource management error additional info. +class DeleteResourceOperationResponse(_Model): + """The response from a delete request. - Readonly variables are only populated by the server, and will be ignored when sending a request. + :ivar description: The description of the operation response. Required. + :vartype description: str + :ivar type: The type of resources used in the delete request eg virtual machines. Required. + :vartype type: str + :ivar location: The location of the start request eg westus. Required. + :vartype location: str + :ivar results: The results from the start request if no errors exist. + :vartype results: list[~azure.mgmt.computeschedule.models.ResourceOperation] + """ + + description: str = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """The description of the operation response. Required.""" + type: str = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """The type of resources used in the delete request eg virtual machines. Required.""" + location: str = rest_field(visibility=["read", "create"]) + """The location of the start request eg westus. Required.""" + results: Optional[List["_models.ResourceOperation"]] = rest_field( + visibility=["read", "create", "update", "delete", "query"] + ) + """The results from the start request if no errors exist.""" + + @overload + def __init__( + self, + *, + description: str, + type: str, + location: str, + results: Optional[List["_models.ResourceOperation"]] = None, + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + super().__init__(*args, **kwargs) + + +class ErrorAdditionalInfo(_Model): + """The resource management error additional info. :ivar type: The additional info type. :vartype type: str @@ -143,11 +230,9 @@ class ErrorAdditionalInfo(_model_base.Model): """The additional info.""" -class ErrorDetail(_model_base.Model): +class ErrorDetail(_Model): """The error detail. - Readonly variables are only populated by the server, and will be ignored when sending a request. - :ivar code: The error code. :vartype code: str :ivar message: The error message. @@ -174,15 +259,14 @@ class ErrorDetail(_model_base.Model): """The error additional info.""" -class ErrorResponse(_model_base.Model): - """Common error response for all Azure Resource Manager APIs to return error details for failed - operations. +class ErrorResponse(_Model): + """Error response. :ivar error: The error object. :vartype error: ~azure.mgmt.computeschedule.models.ErrorDetail """ - error: Optional["_models.ErrorDetail"] = rest_field() + error: Optional["_models.ErrorDetail"] = rest_field(visibility=["read", "create", "update", "delete", "query"]) """The error object.""" @overload @@ -203,10 +287,51 @@ def __init__(self, *args: Any, **kwargs: Any) -> None: super().__init__(*args, **kwargs) -class ExecuteDeallocateRequest(_model_base.Model): - """The ExecuteDeallocateRequest request for executeDeallocate operations. +class ExecuteCreateRequest(_Model): + """The ExecuteCreateRequest request for create operations. + + :ivar resource_config_parameters: resource creation payload. Required. + :vartype resource_config_parameters: + ~azure.mgmt.computeschedule.models.ResourceProvisionPayload + :ivar execution_parameters: The execution parameters for the request. Required. + :vartype execution_parameters: ~azure.mgmt.computeschedule.models.ExecutionParameters + :ivar correlationid: CorrelationId item. + :vartype correlationid: str + """ + + resource_config_parameters: "_models.ResourceProvisionPayload" = rest_field( + name="resourceConfigParameters", visibility=["read", "create", "update", "delete", "query"] + ) + """resource creation payload. Required.""" + execution_parameters: "_models.ExecutionParameters" = rest_field( + name="executionParameters", visibility=["read", "create", "update", "delete", "query"] + ) + """The execution parameters for the request. Required.""" + correlationid: Optional[str] = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """CorrelationId item.""" + + @overload + def __init__( + self, + *, + resource_config_parameters: "_models.ResourceProvisionPayload", + execution_parameters: "_models.ExecutionParameters", + correlationid: Optional[str] = None, + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + super().__init__(*args, **kwargs) - All required parameters must be populated in order to send to server. + +class ExecuteDeallocateRequest(_Model): + """The ExecuteDeallocateRequest request for executeDeallocate operations. :ivar execution_parameters: The execution parameters for the request. Required. :vartype execution_parameters: ~azure.mgmt.computeschedule.models.ExecutionParameters @@ -216,11 +341,13 @@ class ExecuteDeallocateRequest(_model_base.Model): :vartype correlationid: str """ - execution_parameters: "_models.ExecutionParameters" = rest_field(name="executionParameters") + execution_parameters: "_models.ExecutionParameters" = rest_field( + name="executionParameters", visibility=["read", "create", "update", "delete", "query"] + ) """The execution parameters for the request. Required.""" - resources: "_models.Resources" = rest_field() + resources: "_models.Resources" = rest_field(visibility=["read", "create", "update", "delete", "query"]) """The resources for the request. Required.""" - correlationid: str = rest_field() + correlationid: str = rest_field(visibility=["read", "create", "update", "delete", "query"]) """CorrelationId item. Required.""" @overload @@ -243,10 +370,55 @@ def __init__(self, *args: Any, **kwargs: Any) -> None: super().__init__(*args, **kwargs) -class ExecuteHibernateRequest(_model_base.Model): - """The ExecuteHibernateRequest request for executeHibernate operations. +class ExecuteDeleteRequest(_Model): + """The ExecuteDeleteRequest request for delete operations. - All required parameters must be populated in order to send to server. + :ivar execution_parameters: The execution parameters for the request. Required. + :vartype execution_parameters: ~azure.mgmt.computeschedule.models.ExecutionParameters + :ivar resources: The resources for the request. Required. + :vartype resources: ~azure.mgmt.computeschedule.models.Resources + :ivar correlationid: CorrelationId item. + :vartype correlationid: str + :ivar force_deletion: Forced delete resource item. + :vartype force_deletion: bool + """ + + execution_parameters: "_models.ExecutionParameters" = rest_field( + name="executionParameters", visibility=["read", "create", "update", "delete", "query"] + ) + """The execution parameters for the request. Required.""" + resources: "_models.Resources" = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """The resources for the request. Required.""" + correlationid: Optional[str] = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """CorrelationId item.""" + force_deletion: Optional[bool] = rest_field( + name="forceDeletion", visibility=["read", "create", "update", "delete", "query"] + ) + """Forced delete resource item.""" + + @overload + def __init__( + self, + *, + execution_parameters: "_models.ExecutionParameters", + resources: "_models.Resources", + correlationid: Optional[str] = None, + force_deletion: Optional[bool] = None, + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + super().__init__(*args, **kwargs) + + +class ExecuteHibernateRequest(_Model): + """The ExecuteHibernateRequest request for executeHibernate operations. :ivar execution_parameters: The execution parameters for the request. Required. :vartype execution_parameters: ~azure.mgmt.computeschedule.models.ExecutionParameters @@ -256,11 +428,13 @@ class ExecuteHibernateRequest(_model_base.Model): :vartype correlationid: str """ - execution_parameters: "_models.ExecutionParameters" = rest_field(name="executionParameters") + execution_parameters: "_models.ExecutionParameters" = rest_field( + name="executionParameters", visibility=["read", "create", "update", "delete", "query"] + ) """The execution parameters for the request. Required.""" - resources: "_models.Resources" = rest_field() + resources: "_models.Resources" = rest_field(visibility=["read", "create", "update", "delete", "query"]) """The resources for the request. Required.""" - correlationid: str = rest_field() + correlationid: str = rest_field(visibility=["read", "create", "update", "delete", "query"]) """CorrelationId item. Required.""" @overload @@ -283,11 +457,9 @@ def __init__(self, *args: Any, **kwargs: Any) -> None: super().__init__(*args, **kwargs) -class ExecuteStartRequest(_model_base.Model): +class ExecuteStartRequest(_Model): """The ExecuteStartRequest request for executeStart operations. - All required parameters must be populated in order to send to server. - :ivar execution_parameters: The execution parameters for the request. Required. :vartype execution_parameters: ~azure.mgmt.computeschedule.models.ExecutionParameters :ivar resources: The resources for the request. Required. @@ -296,11 +468,13 @@ class ExecuteStartRequest(_model_base.Model): :vartype correlationid: str """ - execution_parameters: "_models.ExecutionParameters" = rest_field(name="executionParameters") + execution_parameters: "_models.ExecutionParameters" = rest_field( + name="executionParameters", visibility=["read", "create", "update", "delete", "query"] + ) """The execution parameters for the request. Required.""" - resources: "_models.Resources" = rest_field() + resources: "_models.Resources" = rest_field(visibility=["read", "create", "update", "delete", "query"]) """The resources for the request. Required.""" - correlationid: str = rest_field() + correlationid: str = rest_field(visibility=["read", "create", "update", "delete", "query"]) """CorrelationId item. Required.""" @overload @@ -323,7 +497,7 @@ def __init__(self, *args: Any, **kwargs: Any) -> None: super().__init__(*args, **kwargs) -class ExecutionParameters(_model_base.Model): +class ExecutionParameters(_Model): """Extra details needed to run the user's request. :ivar optimization_preference: Details that could optimize the user's request. Known values @@ -335,11 +509,13 @@ class ExecutionParameters(_model_base.Model): """ optimization_preference: Optional[Union[str, "_models.OptimizationPreference"]] = rest_field( - name="optimizationPreference" + name="optimizationPreference", visibility=["read", "create", "update", "delete", "query"] ) """Details that could optimize the user's request. Known values are: \"Cost\", \"Availability\", and \"CostAvailabilityBalanced\".""" - retry_policy: Optional["_models.RetryPolicy"] = rest_field(name="retryPolicy") + retry_policy: Optional["_models.RetryPolicy"] = rest_field( + name="retryPolicy", visibility=["read", "create", "update", "delete", "query"] + ) """Retry policy the user can pass.""" @overload @@ -361,16 +537,16 @@ def __init__(self, *args: Any, **kwargs: Any) -> None: super().__init__(*args, **kwargs) -class GetOperationErrorsRequest(_model_base.Model): +class GetOperationErrorsRequest(_Model): """This is the request to get errors per vm operations. - All required parameters must be populated in order to send to server. - :ivar operation_ids: The list of operation ids to query errors of. Required. :vartype operation_ids: list[str] """ - operation_ids: List[str] = rest_field(name="operationIds") + operation_ids: List[str] = rest_field( + name="operationIds", visibility=["read", "create", "update", "delete", "query"] + ) """The list of operation ids to query errors of. Required.""" @overload @@ -391,15 +567,16 @@ def __init__(self, *args: Any, **kwargs: Any) -> None: super().__init__(*args, **kwargs) -class GetOperationErrorsResponse(_model_base.Model): +class GetOperationErrorsResponse(_Model): """This is the response from a get operations errors request. - :ivar results: An array of operationids and their corresponding errors if any. Required. :vartype results: list[~azure.mgmt.computeschedule.models.OperationErrorsResult] """ - results: List["_models.OperationErrorsResult"] = rest_field() + results: List["_models.OperationErrorsResult"] = rest_field( + visibility=["read", "create", "update", "delete", "query"] + ) """An array of operationids and their corresponding errors if any. Required.""" @overload @@ -420,20 +597,20 @@ def __init__(self, *args: Any, **kwargs: Any) -> None: super().__init__(*args, **kwargs) -class GetOperationStatusRequest(_model_base.Model): +class GetOperationStatusRequest(_Model): """This is the request to get operation status using operationids. - All required parameters must be populated in order to send to server. - :ivar operation_ids: The list of operation ids to get the status of. Required. :vartype operation_ids: list[str] :ivar correlationid: CorrelationId item. Required. :vartype correlationid: str """ - operation_ids: List[str] = rest_field(name="operationIds") + operation_ids: List[str] = rest_field( + name="operationIds", visibility=["read", "create", "update", "delete", "query"] + ) """The list of operation ids to get the status of. Required.""" - correlationid: str = rest_field() + correlationid: str = rest_field(visibility=["read", "create", "update", "delete", "query"]) """CorrelationId item. Required.""" @overload @@ -455,15 +632,14 @@ def __init__(self, *args: Any, **kwargs: Any) -> None: super().__init__(*args, **kwargs) -class GetOperationStatusResponse(_model_base.Model): +class GetOperationStatusResponse(_Model): """This is the response from a get operations status request. - :ivar results: An array of resource operations based on their operation ids. Required. :vartype results: list[~azure.mgmt.computeschedule.models.ResourceOperation] """ - results: List["_models.ResourceOperation"] = rest_field() + results: List["_models.ResourceOperation"] = rest_field(visibility=["read", "create", "update", "delete", "query"]) """An array of resource operations based on their operation ids. Required.""" @overload @@ -484,10 +660,9 @@ def __init__(self, *args: Any, **kwargs: Any) -> None: super().__init__(*args, **kwargs) -class HibernateResourceOperationResponse(_model_base.Model): +class HibernateResourceOperationResponse(_Model): """The response from a Hibernate request. - :ivar description: The description of the operation response. Required. :vartype description: str :ivar type: The type of resources used in the Hibernate request eg virtual machines. Required. @@ -498,13 +673,15 @@ class HibernateResourceOperationResponse(_model_base.Model): :vartype results: list[~azure.mgmt.computeschedule.models.ResourceOperation] """ - description: str = rest_field() + description: str = rest_field(visibility=["read", "create", "update", "delete", "query"]) """The description of the operation response. Required.""" - type: str = rest_field() + type: str = rest_field(visibility=["read", "create", "update", "delete", "query"]) """The type of resources used in the Hibernate request eg virtual machines. Required.""" location: str = rest_field(visibility=["read", "create"]) """The location of the Hibernate request eg westus. Required.""" - results: Optional[List["_models.ResourceOperation"]] = rest_field() + results: Optional[List["_models.ResourceOperation"]] = rest_field( + visibility=["read", "create", "update", "delete", "query"] + ) """The results from the Hibernate request if no errors exist.""" @overload @@ -528,10 +705,8 @@ def __init__(self, *args: Any, **kwargs: Any) -> None: super().__init__(*args, **kwargs) -class Operation(_model_base.Model): - """Details of a REST API operation, returned from the Resource Provider Operations API. - - Readonly variables are only populated by the server, and will be ignored when sending a request. +class Operation(_Model): + """REST API Operation. :ivar name: The name of the operation, as per Resource-Based Access Control (RBAC). Examples: "Microsoft.Compute/virtualMachines/write", "Microsoft.Compute/virtualMachines/capture/action". @@ -557,7 +732,9 @@ class Operation(_model_base.Model): is_data_action: Optional[bool] = rest_field(name="isDataAction", visibility=["read"]) """Whether the operation applies to data-plane. This is \"true\" for data-plane operations and \"false\" for Azure Resource Manager/control-plane operations.""" - display: Optional["_models.OperationDisplay"] = rest_field() + display: Optional["_models.OperationDisplay"] = rest_field( + visibility=["read", "create", "update", "delete", "query"] + ) """Localized display information for this particular operation.""" origin: Optional[Union[str, "_models.Origin"]] = rest_field(visibility=["read"]) """The intended executor of the operation; as in Resource Based Access Control (RBAC) and audit @@ -585,11 +762,9 @@ def __init__(self, *args: Any, **kwargs: Any) -> None: super().__init__(*args, **kwargs) -class OperationDisplay(_model_base.Model): +class OperationDisplay(_Model): """Localized display information for and operation. - Readonly variables are only populated by the server, and will be ignored when sending a request. - :ivar provider: The localized friendly form of the resource provider name, e.g. "Microsoft Monitoring Insights" or "Microsoft Compute". :vartype provider: str @@ -618,10 +793,9 @@ class OperationDisplay(_model_base.Model): views.""" -class OperationErrorDetails(_model_base.Model): +class OperationErrorDetails(_Model): """This defines a list of operation errors associated with a unique operationId. - :ivar error_code: The error code of the operation. Required. :vartype error_code: str :ivar error_details: The error details of the operation. Required. @@ -636,17 +810,25 @@ class OperationErrorDetails(_model_base.Model): :vartype crp_operation_id: str """ - error_code: str = rest_field(name="errorCode") + error_code: str = rest_field(name="errorCode", visibility=["read", "create", "update", "delete", "query"]) """The error code of the operation. Required.""" - error_details: str = rest_field(name="errorDetails") + error_details: str = rest_field(name="errorDetails", visibility=["read", "create", "update", "delete", "query"]) """The error details of the operation. Required.""" - timestamp: Optional[datetime.datetime] = rest_field(format="rfc3339") + timestamp: Optional[datetime.datetime] = rest_field( + visibility=["read", "create", "update", "delete", "query"], format="rfc3339" + ) """The timestamp of the error occurence.""" - time_stamp: Optional[datetime.datetime] = rest_field(name="timeStamp", format="rfc3339") + time_stamp: Optional[datetime.datetime] = rest_field( + name="timeStamp", visibility=["read", "create", "update", "delete", "query"], format="rfc3339" + ) """The timestamp of the error occurence.""" - azure_operation_name: Optional[str] = rest_field(name="azureOperationName") + azure_operation_name: Optional[str] = rest_field( + name="azureOperationName", visibility=["read", "create", "update", "delete", "query"] + ) """The compute operationid of the Start/Deallocate/Hibernate request.""" - crp_operation_id: Optional[str] = rest_field(name="crpOperationId") + crp_operation_id: Optional[str] = rest_field( + name="crpOperationId", visibility=["read", "create", "update", "delete", "query"] + ) """The compute operationid of the Start/Deallocate/Hibernate request.""" @overload @@ -672,7 +854,7 @@ def __init__(self, *args: Any, **kwargs: Any) -> None: super().__init__(*args, **kwargs) -class OperationErrorsResult(_model_base.Model): +class OperationErrorsResult(_Model): """This is the first level of operation errors from the request when clients get errors per vm operation. @@ -692,19 +874,33 @@ class OperationErrorsResult(_model_base.Model): :vartype request_error_details: str """ - operation_id: Optional[str] = rest_field(name="operationId") + operation_id: Optional[str] = rest_field( + name="operationId", visibility=["read", "create", "update", "delete", "query"] + ) """The operationId identifying a vm operation.""" - creation_time: Optional[datetime.datetime] = rest_field(name="creationTime", format="rfc3339") + creation_time: Optional[datetime.datetime] = rest_field( + name="creationTime", visibility=["read", "create", "update", "delete", "query"], format="rfc3339" + ) """The creation time of the error result.""" - activation_time: Optional[datetime.datetime] = rest_field(name="activationTime", format="rfc3339") + activation_time: Optional[datetime.datetime] = rest_field( + name="activationTime", visibility=["read", "create", "update", "delete", "query"], format="rfc3339" + ) """The activation time of a vm operation.""" - completed_at: Optional[datetime.datetime] = rest_field(name="completedAt", format="rfc3339") + completed_at: Optional[datetime.datetime] = rest_field( + name="completedAt", visibility=["read", "create", "update", "delete", "query"], format="rfc3339" + ) """The completion time of the operation if the operation was completed.""" - operation_errors: Optional[List["_models.OperationErrorDetails"]] = rest_field(name="operationErrors") + operation_errors: Optional[List["_models.OperationErrorDetails"]] = rest_field( + name="operationErrors", visibility=["read", "create", "update", "delete", "query"] + ) """A list of errors associated with the operationid.""" - request_error_code: Optional[str] = rest_field(name="requestErrorCode") + request_error_code: Optional[str] = rest_field( + name="requestErrorCode", visibility=["read", "create", "update", "delete", "query"] + ) """Request level error code.""" - request_error_details: Optional[str] = rest_field(name="requestErrorDetails") + request_error_details: Optional[str] = rest_field( + name="requestErrorDetails", visibility=["read", "create", "update", "delete", "query"] + ) """Request level error details.""" @overload @@ -731,7 +927,7 @@ def __init__(self, *args: Any, **kwargs: Any) -> None: super().__init__(*args, **kwargs) -class ResourceOperation(_model_base.Model): +class ResourceOperation(_Model): """High level response from an operation on a resource. :ivar resource_id: Unique identifier for the resource involved in the operation, eg ArmId. @@ -744,13 +940,19 @@ class ResourceOperation(_model_base.Model): :vartype operation: ~azure.mgmt.computeschedule.models.ResourceOperationDetails """ - resource_id: Optional[str] = rest_field(name="resourceId") + resource_id: Optional[str] = rest_field( + name="resourceId", visibility=["read", "create", "update", "delete", "query"] + ) """Unique identifier for the resource involved in the operation, eg ArmId.""" - error_code: Optional[str] = rest_field(name="errorCode") + error_code: Optional[str] = rest_field(name="errorCode", visibility=["read", "create", "update", "delete", "query"]) """Resource level error code if it exists.""" - error_details: Optional[str] = rest_field(name="errorDetails") + error_details: Optional[str] = rest_field( + name="errorDetails", visibility=["read", "create", "update", "delete", "query"] + ) """Resource level error details if they exist.""" - operation: Optional["_models.ResourceOperationDetails"] = rest_field() + operation: Optional["_models.ResourceOperationDetails"] = rest_field( + visibility=["read", "create", "update", "delete", "query"] + ) """Details of the operation performed on a resource.""" @overload @@ -774,10 +976,9 @@ def __init__(self, *args: Any, **kwargs: Any) -> None: super().__init__(*args, **kwargs) -class ResourceOperationDetails(_model_base.Model): +class ResourceOperationDetails(_Model): """The details of a response from an operation on a resource. - :ivar operation_id: Operation identifier for the unique operation. Required. :vartype operation_id: str :ivar resource_id: Unique identifier for the resource involved in the operation, eg ArmId. @@ -808,33 +1009,51 @@ class ResourceOperationDetails(_model_base.Model): :vartype retry_policy: ~azure.mgmt.computeschedule.models.RetryPolicy """ - operation_id: str = rest_field(name="operationId") + operation_id: str = rest_field(name="operationId", visibility=["read", "create", "update", "delete", "query"]) """Operation identifier for the unique operation. Required.""" - resource_id: Optional[str] = rest_field(name="resourceId") + resource_id: Optional[str] = rest_field( + name="resourceId", visibility=["read", "create", "update", "delete", "query"] + ) """Unique identifier for the resource involved in the operation, eg ArmId.""" - op_type: Optional[Union[str, "_models.ResourceOperationType"]] = rest_field(name="opType") + op_type: Optional[Union[str, "_models.ResourceOperationType"]] = rest_field( + name="opType", visibility=["read", "create", "update", "delete", "query"] + ) """Type of operation performed on the resources. Known values are: \"Unknown\", \"Start\", \"Deallocate\", and \"Hibernate\".""" - subscription_id: Optional[str] = rest_field(name="subscriptionId") + subscription_id: Optional[str] = rest_field( + name="subscriptionId", visibility=["read", "create", "update", "delete", "query"] + ) """Subscription id attached to the request.""" - deadline: Optional[datetime.datetime] = rest_field(format="rfc3339") + deadline: Optional[datetime.datetime] = rest_field( + visibility=["read", "create", "update", "delete", "query"], format="rfc3339" + ) """Deadline for the operation.""" - deadline_type: Optional[Union[str, "_models.DeadlineType"]] = rest_field(name="deadlineType") + deadline_type: Optional[Union[str, "_models.DeadlineType"]] = rest_field( + name="deadlineType", visibility=["read", "create", "update", "delete", "query"] + ) """Type of deadline of the operation. Known values are: \"Unknown\", \"InitiateAt\", and \"CompleteBy\".""" - state: Optional[Union[str, "_models.OperationState"]] = rest_field() + state: Optional[Union[str, "_models.OperationState"]] = rest_field( + visibility=["read", "create", "update", "delete", "query"] + ) """Current state of the operation. Known values are: \"Unknown\", \"PendingScheduling\", \"Scheduled\", \"PendingExecution\", \"Executing\", \"Succeeded\", \"Failed\", \"Cancelled\", and \"Blocked\".""" - timezone: Optional[str] = rest_field() + timezone: Optional[str] = rest_field(visibility=["read", "create", "update", "delete", "query"]) """Timezone for the operation.""" - time_zone: Optional[str] = rest_field(name="timeZone") + time_zone: Optional[str] = rest_field(name="timeZone", visibility=["read", "create", "update", "delete", "query"]) """Timezone for the operation.""" - resource_operation_error: Optional["_models.ResourceOperationError"] = rest_field(name="resourceOperationError") + resource_operation_error: Optional["_models.ResourceOperationError"] = rest_field( + name="resourceOperationError", visibility=["read", "create", "update", "delete", "query"] + ) """Operation level errors if they exist.""" - completed_at: Optional[datetime.datetime] = rest_field(name="completedAt", format="rfc3339") + completed_at: Optional[datetime.datetime] = rest_field( + name="completedAt", visibility=["read", "create", "update", "delete", "query"], format="rfc3339" + ) """Time the operation was complete if errors are null.""" - retry_policy: Optional["_models.RetryPolicy"] = rest_field(name="retryPolicy") + retry_policy: Optional["_models.RetryPolicy"] = rest_field( + name="retryPolicy", visibility=["read", "create", "update", "delete", "query"] + ) """Retry policy the user can pass.""" @overload @@ -866,19 +1085,18 @@ def __init__(self, *args: Any, **kwargs: Any) -> None: super().__init__(*args, **kwargs) -class ResourceOperationError(_model_base.Model): +class ResourceOperationError(_Model): """These describe errors that occur at the resource level. - :ivar error_code: Code for the error eg 404, 500. Required. :vartype error_code: str :ivar error_details: Detailed message about the error. Required. :vartype error_details: str """ - error_code: str = rest_field(name="errorCode") + error_code: str = rest_field(name="errorCode", visibility=["read", "create", "update", "delete", "query"]) """Code for the error eg 404, 500. Required.""" - error_details: str = rest_field(name="errorDetails") + error_details: str = rest_field(name="errorDetails", visibility=["read", "create", "update", "delete", "query"]) """Detailed message about the error. Required.""" @overload @@ -900,16 +1118,66 @@ def __init__(self, *args: Any, **kwargs: Any) -> None: super().__init__(*args, **kwargs) -class Resources(_model_base.Model): - """The resources needed for the user request. +class ResourceProvisionPayload(_Model): + """Resource creation data model. + + :ivar base_profile: baseProfile, Resource properties that common across all resources. + :vartype base_profile: bytes + :ivar resource_overrides: resourceOverrides, properties per resource that needs to be + overwritted from baseProfile. + :vartype resource_overrides: list[bytes] + :ivar resource_count: Number of resources to be created. Required. + :vartype resource_count: int + :ivar resource_prefix: if resourceOverrides doesn't contain "name", service will create name + based of prefix and ResourceCount e.g. resourceprefix-0,resourceprefix-1.. + :vartype resource_prefix: str + """ + + base_profile: Optional[bytes] = rest_field( + name="baseProfile", visibility=["read", "create", "update", "delete", "query"], format="base64" + ) + """baseProfile, Resource properties that common across all resources.""" + resource_overrides: Optional[List[bytes]] = rest_field( + name="resourceOverrides", visibility=["read", "create", "update", "delete", "query"], format="base64" + ) + """resourceOverrides, properties per resource that needs to be overwritted from baseProfile.""" + resource_count: int = rest_field(name="resourceCount", visibility=["read", "create", "update", "delete", "query"]) + """Number of resources to be created. Required.""" + resource_prefix: Optional[str] = rest_field( + name="resourcePrefix", visibility=["read", "create", "update", "delete", "query"] + ) + """if resourceOverrides doesn't contain \"name\", service will create name based of prefix and + ResourceCount e.g. resourceprefix-0,resourceprefix-1..""" + + @overload + def __init__( + self, + *, + resource_count: int, + base_profile: Optional[bytes] = None, + resource_overrides: Optional[List[bytes]] = None, + resource_prefix: Optional[str] = None, + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ - All required parameters must be populated in order to send to server. + def __init__(self, *args: Any, **kwargs: Any) -> None: + super().__init__(*args, **kwargs) + + +class Resources(_Model): + """The resources needed for the user request. :ivar ids: The resource ids used for the request. Required. :vartype ids: list[str] """ - ids: List[str] = rest_field() + ids: List[str] = rest_field(visibility=["read", "create", "update", "delete", "query"]) """The resource ids used for the request. Required.""" @overload @@ -930,7 +1198,7 @@ def __init__(self, *args: Any, **kwargs: Any) -> None: super().__init__(*args, **kwargs) -class RetryPolicy(_model_base.Model): +class RetryPolicy(_Model): """The retry policy for the user request. :ivar retry_count: Retry count for user request. @@ -939,9 +1207,13 @@ class RetryPolicy(_model_base.Model): :vartype retry_window_in_minutes: int """ - retry_count: Optional[int] = rest_field(name="retryCount") + retry_count: Optional[int] = rest_field( + name="retryCount", visibility=["read", "create", "update", "delete", "query"] + ) """Retry count for user request.""" - retry_window_in_minutes: Optional[int] = rest_field(name="retryWindowInMinutes") + retry_window_in_minutes: Optional[int] = rest_field( + name="retryWindowInMinutes", visibility=["read", "create", "update", "delete", "query"] + ) """Retry window in minutes for user request.""" @overload @@ -963,11 +1235,9 @@ def __init__(self, *args: Any, **kwargs: Any) -> None: super().__init__(*args, **kwargs) -class Schedule(_model_base.Model): +class Schedule(_Model): """The schedule details for the user request. - All required parameters must be populated in order to send to server. - :ivar deadline: The deadline for the operation. :vartype deadline: ~datetime.datetime :ivar dead_line: The deadline for the operation. @@ -981,15 +1251,21 @@ class Schedule(_model_base.Model): :vartype deadline_type: str or ~azure.mgmt.computeschedule.models.DeadlineType """ - deadline: Optional[datetime.datetime] = rest_field(format="rfc3339") + deadline: Optional[datetime.datetime] = rest_field( + visibility=["read", "create", "update", "delete", "query"], format="rfc3339" + ) """The deadline for the operation.""" - dead_line: Optional[datetime.datetime] = rest_field(name="deadLine", format="rfc3339") + dead_line: Optional[datetime.datetime] = rest_field( + name="deadLine", visibility=["read", "create", "update", "delete", "query"], format="rfc3339" + ) """The deadline for the operation.""" - timezone: Optional[str] = rest_field() + timezone: Optional[str] = rest_field(visibility=["read", "create", "update", "delete", "query"]) """The timezone for the operation.""" - time_zone: Optional[str] = rest_field(name="timeZone") + time_zone: Optional[str] = rest_field(name="timeZone", visibility=["read", "create", "update", "delete", "query"]) """The timezone for the operation.""" - deadline_type: Union[str, "_models.DeadlineType"] = rest_field(name="deadlineType") + deadline_type: Union[str, "_models.DeadlineType"] = rest_field( + name="deadlineType", visibility=["read", "create", "update", "delete", "query"] + ) """The deadlinetype of the operation, this can either be InitiateAt or CompleteBy. Required. Known values are: \"Unknown\", \"InitiateAt\", and \"CompleteBy\".""" @@ -1015,10 +1291,9 @@ def __init__(self, *args: Any, **kwargs: Any) -> None: super().__init__(*args, **kwargs) -class StartResourceOperationResponse(_model_base.Model): +class StartResourceOperationResponse(_Model): """The response from a start request. - :ivar description: The description of the operation response. Required. :vartype description: str :ivar type: The type of resources used in the start request eg virtual machines. Required. @@ -1029,13 +1304,15 @@ class StartResourceOperationResponse(_model_base.Model): :vartype results: list[~azure.mgmt.computeschedule.models.ResourceOperation] """ - description: str = rest_field() + description: str = rest_field(visibility=["read", "create", "update", "delete", "query"]) """The description of the operation response. Required.""" - type: str = rest_field() + type: str = rest_field(visibility=["read", "create", "update", "delete", "query"]) """The type of resources used in the start request eg virtual machines. Required.""" location: str = rest_field(visibility=["read", "create"]) """The location of the start request eg westus. Required.""" - results: Optional[List["_models.ResourceOperation"]] = rest_field() + results: Optional[List["_models.ResourceOperation"]] = rest_field( + visibility=["read", "create", "update", "delete", "query"] + ) """The results from the start request if no errors exist.""" @overload @@ -1059,11 +1336,9 @@ def __init__(self, *args: Any, **kwargs: Any) -> None: super().__init__(*args, **kwargs) -class SubmitDeallocateRequest(_model_base.Model): +class SubmitDeallocateRequest(_Model): """The deallocate request for resources. - All required parameters must be populated in order to send to server. - :ivar schedule: The schedule for the request. Required. :vartype schedule: ~azure.mgmt.computeschedule.models.Schedule :ivar execution_parameters: The execution parameters for the request. Required. @@ -1074,13 +1349,15 @@ class SubmitDeallocateRequest(_model_base.Model): :vartype correlationid: str """ - schedule: "_models.Schedule" = rest_field() + schedule: "_models.Schedule" = rest_field(visibility=["read", "create", "update", "delete", "query"]) """The schedule for the request. Required.""" - execution_parameters: "_models.ExecutionParameters" = rest_field(name="executionParameters") + execution_parameters: "_models.ExecutionParameters" = rest_field( + name="executionParameters", visibility=["read", "create", "update", "delete", "query"] + ) """The execution parameters for the request. Required.""" - resources: "_models.Resources" = rest_field() + resources: "_models.Resources" = rest_field(visibility=["read", "create", "update", "delete", "query"]) """The resources for the request. Required.""" - correlationid: str = rest_field() + correlationid: str = rest_field(visibility=["read", "create", "update", "delete", "query"]) """CorrelationId item. Required.""" @overload @@ -1104,11 +1381,9 @@ def __init__(self, *args: Any, **kwargs: Any) -> None: super().__init__(*args, **kwargs) -class SubmitHibernateRequest(_model_base.Model): +class SubmitHibernateRequest(_Model): """This is the request for hibernate. - All required parameters must be populated in order to send to server. - :ivar schedule: The schedule for the request. Required. :vartype schedule: ~azure.mgmt.computeschedule.models.Schedule :ivar execution_parameters: The execution parameters for the request. Required. @@ -1119,13 +1394,15 @@ class SubmitHibernateRequest(_model_base.Model): :vartype correlationid: str """ - schedule: "_models.Schedule" = rest_field() + schedule: "_models.Schedule" = rest_field(visibility=["read", "create", "update", "delete", "query"]) """The schedule for the request. Required.""" - execution_parameters: "_models.ExecutionParameters" = rest_field(name="executionParameters") + execution_parameters: "_models.ExecutionParameters" = rest_field( + name="executionParameters", visibility=["read", "create", "update", "delete", "query"] + ) """The execution parameters for the request. Required.""" - resources: "_models.Resources" = rest_field() + resources: "_models.Resources" = rest_field(visibility=["read", "create", "update", "delete", "query"]) """The resources for the request. Required.""" - correlationid: str = rest_field() + correlationid: str = rest_field(visibility=["read", "create", "update", "delete", "query"]) """CorrelationId item. Required.""" @overload @@ -1149,11 +1426,9 @@ def __init__(self, *args: Any, **kwargs: Any) -> None: super().__init__(*args, **kwargs) -class SubmitStartRequest(_model_base.Model): +class SubmitStartRequest(_Model): """This is the request for start. - All required parameters must be populated in order to send to server. - :ivar schedule: The schedule for the request. Required. :vartype schedule: ~azure.mgmt.computeschedule.models.Schedule :ivar execution_parameters: The execution parameters for the request. Required. @@ -1164,13 +1439,15 @@ class SubmitStartRequest(_model_base.Model): :vartype correlationid: str """ - schedule: "_models.Schedule" = rest_field() + schedule: "_models.Schedule" = rest_field(visibility=["read", "create", "update", "delete", "query"]) """The schedule for the request. Required.""" - execution_parameters: "_models.ExecutionParameters" = rest_field(name="executionParameters") + execution_parameters: "_models.ExecutionParameters" = rest_field( + name="executionParameters", visibility=["read", "create", "update", "delete", "query"] + ) """The execution parameters for the request. Required.""" - resources: "_models.Resources" = rest_field() + resources: "_models.Resources" = rest_field(visibility=["read", "create", "update", "delete", "query"]) """The resources for the request. Required.""" - correlationid: str = rest_field() + correlationid: str = rest_field(visibility=["read", "create", "update", "delete", "query"]) """CorrelationId item. Required.""" @overload diff --git a/sdk/computeschedule/azure-mgmt-computeschedule/azure/mgmt/computeschedule/models/_patch.py b/sdk/computeschedule/azure-mgmt-computeschedule/azure/mgmt/computeschedule/models/_patch.py index f7dd32510333..8bcb627aa475 100644 --- a/sdk/computeschedule/azure-mgmt-computeschedule/azure/mgmt/computeschedule/models/_patch.py +++ b/sdk/computeschedule/azure-mgmt-computeschedule/azure/mgmt/computeschedule/models/_patch.py @@ -1,7 +1,8 @@ -# ------------------------------------ -# Copyright (c) Microsoft Corporation. -# Licensed under the MIT License. -# ------------------------------------ +# 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. +# -------------------------------------------------------------------------- """Customize generated code here. Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize diff --git a/sdk/computeschedule/azure-mgmt-computeschedule/azure/mgmt/computeschedule/operations/_operations.py b/sdk/computeschedule/azure-mgmt-computeschedule/azure/mgmt/computeschedule/operations/_operations.py index a22209e54381..5751df4de373 100644 --- a/sdk/computeschedule/azure-mgmt-computeschedule/azure/mgmt/computeschedule/operations/_operations.py +++ b/sdk/computeschedule/azure-mgmt-computeschedule/azure/mgmt/computeschedule/operations/_operations.py @@ -1,4 +1,4 @@ -# pylint: disable=too-many-lines +# pylint: disable=line-too-long,useless-suppression,too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -6,12 +6,13 @@ # Code generated by Microsoft (R) Python Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +from collections.abc import MutableMapping from io import IOBase import json -import sys from typing import Any, Callable, Dict, IO, Iterable, List, Optional, TypeVar, Union, overload import urllib.parse +from azure.core import PipelineClient from azure.core.exceptions import ( ClientAuthenticationError, HttpResponseError, @@ -30,16 +31,14 @@ from azure.mgmt.core.exceptions import ARMErrorFormat from .. import models as _models -from .._model_base import SdkJSONEncoder, _deserialize, _failsafe_deserialize -from .._serialization import Serializer +from .._configuration import ComputeScheduleMgmtClientConfiguration +from .._utils.model_base import SdkJSONEncoder, _deserialize, _failsafe_deserialize +from .._utils.serialization import Deserializer, Serializer +from .._validation import api_version_validation -if sys.version_info >= (3, 9): - from collections.abc import MutableMapping -else: - from typing import MutableMapping # type: ignore T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] -JSON = MutableMapping[str, Any] # pylint: disable=unsubscriptable-object +JSON = MutableMapping[str, Any] _SERIALIZER = Serializer() _SERIALIZER.client_side_validation = False @@ -49,7 +48,7 @@ def build_operations_list_request(**kwargs: Any) -> HttpRequest: _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", "2024-10-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-05-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -71,11 +70,11 @@ def build_scheduled_actions_virtual_machines_submit_deallocate_request( # pylin _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-10-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-05-01")) accept = _headers.pop("Accept", "application/json") # Construct URL - _url = "/subscriptions/{subscriptionId}/providers/Microsoft.ComputeSchedule/locations/{locationparameter}/virtualMachinesSubmitDeallocate" # pylint: disable=line-too-long + _url = "/subscriptions/{subscriptionId}/providers/Microsoft.ComputeSchedule/locations/{locationparameter}/virtualMachinesSubmitDeallocate" path_format_arguments = { "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), "locationparameter": _SERIALIZER.url("locationparameter", locationparameter, "str"), @@ -101,11 +100,11 @@ def build_scheduled_actions_virtual_machines_submit_hibernate_request( # pylint _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-10-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-05-01")) accept = _headers.pop("Accept", "application/json") # Construct URL - _url = "/subscriptions/{subscriptionId}/providers/Microsoft.ComputeSchedule/locations/{locationparameter}/virtualMachinesSubmitHibernate" # pylint: disable=line-too-long + _url = "/subscriptions/{subscriptionId}/providers/Microsoft.ComputeSchedule/locations/{locationparameter}/virtualMachinesSubmitHibernate" path_format_arguments = { "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), "locationparameter": _SERIALIZER.url("locationparameter", locationparameter, "str"), @@ -131,11 +130,11 @@ def build_scheduled_actions_virtual_machines_submit_start_request( # pylint: di _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-10-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-05-01")) accept = _headers.pop("Accept", "application/json") # Construct URL - _url = "/subscriptions/{subscriptionId}/providers/Microsoft.ComputeSchedule/locations/{locationparameter}/virtualMachinesSubmitStart" # pylint: disable=line-too-long + _url = "/subscriptions/{subscriptionId}/providers/Microsoft.ComputeSchedule/locations/{locationparameter}/virtualMachinesSubmitStart" path_format_arguments = { "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), "locationparameter": _SERIALIZER.url("locationparameter", locationparameter, "str"), @@ -161,11 +160,11 @@ def build_scheduled_actions_virtual_machines_execute_deallocate_request( # pyli _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-10-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-05-01")) accept = _headers.pop("Accept", "application/json") # Construct URL - _url = "/subscriptions/{subscriptionId}/providers/Microsoft.ComputeSchedule/locations/{locationparameter}/virtualMachinesExecuteDeallocate" # pylint: disable=line-too-long + _url = "/subscriptions/{subscriptionId}/providers/Microsoft.ComputeSchedule/locations/{locationparameter}/virtualMachinesExecuteDeallocate" path_format_arguments = { "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), "locationparameter": _SERIALIZER.url("locationparameter", locationparameter, "str"), @@ -191,11 +190,11 @@ def build_scheduled_actions_virtual_machines_execute_hibernate_request( # pylin _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-10-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-05-01")) accept = _headers.pop("Accept", "application/json") # Construct URL - _url = "/subscriptions/{subscriptionId}/providers/Microsoft.ComputeSchedule/locations/{locationparameter}/virtualMachinesExecuteHibernate" # pylint: disable=line-too-long + _url = "/subscriptions/{subscriptionId}/providers/Microsoft.ComputeSchedule/locations/{locationparameter}/virtualMachinesExecuteHibernate" path_format_arguments = { "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), "locationparameter": _SERIALIZER.url("locationparameter", locationparameter, "str"), @@ -221,11 +220,71 @@ def build_scheduled_actions_virtual_machines_execute_start_request( # pylint: d _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-10-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-05-01")) accept = _headers.pop("Accept", "application/json") # Construct URL - _url = "/subscriptions/{subscriptionId}/providers/Microsoft.ComputeSchedule/locations/{locationparameter}/virtualMachinesExecuteStart" # pylint: disable=line-too-long + _url = "/subscriptions/{subscriptionId}/providers/Microsoft.ComputeSchedule/locations/{locationparameter}/virtualMachinesExecuteStart" + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "locationparameter": _SERIALIZER.url("locationparameter", locationparameter, "str"), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + # Construct headers + if content_type is not None: + _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_scheduled_actions_virtual_machines_execute_create_request( # pylint: disable=name-too-long + locationparameter: str, subscription_id: str, **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-05-01")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = "/subscriptions/{subscriptionId}/providers/Microsoft.ComputeSchedule/locations/{locationparameter}/virtualMachinesExecuteCreate" + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "locationparameter": _SERIALIZER.url("locationparameter", locationparameter, "str"), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + # Construct headers + if content_type is not None: + _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_scheduled_actions_virtual_machines_execute_delete_request( # pylint: disable=name-too-long + locationparameter: str, subscription_id: str, **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-05-01")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = "/subscriptions/{subscriptionId}/providers/Microsoft.ComputeSchedule/locations/{locationparameter}/virtualMachinesExecuteDelete" path_format_arguments = { "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), "locationparameter": _SERIALIZER.url("locationparameter", locationparameter, "str"), @@ -251,11 +310,11 @@ def build_scheduled_actions_virtual_machines_get_operation_status_request( # py _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-10-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-05-01")) accept = _headers.pop("Accept", "application/json") # Construct URL - _url = "/subscriptions/{subscriptionId}/providers/Microsoft.ComputeSchedule/locations/{locationparameter}/virtualMachinesGetOperationStatus" # pylint: disable=line-too-long + _url = "/subscriptions/{subscriptionId}/providers/Microsoft.ComputeSchedule/locations/{locationparameter}/virtualMachinesGetOperationStatus" path_format_arguments = { "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), "locationparameter": _SERIALIZER.url("locationparameter", locationparameter, "str"), @@ -281,11 +340,11 @@ def build_scheduled_actions_virtual_machines_cancel_operations_request( # pylin _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-10-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-05-01")) accept = _headers.pop("Accept", "application/json") # Construct URL - _url = "/subscriptions/{subscriptionId}/providers/Microsoft.ComputeSchedule/locations/{locationparameter}/virtualMachinesCancelOperations" # pylint: disable=line-too-long + _url = "/subscriptions/{subscriptionId}/providers/Microsoft.ComputeSchedule/locations/{locationparameter}/virtualMachinesCancelOperations" path_format_arguments = { "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), "locationparameter": _SERIALIZER.url("locationparameter", locationparameter, "str"), @@ -311,11 +370,11 @@ def build_scheduled_actions_virtual_machines_get_operation_errors_request( # py _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-10-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-05-01")) accept = _headers.pop("Accept", "application/json") # Construct URL - _url = "/subscriptions/{subscriptionId}/providers/Microsoft.ComputeSchedule/locations/{locationparameter}/virtualMachinesGetOperationErrors" # pylint: disable=line-too-long + _url = "/subscriptions/{subscriptionId}/providers/Microsoft.ComputeSchedule/locations/{locationparameter}/virtualMachinesGetOperationErrors" path_format_arguments = { "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), "locationparameter": _SERIALIZER.url("locationparameter", locationparameter, "str"), @@ -344,12 +403,12 @@ class Operations: :attr:`operations` attribute. """ - def __init__(self, *args, **kwargs): + 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") + self._client: PipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") + self._config: ComputeScheduleMgmtClientConfiguration = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") @distributed_trace def list(self, **kwargs: Any) -> Iterable["_models.Operation"]: @@ -411,7 +470,7 @@ def prepare_request(next_link=None): def extract_data(pipeline_response): deserialized = pipeline_response.http_response.json() - list_of_elem = _deserialize(List[_models.Operation], deserialized["value"]) + list_of_elem = _deserialize(List[_models.Operation], deserialized.get("value", [])) if cls: list_of_elem = cls(list_of_elem) # type: ignore return deserialized.get("nextLink") or None, iter(list_of_elem) @@ -445,12 +504,12 @@ class ScheduledActionsOperations: :attr:`scheduled_actions` attribute. """ - def __init__(self, *args, **kwargs): + 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") + self._client: PipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") + self._config: ComputeScheduleMgmtClientConfiguration = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") @overload def virtual_machines_submit_deallocate( @@ -1332,6 +1391,308 @@ def virtual_machines_execute_start( return deserialized # type: ignore + @overload + def virtual_machines_execute_create( + self, + locationparameter: str, + request_body: _models.ExecuteCreateRequest, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.CreateResourceOperationResponse: + """VirtualMachinesExecuteCreate: Execute create operation for a batch of virtual machines, this + operation is triggered as soon as Computeschedule receives it. + + :param locationparameter: The location name. Required. + :type locationparameter: str + :param request_body: The request body. Required. + :type request_body: ~azure.mgmt.computeschedule.models.ExecuteCreateRequest + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: CreateResourceOperationResponse. The CreateResourceOperationResponse is compatible + with MutableMapping + :rtype: ~azure.mgmt.computeschedule.models.CreateResourceOperationResponse + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def virtual_machines_execute_create( + self, locationparameter: str, request_body: JSON, *, content_type: str = "application/json", **kwargs: Any + ) -> _models.CreateResourceOperationResponse: + """VirtualMachinesExecuteCreate: Execute create operation for a batch of virtual machines, this + operation is triggered as soon as Computeschedule receives it. + + :param locationparameter: The location name. Required. + :type locationparameter: str + :param request_body: The request body. Required. + :type request_body: JSON + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: CreateResourceOperationResponse. The CreateResourceOperationResponse is compatible + with MutableMapping + :rtype: ~azure.mgmt.computeschedule.models.CreateResourceOperationResponse + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def virtual_machines_execute_create( + self, locationparameter: str, request_body: IO[bytes], *, content_type: str = "application/json", **kwargs: Any + ) -> _models.CreateResourceOperationResponse: + """VirtualMachinesExecuteCreate: Execute create operation for a batch of virtual machines, this + operation is triggered as soon as Computeschedule receives it. + + :param locationparameter: The location name. Required. + :type locationparameter: str + :param request_body: The request body. Required. + :type request_body: IO[bytes] + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :return: CreateResourceOperationResponse. The CreateResourceOperationResponse is compatible + with MutableMapping + :rtype: ~azure.mgmt.computeschedule.models.CreateResourceOperationResponse + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace + @api_version_validation( + method_added_on="2025-05-01", + params_added_on={ + "2025-05-01": ["api_version", "subscription_id", "locationparameter", "content_type", "accept"] + }, + ) + def virtual_machines_execute_create( + self, locationparameter: str, request_body: Union[_models.ExecuteCreateRequest, JSON, IO[bytes]], **kwargs: Any + ) -> _models.CreateResourceOperationResponse: + """VirtualMachinesExecuteCreate: Execute create operation for a batch of virtual machines, this + operation is triggered as soon as Computeschedule receives it. + + :param locationparameter: The location name. Required. + :type locationparameter: str + :param request_body: The request body. Is one of the following types: ExecuteCreateRequest, + JSON, IO[bytes] Required. + :type request_body: ~azure.mgmt.computeschedule.models.ExecuteCreateRequest or JSON or + IO[bytes] + :return: CreateResourceOperationResponse. The CreateResourceOperationResponse is compatible + with MutableMapping + :rtype: ~azure.mgmt.computeschedule.models.CreateResourceOperationResponse + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = kwargs.pop("params", {}) or {} + + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.CreateResourceOperationResponse] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _content = None + if isinstance(request_body, (IOBase, bytes)): + _content = request_body + else: + _content = json.dumps(request_body, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore + + _request = build_scheduled_actions_virtual_machines_execute_create_request( + locationparameter=locationparameter, + subscription_id=self._config.subscription_id, + content_type=content_type, + api_version=self._config.api_version, + content=_content, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _stream = kwargs.pop("stream", False) + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200]: + if _stream: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize(_models.ErrorResponse, response.json()) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if _stream: + deserialized = response.iter_bytes() + else: + deserialized = _deserialize(_models.CreateResourceOperationResponse, response.json()) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + @overload + def virtual_machines_execute_delete( + self, + locationparameter: str, + request_body: _models.ExecuteDeleteRequest, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.DeleteResourceOperationResponse: + """VirtualMachinesExecuteDelete: Execute delete operation for a batch of virtual machines, this + operation is triggered as soon as Computeschedule receives it. + + :param locationparameter: The location name. Required. + :type locationparameter: str + :param request_body: The request body. Required. + :type request_body: ~azure.mgmt.computeschedule.models.ExecuteDeleteRequest + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: DeleteResourceOperationResponse. The DeleteResourceOperationResponse is compatible + with MutableMapping + :rtype: ~azure.mgmt.computeschedule.models.DeleteResourceOperationResponse + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def virtual_machines_execute_delete( + self, locationparameter: str, request_body: JSON, *, content_type: str = "application/json", **kwargs: Any + ) -> _models.DeleteResourceOperationResponse: + """VirtualMachinesExecuteDelete: Execute delete operation for a batch of virtual machines, this + operation is triggered as soon as Computeschedule receives it. + + :param locationparameter: The location name. Required. + :type locationparameter: str + :param request_body: The request body. Required. + :type request_body: JSON + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: DeleteResourceOperationResponse. The DeleteResourceOperationResponse is compatible + with MutableMapping + :rtype: ~azure.mgmt.computeschedule.models.DeleteResourceOperationResponse + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def virtual_machines_execute_delete( + self, locationparameter: str, request_body: IO[bytes], *, content_type: str = "application/json", **kwargs: Any + ) -> _models.DeleteResourceOperationResponse: + """VirtualMachinesExecuteDelete: Execute delete operation for a batch of virtual machines, this + operation is triggered as soon as Computeschedule receives it. + + :param locationparameter: The location name. Required. + :type locationparameter: str + :param request_body: The request body. Required. + :type request_body: IO[bytes] + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :return: DeleteResourceOperationResponse. The DeleteResourceOperationResponse is compatible + with MutableMapping + :rtype: ~azure.mgmt.computeschedule.models.DeleteResourceOperationResponse + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace + @api_version_validation( + method_added_on="2025-05-01", + params_added_on={ + "2025-05-01": ["api_version", "subscription_id", "locationparameter", "content_type", "accept"] + }, + ) + def virtual_machines_execute_delete( + self, locationparameter: str, request_body: Union[_models.ExecuteDeleteRequest, JSON, IO[bytes]], **kwargs: Any + ) -> _models.DeleteResourceOperationResponse: + """VirtualMachinesExecuteDelete: Execute delete operation for a batch of virtual machines, this + operation is triggered as soon as Computeschedule receives it. + + :param locationparameter: The location name. Required. + :type locationparameter: str + :param request_body: The request body. Is one of the following types: ExecuteDeleteRequest, + JSON, IO[bytes] Required. + :type request_body: ~azure.mgmt.computeschedule.models.ExecuteDeleteRequest or JSON or + IO[bytes] + :return: DeleteResourceOperationResponse. The DeleteResourceOperationResponse is compatible + with MutableMapping + :rtype: ~azure.mgmt.computeschedule.models.DeleteResourceOperationResponse + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = kwargs.pop("params", {}) or {} + + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.DeleteResourceOperationResponse] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _content = None + if isinstance(request_body, (IOBase, bytes)): + _content = request_body + else: + _content = json.dumps(request_body, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore + + _request = build_scheduled_actions_virtual_machines_execute_delete_request( + locationparameter=locationparameter, + subscription_id=self._config.subscription_id, + content_type=content_type, + api_version=self._config.api_version, + content=_content, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _stream = kwargs.pop("stream", False) + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200]: + if _stream: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize(_models.ErrorResponse, response.json()) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if _stream: + deserialized = response.iter_bytes() + else: + deserialized = _deserialize(_models.DeleteResourceOperationResponse, response.json()) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + @overload def virtual_machines_get_operation_status( self, diff --git a/sdk/computeschedule/azure-mgmt-computeschedule/azure/mgmt/computeschedule/operations/_patch.py b/sdk/computeschedule/azure-mgmt-computeschedule/azure/mgmt/computeschedule/operations/_patch.py index f7dd32510333..8bcb627aa475 100644 --- a/sdk/computeschedule/azure-mgmt-computeschedule/azure/mgmt/computeschedule/operations/_patch.py +++ b/sdk/computeschedule/azure-mgmt-computeschedule/azure/mgmt/computeschedule/operations/_patch.py @@ -1,7 +1,8 @@ -# ------------------------------------ -# Copyright (c) Microsoft Corporation. -# Licensed under the MIT License. -# ------------------------------------ +# 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. +# -------------------------------------------------------------------------- """Customize generated code here. Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize diff --git a/sdk/computeschedule/azure-mgmt-computeschedule/generated_samples/operations_list.py b/sdk/computeschedule/azure-mgmt-computeschedule/generated_samples/operations_list_maximum_set_gen.py similarity index 92% rename from sdk/computeschedule/azure-mgmt-computeschedule/generated_samples/operations_list.py rename to sdk/computeschedule/azure-mgmt-computeschedule/generated_samples/operations_list_maximum_set_gen.py index 059c2519b258..588af3782de6 100644 --- a/sdk/computeschedule/azure-mgmt-computeschedule/generated_samples/operations_list.py +++ b/sdk/computeschedule/azure-mgmt-computeschedule/generated_samples/operations_list_maximum_set_gen.py @@ -15,7 +15,7 @@ pip install azure-identity pip install azure-mgmt-computeschedule # USAGE - python operations_list.py + python operations_list_maximum_set_gen.py Before run the sample, please set the values of the client ID, tenant ID and client secret of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, @@ -35,6 +35,6 @@ def main(): print(item) -# x-ms-original-file: 2024-10-01/Operations_List.json +# x-ms-original-file: 2025-05-01/Operations_List_MaximumSet_Gen.json if __name__ == "__main__": main() diff --git a/sdk/computeschedule/azure-mgmt-computeschedule/generated_samples/operations_list_minimum_set_gen.py b/sdk/computeschedule/azure-mgmt-computeschedule/generated_samples/operations_list_minimum_set_gen.py new file mode 100644 index 000000000000..79aa34f4e4a7 --- /dev/null +++ b/sdk/computeschedule/azure-mgmt-computeschedule/generated_samples/operations_list_minimum_set_gen.py @@ -0,0 +1,40 @@ +# 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) Python Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential + +from azure.mgmt.computeschedule import ComputeScheduleMgmtClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-computeschedule +# USAGE + python operations_list_minimum_set_gen.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = ComputeScheduleMgmtClient( + credential=DefaultAzureCredential(), + subscription_id="SUBSCRIPTION_ID", + ) + + response = client.operations.list() + for item in response: + print(item) + + +# x-ms-original-file: 2025-05-01/Operations_List_MinimumSet_Gen.json +if __name__ == "__main__": + main() diff --git a/sdk/computeschedule/azure-mgmt-computeschedule/generated_samples/scheduled_actions_virtual_machines_cancel_operations.py b/sdk/computeschedule/azure-mgmt-computeschedule/generated_samples/scheduled_actions_virtual_machines_cancel_operations_maximum_set_gen.py similarity index 78% rename from sdk/computeschedule/azure-mgmt-computeschedule/generated_samples/scheduled_actions_virtual_machines_cancel_operations.py rename to sdk/computeschedule/azure-mgmt-computeschedule/generated_samples/scheduled_actions_virtual_machines_cancel_operations_maximum_set_gen.py index d91d3e081019..08e9bf9a6050 100644 --- a/sdk/computeschedule/azure-mgmt-computeschedule/generated_samples/scheduled_actions_virtual_machines_cancel_operations.py +++ b/sdk/computeschedule/azure-mgmt-computeschedule/generated_samples/scheduled_actions_virtual_machines_cancel_operations_maximum_set_gen.py @@ -15,7 +15,7 @@ pip install azure-identity pip install azure-mgmt-computeschedule # USAGE - python scheduled_actions_virtual_machines_cancel_operations.py + python scheduled_actions_virtual_machines_cancel_operations_maximum_set_gen.py Before run the sample, please set the values of the client ID, tenant ID and client secret of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, @@ -31,15 +31,12 @@ def main(): ) response = client.scheduled_actions.virtual_machines_cancel_operations( - locationparameter="eastus2euap", - request_body={ - "correlationid": "23480d2f-1dca-4610-afb4-gg25eec1f34r", - "operationIds": ["23480d2f-1dca-4610-afb4-dd25eec1f34r"], - }, + locationparameter="hwrogamrxmqmbhyksvvbpge", + request_body={"correlationid": "lacjacfbxixdmg", "operationIds": ["rcudibq"]}, ) print(response) -# x-ms-original-file: 2024-10-01/ScheduledActions_VirtualMachinesCancelOperations.json +# x-ms-original-file: 2025-05-01/ScheduledActions_VirtualMachinesCancelOperations_MaximumSet_Gen.json if __name__ == "__main__": main() diff --git a/sdk/computeschedule/azure-mgmt-computeschedule/generated_samples/scheduled_actions_virtual_machines_cancel_operations_minimum_set_gen.py b/sdk/computeschedule/azure-mgmt-computeschedule/generated_samples/scheduled_actions_virtual_machines_cancel_operations_minimum_set_gen.py new file mode 100644 index 000000000000..702589eb3603 --- /dev/null +++ b/sdk/computeschedule/azure-mgmt-computeschedule/generated_samples/scheduled_actions_virtual_machines_cancel_operations_minimum_set_gen.py @@ -0,0 +1,42 @@ +# 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) Python Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential + +from azure.mgmt.computeschedule import ComputeScheduleMgmtClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-computeschedule +# USAGE + python scheduled_actions_virtual_machines_cancel_operations_minimum_set_gen.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = ComputeScheduleMgmtClient( + credential=DefaultAzureCredential(), + subscription_id="SUBSCRIPTION_ID", + ) + + response = client.scheduled_actions.virtual_machines_cancel_operations( + locationparameter="pitwczrefdkzfrpphvbqrvbavgnfxl", + request_body={"correlationid": "lacjacfbxixdmg", "operationIds": ["rcudibq"]}, + ) + print(response) + + +# x-ms-original-file: 2025-05-01/ScheduledActions_VirtualMachinesCancelOperations_MinimumSet_Gen.json +if __name__ == "__main__": + main() diff --git a/sdk/computeschedule/azure-mgmt-computeschedule/generated_samples/scheduled_actions_virtual_machines_execute_create_maximum_set_gen.py b/sdk/computeschedule/azure-mgmt-computeschedule/generated_samples/scheduled_actions_virtual_machines_execute_create_maximum_set_gen.py new file mode 100644 index 000000000000..255129a21cfe --- /dev/null +++ b/sdk/computeschedule/azure-mgmt-computeschedule/generated_samples/scheduled_actions_virtual_machines_execute_create_maximum_set_gen.py @@ -0,0 +1,57 @@ +# 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) Python Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential + +from azure.mgmt.computeschedule import ComputeScheduleMgmtClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-computeschedule +# USAGE + python scheduled_actions_virtual_machines_execute_create_maximum_set_gen.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = ComputeScheduleMgmtClient( + credential=DefaultAzureCredential(), + subscription_id="SUBSCRIPTION_ID", + ) + + response = client.scheduled_actions.virtual_machines_execute_create( + locationparameter="nxbiupqfkijjq", + request_body={ + "correlationid": "erpswvxajdpqgxfpgmzy", + "executionParameters": { + "optimizationPreference": "Cost", + "retryPolicy": {"retryCount": 25, "retryWindowInMinutes": 4}, + }, + "resourceConfigParameters": { + "baseProfile": "TG9yZW0gaXBzdW0gZG9sb3Igc2l0IGFtZXQ=", + "resourceCount": 28, + "resourceOverrides": [ + "Y29uc2VjdGV0dXIgYWRpcGlzY2luZyBlbGl0", + "c2VkIGRvIGVpdXNtb2QgdGVtcG9yIGluY2lkaWR1bnQ=", + ], + "resourcePrefix": "rqlxavviucrxfjj", + }, + }, + ) + print(response) + + +# x-ms-original-file: 2025-05-01/ScheduledActions_VirtualMachinesExecuteCreate_MaximumSet_Gen.json +if __name__ == "__main__": + main() diff --git a/sdk/computeschedule/azure-mgmt-computeschedule/generated_samples/scheduled_actions_virtual_machines_execute_create_minimum_set_gen.py b/sdk/computeschedule/azure-mgmt-computeschedule/generated_samples/scheduled_actions_virtual_machines_execute_create_minimum_set_gen.py new file mode 100644 index 000000000000..7a67c6e3469b --- /dev/null +++ b/sdk/computeschedule/azure-mgmt-computeschedule/generated_samples/scheduled_actions_virtual_machines_execute_create_minimum_set_gen.py @@ -0,0 +1,42 @@ +# 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) Python Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential + +from azure.mgmt.computeschedule import ComputeScheduleMgmtClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-computeschedule +# USAGE + python scheduled_actions_virtual_machines_execute_create_minimum_set_gen.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = ComputeScheduleMgmtClient( + credential=DefaultAzureCredential(), + subscription_id="SUBSCRIPTION_ID", + ) + + response = client.scheduled_actions.virtual_machines_execute_create( + locationparameter="aiqyytlqsikciuxzocihxb", + request_body={"executionParameters": {}, "resourceConfigParameters": {"resourceCount": 28}}, + ) + print(response) + + +# x-ms-original-file: 2025-05-01/ScheduledActions_VirtualMachinesExecuteCreate_MinimumSet_Gen.json +if __name__ == "__main__": + main() diff --git a/sdk/computeschedule/azure-mgmt-computeschedule/generated_samples/scheduled_actions_virtual_machines_execute_deallocate_maximum_set_gen.py b/sdk/computeschedule/azure-mgmt-computeschedule/generated_samples/scheduled_actions_virtual_machines_execute_deallocate_maximum_set_gen.py new file mode 100644 index 000000000000..e544cb0910d7 --- /dev/null +++ b/sdk/computeschedule/azure-mgmt-computeschedule/generated_samples/scheduled_actions_virtual_machines_execute_deallocate_maximum_set_gen.py @@ -0,0 +1,54 @@ +# pylint: disable=line-too-long,useless-suppression +# 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) Python Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential + +from azure.mgmt.computeschedule import ComputeScheduleMgmtClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-computeschedule +# USAGE + python scheduled_actions_virtual_machines_execute_deallocate_maximum_set_gen.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = ComputeScheduleMgmtClient( + credential=DefaultAzureCredential(), + subscription_id="SUBSCRIPTION_ID", + ) + + response = client.scheduled_actions.virtual_machines_execute_deallocate( + locationparameter="ykpowbmjexmsv", + request_body={ + "correlationid": "dsszhmrdsczkv", + "executionParameters": { + "optimizationPreference": "Cost", + "retryPolicy": {"retryCount": 25, "retryWindowInMinutes": 4}, + }, + "resources": { + "ids": [ + "/subscriptions/YourSubscriptionId/resourceGroups/YourResourceGroupName/providers/Microsoft.Compute/virtualMachines/testResource3" + ] + }, + }, + ) + print(response) + + +# x-ms-original-file: 2025-05-01/ScheduledActions_VirtualMachinesExecuteDeallocate_MaximumSet_Gen.json +if __name__ == "__main__": + main() diff --git a/sdk/computeschedule/azure-mgmt-computeschedule/generated_samples/scheduled_actions_virtual_machines_execute_deallocate.py b/sdk/computeschedule/azure-mgmt-computeschedule/generated_samples/scheduled_actions_virtual_machines_execute_deallocate_minimum_set_gen.py similarity index 84% rename from sdk/computeschedule/azure-mgmt-computeschedule/generated_samples/scheduled_actions_virtual_machines_execute_deallocate.py rename to sdk/computeschedule/azure-mgmt-computeschedule/generated_samples/scheduled_actions_virtual_machines_execute_deallocate_minimum_set_gen.py index ca2887c4c9d8..273ccbdbfaa3 100644 --- a/sdk/computeschedule/azure-mgmt-computeschedule/generated_samples/scheduled_actions_virtual_machines_execute_deallocate.py +++ b/sdk/computeschedule/azure-mgmt-computeschedule/generated_samples/scheduled_actions_virtual_machines_execute_deallocate_minimum_set_gen.py @@ -1,3 +1,4 @@ +# pylint: disable=line-too-long,useless-suppression # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -15,7 +16,7 @@ pip install azure-identity pip install azure-mgmt-computeschedule # USAGE - python scheduled_actions_virtual_machines_execute_deallocate.py + python scheduled_actions_virtual_machines_execute_deallocate_minimum_set_gen.py Before run the sample, please set the values of the client ID, tenant ID and client secret of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, @@ -31,10 +32,10 @@ def main(): ) response = client.scheduled_actions.virtual_machines_execute_deallocate( - locationparameter="eastus2euap", + locationparameter="bfldnxffvllwvqa", request_body={ - "correlationid": "23480d2f-1dca-4610-afb4-dd25eec1f34r", - "executionParameters": {"retryPolicy": {"retryCount": 4, "retryWindowInMinutes": 27}}, + "correlationid": "dsszhmrdsczkv", + "executionParameters": {}, "resources": { "ids": [ "/subscriptions/YourSubscriptionId/resourceGroups/YourResourceGroupName/providers/Microsoft.Compute/virtualMachines/testResource3" @@ -45,6 +46,6 @@ def main(): print(response) -# x-ms-original-file: 2024-10-01/ScheduledActions_VirtualMachinesExecuteDeallocate.json +# x-ms-original-file: 2025-05-01/ScheduledActions_VirtualMachinesExecuteDeallocate_MinimumSet_Gen.json if __name__ == "__main__": main() diff --git a/sdk/computeschedule/azure-mgmt-computeschedule/generated_samples/scheduled_actions_virtual_machines_execute_delete_maximum_set_gen.py b/sdk/computeschedule/azure-mgmt-computeschedule/generated_samples/scheduled_actions_virtual_machines_execute_delete_maximum_set_gen.py new file mode 100644 index 000000000000..7533afebaaaf --- /dev/null +++ b/sdk/computeschedule/azure-mgmt-computeschedule/generated_samples/scheduled_actions_virtual_machines_execute_delete_maximum_set_gen.py @@ -0,0 +1,55 @@ +# pylint: disable=line-too-long,useless-suppression +# 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) Python Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential + +from azure.mgmt.computeschedule import ComputeScheduleMgmtClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-computeschedule +# USAGE + python scheduled_actions_virtual_machines_execute_delete_maximum_set_gen.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = ComputeScheduleMgmtClient( + credential=DefaultAzureCredential(), + subscription_id="SUBSCRIPTION_ID", + ) + + response = client.scheduled_actions.virtual_machines_execute_delete( + locationparameter="yrngwxkxxxbifqyc", + request_body={ + "correlationid": "lgxsiioaybtjexssjzw", + "executionParameters": { + "optimizationPreference": "Cost", + "retryPolicy": {"retryCount": 25, "retryWindowInMinutes": 4}, + }, + "forceDeletion": True, + "resources": { + "ids": [ + "/subscriptions/YourSubscriptionId/resourceGroups/YourResourceGroupName/providers/Microsoft.Compute/virtualMachines/testResource3" + ] + }, + }, + ) + print(response) + + +# x-ms-original-file: 2025-05-01/ScheduledActions_VirtualMachinesExecuteDelete_MaximumSet_Gen.json +if __name__ == "__main__": + main() diff --git a/sdk/computeschedule/azure-mgmt-computeschedule/generated_samples/scheduled_actions_virtual_machines_execute_delete_minimum_set_gen.py b/sdk/computeschedule/azure-mgmt-computeschedule/generated_samples/scheduled_actions_virtual_machines_execute_delete_minimum_set_gen.py new file mode 100644 index 000000000000..6813b8e83129 --- /dev/null +++ b/sdk/computeschedule/azure-mgmt-computeschedule/generated_samples/scheduled_actions_virtual_machines_execute_delete_minimum_set_gen.py @@ -0,0 +1,50 @@ +# pylint: disable=line-too-long,useless-suppression +# 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) Python Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential + +from azure.mgmt.computeschedule import ComputeScheduleMgmtClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-computeschedule +# USAGE + python scheduled_actions_virtual_machines_execute_delete_minimum_set_gen.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = ComputeScheduleMgmtClient( + credential=DefaultAzureCredential(), + subscription_id="SUBSCRIPTION_ID", + ) + + response = client.scheduled_actions.virtual_machines_execute_delete( + locationparameter="urzqnogieubgnjsyadipeyqegdomtm", + request_body={ + "executionParameters": {}, + "resources": { + "ids": [ + "/subscriptions/YourSubscriptionId/resourceGroups/YourResourceGroupName/providers/Microsoft.Compute/virtualMachines/testResource3" + ] + }, + }, + ) + print(response) + + +# x-ms-original-file: 2025-05-01/ScheduledActions_VirtualMachinesExecuteDelete_MinimumSet_Gen.json +if __name__ == "__main__": + main() diff --git a/sdk/computeschedule/azure-mgmt-computeschedule/generated_samples/scheduled_actions_virtual_machines_execute_hibernate_maximum_set_gen.py b/sdk/computeschedule/azure-mgmt-computeschedule/generated_samples/scheduled_actions_virtual_machines_execute_hibernate_maximum_set_gen.py new file mode 100644 index 000000000000..f7683232fb6d --- /dev/null +++ b/sdk/computeschedule/azure-mgmt-computeschedule/generated_samples/scheduled_actions_virtual_machines_execute_hibernate_maximum_set_gen.py @@ -0,0 +1,54 @@ +# pylint: disable=line-too-long,useless-suppression +# 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) Python Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential + +from azure.mgmt.computeschedule import ComputeScheduleMgmtClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-computeschedule +# USAGE + python scheduled_actions_virtual_machines_execute_hibernate_maximum_set_gen.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = ComputeScheduleMgmtClient( + credential=DefaultAzureCredential(), + subscription_id="SUBSCRIPTION_ID", + ) + + response = client.scheduled_actions.virtual_machines_execute_hibernate( + locationparameter="aojgnzdqrphhygchir", + request_body={ + "correlationid": "jmdiz", + "executionParameters": { + "optimizationPreference": "Cost", + "retryPolicy": {"retryCount": 25, "retryWindowInMinutes": 4}, + }, + "resources": { + "ids": [ + "/subscriptions/YourSubscriptionId/resourceGroups/YourResourceGroupName/providers/Microsoft.Compute/virtualMachines/testResource3" + ] + }, + }, + ) + print(response) + + +# x-ms-original-file: 2025-05-01/ScheduledActions_VirtualMachinesExecuteHibernate_MaximumSet_Gen.json +if __name__ == "__main__": + main() diff --git a/sdk/computeschedule/azure-mgmt-computeschedule/generated_samples/scheduled_actions_virtual_machines_execute_hibernate.py b/sdk/computeschedule/azure-mgmt-computeschedule/generated_samples/scheduled_actions_virtual_machines_execute_hibernate_minimum_set_gen.py similarity index 81% rename from sdk/computeschedule/azure-mgmt-computeschedule/generated_samples/scheduled_actions_virtual_machines_execute_hibernate.py rename to sdk/computeschedule/azure-mgmt-computeschedule/generated_samples/scheduled_actions_virtual_machines_execute_hibernate_minimum_set_gen.py index b83004f355c8..498889459702 100644 --- a/sdk/computeschedule/azure-mgmt-computeschedule/generated_samples/scheduled_actions_virtual_machines_execute_hibernate.py +++ b/sdk/computeschedule/azure-mgmt-computeschedule/generated_samples/scheduled_actions_virtual_machines_execute_hibernate_minimum_set_gen.py @@ -1,3 +1,4 @@ +# pylint: disable=line-too-long,useless-suppression # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -15,7 +16,7 @@ pip install azure-identity pip install azure-mgmt-computeschedule # USAGE - python scheduled_actions_virtual_machines_execute_hibernate.py + python scheduled_actions_virtual_machines_execute_hibernate_minimum_set_gen.py Before run the sample, please set the values of the client ID, tenant ID and client secret of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, @@ -31,10 +32,10 @@ def main(): ) response = client.scheduled_actions.virtual_machines_execute_hibernate( - locationparameter="eastus2euap", + locationparameter="gmflbqliyjrhmrjvqrxrgocbxzjr", request_body={ - "correlationid": "23480d2f-1dca-4610-afb4-dd25eec1f34r", - "executionParameters": {"retryPolicy": {"retryCount": 5, "retryWindowInMinutes": 27}}, + "correlationid": "jmdiz", + "executionParameters": {}, "resources": { "ids": [ "/subscriptions/YourSubscriptionId/resourceGroups/YourResourceGroupName/providers/Microsoft.Compute/virtualMachines/testResource3" @@ -45,6 +46,6 @@ def main(): print(response) -# x-ms-original-file: 2024-10-01/ScheduledActions_VirtualMachinesExecuteHibernate.json +# x-ms-original-file: 2025-05-01/ScheduledActions_VirtualMachinesExecuteHibernate_MinimumSet_Gen.json if __name__ == "__main__": main() diff --git a/sdk/computeschedule/azure-mgmt-computeschedule/generated_samples/scheduled_actions_virtual_machines_execute_start_maximum_set_gen.py b/sdk/computeschedule/azure-mgmt-computeschedule/generated_samples/scheduled_actions_virtual_machines_execute_start_maximum_set_gen.py new file mode 100644 index 000000000000..f198d04cd1ad --- /dev/null +++ b/sdk/computeschedule/azure-mgmt-computeschedule/generated_samples/scheduled_actions_virtual_machines_execute_start_maximum_set_gen.py @@ -0,0 +1,54 @@ +# pylint: disable=line-too-long,useless-suppression +# 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) Python Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential + +from azure.mgmt.computeschedule import ComputeScheduleMgmtClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-computeschedule +# USAGE + python scheduled_actions_virtual_machines_execute_start_maximum_set_gen.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = ComputeScheduleMgmtClient( + credential=DefaultAzureCredential(), + subscription_id="SUBSCRIPTION_ID", + ) + + response = client.scheduled_actions.virtual_machines_execute_start( + locationparameter="jwybvpf", + request_body={ + "correlationid": "vwpcrwowcfgjuwnxzvvdma", + "executionParameters": { + "optimizationPreference": "Cost", + "retryPolicy": {"retryCount": 25, "retryWindowInMinutes": 4}, + }, + "resources": { + "ids": [ + "/subscriptions/YourSubscriptionId/resourceGroups/YourResourceGroupName/providers/Microsoft.Compute/virtualMachines/testResource3" + ] + }, + }, + ) + print(response) + + +# x-ms-original-file: 2025-05-01/ScheduledActions_VirtualMachinesExecuteStart_MaximumSet_Gen.json +if __name__ == "__main__": + main() diff --git a/sdk/computeschedule/azure-mgmt-computeschedule/generated_samples/scheduled_actions_virtual_machines_execute_start.py b/sdk/computeschedule/azure-mgmt-computeschedule/generated_samples/scheduled_actions_virtual_machines_execute_start_minimum_set_gen.py similarity index 81% rename from sdk/computeschedule/azure-mgmt-computeschedule/generated_samples/scheduled_actions_virtual_machines_execute_start.py rename to sdk/computeschedule/azure-mgmt-computeschedule/generated_samples/scheduled_actions_virtual_machines_execute_start_minimum_set_gen.py index ab3af28b87a9..2c9df9a3bdb1 100644 --- a/sdk/computeschedule/azure-mgmt-computeschedule/generated_samples/scheduled_actions_virtual_machines_execute_start.py +++ b/sdk/computeschedule/azure-mgmt-computeschedule/generated_samples/scheduled_actions_virtual_machines_execute_start_minimum_set_gen.py @@ -1,3 +1,4 @@ +# pylint: disable=line-too-long,useless-suppression # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -15,7 +16,7 @@ pip install azure-identity pip install azure-mgmt-computeschedule # USAGE - python scheduled_actions_virtual_machines_execute_start.py + python scheduled_actions_virtual_machines_execute_start_minimum_set_gen.py Before run the sample, please set the values of the client ID, tenant ID and client secret of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, @@ -31,10 +32,10 @@ def main(): ) response = client.scheduled_actions.virtual_machines_execute_start( - locationparameter="eastus2euap", + locationparameter="ksfzuak", request_body={ - "correlationid": "23480d2f-1dca-4610-afb4-dd25eec1f34r", - "executionParameters": {"retryPolicy": {"retryCount": 2, "retryWindowInMinutes": 27}}, + "correlationid": "vwpcrwowcfgjuwnxzvvdma", + "executionParameters": {}, "resources": { "ids": [ "/subscriptions/YourSubscriptionId/resourceGroups/YourResourceGroupName/providers/Microsoft.Compute/virtualMachines/testResource3" @@ -45,6 +46,6 @@ def main(): print(response) -# x-ms-original-file: 2024-10-01/ScheduledActions_VirtualMachinesExecuteStart.json +# x-ms-original-file: 2025-05-01/ScheduledActions_VirtualMachinesExecuteStart_MinimumSet_Gen.json if __name__ == "__main__": main() diff --git a/sdk/computeschedule/azure-mgmt-computeschedule/generated_samples/scheduled_actions_virtual_machines_get_operation_errors_maximum_set_gen.py b/sdk/computeschedule/azure-mgmt-computeschedule/generated_samples/scheduled_actions_virtual_machines_get_operation_errors_maximum_set_gen.py new file mode 100644 index 000000000000..72d0afd16a04 --- /dev/null +++ b/sdk/computeschedule/azure-mgmt-computeschedule/generated_samples/scheduled_actions_virtual_machines_get_operation_errors_maximum_set_gen.py @@ -0,0 +1,42 @@ +# 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) Python Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential + +from azure.mgmt.computeschedule import ComputeScheduleMgmtClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-computeschedule +# USAGE + python scheduled_actions_virtual_machines_get_operation_errors_maximum_set_gen.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = ComputeScheduleMgmtClient( + credential=DefaultAzureCredential(), + subscription_id="SUBSCRIPTION_ID", + ) + + response = client.scheduled_actions.virtual_machines_get_operation_errors( + locationparameter="paluwjjcxtjeozpoxrnstls", + request_body={"operationIds": ["ksufjznokhsbowdupyt"]}, + ) + print(response) + + +# x-ms-original-file: 2025-05-01/ScheduledActions_VirtualMachinesGetOperationErrors_MaximumSet_Gen.json +if __name__ == "__main__": + main() diff --git a/sdk/computeschedule/azure-mgmt-computeschedule/generated_samples/scheduled_actions_virtual_machines_get_operation_errors.py b/sdk/computeschedule/azure-mgmt-computeschedule/generated_samples/scheduled_actions_virtual_machines_get_operation_errors_minimum_set_gen.py similarity index 85% rename from sdk/computeschedule/azure-mgmt-computeschedule/generated_samples/scheduled_actions_virtual_machines_get_operation_errors.py rename to sdk/computeschedule/azure-mgmt-computeschedule/generated_samples/scheduled_actions_virtual_machines_get_operation_errors_minimum_set_gen.py index 52b7eae34cdc..bdac9fa4e91e 100644 --- a/sdk/computeschedule/azure-mgmt-computeschedule/generated_samples/scheduled_actions_virtual_machines_get_operation_errors.py +++ b/sdk/computeschedule/azure-mgmt-computeschedule/generated_samples/scheduled_actions_virtual_machines_get_operation_errors_minimum_set_gen.py @@ -15,7 +15,7 @@ pip install azure-identity pip install azure-mgmt-computeschedule # USAGE - python scheduled_actions_virtual_machines_get_operation_errors.py + python scheduled_actions_virtual_machines_get_operation_errors_minimum_set_gen.py Before run the sample, please set the values of the client ID, tenant ID and client secret of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, @@ -31,12 +31,12 @@ def main(): ) response = client.scheduled_actions.virtual_machines_get_operation_errors( - locationparameter="eastus2euap", - request_body={"operationIds": ["23480d2f-1dca-4610-afb4-dd25eec1f34r"]}, + locationparameter="nqwtkslhoamsmxucgbljcz", + request_body={"operationIds": ["ksufjznokhsbowdupyt"]}, ) print(response) -# x-ms-original-file: 2024-10-01/ScheduledActions_VirtualMachinesGetOperationErrors.json +# x-ms-original-file: 2025-05-01/ScheduledActions_VirtualMachinesGetOperationErrors_MinimumSet_Gen.json if __name__ == "__main__": main() diff --git a/sdk/computeschedule/azure-mgmt-computeschedule/generated_samples/scheduled_actions_virtual_machines_get_operation_status.py b/sdk/computeschedule/azure-mgmt-computeschedule/generated_samples/scheduled_actions_virtual_machines_get_operation_status_maximum_set_gen.py similarity index 82% rename from sdk/computeschedule/azure-mgmt-computeschedule/generated_samples/scheduled_actions_virtual_machines_get_operation_status.py rename to sdk/computeschedule/azure-mgmt-computeschedule/generated_samples/scheduled_actions_virtual_machines_get_operation_status_maximum_set_gen.py index 71cbcaaac628..1c15e5285841 100644 --- a/sdk/computeschedule/azure-mgmt-computeschedule/generated_samples/scheduled_actions_virtual_machines_get_operation_status.py +++ b/sdk/computeschedule/azure-mgmt-computeschedule/generated_samples/scheduled_actions_virtual_machines_get_operation_status_maximum_set_gen.py @@ -15,7 +15,7 @@ pip install azure-identity pip install azure-mgmt-computeschedule # USAGE - python scheduled_actions_virtual_machines_get_operation_status.py + python scheduled_actions_virtual_machines_get_operation_status_maximum_set_gen.py Before run the sample, please set the values of the client ID, tenant ID and client secret of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, @@ -31,15 +31,12 @@ def main(): ) response = client.scheduled_actions.virtual_machines_get_operation_status( - locationparameter="eastus2euap", - request_body={ - "correlationid": "35780d2f-1dca-4610-afb4-dd25eec1f34r", - "operationIds": ["23480d2f-1dca-4610-afb4-dd25eec1f34r"], - }, + locationparameter="xzbxygykutmvmxpfowdai", + request_body={"correlationid": "jtlszorevrftvfhnqoxlwpiwcbmj", "operationIds": ["hswzfrierpxdgcuu"]}, ) print(response) -# x-ms-original-file: 2024-10-01/ScheduledActions_VirtualMachinesGetOperationStatus.json +# x-ms-original-file: 2025-05-01/ScheduledActions_VirtualMachinesGetOperationStatus_MaximumSet_Gen.json if __name__ == "__main__": main() diff --git a/sdk/computeschedule/azure-mgmt-computeschedule/generated_samples/scheduled_actions_virtual_machines_get_operation_status_minimum_set_gen.py b/sdk/computeschedule/azure-mgmt-computeschedule/generated_samples/scheduled_actions_virtual_machines_get_operation_status_minimum_set_gen.py new file mode 100644 index 000000000000..8363e1d03b4b --- /dev/null +++ b/sdk/computeschedule/azure-mgmt-computeschedule/generated_samples/scheduled_actions_virtual_machines_get_operation_status_minimum_set_gen.py @@ -0,0 +1,42 @@ +# 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) Python Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential + +from azure.mgmt.computeschedule import ComputeScheduleMgmtClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-computeschedule +# USAGE + python scheduled_actions_virtual_machines_get_operation_status_minimum_set_gen.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = ComputeScheduleMgmtClient( + credential=DefaultAzureCredential(), + subscription_id="SUBSCRIPTION_ID", + ) + + response = client.scheduled_actions.virtual_machines_get_operation_status( + locationparameter="egz", + request_body={"correlationid": "jtlszorevrftvfhnqoxlwpiwcbmj", "operationIds": ["hswzfrierpxdgcuu"]}, + ) + print(response) + + +# x-ms-original-file: 2025-05-01/ScheduledActions_VirtualMachinesGetOperationStatus_MinimumSet_Gen.json +if __name__ == "__main__": + main() diff --git a/sdk/computeschedule/azure-mgmt-computeschedule/generated_samples/scheduled_actions_virtual_machines_submit_deallocate_maximum_set_gen.py b/sdk/computeschedule/azure-mgmt-computeschedule/generated_samples/scheduled_actions_virtual_machines_submit_deallocate_maximum_set_gen.py new file mode 100644 index 000000000000..c56927172941 --- /dev/null +++ b/sdk/computeschedule/azure-mgmt-computeschedule/generated_samples/scheduled_actions_virtual_machines_submit_deallocate_maximum_set_gen.py @@ -0,0 +1,61 @@ +# pylint: disable=line-too-long,useless-suppression +# 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) Python Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential + +from azure.mgmt.computeschedule import ComputeScheduleMgmtClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-computeschedule +# USAGE + python scheduled_actions_virtual_machines_submit_deallocate_maximum_set_gen.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = ComputeScheduleMgmtClient( + credential=DefaultAzureCredential(), + subscription_id="SUBSCRIPTION_ID", + ) + + response = client.scheduled_actions.virtual_machines_submit_deallocate( + locationparameter="mqlftjjfnzubxpricsgstgjojaoah", + request_body={ + "correlationid": "evmwonebfzxenjdpucgcwdjdya", + "executionParameters": { + "optimizationPreference": "Cost", + "retryPolicy": {"retryCount": 25, "retryWindowInMinutes": 4}, + }, + "resources": { + "ids": [ + "/subscriptions/YourSubscriptionId/resourceGroups/YourResourceGroupName/providers/Microsoft.Compute/virtualMachines/testResource3" + ] + }, + "schedule": { + "deadLine": "2025-04-15T19:47:04.403Z", + "deadline": "2025-04-15T19:47:04.403Z", + "deadlineType": "Unknown", + "timeZone": "upnmayfebiadztdktxzq", + "timezone": "qacufsmctpgjozovlsihrzoctatcsj", + }, + }, + ) + print(response) + + +# x-ms-original-file: 2025-05-01/ScheduledActions_VirtualMachinesSubmitDeallocate_MaximumSet_Gen.json +if __name__ == "__main__": + main() diff --git a/sdk/computeschedule/azure-mgmt-computeschedule/generated_samples/scheduled_actions_virtual_machines_submit_deallocate.py b/sdk/computeschedule/azure-mgmt-computeschedule/generated_samples/scheduled_actions_virtual_machines_submit_deallocate_minimum_set_gen.py similarity index 77% rename from sdk/computeschedule/azure-mgmt-computeschedule/generated_samples/scheduled_actions_virtual_machines_submit_deallocate.py rename to sdk/computeschedule/azure-mgmt-computeschedule/generated_samples/scheduled_actions_virtual_machines_submit_deallocate_minimum_set_gen.py index 577024f94eec..5649430f0442 100644 --- a/sdk/computeschedule/azure-mgmt-computeschedule/generated_samples/scheduled_actions_virtual_machines_submit_deallocate.py +++ b/sdk/computeschedule/azure-mgmt-computeschedule/generated_samples/scheduled_actions_virtual_machines_submit_deallocate_minimum_set_gen.py @@ -1,3 +1,4 @@ +# pylint: disable=line-too-long,useless-suppression # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -15,7 +16,7 @@ pip install azure-identity pip install azure-mgmt-computeschedule # USAGE - python scheduled_actions_virtual_machines_submit_deallocate.py + python scheduled_actions_virtual_machines_submit_deallocate_minimum_set_gen.py Before run the sample, please set the values of the client ID, tenant ID and client secret of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, @@ -31,21 +32,21 @@ def main(): ) response = client.scheduled_actions.virtual_machines_submit_deallocate( - locationparameter="eastus2euap", + locationparameter="xrcabowpojl", request_body={ - "correlationid": "23480d2f-1dca-4610-afb4-dd25eec1f34r", - "executionParameters": {"retryPolicy": {"retryCount": 4, "retryWindowInMinutes": 27}}, + "correlationid": "evmwonebfzxenjdpucgcwdjdya", + "executionParameters": {}, "resources": { "ids": [ "/subscriptions/YourSubscriptionId/resourceGroups/YourResourceGroupName/providers/Microsoft.Compute/virtualMachines/testResource3" ] }, - "schedule": {"deadline": "2024-11-01T17:52:54.215Z", "deadlineType": "InitiateAt", "timezone": "UTC"}, + "schedule": {"deadlineType": "Unknown"}, }, ) print(response) -# x-ms-original-file: 2024-10-01/ScheduledActions_VirtualMachinesSubmitDeallocate.json +# x-ms-original-file: 2025-05-01/ScheduledActions_VirtualMachinesSubmitDeallocate_MinimumSet_Gen.json if __name__ == "__main__": main() diff --git a/sdk/computeschedule/azure-mgmt-computeschedule/generated_samples/scheduled_actions_virtual_machines_submit_hibernate_maximum_set_gen.py b/sdk/computeschedule/azure-mgmt-computeschedule/generated_samples/scheduled_actions_virtual_machines_submit_hibernate_maximum_set_gen.py new file mode 100644 index 000000000000..36b781900b7a --- /dev/null +++ b/sdk/computeschedule/azure-mgmt-computeschedule/generated_samples/scheduled_actions_virtual_machines_submit_hibernate_maximum_set_gen.py @@ -0,0 +1,61 @@ +# pylint: disable=line-too-long,useless-suppression +# 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) Python Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential + +from azure.mgmt.computeschedule import ComputeScheduleMgmtClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-computeschedule +# USAGE + python scheduled_actions_virtual_machines_submit_hibernate_maximum_set_gen.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = ComputeScheduleMgmtClient( + credential=DefaultAzureCredential(), + subscription_id="SUBSCRIPTION_ID", + ) + + response = client.scheduled_actions.virtual_machines_submit_hibernate( + locationparameter="hiceqzwkjmijxdfw", + request_body={ + "correlationid": "htqivutynuoslvbp", + "executionParameters": { + "optimizationPreference": "Cost", + "retryPolicy": {"retryCount": 25, "retryWindowInMinutes": 4}, + }, + "resources": { + "ids": [ + "/subscriptions/YourSubscriptionId/resourceGroups/YourResourceGroupName/providers/Microsoft.Compute/virtualMachines/testResource3" + ] + }, + "schedule": { + "deadLine": "2025-04-15T19:47:04.403Z", + "deadline": "2025-04-15T19:47:04.403Z", + "deadlineType": "Unknown", + "timeZone": "upnmayfebiadztdktxzq", + "timezone": "qacufsmctpgjozovlsihrzoctatcsj", + }, + }, + ) + print(response) + + +# x-ms-original-file: 2025-05-01/ScheduledActions_VirtualMachinesSubmitHibernate_MaximumSet_Gen.json +if __name__ == "__main__": + main() diff --git a/sdk/computeschedule/azure-mgmt-computeschedule/generated_samples/scheduled_actions_virtual_machines_submit_hibernate.py b/sdk/computeschedule/azure-mgmt-computeschedule/generated_samples/scheduled_actions_virtual_machines_submit_hibernate_minimum_set_gen.py similarity index 77% rename from sdk/computeschedule/azure-mgmt-computeschedule/generated_samples/scheduled_actions_virtual_machines_submit_hibernate.py rename to sdk/computeschedule/azure-mgmt-computeschedule/generated_samples/scheduled_actions_virtual_machines_submit_hibernate_minimum_set_gen.py index 3df671ad7099..4c05a6b4cc7f 100644 --- a/sdk/computeschedule/azure-mgmt-computeschedule/generated_samples/scheduled_actions_virtual_machines_submit_hibernate.py +++ b/sdk/computeschedule/azure-mgmt-computeschedule/generated_samples/scheduled_actions_virtual_machines_submit_hibernate_minimum_set_gen.py @@ -1,3 +1,4 @@ +# pylint: disable=line-too-long,useless-suppression # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -15,7 +16,7 @@ pip install azure-identity pip install azure-mgmt-computeschedule # USAGE - python scheduled_actions_virtual_machines_submit_hibernate.py + python scheduled_actions_virtual_machines_submit_hibernate_minimum_set_gen.py Before run the sample, please set the values of the client ID, tenant ID and client secret of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, @@ -31,21 +32,21 @@ def main(): ) response = client.scheduled_actions.virtual_machines_submit_hibernate( - locationparameter="eastus2euap", + locationparameter="jsbmestfaqxxejcgrs", request_body={ - "correlationid": "23480d2f-1dca-4610-afb4-dd25eec1f34r", - "executionParameters": {"retryPolicy": {"retryCount": 2, "retryWindowInMinutes": 27}}, + "correlationid": "htqivutynuoslvbp", + "executionParameters": {}, "resources": { "ids": [ "/subscriptions/YourSubscriptionId/resourceGroups/YourResourceGroupName/providers/Microsoft.Compute/virtualMachines/testResource3" ] }, - "schedule": {"deadline": "2024-11-01T17:52:54.215Z", "deadlineType": "InitiateAt", "timezone": "UTC"}, + "schedule": {"deadlineType": "Unknown"}, }, ) print(response) -# x-ms-original-file: 2024-10-01/ScheduledActions_VirtualMachinesSubmitHibernate.json +# x-ms-original-file: 2025-05-01/ScheduledActions_VirtualMachinesSubmitHibernate_MinimumSet_Gen.json if __name__ == "__main__": main() diff --git a/sdk/computeschedule/azure-mgmt-computeschedule/generated_samples/scheduled_actions_virtual_machines_submit_start_maximum_set_gen.py b/sdk/computeschedule/azure-mgmt-computeschedule/generated_samples/scheduled_actions_virtual_machines_submit_start_maximum_set_gen.py new file mode 100644 index 000000000000..e7e9dcf61370 --- /dev/null +++ b/sdk/computeschedule/azure-mgmt-computeschedule/generated_samples/scheduled_actions_virtual_machines_submit_start_maximum_set_gen.py @@ -0,0 +1,61 @@ +# pylint: disable=line-too-long,useless-suppression +# 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) Python Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential + +from azure.mgmt.computeschedule import ComputeScheduleMgmtClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-computeschedule +# USAGE + python scheduled_actions_virtual_machines_submit_start_maximum_set_gen.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = ComputeScheduleMgmtClient( + credential=DefaultAzureCredential(), + subscription_id="SUBSCRIPTION_ID", + ) + + response = client.scheduled_actions.virtual_machines_submit_start( + locationparameter="klvdoznxekrxhuvgeels", + request_body={ + "correlationid": "bvmpxvbd", + "executionParameters": { + "optimizationPreference": "Cost", + "retryPolicy": {"retryCount": 25, "retryWindowInMinutes": 4}, + }, + "resources": { + "ids": [ + "/subscriptions/YourSubscriptionId/resourceGroups/YourResourceGroupName/providers/Microsoft.Compute/virtualMachines/testResource3" + ] + }, + "schedule": { + "deadLine": "2025-04-15T19:47:04.403Z", + "deadline": "2025-04-15T19:47:04.403Z", + "deadlineType": "Unknown", + "timeZone": "upnmayfebiadztdktxzq", + "timezone": "qacufsmctpgjozovlsihrzoctatcsj", + }, + }, + ) + print(response) + + +# x-ms-original-file: 2025-05-01/ScheduledActions_VirtualMachinesSubmitStart_MaximumSet_Gen.json +if __name__ == "__main__": + main() diff --git a/sdk/computeschedule/azure-mgmt-computeschedule/generated_samples/scheduled_actions_virtual_machines_submit_start.py b/sdk/computeschedule/azure-mgmt-computeschedule/generated_samples/scheduled_actions_virtual_machines_submit_start_minimum_set_gen.py similarity index 77% rename from sdk/computeschedule/azure-mgmt-computeschedule/generated_samples/scheduled_actions_virtual_machines_submit_start.py rename to sdk/computeschedule/azure-mgmt-computeschedule/generated_samples/scheduled_actions_virtual_machines_submit_start_minimum_set_gen.py index 46a5ffe7df18..e1f8fcb297d6 100644 --- a/sdk/computeschedule/azure-mgmt-computeschedule/generated_samples/scheduled_actions_virtual_machines_submit_start.py +++ b/sdk/computeschedule/azure-mgmt-computeschedule/generated_samples/scheduled_actions_virtual_machines_submit_start_minimum_set_gen.py @@ -1,3 +1,4 @@ +# pylint: disable=line-too-long,useless-suppression # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -15,7 +16,7 @@ pip install azure-identity pip install azure-mgmt-computeschedule # USAGE - python scheduled_actions_virtual_machines_submit_start.py + python scheduled_actions_virtual_machines_submit_start_minimum_set_gen.py Before run the sample, please set the values of the client ID, tenant ID and client secret of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, @@ -31,21 +32,21 @@ def main(): ) response = client.scheduled_actions.virtual_machines_submit_start( - locationparameter="eastus2euap", + locationparameter="rbsdwsfprygqqwqhwapovusm", request_body={ - "correlationid": "23480d2f-1dca-4610-afb4-dd25eec1f34r", - "executionParameters": {"retryPolicy": {"retryCount": 5, "retryWindowInMinutes": 27}}, + "correlationid": "bvmpxvbd", + "executionParameters": {}, "resources": { "ids": [ "/subscriptions/YourSubscriptionId/resourceGroups/YourResourceGroupName/providers/Microsoft.Compute/virtualMachines/testResource3" ] }, - "schedule": {"deadline": "2024-11-01T17:52:54.215Z", "deadlineType": "InitiateAt", "timezone": "UTC"}, + "schedule": {"deadlineType": "Unknown"}, }, ) print(response) -# x-ms-original-file: 2024-10-01/ScheduledActions_VirtualMachinesSubmitStart.json +# x-ms-original-file: 2025-05-01/ScheduledActions_VirtualMachinesSubmitStart_MinimumSet_Gen.json if __name__ == "__main__": main() diff --git a/sdk/computeschedule/azure-mgmt-computeschedule/generated_tests/test_compute_schedule_mgmt_scheduled_actions_operations.py b/sdk/computeschedule/azure-mgmt-computeschedule/generated_tests/test_compute_schedule_mgmt_scheduled_actions_operations.py index 06ea32cbb288..dcb48840aa83 100644 --- a/sdk/computeschedule/azure-mgmt-computeschedule/generated_tests/test_compute_schedule_mgmt_scheduled_actions_operations.py +++ b/sdk/computeschedule/azure-mgmt-computeschedule/generated_tests/test_compute_schedule_mgmt_scheduled_actions_operations.py @@ -147,6 +147,48 @@ def test_scheduled_actions_virtual_machines_execute_start(self, resource_group): # please add some check logic here by yourself # ... + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_scheduled_actions_virtual_machines_execute_create(self, resource_group): + response = self.client.scheduled_actions.virtual_machines_execute_create( + locationparameter="str", + request_body={ + "executionParameters": { + "optimizationPreference": "str", + "retryPolicy": {"retryCount": 0, "retryWindowInMinutes": 0}, + }, + "resourceConfigParameters": { + "resourceCount": 0, + "baseProfile": bytes("bytes", encoding="utf-8"), + "resourceOverrides": [bytes("bytes", encoding="utf-8")], + "resourcePrefix": "str", + }, + "correlationid": "str", + }, + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_scheduled_actions_virtual_machines_execute_delete(self, resource_group): + response = self.client.scheduled_actions.virtual_machines_execute_delete( + locationparameter="str", + request_body={ + "executionParameters": { + "optimizationPreference": "str", + "retryPolicy": {"retryCount": 0, "retryWindowInMinutes": 0}, + }, + "resources": {"ids": ["str"]}, + "correlationid": "str", + "forceDeletion": bool, + }, + ) + + # please add some check logic here by yourself + # ... + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy def test_scheduled_actions_virtual_machines_get_operation_status(self, resource_group): diff --git a/sdk/computeschedule/azure-mgmt-computeschedule/generated_tests/test_compute_schedule_mgmt_scheduled_actions_operations_async.py b/sdk/computeschedule/azure-mgmt-computeschedule/generated_tests/test_compute_schedule_mgmt_scheduled_actions_operations_async.py index 67c11fba2ac7..4f3a6b44a934 100644 --- a/sdk/computeschedule/azure-mgmt-computeschedule/generated_tests/test_compute_schedule_mgmt_scheduled_actions_operations_async.py +++ b/sdk/computeschedule/azure-mgmt-computeschedule/generated_tests/test_compute_schedule_mgmt_scheduled_actions_operations_async.py @@ -148,6 +148,48 @@ async def test_scheduled_actions_virtual_machines_execute_start(self, resource_g # please add some check logic here by yourself # ... + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_scheduled_actions_virtual_machines_execute_create(self, resource_group): + response = await self.client.scheduled_actions.virtual_machines_execute_create( + locationparameter="str", + request_body={ + "executionParameters": { + "optimizationPreference": "str", + "retryPolicy": {"retryCount": 0, "retryWindowInMinutes": 0}, + }, + "resourceConfigParameters": { + "resourceCount": 0, + "baseProfile": bytes("bytes", encoding="utf-8"), + "resourceOverrides": [bytes("bytes", encoding="utf-8")], + "resourcePrefix": "str", + }, + "correlationid": "str", + }, + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_scheduled_actions_virtual_machines_execute_delete(self, resource_group): + response = await self.client.scheduled_actions.virtual_machines_execute_delete( + locationparameter="str", + request_body={ + "executionParameters": { + "optimizationPreference": "str", + "retryPolicy": {"retryCount": 0, "retryWindowInMinutes": 0}, + }, + "resources": {"ids": ["str"]}, + "correlationid": "str", + "forceDeletion": bool, + }, + ) + + # please add some check logic here by yourself + # ... + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy_async async def test_scheduled_actions_virtual_machines_get_operation_status(self, resource_group): diff --git a/sdk/computeschedule/azure-mgmt-computeschedule/setup.py b/sdk/computeschedule/azure-mgmt-computeschedule/setup.py index ae424006c223..d96096098a80 100644 --- a/sdk/computeschedule/azure-mgmt-computeschedule/setup.py +++ b/sdk/computeschedule/azure-mgmt-computeschedule/setup.py @@ -53,7 +53,6 @@ "Programming Language :: Python", "Programming Language :: Python :: 3 :: Only", "Programming Language :: Python :: 3", - "Programming Language :: Python :: 3.8", "Programming Language :: Python :: 3.9", "Programming Language :: Python :: 3.10", "Programming Language :: Python :: 3.11", @@ -77,7 +76,7 @@ "isodate>=0.6.1", "typing-extensions>=4.6.0", "azure-common>=1.1", - "azure-mgmt-core>=1.3.2", + "azure-mgmt-core>=1.5.0", ], - python_requires=">=3.8", + python_requires=">=3.9", ) diff --git a/sdk/computeschedule/azure-mgmt-computeschedule/tsp-location.yaml b/sdk/computeschedule/azure-mgmt-computeschedule/tsp-location.yaml index 335977793938..78aba01d2fec 100644 --- a/sdk/computeschedule/azure-mgmt-computeschedule/tsp-location.yaml +++ b/sdk/computeschedule/azure-mgmt-computeschedule/tsp-location.yaml @@ -1,4 +1,4 @@ directory: specification/computeschedule/ComputeSchedule.Management -commit: b6075dbc2321933382ea91c787ee62c6bdb87e5d +commit: 88d4bd5b8ba24d0a1ea4c1fdd0e19820201d242a repo: Azure/azure-rest-api-specs additionalDirectories: