Skip to content

Commit

Permalink
{Mixed-Reality} Migration to CodeGen V2 (#6444)
Browse files Browse the repository at this point in the history
* generated initial code, still need to add customization

* fix swagger to not mark account key as secret(hidden)

* fix for `az spatial-anchors-account create` make --sku equal to --kind if exist. `az spatial-anchors-account key renew` bring back `--key` instead of --serial

* fix for `az remote-rendering-account create` make --sku equal to --kind if exist and autofill --identity. `az spatial-anchors-account key renew` bring back `--key` instead of `--serial`

* remove all old files

* use patch for update to be consistent with swagger

* update version to 0.0.5

* fix PR comments and lint
  • Loading branch information
calvinhzy authored Jun 28, 2023
1 parent 4fc021e commit ff5938b
Show file tree
Hide file tree
Showing 58 changed files with 4,659 additions and 5,756 deletions.
4 changes: 4 additions & 0 deletions src/mixed-reality/HISTORY.rst
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,10 @@
Release History
===============

0.0.5
++++++
* Migrate to CodeGen V2

0.0.4
++++++
* Migrate to track2 SDK
Expand Down
11 changes: 11 additions & 0 deletions src/mixed-reality/azext_mixed_reality/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,17 @@ def __init__(self, cli_ctx=None):

def load_command_table(self, args):
from .commands import load_command_table
from azure.cli.core.aaz import load_aaz_command_table
try:
from . import aaz
except ImportError:
aaz = None
if aaz:
load_aaz_command_table(
loader=self,
aaz_pkg_name=aaz.__name__,
args=args
)
load_command_table(self, args)
return self.command_table

Expand Down
18 changes: 0 additions & 18 deletions src/mixed-reality/azext_mixed_reality/_client_factory.py

This file was deleted.

279 changes: 0 additions & 279 deletions src/mixed-reality/azext_mixed_reality/_help.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,282 +4,3 @@
# --------------------------------------------------------------------------------------------

from knack.help_files import helps

helps['spatial-anchors-account'] = """
type: group
short-summary: Manage spatial anchor account with mixed reality
"""

helps['spatial-anchors-account list'] = """
type: command
short-summary: List resources by resource group and list spatial anchors accounts by subscription.
examples:
- name: List spatial anchor accounts by resource group
text: |-
az spatial-anchors-account list --resource-group "MyResourceGroup"
- name: List spatial anchors accounts by subscription
text: |-
az spatial-anchors-account list
"""

helps['spatial-anchors-account show'] = """
type: command
short-summary: Retrieve a spatial anchors account.
examples:
- name: Get spatial anchors account
text: |-
az spatial-anchors-account show -n "MyAccount" --resource-group \
"MyResourceGroup"
"""

helps['spatial-anchors-account create'] = """
type: command
short-summary: Create a spatial anchors account.
parameters:
- name: --sku
short-summary: The SKU associated with this account
long-summary: |
Usage: --sku name=XX tier=XX size=XX family=XX capacity=XX
name: Required. The name of the SKU. Ex - P3. It is typically a letter+number code
tier: This field is required to be implemented by the resource provider if the service has more than one \
tier, but is not required on a PUT.
size: The SKU size. When the name field is the combination of tier and some other value, this would be the \
standalone code.
family: If the service has different generations of hardware, for the same SKU, then that can be captured \
here.
capacity: If the SKU supports scale out/in then the capacity integer should be included. If scale out/in \
is not possible for the resource this may be omitted.
- name: --kind
short-summary: The kind of account, if supported
long-summary: |
Usage: --kind name=XX tier=XX size=XX family=XX capacity=XX
name: Required. The name of the SKU. Ex - P3. It is typically a letter+number code
tier: This field is required to be implemented by the resource provider if the service has more than one \
tier, but is not required on a PUT.
size: The SKU size. When the name field is the combination of tier and some other value, this would be the \
standalone code.
family: If the service has different generations of hardware, for the same SKU, then that can be captured \
here.
capacity: If the SKU supports scale out/in then the capacity integer should be included. If scale out/in \
is not possible for the resource this may be omitted.
examples:
- name: Create spatial anchor account
text: |-
az spatial-anchors-account create -n "MyAccount" --resource-group "MyResourceGroup"
"""

helps['spatial-anchors-account update'] = """
type: command
short-summary: Update a spatial anchors account.
parameters:
- name: --sku
short-summary: The SKU associated with this account
long-summary: |
Usage: --sku name=XX tier=XX size=XX family=XX capacity=XX
name: Required. The name of the SKU. Ex - P3. It is typically a letter+number code
tier: This field is required to be implemented by the resource provider if the service has more than one \
tier, but is not required on a PUT.
size: The SKU size. When the name field is the combination of tier and some other value, this would be the \
standalone code.
family: If the service has different generations of hardware, for the same SKU, then that can be captured \
here.
capacity: If the SKU supports scale out/in then the capacity integer should be included. If scale out/in \
is not possible for the resource this may be omitted.
- name: --kind
short-summary: The kind of account, if supported
long-summary: |
Usage: --kind name=XX tier=XX size=XX family=XX capacity=XX
name: Required. The name of the SKU. Ex - P3. It is typically a letter+number code
tier: This field is required to be implemented by the resource provider if the service has more than one \
tier, but is not required on a PUT.
size: The SKU size. When the name field is the combination of tier and some other value, this would be the \
standalone code.
family: If the service has different generations of hardware, for the same SKU, then that can be captured \
here.
capacity: If the SKU supports scale out/in then the capacity integer should be included. If scale out/in \
is not possible for the resource this may be omitted.
examples:
- name: Update spatial anchors account
text: |-
az spatial-anchors-account update -n "MyAccount" --resource-group \
"MyResourceGroup" --location "eastus2euap" --tags hero="romeo" heroine="juliet"
"""

helps['spatial-anchors-account delete'] = """
type: command
short-summary: Delete a spatial anchors account.
examples:
- name: Delete spatial anchors account
text: |-
az spatial-anchors-account delete -n "MyAccount" --resource-group \
"MyResourceGroup"
"""

helps['spatial-anchors-account key show'] = """
type: command
short-summary: List both of the 2 keys of a spatial anchors account.
examples:
- name: List spatial anchor account key
text: |-
az spatial-anchors-account key show -n "MyAccount" --resource-group \
"MyResourceGroup"
"""

helps['spatial-anchors-account key renew'] = """
type: command
short-summary: Regenerate specified key of a spatial anchors account.
examples:
- name: Regenerate spatial anchors account keys
text: |-
az spatial-anchors-account key renew -n "MyAccount" -k primary \
--resource-group "MyResourceGroup"
"""

helps['remote-rendering-account'] = """
type: group
short-summary: Manage remote rendering account with mixed reality
"""

helps['remote-rendering-account list'] = """
type: command
short-summary: List resources by resource group and list remote rendering accounts by subscription.
examples:
- name: List remote rendering accounts by resource group
text: |-
az remote-rendering-account list --resource-group "MyResourceGroup"
- name: List remote rendering accounts by subscription
text: |-
az remote-rendering-account list
"""

helps['remote-rendering-account show'] = """
type: command
short-summary: Retrieve a remote rendering account.
examples:
- name: Get remote rendering account
text: |-
az remote-rendering-account show -n "MyAccount" --resource-group \
"MyResourceGroup"
"""

helps['remote-rendering-account create'] = """
type: command
short-summary: Create a remote rendering account.
parameters:
- name: --sku
short-summary: The SKU associated with this account
long-summary: |
Usage: --sku name=XX tier=XX size=XX family=XX capacity=XX
name: Required. The name of the SKU. Ex - P3. It is typically a letter+number code
tier: This field is required to be implemented by the resource provider if the service has more than one \
tier, but is not required on a PUT.
size: The SKU size. When the name field is the combination of tier and some other value, this would be the \
standalone code.
family: If the service has different generations of hardware, for the same SKU, then that can be captured \
here.
capacity: If the SKU supports scale out/in then the capacity integer should be included. If scale out/in \
is not possible for the resource this may be omitted.
- name: --kind
short-summary: The kind of account, if supported
long-summary: |
Usage: --kind name=XX tier=XX size=XX family=XX capacity=XX
name: Required. The name of the SKU. Ex - P3. It is typically a letter+number code
tier: This field is required to be implemented by the resource provider if the service has more than one \
tier, but is not required on a PUT.
size: The SKU size. When the name field is the combination of tier and some other value, this would be the \
standalone code.
family: If the service has different generations of hardware, for the same SKU, then that can be captured \
here.
capacity: If the SKU supports scale out/in then the capacity integer should be included. If scale out/in \
is not possible for the resource this may be omitted.
examples:
- name: Create remote rendering account
text: |-
az remote-rendering-account create -n "MyAccount" --location "eastus2euap" \
--resource-group "MyResourceGroup"
"""

helps['remote-rendering-account update'] = """
type: command
short-summary: Update a remote rendering account.
parameters:
- name: --sku
short-summary: The SKU associated with this account
long-summary: |
Usage: --sku name=XX tier=XX size=XX family=XX capacity=XX
name: Required. The name of the SKU. Ex - P3. It is typically a letter+number code
tier: This field is required to be implemented by the resource provider if the service has more than one \
tier, but is not required on a PUT.
size: The SKU size. When the name field is the combination of tier and some other value, this would be the \
standalone code.
family: If the service has different generations of hardware, for the same SKU, then that can be captured \
here.
capacity: If the SKU supports scale out/in then the capacity integer should be included. If scale out/in \
is not possible for the resource this may be omitted.
- name: --kind
short-summary: The kind of account, if supported
long-summary: |
Usage: --kind name=XX tier=XX size=XX family=XX capacity=XX
name: Required. The name of the SKU. Ex - P3. It is typically a letter+number code
tier: This field is required to be implemented by the resource provider if the service has more than one \
tier, but is not required on a PUT.
size: The SKU size. When the name field is the combination of tier and some other value, this would be the \
standalone code.
family: If the service has different generations of hardware, for the same SKU, then that can be captured \
here.
capacity: If the SKU supports scale out/in then the capacity integer should be included. If scale out/in \
is not possible for the resource this may be omitted.
examples:
- name: Update remote rendering account
text: |-
az remote-rendering-account update -n "MyAccount" --tags hero="romeo" heroine="juliet" \
--resource-group "MyResourceGroup"
"""

helps['remote-rendering-account delete'] = """
type: command
short-summary: Delete a remote rendering account.
examples:
- name: Delete remote rendering account
text: |-
az remote-rendering-account delete -n "MyAccount" --resource-group \
"MyResourceGroup"
"""

helps['remote-rendering-account key show'] = """
type: command
short-summary: List both of the 2 keys of a remote rendering account.
examples:
- name: List remote rendering account key
text: |-
az remote-rendering-account key show -n "MyAccount" --resource-group \
"MyResourceGroup"
"""

helps['remote-rendering-account key renew'] = """
type: command
short-summary: Regenerate specified key of a remote rendering account.
examples:
- name: Regenerate remote rendering account keys
text: |-
az remote-rendering-account key renew -n "MyAccount" -k primary \
--resource-group "MyResourceGroup"
"""

helps['spatial-anchors-account key'] = """
type: group
short-summary: Manage developer keys of a spatial anchors account.
"""

helps['remote-rendering-account key'] = """
type: group
short-summary: Manage developer keys of a remote rendering account.
"""
41 changes: 1 addition & 40 deletions src/mixed-reality/azext_mixed_reality/_params.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,45 +3,6 @@
# Licensed under the MIT License. See License.txt in the project root for license information.
# --------------------------------------------------------------------------------------------

from knack.arguments import CLIArgumentType
from azure.cli.core.commands.validators import get_default_location_from_resource_group
from azure.cli.core.commands.parameters import (
resource_group_name_type,
get_location_type,
get_enum_type,
tags_type,
name_type
)
from azext_mixed_reality.action import AddSku

account_key_type = CLIArgumentType(
help='Key to be regenerated.',
arg_type=get_enum_type(['primary', 'secondary'], default='primary'),
options_list=['--key', '-k'],
)


def load_arguments(self, _):
with self.argument_context('spatial-anchors-account') as c:
c.argument('resource_group_name', arg_type=resource_group_name_type)
c.argument('account_name', type=str, help='Name of an mixed reality account.', arg_type=name_type, id_part='name') # pylint: disable=line-too-long
c.argument('location', arg_type=get_location_type(self.cli_ctx), validator=get_default_location_from_resource_group) # pylint: disable=line-too-long
c.argument('tags', arg_type=tags_type)
c.argument('sku', action=AddSku, nargs='+', help='The SKU associated with this account')
c.argument('kind', action=AddSku, nargs='+', help='The kind of account, if supported')
c.argument('storage_account_name', type=str, help='The name of the storage account associated with this accountId') # pylint: disable=line-too-long

with self.argument_context('spatial-anchors-account key renew') as c:
c.argument('key', arg_type=account_key_type)

with self.argument_context('remote-rendering-account') as c:
c.argument('resource_group_name', resource_group_name_type)
c.argument('account_name', type=str, help='Name of an mixed reality account.', arg_type=name_type, id_part='name') # pylint: disable=line-too-long
c.argument('tags', arg_type=tags_type)
c.argument('location', arg_type=get_location_type(self.cli_ctx), validator=get_default_location_from_resource_group) # pylint: disable=line-too-long
c.argument('sku', action=AddSku, nargs='+', help='The SKU associated with this account')
c.argument('kind', action=AddSku, nargs='+', help='The kind of account, if supported')
c.argument('storage_account_name', type=str, help='The name of the storage account associated with this accountId') # pylint: disable=line-too-long

with self.argument_context('remote-rendering-account key renew') as c:
c.argument('key', arg_type=account_key_type)
pass
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# --------------------------------------------------------------------------------------------
# Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License. See License.txt in the project root for license information.
#
# Code generated by aaz-dev-tools
# --------------------------------------------------------------------------------------------

__path__ = __import__('pkgutil').extend_path(__path__, __name__)
Loading

0 comments on commit ff5938b

Please sign in to comment.