Skip to content

Commit

Permalink
[AzureStack][AKS]Add AKS into AzureStack profile (#13280)
Browse files Browse the repository at this point in the history
* add AKS into AzureStack profile

* fix format

* refactor code

* fix format

* fix code

* clean up code

* fix code

* update

* code fix for CR feedback and add ACR

* update
  • Loading branch information
hhz1992 authored May 13, 2020
1 parent 03436bc commit ad782e4
Show file tree
Hide file tree
Showing 3 changed files with 23 additions and 9 deletions.
14 changes: 11 additions & 3 deletions src/azure-cli-core/azure/cli/core/profiles/_shared.py
Original file line number Diff line number Diff line change
Expand Up @@ -54,13 +54,13 @@ class ResourceType(Enum): # pylint: disable=too-few-public-methods
MGMT_APPSERVICE = ('azure.mgmt.web', 'WebSiteManagementClient')
MGMT_IOTHUB = ('azure.mgmt.iothub', 'IotHubClient')
MGMT_ARO = ('azure.mgmt.redhatopenshift', 'AzureRedHatOpenShiftClient')
MGMT_CONTAINERSERVICE = ('azure.mgmt.containerservice', 'ContainerServiceClient')
# the "None" below will stay till a command module fills in the type so "get_mgmt_service_client"
# can be provided with "ResourceType.XXX" to initialize the client object. This usually happens
# when related commands start to support Multi-API
DATA_STORAGE = ('azure.multiapi.storage', None)
DATA_STORAGE_BLOB = ('azure.multiapi.storagev2.blob', None)
DATA_COSMOS_TABLE = ('azure.multiapi.cosmosdb', None)
MGMT_CONTAINERSERVICE = ('azure.mgmt.containerservice', None)
MGMT_ADVISOR = ('azure.mgmt.advisor', None)
MGMT_MEDIA = ('azure.mgmt.media', None)
MGMT_BACKUP = ('azure.mgmt.recoveryservicesbackup', None)
Expand Down Expand Up @@ -190,7 +190,11 @@ def default_api_version(self):
}),
ResourceType.MGMT_APPSERVICE: '2019-08-01',
ResourceType.MGMT_IOTHUB: '2019-07-01-preview',
ResourceType.MGMT_ARO: '2020-04-30'
ResourceType.MGMT_ARO: '2020-04-30',
ResourceType.MGMT_CONTAINERSERVICE: SDKProfile('2020-03-01', {
'container_services': '2017-07-01',
'open_shift_managed_clusters': '2019-10-27-preview'
})
},
'2019-03-01-hybrid': {
ResourceType.MGMT_STORAGE: '2017-10-01',
Expand Down Expand Up @@ -220,7 +224,11 @@ def default_api_version(self):
# API versions
ResourceType.MGMT_APPSERVICE: '2018-02-01',
ResourceType.MGMT_EVENTHUB: '2017-04-01',
ResourceType.MGMT_IOTHUB: '2019-03-22'
ResourceType.MGMT_IOTHUB: '2019-03-22',
ResourceType.MGMT_CONTAINERSERVICE: SDKProfile('2020-03-01', {
'container_services': '2017-07-01',
'open_shift_managed_clusters': '2019-10-27-preview'
})
},
'2018-03-01-hybrid': {
ResourceType.MGMT_STORAGE: '2016-01-01',
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -58,9 +58,7 @@ def get_auth_management_client(cli_ctx, scope=None, **_):


def get_container_service_client(cli_ctx, **_):
from azure.mgmt.containerservice import ContainerServiceClient

return get_mgmt_service_client(cli_ctx, ContainerServiceClient)
return get_mgmt_service_client(cli_ctx, ResourceType.MGMT_CONTAINERSERVICE)


def get_osa_container_service_client(cli_ctx, **_):
Expand Down
14 changes: 11 additions & 3 deletions src/azure-cli/azure/cli/command_modules/acs/commands.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
# pylint: disable=no-name-in-module,import-error
from azure.cli.core.commands import CliCommandType
from azure.cli.core.commands.arm import deployment_validate_table_format
from azure.cli.core.profiles import ResourceType

from ._client_factory import cf_container_services
from ._client_factory import cf_managed_clusters
Expand All @@ -24,26 +25,33 @@
def load_command_table(self, _):

container_services_sdk = CliCommandType(
operations_tmpl='azure.mgmt.containerservice.v2017_07_01.operations.'
operations_tmpl='azure.mgmt.containerservice.operations.'
'_container_services_operations#ContainerServicesOperations.{}',
operation_group='container_services',
resource_type=ResourceType.MGMT_CONTAINERSERVICE,
client_factory=cf_container_services
)

managed_clusters_sdk = CliCommandType(
operations_tmpl='azure.mgmt.containerservice.v2020_03_01.operations.'
operations_tmpl='azure.mgmt.containerservice.operations.'
'_managed_clusters_operations#ManagedClustersOperations.{}',
operation_group='managed_clusters',
resource_type=ResourceType.MGMT_CONTAINERSERVICE,
client_factory=cf_managed_clusters
)

agent_pools_sdk = CliCommandType(
operations_tmpl='azext_aks_preview.vendored_sdks.azure_mgmt_preview_aks.'
'operations._agent_pools_operations#AgentPoolsOperations.{}',
resource_type=ResourceType.MGMT_CONTAINERSERVICE,
client_factory=cf_managed_clusters
)

openshift_managed_clusters_sdk = CliCommandType(
operations_tmpl='azure.mgmt.containerservice.v2019_10_27_preview.operations.'
operations_tmpl='azure.mgmt.containerservice.operations.'
'_open_shift_managed_clusters_operations#OpenShiftManagedClustersOperations.{}',
operation_group='open_shift_managed_clusters',
resource_type=ResourceType.MGMT_CONTAINERSERVICE,
client_factory=cf_openshift_managed_clusters
)

Expand Down

0 comments on commit ad782e4

Please sign in to comment.