resources models

pull/33897/merge
Zhijun Zhao 7 years ago committed by Matt Davis
parent 11c5d7b670
commit 8b482ecd81

@ -379,12 +379,6 @@ except ImportError as exc:
try: try:
from itertools import chain from itertools import chain
from azure.common.exceptions import CloudError from azure.common.exceptions import CloudError
from azure.mgmt.resource.resources.models import (DeploymentProperties,
ParametersLink,
TemplateLink,
Deployment,
ResourceGroup,
Dependency)
from azure.mgmt.resource.resources import ResourceManagementClient from azure.mgmt.resource.resources import ResourceManagementClient
from azure.mgmt.network import NetworkManagementClient from azure.mgmt.network import NetworkManagementClient
@ -482,21 +476,21 @@ class AzureRMDeploymentManager(AzureRMModuleBase):
:return: :return:
""" """
deploy_parameter = DeploymentProperties(self.deployment_mode) deploy_parameter = self.rm_models.DeploymentProperties(self.deployment_mode)
if not self.parameters_link: if not self.parameters_link:
deploy_parameter.parameters = self.parameters deploy_parameter.parameters = self.parameters
else: else:
deploy_parameter.parameters_link = ParametersLink( deploy_parameter.parameters_link = self.rm_models.ParametersLink(
uri=self.parameters_link uri=self.parameters_link
) )
if not self.template_link: if not self.template_link:
deploy_parameter.template = self.template deploy_parameter.template = self.template
else: else:
deploy_parameter.template_link = TemplateLink( deploy_parameter.template_link = self.rm_models.TemplateLink(
uri=self.template_link uri=self.template_link
) )
params = ResourceGroup(location=self.location, tags=self.tags) params = self.rm_models.ResourceGroup(location=self.location, tags=self.tags)
try: try:
self.rm_client.resource_groups.create_or_update(self.resource_group_name, params) self.rm_client.resource_groups.create_or_update(self.resource_group_name, params)
@ -627,7 +621,7 @@ class AzureRMDeploymentManager(AzureRMModuleBase):
for dep in dependencies: for dep in dependencies:
if dep.resource_name not in tree: if dep.resource_name not in tree:
tree[dep.resource_name] = dict(dep=dep, children=dict()) tree[dep.resource_name] = dict(dep=dep, children=dict())
if isinstance(dep, Dependency) and dep.depends_on is not None and len(dep.depends_on) > 0: if isinstance(dep, self.rm_models.Dependency) and dep.depends_on is not None and len(dep.depends_on) > 0:
self._build_hierarchy(dep.depends_on, tree[dep.resource_name]['children']) self._build_hierarchy(dep.depends_on, tree[dep.resource_name]['children'])
if 'top' in tree: if 'top' in tree:

@ -96,7 +96,6 @@ state:
try: try:
from msrestazure.azure_exceptions import CloudError from msrestazure.azure_exceptions import CloudError
from azure.mgmt.resource.resources.models import ResourceGroup
except ImportError: except ImportError:
pass pass
@ -193,13 +192,13 @@ class AzureRMResourceGroup(AzureRMModuleBase):
if self.name_exists(): if self.name_exists():
self.fail("Error: a resource group with the name {0} already exists in your subscription." self.fail("Error: a resource group with the name {0} already exists in your subscription."
.format(self.name)) .format(self.name))
params = ResourceGroup( params = self.rm_models.ResourceGroup(
location=self.location, location=self.location,
tags=self.tags tags=self.tags
) )
else: else:
# Update resource group # Update resource group
params = ResourceGroup( params = self.rm_models.ResourceGroup(
location=results['location'], location=results['location'],
tags=results['tags'] tags=results['tags']
) )

Loading…
Cancel
Save