|
| 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 | + |
| 6 | +from azure.mgmt.cognitiveservices.models import ConnectionCategory |
| 7 | + |
| 8 | +_ML_CONNECTION_TYPE_TO_COGNITIVE_SERVICES_CONNECTION_TYPE = { |
| 9 | + "PythonFeed": ConnectionCategory.PYTHON_FEED, |
| 10 | + "ContainerRegistry": ConnectionCategory.CONTAINER_REGISTRY, |
| 11 | + "Git": ConnectionCategory.GIT, |
| 12 | + "S3": ConnectionCategory.S3, |
| 13 | + "Snowflake": ConnectionCategory.SNOWFLAKE, |
| 14 | + "AzureSqlDb": ConnectionCategory.AZURE_SQL_DB, |
| 15 | + "AzureSynapseAnalytics": ConnectionCategory.AZURE_SYNAPSE_ANALYTICS, |
| 16 | + "AzureMySqlDb": ConnectionCategory.AZURE_MY_SQL_DB, |
| 17 | + "AzurePostgresDb": ConnectionCategory.AZURE_POSTGRES_DB, |
| 18 | + "ADLSGen2": ConnectionCategory.ADLS_GEN2, |
| 19 | + "Redis": ConnectionCategory.REDIS, |
| 20 | + "ApiKey": ConnectionCategory.API_KEY, |
| 21 | + "AzureOpenAI": ConnectionCategory.AZURE_OPEN_AI, |
| 22 | + "AzureOpenAi": ConnectionCategory.AZURE_OPEN_AI, |
| 23 | + "AIServices": ConnectionCategory.AI_SERVICES, |
| 24 | + "AiServices": ConnectionCategory.AI_SERVICES, |
| 25 | + "CognitiveSearch": ConnectionCategory.COGNITIVE_SEARCH, |
| 26 | + "CognitiveService": ConnectionCategory.COGNITIVE_SERVICE, |
| 27 | + "CustomKeys": ConnectionCategory.CUSTOM_KEYS, |
| 28 | + "AzureBlob": ConnectionCategory.AZURE_BLOB, |
| 29 | + "AzureOneLake": ConnectionCategory.AZURE_ONE_LAKE, |
| 30 | + "CosmosDb": ConnectionCategory.COSMOS_DB, |
| 31 | + "CosmosDbMongoDbApi": ConnectionCategory.COSMOS_DB_MONGO_DB_API, |
| 32 | + "AzureDataExplorer": ConnectionCategory.AZURE_DATA_EXPLORER, |
| 33 | + "AzureMariaDb": ConnectionCategory.AZURE_MARIA_DB, |
| 34 | + "AzureDatabricksDeltaLake": ConnectionCategory.AZURE_DATABRICKS_DELTA_LAKE, |
| 35 | + "AzureSqlMi": ConnectionCategory.AZURE_SQL_MI, |
| 36 | + "AzureTableStorage": ConnectionCategory.AZURE_TABLE_STORAGE, |
| 37 | + "AmazonRdsForOracle": ConnectionCategory.AMAZON_RDS_FOR_ORACLE, |
| 38 | + "AmazonRdsForSqlServer": ConnectionCategory.AMAZON_RDS_FOR_SQL_SERVER, |
| 39 | + "AmazonRedshift": ConnectionCategory.AMAZON_REDSHIFT, |
| 40 | + "Db2": ConnectionCategory.DB2, |
| 41 | + "Drill": ConnectionCategory.DRILL, |
| 42 | + "GoogleBigQuery": ConnectionCategory.GOOGLE_BIG_QUERY, |
| 43 | + "Greenplum": ConnectionCategory.GREENPLUM, |
| 44 | + "Hbase": ConnectionCategory.HBASE, |
| 45 | + "Hive": ConnectionCategory.HIVE, |
| 46 | + "Impala": ConnectionCategory.IMPALA, |
| 47 | + "Informix": ConnectionCategory.INFORMIX, |
| 48 | + "MariaDb": ConnectionCategory.MARIA_DB, |
| 49 | + "MicrosoftAccess": ConnectionCategory.MICROSOFT_ACCESS, |
| 50 | + "MySql": ConnectionCategory.MY_SQL, |
| 51 | + "Netezza": ConnectionCategory.NETEZZA, |
| 52 | + "Oracle": ConnectionCategory.ORACLE, |
| 53 | + "Phoenix": ConnectionCategory.PHOENIX, |
| 54 | + "PostgreSql": ConnectionCategory.POSTGRE_SQL, |
| 55 | + "Presto": ConnectionCategory.PRESTO, |
| 56 | + "SapOpenHub": ConnectionCategory.SAP_OPEN_HUB, |
| 57 | + "SapBw": ConnectionCategory.SAP_BW, |
| 58 | + "SapHana": ConnectionCategory.SAP_HANA, |
| 59 | + "SapTable": ConnectionCategory.SAP_TABLE, |
| 60 | + "Spark": ConnectionCategory.SPARK, |
| 61 | + "SqlServer": ConnectionCategory.SQL_SERVER, |
| 62 | + "Sybase": ConnectionCategory.SYBASE, |
| 63 | + "Teradata": ConnectionCategory.TERADATA, |
| 64 | + "Vertica": ConnectionCategory.VERTICA, |
| 65 | + "Pinecone": ConnectionCategory.PINECONE, |
| 66 | + "Cassandra": ConnectionCategory.CASSANDRA, |
| 67 | + "Couchbase": ConnectionCategory.COUCHBASE, |
| 68 | + "MongoDbV2": ConnectionCategory.MONGO_DB_V2, |
| 69 | + "MongoDbAtlas": ConnectionCategory.MONGO_DB_ATLAS, |
| 70 | + "AmazonS3Compatible": ConnectionCategory.AMAZON_S3_COMPATIBLE, |
| 71 | + "FileServer": ConnectionCategory.FILE_SERVER, |
| 72 | + "FtpServer": ConnectionCategory.FTP_SERVER, |
| 73 | + "GoogleCloudStorage": ConnectionCategory.GOOGLE_CLOUD_STORAGE, |
| 74 | + "Hdfs": ConnectionCategory.HDFS, |
| 75 | + "OracleCloudStorage": ConnectionCategory.ORACLE_CLOUD_STORAGE, |
| 76 | + "Sftp": ConnectionCategory.SFTP, |
| 77 | + "GenericHttp": ConnectionCategory.GENERIC_HTTP, |
| 78 | + "ODataRest": ConnectionCategory.O_DATA_REST, |
| 79 | + "Odbc": ConnectionCategory.ODBC, |
| 80 | + "GenericRest": ConnectionCategory.GENERIC_REST, |
| 81 | + "AmazonMws": ConnectionCategory.AMAZON_MWS, |
| 82 | + "Concur": ConnectionCategory.CONCUR, |
| 83 | + "Dynamics": ConnectionCategory.DYNAMICS, |
| 84 | + "DynamicsAx": ConnectionCategory.DYNAMICS_AX, |
| 85 | + "DynamicsCrm": ConnectionCategory.DYNAMICS_CRM, |
| 86 | + "GoogleAdWords": ConnectionCategory.GOOGLE_AD_WORDS, |
| 87 | + "Hubspot": ConnectionCategory.HUBSPOT, |
| 88 | + "Jira": ConnectionCategory.JIRA, |
| 89 | + "Magento": ConnectionCategory.MAGENTO, |
| 90 | + "Marketo": ConnectionCategory.MARKETO, |
| 91 | + "Office365": ConnectionCategory.OFFICE365, |
| 92 | + "Eloqua": ConnectionCategory.ELOQUA, |
| 93 | + "Responsys": ConnectionCategory.RESPONSYS, |
| 94 | + "OracleServiceCloud": ConnectionCategory.ORACLE_SERVICE_CLOUD, |
| 95 | + "PayPal": ConnectionCategory.PAY_PAL, |
| 96 | + "QuickBooks": ConnectionCategory.QUICK_BOOKS, |
| 97 | + "Salesforce": ConnectionCategory.SALESFORCE, |
| 98 | + "SalesforceServiceCloud": ConnectionCategory.SALESFORCE_SERVICE_CLOUD, |
| 99 | + "SalesforceMarketingCloud": ConnectionCategory.SALESFORCE_MARKETING_CLOUD, |
| 100 | + "SapCloudForCustomer": ConnectionCategory.SAP_CLOUD_FOR_CUSTOMER, |
| 101 | + "SapEcc": ConnectionCategory.SAP_ECC, |
| 102 | + "ServiceNow": ConnectionCategory.SERVICE_NOW, |
| 103 | + "SharePointOnlineList": ConnectionCategory.SHARE_POINT_ONLINE_LIST, |
| 104 | + "Shopify": ConnectionCategory.SHOPIFY, |
| 105 | + "Square": ConnectionCategory.SQUARE, |
| 106 | + "WebTable": ConnectionCategory.WEB_TABLE, |
| 107 | + "Xero": ConnectionCategory.XERO, |
| 108 | + "Zoho": ConnectionCategory.ZOHO, |
| 109 | + "GenericContainerRegistry": ConnectionCategory.GENERIC_CONTAINER_REGISTRY, |
| 110 | + "Elasticsearch": ConnectionCategory.ELASTICSEARCH, |
| 111 | + "OpenAI": ConnectionCategory.OPEN_AI, |
| 112 | + "OpenAi": ConnectionCategory.OPEN_AI, |
| 113 | + "Serp": ConnectionCategory.SERP, |
| 114 | + "BingLLMSearch": ConnectionCategory.BING_LLM_SEARCH, |
| 115 | + "Serverless": ConnectionCategory.SERVERLESS, |
| 116 | + "ManagedOnlineEndpoint": ConnectionCategory.MANAGED_ONLINE_ENDPOINT, |
| 117 | + # The following are from azure.ai.ml.constants._common.ConnectionTypes |
| 118 | + "Custom": ConnectionCategory.CUSTOM_KEYS, |
| 119 | + "AzureDataLakeGen2": ConnectionCategory.ADLS_GEN2, |
| 120 | + "AzureContentSafety": ConnectionCategory.COGNITIVE_SERVICE, |
| 121 | + "AzureSpeechServices": ConnectionCategory.COGNITIVE_SERVICE, |
| 122 | + "AzureAiSearch": ConnectionCategory.COGNITIVE_SEARCH, |
| 123 | + "AzureAiServices": ConnectionCategory.AI_SERVICES, |
| 124 | +} |
| 125 | + |
| 126 | + |
| 127 | +def get_valid_mlconn_types(): |
| 128 | + return list(_ML_CONNECTION_TYPE_TO_COGNITIVE_SERVICES_CONNECTION_TYPE.keys()) |
| 129 | + |
| 130 | + |
| 131 | +def get_mapped_mlconn_type(ml_connection_type: str): |
| 132 | + from . _utils import snake_to_camel |
| 133 | + normalized_name = snake_to_camel(ml_connection_type) |
| 134 | + return _ML_CONNECTION_TYPE_TO_COGNITIVE_SERVICES_CONNECTION_TYPE.get(normalized_name) |
0 commit comments