From 13d75f5c37a357b26f2d2774d2c6c4b7670d56f4 Mon Sep 17 00:00:00 2001 From: Azure SDK Bot Date: Fri, 20 Sep 2019 21:36:19 +0000 Subject: [PATCH 1/2] Generated from 1e627820ff9179100c19a8f8ef173c90b41ac843 Add diskEncryptionSet in swagger compute-2019-07 --- .../compute/_compute_management_client.py | 10 +- .../azure/mgmt/compute/models.py | 1 + .../v2019_03_01/_compute_management_client.py | 10 - .../compute/v2019_03_01/models/__init__.py | 61 -- .../_compute_management_client_enums.py | 49 -- .../compute/v2019_03_01/models/_models.py | 668 ---------------- .../compute/v2019_03_01/models/_models_py3.py | 668 ---------------- .../v2019_03_01/models/_paged_models.py | 26 - .../v2019_03_01/operations/__init__.py | 4 - .../operations/_disks_operations.py | 727 ------------------ .../operations/_snapshots_operations.py | 727 ------------------ .../operations/_resource_skus_operations.py | 6 +- 12 files changed, 4 insertions(+), 2953 deletions(-) delete mode 100644 sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2019_03_01/operations/_disks_operations.py delete mode 100644 sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2019_03_01/operations/_snapshots_operations.py diff --git a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/_compute_management_client.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/_compute_management_client.py index 1ddafa5eec7f..fff1dac32a53 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/_compute_management_client.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/_compute_management_client.py @@ -54,13 +54,13 @@ class ComputeManagementClient(MultiApiClientMixin, SDKClient): 'availability_sets': '2019-03-01', 'dedicated_host_groups': '2019-03-01', 'dedicated_hosts': '2019-03-01', - 'disks': '2019-03-01', + 'disks': '2018-09-30', 'images': '2019-03-01', 'log_analytics': '2019-03-01', 'operations': '2019-03-01', 'proximity_placement_groups': '2019-03-01', 'resource_skus': '2019-04-01', - 'snapshots': '2019-03-01', + 'snapshots': '2018-09-30', 'usage': '2019-03-01', 'virtual_machine_extension_images': '2019-03-01', 'virtual_machine_extensions': '2019-03-01', @@ -220,7 +220,6 @@ def disks(self): * 2018-04-01: :class:`DisksOperations` * 2018-06-01: :class:`DisksOperations` * 2018-09-30: :class:`DisksOperations` - * 2019-03-01: :class:`DisksOperations` """ api_version = self._get_api_version('disks') if api_version == '2016-04-30-preview': @@ -233,8 +232,6 @@ def disks(self): from .v2018_06_01.operations import DisksOperations as OperationClass elif api_version == '2018-09-30': from .v2018_09_30.operations import DisksOperations as OperationClass - elif api_version == '2019-03-01': - from .v2019_03_01.operations import DisksOperations as OperationClass else: raise NotImplementedError("APIVersion {} is not available".format(api_version)) return OperationClass(self._client, self.config, Serializer(self._models_dict(api_version)), Deserializer(self._models_dict(api_version))) @@ -459,7 +456,6 @@ def snapshots(self): * 2018-04-01: :class:`SnapshotsOperations` * 2018-06-01: :class:`SnapshotsOperations` * 2018-09-30: :class:`SnapshotsOperations` - * 2019-03-01: :class:`SnapshotsOperations` """ api_version = self._get_api_version('snapshots') if api_version == '2016-04-30-preview': @@ -472,8 +468,6 @@ def snapshots(self): from .v2018_06_01.operations import SnapshotsOperations as OperationClass elif api_version == '2018-09-30': from .v2018_09_30.operations import SnapshotsOperations as OperationClass - elif api_version == '2019-03-01': - from .v2019_03_01.operations import SnapshotsOperations as OperationClass else: raise NotImplementedError("APIVersion {} is not available".format(api_version)) return OperationClass(self._client, self.config, Serializer(self._models_dict(api_version)), Deserializer(self._models_dict(api_version))) diff --git a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/models.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/models.py index 4fc58fb57e42..d9b50fb3172c 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/models.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/models.py @@ -4,6 +4,7 @@ # Licensed under the MIT License. See License.txt in the project root for # license information. # -------------------------------------------------------------------------- +from .v2018_09_30.models import * from .v2019_03_01.models import * from .v2019_04_01.models import * from .v2019_07_01.models import * diff --git a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2019_03_01/_compute_management_client.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2019_03_01/_compute_management_client.py index 133b55f7a971..ebbe6a2aeeab 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2019_03_01/_compute_management_client.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2019_03_01/_compute_management_client.py @@ -36,8 +36,6 @@ from .operations import GalleryImageVersionsOperations from .operations import GalleryApplicationsOperations from .operations import GalleryApplicationVersionsOperations -from .operations import DisksOperations -from .operations import SnapshotsOperations from . import models @@ -93,10 +91,6 @@ class ComputeManagementClient(SDKClient): :vartype gallery_applications: azure.mgmt.compute.v2019_03_01.operations.GalleryApplicationsOperations :ivar gallery_application_versions: GalleryApplicationVersions operations :vartype gallery_application_versions: azure.mgmt.compute.v2019_03_01.operations.GalleryApplicationVersionsOperations - :ivar disks: Disks operations - :vartype disks: azure.mgmt.compute.v2019_03_01.operations.DisksOperations - :ivar snapshots: Snapshots operations - :vartype snapshots: azure.mgmt.compute.v2019_03_01.operations.SnapshotsOperations :param credentials: Credentials needed for the client to connect to Azure. :type credentials: :mod:`A msrestazure Credentials @@ -165,7 +159,3 @@ def __init__( self._client, self.config, self._serialize, self._deserialize) self.gallery_application_versions = GalleryApplicationVersionsOperations( self._client, self.config, self._serialize, self._deserialize) - self.disks = DisksOperations( - self._client, self.config, self._serialize, self._deserialize) - self.snapshots = SnapshotsOperations( - self._client, self.config, self._serialize, self._deserialize) diff --git a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2019_03_01/models/__init__.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2019_03_01/models/__init__.py index 35c252d1703c..0d46a1c70908 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2019_03_01/models/__init__.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2019_03_01/models/__init__.py @@ -10,7 +10,6 @@ # -------------------------------------------------------------------------- try: - from ._models_py3 import AccessUri from ._models_py3 import AdditionalCapabilities from ._models_py3 import AdditionalUnattendContent from ._models_py3 import ApiEntityReference @@ -24,7 +23,6 @@ from ._models_py3 import BootDiagnostics from ._models_py3 import BootDiagnosticsInstanceView from ._models_py3 import ComputeOperationValue - from ._models_py3 import CreationData from ._models_py3 import DataDisk from ._models_py3 import DataDiskImage from ._models_py3 import DedicatedHost @@ -37,13 +35,8 @@ from ._models_py3 import DiagnosticsProfile from ._models_py3 import DiffDiskSettings from ._models_py3 import Disallowed - from ._models_py3 import Disk from ._models_py3 import DiskEncryptionSettings from ._models_py3 import DiskInstanceView - from ._models_py3 import DiskSku - from ._models_py3 import DiskUpdate - from ._models_py3 import EncryptionSettingsCollection - from ._models_py3 import EncryptionSettingsElement from ._models_py3 import Gallery from ._models_py3 import GalleryApplication from ._models_py3 import GalleryApplicationVersion @@ -59,11 +52,9 @@ from ._models_py3 import GalleryImageVersionPublishingProfile from ._models_py3 import GalleryImageVersionStorageProfile from ._models_py3 import GalleryOSDiskImage - from ._models_py3 import GrantAccessData from ._models_py3 import HardwareProfile from ._models_py3 import Image from ._models_py3 import ImageDataDisk - from ._models_py3 import ImageDiskReference from ._models_py3 import ImageOSDisk from ._models_py3 import ImagePurchasePlan from ._models_py3 import ImageReference @@ -71,8 +62,6 @@ from ._models_py3 import ImageUpdate from ._models_py3 import InnerError from ._models_py3 import InstanceViewStatus - from ._models_py3 import KeyVaultAndKeyReference - from ._models_py3 import KeyVaultAndSecretReference from ._models_py3 import KeyVaultKeyReference from ._models_py3 import KeyVaultSecretReference from ._models_py3 import LinuxConfiguration @@ -112,10 +101,6 @@ from ._models_py3 import ScaleInPolicy from ._models_py3 import ScheduledEventsProfile from ._models_py3 import Sku - from ._models_py3 import Snapshot - from ._models_py3 import SnapshotSku - from ._models_py3 import SnapshotUpdate - from ._models_py3 import SourceVault from ._models_py3 import SshConfiguration from ._models_py3 import SshPublicKey from ._models_py3 import StorageProfile @@ -200,7 +185,6 @@ from ._models_py3 import WinRMConfiguration from ._models_py3 import WinRMListener except (SyntaxError, ImportError): - from ._models import AccessUri from ._models import AdditionalCapabilities from ._models import AdditionalUnattendContent from ._models import ApiEntityReference @@ -214,7 +198,6 @@ from ._models import BootDiagnostics from ._models import BootDiagnosticsInstanceView from ._models import ComputeOperationValue - from ._models import CreationData from ._models import DataDisk from ._models import DataDiskImage from ._models import DedicatedHost @@ -227,13 +210,8 @@ from ._models import DiagnosticsProfile from ._models import DiffDiskSettings from ._models import Disallowed - from ._models import Disk from ._models import DiskEncryptionSettings from ._models import DiskInstanceView - from ._models import DiskSku - from ._models import DiskUpdate - from ._models import EncryptionSettingsCollection - from ._models import EncryptionSettingsElement from ._models import Gallery from ._models import GalleryApplication from ._models import GalleryApplicationVersion @@ -249,11 +227,9 @@ from ._models import GalleryImageVersionPublishingProfile from ._models import GalleryImageVersionStorageProfile from ._models import GalleryOSDiskImage - from ._models import GrantAccessData from ._models import HardwareProfile from ._models import Image from ._models import ImageDataDisk - from ._models import ImageDiskReference from ._models import ImageOSDisk from ._models import ImagePurchasePlan from ._models import ImageReference @@ -261,8 +237,6 @@ from ._models import ImageUpdate from ._models import InnerError from ._models import InstanceViewStatus - from ._models import KeyVaultAndKeyReference - from ._models import KeyVaultAndSecretReference from ._models import KeyVaultKeyReference from ._models import KeyVaultSecretReference from ._models import LinuxConfiguration @@ -302,10 +276,6 @@ from ._models import ScaleInPolicy from ._models import ScheduledEventsProfile from ._models import Sku - from ._models import Snapshot - from ._models import SnapshotSku - from ._models import SnapshotUpdate - from ._models import SourceVault from ._models import SshConfiguration from ._models import SshPublicKey from ._models import StorageProfile @@ -393,7 +363,6 @@ from ._paged_models import ComputeOperationValuePaged from ._paged_models import DedicatedHostGroupPaged from ._paged_models import DedicatedHostPaged -from ._paged_models import DiskPaged from ._paged_models import GalleryApplicationPaged from ._paged_models import GalleryApplicationVersionPaged from ._paged_models import GalleryImagePaged @@ -402,7 +371,6 @@ from ._paged_models import ImagePaged from ._paged_models import ProximityPlacementGroupPaged from ._paged_models import RunCommandDocumentBasePaged -from ._paged_models import SnapshotPaged from ._paged_models import UpgradeOperationHistoricalStatusInfoPaged from ._paged_models import UsagePaged from ._paged_models import VirtualMachinePaged @@ -446,18 +414,11 @@ ReplicationState, StorageAccountType, HostCaching, - DiskStorageAccountTypes, - HyperVGeneration, - DiskCreateOption, - DiskState, - SnapshotStorageAccountTypes, - AccessLevel, InstanceViewTypes, ReplicationStatusTypes, ) __all__ = [ - 'AccessUri', 'AdditionalCapabilities', 'AdditionalUnattendContent', 'ApiEntityReference', @@ -471,7 +432,6 @@ 'BootDiagnostics', 'BootDiagnosticsInstanceView', 'ComputeOperationValue', - 'CreationData', 'DataDisk', 'DataDiskImage', 'DedicatedHost', @@ -484,13 +444,8 @@ 'DiagnosticsProfile', 'DiffDiskSettings', 'Disallowed', - 'Disk', 'DiskEncryptionSettings', 'DiskInstanceView', - 'DiskSku', - 'DiskUpdate', - 'EncryptionSettingsCollection', - 'EncryptionSettingsElement', 'Gallery', 'GalleryApplication', 'GalleryApplicationVersion', @@ -506,11 +461,9 @@ 'GalleryImageVersionPublishingProfile', 'GalleryImageVersionStorageProfile', 'GalleryOSDiskImage', - 'GrantAccessData', 'HardwareProfile', 'Image', 'ImageDataDisk', - 'ImageDiskReference', 'ImageOSDisk', 'ImagePurchasePlan', 'ImageReference', @@ -518,8 +471,6 @@ 'ImageUpdate', 'InnerError', 'InstanceViewStatus', - 'KeyVaultAndKeyReference', - 'KeyVaultAndSecretReference', 'KeyVaultKeyReference', 'KeyVaultSecretReference', 'LinuxConfiguration', @@ -559,10 +510,6 @@ 'ScaleInPolicy', 'ScheduledEventsProfile', 'Sku', - 'Snapshot', - 'SnapshotSku', - 'SnapshotUpdate', - 'SourceVault', 'SshConfiguration', 'SshPublicKey', 'StorageProfile', @@ -666,8 +613,6 @@ 'GalleryImageVersionPaged', 'GalleryApplicationPaged', 'GalleryApplicationVersionPaged', - 'DiskPaged', - 'SnapshotPaged', 'HyperVGenerationTypes', 'StatusLevelTypes', 'AvailabilitySetSkuTypes', @@ -702,12 +647,6 @@ 'ReplicationState', 'StorageAccountType', 'HostCaching', - 'DiskStorageAccountTypes', - 'HyperVGeneration', - 'DiskCreateOption', - 'DiskState', - 'SnapshotStorageAccountTypes', - 'AccessLevel', 'InstanceViewTypes', 'ReplicationStatusTypes', ] diff --git a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2019_03_01/models/_compute_management_client_enums.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2019_03_01/models/_compute_management_client_enums.py index 2682a3590cca..5f6a9fdf47df 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2019_03_01/models/_compute_management_client_enums.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2019_03_01/models/_compute_management_client_enums.py @@ -401,55 +401,6 @@ class HostCaching(str, Enum): read_write = "ReadWrite" -class DiskStorageAccountTypes(str, Enum): - - standard_lrs = "Standard_LRS" #: Standard HDD locally redundant storage. Best for backup, non-critical, and infrequent access. - premium_lrs = "Premium_LRS" #: Premium SSD locally redundant storage. Best for production and performance sensitive workloads. - standard_ssd_lrs = "StandardSSD_LRS" #: Standard SSD locally redundant storage. Best for web servers, lightly used enterprise applications and dev/test. - ultra_ssd_lrs = "UltraSSD_LRS" #: Ultra SSD locally redundant storage. Best for IO-intensive workloads such as SAP HANA, top tier databases (for example, SQL, Oracle), and other transaction-heavy workloads. - - -class HyperVGeneration(str, Enum): - - v1 = "V1" - v2 = "V2" - - -class DiskCreateOption(str, Enum): - - empty = "Empty" #: Create an empty data disk of a size given by diskSizeGB. - attach = "Attach" #: Disk will be attached to a VM. - from_image = "FromImage" #: Create a new disk from a platform image specified by the given imageReference. - import_enum = "Import" #: Create a disk by importing from a blob specified by a sourceUri in a storage account specified by storageAccountId. - copy = "Copy" #: Create a new disk or snapshot by copying from a disk or snapshot specified by the given sourceResourceId. - restore = "Restore" #: Create a new disk by copying from a backup recovery point. - upload = "Upload" #: Create a new disk by obtaining a write token and using it to directly upload the contents of the disk. - - -class DiskState(str, Enum): - - unattached = "Unattached" #: The disk is not being used and can be attached to a VM. - attached = "Attached" #: The disk is currently mounted to a running VM. - reserved = "Reserved" #: The disk is mounted to a stopped-deallocated VM - active_sas = "ActiveSAS" #: The disk currently has an Active SAS Uri associated with it. - ready_to_upload = "ReadyToUpload" #: A disk is ready to be created by upload by requesting a write token. - active_upload = "ActiveUpload" #: A disk is created for upload and a write token has been issued for uploading to it. - - -class SnapshotStorageAccountTypes(str, Enum): - - standard_lrs = "Standard_LRS" #: Standard HDD locally redundant storage - premium_lrs = "Premium_LRS" #: Premium SSD locally redundant storage - standard_zrs = "Standard_ZRS" #: Standard zone redundant storage - - -class AccessLevel(str, Enum): - - none = "None" - read = "Read" - write = "Write" - - class InstanceViewTypes(str, Enum): instance_view = "instanceView" diff --git a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2019_03_01/models/_models.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2019_03_01/models/_models.py index 8d089dc8e017..9e38d116309c 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2019_03_01/models/_models.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2019_03_01/models/_models.py @@ -13,29 +13,6 @@ from msrest.exceptions import HttpOperationError -class AccessUri(Model): - """A disk access SAS uri. - - Variables are only populated by the server, and will be ignored when - sending a request. - - :ivar access_sas: A SAS uri for accessing a disk. - :vartype access_sas: str - """ - - _validation = { - 'access_sas': {'readonly': True}, - } - - _attribute_map = { - 'access_sas': {'key': 'accessSAS', 'type': 'str'}, - } - - def __init__(self, **kwargs): - super(AccessUri, self).__init__(**kwargs) - self.access_sas = None - - class AdditionalCapabilities(Model): """Enables or disables a capability on the virtual machine or virtual machine scale set. @@ -581,68 +558,6 @@ def __init__(self, **kwargs): self.provider = None -class CreationData(Model): - """Data used when creating a disk. - - Variables are only populated by the server, and will be ignored when - sending a request. - - All required parameters must be populated in order to send to Azure. - - :param create_option: Required. This enumerates the possible sources of a - disk's creation. Possible values include: 'Empty', 'Attach', 'FromImage', - 'Import', 'Copy', 'Restore', 'Upload' - :type create_option: str or - ~azure.mgmt.compute.v2019_03_01.models.DiskCreateOption - :param storage_account_id: If createOption is Import, the Azure Resource - Manager identifier of the storage account containing the blob to import as - a disk. Required only if the blob is in a different subscription - :type storage_account_id: str - :param image_reference: Disk source information. - :type image_reference: - ~azure.mgmt.compute.v2019_03_01.models.ImageDiskReference - :param source_uri: If createOption is Import, this is the URI of a blob to - be imported into a managed disk. - :type source_uri: str - :param source_resource_id: If createOption is Copy, this is the ARM id of - the source snapshot or disk. - :type source_resource_id: str - :ivar source_unique_id: If this field is set, this is the unique id - identifying the source of this resource. - :vartype source_unique_id: str - :param upload_size_bytes: If createOption is Upload, this is the size of - the contents of the upload including the VHD footer. This value should be - between 20972032 (20 MiB + 512 bytes for the VHD footer) and - 35183298347520 bytes (32 TiB + 512 bytes for the VHD footer). - :type upload_size_bytes: long - """ - - _validation = { - 'create_option': {'required': True}, - 'source_unique_id': {'readonly': True}, - } - - _attribute_map = { - 'create_option': {'key': 'createOption', 'type': 'str'}, - 'storage_account_id': {'key': 'storageAccountId', 'type': 'str'}, - 'image_reference': {'key': 'imageReference', 'type': 'ImageDiskReference'}, - 'source_uri': {'key': 'sourceUri', 'type': 'str'}, - 'source_resource_id': {'key': 'sourceResourceId', 'type': 'str'}, - 'source_unique_id': {'key': 'sourceUniqueId', 'type': 'str'}, - 'upload_size_bytes': {'key': 'uploadSizeBytes', 'type': 'long'}, - } - - def __init__(self, **kwargs): - super(CreationData, self).__init__(**kwargs) - self.create_option = kwargs.get('create_option', None) - self.storage_account_id = kwargs.get('storage_account_id', None) - self.image_reference = kwargs.get('image_reference', None) - self.source_uri = kwargs.get('source_uri', None) - self.source_resource_id = kwargs.get('source_resource_id', None) - self.source_unique_id = None - self.upload_size_bytes = kwargs.get('upload_size_bytes', None) - - class DataDisk(Model): """Describes a data disk. @@ -1159,133 +1074,6 @@ def __init__(self, **kwargs): self.disk_types = kwargs.get('disk_types', None) -class Disk(Resource): - """Disk resource. - - Variables are only populated by the server, and will be ignored when - sending a request. - - All required parameters must be populated in order to send to Azure. - - :ivar id: Resource Id - :vartype id: str - :ivar name: Resource name - :vartype name: str - :ivar type: Resource type - :vartype type: str - :param location: Required. Resource location - :type location: str - :param tags: Resource tags - :type tags: dict[str, str] - :ivar managed_by: A relative URI containing the ID of the VM that has the - disk attached. - :vartype managed_by: str - :param sku: - :type sku: ~azure.mgmt.compute.v2019_03_01.models.DiskSku - :param zones: The Logical zone list for Disk. - :type zones: list[str] - :ivar time_created: The time when the disk was created. - :vartype time_created: datetime - :param os_type: The Operating System type. Possible values include: - 'Windows', 'Linux' - :type os_type: str or - ~azure.mgmt.compute.v2019_03_01.models.OperatingSystemTypes - :param hyper_vgeneration: The hypervisor generation of the Virtual - Machine. Applicable to OS disks only. Possible values include: 'V1', 'V2' - :type hyper_vgeneration: str or - ~azure.mgmt.compute.v2019_03_01.models.HyperVGeneration - :param creation_data: Required. Disk source information. CreationData - information cannot be changed after the disk has been created. - :type creation_data: ~azure.mgmt.compute.v2019_03_01.models.CreationData - :param disk_size_gb: If creationData.createOption is Empty, this field is - mandatory and it indicates the size of the disk to create. If this field - is present for updates or creation with other options, it indicates a - resize. Resizes are only allowed if the disk is not attached to a running - VM, and can only increase the disk's size. - :type disk_size_gb: int - :ivar disk_size_bytes: The size of the disk in bytes. This field is read - only. - :vartype disk_size_bytes: long - :ivar unique_id: Unique Guid identifying the resource. - :vartype unique_id: str - :param encryption_settings_collection: Encryption settings collection used - for Azure Disk Encryption, can contain multiple encryption settings per - disk or snapshot. - :type encryption_settings_collection: - ~azure.mgmt.compute.v2019_03_01.models.EncryptionSettingsCollection - :ivar provisioning_state: The disk provisioning state. - :vartype provisioning_state: str - :param disk_iops_read_write: The number of IOPS allowed for this disk; - only settable for UltraSSD disks. One operation can transfer between 4k - and 256k bytes. - :type disk_iops_read_write: long - :param disk_mbps_read_write: The bandwidth allowed for this disk; only - settable for UltraSSD disks. MBps means millions of bytes per second - MB - here uses the ISO notation, of powers of 10. - :type disk_mbps_read_write: int - :ivar disk_state: The state of the disk. Possible values include: - 'Unattached', 'Attached', 'Reserved', 'ActiveSAS', 'ReadyToUpload', - 'ActiveUpload' - :vartype disk_state: str or - ~azure.mgmt.compute.v2019_03_01.models.DiskState - """ - - _validation = { - 'id': {'readonly': True}, - 'name': {'readonly': True}, - 'type': {'readonly': True}, - 'location': {'required': True}, - 'managed_by': {'readonly': True}, - 'time_created': {'readonly': True}, - 'creation_data': {'required': True}, - 'disk_size_bytes': {'readonly': True}, - 'unique_id': {'readonly': True}, - 'provisioning_state': {'readonly': True}, - 'disk_state': {'readonly': True}, - } - - _attribute_map = { - 'id': {'key': 'id', 'type': 'str'}, - 'name': {'key': 'name', 'type': 'str'}, - 'type': {'key': 'type', 'type': 'str'}, - 'location': {'key': 'location', 'type': 'str'}, - 'tags': {'key': 'tags', 'type': '{str}'}, - 'managed_by': {'key': 'managedBy', 'type': 'str'}, - 'sku': {'key': 'sku', 'type': 'DiskSku'}, - 'zones': {'key': 'zones', 'type': '[str]'}, - 'time_created': {'key': 'properties.timeCreated', 'type': 'iso-8601'}, - 'os_type': {'key': 'properties.osType', 'type': 'OperatingSystemTypes'}, - 'hyper_vgeneration': {'key': 'properties.hyperVGeneration', 'type': 'str'}, - 'creation_data': {'key': 'properties.creationData', 'type': 'CreationData'}, - 'disk_size_gb': {'key': 'properties.diskSizeGB', 'type': 'int'}, - 'disk_size_bytes': {'key': 'properties.diskSizeBytes', 'type': 'long'}, - 'unique_id': {'key': 'properties.uniqueId', 'type': 'str'}, - 'encryption_settings_collection': {'key': 'properties.encryptionSettingsCollection', 'type': 'EncryptionSettingsCollection'}, - 'provisioning_state': {'key': 'properties.provisioningState', 'type': 'str'}, - 'disk_iops_read_write': {'key': 'properties.diskIOPSReadWrite', 'type': 'long'}, - 'disk_mbps_read_write': {'key': 'properties.diskMBpsReadWrite', 'type': 'int'}, - 'disk_state': {'key': 'properties.diskState', 'type': 'str'}, - } - - def __init__(self, **kwargs): - super(Disk, self).__init__(**kwargs) - self.managed_by = None - self.sku = kwargs.get('sku', None) - self.zones = kwargs.get('zones', None) - self.time_created = None - self.os_type = kwargs.get('os_type', None) - self.hyper_vgeneration = kwargs.get('hyper_vgeneration', None) - self.creation_data = kwargs.get('creation_data', None) - self.disk_size_gb = kwargs.get('disk_size_gb', None) - self.disk_size_bytes = None - self.unique_id = None - self.encryption_settings_collection = kwargs.get('encryption_settings_collection', None) - self.provisioning_state = None - self.disk_iops_read_write = kwargs.get('disk_iops_read_write', None) - self.disk_mbps_read_write = kwargs.get('disk_mbps_read_write', None) - self.disk_state = None - - class DiskEncryptionSettings(Model): """Describes a Encryption Settings for a Disk. @@ -1342,153 +1130,6 @@ def __init__(self, **kwargs): self.statuses = kwargs.get('statuses', None) -class DiskSku(Model): - """The disks sku name. Can be Standard_LRS, Premium_LRS, StandardSSD_LRS, or - UltraSSD_LRS. - - Variables are only populated by the server, and will be ignored when - sending a request. - - :param name: The sku name. Possible values include: 'Standard_LRS', - 'Premium_LRS', 'StandardSSD_LRS', 'UltraSSD_LRS' - :type name: str or - ~azure.mgmt.compute.v2019_03_01.models.DiskStorageAccountTypes - :ivar tier: The sku tier. - :vartype tier: str - """ - - _validation = { - 'tier': {'readonly': True}, - } - - _attribute_map = { - 'name': {'key': 'name', 'type': 'str'}, - 'tier': {'key': 'tier', 'type': 'str'}, - } - - def __init__(self, **kwargs): - super(DiskSku, self).__init__(**kwargs) - self.name = kwargs.get('name', None) - self.tier = None - - -class DiskUpdate(Model): - """Disk update resource. - - :param os_type: the Operating System type. Possible values include: - 'Windows', 'Linux' - :type os_type: str or - ~azure.mgmt.compute.v2019_03_01.models.OperatingSystemTypes - :param disk_size_gb: If creationData.createOption is Empty, this field is - mandatory and it indicates the size of the disk to create. If this field - is present for updates or creation with other options, it indicates a - resize. Resizes are only allowed if the disk is not attached to a running - VM, and can only increase the disk's size. - :type disk_size_gb: int - :param encryption_settings_collection: Encryption settings collection used - be Azure Disk Encryption, can contain multiple encryption settings per - disk or snapshot. - :type encryption_settings_collection: - ~azure.mgmt.compute.v2019_03_01.models.EncryptionSettingsCollection - :param disk_iops_read_write: The number of IOPS allowed for this disk; - only settable for UltraSSD disks. One operation can transfer between 4k - and 256k bytes. - :type disk_iops_read_write: long - :param disk_mbps_read_write: The bandwidth allowed for this disk; only - settable for UltraSSD disks. MBps means millions of bytes per second - MB - here uses the ISO notation, of powers of 10. - :type disk_mbps_read_write: int - :param tags: Resource tags - :type tags: dict[str, str] - :param sku: - :type sku: ~azure.mgmt.compute.v2019_03_01.models.DiskSku - """ - - _attribute_map = { - 'os_type': {'key': 'properties.osType', 'type': 'OperatingSystemTypes'}, - 'disk_size_gb': {'key': 'properties.diskSizeGB', 'type': 'int'}, - 'encryption_settings_collection': {'key': 'properties.encryptionSettingsCollection', 'type': 'EncryptionSettingsCollection'}, - 'disk_iops_read_write': {'key': 'properties.diskIOPSReadWrite', 'type': 'long'}, - 'disk_mbps_read_write': {'key': 'properties.diskMBpsReadWrite', 'type': 'int'}, - 'tags': {'key': 'tags', 'type': '{str}'}, - 'sku': {'key': 'sku', 'type': 'DiskSku'}, - } - - def __init__(self, **kwargs): - super(DiskUpdate, self).__init__(**kwargs) - self.os_type = kwargs.get('os_type', None) - self.disk_size_gb = kwargs.get('disk_size_gb', None) - self.encryption_settings_collection = kwargs.get('encryption_settings_collection', None) - self.disk_iops_read_write = kwargs.get('disk_iops_read_write', None) - self.disk_mbps_read_write = kwargs.get('disk_mbps_read_write', None) - self.tags = kwargs.get('tags', None) - self.sku = kwargs.get('sku', None) - - -class EncryptionSettingsCollection(Model): - """Encryption settings for disk or snapshot. - - All required parameters must be populated in order to send to Azure. - - :param enabled: Required. Set this flag to true and provide - DiskEncryptionKey and optional KeyEncryptionKey to enable encryption. Set - this flag to false and remove DiskEncryptionKey and KeyEncryptionKey to - disable encryption. If EncryptionSettings is null in the request object, - the existing settings remain unchanged. - :type enabled: bool - :param encryption_settings: A collection of encryption settings, one for - each disk volume. - :type encryption_settings: - list[~azure.mgmt.compute.v2019_03_01.models.EncryptionSettingsElement] - :param encryption_settings_version: Describes what type of encryption is - used for the disks. Once this field is set, it cannot be overwritten. - '1.0' corresponds to Azure Disk Encryption with AAD app.'1.1' corresponds - to Azure Disk Encryption. - :type encryption_settings_version: str - """ - - _validation = { - 'enabled': {'required': True}, - } - - _attribute_map = { - 'enabled': {'key': 'enabled', 'type': 'bool'}, - 'encryption_settings': {'key': 'encryptionSettings', 'type': '[EncryptionSettingsElement]'}, - 'encryption_settings_version': {'key': 'encryptionSettingsVersion', 'type': 'str'}, - } - - def __init__(self, **kwargs): - super(EncryptionSettingsCollection, self).__init__(**kwargs) - self.enabled = kwargs.get('enabled', None) - self.encryption_settings = kwargs.get('encryption_settings', None) - self.encryption_settings_version = kwargs.get('encryption_settings_version', None) - - -class EncryptionSettingsElement(Model): - """Encryption settings for one disk volume. - - :param disk_encryption_key: Key Vault Secret Url and vault id of the disk - encryption key - :type disk_encryption_key: - ~azure.mgmt.compute.v2019_03_01.models.KeyVaultAndSecretReference - :param key_encryption_key: Key Vault Key Url and vault id of the key - encryption key. KeyEncryptionKey is optional and when provided is used to - unwrap the disk encryption key. - :type key_encryption_key: - ~azure.mgmt.compute.v2019_03_01.models.KeyVaultAndKeyReference - """ - - _attribute_map = { - 'disk_encryption_key': {'key': 'diskEncryptionKey', 'type': 'KeyVaultAndSecretReference'}, - 'key_encryption_key': {'key': 'keyEncryptionKey', 'type': 'KeyVaultAndKeyReference'}, - } - - def __init__(self, **kwargs): - super(EncryptionSettingsElement, self).__init__(**kwargs) - self.disk_encryption_key = kwargs.get('disk_encryption_key', None) - self.key_encryption_key = kwargs.get('key_encryption_key', None) - - class Gallery(Resource): """Specifies information about the Shared Image Gallery that you want to create or update. @@ -2240,34 +1881,6 @@ def __init__(self, **kwargs): super(GalleryOSDiskImage, self).__init__(**kwargs) -class GrantAccessData(Model): - """Data used for requesting a SAS. - - All required parameters must be populated in order to send to Azure. - - :param access: Required. Possible values include: 'None', 'Read', 'Write' - :type access: str or ~azure.mgmt.compute.v2019_03_01.models.AccessLevel - :param duration_in_seconds: Required. Time duration in seconds until the - SAS access expires. - :type duration_in_seconds: int - """ - - _validation = { - 'access': {'required': True}, - 'duration_in_seconds': {'required': True}, - } - - _attribute_map = { - 'access': {'key': 'access', 'type': 'str'}, - 'duration_in_seconds': {'key': 'durationInSeconds', 'type': 'int'}, - } - - def __init__(self, **kwargs): - super(GrantAccessData, self).__init__(**kwargs) - self.access = kwargs.get('access', None) - self.duration_in_seconds = kwargs.get('duration_in_seconds', None) - - class HardwareProfile(Model): """Specifies the hardware settings for the virtual machine. @@ -2462,35 +2075,6 @@ def __init__(self, **kwargs): self.storage_account_type = kwargs.get('storage_account_type', None) -class ImageDiskReference(Model): - """The source image used for creating the disk. - - All required parameters must be populated in order to send to Azure. - - :param id: Required. A relative uri containing either a Platform Image - Repository or user image reference. - :type id: str - :param lun: If the disk is created from an image's data disk, this is an - index that indicates which of the data disks in the image to use. For OS - disks, this field is null. - :type lun: int - """ - - _validation = { - 'id': {'required': True}, - } - - _attribute_map = { - 'id': {'key': 'id', 'type': 'str'}, - 'lun': {'key': 'lun', 'type': 'int'}, - } - - def __init__(self, **kwargs): - super(ImageDiskReference, self).__init__(**kwargs) - self.id = kwargs.get('id', None) - self.lun = kwargs.get('lun', None) - - class ImageOSDisk(Model): """Describes an Operating System disk. @@ -2771,63 +2355,6 @@ def __init__(self, **kwargs): self.time = kwargs.get('time', None) -class KeyVaultAndKeyReference(Model): - """Key Vault Key Url and vault id of KeK, KeK is optional and when provided is - used to unwrap the encryptionKey. - - All required parameters must be populated in order to send to Azure. - - :param source_vault: Required. Resource id of the KeyVault containing the - key or secret - :type source_vault: ~azure.mgmt.compute.v2019_03_01.models.SourceVault - :param key_url: Required. Url pointing to a key or secret in KeyVault - :type key_url: str - """ - - _validation = { - 'source_vault': {'required': True}, - 'key_url': {'required': True}, - } - - _attribute_map = { - 'source_vault': {'key': 'sourceVault', 'type': 'SourceVault'}, - 'key_url': {'key': 'keyUrl', 'type': 'str'}, - } - - def __init__(self, **kwargs): - super(KeyVaultAndKeyReference, self).__init__(**kwargs) - self.source_vault = kwargs.get('source_vault', None) - self.key_url = kwargs.get('key_url', None) - - -class KeyVaultAndSecretReference(Model): - """Key Vault Secret Url and vault id of the encryption key . - - All required parameters must be populated in order to send to Azure. - - :param source_vault: Required. Resource id of the KeyVault containing the - key or secret - :type source_vault: ~azure.mgmt.compute.v2019_03_01.models.SourceVault - :param secret_url: Required. Url pointing to a key or secret in KeyVault - :type secret_url: str - """ - - _validation = { - 'source_vault': {'required': True}, - 'secret_url': {'required': True}, - } - - _attribute_map = { - 'source_vault': {'key': 'sourceVault', 'type': 'SourceVault'}, - 'secret_url': {'key': 'secretUrl', 'type': 'str'}, - } - - def __init__(self, **kwargs): - super(KeyVaultAndSecretReference, self).__init__(**kwargs) - self.source_vault = kwargs.get('source_vault', None) - self.secret_url = kwargs.get('secret_url', None) - - class KeyVaultKeyReference(Model): """Describes a reference to Key Vault Key. @@ -4214,201 +3741,6 @@ def __init__(self, **kwargs): self.capacity = kwargs.get('capacity', None) -class Snapshot(Resource): - """Snapshot resource. - - Variables are only populated by the server, and will be ignored when - sending a request. - - All required parameters must be populated in order to send to Azure. - - :ivar id: Resource Id - :vartype id: str - :ivar name: Resource name - :vartype name: str - :ivar type: Resource type - :vartype type: str - :param location: Required. Resource location - :type location: str - :param tags: Resource tags - :type tags: dict[str, str] - :ivar managed_by: Unused. Always Null. - :vartype managed_by: str - :param sku: - :type sku: ~azure.mgmt.compute.v2019_03_01.models.SnapshotSku - :ivar time_created: The time when the disk was created. - :vartype time_created: datetime - :param os_type: The Operating System type. Possible values include: - 'Windows', 'Linux' - :type os_type: str or - ~azure.mgmt.compute.v2019_03_01.models.OperatingSystemTypes - :param hyper_vgeneration: The hypervisor generation of the Virtual - Machine. Applicable to OS disks only. Possible values include: 'V1', 'V2' - :type hyper_vgeneration: str or - ~azure.mgmt.compute.v2019_03_01.models.HyperVGeneration - :param creation_data: Required. Disk source information. CreationData - information cannot be changed after the disk has been created. - :type creation_data: ~azure.mgmt.compute.v2019_03_01.models.CreationData - :param disk_size_gb: If creationData.createOption is Empty, this field is - mandatory and it indicates the size of the disk to create. If this field - is present for updates or creation with other options, it indicates a - resize. Resizes are only allowed if the disk is not attached to a running - VM, and can only increase the disk's size. - :type disk_size_gb: int - :ivar disk_size_bytes: The size of the disk in bytes. This field is read - only. - :vartype disk_size_bytes: long - :ivar unique_id: Unique Guid identifying the resource. - :vartype unique_id: str - :param encryption_settings_collection: Encryption settings collection used - be Azure Disk Encryption, can contain multiple encryption settings per - disk or snapshot. - :type encryption_settings_collection: - ~azure.mgmt.compute.v2019_03_01.models.EncryptionSettingsCollection - :ivar provisioning_state: The disk provisioning state. - :vartype provisioning_state: str - :param incremental: Whether a snapshot is incremental. Incremental - snapshots on the same disk occupy less space than full snapshots and can - be diffed. - :type incremental: bool - """ - - _validation = { - 'id': {'readonly': True}, - 'name': {'readonly': True}, - 'type': {'readonly': True}, - 'location': {'required': True}, - 'managed_by': {'readonly': True}, - 'time_created': {'readonly': True}, - 'creation_data': {'required': True}, - 'disk_size_bytes': {'readonly': True}, - 'unique_id': {'readonly': True}, - 'provisioning_state': {'readonly': True}, - } - - _attribute_map = { - 'id': {'key': 'id', 'type': 'str'}, - 'name': {'key': 'name', 'type': 'str'}, - 'type': {'key': 'type', 'type': 'str'}, - 'location': {'key': 'location', 'type': 'str'}, - 'tags': {'key': 'tags', 'type': '{str}'}, - 'managed_by': {'key': 'managedBy', 'type': 'str'}, - 'sku': {'key': 'sku', 'type': 'SnapshotSku'}, - 'time_created': {'key': 'properties.timeCreated', 'type': 'iso-8601'}, - 'os_type': {'key': 'properties.osType', 'type': 'OperatingSystemTypes'}, - 'hyper_vgeneration': {'key': 'properties.hyperVGeneration', 'type': 'str'}, - 'creation_data': {'key': 'properties.creationData', 'type': 'CreationData'}, - 'disk_size_gb': {'key': 'properties.diskSizeGB', 'type': 'int'}, - 'disk_size_bytes': {'key': 'properties.diskSizeBytes', 'type': 'long'}, - 'unique_id': {'key': 'properties.uniqueId', 'type': 'str'}, - 'encryption_settings_collection': {'key': 'properties.encryptionSettingsCollection', 'type': 'EncryptionSettingsCollection'}, - 'provisioning_state': {'key': 'properties.provisioningState', 'type': 'str'}, - 'incremental': {'key': 'properties.incremental', 'type': 'bool'}, - } - - def __init__(self, **kwargs): - super(Snapshot, self).__init__(**kwargs) - self.managed_by = None - self.sku = kwargs.get('sku', None) - self.time_created = None - self.os_type = kwargs.get('os_type', None) - self.hyper_vgeneration = kwargs.get('hyper_vgeneration', None) - self.creation_data = kwargs.get('creation_data', None) - self.disk_size_gb = kwargs.get('disk_size_gb', None) - self.disk_size_bytes = None - self.unique_id = None - self.encryption_settings_collection = kwargs.get('encryption_settings_collection', None) - self.provisioning_state = None - self.incremental = kwargs.get('incremental', None) - - -class SnapshotSku(Model): - """The snapshots sku name. Can be Standard_LRS, Premium_LRS, or Standard_ZRS. - - Variables are only populated by the server, and will be ignored when - sending a request. - - :param name: The sku name. Possible values include: 'Standard_LRS', - 'Premium_LRS', 'Standard_ZRS' - :type name: str or - ~azure.mgmt.compute.v2019_03_01.models.SnapshotStorageAccountTypes - :ivar tier: The sku tier. - :vartype tier: str - """ - - _validation = { - 'tier': {'readonly': True}, - } - - _attribute_map = { - 'name': {'key': 'name', 'type': 'str'}, - 'tier': {'key': 'tier', 'type': 'str'}, - } - - def __init__(self, **kwargs): - super(SnapshotSku, self).__init__(**kwargs) - self.name = kwargs.get('name', None) - self.tier = None - - -class SnapshotUpdate(Model): - """Snapshot update resource. - - :param os_type: the Operating System type. Possible values include: - 'Windows', 'Linux' - :type os_type: str or - ~azure.mgmt.compute.v2019_03_01.models.OperatingSystemTypes - :param disk_size_gb: If creationData.createOption is Empty, this field is - mandatory and it indicates the size of the disk to create. If this field - is present for updates or creation with other options, it indicates a - resize. Resizes are only allowed if the disk is not attached to a running - VM, and can only increase the disk's size. - :type disk_size_gb: int - :param encryption_settings_collection: Encryption settings collection used - be Azure Disk Encryption, can contain multiple encryption settings per - disk or snapshot. - :type encryption_settings_collection: - ~azure.mgmt.compute.v2019_03_01.models.EncryptionSettingsCollection - :param tags: Resource tags - :type tags: dict[str, str] - :param sku: - :type sku: ~azure.mgmt.compute.v2019_03_01.models.SnapshotSku - """ - - _attribute_map = { - 'os_type': {'key': 'properties.osType', 'type': 'OperatingSystemTypes'}, - 'disk_size_gb': {'key': 'properties.diskSizeGB', 'type': 'int'}, - 'encryption_settings_collection': {'key': 'properties.encryptionSettingsCollection', 'type': 'EncryptionSettingsCollection'}, - 'tags': {'key': 'tags', 'type': '{str}'}, - 'sku': {'key': 'sku', 'type': 'SnapshotSku'}, - } - - def __init__(self, **kwargs): - super(SnapshotUpdate, self).__init__(**kwargs) - self.os_type = kwargs.get('os_type', None) - self.disk_size_gb = kwargs.get('disk_size_gb', None) - self.encryption_settings_collection = kwargs.get('encryption_settings_collection', None) - self.tags = kwargs.get('tags', None) - self.sku = kwargs.get('sku', None) - - -class SourceVault(Model): - """The vault id is an Azure Resource Manager Resource id in the form - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.KeyVault/vaults/{vaultName}. - - :param id: Resource Id - :type id: str - """ - - _attribute_map = { - 'id': {'key': 'id', 'type': 'str'}, - } - - def __init__(self, **kwargs): - super(SourceVault, self).__init__(**kwargs) - self.id = kwargs.get('id', None) - - class SshConfiguration(Model): """SSH configuration for Linux based VMs running on Azure. diff --git a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2019_03_01/models/_models_py3.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2019_03_01/models/_models_py3.py index 47b02bdd5e0e..1ecd9cf229d6 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2019_03_01/models/_models_py3.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2019_03_01/models/_models_py3.py @@ -13,29 +13,6 @@ from msrest.exceptions import HttpOperationError -class AccessUri(Model): - """A disk access SAS uri. - - Variables are only populated by the server, and will be ignored when - sending a request. - - :ivar access_sas: A SAS uri for accessing a disk. - :vartype access_sas: str - """ - - _validation = { - 'access_sas': {'readonly': True}, - } - - _attribute_map = { - 'access_sas': {'key': 'accessSAS', 'type': 'str'}, - } - - def __init__(self, **kwargs) -> None: - super(AccessUri, self).__init__(**kwargs) - self.access_sas = None - - class AdditionalCapabilities(Model): """Enables or disables a capability on the virtual machine or virtual machine scale set. @@ -581,68 +558,6 @@ def __init__(self, **kwargs) -> None: self.provider = None -class CreationData(Model): - """Data used when creating a disk. - - Variables are only populated by the server, and will be ignored when - sending a request. - - All required parameters must be populated in order to send to Azure. - - :param create_option: Required. This enumerates the possible sources of a - disk's creation. Possible values include: 'Empty', 'Attach', 'FromImage', - 'Import', 'Copy', 'Restore', 'Upload' - :type create_option: str or - ~azure.mgmt.compute.v2019_03_01.models.DiskCreateOption - :param storage_account_id: If createOption is Import, the Azure Resource - Manager identifier of the storage account containing the blob to import as - a disk. Required only if the blob is in a different subscription - :type storage_account_id: str - :param image_reference: Disk source information. - :type image_reference: - ~azure.mgmt.compute.v2019_03_01.models.ImageDiskReference - :param source_uri: If createOption is Import, this is the URI of a blob to - be imported into a managed disk. - :type source_uri: str - :param source_resource_id: If createOption is Copy, this is the ARM id of - the source snapshot or disk. - :type source_resource_id: str - :ivar source_unique_id: If this field is set, this is the unique id - identifying the source of this resource. - :vartype source_unique_id: str - :param upload_size_bytes: If createOption is Upload, this is the size of - the contents of the upload including the VHD footer. This value should be - between 20972032 (20 MiB + 512 bytes for the VHD footer) and - 35183298347520 bytes (32 TiB + 512 bytes for the VHD footer). - :type upload_size_bytes: long - """ - - _validation = { - 'create_option': {'required': True}, - 'source_unique_id': {'readonly': True}, - } - - _attribute_map = { - 'create_option': {'key': 'createOption', 'type': 'str'}, - 'storage_account_id': {'key': 'storageAccountId', 'type': 'str'}, - 'image_reference': {'key': 'imageReference', 'type': 'ImageDiskReference'}, - 'source_uri': {'key': 'sourceUri', 'type': 'str'}, - 'source_resource_id': {'key': 'sourceResourceId', 'type': 'str'}, - 'source_unique_id': {'key': 'sourceUniqueId', 'type': 'str'}, - 'upload_size_bytes': {'key': 'uploadSizeBytes', 'type': 'long'}, - } - - def __init__(self, *, create_option, storage_account_id: str=None, image_reference=None, source_uri: str=None, source_resource_id: str=None, upload_size_bytes: int=None, **kwargs) -> None: - super(CreationData, self).__init__(**kwargs) - self.create_option = create_option - self.storage_account_id = storage_account_id - self.image_reference = image_reference - self.source_uri = source_uri - self.source_resource_id = source_resource_id - self.source_unique_id = None - self.upload_size_bytes = upload_size_bytes - - class DataDisk(Model): """Describes a data disk. @@ -1159,133 +1074,6 @@ def __init__(self, *, disk_types=None, **kwargs) -> None: self.disk_types = disk_types -class Disk(Resource): - """Disk resource. - - Variables are only populated by the server, and will be ignored when - sending a request. - - All required parameters must be populated in order to send to Azure. - - :ivar id: Resource Id - :vartype id: str - :ivar name: Resource name - :vartype name: str - :ivar type: Resource type - :vartype type: str - :param location: Required. Resource location - :type location: str - :param tags: Resource tags - :type tags: dict[str, str] - :ivar managed_by: A relative URI containing the ID of the VM that has the - disk attached. - :vartype managed_by: str - :param sku: - :type sku: ~azure.mgmt.compute.v2019_03_01.models.DiskSku - :param zones: The Logical zone list for Disk. - :type zones: list[str] - :ivar time_created: The time when the disk was created. - :vartype time_created: datetime - :param os_type: The Operating System type. Possible values include: - 'Windows', 'Linux' - :type os_type: str or - ~azure.mgmt.compute.v2019_03_01.models.OperatingSystemTypes - :param hyper_vgeneration: The hypervisor generation of the Virtual - Machine. Applicable to OS disks only. Possible values include: 'V1', 'V2' - :type hyper_vgeneration: str or - ~azure.mgmt.compute.v2019_03_01.models.HyperVGeneration - :param creation_data: Required. Disk source information. CreationData - information cannot be changed after the disk has been created. - :type creation_data: ~azure.mgmt.compute.v2019_03_01.models.CreationData - :param disk_size_gb: If creationData.createOption is Empty, this field is - mandatory and it indicates the size of the disk to create. If this field - is present for updates or creation with other options, it indicates a - resize. Resizes are only allowed if the disk is not attached to a running - VM, and can only increase the disk's size. - :type disk_size_gb: int - :ivar disk_size_bytes: The size of the disk in bytes. This field is read - only. - :vartype disk_size_bytes: long - :ivar unique_id: Unique Guid identifying the resource. - :vartype unique_id: str - :param encryption_settings_collection: Encryption settings collection used - for Azure Disk Encryption, can contain multiple encryption settings per - disk or snapshot. - :type encryption_settings_collection: - ~azure.mgmt.compute.v2019_03_01.models.EncryptionSettingsCollection - :ivar provisioning_state: The disk provisioning state. - :vartype provisioning_state: str - :param disk_iops_read_write: The number of IOPS allowed for this disk; - only settable for UltraSSD disks. One operation can transfer between 4k - and 256k bytes. - :type disk_iops_read_write: long - :param disk_mbps_read_write: The bandwidth allowed for this disk; only - settable for UltraSSD disks. MBps means millions of bytes per second - MB - here uses the ISO notation, of powers of 10. - :type disk_mbps_read_write: int - :ivar disk_state: The state of the disk. Possible values include: - 'Unattached', 'Attached', 'Reserved', 'ActiveSAS', 'ReadyToUpload', - 'ActiveUpload' - :vartype disk_state: str or - ~azure.mgmt.compute.v2019_03_01.models.DiskState - """ - - _validation = { - 'id': {'readonly': True}, - 'name': {'readonly': True}, - 'type': {'readonly': True}, - 'location': {'required': True}, - 'managed_by': {'readonly': True}, - 'time_created': {'readonly': True}, - 'creation_data': {'required': True}, - 'disk_size_bytes': {'readonly': True}, - 'unique_id': {'readonly': True}, - 'provisioning_state': {'readonly': True}, - 'disk_state': {'readonly': True}, - } - - _attribute_map = { - 'id': {'key': 'id', 'type': 'str'}, - 'name': {'key': 'name', 'type': 'str'}, - 'type': {'key': 'type', 'type': 'str'}, - 'location': {'key': 'location', 'type': 'str'}, - 'tags': {'key': 'tags', 'type': '{str}'}, - 'managed_by': {'key': 'managedBy', 'type': 'str'}, - 'sku': {'key': 'sku', 'type': 'DiskSku'}, - 'zones': {'key': 'zones', 'type': '[str]'}, - 'time_created': {'key': 'properties.timeCreated', 'type': 'iso-8601'}, - 'os_type': {'key': 'properties.osType', 'type': 'OperatingSystemTypes'}, - 'hyper_vgeneration': {'key': 'properties.hyperVGeneration', 'type': 'str'}, - 'creation_data': {'key': 'properties.creationData', 'type': 'CreationData'}, - 'disk_size_gb': {'key': 'properties.diskSizeGB', 'type': 'int'}, - 'disk_size_bytes': {'key': 'properties.diskSizeBytes', 'type': 'long'}, - 'unique_id': {'key': 'properties.uniqueId', 'type': 'str'}, - 'encryption_settings_collection': {'key': 'properties.encryptionSettingsCollection', 'type': 'EncryptionSettingsCollection'}, - 'provisioning_state': {'key': 'properties.provisioningState', 'type': 'str'}, - 'disk_iops_read_write': {'key': 'properties.diskIOPSReadWrite', 'type': 'long'}, - 'disk_mbps_read_write': {'key': 'properties.diskMBpsReadWrite', 'type': 'int'}, - 'disk_state': {'key': 'properties.diskState', 'type': 'str'}, - } - - def __init__(self, *, location: str, creation_data, tags=None, sku=None, zones=None, os_type=None, hyper_vgeneration=None, disk_size_gb: int=None, encryption_settings_collection=None, disk_iops_read_write: int=None, disk_mbps_read_write: int=None, **kwargs) -> None: - super(Disk, self).__init__(location=location, tags=tags, **kwargs) - self.managed_by = None - self.sku = sku - self.zones = zones - self.time_created = None - self.os_type = os_type - self.hyper_vgeneration = hyper_vgeneration - self.creation_data = creation_data - self.disk_size_gb = disk_size_gb - self.disk_size_bytes = None - self.unique_id = None - self.encryption_settings_collection = encryption_settings_collection - self.provisioning_state = None - self.disk_iops_read_write = disk_iops_read_write - self.disk_mbps_read_write = disk_mbps_read_write - self.disk_state = None - - class DiskEncryptionSettings(Model): """Describes a Encryption Settings for a Disk. @@ -1342,153 +1130,6 @@ def __init__(self, *, name: str=None, encryption_settings=None, statuses=None, * self.statuses = statuses -class DiskSku(Model): - """The disks sku name. Can be Standard_LRS, Premium_LRS, StandardSSD_LRS, or - UltraSSD_LRS. - - Variables are only populated by the server, and will be ignored when - sending a request. - - :param name: The sku name. Possible values include: 'Standard_LRS', - 'Premium_LRS', 'StandardSSD_LRS', 'UltraSSD_LRS' - :type name: str or - ~azure.mgmt.compute.v2019_03_01.models.DiskStorageAccountTypes - :ivar tier: The sku tier. - :vartype tier: str - """ - - _validation = { - 'tier': {'readonly': True}, - } - - _attribute_map = { - 'name': {'key': 'name', 'type': 'str'}, - 'tier': {'key': 'tier', 'type': 'str'}, - } - - def __init__(self, *, name=None, **kwargs) -> None: - super(DiskSku, self).__init__(**kwargs) - self.name = name - self.tier = None - - -class DiskUpdate(Model): - """Disk update resource. - - :param os_type: the Operating System type. Possible values include: - 'Windows', 'Linux' - :type os_type: str or - ~azure.mgmt.compute.v2019_03_01.models.OperatingSystemTypes - :param disk_size_gb: If creationData.createOption is Empty, this field is - mandatory and it indicates the size of the disk to create. If this field - is present for updates or creation with other options, it indicates a - resize. Resizes are only allowed if the disk is not attached to a running - VM, and can only increase the disk's size. - :type disk_size_gb: int - :param encryption_settings_collection: Encryption settings collection used - be Azure Disk Encryption, can contain multiple encryption settings per - disk or snapshot. - :type encryption_settings_collection: - ~azure.mgmt.compute.v2019_03_01.models.EncryptionSettingsCollection - :param disk_iops_read_write: The number of IOPS allowed for this disk; - only settable for UltraSSD disks. One operation can transfer between 4k - and 256k bytes. - :type disk_iops_read_write: long - :param disk_mbps_read_write: The bandwidth allowed for this disk; only - settable for UltraSSD disks. MBps means millions of bytes per second - MB - here uses the ISO notation, of powers of 10. - :type disk_mbps_read_write: int - :param tags: Resource tags - :type tags: dict[str, str] - :param sku: - :type sku: ~azure.mgmt.compute.v2019_03_01.models.DiskSku - """ - - _attribute_map = { - 'os_type': {'key': 'properties.osType', 'type': 'OperatingSystemTypes'}, - 'disk_size_gb': {'key': 'properties.diskSizeGB', 'type': 'int'}, - 'encryption_settings_collection': {'key': 'properties.encryptionSettingsCollection', 'type': 'EncryptionSettingsCollection'}, - 'disk_iops_read_write': {'key': 'properties.diskIOPSReadWrite', 'type': 'long'}, - 'disk_mbps_read_write': {'key': 'properties.diskMBpsReadWrite', 'type': 'int'}, - 'tags': {'key': 'tags', 'type': '{str}'}, - 'sku': {'key': 'sku', 'type': 'DiskSku'}, - } - - def __init__(self, *, os_type=None, disk_size_gb: int=None, encryption_settings_collection=None, disk_iops_read_write: int=None, disk_mbps_read_write: int=None, tags=None, sku=None, **kwargs) -> None: - super(DiskUpdate, self).__init__(**kwargs) - self.os_type = os_type - self.disk_size_gb = disk_size_gb - self.encryption_settings_collection = encryption_settings_collection - self.disk_iops_read_write = disk_iops_read_write - self.disk_mbps_read_write = disk_mbps_read_write - self.tags = tags - self.sku = sku - - -class EncryptionSettingsCollection(Model): - """Encryption settings for disk or snapshot. - - All required parameters must be populated in order to send to Azure. - - :param enabled: Required. Set this flag to true and provide - DiskEncryptionKey and optional KeyEncryptionKey to enable encryption. Set - this flag to false and remove DiskEncryptionKey and KeyEncryptionKey to - disable encryption. If EncryptionSettings is null in the request object, - the existing settings remain unchanged. - :type enabled: bool - :param encryption_settings: A collection of encryption settings, one for - each disk volume. - :type encryption_settings: - list[~azure.mgmt.compute.v2019_03_01.models.EncryptionSettingsElement] - :param encryption_settings_version: Describes what type of encryption is - used for the disks. Once this field is set, it cannot be overwritten. - '1.0' corresponds to Azure Disk Encryption with AAD app.'1.1' corresponds - to Azure Disk Encryption. - :type encryption_settings_version: str - """ - - _validation = { - 'enabled': {'required': True}, - } - - _attribute_map = { - 'enabled': {'key': 'enabled', 'type': 'bool'}, - 'encryption_settings': {'key': 'encryptionSettings', 'type': '[EncryptionSettingsElement]'}, - 'encryption_settings_version': {'key': 'encryptionSettingsVersion', 'type': 'str'}, - } - - def __init__(self, *, enabled: bool, encryption_settings=None, encryption_settings_version: str=None, **kwargs) -> None: - super(EncryptionSettingsCollection, self).__init__(**kwargs) - self.enabled = enabled - self.encryption_settings = encryption_settings - self.encryption_settings_version = encryption_settings_version - - -class EncryptionSettingsElement(Model): - """Encryption settings for one disk volume. - - :param disk_encryption_key: Key Vault Secret Url and vault id of the disk - encryption key - :type disk_encryption_key: - ~azure.mgmt.compute.v2019_03_01.models.KeyVaultAndSecretReference - :param key_encryption_key: Key Vault Key Url and vault id of the key - encryption key. KeyEncryptionKey is optional and when provided is used to - unwrap the disk encryption key. - :type key_encryption_key: - ~azure.mgmt.compute.v2019_03_01.models.KeyVaultAndKeyReference - """ - - _attribute_map = { - 'disk_encryption_key': {'key': 'diskEncryptionKey', 'type': 'KeyVaultAndSecretReference'}, - 'key_encryption_key': {'key': 'keyEncryptionKey', 'type': 'KeyVaultAndKeyReference'}, - } - - def __init__(self, *, disk_encryption_key=None, key_encryption_key=None, **kwargs) -> None: - super(EncryptionSettingsElement, self).__init__(**kwargs) - self.disk_encryption_key = disk_encryption_key - self.key_encryption_key = key_encryption_key - - class Gallery(Resource): """Specifies information about the Shared Image Gallery that you want to create or update. @@ -2240,34 +1881,6 @@ def __init__(self, **kwargs) -> None: super(GalleryOSDiskImage, self).__init__(**kwargs) -class GrantAccessData(Model): - """Data used for requesting a SAS. - - All required parameters must be populated in order to send to Azure. - - :param access: Required. Possible values include: 'None', 'Read', 'Write' - :type access: str or ~azure.mgmt.compute.v2019_03_01.models.AccessLevel - :param duration_in_seconds: Required. Time duration in seconds until the - SAS access expires. - :type duration_in_seconds: int - """ - - _validation = { - 'access': {'required': True}, - 'duration_in_seconds': {'required': True}, - } - - _attribute_map = { - 'access': {'key': 'access', 'type': 'str'}, - 'duration_in_seconds': {'key': 'durationInSeconds', 'type': 'int'}, - } - - def __init__(self, *, access, duration_in_seconds: int, **kwargs) -> None: - super(GrantAccessData, self).__init__(**kwargs) - self.access = access - self.duration_in_seconds = duration_in_seconds - - class HardwareProfile(Model): """Specifies the hardware settings for the virtual machine. @@ -2462,35 +2075,6 @@ def __init__(self, *, lun: int, snapshot=None, managed_disk=None, blob_uri: str= self.storage_account_type = storage_account_type -class ImageDiskReference(Model): - """The source image used for creating the disk. - - All required parameters must be populated in order to send to Azure. - - :param id: Required. A relative uri containing either a Platform Image - Repository or user image reference. - :type id: str - :param lun: If the disk is created from an image's data disk, this is an - index that indicates which of the data disks in the image to use. For OS - disks, this field is null. - :type lun: int - """ - - _validation = { - 'id': {'required': True}, - } - - _attribute_map = { - 'id': {'key': 'id', 'type': 'str'}, - 'lun': {'key': 'lun', 'type': 'int'}, - } - - def __init__(self, *, id: str, lun: int=None, **kwargs) -> None: - super(ImageDiskReference, self).__init__(**kwargs) - self.id = id - self.lun = lun - - class ImageOSDisk(Model): """Describes an Operating System disk. @@ -2771,63 +2355,6 @@ def __init__(self, *, code: str=None, level=None, display_status: str=None, mess self.time = time -class KeyVaultAndKeyReference(Model): - """Key Vault Key Url and vault id of KeK, KeK is optional and when provided is - used to unwrap the encryptionKey. - - All required parameters must be populated in order to send to Azure. - - :param source_vault: Required. Resource id of the KeyVault containing the - key or secret - :type source_vault: ~azure.mgmt.compute.v2019_03_01.models.SourceVault - :param key_url: Required. Url pointing to a key or secret in KeyVault - :type key_url: str - """ - - _validation = { - 'source_vault': {'required': True}, - 'key_url': {'required': True}, - } - - _attribute_map = { - 'source_vault': {'key': 'sourceVault', 'type': 'SourceVault'}, - 'key_url': {'key': 'keyUrl', 'type': 'str'}, - } - - def __init__(self, *, source_vault, key_url: str, **kwargs) -> None: - super(KeyVaultAndKeyReference, self).__init__(**kwargs) - self.source_vault = source_vault - self.key_url = key_url - - -class KeyVaultAndSecretReference(Model): - """Key Vault Secret Url and vault id of the encryption key . - - All required parameters must be populated in order to send to Azure. - - :param source_vault: Required. Resource id of the KeyVault containing the - key or secret - :type source_vault: ~azure.mgmt.compute.v2019_03_01.models.SourceVault - :param secret_url: Required. Url pointing to a key or secret in KeyVault - :type secret_url: str - """ - - _validation = { - 'source_vault': {'required': True}, - 'secret_url': {'required': True}, - } - - _attribute_map = { - 'source_vault': {'key': 'sourceVault', 'type': 'SourceVault'}, - 'secret_url': {'key': 'secretUrl', 'type': 'str'}, - } - - def __init__(self, *, source_vault, secret_url: str, **kwargs) -> None: - super(KeyVaultAndSecretReference, self).__init__(**kwargs) - self.source_vault = source_vault - self.secret_url = secret_url - - class KeyVaultKeyReference(Model): """Describes a reference to Key Vault Key. @@ -4214,201 +3741,6 @@ def __init__(self, *, name: str=None, tier: str=None, capacity: int=None, **kwar self.capacity = capacity -class Snapshot(Resource): - """Snapshot resource. - - Variables are only populated by the server, and will be ignored when - sending a request. - - All required parameters must be populated in order to send to Azure. - - :ivar id: Resource Id - :vartype id: str - :ivar name: Resource name - :vartype name: str - :ivar type: Resource type - :vartype type: str - :param location: Required. Resource location - :type location: str - :param tags: Resource tags - :type tags: dict[str, str] - :ivar managed_by: Unused. Always Null. - :vartype managed_by: str - :param sku: - :type sku: ~azure.mgmt.compute.v2019_03_01.models.SnapshotSku - :ivar time_created: The time when the disk was created. - :vartype time_created: datetime - :param os_type: The Operating System type. Possible values include: - 'Windows', 'Linux' - :type os_type: str or - ~azure.mgmt.compute.v2019_03_01.models.OperatingSystemTypes - :param hyper_vgeneration: The hypervisor generation of the Virtual - Machine. Applicable to OS disks only. Possible values include: 'V1', 'V2' - :type hyper_vgeneration: str or - ~azure.mgmt.compute.v2019_03_01.models.HyperVGeneration - :param creation_data: Required. Disk source information. CreationData - information cannot be changed after the disk has been created. - :type creation_data: ~azure.mgmt.compute.v2019_03_01.models.CreationData - :param disk_size_gb: If creationData.createOption is Empty, this field is - mandatory and it indicates the size of the disk to create. If this field - is present for updates or creation with other options, it indicates a - resize. Resizes are only allowed if the disk is not attached to a running - VM, and can only increase the disk's size. - :type disk_size_gb: int - :ivar disk_size_bytes: The size of the disk in bytes. This field is read - only. - :vartype disk_size_bytes: long - :ivar unique_id: Unique Guid identifying the resource. - :vartype unique_id: str - :param encryption_settings_collection: Encryption settings collection used - be Azure Disk Encryption, can contain multiple encryption settings per - disk or snapshot. - :type encryption_settings_collection: - ~azure.mgmt.compute.v2019_03_01.models.EncryptionSettingsCollection - :ivar provisioning_state: The disk provisioning state. - :vartype provisioning_state: str - :param incremental: Whether a snapshot is incremental. Incremental - snapshots on the same disk occupy less space than full snapshots and can - be diffed. - :type incremental: bool - """ - - _validation = { - 'id': {'readonly': True}, - 'name': {'readonly': True}, - 'type': {'readonly': True}, - 'location': {'required': True}, - 'managed_by': {'readonly': True}, - 'time_created': {'readonly': True}, - 'creation_data': {'required': True}, - 'disk_size_bytes': {'readonly': True}, - 'unique_id': {'readonly': True}, - 'provisioning_state': {'readonly': True}, - } - - _attribute_map = { - 'id': {'key': 'id', 'type': 'str'}, - 'name': {'key': 'name', 'type': 'str'}, - 'type': {'key': 'type', 'type': 'str'}, - 'location': {'key': 'location', 'type': 'str'}, - 'tags': {'key': 'tags', 'type': '{str}'}, - 'managed_by': {'key': 'managedBy', 'type': 'str'}, - 'sku': {'key': 'sku', 'type': 'SnapshotSku'}, - 'time_created': {'key': 'properties.timeCreated', 'type': 'iso-8601'}, - 'os_type': {'key': 'properties.osType', 'type': 'OperatingSystemTypes'}, - 'hyper_vgeneration': {'key': 'properties.hyperVGeneration', 'type': 'str'}, - 'creation_data': {'key': 'properties.creationData', 'type': 'CreationData'}, - 'disk_size_gb': {'key': 'properties.diskSizeGB', 'type': 'int'}, - 'disk_size_bytes': {'key': 'properties.diskSizeBytes', 'type': 'long'}, - 'unique_id': {'key': 'properties.uniqueId', 'type': 'str'}, - 'encryption_settings_collection': {'key': 'properties.encryptionSettingsCollection', 'type': 'EncryptionSettingsCollection'}, - 'provisioning_state': {'key': 'properties.provisioningState', 'type': 'str'}, - 'incremental': {'key': 'properties.incremental', 'type': 'bool'}, - } - - def __init__(self, *, location: str, creation_data, tags=None, sku=None, os_type=None, hyper_vgeneration=None, disk_size_gb: int=None, encryption_settings_collection=None, incremental: bool=None, **kwargs) -> None: - super(Snapshot, self).__init__(location=location, tags=tags, **kwargs) - self.managed_by = None - self.sku = sku - self.time_created = None - self.os_type = os_type - self.hyper_vgeneration = hyper_vgeneration - self.creation_data = creation_data - self.disk_size_gb = disk_size_gb - self.disk_size_bytes = None - self.unique_id = None - self.encryption_settings_collection = encryption_settings_collection - self.provisioning_state = None - self.incremental = incremental - - -class SnapshotSku(Model): - """The snapshots sku name. Can be Standard_LRS, Premium_LRS, or Standard_ZRS. - - Variables are only populated by the server, and will be ignored when - sending a request. - - :param name: The sku name. Possible values include: 'Standard_LRS', - 'Premium_LRS', 'Standard_ZRS' - :type name: str or - ~azure.mgmt.compute.v2019_03_01.models.SnapshotStorageAccountTypes - :ivar tier: The sku tier. - :vartype tier: str - """ - - _validation = { - 'tier': {'readonly': True}, - } - - _attribute_map = { - 'name': {'key': 'name', 'type': 'str'}, - 'tier': {'key': 'tier', 'type': 'str'}, - } - - def __init__(self, *, name=None, **kwargs) -> None: - super(SnapshotSku, self).__init__(**kwargs) - self.name = name - self.tier = None - - -class SnapshotUpdate(Model): - """Snapshot update resource. - - :param os_type: the Operating System type. Possible values include: - 'Windows', 'Linux' - :type os_type: str or - ~azure.mgmt.compute.v2019_03_01.models.OperatingSystemTypes - :param disk_size_gb: If creationData.createOption is Empty, this field is - mandatory and it indicates the size of the disk to create. If this field - is present for updates or creation with other options, it indicates a - resize. Resizes are only allowed if the disk is not attached to a running - VM, and can only increase the disk's size. - :type disk_size_gb: int - :param encryption_settings_collection: Encryption settings collection used - be Azure Disk Encryption, can contain multiple encryption settings per - disk or snapshot. - :type encryption_settings_collection: - ~azure.mgmt.compute.v2019_03_01.models.EncryptionSettingsCollection - :param tags: Resource tags - :type tags: dict[str, str] - :param sku: - :type sku: ~azure.mgmt.compute.v2019_03_01.models.SnapshotSku - """ - - _attribute_map = { - 'os_type': {'key': 'properties.osType', 'type': 'OperatingSystemTypes'}, - 'disk_size_gb': {'key': 'properties.diskSizeGB', 'type': 'int'}, - 'encryption_settings_collection': {'key': 'properties.encryptionSettingsCollection', 'type': 'EncryptionSettingsCollection'}, - 'tags': {'key': 'tags', 'type': '{str}'}, - 'sku': {'key': 'sku', 'type': 'SnapshotSku'}, - } - - def __init__(self, *, os_type=None, disk_size_gb: int=None, encryption_settings_collection=None, tags=None, sku=None, **kwargs) -> None: - super(SnapshotUpdate, self).__init__(**kwargs) - self.os_type = os_type - self.disk_size_gb = disk_size_gb - self.encryption_settings_collection = encryption_settings_collection - self.tags = tags - self.sku = sku - - -class SourceVault(Model): - """The vault id is an Azure Resource Manager Resource id in the form - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.KeyVault/vaults/{vaultName}. - - :param id: Resource Id - :type id: str - """ - - _attribute_map = { - 'id': {'key': 'id', 'type': 'str'}, - } - - def __init__(self, *, id: str=None, **kwargs) -> None: - super(SourceVault, self).__init__(**kwargs) - self.id = id - - class SshConfiguration(Model): """SSH configuration for Linux based VMs running on Azure. diff --git a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2019_03_01/models/_paged_models.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2019_03_01/models/_paged_models.py index bd87bf553280..b02dee87e189 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2019_03_01/models/_paged_models.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2019_03_01/models/_paged_models.py @@ -272,29 +272,3 @@ class GalleryApplicationVersionPaged(Paged): def __init__(self, *args, **kwargs): super(GalleryApplicationVersionPaged, self).__init__(*args, **kwargs) -class DiskPaged(Paged): - """ - A paging container for iterating over a list of :class:`Disk ` object - """ - - _attribute_map = { - 'next_link': {'key': 'nextLink', 'type': 'str'}, - 'current_page': {'key': 'value', 'type': '[Disk]'} - } - - def __init__(self, *args, **kwargs): - - super(DiskPaged, self).__init__(*args, **kwargs) -class SnapshotPaged(Paged): - """ - A paging container for iterating over a list of :class:`Snapshot ` object - """ - - _attribute_map = { - 'next_link': {'key': 'nextLink', 'type': 'str'}, - 'current_page': {'key': 'value', 'type': '[Snapshot]'} - } - - def __init__(self, *args, **kwargs): - - super(SnapshotPaged, self).__init__(*args, **kwargs) diff --git a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2019_03_01/operations/__init__.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2019_03_01/operations/__init__.py index 5706de7f811d..11fed6cb8382 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2019_03_01/operations/__init__.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2019_03_01/operations/__init__.py @@ -32,8 +32,6 @@ from ._gallery_image_versions_operations import GalleryImageVersionsOperations from ._gallery_applications_operations import GalleryApplicationsOperations from ._gallery_application_versions_operations import GalleryApplicationVersionsOperations -from ._disks_operations import DisksOperations -from ._snapshots_operations import SnapshotsOperations __all__ = [ 'Operations', @@ -59,6 +57,4 @@ 'GalleryImageVersionsOperations', 'GalleryApplicationsOperations', 'GalleryApplicationVersionsOperations', - 'DisksOperations', - 'SnapshotsOperations', ] diff --git a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2019_03_01/operations/_disks_operations.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2019_03_01/operations/_disks_operations.py deleted file mode 100644 index 3e13fe1e9ab5..000000000000 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2019_03_01/operations/_disks_operations.py +++ /dev/null @@ -1,727 +0,0 @@ -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for -# license information. -# -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is -# regenerated. -# -------------------------------------------------------------------------- - -import uuid -from msrest.pipeline import ClientRawResponse -from msrestazure.azure_exceptions import CloudError -from msrest.polling import LROPoller, NoPolling -from msrestazure.polling.arm_polling import ARMPolling - -from .. import models - - -class DisksOperations(object): - """DisksOperations operations. - - You should not instantiate directly this class, but create a Client instance that will create it for you and attach it as attribute. - - :param client: Client for service requests. - :param config: Configuration of service client. - :param serializer: An object model serializer. - :param deserializer: An object model deserializer. - :ivar api_version: Client Api Version. Constant value: "2019-03-01". - """ - - models = models - - def __init__(self, client, config, serializer, deserializer): - - self._client = client - self._serialize = serializer - self._deserialize = deserializer - self.api_version = "2019-03-01" - - self.config = config - - - def _create_or_update_initial( - self, resource_group_name, disk_name, disk, custom_headers=None, raw=False, **operation_config): - # Construct URL - url = self.create_or_update.metadata['url'] - path_format_arguments = { - 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'diskName': self._serialize.url("disk_name", disk_name, 'str') - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') - - # Construct headers - header_parameters = {} - header_parameters['Accept'] = 'application/json' - header_parameters['Content-Type'] = 'application/json; charset=utf-8' - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_headers) - if self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') - - # Construct body - body_content = self._serialize.body(disk, 'Disk') - - # Construct and send request - request = self._client.put(url, query_parameters, header_parameters, body_content) - response = self._client.send(request, stream=False, **operation_config) - - if response.status_code not in [200, 202]: - exp = CloudError(response) - exp.request_id = response.headers.get('x-ms-request-id') - raise exp - - deserialized = None - - if response.status_code == 200: - deserialized = self._deserialize('Disk', response) - if response.status_code == 202: - deserialized = self._deserialize('Disk', response) - - if raw: - client_raw_response = ClientRawResponse(deserialized, response) - return client_raw_response - - return deserialized - - def create_or_update( - self, resource_group_name, disk_name, disk, custom_headers=None, raw=False, polling=True, **operation_config): - """Creates or updates a disk. - - :param resource_group_name: The name of the resource group. - :type resource_group_name: str - :param disk_name: The name of the managed disk that is being created. - The name can't be changed after the disk is created. Supported - characters for the name are a-z, A-Z, 0-9 and _. The maximum name - length is 80 characters. - :type disk_name: str - :param disk: Disk object supplied in the body of the Put disk - operation. - :type disk: ~azure.mgmt.compute.v2019_03_01.models.Disk - :param dict custom_headers: headers that will be added to the request - :param bool raw: The poller return type is ClientRawResponse, the - direct response alongside the deserialized response - :param polling: True for ARMPolling, False for no polling, or a - polling object for personal polling strategy - :return: An instance of LROPoller that returns Disk or - ClientRawResponse if raw==True - :rtype: - ~msrestazure.azure_operation.AzureOperationPoller[~azure.mgmt.compute.v2019_03_01.models.Disk] - or - ~msrestazure.azure_operation.AzureOperationPoller[~msrest.pipeline.ClientRawResponse[~azure.mgmt.compute.v2019_03_01.models.Disk]] - :raises: :class:`CloudError` - """ - raw_result = self._create_or_update_initial( - resource_group_name=resource_group_name, - disk_name=disk_name, - disk=disk, - custom_headers=custom_headers, - raw=True, - **operation_config - ) - - def get_long_running_output(response): - deserialized = self._deserialize('Disk', response) - - if raw: - client_raw_response = ClientRawResponse(deserialized, response) - return client_raw_response - - return deserialized - - lro_delay = operation_config.get( - 'long_running_operation_timeout', - self.config.long_running_operation_timeout) - if polling is True: polling_method = ARMPolling(lro_delay, **operation_config) - elif polling is False: polling_method = NoPolling() - else: polling_method = polling - return LROPoller(self._client, raw_result, get_long_running_output, polling_method) - create_or_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/disks/{diskName}'} - - - def _update_initial( - self, resource_group_name, disk_name, disk, custom_headers=None, raw=False, **operation_config): - # Construct URL - url = self.update.metadata['url'] - path_format_arguments = { - 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'diskName': self._serialize.url("disk_name", disk_name, 'str') - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') - - # Construct headers - header_parameters = {} - header_parameters['Accept'] = 'application/json' - header_parameters['Content-Type'] = 'application/json; charset=utf-8' - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_headers) - if self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') - - # Construct body - body_content = self._serialize.body(disk, 'DiskUpdate') - - # Construct and send request - request = self._client.patch(url, query_parameters, header_parameters, body_content) - response = self._client.send(request, stream=False, **operation_config) - - if response.status_code not in [200, 202]: - exp = CloudError(response) - exp.request_id = response.headers.get('x-ms-request-id') - raise exp - - deserialized = None - - if response.status_code == 200: - deserialized = self._deserialize('Disk', response) - if response.status_code == 202: - deserialized = self._deserialize('Disk', response) - - if raw: - client_raw_response = ClientRawResponse(deserialized, response) - return client_raw_response - - return deserialized - - def update( - self, resource_group_name, disk_name, disk, custom_headers=None, raw=False, polling=True, **operation_config): - """Updates (patches) a disk. - - :param resource_group_name: The name of the resource group. - :type resource_group_name: str - :param disk_name: The name of the managed disk that is being created. - The name can't be changed after the disk is created. Supported - characters for the name are a-z, A-Z, 0-9 and _. The maximum name - length is 80 characters. - :type disk_name: str - :param disk: Disk object supplied in the body of the Patch disk - operation. - :type disk: ~azure.mgmt.compute.v2019_03_01.models.DiskUpdate - :param dict custom_headers: headers that will be added to the request - :param bool raw: The poller return type is ClientRawResponse, the - direct response alongside the deserialized response - :param polling: True for ARMPolling, False for no polling, or a - polling object for personal polling strategy - :return: An instance of LROPoller that returns Disk or - ClientRawResponse if raw==True - :rtype: - ~msrestazure.azure_operation.AzureOperationPoller[~azure.mgmt.compute.v2019_03_01.models.Disk] - or - ~msrestazure.azure_operation.AzureOperationPoller[~msrest.pipeline.ClientRawResponse[~azure.mgmt.compute.v2019_03_01.models.Disk]] - :raises: :class:`CloudError` - """ - raw_result = self._update_initial( - resource_group_name=resource_group_name, - disk_name=disk_name, - disk=disk, - custom_headers=custom_headers, - raw=True, - **operation_config - ) - - def get_long_running_output(response): - deserialized = self._deserialize('Disk', response) - - if raw: - client_raw_response = ClientRawResponse(deserialized, response) - return client_raw_response - - return deserialized - - lro_delay = operation_config.get( - 'long_running_operation_timeout', - self.config.long_running_operation_timeout) - if polling is True: polling_method = ARMPolling(lro_delay, **operation_config) - elif polling is False: polling_method = NoPolling() - else: polling_method = polling - return LROPoller(self._client, raw_result, get_long_running_output, polling_method) - update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/disks/{diskName}'} - - def get( - self, resource_group_name, disk_name, custom_headers=None, raw=False, **operation_config): - """Gets information about a disk. - - :param resource_group_name: The name of the resource group. - :type resource_group_name: str - :param disk_name: The name of the managed disk that is being created. - The name can't be changed after the disk is created. Supported - characters for the name are a-z, A-Z, 0-9 and _. The maximum name - length is 80 characters. - :type disk_name: str - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :param operation_config: :ref:`Operation configuration - overrides`. - :return: Disk or ClientRawResponse if raw=true - :rtype: ~azure.mgmt.compute.v2019_03_01.models.Disk or - ~msrest.pipeline.ClientRawResponse - :raises: :class:`CloudError` - """ - # Construct URL - url = self.get.metadata['url'] - path_format_arguments = { - 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'diskName': self._serialize.url("disk_name", disk_name, 'str') - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') - - # Construct headers - header_parameters = {} - header_parameters['Accept'] = 'application/json' - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_headers) - if self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') - - # Construct and send request - request = self._client.get(url, query_parameters, header_parameters) - response = self._client.send(request, stream=False, **operation_config) - - if response.status_code not in [200]: - exp = CloudError(response) - exp.request_id = response.headers.get('x-ms-request-id') - raise exp - - deserialized = None - if response.status_code == 200: - deserialized = self._deserialize('Disk', response) - - if raw: - client_raw_response = ClientRawResponse(deserialized, response) - return client_raw_response - - return deserialized - get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/disks/{diskName}'} - - - def _delete_initial( - self, resource_group_name, disk_name, custom_headers=None, raw=False, **operation_config): - # Construct URL - url = self.delete.metadata['url'] - path_format_arguments = { - 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'diskName': self._serialize.url("disk_name", disk_name, 'str') - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') - - # Construct headers - header_parameters = {} - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_headers) - if self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') - - # Construct and send request - request = self._client.delete(url, query_parameters, header_parameters) - response = self._client.send(request, stream=False, **operation_config) - - if response.status_code not in [200, 202, 204]: - exp = CloudError(response) - exp.request_id = response.headers.get('x-ms-request-id') - raise exp - - if raw: - client_raw_response = ClientRawResponse(None, response) - return client_raw_response - - def delete( - self, resource_group_name, disk_name, custom_headers=None, raw=False, polling=True, **operation_config): - """Deletes a disk. - - :param resource_group_name: The name of the resource group. - :type resource_group_name: str - :param disk_name: The name of the managed disk that is being created. - The name can't be changed after the disk is created. Supported - characters for the name are a-z, A-Z, 0-9 and _. The maximum name - length is 80 characters. - :type disk_name: str - :param dict custom_headers: headers that will be added to the request - :param bool raw: The poller return type is ClientRawResponse, the - direct response alongside the deserialized response - :param polling: True for ARMPolling, False for no polling, or a - polling object for personal polling strategy - :return: An instance of LROPoller that returns None or - ClientRawResponse if raw==True - :rtype: ~msrestazure.azure_operation.AzureOperationPoller[None] or - ~msrestazure.azure_operation.AzureOperationPoller[~msrest.pipeline.ClientRawResponse[None]] - :raises: :class:`CloudError` - """ - raw_result = self._delete_initial( - resource_group_name=resource_group_name, - disk_name=disk_name, - custom_headers=custom_headers, - raw=True, - **operation_config - ) - - def get_long_running_output(response): - if raw: - client_raw_response = ClientRawResponse(None, response) - return client_raw_response - - lro_delay = operation_config.get( - 'long_running_operation_timeout', - self.config.long_running_operation_timeout) - if polling is True: polling_method = ARMPolling(lro_delay, **operation_config) - elif polling is False: polling_method = NoPolling() - else: polling_method = polling - return LROPoller(self._client, raw_result, get_long_running_output, polling_method) - delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/disks/{diskName}'} - - def list_by_resource_group( - self, resource_group_name, custom_headers=None, raw=False, **operation_config): - """Lists all the disks under a resource group. - - :param resource_group_name: The name of the resource group. - :type resource_group_name: str - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :param operation_config: :ref:`Operation configuration - overrides`. - :return: An iterator like instance of Disk - :rtype: - ~azure.mgmt.compute.v2019_03_01.models.DiskPaged[~azure.mgmt.compute.v2019_03_01.models.Disk] - :raises: :class:`CloudError` - """ - def prepare_request(next_link=None): - if not next_link: - # Construct URL - url = self.list_by_resource_group.metadata['url'] - path_format_arguments = { - 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str') - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') - - else: - url = next_link - query_parameters = {} - - # Construct headers - header_parameters = {} - header_parameters['Accept'] = 'application/json' - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_headers) - if self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') - - # Construct and send request - request = self._client.get(url, query_parameters, header_parameters) - return request - - def internal_paging(next_link=None): - request = prepare_request(next_link) - - response = self._client.send(request, stream=False, **operation_config) - - if response.status_code not in [200]: - exp = CloudError(response) - exp.request_id = response.headers.get('x-ms-request-id') - raise exp - - return response - - # Deserialize response - header_dict = None - if raw: - header_dict = {} - deserialized = models.DiskPaged(internal_paging, self._deserialize.dependencies, header_dict) - - return deserialized - list_by_resource_group.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/disks'} - - def list( - self, custom_headers=None, raw=False, **operation_config): - """Lists all the disks under a subscription. - - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :param operation_config: :ref:`Operation configuration - overrides`. - :return: An iterator like instance of Disk - :rtype: - ~azure.mgmt.compute.v2019_03_01.models.DiskPaged[~azure.mgmt.compute.v2019_03_01.models.Disk] - :raises: :class:`CloudError` - """ - def prepare_request(next_link=None): - if not next_link: - # Construct URL - url = self.list.metadata['url'] - path_format_arguments = { - 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str') - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') - - else: - url = next_link - query_parameters = {} - - # Construct headers - header_parameters = {} - header_parameters['Accept'] = 'application/json' - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_headers) - if self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') - - # Construct and send request - request = self._client.get(url, query_parameters, header_parameters) - return request - - def internal_paging(next_link=None): - request = prepare_request(next_link) - - response = self._client.send(request, stream=False, **operation_config) - - if response.status_code not in [200]: - exp = CloudError(response) - exp.request_id = response.headers.get('x-ms-request-id') - raise exp - - return response - - # Deserialize response - header_dict = None - if raw: - header_dict = {} - deserialized = models.DiskPaged(internal_paging, self._deserialize.dependencies, header_dict) - - return deserialized - list.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.Compute/disks'} - - - def _grant_access_initial( - self, resource_group_name, disk_name, access, duration_in_seconds, custom_headers=None, raw=False, **operation_config): - grant_access_data = models.GrantAccessData(access=access, duration_in_seconds=duration_in_seconds) - - # Construct URL - url = self.grant_access.metadata['url'] - path_format_arguments = { - 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'diskName': self._serialize.url("disk_name", disk_name, 'str') - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') - - # Construct headers - header_parameters = {} - header_parameters['Accept'] = 'application/json' - header_parameters['Content-Type'] = 'application/json; charset=utf-8' - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_headers) - if self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') - - # Construct body - body_content = self._serialize.body(grant_access_data, 'GrantAccessData') - - # Construct and send request - request = self._client.post(url, query_parameters, header_parameters, body_content) - response = self._client.send(request, stream=False, **operation_config) - - if response.status_code not in [200, 202]: - exp = CloudError(response) - exp.request_id = response.headers.get('x-ms-request-id') - raise exp - - deserialized = None - - if response.status_code == 200: - deserialized = self._deserialize('AccessUri', response) - - if raw: - client_raw_response = ClientRawResponse(deserialized, response) - return client_raw_response - - return deserialized - - def grant_access( - self, resource_group_name, disk_name, access, duration_in_seconds, custom_headers=None, raw=False, polling=True, **operation_config): - """Grants access to a disk. - - :param resource_group_name: The name of the resource group. - :type resource_group_name: str - :param disk_name: The name of the managed disk that is being created. - The name can't be changed after the disk is created. Supported - characters for the name are a-z, A-Z, 0-9 and _. The maximum name - length is 80 characters. - :type disk_name: str - :param access: Possible values include: 'None', 'Read', 'Write' - :type access: str or - ~azure.mgmt.compute.v2019_03_01.models.AccessLevel - :param duration_in_seconds: Time duration in seconds until the SAS - access expires. - :type duration_in_seconds: int - :param dict custom_headers: headers that will be added to the request - :param bool raw: The poller return type is ClientRawResponse, the - direct response alongside the deserialized response - :param polling: True for ARMPolling, False for no polling, or a - polling object for personal polling strategy - :return: An instance of LROPoller that returns AccessUri or - ClientRawResponse if raw==True - :rtype: - ~msrestazure.azure_operation.AzureOperationPoller[~azure.mgmt.compute.v2019_03_01.models.AccessUri] - or - ~msrestazure.azure_operation.AzureOperationPoller[~msrest.pipeline.ClientRawResponse[~azure.mgmt.compute.v2019_03_01.models.AccessUri]] - :raises: :class:`CloudError` - """ - raw_result = self._grant_access_initial( - resource_group_name=resource_group_name, - disk_name=disk_name, - access=access, - duration_in_seconds=duration_in_seconds, - custom_headers=custom_headers, - raw=True, - **operation_config - ) - - def get_long_running_output(response): - deserialized = self._deserialize('AccessUri', response) - - if raw: - client_raw_response = ClientRawResponse(deserialized, response) - return client_raw_response - - return deserialized - - lro_delay = operation_config.get( - 'long_running_operation_timeout', - self.config.long_running_operation_timeout) - if polling is True: polling_method = ARMPolling(lro_delay, lro_options={'final-state-via': 'location'}, **operation_config) - elif polling is False: polling_method = NoPolling() - else: polling_method = polling - return LROPoller(self._client, raw_result, get_long_running_output, polling_method) - grant_access.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/disks/{diskName}/beginGetAccess'} - - - def _revoke_access_initial( - self, resource_group_name, disk_name, custom_headers=None, raw=False, **operation_config): - # Construct URL - url = self.revoke_access.metadata['url'] - path_format_arguments = { - 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'diskName': self._serialize.url("disk_name", disk_name, 'str') - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') - - # Construct headers - header_parameters = {} - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_headers) - if self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') - - # Construct and send request - request = self._client.post(url, query_parameters, header_parameters) - response = self._client.send(request, stream=False, **operation_config) - - if response.status_code not in [200, 202]: - exp = CloudError(response) - exp.request_id = response.headers.get('x-ms-request-id') - raise exp - - if raw: - client_raw_response = ClientRawResponse(None, response) - return client_raw_response - - def revoke_access( - self, resource_group_name, disk_name, custom_headers=None, raw=False, polling=True, **operation_config): - """Revokes access to a disk. - - :param resource_group_name: The name of the resource group. - :type resource_group_name: str - :param disk_name: The name of the managed disk that is being created. - The name can't be changed after the disk is created. Supported - characters for the name are a-z, A-Z, 0-9 and _. The maximum name - length is 80 characters. - :type disk_name: str - :param dict custom_headers: headers that will be added to the request - :param bool raw: The poller return type is ClientRawResponse, the - direct response alongside the deserialized response - :param polling: True for ARMPolling, False for no polling, or a - polling object for personal polling strategy - :return: An instance of LROPoller that returns None or - ClientRawResponse if raw==True - :rtype: ~msrestazure.azure_operation.AzureOperationPoller[None] or - ~msrestazure.azure_operation.AzureOperationPoller[~msrest.pipeline.ClientRawResponse[None]] - :raises: :class:`CloudError` - """ - raw_result = self._revoke_access_initial( - resource_group_name=resource_group_name, - disk_name=disk_name, - custom_headers=custom_headers, - raw=True, - **operation_config - ) - - def get_long_running_output(response): - if raw: - client_raw_response = ClientRawResponse(None, response) - return client_raw_response - - lro_delay = operation_config.get( - 'long_running_operation_timeout', - self.config.long_running_operation_timeout) - if polling is True: polling_method = ARMPolling(lro_delay, lro_options={'final-state-via': 'location'}, **operation_config) - elif polling is False: polling_method = NoPolling() - else: polling_method = polling - return LROPoller(self._client, raw_result, get_long_running_output, polling_method) - revoke_access.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/disks/{diskName}/endGetAccess'} diff --git a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2019_03_01/operations/_snapshots_operations.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2019_03_01/operations/_snapshots_operations.py deleted file mode 100644 index e0ca0e242f3a..000000000000 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2019_03_01/operations/_snapshots_operations.py +++ /dev/null @@ -1,727 +0,0 @@ -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for -# license information. -# -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is -# regenerated. -# -------------------------------------------------------------------------- - -import uuid -from msrest.pipeline import ClientRawResponse -from msrestazure.azure_exceptions import CloudError -from msrest.polling import LROPoller, NoPolling -from msrestazure.polling.arm_polling import ARMPolling - -from .. import models - - -class SnapshotsOperations(object): - """SnapshotsOperations operations. - - You should not instantiate directly this class, but create a Client instance that will create it for you and attach it as attribute. - - :param client: Client for service requests. - :param config: Configuration of service client. - :param serializer: An object model serializer. - :param deserializer: An object model deserializer. - :ivar api_version: Client Api Version. Constant value: "2019-03-01". - """ - - models = models - - def __init__(self, client, config, serializer, deserializer): - - self._client = client - self._serialize = serializer - self._deserialize = deserializer - self.api_version = "2019-03-01" - - self.config = config - - - def _create_or_update_initial( - self, resource_group_name, snapshot_name, snapshot, custom_headers=None, raw=False, **operation_config): - # Construct URL - url = self.create_or_update.metadata['url'] - path_format_arguments = { - 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'snapshotName': self._serialize.url("snapshot_name", snapshot_name, 'str') - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') - - # Construct headers - header_parameters = {} - header_parameters['Accept'] = 'application/json' - header_parameters['Content-Type'] = 'application/json; charset=utf-8' - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_headers) - if self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') - - # Construct body - body_content = self._serialize.body(snapshot, 'Snapshot') - - # Construct and send request - request = self._client.put(url, query_parameters, header_parameters, body_content) - response = self._client.send(request, stream=False, **operation_config) - - if response.status_code not in [200, 202]: - exp = CloudError(response) - exp.request_id = response.headers.get('x-ms-request-id') - raise exp - - deserialized = None - - if response.status_code == 200: - deserialized = self._deserialize('Snapshot', response) - if response.status_code == 202: - deserialized = self._deserialize('Snapshot', response) - - if raw: - client_raw_response = ClientRawResponse(deserialized, response) - return client_raw_response - - return deserialized - - def create_or_update( - self, resource_group_name, snapshot_name, snapshot, custom_headers=None, raw=False, polling=True, **operation_config): - """Creates or updates a snapshot. - - :param resource_group_name: The name of the resource group. - :type resource_group_name: str - :param snapshot_name: The name of the snapshot that is being created. - The name can't be changed after the snapshot is created. Supported - characters for the name are a-z, A-Z, 0-9 and _. The max name length - is 80 characters. - :type snapshot_name: str - :param snapshot: Snapshot object supplied in the body of the Put disk - operation. - :type snapshot: ~azure.mgmt.compute.v2019_03_01.models.Snapshot - :param dict custom_headers: headers that will be added to the request - :param bool raw: The poller return type is ClientRawResponse, the - direct response alongside the deserialized response - :param polling: True for ARMPolling, False for no polling, or a - polling object for personal polling strategy - :return: An instance of LROPoller that returns Snapshot or - ClientRawResponse if raw==True - :rtype: - ~msrestazure.azure_operation.AzureOperationPoller[~azure.mgmt.compute.v2019_03_01.models.Snapshot] - or - ~msrestazure.azure_operation.AzureOperationPoller[~msrest.pipeline.ClientRawResponse[~azure.mgmt.compute.v2019_03_01.models.Snapshot]] - :raises: :class:`CloudError` - """ - raw_result = self._create_or_update_initial( - resource_group_name=resource_group_name, - snapshot_name=snapshot_name, - snapshot=snapshot, - custom_headers=custom_headers, - raw=True, - **operation_config - ) - - def get_long_running_output(response): - deserialized = self._deserialize('Snapshot', response) - - if raw: - client_raw_response = ClientRawResponse(deserialized, response) - return client_raw_response - - return deserialized - - lro_delay = operation_config.get( - 'long_running_operation_timeout', - self.config.long_running_operation_timeout) - if polling is True: polling_method = ARMPolling(lro_delay, **operation_config) - elif polling is False: polling_method = NoPolling() - else: polling_method = polling - return LROPoller(self._client, raw_result, get_long_running_output, polling_method) - create_or_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/snapshots/{snapshotName}'} - - - def _update_initial( - self, resource_group_name, snapshot_name, snapshot, custom_headers=None, raw=False, **operation_config): - # Construct URL - url = self.update.metadata['url'] - path_format_arguments = { - 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'snapshotName': self._serialize.url("snapshot_name", snapshot_name, 'str') - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') - - # Construct headers - header_parameters = {} - header_parameters['Accept'] = 'application/json' - header_parameters['Content-Type'] = 'application/json; charset=utf-8' - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_headers) - if self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') - - # Construct body - body_content = self._serialize.body(snapshot, 'SnapshotUpdate') - - # Construct and send request - request = self._client.patch(url, query_parameters, header_parameters, body_content) - response = self._client.send(request, stream=False, **operation_config) - - if response.status_code not in [200, 202]: - exp = CloudError(response) - exp.request_id = response.headers.get('x-ms-request-id') - raise exp - - deserialized = None - - if response.status_code == 200: - deserialized = self._deserialize('Snapshot', response) - if response.status_code == 202: - deserialized = self._deserialize('Snapshot', response) - - if raw: - client_raw_response = ClientRawResponse(deserialized, response) - return client_raw_response - - return deserialized - - def update( - self, resource_group_name, snapshot_name, snapshot, custom_headers=None, raw=False, polling=True, **operation_config): - """Updates (patches) a snapshot. - - :param resource_group_name: The name of the resource group. - :type resource_group_name: str - :param snapshot_name: The name of the snapshot that is being created. - The name can't be changed after the snapshot is created. Supported - characters for the name are a-z, A-Z, 0-9 and _. The max name length - is 80 characters. - :type snapshot_name: str - :param snapshot: Snapshot object supplied in the body of the Patch - snapshot operation. - :type snapshot: ~azure.mgmt.compute.v2019_03_01.models.SnapshotUpdate - :param dict custom_headers: headers that will be added to the request - :param bool raw: The poller return type is ClientRawResponse, the - direct response alongside the deserialized response - :param polling: True for ARMPolling, False for no polling, or a - polling object for personal polling strategy - :return: An instance of LROPoller that returns Snapshot or - ClientRawResponse if raw==True - :rtype: - ~msrestazure.azure_operation.AzureOperationPoller[~azure.mgmt.compute.v2019_03_01.models.Snapshot] - or - ~msrestazure.azure_operation.AzureOperationPoller[~msrest.pipeline.ClientRawResponse[~azure.mgmt.compute.v2019_03_01.models.Snapshot]] - :raises: :class:`CloudError` - """ - raw_result = self._update_initial( - resource_group_name=resource_group_name, - snapshot_name=snapshot_name, - snapshot=snapshot, - custom_headers=custom_headers, - raw=True, - **operation_config - ) - - def get_long_running_output(response): - deserialized = self._deserialize('Snapshot', response) - - if raw: - client_raw_response = ClientRawResponse(deserialized, response) - return client_raw_response - - return deserialized - - lro_delay = operation_config.get( - 'long_running_operation_timeout', - self.config.long_running_operation_timeout) - if polling is True: polling_method = ARMPolling(lro_delay, **operation_config) - elif polling is False: polling_method = NoPolling() - else: polling_method = polling - return LROPoller(self._client, raw_result, get_long_running_output, polling_method) - update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/snapshots/{snapshotName}'} - - def get( - self, resource_group_name, snapshot_name, custom_headers=None, raw=False, **operation_config): - """Gets information about a snapshot. - - :param resource_group_name: The name of the resource group. - :type resource_group_name: str - :param snapshot_name: The name of the snapshot that is being created. - The name can't be changed after the snapshot is created. Supported - characters for the name are a-z, A-Z, 0-9 and _. The max name length - is 80 characters. - :type snapshot_name: str - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :param operation_config: :ref:`Operation configuration - overrides`. - :return: Snapshot or ClientRawResponse if raw=true - :rtype: ~azure.mgmt.compute.v2019_03_01.models.Snapshot or - ~msrest.pipeline.ClientRawResponse - :raises: :class:`CloudError` - """ - # Construct URL - url = self.get.metadata['url'] - path_format_arguments = { - 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'snapshotName': self._serialize.url("snapshot_name", snapshot_name, 'str') - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') - - # Construct headers - header_parameters = {} - header_parameters['Accept'] = 'application/json' - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_headers) - if self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') - - # Construct and send request - request = self._client.get(url, query_parameters, header_parameters) - response = self._client.send(request, stream=False, **operation_config) - - if response.status_code not in [200]: - exp = CloudError(response) - exp.request_id = response.headers.get('x-ms-request-id') - raise exp - - deserialized = None - if response.status_code == 200: - deserialized = self._deserialize('Snapshot', response) - - if raw: - client_raw_response = ClientRawResponse(deserialized, response) - return client_raw_response - - return deserialized - get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/snapshots/{snapshotName}'} - - - def _delete_initial( - self, resource_group_name, snapshot_name, custom_headers=None, raw=False, **operation_config): - # Construct URL - url = self.delete.metadata['url'] - path_format_arguments = { - 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'snapshotName': self._serialize.url("snapshot_name", snapshot_name, 'str') - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') - - # Construct headers - header_parameters = {} - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_headers) - if self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') - - # Construct and send request - request = self._client.delete(url, query_parameters, header_parameters) - response = self._client.send(request, stream=False, **operation_config) - - if response.status_code not in [200, 202, 204]: - exp = CloudError(response) - exp.request_id = response.headers.get('x-ms-request-id') - raise exp - - if raw: - client_raw_response = ClientRawResponse(None, response) - return client_raw_response - - def delete( - self, resource_group_name, snapshot_name, custom_headers=None, raw=False, polling=True, **operation_config): - """Deletes a snapshot. - - :param resource_group_name: The name of the resource group. - :type resource_group_name: str - :param snapshot_name: The name of the snapshot that is being created. - The name can't be changed after the snapshot is created. Supported - characters for the name are a-z, A-Z, 0-9 and _. The max name length - is 80 characters. - :type snapshot_name: str - :param dict custom_headers: headers that will be added to the request - :param bool raw: The poller return type is ClientRawResponse, the - direct response alongside the deserialized response - :param polling: True for ARMPolling, False for no polling, or a - polling object for personal polling strategy - :return: An instance of LROPoller that returns None or - ClientRawResponse if raw==True - :rtype: ~msrestazure.azure_operation.AzureOperationPoller[None] or - ~msrestazure.azure_operation.AzureOperationPoller[~msrest.pipeline.ClientRawResponse[None]] - :raises: :class:`CloudError` - """ - raw_result = self._delete_initial( - resource_group_name=resource_group_name, - snapshot_name=snapshot_name, - custom_headers=custom_headers, - raw=True, - **operation_config - ) - - def get_long_running_output(response): - if raw: - client_raw_response = ClientRawResponse(None, response) - return client_raw_response - - lro_delay = operation_config.get( - 'long_running_operation_timeout', - self.config.long_running_operation_timeout) - if polling is True: polling_method = ARMPolling(lro_delay, **operation_config) - elif polling is False: polling_method = NoPolling() - else: polling_method = polling - return LROPoller(self._client, raw_result, get_long_running_output, polling_method) - delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/snapshots/{snapshotName}'} - - def list_by_resource_group( - self, resource_group_name, custom_headers=None, raw=False, **operation_config): - """Lists snapshots under a resource group. - - :param resource_group_name: The name of the resource group. - :type resource_group_name: str - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :param operation_config: :ref:`Operation configuration - overrides`. - :return: An iterator like instance of Snapshot - :rtype: - ~azure.mgmt.compute.v2019_03_01.models.SnapshotPaged[~azure.mgmt.compute.v2019_03_01.models.Snapshot] - :raises: :class:`CloudError` - """ - def prepare_request(next_link=None): - if not next_link: - # Construct URL - url = self.list_by_resource_group.metadata['url'] - path_format_arguments = { - 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str') - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') - - else: - url = next_link - query_parameters = {} - - # Construct headers - header_parameters = {} - header_parameters['Accept'] = 'application/json' - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_headers) - if self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') - - # Construct and send request - request = self._client.get(url, query_parameters, header_parameters) - return request - - def internal_paging(next_link=None): - request = prepare_request(next_link) - - response = self._client.send(request, stream=False, **operation_config) - - if response.status_code not in [200]: - exp = CloudError(response) - exp.request_id = response.headers.get('x-ms-request-id') - raise exp - - return response - - # Deserialize response - header_dict = None - if raw: - header_dict = {} - deserialized = models.SnapshotPaged(internal_paging, self._deserialize.dependencies, header_dict) - - return deserialized - list_by_resource_group.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/snapshots'} - - def list( - self, custom_headers=None, raw=False, **operation_config): - """Lists snapshots under a subscription. - - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :param operation_config: :ref:`Operation configuration - overrides`. - :return: An iterator like instance of Snapshot - :rtype: - ~azure.mgmt.compute.v2019_03_01.models.SnapshotPaged[~azure.mgmt.compute.v2019_03_01.models.Snapshot] - :raises: :class:`CloudError` - """ - def prepare_request(next_link=None): - if not next_link: - # Construct URL - url = self.list.metadata['url'] - path_format_arguments = { - 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str') - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') - - else: - url = next_link - query_parameters = {} - - # Construct headers - header_parameters = {} - header_parameters['Accept'] = 'application/json' - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_headers) - if self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') - - # Construct and send request - request = self._client.get(url, query_parameters, header_parameters) - return request - - def internal_paging(next_link=None): - request = prepare_request(next_link) - - response = self._client.send(request, stream=False, **operation_config) - - if response.status_code not in [200]: - exp = CloudError(response) - exp.request_id = response.headers.get('x-ms-request-id') - raise exp - - return response - - # Deserialize response - header_dict = None - if raw: - header_dict = {} - deserialized = models.SnapshotPaged(internal_paging, self._deserialize.dependencies, header_dict) - - return deserialized - list.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.Compute/snapshots'} - - - def _grant_access_initial( - self, resource_group_name, snapshot_name, access, duration_in_seconds, custom_headers=None, raw=False, **operation_config): - grant_access_data = models.GrantAccessData(access=access, duration_in_seconds=duration_in_seconds) - - # Construct URL - url = self.grant_access.metadata['url'] - path_format_arguments = { - 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'snapshotName': self._serialize.url("snapshot_name", snapshot_name, 'str') - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') - - # Construct headers - header_parameters = {} - header_parameters['Accept'] = 'application/json' - header_parameters['Content-Type'] = 'application/json; charset=utf-8' - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_headers) - if self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') - - # Construct body - body_content = self._serialize.body(grant_access_data, 'GrantAccessData') - - # Construct and send request - request = self._client.post(url, query_parameters, header_parameters, body_content) - response = self._client.send(request, stream=False, **operation_config) - - if response.status_code not in [200, 202]: - exp = CloudError(response) - exp.request_id = response.headers.get('x-ms-request-id') - raise exp - - deserialized = None - - if response.status_code == 200: - deserialized = self._deserialize('AccessUri', response) - - if raw: - client_raw_response = ClientRawResponse(deserialized, response) - return client_raw_response - - return deserialized - - def grant_access( - self, resource_group_name, snapshot_name, access, duration_in_seconds, custom_headers=None, raw=False, polling=True, **operation_config): - """Grants access to a snapshot. - - :param resource_group_name: The name of the resource group. - :type resource_group_name: str - :param snapshot_name: The name of the snapshot that is being created. - The name can't be changed after the snapshot is created. Supported - characters for the name are a-z, A-Z, 0-9 and _. The max name length - is 80 characters. - :type snapshot_name: str - :param access: Possible values include: 'None', 'Read', 'Write' - :type access: str or - ~azure.mgmt.compute.v2019_03_01.models.AccessLevel - :param duration_in_seconds: Time duration in seconds until the SAS - access expires. - :type duration_in_seconds: int - :param dict custom_headers: headers that will be added to the request - :param bool raw: The poller return type is ClientRawResponse, the - direct response alongside the deserialized response - :param polling: True for ARMPolling, False for no polling, or a - polling object for personal polling strategy - :return: An instance of LROPoller that returns AccessUri or - ClientRawResponse if raw==True - :rtype: - ~msrestazure.azure_operation.AzureOperationPoller[~azure.mgmt.compute.v2019_03_01.models.AccessUri] - or - ~msrestazure.azure_operation.AzureOperationPoller[~msrest.pipeline.ClientRawResponse[~azure.mgmt.compute.v2019_03_01.models.AccessUri]] - :raises: :class:`CloudError` - """ - raw_result = self._grant_access_initial( - resource_group_name=resource_group_name, - snapshot_name=snapshot_name, - access=access, - duration_in_seconds=duration_in_seconds, - custom_headers=custom_headers, - raw=True, - **operation_config - ) - - def get_long_running_output(response): - deserialized = self._deserialize('AccessUri', response) - - if raw: - client_raw_response = ClientRawResponse(deserialized, response) - return client_raw_response - - return deserialized - - lro_delay = operation_config.get( - 'long_running_operation_timeout', - self.config.long_running_operation_timeout) - if polling is True: polling_method = ARMPolling(lro_delay, lro_options={'final-state-via': 'location'}, **operation_config) - elif polling is False: polling_method = NoPolling() - else: polling_method = polling - return LROPoller(self._client, raw_result, get_long_running_output, polling_method) - grant_access.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/snapshots/{snapshotName}/beginGetAccess'} - - - def _revoke_access_initial( - self, resource_group_name, snapshot_name, custom_headers=None, raw=False, **operation_config): - # Construct URL - url = self.revoke_access.metadata['url'] - path_format_arguments = { - 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'snapshotName': self._serialize.url("snapshot_name", snapshot_name, 'str') - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') - - # Construct headers - header_parameters = {} - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_headers) - if self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') - - # Construct and send request - request = self._client.post(url, query_parameters, header_parameters) - response = self._client.send(request, stream=False, **operation_config) - - if response.status_code not in [200, 202]: - exp = CloudError(response) - exp.request_id = response.headers.get('x-ms-request-id') - raise exp - - if raw: - client_raw_response = ClientRawResponse(None, response) - return client_raw_response - - def revoke_access( - self, resource_group_name, snapshot_name, custom_headers=None, raw=False, polling=True, **operation_config): - """Revokes access to a snapshot. - - :param resource_group_name: The name of the resource group. - :type resource_group_name: str - :param snapshot_name: The name of the snapshot that is being created. - The name can't be changed after the snapshot is created. Supported - characters for the name are a-z, A-Z, 0-9 and _. The max name length - is 80 characters. - :type snapshot_name: str - :param dict custom_headers: headers that will be added to the request - :param bool raw: The poller return type is ClientRawResponse, the - direct response alongside the deserialized response - :param polling: True for ARMPolling, False for no polling, or a - polling object for personal polling strategy - :return: An instance of LROPoller that returns None or - ClientRawResponse if raw==True - :rtype: ~msrestazure.azure_operation.AzureOperationPoller[None] or - ~msrestazure.azure_operation.AzureOperationPoller[~msrest.pipeline.ClientRawResponse[None]] - :raises: :class:`CloudError` - """ - raw_result = self._revoke_access_initial( - resource_group_name=resource_group_name, - snapshot_name=snapshot_name, - custom_headers=custom_headers, - raw=True, - **operation_config - ) - - def get_long_running_output(response): - if raw: - client_raw_response = ClientRawResponse(None, response) - return client_raw_response - - lro_delay = operation_config.get( - 'long_running_operation_timeout', - self.config.long_running_operation_timeout) - if polling is True: polling_method = ARMPolling(lro_delay, lro_options={'final-state-via': 'location'}, **operation_config) - elif polling is False: polling_method = NoPolling() - else: polling_method = polling - return LROPoller(self._client, raw_result, get_long_running_output, polling_method) - revoke_access.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/snapshots/{snapshotName}/endGetAccess'} diff --git a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2019_04_01/operations/_resource_skus_operations.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2019_04_01/operations/_resource_skus_operations.py index 8ba3992094fc..44723fd2def2 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2019_04_01/operations/_resource_skus_operations.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2019_04_01/operations/_resource_skus_operations.py @@ -40,12 +40,10 @@ def __init__(self, client, config, serializer, deserializer): self.config = config def list( - self, filter=None, custom_headers=None, raw=False, **operation_config): + self, custom_headers=None, raw=False, **operation_config): """Gets the list of Microsoft.Compute SKUs available for your Subscription. - :param filter: The filter to apply on the operation. - :type filter: str :param dict custom_headers: headers that will be added to the request :param bool raw: returns the direct response alongside the deserialized response @@ -68,8 +66,6 @@ def prepare_request(next_link=None): # Construct parameters query_parameters = {} query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') - if filter is not None: - query_parameters['$filter'] = self._serialize.query("filter", filter, 'str') else: url = next_link From a1332f45506f5e17f45039344130f6982f9aeed5 Mon Sep 17 00:00:00 2001 From: Azure SDK Bot Date: Thu, 26 Sep 2019 00:12:23 +0000 Subject: [PATCH 2/2] Generated from 6e5808f6ae6335c1415db918cf1ab7e7580783aa Merge branch 'compute-2019-07' into private-temp --- .../compute/_compute_management_client.py | 10 +- .../azure/mgmt/compute/models.py | 1 - .../v2019_03_01/_compute_management_client.py | 10 + .../compute/v2019_03_01/models/__init__.py | 61 ++ .../_compute_management_client_enums.py | 49 ++ .../compute/v2019_03_01/models/_models.py | 668 ++++++++++++++++ .../compute/v2019_03_01/models/_models_py3.py | 668 ++++++++++++++++ .../v2019_03_01/models/_paged_models.py | 26 + .../v2019_03_01/operations/__init__.py | 4 + .../operations/_disks_operations.py | 727 ++++++++++++++++++ .../operations/_snapshots_operations.py | 727 ++++++++++++++++++ .../operations/_resource_skus_operations.py | 6 +- 12 files changed, 2953 insertions(+), 4 deletions(-) create mode 100644 sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2019_03_01/operations/_disks_operations.py create mode 100644 sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2019_03_01/operations/_snapshots_operations.py diff --git a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/_compute_management_client.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/_compute_management_client.py index fff1dac32a53..1ddafa5eec7f 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/_compute_management_client.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/_compute_management_client.py @@ -54,13 +54,13 @@ class ComputeManagementClient(MultiApiClientMixin, SDKClient): 'availability_sets': '2019-03-01', 'dedicated_host_groups': '2019-03-01', 'dedicated_hosts': '2019-03-01', - 'disks': '2018-09-30', + 'disks': '2019-03-01', 'images': '2019-03-01', 'log_analytics': '2019-03-01', 'operations': '2019-03-01', 'proximity_placement_groups': '2019-03-01', 'resource_skus': '2019-04-01', - 'snapshots': '2018-09-30', + 'snapshots': '2019-03-01', 'usage': '2019-03-01', 'virtual_machine_extension_images': '2019-03-01', 'virtual_machine_extensions': '2019-03-01', @@ -220,6 +220,7 @@ def disks(self): * 2018-04-01: :class:`DisksOperations` * 2018-06-01: :class:`DisksOperations` * 2018-09-30: :class:`DisksOperations` + * 2019-03-01: :class:`DisksOperations` """ api_version = self._get_api_version('disks') if api_version == '2016-04-30-preview': @@ -232,6 +233,8 @@ def disks(self): from .v2018_06_01.operations import DisksOperations as OperationClass elif api_version == '2018-09-30': from .v2018_09_30.operations import DisksOperations as OperationClass + elif api_version == '2019-03-01': + from .v2019_03_01.operations import DisksOperations as OperationClass else: raise NotImplementedError("APIVersion {} is not available".format(api_version)) return OperationClass(self._client, self.config, Serializer(self._models_dict(api_version)), Deserializer(self._models_dict(api_version))) @@ -456,6 +459,7 @@ def snapshots(self): * 2018-04-01: :class:`SnapshotsOperations` * 2018-06-01: :class:`SnapshotsOperations` * 2018-09-30: :class:`SnapshotsOperations` + * 2019-03-01: :class:`SnapshotsOperations` """ api_version = self._get_api_version('snapshots') if api_version == '2016-04-30-preview': @@ -468,6 +472,8 @@ def snapshots(self): from .v2018_06_01.operations import SnapshotsOperations as OperationClass elif api_version == '2018-09-30': from .v2018_09_30.operations import SnapshotsOperations as OperationClass + elif api_version == '2019-03-01': + from .v2019_03_01.operations import SnapshotsOperations as OperationClass else: raise NotImplementedError("APIVersion {} is not available".format(api_version)) return OperationClass(self._client, self.config, Serializer(self._models_dict(api_version)), Deserializer(self._models_dict(api_version))) diff --git a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/models.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/models.py index d9b50fb3172c..4fc58fb57e42 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/models.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/models.py @@ -4,7 +4,6 @@ # Licensed under the MIT License. See License.txt in the project root for # license information. # -------------------------------------------------------------------------- -from .v2018_09_30.models import * from .v2019_03_01.models import * from .v2019_04_01.models import * from .v2019_07_01.models import * diff --git a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2019_03_01/_compute_management_client.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2019_03_01/_compute_management_client.py index ebbe6a2aeeab..133b55f7a971 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2019_03_01/_compute_management_client.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2019_03_01/_compute_management_client.py @@ -36,6 +36,8 @@ from .operations import GalleryImageVersionsOperations from .operations import GalleryApplicationsOperations from .operations import GalleryApplicationVersionsOperations +from .operations import DisksOperations +from .operations import SnapshotsOperations from . import models @@ -91,6 +93,10 @@ class ComputeManagementClient(SDKClient): :vartype gallery_applications: azure.mgmt.compute.v2019_03_01.operations.GalleryApplicationsOperations :ivar gallery_application_versions: GalleryApplicationVersions operations :vartype gallery_application_versions: azure.mgmt.compute.v2019_03_01.operations.GalleryApplicationVersionsOperations + :ivar disks: Disks operations + :vartype disks: azure.mgmt.compute.v2019_03_01.operations.DisksOperations + :ivar snapshots: Snapshots operations + :vartype snapshots: azure.mgmt.compute.v2019_03_01.operations.SnapshotsOperations :param credentials: Credentials needed for the client to connect to Azure. :type credentials: :mod:`A msrestazure Credentials @@ -159,3 +165,7 @@ def __init__( self._client, self.config, self._serialize, self._deserialize) self.gallery_application_versions = GalleryApplicationVersionsOperations( self._client, self.config, self._serialize, self._deserialize) + self.disks = DisksOperations( + self._client, self.config, self._serialize, self._deserialize) + self.snapshots = SnapshotsOperations( + self._client, self.config, self._serialize, self._deserialize) diff --git a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2019_03_01/models/__init__.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2019_03_01/models/__init__.py index 0d46a1c70908..35c252d1703c 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2019_03_01/models/__init__.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2019_03_01/models/__init__.py @@ -10,6 +10,7 @@ # -------------------------------------------------------------------------- try: + from ._models_py3 import AccessUri from ._models_py3 import AdditionalCapabilities from ._models_py3 import AdditionalUnattendContent from ._models_py3 import ApiEntityReference @@ -23,6 +24,7 @@ from ._models_py3 import BootDiagnostics from ._models_py3 import BootDiagnosticsInstanceView from ._models_py3 import ComputeOperationValue + from ._models_py3 import CreationData from ._models_py3 import DataDisk from ._models_py3 import DataDiskImage from ._models_py3 import DedicatedHost @@ -35,8 +37,13 @@ from ._models_py3 import DiagnosticsProfile from ._models_py3 import DiffDiskSettings from ._models_py3 import Disallowed + from ._models_py3 import Disk from ._models_py3 import DiskEncryptionSettings from ._models_py3 import DiskInstanceView + from ._models_py3 import DiskSku + from ._models_py3 import DiskUpdate + from ._models_py3 import EncryptionSettingsCollection + from ._models_py3 import EncryptionSettingsElement from ._models_py3 import Gallery from ._models_py3 import GalleryApplication from ._models_py3 import GalleryApplicationVersion @@ -52,9 +59,11 @@ from ._models_py3 import GalleryImageVersionPublishingProfile from ._models_py3 import GalleryImageVersionStorageProfile from ._models_py3 import GalleryOSDiskImage + from ._models_py3 import GrantAccessData from ._models_py3 import HardwareProfile from ._models_py3 import Image from ._models_py3 import ImageDataDisk + from ._models_py3 import ImageDiskReference from ._models_py3 import ImageOSDisk from ._models_py3 import ImagePurchasePlan from ._models_py3 import ImageReference @@ -62,6 +71,8 @@ from ._models_py3 import ImageUpdate from ._models_py3 import InnerError from ._models_py3 import InstanceViewStatus + from ._models_py3 import KeyVaultAndKeyReference + from ._models_py3 import KeyVaultAndSecretReference from ._models_py3 import KeyVaultKeyReference from ._models_py3 import KeyVaultSecretReference from ._models_py3 import LinuxConfiguration @@ -101,6 +112,10 @@ from ._models_py3 import ScaleInPolicy from ._models_py3 import ScheduledEventsProfile from ._models_py3 import Sku + from ._models_py3 import Snapshot + from ._models_py3 import SnapshotSku + from ._models_py3 import SnapshotUpdate + from ._models_py3 import SourceVault from ._models_py3 import SshConfiguration from ._models_py3 import SshPublicKey from ._models_py3 import StorageProfile @@ -185,6 +200,7 @@ from ._models_py3 import WinRMConfiguration from ._models_py3 import WinRMListener except (SyntaxError, ImportError): + from ._models import AccessUri from ._models import AdditionalCapabilities from ._models import AdditionalUnattendContent from ._models import ApiEntityReference @@ -198,6 +214,7 @@ from ._models import BootDiagnostics from ._models import BootDiagnosticsInstanceView from ._models import ComputeOperationValue + from ._models import CreationData from ._models import DataDisk from ._models import DataDiskImage from ._models import DedicatedHost @@ -210,8 +227,13 @@ from ._models import DiagnosticsProfile from ._models import DiffDiskSettings from ._models import Disallowed + from ._models import Disk from ._models import DiskEncryptionSettings from ._models import DiskInstanceView + from ._models import DiskSku + from ._models import DiskUpdate + from ._models import EncryptionSettingsCollection + from ._models import EncryptionSettingsElement from ._models import Gallery from ._models import GalleryApplication from ._models import GalleryApplicationVersion @@ -227,9 +249,11 @@ from ._models import GalleryImageVersionPublishingProfile from ._models import GalleryImageVersionStorageProfile from ._models import GalleryOSDiskImage + from ._models import GrantAccessData from ._models import HardwareProfile from ._models import Image from ._models import ImageDataDisk + from ._models import ImageDiskReference from ._models import ImageOSDisk from ._models import ImagePurchasePlan from ._models import ImageReference @@ -237,6 +261,8 @@ from ._models import ImageUpdate from ._models import InnerError from ._models import InstanceViewStatus + from ._models import KeyVaultAndKeyReference + from ._models import KeyVaultAndSecretReference from ._models import KeyVaultKeyReference from ._models import KeyVaultSecretReference from ._models import LinuxConfiguration @@ -276,6 +302,10 @@ from ._models import ScaleInPolicy from ._models import ScheduledEventsProfile from ._models import Sku + from ._models import Snapshot + from ._models import SnapshotSku + from ._models import SnapshotUpdate + from ._models import SourceVault from ._models import SshConfiguration from ._models import SshPublicKey from ._models import StorageProfile @@ -363,6 +393,7 @@ from ._paged_models import ComputeOperationValuePaged from ._paged_models import DedicatedHostGroupPaged from ._paged_models import DedicatedHostPaged +from ._paged_models import DiskPaged from ._paged_models import GalleryApplicationPaged from ._paged_models import GalleryApplicationVersionPaged from ._paged_models import GalleryImagePaged @@ -371,6 +402,7 @@ from ._paged_models import ImagePaged from ._paged_models import ProximityPlacementGroupPaged from ._paged_models import RunCommandDocumentBasePaged +from ._paged_models import SnapshotPaged from ._paged_models import UpgradeOperationHistoricalStatusInfoPaged from ._paged_models import UsagePaged from ._paged_models import VirtualMachinePaged @@ -414,11 +446,18 @@ ReplicationState, StorageAccountType, HostCaching, + DiskStorageAccountTypes, + HyperVGeneration, + DiskCreateOption, + DiskState, + SnapshotStorageAccountTypes, + AccessLevel, InstanceViewTypes, ReplicationStatusTypes, ) __all__ = [ + 'AccessUri', 'AdditionalCapabilities', 'AdditionalUnattendContent', 'ApiEntityReference', @@ -432,6 +471,7 @@ 'BootDiagnostics', 'BootDiagnosticsInstanceView', 'ComputeOperationValue', + 'CreationData', 'DataDisk', 'DataDiskImage', 'DedicatedHost', @@ -444,8 +484,13 @@ 'DiagnosticsProfile', 'DiffDiskSettings', 'Disallowed', + 'Disk', 'DiskEncryptionSettings', 'DiskInstanceView', + 'DiskSku', + 'DiskUpdate', + 'EncryptionSettingsCollection', + 'EncryptionSettingsElement', 'Gallery', 'GalleryApplication', 'GalleryApplicationVersion', @@ -461,9 +506,11 @@ 'GalleryImageVersionPublishingProfile', 'GalleryImageVersionStorageProfile', 'GalleryOSDiskImage', + 'GrantAccessData', 'HardwareProfile', 'Image', 'ImageDataDisk', + 'ImageDiskReference', 'ImageOSDisk', 'ImagePurchasePlan', 'ImageReference', @@ -471,6 +518,8 @@ 'ImageUpdate', 'InnerError', 'InstanceViewStatus', + 'KeyVaultAndKeyReference', + 'KeyVaultAndSecretReference', 'KeyVaultKeyReference', 'KeyVaultSecretReference', 'LinuxConfiguration', @@ -510,6 +559,10 @@ 'ScaleInPolicy', 'ScheduledEventsProfile', 'Sku', + 'Snapshot', + 'SnapshotSku', + 'SnapshotUpdate', + 'SourceVault', 'SshConfiguration', 'SshPublicKey', 'StorageProfile', @@ -613,6 +666,8 @@ 'GalleryImageVersionPaged', 'GalleryApplicationPaged', 'GalleryApplicationVersionPaged', + 'DiskPaged', + 'SnapshotPaged', 'HyperVGenerationTypes', 'StatusLevelTypes', 'AvailabilitySetSkuTypes', @@ -647,6 +702,12 @@ 'ReplicationState', 'StorageAccountType', 'HostCaching', + 'DiskStorageAccountTypes', + 'HyperVGeneration', + 'DiskCreateOption', + 'DiskState', + 'SnapshotStorageAccountTypes', + 'AccessLevel', 'InstanceViewTypes', 'ReplicationStatusTypes', ] diff --git a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2019_03_01/models/_compute_management_client_enums.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2019_03_01/models/_compute_management_client_enums.py index 5f6a9fdf47df..2682a3590cca 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2019_03_01/models/_compute_management_client_enums.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2019_03_01/models/_compute_management_client_enums.py @@ -401,6 +401,55 @@ class HostCaching(str, Enum): read_write = "ReadWrite" +class DiskStorageAccountTypes(str, Enum): + + standard_lrs = "Standard_LRS" #: Standard HDD locally redundant storage. Best for backup, non-critical, and infrequent access. + premium_lrs = "Premium_LRS" #: Premium SSD locally redundant storage. Best for production and performance sensitive workloads. + standard_ssd_lrs = "StandardSSD_LRS" #: Standard SSD locally redundant storage. Best for web servers, lightly used enterprise applications and dev/test. + ultra_ssd_lrs = "UltraSSD_LRS" #: Ultra SSD locally redundant storage. Best for IO-intensive workloads such as SAP HANA, top tier databases (for example, SQL, Oracle), and other transaction-heavy workloads. + + +class HyperVGeneration(str, Enum): + + v1 = "V1" + v2 = "V2" + + +class DiskCreateOption(str, Enum): + + empty = "Empty" #: Create an empty data disk of a size given by diskSizeGB. + attach = "Attach" #: Disk will be attached to a VM. + from_image = "FromImage" #: Create a new disk from a platform image specified by the given imageReference. + import_enum = "Import" #: Create a disk by importing from a blob specified by a sourceUri in a storage account specified by storageAccountId. + copy = "Copy" #: Create a new disk or snapshot by copying from a disk or snapshot specified by the given sourceResourceId. + restore = "Restore" #: Create a new disk by copying from a backup recovery point. + upload = "Upload" #: Create a new disk by obtaining a write token and using it to directly upload the contents of the disk. + + +class DiskState(str, Enum): + + unattached = "Unattached" #: The disk is not being used and can be attached to a VM. + attached = "Attached" #: The disk is currently mounted to a running VM. + reserved = "Reserved" #: The disk is mounted to a stopped-deallocated VM + active_sas = "ActiveSAS" #: The disk currently has an Active SAS Uri associated with it. + ready_to_upload = "ReadyToUpload" #: A disk is ready to be created by upload by requesting a write token. + active_upload = "ActiveUpload" #: A disk is created for upload and a write token has been issued for uploading to it. + + +class SnapshotStorageAccountTypes(str, Enum): + + standard_lrs = "Standard_LRS" #: Standard HDD locally redundant storage + premium_lrs = "Premium_LRS" #: Premium SSD locally redundant storage + standard_zrs = "Standard_ZRS" #: Standard zone redundant storage + + +class AccessLevel(str, Enum): + + none = "None" + read = "Read" + write = "Write" + + class InstanceViewTypes(str, Enum): instance_view = "instanceView" diff --git a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2019_03_01/models/_models.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2019_03_01/models/_models.py index 9e38d116309c..8d089dc8e017 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2019_03_01/models/_models.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2019_03_01/models/_models.py @@ -13,6 +13,29 @@ from msrest.exceptions import HttpOperationError +class AccessUri(Model): + """A disk access SAS uri. + + Variables are only populated by the server, and will be ignored when + sending a request. + + :ivar access_sas: A SAS uri for accessing a disk. + :vartype access_sas: str + """ + + _validation = { + 'access_sas': {'readonly': True}, + } + + _attribute_map = { + 'access_sas': {'key': 'accessSAS', 'type': 'str'}, + } + + def __init__(self, **kwargs): + super(AccessUri, self).__init__(**kwargs) + self.access_sas = None + + class AdditionalCapabilities(Model): """Enables or disables a capability on the virtual machine or virtual machine scale set. @@ -558,6 +581,68 @@ def __init__(self, **kwargs): self.provider = None +class CreationData(Model): + """Data used when creating a disk. + + Variables are only populated by the server, and will be ignored when + sending a request. + + All required parameters must be populated in order to send to Azure. + + :param create_option: Required. This enumerates the possible sources of a + disk's creation. Possible values include: 'Empty', 'Attach', 'FromImage', + 'Import', 'Copy', 'Restore', 'Upload' + :type create_option: str or + ~azure.mgmt.compute.v2019_03_01.models.DiskCreateOption + :param storage_account_id: If createOption is Import, the Azure Resource + Manager identifier of the storage account containing the blob to import as + a disk. Required only if the blob is in a different subscription + :type storage_account_id: str + :param image_reference: Disk source information. + :type image_reference: + ~azure.mgmt.compute.v2019_03_01.models.ImageDiskReference + :param source_uri: If createOption is Import, this is the URI of a blob to + be imported into a managed disk. + :type source_uri: str + :param source_resource_id: If createOption is Copy, this is the ARM id of + the source snapshot or disk. + :type source_resource_id: str + :ivar source_unique_id: If this field is set, this is the unique id + identifying the source of this resource. + :vartype source_unique_id: str + :param upload_size_bytes: If createOption is Upload, this is the size of + the contents of the upload including the VHD footer. This value should be + between 20972032 (20 MiB + 512 bytes for the VHD footer) and + 35183298347520 bytes (32 TiB + 512 bytes for the VHD footer). + :type upload_size_bytes: long + """ + + _validation = { + 'create_option': {'required': True}, + 'source_unique_id': {'readonly': True}, + } + + _attribute_map = { + 'create_option': {'key': 'createOption', 'type': 'str'}, + 'storage_account_id': {'key': 'storageAccountId', 'type': 'str'}, + 'image_reference': {'key': 'imageReference', 'type': 'ImageDiskReference'}, + 'source_uri': {'key': 'sourceUri', 'type': 'str'}, + 'source_resource_id': {'key': 'sourceResourceId', 'type': 'str'}, + 'source_unique_id': {'key': 'sourceUniqueId', 'type': 'str'}, + 'upload_size_bytes': {'key': 'uploadSizeBytes', 'type': 'long'}, + } + + def __init__(self, **kwargs): + super(CreationData, self).__init__(**kwargs) + self.create_option = kwargs.get('create_option', None) + self.storage_account_id = kwargs.get('storage_account_id', None) + self.image_reference = kwargs.get('image_reference', None) + self.source_uri = kwargs.get('source_uri', None) + self.source_resource_id = kwargs.get('source_resource_id', None) + self.source_unique_id = None + self.upload_size_bytes = kwargs.get('upload_size_bytes', None) + + class DataDisk(Model): """Describes a data disk. @@ -1074,6 +1159,133 @@ def __init__(self, **kwargs): self.disk_types = kwargs.get('disk_types', None) +class Disk(Resource): + """Disk resource. + + Variables are only populated by the server, and will be ignored when + sending a request. + + All required parameters must be populated in order to send to Azure. + + :ivar id: Resource Id + :vartype id: str + :ivar name: Resource name + :vartype name: str + :ivar type: Resource type + :vartype type: str + :param location: Required. Resource location + :type location: str + :param tags: Resource tags + :type tags: dict[str, str] + :ivar managed_by: A relative URI containing the ID of the VM that has the + disk attached. + :vartype managed_by: str + :param sku: + :type sku: ~azure.mgmt.compute.v2019_03_01.models.DiskSku + :param zones: The Logical zone list for Disk. + :type zones: list[str] + :ivar time_created: The time when the disk was created. + :vartype time_created: datetime + :param os_type: The Operating System type. Possible values include: + 'Windows', 'Linux' + :type os_type: str or + ~azure.mgmt.compute.v2019_03_01.models.OperatingSystemTypes + :param hyper_vgeneration: The hypervisor generation of the Virtual + Machine. Applicable to OS disks only. Possible values include: 'V1', 'V2' + :type hyper_vgeneration: str or + ~azure.mgmt.compute.v2019_03_01.models.HyperVGeneration + :param creation_data: Required. Disk source information. CreationData + information cannot be changed after the disk has been created. + :type creation_data: ~azure.mgmt.compute.v2019_03_01.models.CreationData + :param disk_size_gb: If creationData.createOption is Empty, this field is + mandatory and it indicates the size of the disk to create. If this field + is present for updates or creation with other options, it indicates a + resize. Resizes are only allowed if the disk is not attached to a running + VM, and can only increase the disk's size. + :type disk_size_gb: int + :ivar disk_size_bytes: The size of the disk in bytes. This field is read + only. + :vartype disk_size_bytes: long + :ivar unique_id: Unique Guid identifying the resource. + :vartype unique_id: str + :param encryption_settings_collection: Encryption settings collection used + for Azure Disk Encryption, can contain multiple encryption settings per + disk or snapshot. + :type encryption_settings_collection: + ~azure.mgmt.compute.v2019_03_01.models.EncryptionSettingsCollection + :ivar provisioning_state: The disk provisioning state. + :vartype provisioning_state: str + :param disk_iops_read_write: The number of IOPS allowed for this disk; + only settable for UltraSSD disks. One operation can transfer between 4k + and 256k bytes. + :type disk_iops_read_write: long + :param disk_mbps_read_write: The bandwidth allowed for this disk; only + settable for UltraSSD disks. MBps means millions of bytes per second - MB + here uses the ISO notation, of powers of 10. + :type disk_mbps_read_write: int + :ivar disk_state: The state of the disk. Possible values include: + 'Unattached', 'Attached', 'Reserved', 'ActiveSAS', 'ReadyToUpload', + 'ActiveUpload' + :vartype disk_state: str or + ~azure.mgmt.compute.v2019_03_01.models.DiskState + """ + + _validation = { + 'id': {'readonly': True}, + 'name': {'readonly': True}, + 'type': {'readonly': True}, + 'location': {'required': True}, + 'managed_by': {'readonly': True}, + 'time_created': {'readonly': True}, + 'creation_data': {'required': True}, + 'disk_size_bytes': {'readonly': True}, + 'unique_id': {'readonly': True}, + 'provisioning_state': {'readonly': True}, + 'disk_state': {'readonly': True}, + } + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + 'name': {'key': 'name', 'type': 'str'}, + 'type': {'key': 'type', 'type': 'str'}, + 'location': {'key': 'location', 'type': 'str'}, + 'tags': {'key': 'tags', 'type': '{str}'}, + 'managed_by': {'key': 'managedBy', 'type': 'str'}, + 'sku': {'key': 'sku', 'type': 'DiskSku'}, + 'zones': {'key': 'zones', 'type': '[str]'}, + 'time_created': {'key': 'properties.timeCreated', 'type': 'iso-8601'}, + 'os_type': {'key': 'properties.osType', 'type': 'OperatingSystemTypes'}, + 'hyper_vgeneration': {'key': 'properties.hyperVGeneration', 'type': 'str'}, + 'creation_data': {'key': 'properties.creationData', 'type': 'CreationData'}, + 'disk_size_gb': {'key': 'properties.diskSizeGB', 'type': 'int'}, + 'disk_size_bytes': {'key': 'properties.diskSizeBytes', 'type': 'long'}, + 'unique_id': {'key': 'properties.uniqueId', 'type': 'str'}, + 'encryption_settings_collection': {'key': 'properties.encryptionSettingsCollection', 'type': 'EncryptionSettingsCollection'}, + 'provisioning_state': {'key': 'properties.provisioningState', 'type': 'str'}, + 'disk_iops_read_write': {'key': 'properties.diskIOPSReadWrite', 'type': 'long'}, + 'disk_mbps_read_write': {'key': 'properties.diskMBpsReadWrite', 'type': 'int'}, + 'disk_state': {'key': 'properties.diskState', 'type': 'str'}, + } + + def __init__(self, **kwargs): + super(Disk, self).__init__(**kwargs) + self.managed_by = None + self.sku = kwargs.get('sku', None) + self.zones = kwargs.get('zones', None) + self.time_created = None + self.os_type = kwargs.get('os_type', None) + self.hyper_vgeneration = kwargs.get('hyper_vgeneration', None) + self.creation_data = kwargs.get('creation_data', None) + self.disk_size_gb = kwargs.get('disk_size_gb', None) + self.disk_size_bytes = None + self.unique_id = None + self.encryption_settings_collection = kwargs.get('encryption_settings_collection', None) + self.provisioning_state = None + self.disk_iops_read_write = kwargs.get('disk_iops_read_write', None) + self.disk_mbps_read_write = kwargs.get('disk_mbps_read_write', None) + self.disk_state = None + + class DiskEncryptionSettings(Model): """Describes a Encryption Settings for a Disk. @@ -1130,6 +1342,153 @@ def __init__(self, **kwargs): self.statuses = kwargs.get('statuses', None) +class DiskSku(Model): + """The disks sku name. Can be Standard_LRS, Premium_LRS, StandardSSD_LRS, or + UltraSSD_LRS. + + Variables are only populated by the server, and will be ignored when + sending a request. + + :param name: The sku name. Possible values include: 'Standard_LRS', + 'Premium_LRS', 'StandardSSD_LRS', 'UltraSSD_LRS' + :type name: str or + ~azure.mgmt.compute.v2019_03_01.models.DiskStorageAccountTypes + :ivar tier: The sku tier. + :vartype tier: str + """ + + _validation = { + 'tier': {'readonly': True}, + } + + _attribute_map = { + 'name': {'key': 'name', 'type': 'str'}, + 'tier': {'key': 'tier', 'type': 'str'}, + } + + def __init__(self, **kwargs): + super(DiskSku, self).__init__(**kwargs) + self.name = kwargs.get('name', None) + self.tier = None + + +class DiskUpdate(Model): + """Disk update resource. + + :param os_type: the Operating System type. Possible values include: + 'Windows', 'Linux' + :type os_type: str or + ~azure.mgmt.compute.v2019_03_01.models.OperatingSystemTypes + :param disk_size_gb: If creationData.createOption is Empty, this field is + mandatory and it indicates the size of the disk to create. If this field + is present for updates or creation with other options, it indicates a + resize. Resizes are only allowed if the disk is not attached to a running + VM, and can only increase the disk's size. + :type disk_size_gb: int + :param encryption_settings_collection: Encryption settings collection used + be Azure Disk Encryption, can contain multiple encryption settings per + disk or snapshot. + :type encryption_settings_collection: + ~azure.mgmt.compute.v2019_03_01.models.EncryptionSettingsCollection + :param disk_iops_read_write: The number of IOPS allowed for this disk; + only settable for UltraSSD disks. One operation can transfer between 4k + and 256k bytes. + :type disk_iops_read_write: long + :param disk_mbps_read_write: The bandwidth allowed for this disk; only + settable for UltraSSD disks. MBps means millions of bytes per second - MB + here uses the ISO notation, of powers of 10. + :type disk_mbps_read_write: int + :param tags: Resource tags + :type tags: dict[str, str] + :param sku: + :type sku: ~azure.mgmt.compute.v2019_03_01.models.DiskSku + """ + + _attribute_map = { + 'os_type': {'key': 'properties.osType', 'type': 'OperatingSystemTypes'}, + 'disk_size_gb': {'key': 'properties.diskSizeGB', 'type': 'int'}, + 'encryption_settings_collection': {'key': 'properties.encryptionSettingsCollection', 'type': 'EncryptionSettingsCollection'}, + 'disk_iops_read_write': {'key': 'properties.diskIOPSReadWrite', 'type': 'long'}, + 'disk_mbps_read_write': {'key': 'properties.diskMBpsReadWrite', 'type': 'int'}, + 'tags': {'key': 'tags', 'type': '{str}'}, + 'sku': {'key': 'sku', 'type': 'DiskSku'}, + } + + def __init__(self, **kwargs): + super(DiskUpdate, self).__init__(**kwargs) + self.os_type = kwargs.get('os_type', None) + self.disk_size_gb = kwargs.get('disk_size_gb', None) + self.encryption_settings_collection = kwargs.get('encryption_settings_collection', None) + self.disk_iops_read_write = kwargs.get('disk_iops_read_write', None) + self.disk_mbps_read_write = kwargs.get('disk_mbps_read_write', None) + self.tags = kwargs.get('tags', None) + self.sku = kwargs.get('sku', None) + + +class EncryptionSettingsCollection(Model): + """Encryption settings for disk or snapshot. + + All required parameters must be populated in order to send to Azure. + + :param enabled: Required. Set this flag to true and provide + DiskEncryptionKey and optional KeyEncryptionKey to enable encryption. Set + this flag to false and remove DiskEncryptionKey and KeyEncryptionKey to + disable encryption. If EncryptionSettings is null in the request object, + the existing settings remain unchanged. + :type enabled: bool + :param encryption_settings: A collection of encryption settings, one for + each disk volume. + :type encryption_settings: + list[~azure.mgmt.compute.v2019_03_01.models.EncryptionSettingsElement] + :param encryption_settings_version: Describes what type of encryption is + used for the disks. Once this field is set, it cannot be overwritten. + '1.0' corresponds to Azure Disk Encryption with AAD app.'1.1' corresponds + to Azure Disk Encryption. + :type encryption_settings_version: str + """ + + _validation = { + 'enabled': {'required': True}, + } + + _attribute_map = { + 'enabled': {'key': 'enabled', 'type': 'bool'}, + 'encryption_settings': {'key': 'encryptionSettings', 'type': '[EncryptionSettingsElement]'}, + 'encryption_settings_version': {'key': 'encryptionSettingsVersion', 'type': 'str'}, + } + + def __init__(self, **kwargs): + super(EncryptionSettingsCollection, self).__init__(**kwargs) + self.enabled = kwargs.get('enabled', None) + self.encryption_settings = kwargs.get('encryption_settings', None) + self.encryption_settings_version = kwargs.get('encryption_settings_version', None) + + +class EncryptionSettingsElement(Model): + """Encryption settings for one disk volume. + + :param disk_encryption_key: Key Vault Secret Url and vault id of the disk + encryption key + :type disk_encryption_key: + ~azure.mgmt.compute.v2019_03_01.models.KeyVaultAndSecretReference + :param key_encryption_key: Key Vault Key Url and vault id of the key + encryption key. KeyEncryptionKey is optional and when provided is used to + unwrap the disk encryption key. + :type key_encryption_key: + ~azure.mgmt.compute.v2019_03_01.models.KeyVaultAndKeyReference + """ + + _attribute_map = { + 'disk_encryption_key': {'key': 'diskEncryptionKey', 'type': 'KeyVaultAndSecretReference'}, + 'key_encryption_key': {'key': 'keyEncryptionKey', 'type': 'KeyVaultAndKeyReference'}, + } + + def __init__(self, **kwargs): + super(EncryptionSettingsElement, self).__init__(**kwargs) + self.disk_encryption_key = kwargs.get('disk_encryption_key', None) + self.key_encryption_key = kwargs.get('key_encryption_key', None) + + class Gallery(Resource): """Specifies information about the Shared Image Gallery that you want to create or update. @@ -1881,6 +2240,34 @@ def __init__(self, **kwargs): super(GalleryOSDiskImage, self).__init__(**kwargs) +class GrantAccessData(Model): + """Data used for requesting a SAS. + + All required parameters must be populated in order to send to Azure. + + :param access: Required. Possible values include: 'None', 'Read', 'Write' + :type access: str or ~azure.mgmt.compute.v2019_03_01.models.AccessLevel + :param duration_in_seconds: Required. Time duration in seconds until the + SAS access expires. + :type duration_in_seconds: int + """ + + _validation = { + 'access': {'required': True}, + 'duration_in_seconds': {'required': True}, + } + + _attribute_map = { + 'access': {'key': 'access', 'type': 'str'}, + 'duration_in_seconds': {'key': 'durationInSeconds', 'type': 'int'}, + } + + def __init__(self, **kwargs): + super(GrantAccessData, self).__init__(**kwargs) + self.access = kwargs.get('access', None) + self.duration_in_seconds = kwargs.get('duration_in_seconds', None) + + class HardwareProfile(Model): """Specifies the hardware settings for the virtual machine. @@ -2075,6 +2462,35 @@ def __init__(self, **kwargs): self.storage_account_type = kwargs.get('storage_account_type', None) +class ImageDiskReference(Model): + """The source image used for creating the disk. + + All required parameters must be populated in order to send to Azure. + + :param id: Required. A relative uri containing either a Platform Image + Repository or user image reference. + :type id: str + :param lun: If the disk is created from an image's data disk, this is an + index that indicates which of the data disks in the image to use. For OS + disks, this field is null. + :type lun: int + """ + + _validation = { + 'id': {'required': True}, + } + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + 'lun': {'key': 'lun', 'type': 'int'}, + } + + def __init__(self, **kwargs): + super(ImageDiskReference, self).__init__(**kwargs) + self.id = kwargs.get('id', None) + self.lun = kwargs.get('lun', None) + + class ImageOSDisk(Model): """Describes an Operating System disk. @@ -2355,6 +2771,63 @@ def __init__(self, **kwargs): self.time = kwargs.get('time', None) +class KeyVaultAndKeyReference(Model): + """Key Vault Key Url and vault id of KeK, KeK is optional and when provided is + used to unwrap the encryptionKey. + + All required parameters must be populated in order to send to Azure. + + :param source_vault: Required. Resource id of the KeyVault containing the + key or secret + :type source_vault: ~azure.mgmt.compute.v2019_03_01.models.SourceVault + :param key_url: Required. Url pointing to a key or secret in KeyVault + :type key_url: str + """ + + _validation = { + 'source_vault': {'required': True}, + 'key_url': {'required': True}, + } + + _attribute_map = { + 'source_vault': {'key': 'sourceVault', 'type': 'SourceVault'}, + 'key_url': {'key': 'keyUrl', 'type': 'str'}, + } + + def __init__(self, **kwargs): + super(KeyVaultAndKeyReference, self).__init__(**kwargs) + self.source_vault = kwargs.get('source_vault', None) + self.key_url = kwargs.get('key_url', None) + + +class KeyVaultAndSecretReference(Model): + """Key Vault Secret Url and vault id of the encryption key . + + All required parameters must be populated in order to send to Azure. + + :param source_vault: Required. Resource id of the KeyVault containing the + key or secret + :type source_vault: ~azure.mgmt.compute.v2019_03_01.models.SourceVault + :param secret_url: Required. Url pointing to a key or secret in KeyVault + :type secret_url: str + """ + + _validation = { + 'source_vault': {'required': True}, + 'secret_url': {'required': True}, + } + + _attribute_map = { + 'source_vault': {'key': 'sourceVault', 'type': 'SourceVault'}, + 'secret_url': {'key': 'secretUrl', 'type': 'str'}, + } + + def __init__(self, **kwargs): + super(KeyVaultAndSecretReference, self).__init__(**kwargs) + self.source_vault = kwargs.get('source_vault', None) + self.secret_url = kwargs.get('secret_url', None) + + class KeyVaultKeyReference(Model): """Describes a reference to Key Vault Key. @@ -3741,6 +4214,201 @@ def __init__(self, **kwargs): self.capacity = kwargs.get('capacity', None) +class Snapshot(Resource): + """Snapshot resource. + + Variables are only populated by the server, and will be ignored when + sending a request. + + All required parameters must be populated in order to send to Azure. + + :ivar id: Resource Id + :vartype id: str + :ivar name: Resource name + :vartype name: str + :ivar type: Resource type + :vartype type: str + :param location: Required. Resource location + :type location: str + :param tags: Resource tags + :type tags: dict[str, str] + :ivar managed_by: Unused. Always Null. + :vartype managed_by: str + :param sku: + :type sku: ~azure.mgmt.compute.v2019_03_01.models.SnapshotSku + :ivar time_created: The time when the disk was created. + :vartype time_created: datetime + :param os_type: The Operating System type. Possible values include: + 'Windows', 'Linux' + :type os_type: str or + ~azure.mgmt.compute.v2019_03_01.models.OperatingSystemTypes + :param hyper_vgeneration: The hypervisor generation of the Virtual + Machine. Applicable to OS disks only. Possible values include: 'V1', 'V2' + :type hyper_vgeneration: str or + ~azure.mgmt.compute.v2019_03_01.models.HyperVGeneration + :param creation_data: Required. Disk source information. CreationData + information cannot be changed after the disk has been created. + :type creation_data: ~azure.mgmt.compute.v2019_03_01.models.CreationData + :param disk_size_gb: If creationData.createOption is Empty, this field is + mandatory and it indicates the size of the disk to create. If this field + is present for updates or creation with other options, it indicates a + resize. Resizes are only allowed if the disk is not attached to a running + VM, and can only increase the disk's size. + :type disk_size_gb: int + :ivar disk_size_bytes: The size of the disk in bytes. This field is read + only. + :vartype disk_size_bytes: long + :ivar unique_id: Unique Guid identifying the resource. + :vartype unique_id: str + :param encryption_settings_collection: Encryption settings collection used + be Azure Disk Encryption, can contain multiple encryption settings per + disk or snapshot. + :type encryption_settings_collection: + ~azure.mgmt.compute.v2019_03_01.models.EncryptionSettingsCollection + :ivar provisioning_state: The disk provisioning state. + :vartype provisioning_state: str + :param incremental: Whether a snapshot is incremental. Incremental + snapshots on the same disk occupy less space than full snapshots and can + be diffed. + :type incremental: bool + """ + + _validation = { + 'id': {'readonly': True}, + 'name': {'readonly': True}, + 'type': {'readonly': True}, + 'location': {'required': True}, + 'managed_by': {'readonly': True}, + 'time_created': {'readonly': True}, + 'creation_data': {'required': True}, + 'disk_size_bytes': {'readonly': True}, + 'unique_id': {'readonly': True}, + 'provisioning_state': {'readonly': True}, + } + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + 'name': {'key': 'name', 'type': 'str'}, + 'type': {'key': 'type', 'type': 'str'}, + 'location': {'key': 'location', 'type': 'str'}, + 'tags': {'key': 'tags', 'type': '{str}'}, + 'managed_by': {'key': 'managedBy', 'type': 'str'}, + 'sku': {'key': 'sku', 'type': 'SnapshotSku'}, + 'time_created': {'key': 'properties.timeCreated', 'type': 'iso-8601'}, + 'os_type': {'key': 'properties.osType', 'type': 'OperatingSystemTypes'}, + 'hyper_vgeneration': {'key': 'properties.hyperVGeneration', 'type': 'str'}, + 'creation_data': {'key': 'properties.creationData', 'type': 'CreationData'}, + 'disk_size_gb': {'key': 'properties.diskSizeGB', 'type': 'int'}, + 'disk_size_bytes': {'key': 'properties.diskSizeBytes', 'type': 'long'}, + 'unique_id': {'key': 'properties.uniqueId', 'type': 'str'}, + 'encryption_settings_collection': {'key': 'properties.encryptionSettingsCollection', 'type': 'EncryptionSettingsCollection'}, + 'provisioning_state': {'key': 'properties.provisioningState', 'type': 'str'}, + 'incremental': {'key': 'properties.incremental', 'type': 'bool'}, + } + + def __init__(self, **kwargs): + super(Snapshot, self).__init__(**kwargs) + self.managed_by = None + self.sku = kwargs.get('sku', None) + self.time_created = None + self.os_type = kwargs.get('os_type', None) + self.hyper_vgeneration = kwargs.get('hyper_vgeneration', None) + self.creation_data = kwargs.get('creation_data', None) + self.disk_size_gb = kwargs.get('disk_size_gb', None) + self.disk_size_bytes = None + self.unique_id = None + self.encryption_settings_collection = kwargs.get('encryption_settings_collection', None) + self.provisioning_state = None + self.incremental = kwargs.get('incremental', None) + + +class SnapshotSku(Model): + """The snapshots sku name. Can be Standard_LRS, Premium_LRS, or Standard_ZRS. + + Variables are only populated by the server, and will be ignored when + sending a request. + + :param name: The sku name. Possible values include: 'Standard_LRS', + 'Premium_LRS', 'Standard_ZRS' + :type name: str or + ~azure.mgmt.compute.v2019_03_01.models.SnapshotStorageAccountTypes + :ivar tier: The sku tier. + :vartype tier: str + """ + + _validation = { + 'tier': {'readonly': True}, + } + + _attribute_map = { + 'name': {'key': 'name', 'type': 'str'}, + 'tier': {'key': 'tier', 'type': 'str'}, + } + + def __init__(self, **kwargs): + super(SnapshotSku, self).__init__(**kwargs) + self.name = kwargs.get('name', None) + self.tier = None + + +class SnapshotUpdate(Model): + """Snapshot update resource. + + :param os_type: the Operating System type. Possible values include: + 'Windows', 'Linux' + :type os_type: str or + ~azure.mgmt.compute.v2019_03_01.models.OperatingSystemTypes + :param disk_size_gb: If creationData.createOption is Empty, this field is + mandatory and it indicates the size of the disk to create. If this field + is present for updates or creation with other options, it indicates a + resize. Resizes are only allowed if the disk is not attached to a running + VM, and can only increase the disk's size. + :type disk_size_gb: int + :param encryption_settings_collection: Encryption settings collection used + be Azure Disk Encryption, can contain multiple encryption settings per + disk or snapshot. + :type encryption_settings_collection: + ~azure.mgmt.compute.v2019_03_01.models.EncryptionSettingsCollection + :param tags: Resource tags + :type tags: dict[str, str] + :param sku: + :type sku: ~azure.mgmt.compute.v2019_03_01.models.SnapshotSku + """ + + _attribute_map = { + 'os_type': {'key': 'properties.osType', 'type': 'OperatingSystemTypes'}, + 'disk_size_gb': {'key': 'properties.diskSizeGB', 'type': 'int'}, + 'encryption_settings_collection': {'key': 'properties.encryptionSettingsCollection', 'type': 'EncryptionSettingsCollection'}, + 'tags': {'key': 'tags', 'type': '{str}'}, + 'sku': {'key': 'sku', 'type': 'SnapshotSku'}, + } + + def __init__(self, **kwargs): + super(SnapshotUpdate, self).__init__(**kwargs) + self.os_type = kwargs.get('os_type', None) + self.disk_size_gb = kwargs.get('disk_size_gb', None) + self.encryption_settings_collection = kwargs.get('encryption_settings_collection', None) + self.tags = kwargs.get('tags', None) + self.sku = kwargs.get('sku', None) + + +class SourceVault(Model): + """The vault id is an Azure Resource Manager Resource id in the form + /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.KeyVault/vaults/{vaultName}. + + :param id: Resource Id + :type id: str + """ + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + } + + def __init__(self, **kwargs): + super(SourceVault, self).__init__(**kwargs) + self.id = kwargs.get('id', None) + + class SshConfiguration(Model): """SSH configuration for Linux based VMs running on Azure. diff --git a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2019_03_01/models/_models_py3.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2019_03_01/models/_models_py3.py index 1ecd9cf229d6..47b02bdd5e0e 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2019_03_01/models/_models_py3.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2019_03_01/models/_models_py3.py @@ -13,6 +13,29 @@ from msrest.exceptions import HttpOperationError +class AccessUri(Model): + """A disk access SAS uri. + + Variables are only populated by the server, and will be ignored when + sending a request. + + :ivar access_sas: A SAS uri for accessing a disk. + :vartype access_sas: str + """ + + _validation = { + 'access_sas': {'readonly': True}, + } + + _attribute_map = { + 'access_sas': {'key': 'accessSAS', 'type': 'str'}, + } + + def __init__(self, **kwargs) -> None: + super(AccessUri, self).__init__(**kwargs) + self.access_sas = None + + class AdditionalCapabilities(Model): """Enables or disables a capability on the virtual machine or virtual machine scale set. @@ -558,6 +581,68 @@ def __init__(self, **kwargs) -> None: self.provider = None +class CreationData(Model): + """Data used when creating a disk. + + Variables are only populated by the server, and will be ignored when + sending a request. + + All required parameters must be populated in order to send to Azure. + + :param create_option: Required. This enumerates the possible sources of a + disk's creation. Possible values include: 'Empty', 'Attach', 'FromImage', + 'Import', 'Copy', 'Restore', 'Upload' + :type create_option: str or + ~azure.mgmt.compute.v2019_03_01.models.DiskCreateOption + :param storage_account_id: If createOption is Import, the Azure Resource + Manager identifier of the storage account containing the blob to import as + a disk. Required only if the blob is in a different subscription + :type storage_account_id: str + :param image_reference: Disk source information. + :type image_reference: + ~azure.mgmt.compute.v2019_03_01.models.ImageDiskReference + :param source_uri: If createOption is Import, this is the URI of a blob to + be imported into a managed disk. + :type source_uri: str + :param source_resource_id: If createOption is Copy, this is the ARM id of + the source snapshot or disk. + :type source_resource_id: str + :ivar source_unique_id: If this field is set, this is the unique id + identifying the source of this resource. + :vartype source_unique_id: str + :param upload_size_bytes: If createOption is Upload, this is the size of + the contents of the upload including the VHD footer. This value should be + between 20972032 (20 MiB + 512 bytes for the VHD footer) and + 35183298347520 bytes (32 TiB + 512 bytes for the VHD footer). + :type upload_size_bytes: long + """ + + _validation = { + 'create_option': {'required': True}, + 'source_unique_id': {'readonly': True}, + } + + _attribute_map = { + 'create_option': {'key': 'createOption', 'type': 'str'}, + 'storage_account_id': {'key': 'storageAccountId', 'type': 'str'}, + 'image_reference': {'key': 'imageReference', 'type': 'ImageDiskReference'}, + 'source_uri': {'key': 'sourceUri', 'type': 'str'}, + 'source_resource_id': {'key': 'sourceResourceId', 'type': 'str'}, + 'source_unique_id': {'key': 'sourceUniqueId', 'type': 'str'}, + 'upload_size_bytes': {'key': 'uploadSizeBytes', 'type': 'long'}, + } + + def __init__(self, *, create_option, storage_account_id: str=None, image_reference=None, source_uri: str=None, source_resource_id: str=None, upload_size_bytes: int=None, **kwargs) -> None: + super(CreationData, self).__init__(**kwargs) + self.create_option = create_option + self.storage_account_id = storage_account_id + self.image_reference = image_reference + self.source_uri = source_uri + self.source_resource_id = source_resource_id + self.source_unique_id = None + self.upload_size_bytes = upload_size_bytes + + class DataDisk(Model): """Describes a data disk. @@ -1074,6 +1159,133 @@ def __init__(self, *, disk_types=None, **kwargs) -> None: self.disk_types = disk_types +class Disk(Resource): + """Disk resource. + + Variables are only populated by the server, and will be ignored when + sending a request. + + All required parameters must be populated in order to send to Azure. + + :ivar id: Resource Id + :vartype id: str + :ivar name: Resource name + :vartype name: str + :ivar type: Resource type + :vartype type: str + :param location: Required. Resource location + :type location: str + :param tags: Resource tags + :type tags: dict[str, str] + :ivar managed_by: A relative URI containing the ID of the VM that has the + disk attached. + :vartype managed_by: str + :param sku: + :type sku: ~azure.mgmt.compute.v2019_03_01.models.DiskSku + :param zones: The Logical zone list for Disk. + :type zones: list[str] + :ivar time_created: The time when the disk was created. + :vartype time_created: datetime + :param os_type: The Operating System type. Possible values include: + 'Windows', 'Linux' + :type os_type: str or + ~azure.mgmt.compute.v2019_03_01.models.OperatingSystemTypes + :param hyper_vgeneration: The hypervisor generation of the Virtual + Machine. Applicable to OS disks only. Possible values include: 'V1', 'V2' + :type hyper_vgeneration: str or + ~azure.mgmt.compute.v2019_03_01.models.HyperVGeneration + :param creation_data: Required. Disk source information. CreationData + information cannot be changed after the disk has been created. + :type creation_data: ~azure.mgmt.compute.v2019_03_01.models.CreationData + :param disk_size_gb: If creationData.createOption is Empty, this field is + mandatory and it indicates the size of the disk to create. If this field + is present for updates or creation with other options, it indicates a + resize. Resizes are only allowed if the disk is not attached to a running + VM, and can only increase the disk's size. + :type disk_size_gb: int + :ivar disk_size_bytes: The size of the disk in bytes. This field is read + only. + :vartype disk_size_bytes: long + :ivar unique_id: Unique Guid identifying the resource. + :vartype unique_id: str + :param encryption_settings_collection: Encryption settings collection used + for Azure Disk Encryption, can contain multiple encryption settings per + disk or snapshot. + :type encryption_settings_collection: + ~azure.mgmt.compute.v2019_03_01.models.EncryptionSettingsCollection + :ivar provisioning_state: The disk provisioning state. + :vartype provisioning_state: str + :param disk_iops_read_write: The number of IOPS allowed for this disk; + only settable for UltraSSD disks. One operation can transfer between 4k + and 256k bytes. + :type disk_iops_read_write: long + :param disk_mbps_read_write: The bandwidth allowed for this disk; only + settable for UltraSSD disks. MBps means millions of bytes per second - MB + here uses the ISO notation, of powers of 10. + :type disk_mbps_read_write: int + :ivar disk_state: The state of the disk. Possible values include: + 'Unattached', 'Attached', 'Reserved', 'ActiveSAS', 'ReadyToUpload', + 'ActiveUpload' + :vartype disk_state: str or + ~azure.mgmt.compute.v2019_03_01.models.DiskState + """ + + _validation = { + 'id': {'readonly': True}, + 'name': {'readonly': True}, + 'type': {'readonly': True}, + 'location': {'required': True}, + 'managed_by': {'readonly': True}, + 'time_created': {'readonly': True}, + 'creation_data': {'required': True}, + 'disk_size_bytes': {'readonly': True}, + 'unique_id': {'readonly': True}, + 'provisioning_state': {'readonly': True}, + 'disk_state': {'readonly': True}, + } + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + 'name': {'key': 'name', 'type': 'str'}, + 'type': {'key': 'type', 'type': 'str'}, + 'location': {'key': 'location', 'type': 'str'}, + 'tags': {'key': 'tags', 'type': '{str}'}, + 'managed_by': {'key': 'managedBy', 'type': 'str'}, + 'sku': {'key': 'sku', 'type': 'DiskSku'}, + 'zones': {'key': 'zones', 'type': '[str]'}, + 'time_created': {'key': 'properties.timeCreated', 'type': 'iso-8601'}, + 'os_type': {'key': 'properties.osType', 'type': 'OperatingSystemTypes'}, + 'hyper_vgeneration': {'key': 'properties.hyperVGeneration', 'type': 'str'}, + 'creation_data': {'key': 'properties.creationData', 'type': 'CreationData'}, + 'disk_size_gb': {'key': 'properties.diskSizeGB', 'type': 'int'}, + 'disk_size_bytes': {'key': 'properties.diskSizeBytes', 'type': 'long'}, + 'unique_id': {'key': 'properties.uniqueId', 'type': 'str'}, + 'encryption_settings_collection': {'key': 'properties.encryptionSettingsCollection', 'type': 'EncryptionSettingsCollection'}, + 'provisioning_state': {'key': 'properties.provisioningState', 'type': 'str'}, + 'disk_iops_read_write': {'key': 'properties.diskIOPSReadWrite', 'type': 'long'}, + 'disk_mbps_read_write': {'key': 'properties.diskMBpsReadWrite', 'type': 'int'}, + 'disk_state': {'key': 'properties.diskState', 'type': 'str'}, + } + + def __init__(self, *, location: str, creation_data, tags=None, sku=None, zones=None, os_type=None, hyper_vgeneration=None, disk_size_gb: int=None, encryption_settings_collection=None, disk_iops_read_write: int=None, disk_mbps_read_write: int=None, **kwargs) -> None: + super(Disk, self).__init__(location=location, tags=tags, **kwargs) + self.managed_by = None + self.sku = sku + self.zones = zones + self.time_created = None + self.os_type = os_type + self.hyper_vgeneration = hyper_vgeneration + self.creation_data = creation_data + self.disk_size_gb = disk_size_gb + self.disk_size_bytes = None + self.unique_id = None + self.encryption_settings_collection = encryption_settings_collection + self.provisioning_state = None + self.disk_iops_read_write = disk_iops_read_write + self.disk_mbps_read_write = disk_mbps_read_write + self.disk_state = None + + class DiskEncryptionSettings(Model): """Describes a Encryption Settings for a Disk. @@ -1130,6 +1342,153 @@ def __init__(self, *, name: str=None, encryption_settings=None, statuses=None, * self.statuses = statuses +class DiskSku(Model): + """The disks sku name. Can be Standard_LRS, Premium_LRS, StandardSSD_LRS, or + UltraSSD_LRS. + + Variables are only populated by the server, and will be ignored when + sending a request. + + :param name: The sku name. Possible values include: 'Standard_LRS', + 'Premium_LRS', 'StandardSSD_LRS', 'UltraSSD_LRS' + :type name: str or + ~azure.mgmt.compute.v2019_03_01.models.DiskStorageAccountTypes + :ivar tier: The sku tier. + :vartype tier: str + """ + + _validation = { + 'tier': {'readonly': True}, + } + + _attribute_map = { + 'name': {'key': 'name', 'type': 'str'}, + 'tier': {'key': 'tier', 'type': 'str'}, + } + + def __init__(self, *, name=None, **kwargs) -> None: + super(DiskSku, self).__init__(**kwargs) + self.name = name + self.tier = None + + +class DiskUpdate(Model): + """Disk update resource. + + :param os_type: the Operating System type. Possible values include: + 'Windows', 'Linux' + :type os_type: str or + ~azure.mgmt.compute.v2019_03_01.models.OperatingSystemTypes + :param disk_size_gb: If creationData.createOption is Empty, this field is + mandatory and it indicates the size of the disk to create. If this field + is present for updates or creation with other options, it indicates a + resize. Resizes are only allowed if the disk is not attached to a running + VM, and can only increase the disk's size. + :type disk_size_gb: int + :param encryption_settings_collection: Encryption settings collection used + be Azure Disk Encryption, can contain multiple encryption settings per + disk or snapshot. + :type encryption_settings_collection: + ~azure.mgmt.compute.v2019_03_01.models.EncryptionSettingsCollection + :param disk_iops_read_write: The number of IOPS allowed for this disk; + only settable for UltraSSD disks. One operation can transfer between 4k + and 256k bytes. + :type disk_iops_read_write: long + :param disk_mbps_read_write: The bandwidth allowed for this disk; only + settable for UltraSSD disks. MBps means millions of bytes per second - MB + here uses the ISO notation, of powers of 10. + :type disk_mbps_read_write: int + :param tags: Resource tags + :type tags: dict[str, str] + :param sku: + :type sku: ~azure.mgmt.compute.v2019_03_01.models.DiskSku + """ + + _attribute_map = { + 'os_type': {'key': 'properties.osType', 'type': 'OperatingSystemTypes'}, + 'disk_size_gb': {'key': 'properties.diskSizeGB', 'type': 'int'}, + 'encryption_settings_collection': {'key': 'properties.encryptionSettingsCollection', 'type': 'EncryptionSettingsCollection'}, + 'disk_iops_read_write': {'key': 'properties.diskIOPSReadWrite', 'type': 'long'}, + 'disk_mbps_read_write': {'key': 'properties.diskMBpsReadWrite', 'type': 'int'}, + 'tags': {'key': 'tags', 'type': '{str}'}, + 'sku': {'key': 'sku', 'type': 'DiskSku'}, + } + + def __init__(self, *, os_type=None, disk_size_gb: int=None, encryption_settings_collection=None, disk_iops_read_write: int=None, disk_mbps_read_write: int=None, tags=None, sku=None, **kwargs) -> None: + super(DiskUpdate, self).__init__(**kwargs) + self.os_type = os_type + self.disk_size_gb = disk_size_gb + self.encryption_settings_collection = encryption_settings_collection + self.disk_iops_read_write = disk_iops_read_write + self.disk_mbps_read_write = disk_mbps_read_write + self.tags = tags + self.sku = sku + + +class EncryptionSettingsCollection(Model): + """Encryption settings for disk or snapshot. + + All required parameters must be populated in order to send to Azure. + + :param enabled: Required. Set this flag to true and provide + DiskEncryptionKey and optional KeyEncryptionKey to enable encryption. Set + this flag to false and remove DiskEncryptionKey and KeyEncryptionKey to + disable encryption. If EncryptionSettings is null in the request object, + the existing settings remain unchanged. + :type enabled: bool + :param encryption_settings: A collection of encryption settings, one for + each disk volume. + :type encryption_settings: + list[~azure.mgmt.compute.v2019_03_01.models.EncryptionSettingsElement] + :param encryption_settings_version: Describes what type of encryption is + used for the disks. Once this field is set, it cannot be overwritten. + '1.0' corresponds to Azure Disk Encryption with AAD app.'1.1' corresponds + to Azure Disk Encryption. + :type encryption_settings_version: str + """ + + _validation = { + 'enabled': {'required': True}, + } + + _attribute_map = { + 'enabled': {'key': 'enabled', 'type': 'bool'}, + 'encryption_settings': {'key': 'encryptionSettings', 'type': '[EncryptionSettingsElement]'}, + 'encryption_settings_version': {'key': 'encryptionSettingsVersion', 'type': 'str'}, + } + + def __init__(self, *, enabled: bool, encryption_settings=None, encryption_settings_version: str=None, **kwargs) -> None: + super(EncryptionSettingsCollection, self).__init__(**kwargs) + self.enabled = enabled + self.encryption_settings = encryption_settings + self.encryption_settings_version = encryption_settings_version + + +class EncryptionSettingsElement(Model): + """Encryption settings for one disk volume. + + :param disk_encryption_key: Key Vault Secret Url and vault id of the disk + encryption key + :type disk_encryption_key: + ~azure.mgmt.compute.v2019_03_01.models.KeyVaultAndSecretReference + :param key_encryption_key: Key Vault Key Url and vault id of the key + encryption key. KeyEncryptionKey is optional and when provided is used to + unwrap the disk encryption key. + :type key_encryption_key: + ~azure.mgmt.compute.v2019_03_01.models.KeyVaultAndKeyReference + """ + + _attribute_map = { + 'disk_encryption_key': {'key': 'diskEncryptionKey', 'type': 'KeyVaultAndSecretReference'}, + 'key_encryption_key': {'key': 'keyEncryptionKey', 'type': 'KeyVaultAndKeyReference'}, + } + + def __init__(self, *, disk_encryption_key=None, key_encryption_key=None, **kwargs) -> None: + super(EncryptionSettingsElement, self).__init__(**kwargs) + self.disk_encryption_key = disk_encryption_key + self.key_encryption_key = key_encryption_key + + class Gallery(Resource): """Specifies information about the Shared Image Gallery that you want to create or update. @@ -1881,6 +2240,34 @@ def __init__(self, **kwargs) -> None: super(GalleryOSDiskImage, self).__init__(**kwargs) +class GrantAccessData(Model): + """Data used for requesting a SAS. + + All required parameters must be populated in order to send to Azure. + + :param access: Required. Possible values include: 'None', 'Read', 'Write' + :type access: str or ~azure.mgmt.compute.v2019_03_01.models.AccessLevel + :param duration_in_seconds: Required. Time duration in seconds until the + SAS access expires. + :type duration_in_seconds: int + """ + + _validation = { + 'access': {'required': True}, + 'duration_in_seconds': {'required': True}, + } + + _attribute_map = { + 'access': {'key': 'access', 'type': 'str'}, + 'duration_in_seconds': {'key': 'durationInSeconds', 'type': 'int'}, + } + + def __init__(self, *, access, duration_in_seconds: int, **kwargs) -> None: + super(GrantAccessData, self).__init__(**kwargs) + self.access = access + self.duration_in_seconds = duration_in_seconds + + class HardwareProfile(Model): """Specifies the hardware settings for the virtual machine. @@ -2075,6 +2462,35 @@ def __init__(self, *, lun: int, snapshot=None, managed_disk=None, blob_uri: str= self.storage_account_type = storage_account_type +class ImageDiskReference(Model): + """The source image used for creating the disk. + + All required parameters must be populated in order to send to Azure. + + :param id: Required. A relative uri containing either a Platform Image + Repository or user image reference. + :type id: str + :param lun: If the disk is created from an image's data disk, this is an + index that indicates which of the data disks in the image to use. For OS + disks, this field is null. + :type lun: int + """ + + _validation = { + 'id': {'required': True}, + } + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + 'lun': {'key': 'lun', 'type': 'int'}, + } + + def __init__(self, *, id: str, lun: int=None, **kwargs) -> None: + super(ImageDiskReference, self).__init__(**kwargs) + self.id = id + self.lun = lun + + class ImageOSDisk(Model): """Describes an Operating System disk. @@ -2355,6 +2771,63 @@ def __init__(self, *, code: str=None, level=None, display_status: str=None, mess self.time = time +class KeyVaultAndKeyReference(Model): + """Key Vault Key Url and vault id of KeK, KeK is optional and when provided is + used to unwrap the encryptionKey. + + All required parameters must be populated in order to send to Azure. + + :param source_vault: Required. Resource id of the KeyVault containing the + key or secret + :type source_vault: ~azure.mgmt.compute.v2019_03_01.models.SourceVault + :param key_url: Required. Url pointing to a key or secret in KeyVault + :type key_url: str + """ + + _validation = { + 'source_vault': {'required': True}, + 'key_url': {'required': True}, + } + + _attribute_map = { + 'source_vault': {'key': 'sourceVault', 'type': 'SourceVault'}, + 'key_url': {'key': 'keyUrl', 'type': 'str'}, + } + + def __init__(self, *, source_vault, key_url: str, **kwargs) -> None: + super(KeyVaultAndKeyReference, self).__init__(**kwargs) + self.source_vault = source_vault + self.key_url = key_url + + +class KeyVaultAndSecretReference(Model): + """Key Vault Secret Url and vault id of the encryption key . + + All required parameters must be populated in order to send to Azure. + + :param source_vault: Required. Resource id of the KeyVault containing the + key or secret + :type source_vault: ~azure.mgmt.compute.v2019_03_01.models.SourceVault + :param secret_url: Required. Url pointing to a key or secret in KeyVault + :type secret_url: str + """ + + _validation = { + 'source_vault': {'required': True}, + 'secret_url': {'required': True}, + } + + _attribute_map = { + 'source_vault': {'key': 'sourceVault', 'type': 'SourceVault'}, + 'secret_url': {'key': 'secretUrl', 'type': 'str'}, + } + + def __init__(self, *, source_vault, secret_url: str, **kwargs) -> None: + super(KeyVaultAndSecretReference, self).__init__(**kwargs) + self.source_vault = source_vault + self.secret_url = secret_url + + class KeyVaultKeyReference(Model): """Describes a reference to Key Vault Key. @@ -3741,6 +4214,201 @@ def __init__(self, *, name: str=None, tier: str=None, capacity: int=None, **kwar self.capacity = capacity +class Snapshot(Resource): + """Snapshot resource. + + Variables are only populated by the server, and will be ignored when + sending a request. + + All required parameters must be populated in order to send to Azure. + + :ivar id: Resource Id + :vartype id: str + :ivar name: Resource name + :vartype name: str + :ivar type: Resource type + :vartype type: str + :param location: Required. Resource location + :type location: str + :param tags: Resource tags + :type tags: dict[str, str] + :ivar managed_by: Unused. Always Null. + :vartype managed_by: str + :param sku: + :type sku: ~azure.mgmt.compute.v2019_03_01.models.SnapshotSku + :ivar time_created: The time when the disk was created. + :vartype time_created: datetime + :param os_type: The Operating System type. Possible values include: + 'Windows', 'Linux' + :type os_type: str or + ~azure.mgmt.compute.v2019_03_01.models.OperatingSystemTypes + :param hyper_vgeneration: The hypervisor generation of the Virtual + Machine. Applicable to OS disks only. Possible values include: 'V1', 'V2' + :type hyper_vgeneration: str or + ~azure.mgmt.compute.v2019_03_01.models.HyperVGeneration + :param creation_data: Required. Disk source information. CreationData + information cannot be changed after the disk has been created. + :type creation_data: ~azure.mgmt.compute.v2019_03_01.models.CreationData + :param disk_size_gb: If creationData.createOption is Empty, this field is + mandatory and it indicates the size of the disk to create. If this field + is present for updates or creation with other options, it indicates a + resize. Resizes are only allowed if the disk is not attached to a running + VM, and can only increase the disk's size. + :type disk_size_gb: int + :ivar disk_size_bytes: The size of the disk in bytes. This field is read + only. + :vartype disk_size_bytes: long + :ivar unique_id: Unique Guid identifying the resource. + :vartype unique_id: str + :param encryption_settings_collection: Encryption settings collection used + be Azure Disk Encryption, can contain multiple encryption settings per + disk or snapshot. + :type encryption_settings_collection: + ~azure.mgmt.compute.v2019_03_01.models.EncryptionSettingsCollection + :ivar provisioning_state: The disk provisioning state. + :vartype provisioning_state: str + :param incremental: Whether a snapshot is incremental. Incremental + snapshots on the same disk occupy less space than full snapshots and can + be diffed. + :type incremental: bool + """ + + _validation = { + 'id': {'readonly': True}, + 'name': {'readonly': True}, + 'type': {'readonly': True}, + 'location': {'required': True}, + 'managed_by': {'readonly': True}, + 'time_created': {'readonly': True}, + 'creation_data': {'required': True}, + 'disk_size_bytes': {'readonly': True}, + 'unique_id': {'readonly': True}, + 'provisioning_state': {'readonly': True}, + } + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + 'name': {'key': 'name', 'type': 'str'}, + 'type': {'key': 'type', 'type': 'str'}, + 'location': {'key': 'location', 'type': 'str'}, + 'tags': {'key': 'tags', 'type': '{str}'}, + 'managed_by': {'key': 'managedBy', 'type': 'str'}, + 'sku': {'key': 'sku', 'type': 'SnapshotSku'}, + 'time_created': {'key': 'properties.timeCreated', 'type': 'iso-8601'}, + 'os_type': {'key': 'properties.osType', 'type': 'OperatingSystemTypes'}, + 'hyper_vgeneration': {'key': 'properties.hyperVGeneration', 'type': 'str'}, + 'creation_data': {'key': 'properties.creationData', 'type': 'CreationData'}, + 'disk_size_gb': {'key': 'properties.diskSizeGB', 'type': 'int'}, + 'disk_size_bytes': {'key': 'properties.diskSizeBytes', 'type': 'long'}, + 'unique_id': {'key': 'properties.uniqueId', 'type': 'str'}, + 'encryption_settings_collection': {'key': 'properties.encryptionSettingsCollection', 'type': 'EncryptionSettingsCollection'}, + 'provisioning_state': {'key': 'properties.provisioningState', 'type': 'str'}, + 'incremental': {'key': 'properties.incremental', 'type': 'bool'}, + } + + def __init__(self, *, location: str, creation_data, tags=None, sku=None, os_type=None, hyper_vgeneration=None, disk_size_gb: int=None, encryption_settings_collection=None, incremental: bool=None, **kwargs) -> None: + super(Snapshot, self).__init__(location=location, tags=tags, **kwargs) + self.managed_by = None + self.sku = sku + self.time_created = None + self.os_type = os_type + self.hyper_vgeneration = hyper_vgeneration + self.creation_data = creation_data + self.disk_size_gb = disk_size_gb + self.disk_size_bytes = None + self.unique_id = None + self.encryption_settings_collection = encryption_settings_collection + self.provisioning_state = None + self.incremental = incremental + + +class SnapshotSku(Model): + """The snapshots sku name. Can be Standard_LRS, Premium_LRS, or Standard_ZRS. + + Variables are only populated by the server, and will be ignored when + sending a request. + + :param name: The sku name. Possible values include: 'Standard_LRS', + 'Premium_LRS', 'Standard_ZRS' + :type name: str or + ~azure.mgmt.compute.v2019_03_01.models.SnapshotStorageAccountTypes + :ivar tier: The sku tier. + :vartype tier: str + """ + + _validation = { + 'tier': {'readonly': True}, + } + + _attribute_map = { + 'name': {'key': 'name', 'type': 'str'}, + 'tier': {'key': 'tier', 'type': 'str'}, + } + + def __init__(self, *, name=None, **kwargs) -> None: + super(SnapshotSku, self).__init__(**kwargs) + self.name = name + self.tier = None + + +class SnapshotUpdate(Model): + """Snapshot update resource. + + :param os_type: the Operating System type. Possible values include: + 'Windows', 'Linux' + :type os_type: str or + ~azure.mgmt.compute.v2019_03_01.models.OperatingSystemTypes + :param disk_size_gb: If creationData.createOption is Empty, this field is + mandatory and it indicates the size of the disk to create. If this field + is present for updates or creation with other options, it indicates a + resize. Resizes are only allowed if the disk is not attached to a running + VM, and can only increase the disk's size. + :type disk_size_gb: int + :param encryption_settings_collection: Encryption settings collection used + be Azure Disk Encryption, can contain multiple encryption settings per + disk or snapshot. + :type encryption_settings_collection: + ~azure.mgmt.compute.v2019_03_01.models.EncryptionSettingsCollection + :param tags: Resource tags + :type tags: dict[str, str] + :param sku: + :type sku: ~azure.mgmt.compute.v2019_03_01.models.SnapshotSku + """ + + _attribute_map = { + 'os_type': {'key': 'properties.osType', 'type': 'OperatingSystemTypes'}, + 'disk_size_gb': {'key': 'properties.diskSizeGB', 'type': 'int'}, + 'encryption_settings_collection': {'key': 'properties.encryptionSettingsCollection', 'type': 'EncryptionSettingsCollection'}, + 'tags': {'key': 'tags', 'type': '{str}'}, + 'sku': {'key': 'sku', 'type': 'SnapshotSku'}, + } + + def __init__(self, *, os_type=None, disk_size_gb: int=None, encryption_settings_collection=None, tags=None, sku=None, **kwargs) -> None: + super(SnapshotUpdate, self).__init__(**kwargs) + self.os_type = os_type + self.disk_size_gb = disk_size_gb + self.encryption_settings_collection = encryption_settings_collection + self.tags = tags + self.sku = sku + + +class SourceVault(Model): + """The vault id is an Azure Resource Manager Resource id in the form + /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.KeyVault/vaults/{vaultName}. + + :param id: Resource Id + :type id: str + """ + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + } + + def __init__(self, *, id: str=None, **kwargs) -> None: + super(SourceVault, self).__init__(**kwargs) + self.id = id + + class SshConfiguration(Model): """SSH configuration for Linux based VMs running on Azure. diff --git a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2019_03_01/models/_paged_models.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2019_03_01/models/_paged_models.py index b02dee87e189..bd87bf553280 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2019_03_01/models/_paged_models.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2019_03_01/models/_paged_models.py @@ -272,3 +272,29 @@ class GalleryApplicationVersionPaged(Paged): def __init__(self, *args, **kwargs): super(GalleryApplicationVersionPaged, self).__init__(*args, **kwargs) +class DiskPaged(Paged): + """ + A paging container for iterating over a list of :class:`Disk ` object + """ + + _attribute_map = { + 'next_link': {'key': 'nextLink', 'type': 'str'}, + 'current_page': {'key': 'value', 'type': '[Disk]'} + } + + def __init__(self, *args, **kwargs): + + super(DiskPaged, self).__init__(*args, **kwargs) +class SnapshotPaged(Paged): + """ + A paging container for iterating over a list of :class:`Snapshot ` object + """ + + _attribute_map = { + 'next_link': {'key': 'nextLink', 'type': 'str'}, + 'current_page': {'key': 'value', 'type': '[Snapshot]'} + } + + def __init__(self, *args, **kwargs): + + super(SnapshotPaged, self).__init__(*args, **kwargs) diff --git a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2019_03_01/operations/__init__.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2019_03_01/operations/__init__.py index 11fed6cb8382..5706de7f811d 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2019_03_01/operations/__init__.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2019_03_01/operations/__init__.py @@ -32,6 +32,8 @@ from ._gallery_image_versions_operations import GalleryImageVersionsOperations from ._gallery_applications_operations import GalleryApplicationsOperations from ._gallery_application_versions_operations import GalleryApplicationVersionsOperations +from ._disks_operations import DisksOperations +from ._snapshots_operations import SnapshotsOperations __all__ = [ 'Operations', @@ -57,4 +59,6 @@ 'GalleryImageVersionsOperations', 'GalleryApplicationsOperations', 'GalleryApplicationVersionsOperations', + 'DisksOperations', + 'SnapshotsOperations', ] diff --git a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2019_03_01/operations/_disks_operations.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2019_03_01/operations/_disks_operations.py new file mode 100644 index 000000000000..3e13fe1e9ab5 --- /dev/null +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2019_03_01/operations/_disks_operations.py @@ -0,0 +1,727 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for +# license information. +# +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is +# regenerated. +# -------------------------------------------------------------------------- + +import uuid +from msrest.pipeline import ClientRawResponse +from msrestazure.azure_exceptions import CloudError +from msrest.polling import LROPoller, NoPolling +from msrestazure.polling.arm_polling import ARMPolling + +from .. import models + + +class DisksOperations(object): + """DisksOperations operations. + + You should not instantiate directly this class, but create a Client instance that will create it for you and attach it as attribute. + + :param client: Client for service requests. + :param config: Configuration of service client. + :param serializer: An object model serializer. + :param deserializer: An object model deserializer. + :ivar api_version: Client Api Version. Constant value: "2019-03-01". + """ + + models = models + + def __init__(self, client, config, serializer, deserializer): + + self._client = client + self._serialize = serializer + self._deserialize = deserializer + self.api_version = "2019-03-01" + + self.config = config + + + def _create_or_update_initial( + self, resource_group_name, disk_name, disk, custom_headers=None, raw=False, **operation_config): + # Construct URL + url = self.create_or_update.metadata['url'] + path_format_arguments = { + 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'diskName': self._serialize.url("disk_name", disk_name, 'str') + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} + query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + + # Construct headers + header_parameters = {} + header_parameters['Accept'] = 'application/json' + header_parameters['Content-Type'] = 'application/json; charset=utf-8' + if self.config.generate_client_request_id: + header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) + if custom_headers: + header_parameters.update(custom_headers) + if self.config.accept_language is not None: + header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') + + # Construct body + body_content = self._serialize.body(disk, 'Disk') + + # Construct and send request + request = self._client.put(url, query_parameters, header_parameters, body_content) + response = self._client.send(request, stream=False, **operation_config) + + if response.status_code not in [200, 202]: + exp = CloudError(response) + exp.request_id = response.headers.get('x-ms-request-id') + raise exp + + deserialized = None + + if response.status_code == 200: + deserialized = self._deserialize('Disk', response) + if response.status_code == 202: + deserialized = self._deserialize('Disk', response) + + if raw: + client_raw_response = ClientRawResponse(deserialized, response) + return client_raw_response + + return deserialized + + def create_or_update( + self, resource_group_name, disk_name, disk, custom_headers=None, raw=False, polling=True, **operation_config): + """Creates or updates a disk. + + :param resource_group_name: The name of the resource group. + :type resource_group_name: str + :param disk_name: The name of the managed disk that is being created. + The name can't be changed after the disk is created. Supported + characters for the name are a-z, A-Z, 0-9 and _. The maximum name + length is 80 characters. + :type disk_name: str + :param disk: Disk object supplied in the body of the Put disk + operation. + :type disk: ~azure.mgmt.compute.v2019_03_01.models.Disk + :param dict custom_headers: headers that will be added to the request + :param bool raw: The poller return type is ClientRawResponse, the + direct response alongside the deserialized response + :param polling: True for ARMPolling, False for no polling, or a + polling object for personal polling strategy + :return: An instance of LROPoller that returns Disk or + ClientRawResponse if raw==True + :rtype: + ~msrestazure.azure_operation.AzureOperationPoller[~azure.mgmt.compute.v2019_03_01.models.Disk] + or + ~msrestazure.azure_operation.AzureOperationPoller[~msrest.pipeline.ClientRawResponse[~azure.mgmt.compute.v2019_03_01.models.Disk]] + :raises: :class:`CloudError` + """ + raw_result = self._create_or_update_initial( + resource_group_name=resource_group_name, + disk_name=disk_name, + disk=disk, + custom_headers=custom_headers, + raw=True, + **operation_config + ) + + def get_long_running_output(response): + deserialized = self._deserialize('Disk', response) + + if raw: + client_raw_response = ClientRawResponse(deserialized, response) + return client_raw_response + + return deserialized + + lro_delay = operation_config.get( + 'long_running_operation_timeout', + self.config.long_running_operation_timeout) + if polling is True: polling_method = ARMPolling(lro_delay, **operation_config) + elif polling is False: polling_method = NoPolling() + else: polling_method = polling + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + create_or_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/disks/{diskName}'} + + + def _update_initial( + self, resource_group_name, disk_name, disk, custom_headers=None, raw=False, **operation_config): + # Construct URL + url = self.update.metadata['url'] + path_format_arguments = { + 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'diskName': self._serialize.url("disk_name", disk_name, 'str') + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} + query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + + # Construct headers + header_parameters = {} + header_parameters['Accept'] = 'application/json' + header_parameters['Content-Type'] = 'application/json; charset=utf-8' + if self.config.generate_client_request_id: + header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) + if custom_headers: + header_parameters.update(custom_headers) + if self.config.accept_language is not None: + header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') + + # Construct body + body_content = self._serialize.body(disk, 'DiskUpdate') + + # Construct and send request + request = self._client.patch(url, query_parameters, header_parameters, body_content) + response = self._client.send(request, stream=False, **operation_config) + + if response.status_code not in [200, 202]: + exp = CloudError(response) + exp.request_id = response.headers.get('x-ms-request-id') + raise exp + + deserialized = None + + if response.status_code == 200: + deserialized = self._deserialize('Disk', response) + if response.status_code == 202: + deserialized = self._deserialize('Disk', response) + + if raw: + client_raw_response = ClientRawResponse(deserialized, response) + return client_raw_response + + return deserialized + + def update( + self, resource_group_name, disk_name, disk, custom_headers=None, raw=False, polling=True, **operation_config): + """Updates (patches) a disk. + + :param resource_group_name: The name of the resource group. + :type resource_group_name: str + :param disk_name: The name of the managed disk that is being created. + The name can't be changed after the disk is created. Supported + characters for the name are a-z, A-Z, 0-9 and _. The maximum name + length is 80 characters. + :type disk_name: str + :param disk: Disk object supplied in the body of the Patch disk + operation. + :type disk: ~azure.mgmt.compute.v2019_03_01.models.DiskUpdate + :param dict custom_headers: headers that will be added to the request + :param bool raw: The poller return type is ClientRawResponse, the + direct response alongside the deserialized response + :param polling: True for ARMPolling, False for no polling, or a + polling object for personal polling strategy + :return: An instance of LROPoller that returns Disk or + ClientRawResponse if raw==True + :rtype: + ~msrestazure.azure_operation.AzureOperationPoller[~azure.mgmt.compute.v2019_03_01.models.Disk] + or + ~msrestazure.azure_operation.AzureOperationPoller[~msrest.pipeline.ClientRawResponse[~azure.mgmt.compute.v2019_03_01.models.Disk]] + :raises: :class:`CloudError` + """ + raw_result = self._update_initial( + resource_group_name=resource_group_name, + disk_name=disk_name, + disk=disk, + custom_headers=custom_headers, + raw=True, + **operation_config + ) + + def get_long_running_output(response): + deserialized = self._deserialize('Disk', response) + + if raw: + client_raw_response = ClientRawResponse(deserialized, response) + return client_raw_response + + return deserialized + + lro_delay = operation_config.get( + 'long_running_operation_timeout', + self.config.long_running_operation_timeout) + if polling is True: polling_method = ARMPolling(lro_delay, **operation_config) + elif polling is False: polling_method = NoPolling() + else: polling_method = polling + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/disks/{diskName}'} + + def get( + self, resource_group_name, disk_name, custom_headers=None, raw=False, **operation_config): + """Gets information about a disk. + + :param resource_group_name: The name of the resource group. + :type resource_group_name: str + :param disk_name: The name of the managed disk that is being created. + The name can't be changed after the disk is created. Supported + characters for the name are a-z, A-Z, 0-9 and _. The maximum name + length is 80 characters. + :type disk_name: str + :param dict custom_headers: headers that will be added to the request + :param bool raw: returns the direct response alongside the + deserialized response + :param operation_config: :ref:`Operation configuration + overrides`. + :return: Disk or ClientRawResponse if raw=true + :rtype: ~azure.mgmt.compute.v2019_03_01.models.Disk or + ~msrest.pipeline.ClientRawResponse + :raises: :class:`CloudError` + """ + # Construct URL + url = self.get.metadata['url'] + path_format_arguments = { + 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'diskName': self._serialize.url("disk_name", disk_name, 'str') + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} + query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + + # Construct headers + header_parameters = {} + header_parameters['Accept'] = 'application/json' + if self.config.generate_client_request_id: + header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) + if custom_headers: + header_parameters.update(custom_headers) + if self.config.accept_language is not None: + header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') + + # Construct and send request + request = self._client.get(url, query_parameters, header_parameters) + response = self._client.send(request, stream=False, **operation_config) + + if response.status_code not in [200]: + exp = CloudError(response) + exp.request_id = response.headers.get('x-ms-request-id') + raise exp + + deserialized = None + if response.status_code == 200: + deserialized = self._deserialize('Disk', response) + + if raw: + client_raw_response = ClientRawResponse(deserialized, response) + return client_raw_response + + return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/disks/{diskName}'} + + + def _delete_initial( + self, resource_group_name, disk_name, custom_headers=None, raw=False, **operation_config): + # Construct URL + url = self.delete.metadata['url'] + path_format_arguments = { + 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'diskName': self._serialize.url("disk_name", disk_name, 'str') + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} + query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + + # Construct headers + header_parameters = {} + if self.config.generate_client_request_id: + header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) + if custom_headers: + header_parameters.update(custom_headers) + if self.config.accept_language is not None: + header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') + + # Construct and send request + request = self._client.delete(url, query_parameters, header_parameters) + response = self._client.send(request, stream=False, **operation_config) + + if response.status_code not in [200, 202, 204]: + exp = CloudError(response) + exp.request_id = response.headers.get('x-ms-request-id') + raise exp + + if raw: + client_raw_response = ClientRawResponse(None, response) + return client_raw_response + + def delete( + self, resource_group_name, disk_name, custom_headers=None, raw=False, polling=True, **operation_config): + """Deletes a disk. + + :param resource_group_name: The name of the resource group. + :type resource_group_name: str + :param disk_name: The name of the managed disk that is being created. + The name can't be changed after the disk is created. Supported + characters for the name are a-z, A-Z, 0-9 and _. The maximum name + length is 80 characters. + :type disk_name: str + :param dict custom_headers: headers that will be added to the request + :param bool raw: The poller return type is ClientRawResponse, the + direct response alongside the deserialized response + :param polling: True for ARMPolling, False for no polling, or a + polling object for personal polling strategy + :return: An instance of LROPoller that returns None or + ClientRawResponse if raw==True + :rtype: ~msrestazure.azure_operation.AzureOperationPoller[None] or + ~msrestazure.azure_operation.AzureOperationPoller[~msrest.pipeline.ClientRawResponse[None]] + :raises: :class:`CloudError` + """ + raw_result = self._delete_initial( + resource_group_name=resource_group_name, + disk_name=disk_name, + custom_headers=custom_headers, + raw=True, + **operation_config + ) + + def get_long_running_output(response): + if raw: + client_raw_response = ClientRawResponse(None, response) + return client_raw_response + + lro_delay = operation_config.get( + 'long_running_operation_timeout', + self.config.long_running_operation_timeout) + if polling is True: polling_method = ARMPolling(lro_delay, **operation_config) + elif polling is False: polling_method = NoPolling() + else: polling_method = polling + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/disks/{diskName}'} + + def list_by_resource_group( + self, resource_group_name, custom_headers=None, raw=False, **operation_config): + """Lists all the disks under a resource group. + + :param resource_group_name: The name of the resource group. + :type resource_group_name: str + :param dict custom_headers: headers that will be added to the request + :param bool raw: returns the direct response alongside the + deserialized response + :param operation_config: :ref:`Operation configuration + overrides`. + :return: An iterator like instance of Disk + :rtype: + ~azure.mgmt.compute.v2019_03_01.models.DiskPaged[~azure.mgmt.compute.v2019_03_01.models.Disk] + :raises: :class:`CloudError` + """ + def prepare_request(next_link=None): + if not next_link: + # Construct URL + url = self.list_by_resource_group.metadata['url'] + path_format_arguments = { + 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str') + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} + query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + + else: + url = next_link + query_parameters = {} + + # Construct headers + header_parameters = {} + header_parameters['Accept'] = 'application/json' + if self.config.generate_client_request_id: + header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) + if custom_headers: + header_parameters.update(custom_headers) + if self.config.accept_language is not None: + header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') + + # Construct and send request + request = self._client.get(url, query_parameters, header_parameters) + return request + + def internal_paging(next_link=None): + request = prepare_request(next_link) + + response = self._client.send(request, stream=False, **operation_config) + + if response.status_code not in [200]: + exp = CloudError(response) + exp.request_id = response.headers.get('x-ms-request-id') + raise exp + + return response + + # Deserialize response + header_dict = None + if raw: + header_dict = {} + deserialized = models.DiskPaged(internal_paging, self._deserialize.dependencies, header_dict) + + return deserialized + list_by_resource_group.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/disks'} + + def list( + self, custom_headers=None, raw=False, **operation_config): + """Lists all the disks under a subscription. + + :param dict custom_headers: headers that will be added to the request + :param bool raw: returns the direct response alongside the + deserialized response + :param operation_config: :ref:`Operation configuration + overrides`. + :return: An iterator like instance of Disk + :rtype: + ~azure.mgmt.compute.v2019_03_01.models.DiskPaged[~azure.mgmt.compute.v2019_03_01.models.Disk] + :raises: :class:`CloudError` + """ + def prepare_request(next_link=None): + if not next_link: + # Construct URL + url = self.list.metadata['url'] + path_format_arguments = { + 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str') + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} + query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + + else: + url = next_link + query_parameters = {} + + # Construct headers + header_parameters = {} + header_parameters['Accept'] = 'application/json' + if self.config.generate_client_request_id: + header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) + if custom_headers: + header_parameters.update(custom_headers) + if self.config.accept_language is not None: + header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') + + # Construct and send request + request = self._client.get(url, query_parameters, header_parameters) + return request + + def internal_paging(next_link=None): + request = prepare_request(next_link) + + response = self._client.send(request, stream=False, **operation_config) + + if response.status_code not in [200]: + exp = CloudError(response) + exp.request_id = response.headers.get('x-ms-request-id') + raise exp + + return response + + # Deserialize response + header_dict = None + if raw: + header_dict = {} + deserialized = models.DiskPaged(internal_paging, self._deserialize.dependencies, header_dict) + + return deserialized + list.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.Compute/disks'} + + + def _grant_access_initial( + self, resource_group_name, disk_name, access, duration_in_seconds, custom_headers=None, raw=False, **operation_config): + grant_access_data = models.GrantAccessData(access=access, duration_in_seconds=duration_in_seconds) + + # Construct URL + url = self.grant_access.metadata['url'] + path_format_arguments = { + 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'diskName': self._serialize.url("disk_name", disk_name, 'str') + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} + query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + + # Construct headers + header_parameters = {} + header_parameters['Accept'] = 'application/json' + header_parameters['Content-Type'] = 'application/json; charset=utf-8' + if self.config.generate_client_request_id: + header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) + if custom_headers: + header_parameters.update(custom_headers) + if self.config.accept_language is not None: + header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') + + # Construct body + body_content = self._serialize.body(grant_access_data, 'GrantAccessData') + + # Construct and send request + request = self._client.post(url, query_parameters, header_parameters, body_content) + response = self._client.send(request, stream=False, **operation_config) + + if response.status_code not in [200, 202]: + exp = CloudError(response) + exp.request_id = response.headers.get('x-ms-request-id') + raise exp + + deserialized = None + + if response.status_code == 200: + deserialized = self._deserialize('AccessUri', response) + + if raw: + client_raw_response = ClientRawResponse(deserialized, response) + return client_raw_response + + return deserialized + + def grant_access( + self, resource_group_name, disk_name, access, duration_in_seconds, custom_headers=None, raw=False, polling=True, **operation_config): + """Grants access to a disk. + + :param resource_group_name: The name of the resource group. + :type resource_group_name: str + :param disk_name: The name of the managed disk that is being created. + The name can't be changed after the disk is created. Supported + characters for the name are a-z, A-Z, 0-9 and _. The maximum name + length is 80 characters. + :type disk_name: str + :param access: Possible values include: 'None', 'Read', 'Write' + :type access: str or + ~azure.mgmt.compute.v2019_03_01.models.AccessLevel + :param duration_in_seconds: Time duration in seconds until the SAS + access expires. + :type duration_in_seconds: int + :param dict custom_headers: headers that will be added to the request + :param bool raw: The poller return type is ClientRawResponse, the + direct response alongside the deserialized response + :param polling: True for ARMPolling, False for no polling, or a + polling object for personal polling strategy + :return: An instance of LROPoller that returns AccessUri or + ClientRawResponse if raw==True + :rtype: + ~msrestazure.azure_operation.AzureOperationPoller[~azure.mgmt.compute.v2019_03_01.models.AccessUri] + or + ~msrestazure.azure_operation.AzureOperationPoller[~msrest.pipeline.ClientRawResponse[~azure.mgmt.compute.v2019_03_01.models.AccessUri]] + :raises: :class:`CloudError` + """ + raw_result = self._grant_access_initial( + resource_group_name=resource_group_name, + disk_name=disk_name, + access=access, + duration_in_seconds=duration_in_seconds, + custom_headers=custom_headers, + raw=True, + **operation_config + ) + + def get_long_running_output(response): + deserialized = self._deserialize('AccessUri', response) + + if raw: + client_raw_response = ClientRawResponse(deserialized, response) + return client_raw_response + + return deserialized + + lro_delay = operation_config.get( + 'long_running_operation_timeout', + self.config.long_running_operation_timeout) + if polling is True: polling_method = ARMPolling(lro_delay, lro_options={'final-state-via': 'location'}, **operation_config) + elif polling is False: polling_method = NoPolling() + else: polling_method = polling + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + grant_access.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/disks/{diskName}/beginGetAccess'} + + + def _revoke_access_initial( + self, resource_group_name, disk_name, custom_headers=None, raw=False, **operation_config): + # Construct URL + url = self.revoke_access.metadata['url'] + path_format_arguments = { + 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'diskName': self._serialize.url("disk_name", disk_name, 'str') + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} + query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + + # Construct headers + header_parameters = {} + if self.config.generate_client_request_id: + header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) + if custom_headers: + header_parameters.update(custom_headers) + if self.config.accept_language is not None: + header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') + + # Construct and send request + request = self._client.post(url, query_parameters, header_parameters) + response = self._client.send(request, stream=False, **operation_config) + + if response.status_code not in [200, 202]: + exp = CloudError(response) + exp.request_id = response.headers.get('x-ms-request-id') + raise exp + + if raw: + client_raw_response = ClientRawResponse(None, response) + return client_raw_response + + def revoke_access( + self, resource_group_name, disk_name, custom_headers=None, raw=False, polling=True, **operation_config): + """Revokes access to a disk. + + :param resource_group_name: The name of the resource group. + :type resource_group_name: str + :param disk_name: The name of the managed disk that is being created. + The name can't be changed after the disk is created. Supported + characters for the name are a-z, A-Z, 0-9 and _. The maximum name + length is 80 characters. + :type disk_name: str + :param dict custom_headers: headers that will be added to the request + :param bool raw: The poller return type is ClientRawResponse, the + direct response alongside the deserialized response + :param polling: True for ARMPolling, False for no polling, or a + polling object for personal polling strategy + :return: An instance of LROPoller that returns None or + ClientRawResponse if raw==True + :rtype: ~msrestazure.azure_operation.AzureOperationPoller[None] or + ~msrestazure.azure_operation.AzureOperationPoller[~msrest.pipeline.ClientRawResponse[None]] + :raises: :class:`CloudError` + """ + raw_result = self._revoke_access_initial( + resource_group_name=resource_group_name, + disk_name=disk_name, + custom_headers=custom_headers, + raw=True, + **operation_config + ) + + def get_long_running_output(response): + if raw: + client_raw_response = ClientRawResponse(None, response) + return client_raw_response + + lro_delay = operation_config.get( + 'long_running_operation_timeout', + self.config.long_running_operation_timeout) + if polling is True: polling_method = ARMPolling(lro_delay, lro_options={'final-state-via': 'location'}, **operation_config) + elif polling is False: polling_method = NoPolling() + else: polling_method = polling + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + revoke_access.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/disks/{diskName}/endGetAccess'} diff --git a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2019_03_01/operations/_snapshots_operations.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2019_03_01/operations/_snapshots_operations.py new file mode 100644 index 000000000000..e0ca0e242f3a --- /dev/null +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2019_03_01/operations/_snapshots_operations.py @@ -0,0 +1,727 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for +# license information. +# +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is +# regenerated. +# -------------------------------------------------------------------------- + +import uuid +from msrest.pipeline import ClientRawResponse +from msrestazure.azure_exceptions import CloudError +from msrest.polling import LROPoller, NoPolling +from msrestazure.polling.arm_polling import ARMPolling + +from .. import models + + +class SnapshotsOperations(object): + """SnapshotsOperations operations. + + You should not instantiate directly this class, but create a Client instance that will create it for you and attach it as attribute. + + :param client: Client for service requests. + :param config: Configuration of service client. + :param serializer: An object model serializer. + :param deserializer: An object model deserializer. + :ivar api_version: Client Api Version. Constant value: "2019-03-01". + """ + + models = models + + def __init__(self, client, config, serializer, deserializer): + + self._client = client + self._serialize = serializer + self._deserialize = deserializer + self.api_version = "2019-03-01" + + self.config = config + + + def _create_or_update_initial( + self, resource_group_name, snapshot_name, snapshot, custom_headers=None, raw=False, **operation_config): + # Construct URL + url = self.create_or_update.metadata['url'] + path_format_arguments = { + 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'snapshotName': self._serialize.url("snapshot_name", snapshot_name, 'str') + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} + query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + + # Construct headers + header_parameters = {} + header_parameters['Accept'] = 'application/json' + header_parameters['Content-Type'] = 'application/json; charset=utf-8' + if self.config.generate_client_request_id: + header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) + if custom_headers: + header_parameters.update(custom_headers) + if self.config.accept_language is not None: + header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') + + # Construct body + body_content = self._serialize.body(snapshot, 'Snapshot') + + # Construct and send request + request = self._client.put(url, query_parameters, header_parameters, body_content) + response = self._client.send(request, stream=False, **operation_config) + + if response.status_code not in [200, 202]: + exp = CloudError(response) + exp.request_id = response.headers.get('x-ms-request-id') + raise exp + + deserialized = None + + if response.status_code == 200: + deserialized = self._deserialize('Snapshot', response) + if response.status_code == 202: + deserialized = self._deserialize('Snapshot', response) + + if raw: + client_raw_response = ClientRawResponse(deserialized, response) + return client_raw_response + + return deserialized + + def create_or_update( + self, resource_group_name, snapshot_name, snapshot, custom_headers=None, raw=False, polling=True, **operation_config): + """Creates or updates a snapshot. + + :param resource_group_name: The name of the resource group. + :type resource_group_name: str + :param snapshot_name: The name of the snapshot that is being created. + The name can't be changed after the snapshot is created. Supported + characters for the name are a-z, A-Z, 0-9 and _. The max name length + is 80 characters. + :type snapshot_name: str + :param snapshot: Snapshot object supplied in the body of the Put disk + operation. + :type snapshot: ~azure.mgmt.compute.v2019_03_01.models.Snapshot + :param dict custom_headers: headers that will be added to the request + :param bool raw: The poller return type is ClientRawResponse, the + direct response alongside the deserialized response + :param polling: True for ARMPolling, False for no polling, or a + polling object for personal polling strategy + :return: An instance of LROPoller that returns Snapshot or + ClientRawResponse if raw==True + :rtype: + ~msrestazure.azure_operation.AzureOperationPoller[~azure.mgmt.compute.v2019_03_01.models.Snapshot] + or + ~msrestazure.azure_operation.AzureOperationPoller[~msrest.pipeline.ClientRawResponse[~azure.mgmt.compute.v2019_03_01.models.Snapshot]] + :raises: :class:`CloudError` + """ + raw_result = self._create_or_update_initial( + resource_group_name=resource_group_name, + snapshot_name=snapshot_name, + snapshot=snapshot, + custom_headers=custom_headers, + raw=True, + **operation_config + ) + + def get_long_running_output(response): + deserialized = self._deserialize('Snapshot', response) + + if raw: + client_raw_response = ClientRawResponse(deserialized, response) + return client_raw_response + + return deserialized + + lro_delay = operation_config.get( + 'long_running_operation_timeout', + self.config.long_running_operation_timeout) + if polling is True: polling_method = ARMPolling(lro_delay, **operation_config) + elif polling is False: polling_method = NoPolling() + else: polling_method = polling + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + create_or_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/snapshots/{snapshotName}'} + + + def _update_initial( + self, resource_group_name, snapshot_name, snapshot, custom_headers=None, raw=False, **operation_config): + # Construct URL + url = self.update.metadata['url'] + path_format_arguments = { + 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'snapshotName': self._serialize.url("snapshot_name", snapshot_name, 'str') + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} + query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + + # Construct headers + header_parameters = {} + header_parameters['Accept'] = 'application/json' + header_parameters['Content-Type'] = 'application/json; charset=utf-8' + if self.config.generate_client_request_id: + header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) + if custom_headers: + header_parameters.update(custom_headers) + if self.config.accept_language is not None: + header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') + + # Construct body + body_content = self._serialize.body(snapshot, 'SnapshotUpdate') + + # Construct and send request + request = self._client.patch(url, query_parameters, header_parameters, body_content) + response = self._client.send(request, stream=False, **operation_config) + + if response.status_code not in [200, 202]: + exp = CloudError(response) + exp.request_id = response.headers.get('x-ms-request-id') + raise exp + + deserialized = None + + if response.status_code == 200: + deserialized = self._deserialize('Snapshot', response) + if response.status_code == 202: + deserialized = self._deserialize('Snapshot', response) + + if raw: + client_raw_response = ClientRawResponse(deserialized, response) + return client_raw_response + + return deserialized + + def update( + self, resource_group_name, snapshot_name, snapshot, custom_headers=None, raw=False, polling=True, **operation_config): + """Updates (patches) a snapshot. + + :param resource_group_name: The name of the resource group. + :type resource_group_name: str + :param snapshot_name: The name of the snapshot that is being created. + The name can't be changed after the snapshot is created. Supported + characters for the name are a-z, A-Z, 0-9 and _. The max name length + is 80 characters. + :type snapshot_name: str + :param snapshot: Snapshot object supplied in the body of the Patch + snapshot operation. + :type snapshot: ~azure.mgmt.compute.v2019_03_01.models.SnapshotUpdate + :param dict custom_headers: headers that will be added to the request + :param bool raw: The poller return type is ClientRawResponse, the + direct response alongside the deserialized response + :param polling: True for ARMPolling, False for no polling, or a + polling object for personal polling strategy + :return: An instance of LROPoller that returns Snapshot or + ClientRawResponse if raw==True + :rtype: + ~msrestazure.azure_operation.AzureOperationPoller[~azure.mgmt.compute.v2019_03_01.models.Snapshot] + or + ~msrestazure.azure_operation.AzureOperationPoller[~msrest.pipeline.ClientRawResponse[~azure.mgmt.compute.v2019_03_01.models.Snapshot]] + :raises: :class:`CloudError` + """ + raw_result = self._update_initial( + resource_group_name=resource_group_name, + snapshot_name=snapshot_name, + snapshot=snapshot, + custom_headers=custom_headers, + raw=True, + **operation_config + ) + + def get_long_running_output(response): + deserialized = self._deserialize('Snapshot', response) + + if raw: + client_raw_response = ClientRawResponse(deserialized, response) + return client_raw_response + + return deserialized + + lro_delay = operation_config.get( + 'long_running_operation_timeout', + self.config.long_running_operation_timeout) + if polling is True: polling_method = ARMPolling(lro_delay, **operation_config) + elif polling is False: polling_method = NoPolling() + else: polling_method = polling + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/snapshots/{snapshotName}'} + + def get( + self, resource_group_name, snapshot_name, custom_headers=None, raw=False, **operation_config): + """Gets information about a snapshot. + + :param resource_group_name: The name of the resource group. + :type resource_group_name: str + :param snapshot_name: The name of the snapshot that is being created. + The name can't be changed after the snapshot is created. Supported + characters for the name are a-z, A-Z, 0-9 and _. The max name length + is 80 characters. + :type snapshot_name: str + :param dict custom_headers: headers that will be added to the request + :param bool raw: returns the direct response alongside the + deserialized response + :param operation_config: :ref:`Operation configuration + overrides`. + :return: Snapshot or ClientRawResponse if raw=true + :rtype: ~azure.mgmt.compute.v2019_03_01.models.Snapshot or + ~msrest.pipeline.ClientRawResponse + :raises: :class:`CloudError` + """ + # Construct URL + url = self.get.metadata['url'] + path_format_arguments = { + 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'snapshotName': self._serialize.url("snapshot_name", snapshot_name, 'str') + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} + query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + + # Construct headers + header_parameters = {} + header_parameters['Accept'] = 'application/json' + if self.config.generate_client_request_id: + header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) + if custom_headers: + header_parameters.update(custom_headers) + if self.config.accept_language is not None: + header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') + + # Construct and send request + request = self._client.get(url, query_parameters, header_parameters) + response = self._client.send(request, stream=False, **operation_config) + + if response.status_code not in [200]: + exp = CloudError(response) + exp.request_id = response.headers.get('x-ms-request-id') + raise exp + + deserialized = None + if response.status_code == 200: + deserialized = self._deserialize('Snapshot', response) + + if raw: + client_raw_response = ClientRawResponse(deserialized, response) + return client_raw_response + + return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/snapshots/{snapshotName}'} + + + def _delete_initial( + self, resource_group_name, snapshot_name, custom_headers=None, raw=False, **operation_config): + # Construct URL + url = self.delete.metadata['url'] + path_format_arguments = { + 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'snapshotName': self._serialize.url("snapshot_name", snapshot_name, 'str') + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} + query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + + # Construct headers + header_parameters = {} + if self.config.generate_client_request_id: + header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) + if custom_headers: + header_parameters.update(custom_headers) + if self.config.accept_language is not None: + header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') + + # Construct and send request + request = self._client.delete(url, query_parameters, header_parameters) + response = self._client.send(request, stream=False, **operation_config) + + if response.status_code not in [200, 202, 204]: + exp = CloudError(response) + exp.request_id = response.headers.get('x-ms-request-id') + raise exp + + if raw: + client_raw_response = ClientRawResponse(None, response) + return client_raw_response + + def delete( + self, resource_group_name, snapshot_name, custom_headers=None, raw=False, polling=True, **operation_config): + """Deletes a snapshot. + + :param resource_group_name: The name of the resource group. + :type resource_group_name: str + :param snapshot_name: The name of the snapshot that is being created. + The name can't be changed after the snapshot is created. Supported + characters for the name are a-z, A-Z, 0-9 and _. The max name length + is 80 characters. + :type snapshot_name: str + :param dict custom_headers: headers that will be added to the request + :param bool raw: The poller return type is ClientRawResponse, the + direct response alongside the deserialized response + :param polling: True for ARMPolling, False for no polling, or a + polling object for personal polling strategy + :return: An instance of LROPoller that returns None or + ClientRawResponse if raw==True + :rtype: ~msrestazure.azure_operation.AzureOperationPoller[None] or + ~msrestazure.azure_operation.AzureOperationPoller[~msrest.pipeline.ClientRawResponse[None]] + :raises: :class:`CloudError` + """ + raw_result = self._delete_initial( + resource_group_name=resource_group_name, + snapshot_name=snapshot_name, + custom_headers=custom_headers, + raw=True, + **operation_config + ) + + def get_long_running_output(response): + if raw: + client_raw_response = ClientRawResponse(None, response) + return client_raw_response + + lro_delay = operation_config.get( + 'long_running_operation_timeout', + self.config.long_running_operation_timeout) + if polling is True: polling_method = ARMPolling(lro_delay, **operation_config) + elif polling is False: polling_method = NoPolling() + else: polling_method = polling + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/snapshots/{snapshotName}'} + + def list_by_resource_group( + self, resource_group_name, custom_headers=None, raw=False, **operation_config): + """Lists snapshots under a resource group. + + :param resource_group_name: The name of the resource group. + :type resource_group_name: str + :param dict custom_headers: headers that will be added to the request + :param bool raw: returns the direct response alongside the + deserialized response + :param operation_config: :ref:`Operation configuration + overrides`. + :return: An iterator like instance of Snapshot + :rtype: + ~azure.mgmt.compute.v2019_03_01.models.SnapshotPaged[~azure.mgmt.compute.v2019_03_01.models.Snapshot] + :raises: :class:`CloudError` + """ + def prepare_request(next_link=None): + if not next_link: + # Construct URL + url = self.list_by_resource_group.metadata['url'] + path_format_arguments = { + 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str') + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} + query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + + else: + url = next_link + query_parameters = {} + + # Construct headers + header_parameters = {} + header_parameters['Accept'] = 'application/json' + if self.config.generate_client_request_id: + header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) + if custom_headers: + header_parameters.update(custom_headers) + if self.config.accept_language is not None: + header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') + + # Construct and send request + request = self._client.get(url, query_parameters, header_parameters) + return request + + def internal_paging(next_link=None): + request = prepare_request(next_link) + + response = self._client.send(request, stream=False, **operation_config) + + if response.status_code not in [200]: + exp = CloudError(response) + exp.request_id = response.headers.get('x-ms-request-id') + raise exp + + return response + + # Deserialize response + header_dict = None + if raw: + header_dict = {} + deserialized = models.SnapshotPaged(internal_paging, self._deserialize.dependencies, header_dict) + + return deserialized + list_by_resource_group.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/snapshots'} + + def list( + self, custom_headers=None, raw=False, **operation_config): + """Lists snapshots under a subscription. + + :param dict custom_headers: headers that will be added to the request + :param bool raw: returns the direct response alongside the + deserialized response + :param operation_config: :ref:`Operation configuration + overrides`. + :return: An iterator like instance of Snapshot + :rtype: + ~azure.mgmt.compute.v2019_03_01.models.SnapshotPaged[~azure.mgmt.compute.v2019_03_01.models.Snapshot] + :raises: :class:`CloudError` + """ + def prepare_request(next_link=None): + if not next_link: + # Construct URL + url = self.list.metadata['url'] + path_format_arguments = { + 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str') + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} + query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + + else: + url = next_link + query_parameters = {} + + # Construct headers + header_parameters = {} + header_parameters['Accept'] = 'application/json' + if self.config.generate_client_request_id: + header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) + if custom_headers: + header_parameters.update(custom_headers) + if self.config.accept_language is not None: + header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') + + # Construct and send request + request = self._client.get(url, query_parameters, header_parameters) + return request + + def internal_paging(next_link=None): + request = prepare_request(next_link) + + response = self._client.send(request, stream=False, **operation_config) + + if response.status_code not in [200]: + exp = CloudError(response) + exp.request_id = response.headers.get('x-ms-request-id') + raise exp + + return response + + # Deserialize response + header_dict = None + if raw: + header_dict = {} + deserialized = models.SnapshotPaged(internal_paging, self._deserialize.dependencies, header_dict) + + return deserialized + list.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.Compute/snapshots'} + + + def _grant_access_initial( + self, resource_group_name, snapshot_name, access, duration_in_seconds, custom_headers=None, raw=False, **operation_config): + grant_access_data = models.GrantAccessData(access=access, duration_in_seconds=duration_in_seconds) + + # Construct URL + url = self.grant_access.metadata['url'] + path_format_arguments = { + 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'snapshotName': self._serialize.url("snapshot_name", snapshot_name, 'str') + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} + query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + + # Construct headers + header_parameters = {} + header_parameters['Accept'] = 'application/json' + header_parameters['Content-Type'] = 'application/json; charset=utf-8' + if self.config.generate_client_request_id: + header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) + if custom_headers: + header_parameters.update(custom_headers) + if self.config.accept_language is not None: + header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') + + # Construct body + body_content = self._serialize.body(grant_access_data, 'GrantAccessData') + + # Construct and send request + request = self._client.post(url, query_parameters, header_parameters, body_content) + response = self._client.send(request, stream=False, **operation_config) + + if response.status_code not in [200, 202]: + exp = CloudError(response) + exp.request_id = response.headers.get('x-ms-request-id') + raise exp + + deserialized = None + + if response.status_code == 200: + deserialized = self._deserialize('AccessUri', response) + + if raw: + client_raw_response = ClientRawResponse(deserialized, response) + return client_raw_response + + return deserialized + + def grant_access( + self, resource_group_name, snapshot_name, access, duration_in_seconds, custom_headers=None, raw=False, polling=True, **operation_config): + """Grants access to a snapshot. + + :param resource_group_name: The name of the resource group. + :type resource_group_name: str + :param snapshot_name: The name of the snapshot that is being created. + The name can't be changed after the snapshot is created. Supported + characters for the name are a-z, A-Z, 0-9 and _. The max name length + is 80 characters. + :type snapshot_name: str + :param access: Possible values include: 'None', 'Read', 'Write' + :type access: str or + ~azure.mgmt.compute.v2019_03_01.models.AccessLevel + :param duration_in_seconds: Time duration in seconds until the SAS + access expires. + :type duration_in_seconds: int + :param dict custom_headers: headers that will be added to the request + :param bool raw: The poller return type is ClientRawResponse, the + direct response alongside the deserialized response + :param polling: True for ARMPolling, False for no polling, or a + polling object for personal polling strategy + :return: An instance of LROPoller that returns AccessUri or + ClientRawResponse if raw==True + :rtype: + ~msrestazure.azure_operation.AzureOperationPoller[~azure.mgmt.compute.v2019_03_01.models.AccessUri] + or + ~msrestazure.azure_operation.AzureOperationPoller[~msrest.pipeline.ClientRawResponse[~azure.mgmt.compute.v2019_03_01.models.AccessUri]] + :raises: :class:`CloudError` + """ + raw_result = self._grant_access_initial( + resource_group_name=resource_group_name, + snapshot_name=snapshot_name, + access=access, + duration_in_seconds=duration_in_seconds, + custom_headers=custom_headers, + raw=True, + **operation_config + ) + + def get_long_running_output(response): + deserialized = self._deserialize('AccessUri', response) + + if raw: + client_raw_response = ClientRawResponse(deserialized, response) + return client_raw_response + + return deserialized + + lro_delay = operation_config.get( + 'long_running_operation_timeout', + self.config.long_running_operation_timeout) + if polling is True: polling_method = ARMPolling(lro_delay, lro_options={'final-state-via': 'location'}, **operation_config) + elif polling is False: polling_method = NoPolling() + else: polling_method = polling + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + grant_access.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/snapshots/{snapshotName}/beginGetAccess'} + + + def _revoke_access_initial( + self, resource_group_name, snapshot_name, custom_headers=None, raw=False, **operation_config): + # Construct URL + url = self.revoke_access.metadata['url'] + path_format_arguments = { + 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'snapshotName': self._serialize.url("snapshot_name", snapshot_name, 'str') + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} + query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + + # Construct headers + header_parameters = {} + if self.config.generate_client_request_id: + header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) + if custom_headers: + header_parameters.update(custom_headers) + if self.config.accept_language is not None: + header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') + + # Construct and send request + request = self._client.post(url, query_parameters, header_parameters) + response = self._client.send(request, stream=False, **operation_config) + + if response.status_code not in [200, 202]: + exp = CloudError(response) + exp.request_id = response.headers.get('x-ms-request-id') + raise exp + + if raw: + client_raw_response = ClientRawResponse(None, response) + return client_raw_response + + def revoke_access( + self, resource_group_name, snapshot_name, custom_headers=None, raw=False, polling=True, **operation_config): + """Revokes access to a snapshot. + + :param resource_group_name: The name of the resource group. + :type resource_group_name: str + :param snapshot_name: The name of the snapshot that is being created. + The name can't be changed after the snapshot is created. Supported + characters for the name are a-z, A-Z, 0-9 and _. The max name length + is 80 characters. + :type snapshot_name: str + :param dict custom_headers: headers that will be added to the request + :param bool raw: The poller return type is ClientRawResponse, the + direct response alongside the deserialized response + :param polling: True for ARMPolling, False for no polling, or a + polling object for personal polling strategy + :return: An instance of LROPoller that returns None or + ClientRawResponse if raw==True + :rtype: ~msrestazure.azure_operation.AzureOperationPoller[None] or + ~msrestazure.azure_operation.AzureOperationPoller[~msrest.pipeline.ClientRawResponse[None]] + :raises: :class:`CloudError` + """ + raw_result = self._revoke_access_initial( + resource_group_name=resource_group_name, + snapshot_name=snapshot_name, + custom_headers=custom_headers, + raw=True, + **operation_config + ) + + def get_long_running_output(response): + if raw: + client_raw_response = ClientRawResponse(None, response) + return client_raw_response + + lro_delay = operation_config.get( + 'long_running_operation_timeout', + self.config.long_running_operation_timeout) + if polling is True: polling_method = ARMPolling(lro_delay, lro_options={'final-state-via': 'location'}, **operation_config) + elif polling is False: polling_method = NoPolling() + else: polling_method = polling + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + revoke_access.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/snapshots/{snapshotName}/endGetAccess'} diff --git a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2019_04_01/operations/_resource_skus_operations.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2019_04_01/operations/_resource_skus_operations.py index 44723fd2def2..8ba3992094fc 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2019_04_01/operations/_resource_skus_operations.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2019_04_01/operations/_resource_skus_operations.py @@ -40,10 +40,12 @@ def __init__(self, client, config, serializer, deserializer): self.config = config def list( - self, custom_headers=None, raw=False, **operation_config): + self, filter=None, custom_headers=None, raw=False, **operation_config): """Gets the list of Microsoft.Compute SKUs available for your Subscription. + :param filter: The filter to apply on the operation. + :type filter: str :param dict custom_headers: headers that will be added to the request :param bool raw: returns the direct response alongside the deserialized response @@ -66,6 +68,8 @@ def prepare_request(next_link=None): # Construct parameters query_parameters = {} query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + if filter is not None: + query_parameters['$filter'] = self._serialize.query("filter", filter, 'str') else: url = next_link