def _set_base_deploy_azure_vm_model_params(self, deployed_resource, resource):
"""Convert all basic parameters for VM deploy models
:param deployed_resource: deploy_azure_vm_resource_models.BaseDeployAzureVMResourceModel subclass instance
:param resource: The context of the resource
:return:
"""
deployed_resource.group_name = "" # needs to be auto generated
deployed_resource.vm_name = "" # needs to be auto generated
deployed_resource.cloud_provider = resource.attributes[
'Cloud Provider'] if 'Cloud Provider' in resource.attributes.keys() else None
deployed_resource.vm_size = resource.attributes['VM Size']
deployed_resource.autoload = self._convert_to_bool(resource.attributes['Autoload'])
deployed_resource.add_public_ip = self._convert_to_bool(resource.attributes['Add Public IP'])
deployed_resource.inbound_ports = resource.attributes['Inbound Ports']
deployed_resource.public_ip_type = resource.attributes['Public IP Type']
deployed_resource.disk_type = resource.attributes['Disk Type']
deployed_resource.extension_script_file = resource.attributes['Extension Script file']
deployed_resource.extension_script_configurations = resource.attributes['Extension Script Configurations']
deployed_resource.extension_script_timeout = int(resource.attributes['Extension Script Timeout'])
app_request = jsonpickle.decode(resource.app_context.app_request_json)
attrs = app_request["logicalResource"]["attributes"]
deployed_resource.username = AzureModelsParser.get_attribute_value_by_name_ignoring_namespace(attrs, "User")
deployed_resource.password = AzureModelsParser.get_attribute_value_by_name_ignoring_namespace(attrs, "Password")
评论列表
文章目录