forked from Azure/azure-cli-extensions
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy path_client_factory.py
More file actions
53 lines (33 loc) · 1.82 KB
/
_client_factory.py
File metadata and controls
53 lines (33 loc) · 1.82 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
# --------------------------------------------------------------------------------------------
# Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License. See License.txt in the project root for license information.
# --------------------------------------------------------------------------------------------
from azure.cli.core.commands.client_factory import get_mgmt_service_client
from azure.cli.core.profiles import (
CustomResourceType,
ResourceType
)
CUSTOM_MGMT_FLEET = CustomResourceType('azext_fleet.vendored_sdks', 'ContainerServiceFleetMgmtClient')
# container service clients
def get_container_service_client(cli_ctx, subscription_id=None):
return get_mgmt_service_client(cli_ctx, CUSTOM_MGMT_FLEET, subscription_id=subscription_id)
def cf_fleets(cli_ctx, *_):
return get_container_service_client(cli_ctx).fleets
def cf_fleet_members(cli_ctx, *_):
return get_container_service_client(cli_ctx).fleet_members
def cf_gates(cli_ctx, *_):
return get_container_service_client(cli_ctx).gates
def cf_update_runs(cli_ctx, *_):
return get_container_service_client(cli_ctx).update_runs
def cf_fleet_update_strategies(cli_ctx, *_):
return get_container_service_client(cli_ctx).fleet_update_strategies
def get_resource_groups_client(cli_ctx, subscription_id=None):
return get_mgmt_service_client(
cli_ctx, ResourceType.MGMT_RESOURCE_RESOURCES, subscription_id=subscription_id).resource_groups
def cf_auto_upgrade_profiles(cli_ctx, *_):
return get_container_service_client(cli_ctx).auto_upgrade_profiles
def cf_auto_upgrade_profile_operations(cli_ctx, *_):
return get_container_service_client(cli_ctx).auto_upgrade_profile_operations
def get_provider_client(cli_ctx):
return get_mgmt_service_client(
cli_ctx, ResourceType.MGMT_RESOURCE_RESOURCES)