1# -------------------------------------------------------------------------------------------- 2# Copyright (c) Microsoft Corporation. All rights reserved. 3# Licensed under the MIT License. See License.txt in the project root for license information. 4# -------------------------------------------------------------------------------------------- 5 6 7def cf_resource_groups(cli_ctx, subscription_id=None): 8 from azure.cli.core.commands.client_factory import get_mgmt_service_client 9 from azure.cli.core.profiles import ResourceType 10 return get_mgmt_service_client(cli_ctx, ResourceType.MGMT_RESOURCE_RESOURCES, 11 subscription_id=subscription_id).resource_groups 12 13 14def cf_storage(cli_ctx, *_, **__): 15 from azure.cli.core.commands.client_factory import get_mgmt_service_client 16 from azure.mgmt.storage import StorageManagementClient 17 return get_mgmt_service_client(cli_ctx, StorageManagementClient) 18 19 20def cf_network(cli_ctx, aux_subscriptions=None, **_): 21 from azure.cli.core.profiles import ResourceType 22 from azure.cli.core.commands.client_factory import get_mgmt_service_client 23 return get_mgmt_service_client(cli_ctx, ResourceType.MGMT_NETWORK, 24 aux_subscriptions=aux_subscriptions) 25 26 27def cf_graph(cli_ctx, **_): 28 from azure.cli.core._profile import Profile 29 from azure.cli.core.commands.client_factory import configure_common_settings 30 from azure.graphrbac import GraphRbacManagementClient 31 profile = Profile(cli_ctx=cli_ctx) 32 cred, _, tenant_id = profile.get_login_credentials( 33 resource=cli_ctx.cloud.endpoints.active_directory_graph_resource_id) 34 client = GraphRbacManagementClient(cred, tenant_id, 35 base_url=cli_ctx.cloud.endpoints.active_directory_graph_resource_id) 36 configure_common_settings(cli_ctx, client) 37 return client 38 39 40def cf_resources(cli_ctx, **_): 41 from azure.cli.core.commands.client_factory import get_mgmt_service_client 42 from azure.cli.core.profiles import ResourceType 43 return get_mgmt_service_client(cli_ctx, ResourceType.MGMT_RESOURCE_RESOURCES) 44 45 46def cf_log_analytics(cli_ctx, *_, **__): 47 from azure.cli.core.commands.client_factory import get_mgmt_service_client 48 from azure.mgmt.loganalytics import LogAnalyticsManagementClient 49 return get_mgmt_service_client(cli_ctx, LogAnalyticsManagementClient) 50 51 52def cf_hdinsight(cli_ctx, *_, **__): 53 from azure.cli.core.commands.client_factory import get_mgmt_service_client 54 from azure.mgmt.hdinsight import HDInsightManagementClient 55 return get_mgmt_service_client(cli_ctx, HDInsightManagementClient) 56 57 58def cf_hdinsight_clusters(cli_ctx, *_, **__): 59 return cf_hdinsight(cli_ctx).clusters 60 61 62def cf_hdinsight_script_actions(cli_ctx, *_, **__): 63 return cf_hdinsight(cli_ctx).script_actions 64 65 66def cf_hdinsight_script_execution_history(cli_ctx, *_, **__): 67 return cf_hdinsight(cli_ctx).script_execution_history 68 69 70def cf_hdinsight_applications(cli_ctx, *_, **__): 71 return cf_hdinsight(cli_ctx).applications 72 73 74def cf_hdinsight_extensions(cli_ctx, *_, **__): 75 return cf_hdinsight(cli_ctx).extensions 76 77 78def cf_hdinsight_locations(cli_ctx, *_, **__): 79 return cf_hdinsight(cli_ctx).locations 80 81 82def cf_hdinsight_virtual_machines(cli_ctx, *_, **__): 83 return cf_hdinsight(cli_ctx).virtual_machines 84