1# -------------------------------------------------------------------------------------------- 2# Copyright (c) Microsoft Corporation. All rights reserved. 3# Licensed under the MIT License. See License.txt in the project root for license information. 4# -------------------------------------------------------------------------------------------- 5# pylint: disable=unused-argument 6from azure.cli.core.util import sdk_no_wait 7from azure.mgmt.synapse.models import (IntegrationRuntimeResource, 8 IntegrationRuntimeRegenerateKeyParameters, UpdateIntegrationRuntimeRequest) 9 10 11def create(cmd, client, resource_group_name, workspace_name, integration_runtime_name, integration_runtime_type, 12 description=None, if_match=None, location='AutoResolve', compute_type='General', 13 core_count=8, time_to_live=0, no_wait=False): 14 property_files = {} 15 property_files['type'] = integration_runtime_type 16 property_files['description'] = description 17 if integration_runtime_type == 'Managed': 18 property_files['typeProperties'] = {} 19 property_files['typeProperties']['computeProperties'] = {} 20 property_files['typeProperties']['computeProperties']['location'] = location 21 property_files['typeProperties']['computeProperties']['dataFlowProperties'] = {} 22 property_files['typeProperties']['computeProperties']['dataFlowProperties']['computeType'] = compute_type 23 property_files['typeProperties']['computeProperties']['dataFlowProperties']['coreCount'] = core_count 24 property_files['typeProperties']['computeProperties']['dataFlowProperties']['timeToLive'] = time_to_live 25 properties = IntegrationRuntimeResource(type=integration_runtime_type, properties=property_files) 26 return sdk_no_wait(no_wait, client.begin_create, resource_group_name, workspace_name, 27 integration_runtime_name, properties, if_match) 28 29 30def Managed_Create(cmd, client, resource_group_name, workspace_name, integration_runtime_name, 31 description=None, if_match=None, location='AutoResolve', compute_type='General', 32 core_count=8, time_to_live=0, no_wait=False): 33 property_files = {} 34 property_files['type'] = 'Managed' 35 property_files['description'] = description 36 property_files['typeProperties'] = {} 37 property_files['typeProperties']['computeProperties'] = {} 38 property_files['typeProperties']['computeProperties']['location'] = location 39 property_files['typeProperties']['computeProperties']['dataFlowProperties'] = {} 40 property_files['typeProperties']['computeProperties']['dataFlowProperties']['computeType'] = compute_type 41 property_files['typeProperties']['computeProperties']['dataFlowProperties']['coreCount'] = core_count 42 property_files['typeProperties']['computeProperties']['dataFlowProperties']['timeToLive'] = time_to_live 43 properties = IntegrationRuntimeResource(type='Managed', properties=property_files) 44 return sdk_no_wait(no_wait, client.begin_create, resource_group_name, workspace_name, 45 integration_runtime_name, properties, if_match) 46 47 48def Selfhosted_Create(cmd, client, resource_group_name, workspace_name, integration_runtime_name, 49 description=None, if_match=None, no_wait=False): 50 property_files = {} 51 property_files['type'] = 'SelfHosted' 52 property_files['description'] = description 53 properties = IntegrationRuntimeResource(type='SelfHosted', properties=property_files) 54 return sdk_no_wait(no_wait, client.begin_create, resource_group_name, workspace_name, 55 integration_runtime_name, properties, if_match) 56 57 58def regenerate(cmd, client, resource_group_name, workspace_name, integration_runtime_name, key_name="default", 59 no_wait=False): 60 regenerate_key_parameters = IntegrationRuntimeRegenerateKeyParameters(key_name=key_name) 61 return sdk_no_wait(no_wait, client.regenerate, resource_group_name, workspace_name, integration_runtime_name, 62 regenerate_key_parameters) 63 64 65def update(cmd, client, resource_group_name, workspace_name, integration_runtime_name, auto_update, 66 update_delay_offset, no_wait=False): 67 update_integration_runtime_request = UpdateIntegrationRuntimeRequest( 68 auto_update=auto_update, 69 update_delay_offset=update_delay_offset 70 ) 71 return sdk_no_wait(no_wait, client.update, resource_group_name, workspace_name, integration_runtime_name, 72 update_integration_runtime_request) 73