Skip to content

Commit

Permalink
Generated from f2f595089c0038c9109c3221d2f04f8d0019a04e (#2164)
Browse files Browse the repository at this point in the history
Plug disks 2018-04-01 for multi api versionning
  • Loading branch information
AutorestCI authored Mar 14, 2018
1 parent c8a4a92 commit 7c81b39
Show file tree
Hide file tree
Showing 51 changed files with 3,762 additions and 0 deletions.
10 changes: 10 additions & 0 deletions azure-mgmt-compute/azure/mgmt/compute/compute_management_client.py
Original file line number Diff line number Diff line change
Expand Up @@ -108,6 +108,7 @@ def models(cls, api_version=DEFAULT_API_VERSION):
* 2017-03-30: :mod:`v2017_03_30.models<azure.mgmt.compute.v2017_03_30.models>`
* 2017-09-01: :mod:`v2017_09_01.models<azure.mgmt.compute.v2017_09_01.models>`
* 2017-12-01: :mod:`v2017_12_01.models<azure.mgmt.compute.v2017_12_01.models>`
* 2018-04-01: :mod:`v2018_04_01.models<azure.mgmt.compute.v2018_04_01.models>`
"""
if api_version == '2015-06-15':
from .v2015_06_15 import models
Expand All @@ -127,6 +128,9 @@ def models(cls, api_version=DEFAULT_API_VERSION):
elif api_version == '2017-12-01':
from .v2017_12_01 import models
return models
elif api_version == '2018-04-01':
from .v2018_04_01 import models
return models
raise NotImplementedError("APIVersion {} is not available".format(api_version))

@property
Expand Down Expand Up @@ -160,12 +164,15 @@ def disks(self):
* 2016-04-30-preview: :class:`DisksOperations<azure.mgmt.compute.v2016_04_30_preview.operations.DisksOperations>`
* 2017-03-30: :class:`DisksOperations<azure.mgmt.compute.v2017_03_30.operations.DisksOperations>`
* 2018-04-01: :class:`DisksOperations<azure.mgmt.compute.v2018_04_01.operations.DisksOperations>`
"""
api_version = self.profile.get('disks', self.api_version)
if api_version == '2016-04-30-preview':
from .v2016_04_30_preview.operations import DisksOperations as OperationClass
elif api_version == '2017-03-30':
from .v2017_03_30.operations import DisksOperations as OperationClass
elif api_version == '2018-04-01':
from .v2018_04_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)))
Expand Down Expand Up @@ -224,12 +231,15 @@ def snapshots(self):
* 2016-04-30-preview: :class:`SnapshotsOperations<azure.mgmt.compute.v2016_04_30_preview.operations.SnapshotsOperations>`
* 2017-03-30: :class:`SnapshotsOperations<azure.mgmt.compute.v2017_03_30.operations.SnapshotsOperations>`
* 2018-04-01: :class:`SnapshotsOperations<azure.mgmt.compute.v2018_04_01.operations.SnapshotsOperations>`
"""
api_version = self.profile.get('snapshots', self.api_version)
if api_version == '2016-04-30-preview':
from .v2016_04_30_preview.operations import SnapshotsOperations as OperationClass
elif api_version == '2017-03-30':
from .v2017_03_30.operations import SnapshotsOperations as OperationClass
elif api_version == '2018-04-01':
from .v2018_04_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)))
Expand Down
18 changes: 18 additions & 0 deletions azure-mgmt-compute/azure/mgmt/compute/v2018_04_01/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
# coding=utf-8
# --------------------------------------------------------------------------
# Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License. See License.txt in the project root for
# license information.
#
# Code generated by Microsoft (R) AutoRest Code Generator.
# Changes may cause incorrect behavior and will be lost if the code is
# regenerated.
# --------------------------------------------------------------------------

from .compute_management_client import ComputeManagementClient
from .version import VERSION

__all__ = ['ComputeManagementClient']

__version__ = VERSION

Original file line number Diff line number Diff line change
@@ -0,0 +1,90 @@
# coding=utf-8
# --------------------------------------------------------------------------
# Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License. See License.txt in the project root for
# license information.
#
# Code generated by Microsoft (R) AutoRest Code Generator.
# Changes may cause incorrect behavior and will be lost if the code is
# regenerated.
# --------------------------------------------------------------------------

from msrest.service_client import ServiceClient
from msrest import Serializer, Deserializer
from msrestazure import AzureConfiguration
from .version import VERSION
from .operations.disks_operations import DisksOperations
from .operations.snapshots_operations import SnapshotsOperations
from . import models


class ComputeManagementClientConfiguration(AzureConfiguration):
"""Configuration for ComputeManagementClient
Note that all parameters used to create this instance are saved as instance
attributes.
:param credentials: Credentials needed for the client to connect to Azure.
:type credentials: :mod:`A msrestazure Credentials
object<msrestazure.azure_active_directory>`
:param subscription_id: Subscription credentials which uniquely identify
Microsoft Azure subscription. The subscription ID forms part of the URI
for every service call.
:type subscription_id: str
:param str base_url: Service URL
"""

def __init__(
self, credentials, subscription_id, base_url=None):

if credentials is None:
raise ValueError("Parameter 'credentials' must not be None.")
if subscription_id is None:
raise ValueError("Parameter 'subscription_id' must not be None.")
if not base_url:
base_url = 'https://management.azure.com'

super(ComputeManagementClientConfiguration, self).__init__(base_url)

self.add_user_agent('azure-mgmt-compute/{}'.format(VERSION))
self.add_user_agent('Azure-SDK-For-Python')

self.credentials = credentials
self.subscription_id = subscription_id


class ComputeManagementClient(object):
"""Compute Client
:ivar config: Configuration for client.
:vartype config: ComputeManagementClientConfiguration
:ivar disks: Disks operations
:vartype disks: azure.mgmt.compute.v2018_04_01.operations.DisksOperations
:ivar snapshots: Snapshots operations
:vartype snapshots: azure.mgmt.compute.v2018_04_01.operations.SnapshotsOperations
:param credentials: Credentials needed for the client to connect to Azure.
:type credentials: :mod:`A msrestazure Credentials
object<msrestazure.azure_active_directory>`
:param subscription_id: Subscription credentials which uniquely identify
Microsoft Azure subscription. The subscription ID forms part of the URI
for every service call.
:type subscription_id: str
:param str base_url: Service URL
"""

def __init__(
self, credentials, subscription_id, base_url=None):

self.config = ComputeManagementClientConfiguration(credentials, subscription_id, base_url)
self._client = ServiceClient(self.config.credentials, self.config)

client_models = {k: v for k, v in models.__dict__.items() if isinstance(v, type)}
self.api_version = '2018-04-01'
self._serialize = Serializer(client_models)
self._deserialize = Deserializer(client_models)

self.disks = DisksOperations(
self._client, self.config, self._serialize, self._deserialize)
self.snapshots = SnapshotsOperations(
self._client, self.config, self._serialize, self._deserialize)
Original file line number Diff line number Diff line change
@@ -0,0 +1,92 @@
# 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.
# --------------------------------------------------------------------------

try:
from .resource_py3 import Resource
from .disk_sku_py3 import DiskSku
from .resource_update_py3 import ResourceUpdate
from .image_disk_reference_py3 import ImageDiskReference
from .creation_data_py3 import CreationData
from .source_vault_py3 import SourceVault
from .key_vault_and_secret_reference_py3 import KeyVaultAndSecretReference
from .key_vault_and_key_reference_py3 import KeyVaultAndKeyReference
from .encryption_settings_py3 import EncryptionSettings
from .disk_py3 import Disk
from .disk_update_py3 import DiskUpdate
from .snapshot_sku_py3 import SnapshotSku
from .grant_access_data_py3 import GrantAccessData
from .access_uri_py3 import AccessUri
from .snapshot_py3 import Snapshot
from .snapshot_update_py3 import SnapshotUpdate
from .api_error_base_py3 import ApiErrorBase
from .inner_error_py3 import InnerError
from .api_error_py3 import ApiError
from .operation_status_response_py3 import OperationStatusResponse
except (SyntaxError, ImportError):
from .resource import Resource
from .disk_sku import DiskSku
from .resource_update import ResourceUpdate
from .image_disk_reference import ImageDiskReference
from .creation_data import CreationData
from .source_vault import SourceVault
from .key_vault_and_secret_reference import KeyVaultAndSecretReference
from .key_vault_and_key_reference import KeyVaultAndKeyReference
from .encryption_settings import EncryptionSettings
from .disk import Disk
from .disk_update import DiskUpdate
from .snapshot_sku import SnapshotSku
from .grant_access_data import GrantAccessData
from .access_uri import AccessUri
from .snapshot import Snapshot
from .snapshot_update import SnapshotUpdate
from .api_error_base import ApiErrorBase
from .inner_error import InnerError
from .api_error import ApiError
from .operation_status_response import OperationStatusResponse
from .disk_paged import DiskPaged
from .snapshot_paged import SnapshotPaged
from .compute_management_client_enums import (
StorageAccountTypes,
OperatingSystemTypes,
DiskCreateOption,
SnapshotStorageAccountTypes,
AccessLevel,
)

__all__ = [
'Resource',
'DiskSku',
'ResourceUpdate',
'ImageDiskReference',
'CreationData',
'SourceVault',
'KeyVaultAndSecretReference',
'KeyVaultAndKeyReference',
'EncryptionSettings',
'Disk',
'DiskUpdate',
'SnapshotSku',
'GrantAccessData',
'AccessUri',
'Snapshot',
'SnapshotUpdate',
'ApiErrorBase',
'InnerError',
'ApiError',
'OperationStatusResponse',
'DiskPaged',
'SnapshotPaged',
'StorageAccountTypes',
'OperatingSystemTypes',
'DiskCreateOption',
'SnapshotStorageAccountTypes',
'AccessLevel',
]
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
# coding=utf-8
# --------------------------------------------------------------------------
# Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License. See License.txt in the project root for
# license information.
#
# Code generated by Microsoft (R) AutoRest Code Generator.
# Changes may cause incorrect behavior and will be lost if the code is
# regenerated.
# --------------------------------------------------------------------------

from msrest.serialization import Model


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': 'properties.output.accessSAS', 'type': 'str'},
}

def __init__(self, **kwargs):
super(AccessUri, self).__init__(**kwargs)
self.access_sas = None
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
# coding=utf-8
# --------------------------------------------------------------------------
# Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License. See License.txt in the project root for
# license information.
#
# Code generated by Microsoft (R) AutoRest Code Generator.
# Changes may cause incorrect behavior and will be lost if the code is
# regenerated.
# --------------------------------------------------------------------------

from msrest.serialization import Model


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': 'properties.output.accessSAS', 'type': 'str'},
}

def __init__(self, **kwargs) -> None:
super(AccessUri, self).__init__(**kwargs)
self.access_sas = None
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
# coding=utf-8
# --------------------------------------------------------------------------
# Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License. See License.txt in the project root for
# license information.
#
# Code generated by Microsoft (R) AutoRest Code Generator.
# Changes may cause incorrect behavior and will be lost if the code is
# regenerated.
# --------------------------------------------------------------------------

from msrest.serialization import Model


class ApiError(Model):
"""Api error.
:param details: The Api error details
:type details: list[~azure.mgmt.compute.v2018_04_01.models.ApiErrorBase]
:param innererror: The Api inner error
:type innererror: ~azure.mgmt.compute.v2018_04_01.models.InnerError
:param code: The error code.
:type code: str
:param target: The target of the particular error.
:type target: str
:param message: The error message.
:type message: str
"""

_attribute_map = {
'details': {'key': 'details', 'type': '[ApiErrorBase]'},
'innererror': {'key': 'innererror', 'type': 'InnerError'},
'code': {'key': 'code', 'type': 'str'},
'target': {'key': 'target', 'type': 'str'},
'message': {'key': 'message', 'type': 'str'},
}

def __init__(self, **kwargs):
super(ApiError, self).__init__(**kwargs)
self.details = kwargs.get('details', None)
self.innererror = kwargs.get('innererror', None)
self.code = kwargs.get('code', None)
self.target = kwargs.get('target', None)
self.message = kwargs.get('message', None)
Loading

0 comments on commit 7c81b39

Please sign in to comment.