Skip to content

Commit

Permalink
Create Standby pool cli (#7430)
Browse files Browse the repository at this point in the history
* add standbypool.

* fix commands.

* fix cli.

* remove sub.

* update.

* address comments.

* address comments.
  • Loading branch information
fangru2023 authored Apr 23, 2024
1 parent 9f7d444 commit 02e8832
Show file tree
Hide file tree
Showing 38 changed files with 8,587 additions and 0 deletions.
10 changes: 10 additions & 0 deletions src/service_name.json
Original file line number Diff line number Diff line change
Expand Up @@ -559,6 +559,16 @@
"AzureServiceName": "Stack HCI",
"URL": "https://learn.microsoft.com/azure-stack/hci"
},
{
"Command": "az standby-container-group-pool",
"AzureServiceName": "Standby Pool",
"URL": "https://aka.ms/StandbyPoolsForACI"
},
{
"Command": "az standby-vm-pool",
"AzureServiceName": "Standby Pool",
"URL": "https://aka.ms/StandbyPoolsForVMSS"
},
{
"Command": "az stack-hci-vm",
"AzureServiceName": "Stack HCI",
Expand Down
8 changes: 8 additions & 0 deletions src/standbypool/HISTORY.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
.. :changelog:
Release History
===============

1.0.0b1
++++++
* Initial release.
133 changes: 133 additions & 0 deletions src/standbypool/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,133 @@
# Azure CLI Standbypool Extension #

This is an extension to Azure CLI to manage Standbypool resources.

## How to use ##

Install standby virtual machine pool extension using ths blow CLI command
```
az extension add --name standby-vm-pool
```

Install standby container group pool extension using ths blow CLI command
```
az extension add --name standby-container-group-pool
```

### Included features ###

#### standby-vm-pool usage ####

##### Create #####

```
az standby-vm-pool create \
--subscription 461fa159-654a-415f-853a-40b801021944 \
--resource-group myrg \
--name mypool \
--max-ready-capacity 20 \
--vm-state Running \
--vmss-id /subscriptions/461fa159-654a-415f-853a-40b801021944/resourceGroups/myrg/providers/Microsoft.Compute/virtualMachineScaleSets/myvmss \
--location eastus \
```

##### Update #####

Update max ready capacity
```
az standby-vm-pool update \
--subscription 461fa159-654a-415f-853a-40b801021944 \
--resource-group myrg \
--name mypool \
--max-ready-capacity 3 \
```

Update vm state
```
az standby-vm-pool update \
--subscription 461fa159-654a-415f-853a-40b801021944 \
--resource-group myrg \
--name mypool \
--vm-state Deallocate \
```

Update vmssId
```
az standby-vm-pool update \
--subscription 461fa159-654a-415f-853a-40b801021944 \
--resource-group myrg \
--name mypool \
--vmss-id /subscriptions/461fa159-654a-415f-853a-40b801021944/resourceGroups/myrg/providers/Microsoft.Compute/virtualMachineScaleSets/testvmss \
```

##### show #####

```
az standby-vm-pool show --subscription 461fa159-654a-415f-853a-40b801021944 --resource-group myrg --name mypool
```

##### List #####
List by subscription Id

```
az standby-vm-pool list --subscription 461fa159-654a-415f-853a-40b801021944
```

List by resource group
```
az standby-vm-pool list --subscription 461fa159-654a-415f-853a-40b801021944 --resource-group myrg
```

##### Delete #####

```
az standby-vm-pool delete --subscription 461fa159-654a-415f-853a-40b801021944 --resource-group myrg --name mypool
```

##### List VMs in StandbyPool #####

```
az standby-vm-pool vm list --subscription 461fa159-654a-415f-853a-40b801021944 --resource-group myrg --name mypool
```

#### standby-container-group-pool usage ####

##### Create #####

```
az standby-container-group-pool create \
--resource-group myrg \
--name mypool \
--subscription 461fa159-654a-415f-853a-40b801021944 \
--container-profile-id /subscriptions/461fa159-654a-415f-853a-40b801021944/resourceGroups/myrg/providers/Microsoft.ContainerInstance/containerGroupProfiles/mycg \
--profile-revision 1 \
--subnet-ids [0].id=/subscriptions/461fa159-654a-415f-853a-40b801021944/resourceGroups/ru-cli-test-standbypool/providers/Microsoft.Network/virtualNetworks/ru-cli-test-standbypool-vnet/subnets/testSubnet \
--refill-policy always \
--max-ready-capacity 1 \
--location eastus
```

##### show #####

```
az standby-container-group-pool show --subscription 461fa159-654a-415f-853a-40b801021944 --resource-group myrg --name mypool
```

##### List #####
List by subscription Id

```
az standby-container-group-pool list --subscription 461fa159-654a-415f-853a-40b801021944
```

List by resource group
```
az standby-container-pool list --subscription 461fa159-654a-415f-853a-40b801021944 --resource-group myrg
```

##### Delete #####

```
az standby-container-group-pool delete --name mypool --subscription 461fa159-654a-415f-853a-40b801021944 --resource-group
```
42 changes: 42 additions & 0 deletions src/standbypool/azext_standbypool/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
# --------------------------------------------------------------------------------------------
# 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
# --------------------------------------------------------------------------------------------

from azure.cli.core import AzCommandsLoader
from azext_standbypool._help import helps # pylint: disable=unused-import


class StandbypoolCommandsLoader(AzCommandsLoader):

def __init__(self, cli_ctx=None):
from azure.cli.core.commands import CliCommandType
custom_command_type = CliCommandType(
operations_tmpl='azext_standbypool.custom#{}')
super().__init__(cli_ctx=cli_ctx,
custom_command_type=custom_command_type)

def load_command_table(self, args):
from azext_standbypool.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

def load_arguments(self, command):
from azext_standbypool._params import load_arguments
load_arguments(self, command)


COMMAND_LOADER_CLS = StandbypoolCommandsLoader
11 changes: 11 additions & 0 deletions src/standbypool/azext_standbypool/_help.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
# --------------------------------------------------------------------------------------------
# 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
# --------------------------------------------------------------------------------------------

# pylint: disable=line-too-long
# pylint: disable=too-many-lines

from knack.help_files import helps # pylint: disable=unused-import
13 changes: 13 additions & 0 deletions src/standbypool/azext_standbypool/_params.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
# --------------------------------------------------------------------------------------------
# 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
# --------------------------------------------------------------------------------------------

# pylint: disable=too-many-lines
# pylint: disable=too-many-statements


def load_arguments(self, _): # pylint: disable=unused-argument
pass
6 changes: 6 additions & 0 deletions src/standbypool/azext_standbypool/aaz/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +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
# --------------------------------------------------------------------------------------------
10 changes: 10 additions & 0 deletions src/standbypool/azext_standbypool/aaz/latest/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
# --------------------------------------------------------------------------------------------
# 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
# --------------------------------------------------------------------------------------------

# pylint: skip-file
# flake8: noqa

Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
# --------------------------------------------------------------------------------------------
# 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
# --------------------------------------------------------------------------------------------

# pylint: skip-file
# flake8: noqa

from azure.cli.core.aaz import *


@register_command_group(
"standby-container-group-pool",
)
class __CMDGroup(AAZCommandGroup):
"""Standby Container Group Pool Operations
"""
pass


__all__ = ["__CMDGroup"]
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
# --------------------------------------------------------------------------------------------
# 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
# --------------------------------------------------------------------------------------------

# pylint: skip-file
# flake8: noqa

from .__cmd_group import *
from ._create import *
from ._delete import *
from ._list import *
from ._show import *
from ._update import *
from ._wait import *
Loading

0 comments on commit 02e8832

Please sign in to comment.