def create_hdi_application(cmd, client, resource_group_name, cluster_name, application_name, script_uri, script_action_name, script_parameters=None, edgenode_size='Standard_D3_V2', ssh_username='******', ssh_password=None, ssh_public_key=None, marketplace_identifier=None, application_type='CustomApplication', tags=None, https_endpoint_access_mode=None, https_endpoint_location=None, https_endpoint_destination_port=8080, https_endpoint_public_port=443, sub_domain_suffix=None, disable_gateway_auth=None, ssh_endpoint_location=None, ssh_endpoint_destination_port=22, ssh_endpoint_public_port=22, vnet_name=None, subnet=None, no_validation_timeout=False): from .util import build_virtual_network_profile from azure.mgmt.hdinsight.models import Application, ApplicationProperties, ComputeProfile, RuntimeScriptAction, \ Role, LinuxOperatingSystemProfile, HardwareProfile, \ ApplicationGetHttpsEndpoint, ApplicationGetEndpoint, OsProfile # Specify virtual network profile only when network arguments are provided virtual_network_profile = subnet and build_virtual_network_profile(subnet) os_profile = (ssh_password or ssh_public_key) and OsProfile( linux_operating_system_profile=LinuxOperatingSystemProfile( username=ssh_username, password=ssh_password, ssh_public_key=ssh_public_key ) ) roles = [ Role( name="edgenode", target_instance_count=1, hardware_profile=HardwareProfile(vm_size=edgenode_size), os_profile=os_profile, virtual_network_profile=virtual_network_profile ) ] # Validate network profile parameters if not _all_or_none(https_endpoint_access_mode, https_endpoint_location): raise CLIError('Either both the https endpoint location and access mode should be specified, ' 'or neither should be.') https_endpoints = [] if https_endpoint_location: https_endpoints.append( ApplicationGetHttpsEndpoint( access_modes=[https_endpoint_access_mode], location=https_endpoint_location, destination_port=https_endpoint_destination_port, public_port=https_endpoint_public_port, sub_domain_suffix=sub_domain_suffix, disable_gateway_auth=disable_gateway_auth ) ) ssh_endpoints = [] if ssh_endpoint_location: ssh_endpoints.append( ApplicationGetEndpoint( location=ssh_endpoint_location, destination_port=ssh_endpoint_destination_port, public_port=ssh_endpoint_public_port ) ) application_properties = ApplicationProperties( compute_profile=ComputeProfile( roles=roles ), install_script_actions=[ RuntimeScriptAction( name=script_action_name, uri=script_uri, parameters=script_parameters, roles=[role.name for role in roles] ) ], https_endpoints=https_endpoints, ssh_endpoints=ssh_endpoints, application_type=application_type, marketplace_identifier=marketplace_identifier, ) create_params = Application( tags=tags, properties=application_properties ) return client.create(resource_group_name, cluster_name, application_name, create_params)
def create_hdi_application(cmd, client, resource_group_name, cluster_name, application_name, script_uri, script_action_name, script_parameters=None, edgenode_size='Standard_D3_V2', ssh_username='******', ssh_password=None, ssh_public_key=None, marketplace_identifier=None, application_type='CustomApplication', tags=None, https_endpoint_access_mode='WebPage', https_endpoint_destination_port=8080, sub_domain_suffix=None, disable_gateway_auth=None, vnet_name=None, subnet=None, no_validation_timeout=False): from .util import build_virtual_network_profile from azure.mgmt.hdinsight.models import Application, ApplicationProperties, ComputeProfile, RuntimeScriptAction, \ Role, LinuxOperatingSystemProfile, HardwareProfile, \ ApplicationGetHttpsEndpoint, OsProfile, SshProfile, SshPublicKey # Specify virtual network profile only when network arguments are provided virtual_network_profile = subnet and build_virtual_network_profile(subnet) os_profile = (ssh_password or ssh_public_key) and OsProfile( linux_operating_system_profile=LinuxOperatingSystemProfile( username=ssh_username, password=ssh_password, ssh_profile=ssh_public_key and SshProfile( public_keys=[SshPublicKey(certificate_data=ssh_public_key)]))) roles = [ Role(name="edgenode", target_instance_count=1, hardware_profile=HardwareProfile(vm_size=edgenode_size), os_profile=os_profile, virtual_network_profile=virtual_network_profile) ] # Validate network profile parameters https_endpoints = [] if sub_domain_suffix: https_endpoints.append( ApplicationGetHttpsEndpoint( access_modes=[https_endpoint_access_mode], destination_port=https_endpoint_destination_port, sub_domain_suffix=sub_domain_suffix, disable_gateway_auth=disable_gateway_auth)) application_properties = ApplicationProperties( compute_profile=ComputeProfile(roles=roles), install_script_actions=[ RuntimeScriptAction(name=script_action_name, uri=script_uri, parameters=script_parameters, roles=[role.name for role in roles]) ], https_endpoints=https_endpoints, application_type=application_type, marketplace_identifier=marketplace_identifier, ) create_params = Application(tags=tags, properties=application_properties) return client.begin_create(resource_group_name, cluster_name, application_name, create_params)