Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[AKS] Convert module to use multi-API idioms #8267

Open
tjprescott opened this issue Jan 16, 2019 · 1 comment
Open

[AKS] Convert module to use multi-API idioms #8267

tjprescott opened this issue Jan 16, 2019 · 1 comment
Labels
AKS az aks/acs/openshift Profile Versioning Service Attention This issue is responsible by Azure service team.

Comments

@tjprescott
Copy link
Member

tjprescott commented Jan 16, 2019

Is your feature request related to a problem? Please describe.

The latest container service SDK has switched to a multi-API format. The CLI needs to be updated to use multi-API idioms.

In azure.cli.core.profiles._shared.py:
Add an entry in the "latest" profile like this:

AZURE_API_PROFILES = {
    'latest': {
        ResourceType.MGMT_ACS: '2017-07-01',  # you can call this whatever you want
        ResourceType.MGMT_ACS_PREVIEW: '2018_03_31', # looks like you'll need two versions on a given profile.
        ResourceType.MGMT_STORAGE: '2018-07-01',

In init.py for your module:

class ContainerServiceCommandsLoader(AzCommandsLoader):

    def __init__(self, cli_ctx=None):
        from azure.cli.core.commands import CliCommandType
        acs_custom = CliCommandType(operations_tmpl='azure.cli.command_modules.acs.custom#{}')
        from azure.cli.core.profile import ResourceType
        super(ContainerServiceCommandsLoader, self).__init__(cli_ctx=cli_ctx,
                                                             custom_command_type=acs_custom,
                                                             min_profile='2017-03-10-profile',
                                                             resource_type=ResourceType.MGMT_ACS) # your resource type here

Where ever you have direct import statements, move them into the command or validator they are needed for and convert.
Example:

    # this
    from azure.mgmt.containerservice.models import ContainerServiceLinuxProfile
    from azure.mgmt.containerservice.models import ContainerServiceNetworkProfile

    # becomes this
    ContainerServiceLinuxProfile, ContainerServiceNetworkProfile = cmd.get_models(
        'ContainerServiceLinuxProfile', 'ContainerServiceNetworkProfile'
    )

Note you need a cmd context to call get_models so you can only do this import inside a command or validator, not as a top-level import.

@tjprescott tjprescott added ACS az acs/aks/openshift AKS az aks/acs/openshift labels Jan 16, 2019
@tjprescott
Copy link
Member Author

@bsiegel bsiegel added the Service Attention This issue is responsible by Azure service team. label Jun 14, 2019
@yugangw-msft yugangw-msft removed the ACS az acs/aks/openshift label Jul 27, 2019
@haroldrandom haroldrandom added AKS az aks/acs/openshift Profile Versioning Service Attention This issue is responsible by Azure service team. labels Oct 25, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
AKS az aks/acs/openshift Profile Versioning Service Attention This issue is responsible by Azure service team.
Projects
None yet
Development

No branches or pull requests

4 participants