diff --git a/src/azure-cli/azure/cli/command_modules/serviceconnector/_help.py b/src/azure-cli/azure/cli/command_modules/serviceconnector/_help.py index ab4a55edecc..eb7b96c9df7 100644 --- a/src/azure-cli/azure/cli/command_modules/serviceconnector/_help.py +++ b/src/azure-cli/azure/cli/command_modules/serviceconnector/_help.py @@ -307,7 +307,7 @@ def get_auth_info_params(auth_type): # special target resource, independent implementation target = RESOURCE.ConfluentKafka server_params = ('--bootstrap-server xxx.eastus.azure.confluent.cloud:9092 ' - '--kafka-key Name --kafka-secret Secret ') + '--kafka-key Name --kafka-secret Secret') registry_params = ('--schema-registry https://xxx.eastus.azure.confluent.cloud ' '--schema-key Name --schema-secret Secret') diff --git a/src/azure-cli/azure/cli/command_modules/serviceconnector/_params.py b/src/azure-cli/azure/cli/command_modules/serviceconnector/_params.py index c5c3f48ff3b..84f7793da07 100644 --- a/src/azure-cli/azure/cli/command_modules/serviceconnector/_params.py +++ b/src/azure-cli/azure/cli/command_modules/serviceconnector/_params.py @@ -35,8 +35,9 @@ def add_source_resource_block(context, source, enable_id=True, validate_source_i required_args = [] for arg, content in SOURCE_RESOURCES_PARAMS.get(source).items(): + id_arg = '\'--id\'' if enable_id else '\'--source-id\'' context.argument(arg, options_list=content.get('options'), type=str, - help='{}. Required if \'--source-id\' is not specified.'.format(content.get('help'))) + help='{}. Required if {} is not specified.'.format(content.get('help'), id_arg)) required_args.append(content.get('options')[0]) validator_kwargs = {'validator': validate_params} if validate_source_id else {} diff --git a/src/azure-cli/azure/cli/command_modules/serviceconnector/_resource_config.py b/src/azure-cli/azure/cli/command_modules/serviceconnector/_resource_config.py index ac246912e87..cf89b9fec3a 100644 --- a/src/azure-cli/azure/cli/command_modules/serviceconnector/_resource_config.py +++ b/src/azure-cli/azure/cli/command_modules/serviceconnector/_resource_config.py @@ -19,6 +19,7 @@ class RESOURCE(Enum): WebApp = 'webapp' SpringCloud = 'spring-cloud' + KubernetesCluster = 'aks' CosmosCassandra = 'cosmos-cassandra' CosmosGremlin = 'cosmos-gremlin' CosmosMongo = 'cosmos-mongo' @@ -33,8 +34,8 @@ class RESOURCE(Enum): Mysql = 'mysql' MysqlFlexible = 'mysql-flexible' # Sql = 'sql' - # Redis = 'redis' - # RedisEnterprise = 'redis-enterprise' + Redis = 'redis' + RedisEnterprise = 'redis-enterprise' KeyVault = 'keyvault' EventHub = 'eventhub' AppConfig = 'appconfig' @@ -75,7 +76,9 @@ class CLIENT_TYPE(Enum): # The dict defines the resource id pattern of source resources. SOURCE_RESOURCES = { RESOURCE.WebApp: '/subscriptions/{subscription}/resourceGroups/{source_resource_group}/providers/Microsoft.Web/sites/{site}', - RESOURCE.SpringCloud: '/subscriptions/{subscription}/resourceGroups/{source_resource_group}/providers/Microsoft.AppPlatform/Spring/{spring}/apps/{app}/deployments/{deployment}' + RESOURCE.SpringCloud: '/subscriptions/{subscription}/resourceGroups/{source_resource_group}/providers/Microsoft.AppPlatform/Spring/{spring}/apps/{app}/deployments/{deployment}', + # TODO: Houk, uncomment this when AKS is officially supported + # RESOURCE.KubernetesCluster: '/subscriptions/{subscription}/resourceGroups/{source_resource_group}/providers/Microsoft.ContainerService/managedClusters/{cluster}', } @@ -86,8 +89,8 @@ class CLIENT_TYPE(Enum): RESOURCE.MysqlFlexible: '/subscriptions/{subscription}/resourceGroups/{target_resource_group}/providers/Microsoft.DBforMySQL/flexibleServers/{server}/databases/{database}', RESOURCE.Mysql: '/subscriptions/{subscription}/resourceGroups/{target_resource_group}/providers/Microsoft.DBForMySQL/servers/{server}/databases/{database}', # RESOURCE.Sql: '/subscriptions/{subscription}/resourceGroups/{target_resource_group}/providers/Microsoft.Sql/servers/{server}/databases/{database}', - # RESOURCE.Redis: '/subscriptions/{subscription}/resourceGroups/{target_resource_group}/providers/Microsoft.Cache/redis/{server}/databases/{database}', - # RESOURCE.RedisEnterprise: '/subscriptions/{subscription}/resourceGroups/{target_resource_group}/providers/Microsoft.Cache/redisEnterprise/{server}/databases/{database}', + RESOURCE.Redis: '/subscriptions/{subscription}/resourceGroups/{target_resource_group}/providers/Microsoft.Cache/redis/{server}/databases/{database}', + RESOURCE.RedisEnterprise: '/subscriptions/{subscription}/resourceGroups/{target_resource_group}/providers/Microsoft.Cache/redisEnterprise/{server}/databases/{database}', RESOURCE.CosmosCassandra: '/subscriptions/{subscription}/resourceGroups/{target_resource_group}/providers/Microsoft.DocumentDB/databaseAccounts/{account}/cassandraKeyspaces/{key_space}', RESOURCE.CosmosGremlin: '/subscriptions/{subscription}/resourceGroups/{target_resource_group}/providers/Microsoft.DocumentDB/databaseAccounts/{account}/gremlinDatabases/{database}/graphs/{graph}', @@ -146,6 +149,18 @@ class CLIENT_TYPE(Enum): 'help': 'The deployment name of the app', 'placeholder': 'MyDeployment' } + }, + RESOURCE.KubernetesCluster: { + 'source_resource_group': { + 'options': ['--resource-group', '-g'], + 'help': 'The resource group which contains the managed cluster', + 'placeholder': 'ClusterRG' + }, + 'cluster': { + 'options': ['--name', '-n'], + 'help': 'Name of the managed cluster', + 'placeholder': 'MyCluster' + } } } @@ -239,40 +254,40 @@ class CLIENT_TYPE(Enum): # 'placeholder': 'MyDB' # } # }, - # RESOURCE.Redis: { - # 'target_resource_group': { - # 'options': ['--target-resource-group', '--tg'], - # 'help': 'The resource group which contains the redis server', - # 'placeholder': 'RedisRG' - # }, - # 'server': { - # 'options': ['--server'], - # 'help': 'Name of the redis server', - # 'placeholder': 'MyServer' - # }, - # 'database': { - # 'options': ['--database'], - # 'help': 'Name of the redis database', - # 'placeholder': 'MyDB' - # } - # }, - # RESOURCE.RedisEnterprise: { - # 'target_resource_group': { - # 'options': ['--target-resource-group', '--tg'], - # 'help': 'The resource group which contains the redis server', - # 'placeholder': 'RedisRG' - # }, - # 'server': { - # 'options': ['--server'], - # 'help': 'Name of the redis enterprise server', - # 'placeholder': 'MyServer' - # }, - # 'database': { - # 'options': ['--database'], - # 'help': 'Name of the redis enterprise database', - # 'placeholder': 'MyDB' - # } - # }, + RESOURCE.Redis: { + 'target_resource_group': { + 'options': ['--target-resource-group', '--tg'], + 'help': 'The resource group which contains the redis server', + 'placeholder': 'RedisRG' + }, + 'server': { + 'options': ['--server'], + 'help': 'Name of the redis server', + 'placeholder': 'MyServer' + }, + 'database': { + 'options': ['--database'], + 'help': 'Name of the redis database', + 'placeholder': 'MyDB' + } + }, + RESOURCE.RedisEnterprise: { + 'target_resource_group': { + 'options': ['--target-resource-group', '--tg'], + 'help': 'The resource group which contains the redis server', + 'placeholder': 'RedisRG' + }, + 'server': { + 'options': ['--server'], + 'help': 'Name of the redis enterprise server', + 'placeholder': 'MyServer' + }, + 'database': { + 'options': ['--database'], + 'help': 'Name of the redis enterprise database', + 'placeholder': 'MyDB' + } + }, RESOURCE.CosmosCassandra: { 'target_resource_group': { 'options': ['--target-resource-group', '--tg'], @@ -523,8 +538,8 @@ class CLIENT_TYPE(Enum): RESOURCE.Mysql: [AUTH_TYPE.Secret], RESOURCE.MysqlFlexible: [AUTH_TYPE.Secret], # RESOURCE.Sql: [AUTH_TYPE.Secret], - # RESOURCE.Redis: [AUTH_TYPE.SecretAuto], - # RESOURCE.RedisEnterprise: [AUTH_TYPE.SecretAuto], + RESOURCE.Redis: [AUTH_TYPE.SecretAuto], + RESOURCE.RedisEnterprise: [AUTH_TYPE.SecretAuto], RESOURCE.CosmosCassandra: [AUTH_TYPE.SystemIdentity, AUTH_TYPE.SecretAuto, AUTH_TYPE.UserIdentity, AUTH_TYPE.ServicePrincipalSecret], RESOURCE.CosmosGremlin: [AUTH_TYPE.SystemIdentity, AUTH_TYPE.SecretAuto, AUTH_TYPE.UserIdentity, AUTH_TYPE.ServicePrincipalSecret], @@ -550,8 +565,8 @@ class CLIENT_TYPE(Enum): RESOURCE.Mysql: [AUTH_TYPE.Secret], RESOURCE.MysqlFlexible: [AUTH_TYPE.Secret], # RESOURCE.Sql: [AUTH_TYPE.Secret], - # RESOURCE.Redis: [AUTH_TYPE.SecretAuto], - # RESOURCE.RedisEnterprise: [AUTH_TYPE.SecretAuto], + RESOURCE.Redis: [AUTH_TYPE.SecretAuto], + RESOURCE.RedisEnterprise: [AUTH_TYPE.SecretAuto], RESOURCE.CosmosCassandra: [AUTH_TYPE.SystemIdentity, AUTH_TYPE.SecretAuto, AUTH_TYPE.ServicePrincipalSecret], RESOURCE.CosmosGremlin: [AUTH_TYPE.SystemIdentity, AUTH_TYPE.SecretAuto, AUTH_TYPE.ServicePrincipalSecret], @@ -569,7 +584,34 @@ class CLIENT_TYPE(Enum): RESOURCE.EventHub: [AUTH_TYPE.SystemIdentity, AUTH_TYPE.SecretAuto, AUTH_TYPE.UserIdentity, AUTH_TYPE.ServicePrincipalSecret], RESOURCE.ServiceBus: [AUTH_TYPE.SystemIdentity, AUTH_TYPE.SecretAuto, AUTH_TYPE.UserIdentity, AUTH_TYPE.ServicePrincipalSecret], RESOURCE.ConfluentKafka: [AUTH_TYPE.Secret], - } + }, + RESOURCE.KubernetesCluster: { + RESOURCE.Postgres: [AUTH_TYPE.Secret], + RESOURCE.PostgresFlexible: [AUTH_TYPE.Secret], + RESOURCE.Mysql: [AUTH_TYPE.Secret], + RESOURCE.MysqlFlexible: [AUTH_TYPE.Secret], + # RESOURCE.Sql: [AUTH_TYPE.Secret], + RESOURCE.Redis: [AUTH_TYPE.SecretAuto], + RESOURCE.RedisEnterprise: [AUTH_TYPE.SecretAuto], + + RESOURCE.CosmosCassandra: [AUTH_TYPE.SecretAuto, AUTH_TYPE.ServicePrincipalSecret], + RESOURCE.CosmosGremlin: [AUTH_TYPE.SecretAuto, AUTH_TYPE.ServicePrincipalSecret], + RESOURCE.CosmosMongo: [AUTH_TYPE.SecretAuto, AUTH_TYPE.ServicePrincipalSecret], + RESOURCE.CosmosTable: [AUTH_TYPE.SecretAuto, AUTH_TYPE.ServicePrincipalSecret], + RESOURCE.CosmosSql: [AUTH_TYPE.SecretAuto, AUTH_TYPE.ServicePrincipalSecret], + + RESOURCE.StorageBlob: [AUTH_TYPE.SecretAuto, AUTH_TYPE.ServicePrincipalSecret], + RESOURCE.StorageQueue: [AUTH_TYPE.SecretAuto, AUTH_TYPE.ServicePrincipalSecret], + RESOURCE.StorageFile: [AUTH_TYPE.SecretAuto], + RESOURCE.StorageTable: [AUTH_TYPE.SecretAuto], + + RESOURCE.KeyVault: [AUTH_TYPE.ServicePrincipalSecret], + RESOURCE.AppConfig: [AUTH_TYPE.SecretAuto, AUTH_TYPE.ServicePrincipalSecret], + RESOURCE.EventHub: [AUTH_TYPE.SecretAuto, AUTH_TYPE.ServicePrincipalSecret], + RESOURCE.ServiceBus: [AUTH_TYPE.SecretAuto, AUTH_TYPE.ServicePrincipalSecret], + RESOURCE.SignalR: [AUTH_TYPE.SecretAuto, AUTH_TYPE.ServicePrincipalSecret], + RESOURCE.ConfluentKafka: [AUTH_TYPE.Secret], + }, } @@ -586,7 +628,8 @@ class CLIENT_TYPE(Enum): CLIENT_TYPE.Php, CLIENT_TYPE.Ruby, CLIENT_TYPE.Django, - CLIENT_TYPE.SpringBoot + CLIENT_TYPE.SpringBoot, + CLIENT_TYPE.Blank ], RESOURCE.PostgresFlexible: [ CLIENT_TYPE.Dotnet, @@ -597,7 +640,8 @@ class CLIENT_TYPE(Enum): CLIENT_TYPE.Php, CLIENT_TYPE.Ruby, CLIENT_TYPE.Django, - CLIENT_TYPE.SpringBoot + CLIENT_TYPE.SpringBoot, + CLIENT_TYPE.Blank ], RESOURCE.Mysql: [ CLIENT_TYPE.Dotnet, @@ -608,7 +652,8 @@ class CLIENT_TYPE(Enum): CLIENT_TYPE.Php, CLIENT_TYPE.Ruby, CLIENT_TYPE.Django, - CLIENT_TYPE.SpringBoot + CLIENT_TYPE.SpringBoot, + CLIENT_TYPE.Blank ], RESOURCE.MysqlFlexible: [ CLIENT_TYPE.Dotnet, @@ -619,7 +664,8 @@ class CLIENT_TYPE(Enum): CLIENT_TYPE.Php, CLIENT_TYPE.Ruby, CLIENT_TYPE.Django, - CLIENT_TYPE.SpringBoot + CLIENT_TYPE.SpringBoot, + CLIENT_TYPE.Blank ], # RESOURCE.Sql: [ # CLIENT_TYPE.Dotnet, @@ -630,72 +676,82 @@ class CLIENT_TYPE(Enum): # CLIENT_TYPE.Php, # CLIENT_TYPE.Ruby, # CLIENT_TYPE.Django, - # CLIENT_TYPE.SpringBoot - # ], - # RESOURCE.Redis: [ - # CLIENT_TYPE.Dotnet, - # CLIENT_TYPE.Java, - # CLIENT_TYPE.Python, - # CLIENT_TYPE.Nodejs, - # CLIENT_TYPE.Go, - # CLIENT_TYPE.SpringBoot - # ], - # RESOURCE.RedisEnterprise: [ - # CLIENT_TYPE.Dotnet, - # CLIENT_TYPE.Java, - # CLIENT_TYPE.Python, - # CLIENT_TYPE.Nodejs, - # CLIENT_TYPE.Go, - # CLIENT_TYPE.SpringBoot + # CLIENT_TYPE.SpringBoot, + # CLIENT_TYPE.Blank # ], + RESOURCE.Redis: [ + CLIENT_TYPE.Dotnet, + CLIENT_TYPE.Java, + CLIENT_TYPE.Python, + CLIENT_TYPE.Nodejs, + CLIENT_TYPE.Go, + CLIENT_TYPE.SpringBoot, + CLIENT_TYPE.Blank + ], + RESOURCE.RedisEnterprise: [ + CLIENT_TYPE.Dotnet, + CLIENT_TYPE.Java, + CLIENT_TYPE.Python, + CLIENT_TYPE.Nodejs, + CLIENT_TYPE.Go, + CLIENT_TYPE.SpringBoot, + CLIENT_TYPE.Blank + ], RESOURCE.CosmosCassandra: [ CLIENT_TYPE.Dotnet, CLIENT_TYPE.Java, CLIENT_TYPE.Python, CLIENT_TYPE.Nodejs, CLIENT_TYPE.Go, - CLIENT_TYPE.SpringBoot + CLIENT_TYPE.SpringBoot, + CLIENT_TYPE.Blank ], RESOURCE.CosmosGremlin: [ CLIENT_TYPE.Dotnet, CLIENT_TYPE.Java, CLIENT_TYPE.Python, CLIENT_TYPE.Nodejs, - CLIENT_TYPE.Php + CLIENT_TYPE.Php, + CLIENT_TYPE.Blank ], RESOURCE.CosmosMongo: [ CLIENT_TYPE.Dotnet, CLIENT_TYPE.Java, CLIENT_TYPE.Nodejs, CLIENT_TYPE.Go, - CLIENT_TYPE.SpringBoot + CLIENT_TYPE.SpringBoot, + CLIENT_TYPE.Blank ], RESOURCE.CosmosTable: [ CLIENT_TYPE.Dotnet, CLIENT_TYPE.Java, CLIENT_TYPE.Python, CLIENT_TYPE.Nodejs, - CLIENT_TYPE.SpringBoot + CLIENT_TYPE.SpringBoot, + CLIENT_TYPE.Blank ], RESOURCE.CosmosSql: [ CLIENT_TYPE.Dotnet, CLIENT_TYPE.Java, CLIENT_TYPE.Python, - CLIENT_TYPE.Nodejs + CLIENT_TYPE.Nodejs, + CLIENT_TYPE.Blank ], RESOURCE.StorageBlob: [ CLIENT_TYPE.Dotnet, CLIENT_TYPE.Java, CLIENT_TYPE.Python, CLIENT_TYPE.Nodejs, - CLIENT_TYPE.SpringBoot + CLIENT_TYPE.SpringBoot, + CLIENT_TYPE.Blank ], RESOURCE.StorageQueue: [ CLIENT_TYPE.Dotnet, CLIENT_TYPE.Java, CLIENT_TYPE.Python, CLIENT_TYPE.Nodejs, - CLIENT_TYPE.SpringBoot + CLIENT_TYPE.SpringBoot, + CLIENT_TYPE.Blank ], RESOURCE.StorageFile: [ CLIENT_TYPE.Dotnet, @@ -704,26 +760,30 @@ class CLIENT_TYPE(Enum): CLIENT_TYPE.Nodejs, CLIENT_TYPE.Php, CLIENT_TYPE.Ruby, - CLIENT_TYPE.SpringBoot + CLIENT_TYPE.SpringBoot, + CLIENT_TYPE.Blank ], RESOURCE.StorageTable: [ CLIENT_TYPE.Dotnet, CLIENT_TYPE.Java, CLIENT_TYPE.Python, - CLIENT_TYPE.Nodejs + CLIENT_TYPE.Nodejs, + CLIENT_TYPE.Blank ], RESOURCE.KeyVault: [ CLIENT_TYPE.Dotnet, CLIENT_TYPE.Java, CLIENT_TYPE.Python, CLIENT_TYPE.Nodejs, - CLIENT_TYPE.SpringBoot + CLIENT_TYPE.SpringBoot, + CLIENT_TYPE.Blank ], RESOURCE.AppConfig: [ CLIENT_TYPE.Dotnet, CLIENT_TYPE.Java, CLIENT_TYPE.Python, - CLIENT_TYPE.Nodejs + CLIENT_TYPE.Nodejs, + CLIENT_TYPE.Blank ], RESOURCE.EventHub: [ CLIENT_TYPE.Dotnet, @@ -731,7 +791,8 @@ class CLIENT_TYPE(Enum): CLIENT_TYPE.Python, CLIENT_TYPE.Nodejs, CLIENT_TYPE.Go, - CLIENT_TYPE.SpringBoot + CLIENT_TYPE.SpringBoot, + CLIENT_TYPE.Blank ], RESOURCE.ServiceBus: [ CLIENT_TYPE.Dotnet, @@ -739,120 +800,145 @@ class CLIENT_TYPE(Enum): CLIENT_TYPE.Python, CLIENT_TYPE.Nodejs, CLIENT_TYPE.Go, - CLIENT_TYPE.SpringBoot + CLIENT_TYPE.SpringBoot, + CLIENT_TYPE.Blank ], RESOURCE.SignalR: [ - CLIENT_TYPE.Dotnet + CLIENT_TYPE.Dotnet, + CLIENT_TYPE.Blank ], RESOURCE.ConfluentKafka: [ CLIENT_TYPE.Dotnet, CLIENT_TYPE.Java, CLIENT_TYPE.Python, CLIENT_TYPE.Go, - CLIENT_TYPE.SpringBoot + CLIENT_TYPE.SpringBoot, + CLIENT_TYPE.Blank ] }, RESOURCE.SpringCloud: { RESOURCE.Postgres: [ CLIENT_TYPE.Java, CLIENT_TYPE.SpringBoot, - CLIENT_TYPE.Dotnet + CLIENT_TYPE.Dotnet, + CLIENT_TYPE.Blank ], RESOURCE.PostgresFlexible: [ CLIENT_TYPE.Java, CLIENT_TYPE.SpringBoot, - CLIENT_TYPE.Dotnet + CLIENT_TYPE.Dotnet, + CLIENT_TYPE.Blank ], RESOURCE.Mysql: [ CLIENT_TYPE.Java, CLIENT_TYPE.SpringBoot, - CLIENT_TYPE.Dotnet + CLIENT_TYPE.Dotnet, + CLIENT_TYPE.Blank ], RESOURCE.MysqlFlexible: [ CLIENT_TYPE.Java, CLIENT_TYPE.SpringBoot, - CLIENT_TYPE.Dotnet + CLIENT_TYPE.Dotnet, + CLIENT_TYPE.Blank ], # RESOURCE.Sql: [ # CLIENT_TYPE.Java, # CLIENT_TYPE.SpringBoot, # CLIENT_TYPE.Dotnet + # CLIENT_TYPE.Blank # ], - # RESOURCE.Redis: [ - # CLIENT_TYPE.Java, - # CLIENT_TYPE.SpringBoot, - # CLIENT_TYPE.Dotnet - # ], - # RESOURCE.RedisEnterprise: [ - # CLIENT_TYPE.Java, - # CLIENT_TYPE.SpringBoot, - # CLIENT_TYPE.Dotnet - # ], + RESOURCE.Redis: [ + CLIENT_TYPE.Java, + CLIENT_TYPE.SpringBoot, + CLIENT_TYPE.Dotnet, + CLIENT_TYPE.Blank + ], + RESOURCE.RedisEnterprise: [ + CLIENT_TYPE.Java, + CLIENT_TYPE.SpringBoot, + CLIENT_TYPE.Dotnet, + CLIENT_TYPE.Blank + ], RESOURCE.CosmosCassandra: [ CLIENT_TYPE.Java, CLIENT_TYPE.SpringBoot, - CLIENT_TYPE.Dotnet + CLIENT_TYPE.Dotnet, + CLIENT_TYPE.Blank ], RESOURCE.CosmosGremlin: [ CLIENT_TYPE.Java, - CLIENT_TYPE.Dotnet + CLIENT_TYPE.Dotnet, + CLIENT_TYPE.Blank ], RESOURCE.CosmosMongo: [ CLIENT_TYPE.Java, CLIENT_TYPE.SpringBoot, - CLIENT_TYPE.Dotnet + CLIENT_TYPE.Dotnet, + CLIENT_TYPE.Blank ], RESOURCE.CosmosTable: [ CLIENT_TYPE.Java, CLIENT_TYPE.SpringBoot, - CLIENT_TYPE.Dotnet + CLIENT_TYPE.Dotnet, + CLIENT_TYPE.Blank ], RESOURCE.CosmosSql: [ CLIENT_TYPE.Java, - CLIENT_TYPE.Dotnet + CLIENT_TYPE.Dotnet, + CLIENT_TYPE.Blank ], RESOURCE.StorageBlob: [ CLIENT_TYPE.Java, CLIENT_TYPE.SpringBoot, - CLIENT_TYPE.Dotnet + CLIENT_TYPE.Dotnet, + CLIENT_TYPE.Blank ], RESOURCE.StorageQueue: [ CLIENT_TYPE.Java, CLIENT_TYPE.SpringBoot, - CLIENT_TYPE.Dotnet + CLIENT_TYPE.Dotnet, + CLIENT_TYPE.Blank ], RESOURCE.StorageFile: [ CLIENT_TYPE.Java, CLIENT_TYPE.SpringBoot, - CLIENT_TYPE.Dotnet + CLIENT_TYPE.Dotnet, + CLIENT_TYPE.Blank ], RESOURCE.StorageTable: [ CLIENT_TYPE.Java, - CLIENT_TYPE.Dotnet + CLIENT_TYPE.Dotnet, + CLIENT_TYPE.Blank ], RESOURCE.KeyVault: [ CLIENT_TYPE.Java, CLIENT_TYPE.SpringBoot, - CLIENT_TYPE.Dotnet + CLIENT_TYPE.Dotnet, + CLIENT_TYPE.Blank ], RESOURCE.AppConfig: [ CLIENT_TYPE.Java, - CLIENT_TYPE.Dotnet + CLIENT_TYPE.Dotnet, + CLIENT_TYPE.Blank ], RESOURCE.EventHub: [ CLIENT_TYPE.Java, CLIENT_TYPE.SpringBoot, - CLIENT_TYPE.Dotnet + CLIENT_TYPE.Dotnet, + CLIENT_TYPE.Blank ], RESOURCE.ServiceBus: [ CLIENT_TYPE.Java, CLIENT_TYPE.SpringBoot, - CLIENT_TYPE.Dotnet + CLIENT_TYPE.Dotnet, + CLIENT_TYPE.Blank ], RESOURCE.ConfluentKafka: [ CLIENT_TYPE.Java, CLIENT_TYPE.SpringBoot, - CLIENT_TYPE.Dotnet + CLIENT_TYPE.Dotnet, + CLIENT_TYPE.Blank ] } } +SUPPORTED_CLIENT_TYPE[RESOURCE.KubernetesCluster] = SUPPORTED_CLIENT_TYPE[RESOURCE.WebApp] diff --git a/src/azure-cli/azure/cli/command_modules/serviceconnector/_utils.py b/src/azure-cli/azure/cli/command_modules/serviceconnector/_utils.py index 593346a4ed6..e974a9aaa4e 100644 --- a/src/azure-cli/azure/cli/command_modules/serviceconnector/_utils.py +++ b/src/azure-cli/azure/cli/command_modules/serviceconnector/_utils.py @@ -212,7 +212,7 @@ def get_auth_if_no_valid_key_vault_connection(logger, source_name, source_id, ke client_id = None subscription_id = None - if len(key_vault_connections) > 0: + if key_vault_connections: from ._resource_config import RESOURCE from msrestazure.tools import ( is_valid_resource_id diff --git a/src/azure-cli/azure/cli/command_modules/serviceconnector/custom.py b/src/azure-cli/azure/cli/command_modules/serviceconnector/custom.py index dcdd723dbca..a75ffa756dc 100644 --- a/src/azure-cli/azure/cli/command_modules/serviceconnector/custom.py +++ b/src/azure-cli/azure/cli/command_modules/serviceconnector/custom.py @@ -38,8 +38,9 @@ def connection_list(client, source_resource_group=None, source_id=None, + cluster=None, site=None, - spring=None, app=None, deployment=None): + spring=None, app=None, deployment='default'): if not source_id: raise RequiredArgumentMissingError(err_msg.format('--source-id')) return auto_register(client.list, resource_uri=source_id) @@ -81,8 +82,9 @@ def connection_show(client, source_resource_group=None, source_id=None, indentifier=None, + cluster=None, site=None, - spring=None, app=None, deployment=None): + spring=None, app=None, deployment='default'): if not source_id or not connection_name: raise RequiredArgumentMissingError(err_msg.format('--source-id, --connection')) return auto_register(client.get, resource_uri=source_id, linker_name=connection_name) @@ -93,8 +95,9 @@ def connection_delete(client, source_resource_group=None, source_id=None, indentifier=None, + cluster=None, site=None, - spring=None, app=None, deployment=None, + spring=None, app=None, deployment='default', no_wait=False): if not source_id or not connection_name: raise RequiredArgumentMissingError(err_msg.format('--source-id, --connection')) @@ -110,8 +113,9 @@ def connection_list_configuration(client, source_resource_group=None, source_id=None, indentifier=None, + cluster=None, site=None, - spring=None, app=None, deployment=None): + spring=None, app=None, deployment='default'): if not source_id or not connection_name: raise RequiredArgumentMissingError(err_msg.format('--source-id, --connection')) return auto_register(client.list_configurations, @@ -124,8 +128,9 @@ def connection_validate(cmd, client, source_resource_group=None, source_id=None, indentifier=None, + cluster=None, site=None, - spring=None, app=None, deployment=None): + spring=None, app=None, deployment='default'): import re from ._validators import get_resource_regex @@ -153,8 +158,9 @@ def connection_create(cmd, client, # pylint: disable=too-many-locals service_principal_auth_info_secret=None, key_vault_id=None, new_addon=False, no_wait=False, + cluster=None, site=None, # Resource.WebApp - spring=None, app=None, deployment=None, # Resource.SpringCloud + spring=None, app=None, deployment='default', # Resource.SpringCloud server=None, database=None, # Resource.*Postgres, Resource.*Sql* vault=None, # Resource.KeyVault account=None, # Resource.Storage* @@ -236,8 +242,9 @@ def connection_update(cmd, client, service_principal_auth_info_secret=None, key_vault_id=None, no_wait=False, + cluster=None, site=None, # Resource.WebApp - deployment=None, + deployment='default', spring=None, app=None): # Resource.SpringCloud linker = todict(client.get(resource_uri=source_id, linker_name=connection_name)) @@ -312,8 +319,9 @@ def connection_create_kafka(cmd, client, # pylint: disable=too-many-locals client_type=None, source_resource_group=None, source_id=None, + cluster=None, site=None, # Resource.WebApp - deployment=None, + deployment='default', spring=None, app=None): # Resource.SpringCloud from ._transformers import transform_linker_properties @@ -388,8 +396,9 @@ def connection_update_kafka(cmd, client, # pylint: disable=too-many-locals client_type=None, source_resource_group=None, source_id=None, + cluster=None, site=None, # Resource.WebApp - deployment=None, + deployment='default', spring=None, app=None): # Resource.SpringCloud # use the suffix to decide the connection type diff --git a/src/azure-cli/azure/cli/command_modules/serviceconnector/tests/latest/recordings/test_webapp_redis_e2e.yaml b/src/azure-cli/azure/cli/command_modules/serviceconnector/tests/latest/recordings/test_webapp_redis_e2e.yaml new file mode 100644 index 00000000000..a5a3e8f0e69 --- /dev/null +++ b/src/azure-cli/azure/cli/command_modules/serviceconnector/tests/latest/recordings/test_webapp_redis_e2e.yaml @@ -0,0 +1,594 @@ +interactions: +- request: + body: '{"properties": {"targetId": "/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/servicelinker-test-linux-group/providers/Microsoft.Cache/redis/servicelinker-redis/databases/0", + "authInfo": {"authType": "secret"}, "clientType": "python"}}' + headers: + Accept: + - application/json + Accept-Encoding: + - gzip, deflate + CommandName: + - webapp connection create redis + Connection: + - keep-alive + Content-Length: + - '253' + Content-Type: + - application/json + ParameterSetName: + - --connection --source-id --target-id --secret --client-type + User-Agent: + - AZURECLI/2.34.1 azsdk-python-mgmt-servicelinker/1.0.0b1 Python/3.8.2 (Windows-10-10.0.19041-SP0) + method: PUT + uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/servicelinker-test-linux-group/providers/Microsoft.Web/sites/servicelinker-redis-app/providers/Microsoft.ServiceLinker/linkers/testconn?api-version=2021-11-01-preview + response: + body: + string: '{"id": "/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/servicelinker-test-linux-group/providers/Microsoft.Web/sites/servicelinker-redis-app/providers/Microsoft.ServiceLinker/linkers/testconn", + "name": "testconn", "type": "microsoft.servicelinker/linkers", "systemData": + {"createdBy": "honc@microsoft.com", "createdByType": "User", "createdAt": + "2022-03-23T02:39:00.6834758Z", "lastModifiedBy": "honc@microsoft.com", "lastModifiedByType": + "User", "lastModifiedAt": "2022-03-23T02:39:00.6834758Z"}, "properties": {"provisioningState": + "Accepted", "targetId": "/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/servicelinker-test-linux-group/providers/Microsoft.Cache/redis/servicelinker-redis/databases/0", + "authInfo": {"name": null, "secret": null, "authType": "secret"}, "vNetSolution": + null, "clientType": "python", "secretStore": null}}' + headers: + azure-asyncoperation: + - https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.ServiceLinker/locations/EASTUS/operationStatuses/14ae166d-8ed8-46d9-acb8-a71530782a0e*0E9755A8E9556B59F8C5A422A9FEF0EFC20F5D10D4E446CC359B248124F51533?api-version=2021-11-01-preview + cache-control: + - no-cache + content-length: + - '875' + content-type: + - application/json; charset=utf-8 + date: + - Wed, 23 Mar 2022 02:39:00 GMT + etag: + - '"6100bffb-0000-0400-0000-623a88450000"' + expires: + - '-1' + mise-correlation-id: + - 44834cb2-f129-404d-b424-c1639234e3c2 + pragma: + - no-cache + strict-transport-security: + - max-age=31536000; includeSubDomains + x-content-type-options: + - nosniff + x-ms-providerhub-traffic: + - 'True' + x-ms-ratelimit-remaining-subscription-writes: + - '1199' + status: + code: 201 + message: Created +- request: + body: null + headers: + Accept: + - '*/*' + Accept-Encoding: + - gzip, deflate + CommandName: + - webapp connection create redis + Connection: + - keep-alive + ParameterSetName: + - --connection --source-id --target-id --secret --client-type + User-Agent: + - AZURECLI/2.34.1 azsdk-python-mgmt-servicelinker/1.0.0b1 Python/3.8.2 (Windows-10-10.0.19041-SP0) + method: GET + uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.ServiceLinker/locations/EASTUS/operationStatuses/14ae166d-8ed8-46d9-acb8-a71530782a0e*0E9755A8E9556B59F8C5A422A9FEF0EFC20F5D10D4E446CC359B248124F51533?api-version=2021-11-01-preview + response: + body: + string: '{"id": "/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.ServiceLinker/locations/EASTUS/operationStatuses/14ae166d-8ed8-46d9-acb8-a71530782a0e*0E9755A8E9556B59F8C5A422A9FEF0EFC20F5D10D4E446CC359B248124F51533", + "name": "14ae166d-8ed8-46d9-acb8-a71530782a0e*0E9755A8E9556B59F8C5A422A9FEF0EFC20F5D10D4E446CC359B248124F51533", + "resourceId": "/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/servicelinker-test-linux-group/providers/Microsoft.Web/sites/servicelinker-redis-app/providers/Microsoft.ServiceLinker/linkers/testconn", + "status": "Succeeded", "startTime": "2022-03-23T02:39:01.5167163Z", "endTime": + "2022-03-23T02:39:06.840007Z", "properties": {"message": "Deny public network + access is set to yes. Please confirm you are using private endpoint connection + to access target resource."}}' + headers: + cache-control: + - no-cache + content-length: + - '831' + content-type: + - application/json; charset=utf-8 + date: + - Wed, 23 Mar 2022 02:39:32 GMT + etag: + - '"e3028bdd-0000-0200-0000-623a884a0000"' + expires: + - '-1' + pragma: + - no-cache + strict-transport-security: + - max-age=31536000; includeSubDomains + transfer-encoding: + - chunked + vary: + - Accept-Encoding + x-content-type-options: + - nosniff + status: + code: 200 + message: OK +- request: + body: null + headers: + Accept: + - '*/*' + Accept-Encoding: + - gzip, deflate + CommandName: + - webapp connection create redis + Connection: + - keep-alive + ParameterSetName: + - --connection --source-id --target-id --secret --client-type + User-Agent: + - AZURECLI/2.34.1 azsdk-python-mgmt-servicelinker/1.0.0b1 Python/3.8.2 (Windows-10-10.0.19041-SP0) + method: GET + uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/servicelinker-test-linux-group/providers/Microsoft.Web/sites/servicelinker-redis-app/providers/Microsoft.ServiceLinker/linkers/testconn?api-version=2021-11-01-preview + response: + body: + string: '{"id": "/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/servicelinker-test-linux-group/providers/Microsoft.Web/sites/servicelinker-redis-app/providers/Microsoft.ServiceLinker/linkers/testconn", + "name": "testconn", "type": "microsoft.servicelinker/linkers", "systemData": + {"createdBy": "honc@microsoft.com", "createdByType": "User", "createdAt": + "2022-03-23T02:39:00.6834758Z", "lastModifiedBy": "honc@microsoft.com", "lastModifiedByType": + "User", "lastModifiedAt": "2022-03-23T02:39:00.6834758Z"}, "properties": {"provisioningState": + "Succeeded", "targetId": "/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/servicelinker-test-linux-group/providers/Microsoft.Cache/redis/servicelinker-redis/databases/0", + "authInfo": {"authType": "secret"}, "clientType": "python"}}' + headers: + cache-control: + - no-cache + content-length: + - '803' + content-type: + - application/json; charset=utf-8 + date: + - Wed, 23 Mar 2022 02:39:32 GMT + etag: + - '"b1027ce0-0000-0200-0000-623a884a0000"' + expires: + - '-1' + pragma: + - no-cache + strict-transport-security: + - max-age=31536000; includeSubDomains + transfer-encoding: + - chunked + vary: + - Accept-Encoding + x-content-type-options: + - nosniff + x-ms-providerhub-traffic: + - 'True' + status: + code: 200 + message: OK +- request: + body: null + headers: + Accept: + - application/json + Accept-Encoding: + - gzip, deflate + CommandName: + - webapp connection list + Connection: + - keep-alive + ParameterSetName: + - --source-id + User-Agent: + - AZURECLI/2.34.1 azsdk-python-mgmt-servicelinker/1.0.0b1 Python/3.8.2 (Windows-10-10.0.19041-SP0) + method: GET + uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/servicelinker-test-linux-group/providers/Microsoft.Web/sites/servicelinker-redis-app/providers/Microsoft.ServiceLinker/linkers?api-version=2021-11-01-preview + response: + body: + string: '{"value": [{"id": "/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/servicelinker-test-linux-group/providers/Microsoft.Web/sites/servicelinker-redis-app/providers/Microsoft.ServiceLinker/linkers/testconn", + "name": "testconn", "type": "microsoft.servicelinker/linkers", "systemData": + {"createdBy": "honc@microsoft.com", "createdByType": "User", "createdAt": + "2022-03-23T02:39:00.6834758Z", "lastModifiedBy": "honc@microsoft.com", "lastModifiedByType": + "User", "lastModifiedAt": "2022-03-23T02:39:00.6834758Z"}, "properties": {"provisioningState": + "Succeeded", "targetId": "/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/servicelinker-test-linux-group/providers/Microsoft.Cache/redis/servicelinker-redis/databases/0", + "authInfo": {"authType": "secret"}, "clientType": "python"}}]}' + headers: + cache-control: + - no-cache + content-length: + - '816' + content-type: + - application/json; charset=utf-8 + date: + - Wed, 23 Mar 2022 02:39:36 GMT + expires: + - '-1' + pragma: + - no-cache + strict-transport-security: + - max-age=31536000; includeSubDomains + transfer-encoding: + - chunked + vary: + - Accept-Encoding + x-content-type-options: + - nosniff + x-ms-providerhub-traffic: + - 'True' + status: + code: 200 + message: OK +- request: + body: null + headers: + Accept: + - application/json + Accept-Encoding: + - gzip, deflate + CommandName: + - webapp connection list-configuration + Connection: + - keep-alive + Content-Length: + - '0' + ParameterSetName: + - --id + User-Agent: + - AZURECLI/2.34.1 azsdk-python-mgmt-servicelinker/1.0.0b1 Python/3.8.2 (Windows-10-10.0.19041-SP0) + method: POST + uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/servicelinker-test-linux-group/providers/Microsoft.Web/sites/servicelinker-redis-app/providers/Microsoft.ServiceLinker/linkers/testconn/listConfigurations?api-version=2021-11-01-preview + response: + body: + string: '{"configurations": [{"name": "AZURE_REDIS_CONNECTIONSTRING", "value": + "rediss://:99zNQ0GIZ7OkMbIvX34kemQ4yt7yy1PSn5HIG2ho0a0=@servicelinker-redis.redis.cache.windows.net:6380/0"}]}' + headers: + cache-control: + - no-cache + content-length: + - '180' + content-type: + - application/json; charset=utf-8 + date: + - Wed, 23 Mar 2022 02:39:37 GMT + expires: + - '-1' + mise-correlation-id: + - 49f66b37-cff5-4103-b333-bf60e2799926 + pragma: + - no-cache + strict-transport-security: + - max-age=31536000; includeSubDomains + transfer-encoding: + - chunked + vary: + - Accept-Encoding,Accept-Encoding + x-content-type-options: + - nosniff + x-ms-providerhub-traffic: + - 'True' + x-ms-ratelimit-remaining-subscription-writes: + - '1199' + status: + code: 200 + message: OK +- request: + body: null + headers: + Accept: + - application/json + Accept-Encoding: + - gzip, deflate + CommandName: + - webapp connection validate + Connection: + - keep-alive + ParameterSetName: + - --id + User-Agent: + - AZURECLI/2.34.1 azsdk-python-mgmt-servicelinker/1.0.0b1 Python/3.8.2 (Windows-10-10.0.19041-SP0) + method: GET + uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/servicelinker-test-linux-group/providers/Microsoft.Web/sites/servicelinker-redis-app/providers/Microsoft.ServiceLinker/linkers/testconn?api-version=2021-11-01-preview + response: + body: + string: '{"id": "/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/servicelinker-test-linux-group/providers/Microsoft.Web/sites/servicelinker-redis-app/providers/Microsoft.ServiceLinker/linkers/testconn", + "name": "testconn", "type": "microsoft.servicelinker/linkers", "systemData": + {"createdBy": "honc@microsoft.com", "createdByType": "User", "createdAt": + "2022-03-23T02:39:00.6834758Z", "lastModifiedBy": "honc@microsoft.com", "lastModifiedByType": + "User", "lastModifiedAt": "2022-03-23T02:39:00.6834758Z"}, "properties": {"provisioningState": + "Succeeded", "targetId": "/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/servicelinker-test-linux-group/providers/Microsoft.Cache/redis/servicelinker-redis/databases/0", + "authInfo": {"authType": "secret"}, "clientType": "python"}}' + headers: + cache-control: + - no-cache + content-length: + - '803' + content-type: + - application/json; charset=utf-8 + date: + - Wed, 23 Mar 2022 02:39:40 GMT + etag: + - '"b1027ce0-0000-0200-0000-623a884a0000"' + expires: + - '-1' + pragma: + - no-cache + strict-transport-security: + - max-age=31536000; includeSubDomains + transfer-encoding: + - chunked + vary: + - Accept-Encoding + x-content-type-options: + - nosniff + x-ms-providerhub-traffic: + - 'True' + status: + code: 200 + message: OK +- request: + body: null + headers: + Accept: + - application/json + Accept-Encoding: + - gzip, deflate + CommandName: + - webapp connection validate + Connection: + - keep-alive + Content-Length: + - '0' + ParameterSetName: + - --id + User-Agent: + - AZURECLI/2.34.1 azsdk-python-mgmt-servicelinker/1.0.0b1 Python/3.8.2 (Windows-10-10.0.19041-SP0) + method: POST + uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/servicelinker-test-linux-group/providers/Microsoft.Web/sites/servicelinker-redis-app/providers/Microsoft.ServiceLinker/linkers/testconn/validateLinker?api-version=2021-11-01-preview + response: + body: + string: 'null' + headers: + azure-asyncoperation: + - https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.ServiceLinker/locations/EASTUS/operationStatuses/4584550a-76bf-4a3a-af08-792640dcf56e*0E9755A8E9556B59F8C5A422A9FEF0EFC20F5D10D4E446CC359B248124F51533?api-version=2021-11-01-preview + cache-control: + - no-cache + content-length: + - '4' + content-type: + - application/json; charset=utf-8 + date: + - Wed, 23 Mar 2022 02:39:40 GMT + expires: + - '-1' + location: + - https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.ServiceLinker/locations/EASTUS/operationStatuses/4584550a-76bf-4a3a-af08-792640dcf56e*0E9755A8E9556B59F8C5A422A9FEF0EFC20F5D10D4E446CC359B248124F51533?api-version=2021-11-01-preview + mise-correlation-id: + - bd80b3b2-a6e8-43d5-a9e3-211ed8de7c1a + pragma: + - no-cache + strict-transport-security: + - max-age=31536000; includeSubDomains + x-content-type-options: + - nosniff + x-ms-providerhub-traffic: + - 'True' + x-ms-ratelimit-remaining-subscription-writes: + - '1199' + status: + code: 202 + message: Accepted +- request: + body: null + headers: + Accept: + - '*/*' + Accept-Encoding: + - gzip, deflate + CommandName: + - webapp connection validate + Connection: + - keep-alive + ParameterSetName: + - --id + User-Agent: + - AZURECLI/2.34.1 azsdk-python-mgmt-servicelinker/1.0.0b1 Python/3.8.2 (Windows-10-10.0.19041-SP0) + method: GET + uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.ServiceLinker/locations/EASTUS/operationStatuses/4584550a-76bf-4a3a-af08-792640dcf56e*0E9755A8E9556B59F8C5A422A9FEF0EFC20F5D10D4E446CC359B248124F51533?api-version=2021-11-01-preview + response: + body: + string: '{"id": "/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.ServiceLinker/locations/EASTUS/operationStatuses/4584550a-76bf-4a3a-af08-792640dcf56e*0E9755A8E9556B59F8C5A422A9FEF0EFC20F5D10D4E446CC359B248124F51533", + "name": "4584550a-76bf-4a3a-af08-792640dcf56e*0E9755A8E9556B59F8C5A422A9FEF0EFC20F5D10D4E446CC359B248124F51533", + "resourceId": "/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/servicelinker-test-linux-group/providers/Microsoft.Web/sites/servicelinker-redis-app/providers/Microsoft.ServiceLinker/linkers/testconn", + "status": "Succeeded", "startTime": "2022-03-23T02:39:40.5302089Z", "endTime": + "2022-03-23T02:39:42.6295549Z", "properties": {"message": "{\"ConnectionName\":\"testconn\",\"IsConnectionAvailable\":true,\"ValidationDetail\":[{\"Name\":\"The + target existence is validated\",\"Description\":null,\"Result\":0},{\"Name\":\"The + target''s network access is validated\",\"Description\":\"Deny public network + access is set to yes. Please confirm you are using private endpoint connection + to access target resource.\",\"Result\":2},{\"Name\":\"The configured values + is validated\",\"Description\":null,\"Result\":0}],\"ReportStartTimeUtc\":\"2022-03-23T02:39:41.7409203Z\",\"ReportEndTimeUtc\":\"2022-03-23T02:39:42.5697634Z\",\"SourceId\":null,\"TargetId\":\"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/servicelinker-test-linux-group/providers/Microsoft.Cache/redis/servicelinker-redis/databases/0\",\"AuthType\":4}"}}' + headers: + cache-control: + - no-cache + content-length: + - '1498' + content-type: + - application/json; charset=utf-8 + date: + - Wed, 23 Mar 2022 02:40:10 GMT + etag: + - '"e302d3de-0000-0200-0000-623a886e0000"' + expires: + - '-1' + pragma: + - no-cache + strict-transport-security: + - max-age=31536000; includeSubDomains + transfer-encoding: + - chunked + vary: + - Accept-Encoding + x-content-type-options: + - nosniff + status: + code: 200 + message: OK +- request: + body: null + headers: + Accept: + - application/json + Accept-Encoding: + - gzip, deflate + CommandName: + - webapp connection show + Connection: + - keep-alive + ParameterSetName: + - --id + User-Agent: + - AZURECLI/2.34.1 azsdk-python-mgmt-servicelinker/1.0.0b1 Python/3.8.2 (Windows-10-10.0.19041-SP0) + method: GET + uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/servicelinker-test-linux-group/providers/Microsoft.Web/sites/servicelinker-redis-app/providers/Microsoft.ServiceLinker/linkers/testconn?api-version=2021-11-01-preview + response: + body: + string: '{"id": "/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/servicelinker-test-linux-group/providers/Microsoft.Web/sites/servicelinker-redis-app/providers/Microsoft.ServiceLinker/linkers/testconn", + "name": "testconn", "type": "microsoft.servicelinker/linkers", "systemData": + {"createdBy": "honc@microsoft.com", "createdByType": "User", "createdAt": + "2022-03-23T02:39:00.6834758Z", "lastModifiedBy": "honc@microsoft.com", "lastModifiedByType": + "User", "lastModifiedAt": "2022-03-23T02:39:00.6834758Z"}, "properties": {"provisioningState": + "Succeeded", "targetId": "/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/servicelinker-test-linux-group/providers/Microsoft.Cache/redis/servicelinker-redis/databases/0", + "authInfo": {"authType": "secret"}, "clientType": "python"}}' + headers: + cache-control: + - no-cache + content-length: + - '803' + content-type: + - application/json; charset=utf-8 + date: + - Wed, 23 Mar 2022 02:40:11 GMT + etag: + - '"b1027ce0-0000-0200-0000-623a884a0000"' + expires: + - '-1' + pragma: + - no-cache + strict-transport-security: + - max-age=31536000; includeSubDomains + transfer-encoding: + - chunked + vary: + - Accept-Encoding + x-content-type-options: + - nosniff + x-ms-providerhub-traffic: + - 'True' + status: + code: 200 + message: OK +- request: + body: null + headers: + Accept: + - application/json + Accept-Encoding: + - gzip, deflate + CommandName: + - webapp connection delete + Connection: + - keep-alive + Content-Length: + - '0' + ParameterSetName: + - --id --yes + User-Agent: + - AZURECLI/2.34.1 azsdk-python-mgmt-servicelinker/1.0.0b1 Python/3.8.2 (Windows-10-10.0.19041-SP0) + method: DELETE + uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/servicelinker-test-linux-group/providers/Microsoft.Web/sites/servicelinker-redis-app/providers/Microsoft.ServiceLinker/linkers/testconn?api-version=2021-11-01-preview + response: + body: + string: 'null' + headers: + azure-asyncoperation: + - https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.ServiceLinker/locations/EASTUS/operationStatuses/fa94b70c-2bc2-40b3-b925-b214a59c9b77*0E9755A8E9556B59F8C5A422A9FEF0EFC20F5D10D4E446CC359B248124F51533?api-version=2021-11-01-preview + cache-control: + - no-cache + content-length: + - '4' + content-type: + - application/json; charset=utf-8 + date: + - Wed, 23 Mar 2022 02:40:17 GMT + etag: + - '"61008afe-0000-0400-0000-623a88910000"' + expires: + - '-1' + location: + - https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.ServiceLinker/locations/EASTUS/operationStatuses/fa94b70c-2bc2-40b3-b925-b214a59c9b77*0E9755A8E9556B59F8C5A422A9FEF0EFC20F5D10D4E446CC359B248124F51533?api-version=2021-11-01-preview + mise-correlation-id: + - 19f558ef-719d-4f81-864e-6c728a390652 + pragma: + - no-cache + strict-transport-security: + - max-age=31536000; includeSubDomains + x-content-type-options: + - nosniff + x-ms-providerhub-traffic: + - 'True' + x-ms-ratelimit-remaining-subscription-deletes: + - '14999' + status: + code: 202 + message: Accepted +- request: + body: null + headers: + Accept: + - '*/*' + Accept-Encoding: + - gzip, deflate + CommandName: + - webapp connection delete + Connection: + - keep-alive + ParameterSetName: + - --id --yes + User-Agent: + - AZURECLI/2.34.1 azsdk-python-mgmt-servicelinker/1.0.0b1 Python/3.8.2 (Windows-10-10.0.19041-SP0) + method: GET + uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.ServiceLinker/locations/EASTUS/operationStatuses/fa94b70c-2bc2-40b3-b925-b214a59c9b77*0E9755A8E9556B59F8C5A422A9FEF0EFC20F5D10D4E446CC359B248124F51533?api-version=2021-11-01-preview + response: + body: + string: '{"id": "/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.ServiceLinker/locations/EASTUS/operationStatuses/fa94b70c-2bc2-40b3-b925-b214a59c9b77*0E9755A8E9556B59F8C5A422A9FEF0EFC20F5D10D4E446CC359B248124F51533", + "name": "fa94b70c-2bc2-40b3-b925-b214a59c9b77*0E9755A8E9556B59F8C5A422A9FEF0EFC20F5D10D4E446CC359B248124F51533", + "resourceId": "/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/servicelinker-test-linux-group/providers/Microsoft.Web/sites/servicelinker-redis-app/providers/Microsoft.ServiceLinker/linkers/testconn", + "status": "Succeeded", "startTime": "2022-03-23T02:40:17.8512096Z", "endTime": + "2022-03-23T02:40:20.7907833Z", "properties": null}' + headers: + cache-control: + - no-cache + content-length: + - '696' + content-type: + - application/json; charset=utf-8 + date: + - Wed, 23 Mar 2022 02:40:48 GMT + etag: + - '"e3027ddf-0000-0200-0000-623a88940000"' + expires: + - '-1' + pragma: + - no-cache + strict-transport-security: + - max-age=31536000; includeSubDomains + transfer-encoding: + - chunked + vary: + - Accept-Encoding + x-content-type-options: + - nosniff + status: + code: 200 + message: OK +version: 1 diff --git a/src/azure-cli/azure/cli/command_modules/serviceconnector/tests/latest/recordings/test_webapp_redisenterprise_e2e.yaml b/src/azure-cli/azure/cli/command_modules/serviceconnector/tests/latest/recordings/test_webapp_redisenterprise_e2e.yaml new file mode 100644 index 00000000000..9876e82a5c8 --- /dev/null +++ b/src/azure-cli/azure/cli/command_modules/serviceconnector/tests/latest/recordings/test_webapp_redisenterprise_e2e.yaml @@ -0,0 +1,591 @@ +interactions: +- request: + body: '{"properties": {"targetId": "/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/servicelinker-test-linux-group/providers/Microsoft.Cache/redisEnterprise/servicelinker-redis-enterprise/databases/default", + "authInfo": {"authType": "secret"}, "clientType": "python"}}' + headers: + Accept: + - application/json + Accept-Encoding: + - gzip, deflate + CommandName: + - webapp connection create redis-enterprise + Connection: + - keep-alive + Content-Length: + - '280' + Content-Type: + - application/json + ParameterSetName: + - --connection --source-id --target-id --secret --client-type + User-Agent: + - AZURECLI/2.34.1 azsdk-python-mgmt-servicelinker/1.0.0b1 Python/3.8.2 (Windows-10-10.0.19041-SP0) + method: PUT + uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/servicelinker-test-linux-group/providers/Microsoft.Web/sites/servicelinker-redis-enterprise-app/providers/Microsoft.ServiceLinker/linkers/testconn?api-version=2021-11-01-preview + response: + body: + string: '{"id": "/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/servicelinker-test-linux-group/providers/Microsoft.Web/sites/servicelinker-redis-enterprise-app/providers/Microsoft.ServiceLinker/linkers/testconn", + "name": "testconn", "type": "microsoft.servicelinker/linkers", "systemData": + {"createdBy": "honc@microsoft.com", "createdByType": "User", "createdAt": + "2022-03-23T02:39:00.7800686Z", "lastModifiedBy": "honc@microsoft.com", "lastModifiedByType": + "User", "lastModifiedAt": "2022-03-23T02:39:00.7800686Z"}, "properties": {"provisioningState": + "Accepted", "targetId": "/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/servicelinker-test-linux-group/providers/Microsoft.Cache/redisEnterprise/servicelinker-redis-enterprise/databases/default", + "authInfo": {"name": null, "secret": null, "authType": "secret"}, "vNetSolution": + null, "clientType": "python", "secretStore": null}}' + headers: + azure-asyncoperation: + - https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.ServiceLinker/locations/EASTUS/operationStatuses/7a7ffaa9-c38c-4ff5-8a71-23de35c82e2f*E641C40111966C9CDA15DAA5AEFC7494CEFC89AEEFD9F7AE2FE3560C232ED94F?api-version=2021-11-01-preview + cache-control: + - no-cache + content-length: + - '913' + content-type: + - application/json; charset=utf-8 + date: + - Wed, 23 Mar 2022 02:39:01 GMT + etag: + - '"6100bdfb-0000-0400-0000-623a88450000"' + expires: + - '-1' + mise-correlation-id: + - 4644d162-5e9b-4222-807b-ac0168f31a29 + pragma: + - no-cache + strict-transport-security: + - max-age=31536000; includeSubDomains + x-content-type-options: + - nosniff + x-ms-providerhub-traffic: + - 'True' + x-ms-ratelimit-remaining-subscription-writes: + - '1199' + status: + code: 201 + message: Created +- request: + body: null + headers: + Accept: + - '*/*' + Accept-Encoding: + - gzip, deflate + CommandName: + - webapp connection create redis-enterprise + Connection: + - keep-alive + ParameterSetName: + - --connection --source-id --target-id --secret --client-type + User-Agent: + - AZURECLI/2.34.1 azsdk-python-mgmt-servicelinker/1.0.0b1 Python/3.8.2 (Windows-10-10.0.19041-SP0) + method: GET + uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.ServiceLinker/locations/EASTUS/operationStatuses/7a7ffaa9-c38c-4ff5-8a71-23de35c82e2f*E641C40111966C9CDA15DAA5AEFC7494CEFC89AEEFD9F7AE2FE3560C232ED94F?api-version=2021-11-01-preview + response: + body: + string: '{"id": "/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.ServiceLinker/locations/EASTUS/operationStatuses/7a7ffaa9-c38c-4ff5-8a71-23de35c82e2f*E641C40111966C9CDA15DAA5AEFC7494CEFC89AEEFD9F7AE2FE3560C232ED94F", + "name": "7a7ffaa9-c38c-4ff5-8a71-23de35c82e2f*E641C40111966C9CDA15DAA5AEFC7494CEFC89AEEFD9F7AE2FE3560C232ED94F", + "resourceId": "/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/servicelinker-test-linux-group/providers/Microsoft.Web/sites/servicelinker-redis-enterprise-app/providers/Microsoft.ServiceLinker/linkers/testconn", + "status": "Succeeded", "startTime": "2022-03-23T02:39:01.137283Z", "endTime": + "2022-03-23T02:39:06.5823081Z", "properties": {"message": "Unable to config + network connectivity for RedisEnterprise. Please confirm your app can connect + to RedisEnterprise successfully."}}' + headers: + cache-control: + - no-cache + content-length: + - '844' + content-type: + - application/json; charset=utf-8 + date: + - Wed, 23 Mar 2022 02:39:32 GMT + etag: + - '"e30288dd-0000-0200-0000-623a884a0000"' + expires: + - '-1' + pragma: + - no-cache + strict-transport-security: + - max-age=31536000; includeSubDomains + transfer-encoding: + - chunked + vary: + - Accept-Encoding + x-content-type-options: + - nosniff + status: + code: 200 + message: OK +- request: + body: null + headers: + Accept: + - '*/*' + Accept-Encoding: + - gzip, deflate + CommandName: + - webapp connection create redis-enterprise + Connection: + - keep-alive + ParameterSetName: + - --connection --source-id --target-id --secret --client-type + User-Agent: + - AZURECLI/2.34.1 azsdk-python-mgmt-servicelinker/1.0.0b1 Python/3.8.2 (Windows-10-10.0.19041-SP0) + method: GET + uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/servicelinker-test-linux-group/providers/Microsoft.Web/sites/servicelinker-redis-enterprise-app/providers/Microsoft.ServiceLinker/linkers/testconn?api-version=2021-11-01-preview + response: + body: + string: '{"id": "/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/servicelinker-test-linux-group/providers/Microsoft.Web/sites/servicelinker-redis-enterprise-app/providers/Microsoft.ServiceLinker/linkers/testconn", + "name": "testconn", "type": "microsoft.servicelinker/linkers", "systemData": + {"createdBy": "honc@microsoft.com", "createdByType": "User", "createdAt": + "2022-03-23T02:39:00.7800686Z", "lastModifiedBy": "honc@microsoft.com", "lastModifiedByType": + "User", "lastModifiedAt": "2022-03-23T02:39:00.7800686Z"}, "properties": {"provisioningState": + "Succeeded", "targetId": "/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/servicelinker-test-linux-group/providers/Microsoft.Cache/redisEnterprise/servicelinker-redis-enterprise/databases/default", + "authInfo": {"authType": "secret"}, "clientType": "python"}}' + headers: + cache-control: + - no-cache + content-length: + - '841' + content-type: + - application/json; charset=utf-8 + date: + - Wed, 23 Mar 2022 02:39:32 GMT + etag: + - '"b10273e0-0000-0200-0000-623a884a0000"' + expires: + - '-1' + pragma: + - no-cache + strict-transport-security: + - max-age=31536000; includeSubDomains + transfer-encoding: + - chunked + vary: + - Accept-Encoding + x-content-type-options: + - nosniff + x-ms-providerhub-traffic: + - 'True' + status: + code: 200 + message: OK +- request: + body: null + headers: + Accept: + - application/json + Accept-Encoding: + - gzip, deflate + CommandName: + - webapp connection list + Connection: + - keep-alive + ParameterSetName: + - --source-id + User-Agent: + - AZURECLI/2.34.1 azsdk-python-mgmt-servicelinker/1.0.0b1 Python/3.8.2 (Windows-10-10.0.19041-SP0) + method: GET + uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/servicelinker-test-linux-group/providers/Microsoft.Web/sites/servicelinker-redis-enterprise-app/providers/Microsoft.ServiceLinker/linkers?api-version=2021-11-01-preview + response: + body: + string: '{"value": [{"id": "/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/servicelinker-test-linux-group/providers/Microsoft.Web/sites/servicelinker-redis-enterprise-app/providers/Microsoft.ServiceLinker/linkers/testconn", + "name": "testconn", "type": "microsoft.servicelinker/linkers", "systemData": + {"createdBy": "honc@microsoft.com", "createdByType": "User", "createdAt": + "2022-03-23T02:39:00.7800686Z", "lastModifiedBy": "honc@microsoft.com", "lastModifiedByType": + "User", "lastModifiedAt": "2022-03-23T02:39:00.7800686Z"}, "properties": {"provisioningState": + "Succeeded", "targetId": "/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/servicelinker-test-linux-group/providers/Microsoft.Cache/redisEnterprise/servicelinker-redis-enterprise/databases/default", + "authInfo": {"authType": "secret"}, "clientType": "python"}}]}' + headers: + cache-control: + - no-cache + content-length: + - '854' + content-type: + - application/json; charset=utf-8 + date: + - Wed, 23 Mar 2022 02:39:37 GMT + expires: + - '-1' + pragma: + - no-cache + strict-transport-security: + - max-age=31536000; includeSubDomains + transfer-encoding: + - chunked + vary: + - Accept-Encoding + x-content-type-options: + - nosniff + x-ms-providerhub-traffic: + - 'True' + status: + code: 200 + message: OK +- request: + body: null + headers: + Accept: + - application/json + Accept-Encoding: + - gzip, deflate + CommandName: + - webapp connection list-configuration + Connection: + - keep-alive + Content-Length: + - '0' + ParameterSetName: + - --id + User-Agent: + - AZURECLI/2.34.1 azsdk-python-mgmt-servicelinker/1.0.0b1 Python/3.8.2 (Windows-10-10.0.19041-SP0) + method: POST + uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/servicelinker-test-linux-group/providers/Microsoft.Web/sites/servicelinker-redis-enterprise-app/providers/Microsoft.ServiceLinker/linkers/testconn/listConfigurations?api-version=2021-11-01-preview + response: + body: + string: '{"configurations": [{"name": "AZURE_REDIS_CONNECTIONSTRING", "value": + "rediss://:oRF9wBeIj9Ip753URoU9Is2xQYiEzKAXntFKa9upLvI=@servicelinker-redis-enterprise.eastus.redisenterprise.cache.azure.net:10000/0"}]}' + headers: + cache-control: + - no-cache + content-length: + - '207' + content-type: + - application/json; charset=utf-8 + date: + - Wed, 23 Mar 2022 02:39:39 GMT + expires: + - '-1' + mise-correlation-id: + - 23d285a3-f4cb-46b0-a2be-906c6c02a90d + pragma: + - no-cache + strict-transport-security: + - max-age=31536000; includeSubDomains + transfer-encoding: + - chunked + vary: + - Accept-Encoding,Accept-Encoding + x-content-type-options: + - nosniff + x-ms-providerhub-traffic: + - 'True' + x-ms-ratelimit-remaining-subscription-writes: + - '1199' + status: + code: 200 + message: OK +- request: + body: null + headers: + Accept: + - application/json + Accept-Encoding: + - gzip, deflate + CommandName: + - webapp connection validate + Connection: + - keep-alive + ParameterSetName: + - --id + User-Agent: + - AZURECLI/2.34.1 azsdk-python-mgmt-servicelinker/1.0.0b1 Python/3.8.2 (Windows-10-10.0.19041-SP0) + method: GET + uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/servicelinker-test-linux-group/providers/Microsoft.Web/sites/servicelinker-redis-enterprise-app/providers/Microsoft.ServiceLinker/linkers/testconn?api-version=2021-11-01-preview + response: + body: + string: '{"id": "/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/servicelinker-test-linux-group/providers/Microsoft.Web/sites/servicelinker-redis-enterprise-app/providers/Microsoft.ServiceLinker/linkers/testconn", + "name": "testconn", "type": "microsoft.servicelinker/linkers", "systemData": + {"createdBy": "honc@microsoft.com", "createdByType": "User", "createdAt": + "2022-03-23T02:39:00.7800686Z", "lastModifiedBy": "honc@microsoft.com", "lastModifiedByType": + "User", "lastModifiedAt": "2022-03-23T02:39:00.7800686Z"}, "properties": {"provisioningState": + "Succeeded", "targetId": "/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/servicelinker-test-linux-group/providers/Microsoft.Cache/redisEnterprise/servicelinker-redis-enterprise/databases/default", + "authInfo": {"authType": "secret"}, "clientType": "python"}}' + headers: + cache-control: + - no-cache + content-length: + - '841' + content-type: + - application/json; charset=utf-8 + date: + - Wed, 23 Mar 2022 02:39:40 GMT + etag: + - '"b10273e0-0000-0200-0000-623a884a0000"' + expires: + - '-1' + pragma: + - no-cache + strict-transport-security: + - max-age=31536000; includeSubDomains + transfer-encoding: + - chunked + vary: + - Accept-Encoding + x-content-type-options: + - nosniff + x-ms-providerhub-traffic: + - 'True' + status: + code: 200 + message: OK +- request: + body: null + headers: + Accept: + - application/json + Accept-Encoding: + - gzip, deflate + CommandName: + - webapp connection validate + Connection: + - keep-alive + Content-Length: + - '0' + ParameterSetName: + - --id + User-Agent: + - AZURECLI/2.34.1 azsdk-python-mgmt-servicelinker/1.0.0b1 Python/3.8.2 (Windows-10-10.0.19041-SP0) + method: POST + uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/servicelinker-test-linux-group/providers/Microsoft.Web/sites/servicelinker-redis-enterprise-app/providers/Microsoft.ServiceLinker/linkers/testconn/validateLinker?api-version=2021-11-01-preview + response: + body: + string: 'null' + headers: + azure-asyncoperation: + - https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.ServiceLinker/locations/EASTUS/operationStatuses/8018b15c-17a5-45b6-85ac-25f47965aaaa*E641C40111966C9CDA15DAA5AEFC7494CEFC89AEEFD9F7AE2FE3560C232ED94F?api-version=2021-11-01-preview + cache-control: + - no-cache + content-length: + - '4' + content-type: + - application/json; charset=utf-8 + date: + - Wed, 23 Mar 2022 02:39:40 GMT + expires: + - '-1' + location: + - https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.ServiceLinker/locations/EASTUS/operationStatuses/8018b15c-17a5-45b6-85ac-25f47965aaaa*E641C40111966C9CDA15DAA5AEFC7494CEFC89AEEFD9F7AE2FE3560C232ED94F?api-version=2021-11-01-preview + mise-correlation-id: + - 208b4084-d08e-4f25-ab3c-8578a0e9ec13 + pragma: + - no-cache + strict-transport-security: + - max-age=31536000; includeSubDomains + x-content-type-options: + - nosniff + x-ms-providerhub-traffic: + - 'True' + x-ms-ratelimit-remaining-subscription-writes: + - '1199' + status: + code: 202 + message: Accepted +- request: + body: null + headers: + Accept: + - '*/*' + Accept-Encoding: + - gzip, deflate + CommandName: + - webapp connection validate + Connection: + - keep-alive + ParameterSetName: + - --id + User-Agent: + - AZURECLI/2.34.1 azsdk-python-mgmt-servicelinker/1.0.0b1 Python/3.8.2 (Windows-10-10.0.19041-SP0) + method: GET + uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.ServiceLinker/locations/EASTUS/operationStatuses/8018b15c-17a5-45b6-85ac-25f47965aaaa*E641C40111966C9CDA15DAA5AEFC7494CEFC89AEEFD9F7AE2FE3560C232ED94F?api-version=2021-11-01-preview + response: + body: + string: '{"id": "/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.ServiceLinker/locations/EASTUS/operationStatuses/8018b15c-17a5-45b6-85ac-25f47965aaaa*E641C40111966C9CDA15DAA5AEFC7494CEFC89AEEFD9F7AE2FE3560C232ED94F", + "name": "8018b15c-17a5-45b6-85ac-25f47965aaaa*E641C40111966C9CDA15DAA5AEFC7494CEFC89AEEFD9F7AE2FE3560C232ED94F", + "resourceId": "/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/servicelinker-test-linux-group/providers/Microsoft.Web/sites/servicelinker-redis-enterprise-app/providers/Microsoft.ServiceLinker/linkers/testconn", + "status": "Succeeded", "startTime": "2022-03-23T02:39:41.4806584Z", "endTime": + "2022-03-23T02:39:43.5632364Z", "properties": {"message": "{\"ConnectionName\":\"testconn\",\"IsConnectionAvailable\":true,\"ValidationDetail\":[{\"Name\":\"The + target existence is validated\",\"Description\":null,\"Result\":0},{\"Name\":\"The + configured values is validated\",\"Description\":null,\"Result\":0}],\"ReportStartTimeUtc\":\"2022-03-23T02:39:42.74885Z\",\"ReportEndTimeUtc\":\"2022-03-23T02:39:43.5048181Z\",\"SourceId\":null,\"TargetId\":\"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/servicelinker-test-linux-group/providers/Microsoft.Cache/redisEnterprise/servicelinker-redis-enterprise/databases/default\",\"AuthType\":4}"}}' + headers: + cache-control: + - no-cache + content-length: + - '1319' + content-type: + - application/json; charset=utf-8 + date: + - Wed, 23 Mar 2022 02:40:17 GMT + etag: + - '"e302d9de-0000-0200-0000-623a886f0000"' + expires: + - '-1' + pragma: + - no-cache + strict-transport-security: + - max-age=31536000; includeSubDomains + transfer-encoding: + - chunked + vary: + - Accept-Encoding + x-content-type-options: + - nosniff + status: + code: 200 + message: OK +- request: + body: null + headers: + Accept: + - application/json + Accept-Encoding: + - gzip, deflate + CommandName: + - webapp connection show + Connection: + - keep-alive + ParameterSetName: + - --id + User-Agent: + - AZURECLI/2.34.1 azsdk-python-mgmt-servicelinker/1.0.0b1 Python/3.8.2 (Windows-10-10.0.19041-SP0) + method: GET + uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/servicelinker-test-linux-group/providers/Microsoft.Web/sites/servicelinker-redis-enterprise-app/providers/Microsoft.ServiceLinker/linkers/testconn?api-version=2021-11-01-preview + response: + body: + string: '{"id": "/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/servicelinker-test-linux-group/providers/Microsoft.Web/sites/servicelinker-redis-enterprise-app/providers/Microsoft.ServiceLinker/linkers/testconn", + "name": "testconn", "type": "microsoft.servicelinker/linkers", "systemData": + {"createdBy": "honc@microsoft.com", "createdByType": "User", "createdAt": + "2022-03-23T02:39:00.7800686Z", "lastModifiedBy": "honc@microsoft.com", "lastModifiedByType": + "User", "lastModifiedAt": "2022-03-23T02:39:00.7800686Z"}, "properties": {"provisioningState": + "Succeeded", "targetId": "/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/servicelinker-test-linux-group/providers/Microsoft.Cache/redisEnterprise/servicelinker-redis-enterprise/databases/default", + "authInfo": {"authType": "secret"}, "clientType": "python"}}' + headers: + cache-control: + - no-cache + content-length: + - '841' + content-type: + - application/json; charset=utf-8 + date: + - Wed, 23 Mar 2022 02:40:18 GMT + etag: + - '"b10273e0-0000-0200-0000-623a884a0000"' + expires: + - '-1' + pragma: + - no-cache + strict-transport-security: + - max-age=31536000; includeSubDomains + transfer-encoding: + - chunked + vary: + - Accept-Encoding + x-content-type-options: + - nosniff + x-ms-providerhub-traffic: + - 'True' + status: + code: 200 + message: OK +- request: + body: null + headers: + Accept: + - application/json + Accept-Encoding: + - gzip, deflate + CommandName: + - webapp connection delete + Connection: + - keep-alive + Content-Length: + - '0' + ParameterSetName: + - --id --yes + User-Agent: + - AZURECLI/2.34.1 azsdk-python-mgmt-servicelinker/1.0.0b1 Python/3.8.2 (Windows-10-10.0.19041-SP0) + method: DELETE + uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/servicelinker-test-linux-group/providers/Microsoft.Web/sites/servicelinker-redis-enterprise-app/providers/Microsoft.ServiceLinker/linkers/testconn?api-version=2021-11-01-preview + response: + body: + string: 'null' + headers: + azure-asyncoperation: + - https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.ServiceLinker/locations/EASTUS/operationStatuses/18329926-85bc-439a-af34-028d03466491*E641C40111966C9CDA15DAA5AEFC7494CEFC89AEEFD9F7AE2FE3560C232ED94F?api-version=2021-11-01-preview + cache-control: + - no-cache + content-length: + - '4' + content-type: + - application/json; charset=utf-8 + date: + - Wed, 23 Mar 2022 02:40:23 GMT + etag: + - '"6100a6fe-0000-0400-0000-623a88980000"' + expires: + - '-1' + location: + - https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.ServiceLinker/locations/EASTUS/operationStatuses/18329926-85bc-439a-af34-028d03466491*E641C40111966C9CDA15DAA5AEFC7494CEFC89AEEFD9F7AE2FE3560C232ED94F?api-version=2021-11-01-preview + mise-correlation-id: + - fddcd8cf-2592-4541-b028-8f32f9be6f0e + pragma: + - no-cache + strict-transport-security: + - max-age=31536000; includeSubDomains + x-content-type-options: + - nosniff + x-ms-providerhub-traffic: + - 'True' + x-ms-ratelimit-remaining-subscription-deletes: + - '14999' + status: + code: 202 + message: Accepted +- request: + body: null + headers: + Accept: + - '*/*' + Accept-Encoding: + - gzip, deflate + CommandName: + - webapp connection delete + Connection: + - keep-alive + ParameterSetName: + - --id --yes + User-Agent: + - AZURECLI/2.34.1 azsdk-python-mgmt-servicelinker/1.0.0b1 Python/3.8.2 (Windows-10-10.0.19041-SP0) + method: GET + uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.ServiceLinker/locations/EASTUS/operationStatuses/18329926-85bc-439a-af34-028d03466491*E641C40111966C9CDA15DAA5AEFC7494CEFC89AEEFD9F7AE2FE3560C232ED94F?api-version=2021-11-01-preview + response: + body: + string: '{"id": "/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.ServiceLinker/locations/EASTUS/operationStatuses/18329926-85bc-439a-af34-028d03466491*E641C40111966C9CDA15DAA5AEFC7494CEFC89AEEFD9F7AE2FE3560C232ED94F", + "name": "18329926-85bc-439a-af34-028d03466491*E641C40111966C9CDA15DAA5AEFC7494CEFC89AEEFD9F7AE2FE3560C232ED94F", + "resourceId": "/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/servicelinker-test-linux-group/providers/Microsoft.Web/sites/servicelinker-redis-enterprise-app/providers/Microsoft.ServiceLinker/linkers/testconn", + "status": "Succeeded", "startTime": "2022-03-23T02:40:24.2596151Z", "endTime": + "2022-03-23T02:40:27.7016382Z", "properties": null}' + headers: + cache-control: + - no-cache + content-length: + - '707' + content-type: + - application/json; charset=utf-8 + date: + - Wed, 23 Mar 2022 02:40:55 GMT + etag: + - '"e302a1df-0000-0200-0000-623a889b0000"' + expires: + - '-1' + pragma: + - no-cache + strict-transport-security: + - max-age=31536000; includeSubDomains + transfer-encoding: + - chunked + vary: + - Accept-Encoding + x-content-type-options: + - nosniff + status: + code: 200 + message: OK +version: 1 diff --git a/src/azure-cli/azure/cli/command_modules/serviceconnector/tests/latest/test_springcloud_connection_scenario_withoutId.py b/src/azure-cli/azure/cli/command_modules/serviceconnector/tests/latest/test_springcloud_connection_scenario_withoutId.py deleted file mode 100644 index 1ede5741985..00000000000 --- a/src/azure-cli/azure/cli/command_modules/serviceconnector/tests/latest/test_springcloud_connection_scenario_withoutId.py +++ /dev/null @@ -1,838 +0,0 @@ -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for -# license information. -# -------------------------------------------------------------------------- - -import unittest - -from azure.cli.core.commands.client_factory import get_subscription_id -from azure.cli.testsdk import ( - ScenarioTest, - record_only -) -from azure.cli.testsdk.scenario_tests import RecordingProcessor -from azure.cli.testsdk.scenario_tests.utilities import is_text_payload -from azure.cli.command_modules.serviceconnector._resource_config import ( - RESOURCE, - SOURCE_RESOURCES, - TARGET_RESOURCES -) - - -class CredentialReplacer(RecordingProcessor): - - def recursive_hide(self, props): - # hide sensitive data recursively - fake_content = 'hidden' - sensitive_data = ['password=', 'key='] - - if isinstance(props, dict): - for key, val in props.items(): - props[key] = self.recursive_hide(val) - elif isinstance(props, list): - for index, val in enumerate(props): - props[index] = self.recursive_hide(val) - elif isinstance(props, str): - for data in sensitive_data: - if data in props.lower(): - props = fake_content - - return props - - def process_request(self, request): - import json - - # hide secrets in request body - if is_text_payload(request) and request.body and json.loads(request.body): - body = self.recursive_hide(json.loads(request.body)) - request.body = json.dumps(body) - - # hide token in header - if 'x-ms-cupertino-test-token' in request.headers: - request.headers['x-ms-cupertino-test-token'] = 'hidden' - - return request - - def process_response(self, response): - import json - - if is_text_payload(response) and response['body']['string']: - try: - body = json.loads(response['body']['string']) - body = self.recursive_hide(body) - response['body']['string'] = json.dumps(body) - except Exception: - pass - - return response - - -@unittest.skip('Need spring-cloud extension installed') -class SpringCloudConnectionWithoutIdScenarioTest(ScenarioTest): - - def __init__(self, method_name): - super(SpringCloudConnectionWithoutIdScenarioTest, self).__init__( - method_name, - recording_processors=[CredentialReplacer()] - ) - - # @record_only - def test_springcloud_appconfig_e2e(self): - self.kwargs.update({ - 'name' : 'testconn5', - 'subscription': get_subscription_id(self.cli_ctx), - 'source_resource_group': 'servicelinker-test-linux-group', - 'target_resource_group': 'servicelinker-test-linux-group', - 'spring': 'servicelinker-springcloud', - 'app': 'appconfiguration', - 'deployment': 'default', - 'config_store': 'servicelinker-app-configuration' - }) - - # create connection - self.cmd('spring-cloud connection create appconfig --connection {name} -g {source_resource_group} --service {spring} --app {app} --deployment {deployment} ' - '--tg {target_resource_group} --app-config {config_store} --system-identity --client-type java') - - # list connection - connections = self.cmd( - 'spring-cloud connection list -g {source_resource_group} --service {spring} --app {app} --deployment {deployment} ', - checks = [ - # self.check('length(@)', 1), - self.check('[0].authInfo.authType', 'systemAssignedIdentity'), - self.check('[0].clientType', 'java') - ] - ).get_output_in_json() - connection_id = connections[0].get('id') - - # list configuration - self.cmd('spring-cloud connection list-configuration --connection {name} -g {source_resource_group} --service {spring} --app {app} --deployment {deployment}') - - # validate connection - self.cmd('spring-cloud connection validate --connection {name} -g {source_resource_group} --service {spring} --app {app} --deployment {deployment}') - - # show connection - self.cmd('spring-cloud connection show --connection {name} -g {source_resource_group} --service {spring} --app {app} --deployment {deployment}') - - # delete connection - self.cmd('spring-cloud connection delete --connection {name} -g {source_resource_group} --service {spring} --app {app} --deployment {deployment} --yes') - - - # @record_only - def test_springcloud_cosmoscassandra_e2e(self): - self.kwargs.update({ - 'name' : 'testconn3', - 'subscription': get_subscription_id(self.cli_ctx), - 'source_resource_group': 'servicelinker-test-linux-group', - 'target_resource_group': 'servicelinker-test-win-group', - 'spring': 'servicelinker-springcloud', - 'app': 'cosmoscassandra', - 'deployment': 'default', - 'account': 'servicelinker-cassandra-cosmos', - 'key_space': 'coredb' - }) - - - # create connection - self.cmd('spring-cloud connection create cosmos-cassandra --connection {name} -g {source_resource_group} --service {spring} --app {app} --deployment {deployment} ' - '--tg {target_resource_group} --account {account} --key-space {key_space} --system-identity --client-type java') - - # list connection - connections = self.cmd( - 'spring-cloud connection list -g {source_resource_group} --service {spring} --app {app} --deployment {deployment}', - checks = [ - # self.check('length(@)', 1), - self.check('[0].authInfo.authType', 'systemAssignedIdentity'), - self.check('[0].clientType', 'java') - ] - ).get_output_in_json() - connection_id = connections[0].get('id') - - # list configuration - self.cmd('spring-cloud connection list-configuration --connection {name} -g {source_resource_group} --service {spring} --app {app} --deployment {deployment}') - - # validate connection - self.cmd('spring-cloud connection validate --connection {name} -g {source_resource_group} --service {spring} --app {app} --deployment {deployment}') - - # show connection - self.cmd('spring-cloud connection show --connection {name} -g {source_resource_group} --service {spring} --app {app} --deployment {deployment}') - - # delete connection - self.cmd('spring-cloud connection delete --connection {name} -g {source_resource_group} --service {spring} --app {app} --deployment {deployment} --yes') - - - # @record_only - def test_springcloud_cosmosgremlin_e2e(self): - self.kwargs.update({ - 'name' : 'testconn3', - 'subscription': get_subscription_id(self.cli_ctx), - 'source_resource_group': 'servicelinker-test-linux-group', - 'target_resource_group': 'servicelinker-test-win-group', - 'spring': 'servicelinker-springcloud', - 'app': 'cosmosgremlin', - 'deployment': 'default', - 'account': 'servicelinker-gremlin-cosmos', - 'database': 'coreDB', - 'graph': 'MyItem' - }) - - - # create connection - self.cmd('spring-cloud connection create cosmos-gremlin --connection {name} -g {source_resource_group} --service {spring} --app {app} --deployment {deployment} ' - '--tg {target_resource_group} --account {account} --database {database} --graph {graph} --system-identity --client-type java') - - # list connection - connections = self.cmd( - 'spring-cloud connection list -g {source_resource_group} --service {spring} --app {app} --deployment {deployment}', - checks = [ - # self.check('length(@)', 1), - self.check('[0].authInfo.authType', 'systemAssignedIdentity'), - self.check('[0].clientType', 'java') - ] - ).get_output_in_json() - connection_id = connections[0].get('id') - - # list configuration - self.cmd('spring-cloud connection list-configuration --connection {name} -g {source_resource_group} --service {spring} --app {app} --deployment {deployment}') - - # validate connection - self.cmd('spring-cloud connection validate --connection {name} -g {source_resource_group} --service {spring} --app {app} --deployment {deployment}') - - # show connection - self.cmd('spring-cloud connection show --connection {name} -g {source_resource_group} --service {spring} --app {app} --deployment {deployment}') - - # delete connection - self.cmd('spring-cloud connection delete --connection {name} -g {source_resource_group} --service {spring} --app {app} --deployment {deployment} --yes') - - - # @record_only - def test_springcloud_cosmosmongo_e2e(self): - self.kwargs.update({ - 'name' : 'testconn3', - 'subscription': get_subscription_id(self.cli_ctx), - 'source_resource_group': 'servicelinker-test-linux-group', - 'target_resource_group': 'servicelinker-test-win-group', - 'spring': 'servicelinker-springcloud', - 'app': 'cosmosmongo', - 'deployment': 'default', - 'account': 'servicelinker-mongo-cosmos', - 'database': 'coreDB' - }) - - - # create connection - self.cmd('spring-cloud connection create cosmos-mongo --connection {name} -g {source_resource_group} --service {spring} --app {app} --deployment {deployment} ' - '--tg {target_resource_group} --account {account} --database {database} --system-identity --client-type java') - - # list connection - connections = self.cmd( - 'spring-cloud connection list -g {source_resource_group} --service {spring} --app {app} --deployment {deployment}', - checks = [ - # self.check('length(@)', 1), - self.check('[0].authInfo.authType', 'systemAssignedIdentity'), - self.check('[0].clientType', 'java') - ] - ).get_output_in_json() - connection_id = connections[0].get('id') - - # list configuration - self.cmd('spring-cloud connection list-configuration --connection {name} -g {source_resource_group} --service {spring} --app {app} --deployment {deployment}') - - # validate connection - self.cmd('spring-cloud connection validate --connection {name} -g {source_resource_group} --service {spring} --app {app} --deployment {deployment}') - - # show connection - self.cmd('spring-cloud connection show --connection {name} -g {source_resource_group} --service {spring} --app {app} --deployment {deployment}') - - # delete connection - self.cmd('spring-cloud connection delete --connection {name} -g {source_resource_group} --service {spring} --app {app} --deployment {deployment} --yes') - - - # @record_only - def test_springcloud_cosmossql_e2e(self): - self.kwargs.update({ - 'name' : 'testconn3', - 'subscription': get_subscription_id(self.cli_ctx), - 'source_resource_group': 'servicelinker-test-linux-group', - 'target_resource_group': 'servicelinker-test-win-group', - 'spring': 'servicelinker-springcloud', - 'app': 'cosmossql', - 'deployment': 'default', - 'account': 'servicelinker-sql-cosmos', - 'database': 'coreDB' - }) - - - # create connection - self.cmd('spring-cloud connection create cosmos-sql --connection {name} -g {source_resource_group} --service {spring} --app {app} --deployment {deployment} ' - '--tg {target_resource_group} --account {account} --database {database} --system-identity --client-type java') - - # list connection - connections = self.cmd( - 'spring-cloud connection list -g {source_resource_group} --service {spring} --app {app} --deployment {deployment}', - checks = [ - # self.check('length(@)', 1), - self.check('[0].authInfo.authType', 'systemAssignedIdentity'), - self.check('[0].clientType', 'java') - ] - ).get_output_in_json() - connection_id = connections[0].get('id') - - # list configuration - self.cmd('spring-cloud connection list-configuration --connection {name} -g {source_resource_group} --service {spring} --app {app} --deployment {deployment}') - - # validate connection - self.cmd('spring-cloud connection validate --connection {name} -g {source_resource_group} --service {spring} --app {app} --deployment {deployment}') - - # show connection - self.cmd('spring-cloud connection show --connection {name} -g {source_resource_group} --service {spring} --app {app} --deployment {deployment}') - - # delete connection - self.cmd('spring-cloud connection delete --connection {name} -g {source_resource_group} --service {spring} --app {app} --deployment {deployment} --yes') - - - # @record_only - def test_springcloud_cosmostable_e2e(self): - self.kwargs.update({ - 'name' : 'testconn3', - 'subscription': get_subscription_id(self.cli_ctx), - 'source_resource_group': 'servicelinker-test-linux-group', - 'target_resource_group': 'servicelinker-test-win-group', - 'spring': 'servicelinker-springcloud', - 'app': 'cosmostable', - 'deployment': 'default', - 'account': 'servicelinker-table-cosmos', - 'table': 'MyItem' - }) - - - # create connection - self.cmd('spring-cloud connection create cosmos-table --connection {name} -g {source_resource_group} --service {spring} --app {app} --deployment {deployment} ' - '--tg {target_resource_group} --account {account} --table {table} --system-identity --client-type java') - - # list connection - connections = self.cmd( - 'spring-cloud connection list -g {source_resource_group} --service {spring} --app {app} --deployment {deployment}', - checks = [ - # self.check('length(@)', 1), - self.check('[0].authInfo.authType', 'systemAssignedIdentity'), - self.check('[0].clientType', 'java') - ] - ).get_output_in_json() - connection_id = connections[0].get('id') - - # list configuration - self.cmd('spring-cloud connection list-configuration --connection {name} -g {source_resource_group} --service {spring} --app {app} --deployment {deployment}') - - # validate connection - self.cmd('spring-cloud connection validate --connection {name} -g {source_resource_group} --service {spring} --app {app} --deployment {deployment}') - - # show connection - self.cmd('spring-cloud connection show --connection {name} -g {source_resource_group} --service {spring} --app {app} --deployment {deployment}') - - # delete connection - self.cmd('spring-cloud connection delete --connection {name} -g {source_resource_group} --service {spring} --app {app} --deployment {deployment} --yes') - - - # @record_only - def test_springcloud_eventhub_e2e(self): - self.kwargs.update({ - 'name' : 'testconn3', - 'subscription': get_subscription_id(self.cli_ctx), - 'source_resource_group': 'servicelinker-test-linux-group', - 'target_resource_group': 'servicelinker-test-linux-group', - 'spring': 'servicelinker-springcloud', - 'app': 'eventhub', - 'deployment': 'default', - 'namespace': 'servicelinkertesteventhub' - }) - - - # create connection - self.cmd('spring-cloud connection create eventhub --connection {name} -g {source_resource_group} --service {spring} --app {app} --deployment {deployment} ' - '--tg {target_resource_group} --namespace {namespace} --system-identity --client-type java') - - # list connection - connections = self.cmd( - 'spring-cloud connection list -g {source_resource_group} --service {spring} --app {app} --deployment {deployment}', - checks = [ - # self.check('length(@)', 1), - self.check('[0].authInfo.authType', 'systemAssignedIdentity'), - self.check('[0].clientType', 'java') - ] - ).get_output_in_json() - connection_id = connections[0].get('id') - - # list configuration - self.cmd('spring-cloud connection list-configuration --connection {name} -g {source_resource_group} --service {spring} --app {app} --deployment {deployment}') - - # validate connection - self.cmd('spring-cloud connection validate --connection {name} -g {source_resource_group} --service {spring} --app {app} --deployment {deployment}') - - # show connection - self.cmd('spring-cloud connection show --connection {name} -g {source_resource_group} --service {spring} --app {app} --deployment {deployment}') - - # delete connection - self.cmd('spring-cloud connection delete --connection {name} -g {source_resource_group} --service {spring} --app {app} --deployment {deployment} --yes') - - - # @record_only - def test_springcloud_postgresflexible_e2e(self): - self.kwargs.update({ - 'name' : 'testconn3', - 'subscription': get_subscription_id(self.cli_ctx), - 'source_resource_group': 'servicelinker-test-linux-group', - 'target_resource_group': 'servicelinker-test-linux-group', - 'spring': 'servicelinker-springcloud', - 'app': 'postgresflexible', - 'deployment': 'default', - 'server': 'servicelinker-flexiblepostgresql', - 'database': 'postgres', - 'user': 'servicelinker', - }) - - # prepare password - password = self.cmd('keyvault secret show --vault-name cupertino-kv-test -n TestDbPassword')\ - .get_output_in_json().get('value') - - self.kwargs.update({'password': password}) - - - # create connection - self.cmd('spring-cloud connection create postgres-flexible --connection {name} -g {source_resource_group} --service {spring} --app {app} --deployment {deployment} ' - '--tg {target_resource_group} --server {server} --database {database} --secret name={user} secret={password} --client-type java') - - # list connection - connections = self.cmd( - 'spring-cloud connection list -g {source_resource_group} --service {spring} --app {app} --deployment {deployment}', - checks = [ - # self.check('length(@)', 1), - self.check('[0].authInfo.authType', 'secret'), - self.check('[0].clientType', 'java') - ] - ).get_output_in_json() - connection_id = connections[0].get('id') - - # list configuration - self.cmd('spring-cloud connection list-configuration --connection {name} -g {source_resource_group} --service {spring} --app {app} --deployment {deployment}') - - # validate connection - self.cmd('spring-cloud connection validate --connection {name} -g {source_resource_group} --service {spring} --app {app} --deployment {deployment}') - - # show connection - self.cmd('spring-cloud connection show --connection {name} -g {source_resource_group} --service {spring} --app {app} --deployment {deployment}') - - # delete connection - self.cmd('spring-cloud connection delete --connection {name} -g {source_resource_group} --service {spring} --app {app} --deployment {deployment} --yes') - - - # @record_only - def test_springcloud_keyvault_e2e(self): - self.kwargs.update({ - 'name' : 'testconn3', - 'subscription': get_subscription_id(self.cli_ctx), - 'source_resource_group': 'servicelinker-test-linux-group', - 'target_resource_group': 'servicelinker-test-linux-group', - 'spring': 'servicelinker-springcloud', - 'app': 'keyvaultmi', - 'deployment': 'default', - 'vault': 'servicelinker-test-kv' - }) - - - # create connection - self.cmd('spring-cloud connection create keyvault --connection {name} -g {source_resource_group} --service {spring} --app {app} --deployment {deployment} ' - '--tg {target_resource_group} --vault {vault} --system-identity --client-type java') - - # list connection - connections = self.cmd( - 'spring-cloud connection list -g {source_resource_group} --service {spring} --app {app} --deployment {deployment}', - checks = [ - # self.check('length(@)', 1), - self.check('[0].authInfo.authType', 'systemAssignedIdentity'), - self.check('[0].clientType', 'java') - ] - ).get_output_in_json() - connection_id = connections[0].get('id') - - # list configuration - self.cmd('spring-cloud connection list-configuration --connection {name} -g {source_resource_group} --service {spring} --app {app} --deployment {deployment}') - - # validate connection - self.cmd('spring-cloud connection validate --connection {name} -g {source_resource_group} --service {spring} --app {app} --deployment {deployment}') - - # show connection - self.cmd('spring-cloud connection show --connection {name} -g {source_resource_group} --service {spring} --app {app} --deployment {deployment}') - - # delete connection - self.cmd('spring-cloud connection delete --connection {name} -g {source_resource_group} --service {spring} --app {app} --deployment {deployment} --yes') - - - # @record_only - def test_springcloud_mysql_e2e(self): - self.kwargs.update({ - 'name' : 'testconn3', - 'subscription': get_subscription_id(self.cli_ctx), - 'source_resource_group': 'servicelinker-test-linux-group', - 'target_resource_group': 'servicelinker-test-linux-group', - 'spring': 'servicelinker-springcloud', - 'app': 'mysql', - 'deployment': 'default', - 'server': 'servicelinker-mysql', - 'database': 'mysqlDB', - 'user': 'servicelinker', - }) - - # prepare password - password = self.cmd('keyvault secret show --vault-name cupertino-kv-test -n TestDbPassword')\ - .get_output_in_json().get('value') - self.kwargs.update({'password': password}) - - - # create connection - self.cmd('spring-cloud connection create mysql --connection {name} -g {source_resource_group} --service {spring} --app {app} --deployment {deployment} ' - '--tg {target_resource_group} --server {server} --database {database} --secret name={user} secret={password} --client-type java') - - # list connection - connections = self.cmd( - 'spring-cloud connection list -g {source_resource_group} --service {spring} --app {app} --deployment {deployment}', - checks = [ - # self.check('length(@)', 1), - self.check('[0].authInfo.authType', 'secret'), - self.check('[0].clientType', 'java') - ] - ).get_output_in_json() - connection_id = connections[0].get('id') - - # list configuration - self.cmd('spring-cloud connection list-configuration --connection {name} -g {source_resource_group} --service {spring} --app {app} --deployment {deployment}') - - # validate connection - self.cmd('spring-cloud connection validate --connection {name} -g {source_resource_group} --service {spring} --app {app} --deployment {deployment}') - - # show connection - self.cmd('spring-cloud connection show --connection {name} -g {source_resource_group} --service {spring} --app {app} --deployment {deployment}') - - # delete connection - self.cmd('spring-cloud connection delete --connection {name} -g {source_resource_group} --service {spring} --app {app} --deployment {deployment} --yes') - - - # @record_only - def test_springcloud_mysqlflexible_e2e(self): - self.kwargs.update({ - 'name' : 'testconn3', - 'subscription': get_subscription_id(self.cli_ctx), - 'source_resource_group': 'servicelinker-test-linux-group', - 'target_resource_group': 'servicelinker-test-linux-group', - 'spring': 'servicelinker-springcloud', - 'app': 'mysqlflexible', - 'deployment': 'default', - 'server': 'servicelinker-flexible-mysql', - 'database': 'mysqlDB' - }) - - # prepare password - user = 'servicelinker' - password = self.cmd('keyvault secret show --vault-name cupertino-kv-test -n TestDbPassword')\ - .get_output_in_json().get('value') - self.kwargs.update({ - 'user': user, - 'password': password - }) - - - # create connection - self.cmd('spring-cloud connection create mysql-flexible --connection {name} -g {source_resource_group} --service {spring} --app {app} --deployment {deployment} ' - '--tg {target_resource_group} --server {server} --database {database} --secret name={user} secret={password} --client-type java') - - # list connection - connections = self.cmd( - 'spring-cloud connection list -g {source_resource_group} --service {spring} --app {app} --deployment {deployment}', - checks = [ - # self.check('length(@)', 1), - self.check('[0].authInfo.authType', 'secret'), - self.check('[0].clientType', 'java') - ] - ).get_output_in_json() - connection_id = connections[0].get('id') - - # list configuration - self.cmd('spring-cloud connection list-configuration --connection {name} -g {source_resource_group} --service {spring} --app {app} --deployment {deployment}') - - # validate connection - self.cmd('spring-cloud connection validate --connection {name} -g {source_resource_group} --service {spring} --app {app} --deployment {deployment}') - - # show connection - self.cmd('spring-cloud connection show --connection {name} -g {source_resource_group} --service {spring} --app {app} --deployment {deployment}') - - # delete connection - self.cmd('spring-cloud connection delete --connection {name} -g {source_resource_group} --service {spring} --app {app} --deployment {deployment} --yes') - - - # @record_only - def test_springcloud_postgres_e2e(self): - self.kwargs.update({ - 'name' : 'testconn3', - 'subscription': get_subscription_id(self.cli_ctx), - 'source_resource_group': 'servicelinker-test-linux-group', - 'target_resource_group': 'servicelinker-test-linux-group', - 'spring': 'servicelinker-springcloud', - 'app': 'postgresql', - 'deployment': 'default', - 'server': 'servicelinker-postgresql', - 'database': 'postgres' - }) - - # prepare password - user = 'servicelinker' - password = self.cmd('keyvault secret show --vault-name cupertino-kv-test -n TestDbPassword')\ - .get_output_in_json().get('value') - self.kwargs.update({ - 'user': user, - 'password': password - }) - - - # create connection - self.cmd('spring-cloud connection create postgres --connection {name} -g {source_resource_group} --service {spring} --app {app} --deployment {deployment} ' - '--tg {target_resource_group} --server {server} --database {database} --secret name={user} secret={password} --client-type java') - - # list connection - connections = self.cmd( - 'spring-cloud connection list -g {source_resource_group} --service {spring} --app {app} --deployment {deployment}', - checks = [ - # self.check('length(@)', 1), - self.check('[0].authInfo.authType', 'secret'), - self.check('[0].clientType', 'java') - ] - ).get_output_in_json() - connection_id = connections[0].get('id') - - # list configuration - self.cmd('spring-cloud connection list-configuration --connection {name} -g {source_resource_group} --service {spring} --app {app} --deployment {deployment}') - - # validate connection - self.cmd('spring-cloud connection validate --connection {name} -g {source_resource_group} --service {spring} --app {app} --deployment {deployment}') - - # show connection - self.cmd('spring-cloud connection show --connection {name} -g {source_resource_group} --service {spring} --app {app} --deployment {deployment}') - - # delete connection - self.cmd('spring-cloud connection delete --connection {name} -g {source_resource_group} --service {spring} --app {app} --deployment {deployment} --yes') - - - # @record_only - @unittest.skip('') - def test_springcloud_sql_e2e(self): - self.kwargs.update({ - 'name' : 'testconn3', - 'subscription': get_subscription_id(self.cli_ctx), - 'source_resource_group': 'servicelinker-test-linux-group', - 'target_resource_group': 'servicelinker-test-linux-group', - 'spring': 'servicelinker-springcloud', - 'app': 'sqldb', - 'deployment': 'default', - 'server': 'servicelinker-sql', - 'database': 'handler-test' - }) - - # prepare password - user = 'servicelinker' - password = self.cmd('keyvault secret show --vault-name cupertino-kv-test -n TestDbPassword')\ - .get_output_in_json().get('value') - self.kwargs.update({ - 'user': user, - 'password': password - }) - - # create connection - self.cmd('spring-cloud connection create sql --connection {name} -g {source_resource_group} --service {spring} --app {app} --deployment {deployment} ' - '--tg {target_resource_group} --server {server} --database {database} --secret name={user} secret={password} --client-type java') - - # list connection - connections = self.cmd( - 'spring-cloud connection list -g {source_resource_group} --service {spring} --app {app} --deployment {deployment}', - checks = [ - # self.check('length(@)', 1), - self.check('[0].authInfo.authType', 'secret'), - self.check('[0].clientType', 'java') - ] - ).get_output_in_json() - connection_id = connections[0].get('id') - - # list configuration - self.cmd('spring-cloud connection list-configuration --connection {name} -g {source_resource_group} --service {spring} --app {app} --deployment {deployment}') - - # validate connection - self.cmd('spring-cloud connection validate --connection {name} -g {source_resource_group} --service {spring} --app {app} --deployment {deployment}') - - # show connection - self.cmd('spring-cloud connection show --connection {name} -g {source_resource_group} --service {spring} --app {app} --deployment {deployment}') - - # delete connection - self.cmd('spring-cloud connection delete --connection {name} -g {source_resource_group} --service {spring} --app {app} --deployment {deployment} --yes') - - - # @record_only - def test_springcloud_storageblob_e2e(self): - self.kwargs.update({ - 'name' : 'testconn3', - 'subscription': get_subscription_id(self.cli_ctx), - 'source_resource_group': 'servicelinker-test-linux-group', - 'target_resource_group': 'servicelinker-test-linux-group', - 'spring': 'servicelinker-springcloud', - 'app': 'storageblob', - 'deployment': 'default', - 'account': 'servicelinkerteststorage' - }) - - # create connection - self.cmd('spring-cloud connection create storage-blob --connection {name} -g {source_resource_group} --service {spring} --app {app} --deployment {deployment} ' - '--tg {target_resource_group} --account {account} --system-identity --client-type java') - - # list connection - connections = self.cmd( - 'spring-cloud connection list -g {source_resource_group} --service {spring} --app {app} --deployment {deployment}', - checks = [ - # self.check('length(@)', 1), - self.check('[0].authInfo.authType', 'systemAssignedIdentity'), - self.check('[0].clientType', 'java') - ] - ).get_output_in_json() - connection_id = connections[0].get('id') - - # list configuration - self.cmd('spring-cloud connection list-configuration --connection {name} -g {source_resource_group} --service {spring} --app {app} --deployment {deployment}') - - # validate connection - self.cmd('spring-cloud connection validate --connection {name} -g {source_resource_group} --service {spring} --app {app} --deployment {deployment}') - - # show connection - self.cmd('spring-cloud connection show --connection {name} -g {source_resource_group} --service {spring} --app {app} --deployment {deployment}') - - # delete connection - self.cmd('spring-cloud connection delete --connection {name} -g {source_resource_group} --service {spring} --app {app} --deployment {deployment} --yes') - - - # @record_only - def test_springcloud_storagequeue_e2e(self): - self.kwargs.update({ - 'name' : 'testconn3', - 'subscription': get_subscription_id(self.cli_ctx), - 'source_resource_group': 'servicelinker-test-linux-group', - 'target_resource_group': 'servicelinker-test-linux-group', - 'spring': 'servicelinker-springcloud', - 'app': 'storagequeue', - 'deployment': 'default', - 'account': 'servicelinkerteststorage' - }) - - # create connection - self.cmd('spring-cloud connection create storage-queue --connection {name} -g {source_resource_group} --service {spring} --app {app} --deployment {deployment} ' - '--tg {target_resource_group} --account {account} --secret --client-type java') - - # list connection - connections = self.cmd( - 'spring-cloud connection list -g {source_resource_group} --service {spring} --app {app} --deployment {deployment}', - checks = [ - # self.check('length(@)', 1), - self.check('[0].authInfo.authType', 'secret'), - self.check('[0].clientType', 'java') - ] - ).get_output_in_json() - connection_id = connections[0].get('id') - - # list configuration - self.cmd('spring-cloud connection list-configuration --connection {name} -g {source_resource_group} --service {spring} --app {app} --deployment {deployment}') - - # validate connection - self.cmd('spring-cloud connection validate --connection {name} -g {source_resource_group} --service {spring} --app {app} --deployment {deployment}') - - # show connection - self.cmd('spring-cloud connection show --connection {name} -g {source_resource_group} --service {spring} --app {app} --deployment {deployment}') - - # delete connection - self.cmd('spring-cloud connection delete --connection {name} -g {source_resource_group} --service {spring} --app {app} --deployment {deployment} --yes') - - - # @record_only - def test_springcloud_storagefile_e2e(self): - self.kwargs.update({ - 'name' : 'testconn3', - 'subscription': get_subscription_id(self.cli_ctx), - 'source_resource_group': 'servicelinker-test-linux-group', - 'target_resource_group': 'servicelinker-test-linux-group', - 'spring': 'servicelinker-springcloud', - 'app': 'storagefile', - 'deployment': 'default', - 'account': 'servicelinkerteststorage' - }) - - # create connection - self.cmd('spring-cloud connection create storage-file --connection {name} -g {source_resource_group} --service {spring} --app {app} --deployment {deployment} ' - '--tg {target_resource_group} --account {account} --secret --client-type java') - - # list connection - connections = self.cmd( - 'spring-cloud connection list -g {source_resource_group} --service {spring} --app {app} --deployment {deployment}', - checks = [ - # self.check('length(@)', 1), - self.check('[0].authInfo.authType', 'secret'), - self.check('[0].clientType', 'java') - ] - ).get_output_in_json() - connection_id = connections[0].get('id') - - # list configuration - self.cmd('spring-cloud connection list-configuration --connection {name} -g {source_resource_group} --service {spring} --app {app} --deployment {deployment}') - - # validate connection - self.cmd('spring-cloud connection validate --connection {name} -g {source_resource_group} --service {spring} --app {app} --deployment {deployment}') - - # show connection - self.cmd('spring-cloud connection show --connection {name} -g {source_resource_group} --service {spring} --app {app} --deployment {deployment}') - - # delete connection - self.cmd('spring-cloud connection delete --connection {name} -g {source_resource_group} --service {spring} --app {app} --deployment {deployment} --yes') - - - # @record_only - def test_springcloud_storagetable_e2e(self): - self.kwargs.update({ - 'name' : 'testconn3', - 'subscription': get_subscription_id(self.cli_ctx), - 'source_resource_group': 'servicelinker-test-linux-group', - 'target_resource_group': 'servicelinker-test-linux-group', - 'spring': 'servicelinker-springcloud', - 'app': 'storagetable', - 'deployment': 'default', - 'account': 'servicelinkerteststorage' - }) - - - # create connection - self.cmd('spring-cloud connection create storage-table --connection {name} -g {source_resource_group} --service {spring} --app {app} --deployment {deployment} ' - '--tg {target_resource_group} --account {account} --secret --client-type java') - - # list connection - connections = self.cmd( - 'spring-cloud connection list -g {source_resource_group} --service {spring} --app {app} --deployment {deployment}', - checks = [ - # self.check('length(@)', 1), - self.check('[0].authInfo.authType', 'secret'), - self.check('[0].clientType', 'java') - ] - ).get_output_in_json() - connection_id = connections[0].get('id') - - # list configuration - self.cmd('spring-cloud connection list-configuration --connection {name} -g {source_resource_group} --service {spring} --app {app} --deployment {deployment}') - - # validate connection - self.cmd('spring-cloud connection validate --connection {name} -g {source_resource_group} --service {spring} --app {app} --deployment {deployment}') - - # show connection - self.cmd('spring-cloud connection show --connection {name} -g {source_resource_group} --service {spring} --app {app} --deployment {deployment}') - - # delete connection - self.cmd('spring-cloud connection delete --connection {name} -g {source_resource_group} --service {spring} --app {app} --deployment {deployment} --yes') diff --git a/src/azure-cli/azure/cli/command_modules/serviceconnector/tests/latest/test_webpp_connection_scenario.py b/src/azure-cli/azure/cli/command_modules/serviceconnector/tests/latest/test_webpp_connection_scenario.py index 745f1931840..5a0e300903c 100644 --- a/src/azure-cli/azure/cli/command_modules/serviceconnector/tests/latest/test_webpp_connection_scenario.py +++ b/src/azure-cli/azure/cli/command_modules/serviceconnector/tests/latest/test_webpp_connection_scenario.py @@ -564,7 +564,6 @@ def test_webapp_postgresflexible_e2e(self): @record_only() - @unittest.skip('Temporarily removed from supported target resources') def test_webapp_redis_e2e(self): self.kwargs.update({ 'subscription': get_subscription_id(self.cli_ctx), @@ -609,7 +608,6 @@ def test_webapp_redis_e2e(self): @record_only() - @unittest.skip('Temporarily removed from supported target resources') def test_webapp_redisenterprise_e2e(self): self.kwargs.update({ 'subscription': get_subscription_id(self.cli_ctx), diff --git a/src/azure-cli/azure/cli/command_modules/serviceconnector/tests/latest/test_webpp_connection_scenario_withoutId.py b/src/azure-cli/azure/cli/command_modules/serviceconnector/tests/latest/test_webpp_connection_scenario_withoutId.py deleted file mode 100644 index 2a820a26655..00000000000 --- a/src/azure-cli/azure/cli/command_modules/serviceconnector/tests/latest/test_webpp_connection_scenario_withoutId.py +++ /dev/null @@ -1,878 +0,0 @@ -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for -# license information. -# -------------------------------------------------------------------------- - -import unittest -from azure.cli.core.commands.client_factory import get_subscription_id -from azure.cli.testsdk import ( - ScenarioTest, - record_only -) -from azure.cli.testsdk.scenario_tests import RecordingProcessor -from azure.cli.testsdk.scenario_tests.utilities import is_text_payload -from azure.cli.command_modules.serviceconnector._resource_config import ( - RESOURCE, - SOURCE_RESOURCES, - TARGET_RESOURCES -) - - -class CredentialReplacer(RecordingProcessor): - - def recursive_hide(self, props): - # hide sensitive data recursively - fake_content = 'hidden' - sensitive_data = ['password=', 'key='] - - if isinstance(props, dict): - for key, val in props.items(): - props[key] = self.recursive_hide(val) - elif isinstance(props, list): - for index, val in enumerate(props): - props[index] = self.recursive_hide(val) - elif isinstance(props, str): - for data in sensitive_data: - if data in props.lower(): - props = fake_content - - return props - - def process_request(self, request): - import json - - # hide secrets in request body - if is_text_payload(request) and request.body and json.loads(request.body): - body = self.recursive_hide(json.loads(request.body)) - request.body = json.dumps(body) - - # hide token in header - if 'x-ms-cupertino-test-token' in request.headers: - request.headers['x-ms-cupertino-test-token'] = 'hidden' - - return request - - def process_response(self, response): - import json - - if is_text_payload(response) and response['body']['string']: - try: - body = json.loads(response['body']['string']) - body = self.recursive_hide(body) - response['body']['string'] = json.dumps(body) - except Exception: - pass - - return response - -@unittest.skip('') -class WebAppConnectionWithoutIdScenarioTest(ScenarioTest): - - def __init__(self, method_name): - super(WebAppConnectionWithoutIdScenarioTest, self).__init__( - method_name, - recording_processors=[CredentialReplacer()] - ) - - # @record_only() - def test_webapp_appconfig_e2e(self): - self.kwargs.update({ - 'name': 'testconn1', - 'subscription': get_subscription_id(self.cli_ctx), - 'source_resource_group': 'servicelinker-test-linux-group', - 'target_resource_group': 'servicelinker-test-linux-group', - 'site': 'servicelinker-config-app', - 'config_store': 'servicelinker-app-configuration' - }) - - # prepare params - name = 'testconn' - - target_id = TARGET_RESOURCES.get(RESOURCE.AppConfig).format(**self.kwargs) - - # create connection - self.cmd('webapp connection create appconfig --connection {name} -g {source_resource_group} -n {site} ' - '--tg {target_resource_group} --app-config {config_store} --system-identity --client-type python') - - # list connection - connections = self.cmd( - 'webapp connection list -g {source_resource_group} -n {site}', - checks = [ - self.check('length(@)', 1), - self.check('[0].authInfo.authType', 'systemAssignedIdentity'), - self.check('[0].clientType', 'python') - ] - ).get_output_in_json() - connection_id = connections[0].get('id') - - # list configuration - self.cmd('webapp connection list-configuration --connection {name} -g {source_resource_group} -n {site}') - - # validate connection - self.cmd('webapp connection validate --connection {name} -g {source_resource_group} -n {site}') - - # show connection - self.cmd('webapp connection show --connection {name} -g {source_resource_group} -n {site}') - - # delete connection - self.cmd('webapp connection delete --id {} --yes'.format(connection_id)) - - - # @record_only() - def test_webapp_cosmoscassandra_e2e(self): - self.kwargs.update({ - 'name': 'testconn1', - 'subscription': get_subscription_id(self.cli_ctx), - 'source_resource_group': 'servicelinker-test-win-group', - 'target_resource_group': 'servicelinker-test-win-group', - 'site': 'servicelinker-cassandra-cosmos-asp-app', - 'account': 'servicelinker-cassandra-cosmos', - 'key_space': 'coredb' - }) - - # prepare params - name = 'testconn' - - target_id = TARGET_RESOURCES.get(RESOURCE.CosmosCassandra).format(**self.kwargs) - - # create connection - self.cmd('webapp connection create cosmos-cassandra --connection {name} -g {source_resource_group} -n {site} ' - '--tg {target_resource_group} --account {account} --key-space {key_space} --system-identity --client-type python') - - # list connection - connections = self.cmd( - 'webapp connection list -g {source_resource_group} -n {site}', - checks = [ - self.check('length(@)', 1), - self.check('[0].authInfo.authType', 'systemAssignedIdentity'), - self.check('[0].clientType', 'python') - ] - ).get_output_in_json() - connection_id = connections[0].get('id') - - # list configuration - self.cmd('webapp connection list-configuration --connection {name} -g {source_resource_group} -n {site}') - - # validate connection - self.cmd('webapp connection validate --connection {name} -g {source_resource_group} -n {site}') - - # show connection - self.cmd('webapp connection show --connection {name} -g {source_resource_group} -n {site}') - - # delete connection - self.cmd('webapp connection delete --id {} --yes'.format(connection_id)) - - - # @record_only() - def test_webapp_cosmosgremlin_e2e(self): - self.kwargs.update({ - 'name': 'testconn1', - 'subscription': get_subscription_id(self.cli_ctx), - 'source_resource_group': 'servicelinker-test-win-group', - 'target_resource_group': 'servicelinker-test-win-group', - 'site': 'servicelinker-gremlin-cosmos-asp-app', - 'account': 'servicelinker-gremlin-cosmos', - 'database': 'coreDB', - 'graph': 'MyItem' - }) - - # prepare params - name = 'testconn' - - target_id = TARGET_RESOURCES.get(RESOURCE.CosmosGremlin).format(**self.kwargs) - - # create connection - self.cmd('webapp connection create cosmos-gremlin --connection {name} -g {source_resource_group} -n {site} ' - '--tg {target_resource_group} --account {account} --database {database} --graph {graph} --system-identity --client-type python') - - # list connection - connections = self.cmd( - 'webapp connection list -g {source_resource_group} -n {site}', - checks = [ - self.check('length(@)', 1), - self.check('[0].authInfo.authType', 'systemAssignedIdentity'), - self.check('[0].clientType', 'python') - ] - ).get_output_in_json() - connection_id = connections[0].get('id') - - # list configuration - self.cmd('webapp connection list-configuration --connection {name} -g {source_resource_group} -n {site}') - - # validate connection - self.cmd('webapp connection validate --connection {name} -g {source_resource_group} -n {site}') - - # show connection - self.cmd('webapp connection show --connection {name} -g {source_resource_group} -n {site}') - - # delete connection - self.cmd('webapp connection delete --id {} --yes'.format(connection_id)) - - - # @record_only() - def test_webapp_cosmosmongo_e2e(self): - self.kwargs.update({ - 'name': 'testconn1', - 'subscription': get_subscription_id(self.cli_ctx), - 'source_resource_group': 'servicelinker-test-win-group', - 'target_resource_group': 'servicelinker-test-win-group', - 'site': 'servicelinker-mongo-cosmos-asp-app', - 'account': 'servicelinker-mongo-cosmos', - 'database': 'coreDB' - }) - - # prepare params - name = 'testconn' - - target_id = TARGET_RESOURCES.get(RESOURCE.CosmosMongo).format(**self.kwargs) - - # create connection - self.cmd('webapp connection create cosmos-mongo --connection {name} -g {source_resource_group} -n {site} ' - '--tg {target_resource_group} --account {account} --database {database} --system-identity --client-type dotnet') - - # list connection - connections = self.cmd( - 'webapp connection list -g {source_resource_group} -n {site}', - checks = [ - self.check('length(@)', 1), - self.check('[0].authInfo.authType', 'systemAssignedIdentity'), - self.check('[0].clientType', 'dotnet') - ] - ).get_output_in_json() - connection_id = connections[0].get('id') - - # list configuration - self.cmd('webapp connection list-configuration --connection {name} -g {source_resource_group} -n {site}') - - # validate connection - self.cmd('webapp connection validate --connection {name} -g {source_resource_group} -n {site}') - - # show connection - self.cmd('webapp connection show --connection {name} -g {source_resource_group} -n {site}') - - # delete connection - self.cmd('webapp connection delete --id {} --yes'.format(connection_id)) - - - # @record_only() - def test_webapp_cosmossql_e2e(self): - self.kwargs.update({ - 'name': 'testconn1', - 'subscription': get_subscription_id(self.cli_ctx), - 'source_resource_group': 'servicelinker-test-win-group', - 'target_resource_group': 'servicelinker-test-win-group', - 'site': 'servicelinker-sql-cosmos-asp-app', - 'account': 'servicelinker-sql-cosmos', - 'database': 'coreDB' - }) - - # prepare params - name = 'testconn' - - target_id = TARGET_RESOURCES.get(RESOURCE.CosmosSql).format(**self.kwargs) - - # create connection - self.cmd('webapp connection create cosmos-sql --connection {name} -g {source_resource_group} -n {site} ' - '--tg {target_resource_group} --account {account} --database {database} --system-identity --client-type python') - - # list connection - connections = self.cmd( - 'webapp connection list -g {source_resource_group} -n {site}', - checks = [ - self.check('length(@)', 1), - self.check('[0].authInfo.authType', 'systemAssignedIdentity'), - self.check('[0].clientType', 'python') - ] - ).get_output_in_json() - connection_id = connections[0].get('id') - - # list configuration - self.cmd('webapp connection list-configuration --connection {name} -g {source_resource_group} -n {site}') - - # validate connection - self.cmd('webapp connection validate --connection {name} -g {source_resource_group} -n {site}') - - # show connection - self.cmd('webapp connection show --connection {name} -g {source_resource_group} -n {site}') - - # delete connection - self.cmd('webapp connection delete --id {} --yes'.format(connection_id)) - - - # @record_only() - def test_webapp_cosmostable_e2e(self): - self.kwargs.update({ - 'name': 'testconn1', - 'subscription': get_subscription_id(self.cli_ctx), - 'source_resource_group': 'servicelinker-test-win-group', - 'target_resource_group': 'servicelinker-test-win-group', - 'site': 'servicelinker-table-cosmos-asp-app', - 'account': 'servicelinker-table-cosmos', - 'table': 'MyItem' - }) - - # prepare params - name = 'testconn' - - target_id = TARGET_RESOURCES.get(RESOURCE.CosmosTable).format(**self.kwargs) - - # create connection - self.cmd('webapp connection create cosmos-table --connection {name} -g {source_resource_group} -n {site} ' - '--tg {target_resource_group} --account {account} --table {table} --system-identity --client-type python') - - # list connection - connections = self.cmd( - 'webapp connection list -g {source_resource_group} -n {site}', - checks = [ - self.check('length(@)', 1), - self.check('[0].authInfo.authType', 'systemAssignedIdentity'), - self.check('[0].clientType', 'python') - ] - ).get_output_in_json() - connection_id = connections[0].get('id') - - # list configuration - self.cmd('webapp connection list-configuration --connection {name} -g {source_resource_group} -n {site}') - - # validate connection - self.cmd('webapp connection validate --connection {name} -g {source_resource_group} -n {site}') - - # show connection - self.cmd('webapp connection show --connection {name} -g {source_resource_group} -n {site}') - - # delete connection - self.cmd('webapp connection delete --id {} --yes'.format(connection_id)) - - - # @record_only() - def test_webapp_eventhub_e2e(self): - self.kwargs.update({ - 'name': 'testconn1', - 'subscription': get_subscription_id(self.cli_ctx), - 'source_resource_group': 'servicelinker-test-linux-group', - 'target_resource_group': 'servicelinker-test-linux-group', - 'site': 'servicelinker-eventhub-app', - 'namespace': 'servicelinkertesteventhub' - }) - - # prepare params - name = 'testconn' - - target_id = TARGET_RESOURCES.get(RESOURCE.EventHub).format(**self.kwargs) - - # create connection - self.cmd('webapp connection create eventhub --connection {name} -g {source_resource_group} -n {site} ' - '--tg {target_resource_group} --namespace {namespace} --system-identity --client-type python') - - # list connection - connections = self.cmd( - 'webapp connection list -g {source_resource_group} -n {site}', - checks = [ - self.check('length(@)', 1), - self.check('[0].authInfo.authType', 'systemAssignedIdentity'), - self.check('[0].clientType', 'python') - ] - ).get_output_in_json() - connection_id = connections[0].get('id') - - # list configuration - self.cmd('webapp connection list-configuration --connection {name} -g {source_resource_group} -n {site}') - - # validate connection - self.cmd('webapp connection validate --connection {name} -g {source_resource_group} -n {site}') - - # show connection - self.cmd('webapp connection show --connection {name} -g {source_resource_group} -n {site}') - - # delete connection - self.cmd('webapp connection delete --id {} --yes'.format(connection_id)) - - - # @record_only() - def test_webapp_postgresflexible_e2e(self): - self.kwargs.update({ - 'name': 'testconn1', - 'subscription': get_subscription_id(self.cli_ctx), - 'source_resource_group': 'servicelinker-test-linux-group', - 'target_resource_group': 'servicelinker-test-linux-group', - 'site': 'servicelinker-flexiblepostgresql-app', - 'server': 'servicelinker-flexiblepostgresql', - 'database': 'postgres' - }) - - # prepare password - user = 'servicelinker' - password = self.cmd('keyvault secret show --vault-name cupertino-kv-test -n TestDbPassword')\ - .get_output_in_json().get('value') - self.kwargs.update({ - 'user': user, - 'password': password - }) - # prepare params - name = 'testconn' - - target_id = TARGET_RESOURCES.get(RESOURCE.PostgresFlexible).format(**self.kwargs) - - # create connection - self.cmd('webapp connection create postgres-flexible --connection {name} -g {source_resource_group} -n {site} ' - '--tg {target_resource_group} --server {server} --database {database} --secret name={user} secret={password} --client-type python') - - # list connection - connections = self.cmd( - 'webapp connection list -g {source_resource_group} -n {site}', - checks = [ - self.check('length(@)', 1), - self.check('[0].authInfo.authType', 'secret'), - self.check('[0].clientType', 'python') - ] - ).get_output_in_json() - connection_id = connections[0].get('id') - - # list configuration - self.cmd('webapp connection list-configuration --connection {name} -g {source_resource_group} -n {site}') - - # validate connection - self.cmd('webapp connection validate --connection {name} -g {source_resource_group} -n {site}') - - # show connection - self.cmd('webapp connection show --connection {name} -g {source_resource_group} -n {site}') - - # delete connection - self.cmd('webapp connection delete --id {} --yes'.format(connection_id)) - - - # @record_only() - def test_webapp_keyvault_e2e(self): - self.kwargs.update({ - 'name': 'testconn1', - 'subscription': get_subscription_id(self.cli_ctx), - 'source_resource_group': 'servicelinker-test-linux-group', - 'target_resource_group': 'servicelinker-test-linux-group', - 'site': 'servicelinker-keyvault-app', - 'vault': 'servicelinker-test-kv' - }) - - # prepare params - name = 'testconn' - - target_id = TARGET_RESOURCES.get(RESOURCE.KeyVault).format(**self.kwargs) - - # create connection - self.cmd('webapp connection create keyvault --connection {name} -g {source_resource_group} -n {site} ' - '--tg {target_resource_group} --vault {vault} --system-identity --client-type python') - - # list connection - connections = self.cmd( - 'webapp connection list -g {source_resource_group} -n {site}', - checks = [ - self.check('length(@)', 1), - self.check('[0].authInfo.authType', 'systemAssignedIdentity'), - self.check('[0].clientType', 'python') - ] - ).get_output_in_json() - connection_id = connections[0].get('id') - - # list configuration - self.cmd('webapp connection list-configuration --connection {name} -g {source_resource_group} -n {site}') - - # validate connection - self.cmd('webapp connection validate --connection {name} -g {source_resource_group} -n {site}') - - # show connection - self.cmd('webapp connection show --connection {name} -g {source_resource_group} -n {site}') - - # delete connection - self.cmd('webapp connection delete --id {} --yes'.format(connection_id)) - - - # @record_only() - def test_webapp_mysql_e2e(self): - self.kwargs.update({ - 'name': 'testconn1', - 'subscription': get_subscription_id(self.cli_ctx), - 'source_resource_group': 'servicelinker-test-linux-group', - 'target_resource_group': 'servicelinker-test-linux-group', - 'site': 'servicelinker-mysql-app', - 'server': 'servicelinker-mysql', - 'database': 'mysqlDB' - }) - - # prepare password - user = 'servicelinker' - password = self.cmd('keyvault secret show --vault-name cupertino-kv-test -n TestDbPassword')\ - .get_output_in_json().get('value') - self.kwargs.update({ - 'user': user, - 'password': password - }) - - # prepare params - name = 'testconn' - - target_id = TARGET_RESOURCES.get(RESOURCE.Mysql).format(**self.kwargs) - - # create connection - self.cmd('webapp connection create mysql --connection {name} -g {source_resource_group} -n {site} ' - '--tg {target_resource_group} --server {server} --database {database} --secret name={user} secret={password} --client-type python'.format(user, password)) - - # list connection - connections = self.cmd( - 'webapp connection list -g {source_resource_group} -n {site}', - checks = [ - self.check('length(@)', 1), - self.check('[0].authInfo.authType', 'secret'), - self.check('[0].clientType', 'python') - ] - ).get_output_in_json() - connection_id = connections[0].get('id') - - # list configuration - self.cmd('webapp connection list-configuration --connection {name} -g {source_resource_group} -n {site}') - - # validate connection - self.cmd('webapp connection validate --connection {name} -g {source_resource_group} -n {site}') - - # show connection - self.cmd('webapp connection show --connection {name} -g {source_resource_group} -n {site}') - - # delete connection - self.cmd('webapp connection delete --id {} --yes'.format(connection_id)) - - - # @record_only() - def test_webapp_mysqlflexible_e2e(self): - self.kwargs.update({ - 'name': 'testconn1', - 'subscription': get_subscription_id(self.cli_ctx), - 'source_resource_group': 'servicelinker-test-linux-group', - 'target_resource_group': 'servicelinker-test-linux-group', - 'site': 'servicelinker-flexiblemysql-app', - 'server': 'servicelinker-flexible-mysql', - 'database': 'mysqlDB' - }) - - # prepare password - user = 'servicelinker' - password = self.cmd('keyvault secret show --vault-name cupertino-kv-test -n TestDbPassword')\ - .get_output_in_json().get('value') - self.kwargs.update({ - 'user': user, - 'password': password - }) - - # prepare params - name = 'testconn' - - target_id = TARGET_RESOURCES.get(RESOURCE.MysqlFlexible).format(**self.kwargs) - - # create connection - self.cmd('webapp connection create mysql-flexible --connection {name} -g {source_resource_group} -n {site} ' - '--tg {target_resource_group} --server {server} --database {database} --secret name={user} secret={password} --client-type python'.format(user, password)) - - # list connection - connections = self.cmd( - 'webapp connection list -g {source_resource_group} -n {site}', - checks = [ - self.check('length(@)', 1), - self.check('[0].authInfo.authType', 'secret'), - self.check('[0].clientType', 'python') - ] - ).get_output_in_json() - connection_id = connections[0].get('id') - - # list configuration - self.cmd('webapp connection list-configuration --connection {name} -g {source_resource_group} -n {site}') - - # validate connection - self.cmd('webapp connection validate --connection {name} -g {source_resource_group} -n {site}') - - # show connection - self.cmd('webapp connection show --connection {name} -g {source_resource_group} -n {site}') - - # delete connection - self.cmd('webapp connection delete --id {} --yes'.format(connection_id)) - - - # @record_only() - def test_webapp_postgres_e2e(self): - self.kwargs.update({ - 'name': 'testconn1', - 'subscription': get_subscription_id(self.cli_ctx), - 'source_resource_group': 'servicelinker-test-linux-group', - 'target_resource_group': 'servicelinker-test-linux-group', - 'site': 'servicelinker-postgresql-app', - 'server': 'servicelinker-postgresql', - 'database': 'postgres' - }) - - # prepare password - user = 'servicelinker' - password = self.cmd('keyvault secret show --vault-name cupertino-kv-test -n TestDbPassword')\ - .get_output_in_json().get('value') - self.kwargs.update({ - 'user': user, - 'password': password - }) - - # prepare params - name = 'testconn' - - target_id = TARGET_RESOURCES.get(RESOURCE.Postgres).format(**self.kwargs) - - # create connection - self.cmd('webapp connection create postgres --connection {name} -g {source_resource_group} -n {site} ' - '--tg {target_resource_group} --server {server} --database {database} --secret name={user} secret={password} --client-type python'.format(user, password)) - - # list connection - connections = self.cmd( - 'webapp connection list -g {source_resource_group} -n {site}', - checks = [ - self.check('length(@)', 1), - self.check('[0].authInfo.authType', 'secret'), - self.check('[0].clientType', 'python') - ] - ).get_output_in_json() - connection_id = connections[0].get('id') - - # list configuration - self.cmd('webapp connection list-configuration --connection {name} -g {source_resource_group} -n {site}') - - # validate connection - self.cmd('webapp connection validate --connection {name} -g {source_resource_group} -n {site}') - - # show connection - self.cmd('webapp connection show --connection {name} -g {source_resource_group} -n {site}') - - # delete connection - self.cmd('webapp connection delete --id {} --yes'.format(connection_id)) - - - # @record_only() - def test_webapp_sql_e2e(self): - self.kwargs.update({ - 'name': 'testconn1', - 'subscription': get_subscription_id(self.cli_ctx), - 'source_resource_group': 'servicelinker-test-linux-group', - 'target_resource_group': 'servicelinker-test-linux-group', - 'site': 'servicelinker-sql-app', - 'server': 'servicelinker-sql', - 'database': 'handler-test' - }) - - # prepare password - user = 'servicelinker' - password = self.cmd('keyvault secret show --vault-name cupertino-kv-test -n TestDbPassword')\ - .get_output_in_json().get('value') - self.kwargs.update({ - 'user': user, - 'password': password - }) - - # prepare params - name = 'testconn' - - target_id = TARGET_RESOURCES.get(RESOURCE.Sql).format(**self.kwargs) - - # create connection - self.cmd('webapp connection create sql --connection {name} -g {source_resource_group} -n {site} ' - '--tg {target_resource_group} --server {server} --database {database} --secret name={user} secret={password} --client-type python'.format(user, password)) - - # list connection - connections = self.cmd( - 'webapp connection list -g {source_resource_group} -n {site}', - checks = [ - self.check('length(@)', 1), - self.check('[0].authInfo.authType', 'secret'), - self.check('[0].clientType', 'python') - ] - ).get_output_in_json() - connection_id = connections[0].get('id') - - # list configuration - self.cmd('webapp connection list-configuration --connection {name} -g {source_resource_group} -n {site}') - - # validate connection - self.cmd('webapp connection validate --connection {name} -g {source_resource_group} -n {site}') - - # show connection - self.cmd('webapp connection show --connection {name} -g {source_resource_group} -n {site}') - - # delete connection - self.cmd('webapp connection delete --id {} --yes'.format(connection_id)) - - - # @record_only() - def test_webapp_storageblob_e2e(self): - self.kwargs.update({ - 'name': 'testconn1', - 'subscription': get_subscription_id(self.cli_ctx), - 'source_resource_group': 'servicelinker-test-linux-group', - 'target_resource_group': 'servicelinker-test-linux-group', - 'site': 'servicelinker-storageblob-app', - 'account': 'servicelinkerteststorage' - }) - - # prepare params - name = 'testconn' - - target_id = TARGET_RESOURCES.get(RESOURCE.StorageBlob).format(**self.kwargs) - - # create connection - self.cmd('webapp connection create storage-blob --connection {name} -g {source_resource_group} -n {site} ' - '--tg {target_resource_group} --account {account} --system-identity --client-type python') - - # list connection - connections = self.cmd( - 'webapp connection list -g {source_resource_group} -n {site}', - checks = [ - self.check('length(@)', 1), - self.check('[0].authInfo.authType', 'systemAssignedIdentity'), - self.check('[0].clientType', 'python') - ] - ).get_output_in_json() - connection_id = connections[0].get('id') - - # list configuration - self.cmd('webapp connection list-configuration --connection {name} -g {source_resource_group} -n {site}') - - # validate connection - self.cmd('webapp connection validate --connection {name} -g {source_resource_group} -n {site}') - - # show connection - self.cmd('webapp connection show --connection {name} -g {source_resource_group} -n {site}') - - # delete connection - self.cmd('webapp connection delete --id {} --yes'.format(connection_id)) - - - # @record_only() - def test_webapp_storagequeue_e2e(self): - self.kwargs.update({ - 'name': 'testconn1', - 'subscription': get_subscription_id(self.cli_ctx), - 'source_resource_group': 'servicelinker-test-linux-group', - 'target_resource_group': 'servicelinker-test-linux-group', - 'site': 'servicelinker-storagequeue-app', - 'account': 'servicelinkerteststorage' - }) - - # prepare params - name = 'testconn' - - target_id = TARGET_RESOURCES.get(RESOURCE.StorageQueue).format(**self.kwargs) - - # create connection - self.cmd('webapp connection create storage-queue --connection {name} -g {source_resource_group} -n {site} ' - '--tg {target_resource_group} --account {account} --secret --client-type python') - - # list connection - connections = self.cmd( - 'webapp connection list -g {source_resource_group} -n {site}', - checks = [ - self.check('length(@)', 1), - self.check('[0].authInfo.authType', 'secret'), - self.check('[0].clientType', 'python') - ] - ).get_output_in_json() - connection_id = connections[0].get('id') - - # list configuration - self.cmd('webapp connection list-configuration --connection {name} -g {source_resource_group} -n {site}') - - # validate connection - self.cmd('webapp connection validate --connection {name} -g {source_resource_group} -n {site}') - - # show connection - self.cmd('webapp connection show --connection {name} -g {source_resource_group} -n {site}') - - # delete connection - self.cmd('webapp connection delete --id {} --yes'.format(connection_id)) - - - # @record_only() - def test_webapp_storagefile_e2e(self): - self.kwargs.update({ - 'name': 'testconn1', - 'subscription': get_subscription_id(self.cli_ctx), - 'source_resource_group': 'servicelinker-test-linux-group', - 'target_resource_group': 'servicelinker-test-linux-group', - 'site': 'servicelinker-storagefile-app', - 'account': 'servicelinkerteststorage' - }) - - # prepare params - name = 'testconn' - - - - # create connection - self.cmd('webapp connection create storage-file --connection {name} -g {source_resource_group} -n {site} ' - '--tg {target_resource_group} --account {account} --secret --client-type python') - - # list connection - connections = self.cmd( - 'webapp connection list -g {source_resource_group} -n {site}', - checks = [ - self.check('length(@)', 1), - self.check('[0].authInfo.authType', 'secret'), - self.check('[0].clientType', 'python') - ] - ).get_output_in_json() - connection_id = connections[0].get('id') - - # list configuration - self.cmd('webapp connection list-configuration --connection {name} -g {source_resource_group} -n {site}') - - # validate connection - self.cmd('webapp connection validate --connection {name} -g {source_resource_group} -n {site}') - - # show connection - self.cmd('webapp connection show --connection {name} -g {source_resource_group} -n {site}') - - # delete connection - self.cmd('webapp connection delete --id {} --yes'.format(connection_id)) - - - # @record_only() - def test_webapp_storagetable_e2e(self): - self.kwargs.update({ - 'name': 'testconn1', - 'subscription': get_subscription_id(self.cli_ctx), - 'source_resource_group': 'servicelinker-test-linux-group', - 'target_resource_group': 'servicelinker-test-linux-group', - 'site': 'servicelinker-storagetable-app', - 'account': 'servicelinkerteststorage' - }) - - # prepare params - name = 'testconn' - - target_id = TARGET_RESOURCES.get(RESOURCE.StorageTable).format(**self.kwargs) - - # create connection - self.cmd('webapp connection create storage-table --connection {name} -g {source_resource_group} -n {site} ' - '--tg {target_resource_group} --account {account} --secret --client-type python') - - # list connection - connections = self.cmd( - 'webapp connection list -g {source_resource_group} -n {site}', - checks = [ - self.check('length(@)', 1), - self.check('[0].authInfo.authType', 'secret'), - self.check('[0].clientType', 'python') - ] - ).get_output_in_json() - connection_id = connections[0].get('id') - - # list configuration - self.cmd('webapp connection list-configuration --connection {name} -g {source_resource_group} -n {site}') - - # validate connection - self.cmd('webapp connection validate --connection {name} -g {source_resource_group} -n {site}') - - # show connection - self.cmd('webapp connection show --connection {name} -g {source_resource_group} -n {site}') - - # delete connection - self.cmd('webapp connection delete --id {} --yes'.format(connection_id))