Skip to content

Commit 4a4e750

Browse files
authored
Azure CLI to manage Site resources (#9181)
* Site cli extension changes * removing beta * Allowing labels deletion * removing beta from version history * Correcting argument * Correcting format * Updated readme * Adding beta to version * Updating service_name file with site entry
1 parent fd1c96b commit 4a4e750

24 files changed

+3967
-0
lines changed

src/service_name.json

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -968,5 +968,10 @@
968968
"Command": "az networkfabric",
969969
"AzureServiceName": "Nexus Network Fabric",
970970
"URL": "https://learn.microsoft.com/en-us/azure/operator-nexus/concepts-network-fabric"
971+
},
972+
{
973+
"Command": "az site",
974+
"AzureServiceName": "Azure Arc site manager",
975+
"URL": "https://learn.microsoft.com/en-us/azure/azure-arc/site-manager/"
971976
}
972977
]

src/site/HISTORY.rst

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
.. :changelog:
2+
3+
Release History
4+
===============
5+
6+
1.0.0b1
7+
++++++
8+
* Initial release.

src/site/README.md

Lines changed: 86 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,86 @@
1+
# Azure CLI Site Extension #
2+
This is an extension to Azure CLI to manage Site resources.
3+
4+
## How to use ##
5+
Install this extension using the below CLI command
6+
```
7+
az extension add --name site
8+
```
9+
## What is Azure Arc site manager?
10+
Azure Arc site manager allows you to manage and monitor your on-premises environments as Azure Arc sites. Arc sites are scoped to an Azure resource group, subscription or service group and enable you to track connectivity, alerts, and updates across your environment. The experience is tailored for on-premises scenarios where infrastructure is often managed within a common physical boundary, such as a store, restaurant, or factory.
11+
12+
### Included Features ###
13+
##### Create a Site at service group scope #####
14+
```
15+
az site create --site-name TestSiteName --service-group TestSGName --display-name 'Test Site Display' --description "Test Site" --labels key1="value1" key2="value2" --street-address1="16 TOWNSEND ST" --street-address2="UNIT 1" --city="newyork" --state-or-province="CA" --country="US" --postal-code="94107"
16+
```
17+
18+
##### Create a Site at resource group scope #####
19+
```
20+
az site create --site-name TestSiteName --resource-group TestRGName --subscription 000000000-0000-0000-0000-000000000000 --display-name 'Test Site Display' --description "Test Site" --street-address1="16 TOWNSEND ST" --street-address2="UNIT 1" --city="newyork" --state-or-province="CA" --country="US" --postal-code="94107"
21+
```
22+
23+
##### Create a Site at subscription scope #####
24+
```
25+
az site create --site-name TestSiteName --subscription 000000000-0000-0000-0000-000000000000 --display-name 'Test Site Display' --description "Test Site" --labels key1="value1" --street-address1="16 TOWNSEND ST" --street-address2="UNIT 1" --city="newyork" --state-or-province="CA" --country="US" --postal-code="94107"
26+
```
27+
28+
##### Delete a Site at service group scope #####
29+
```
30+
az site delete --site-name TestSiteName --service-group TestSGName
31+
```
32+
33+
##### Delete a Site at resource group scope #####
34+
```
35+
az site delete --site-name TestSiteName --resource-group TestRGName --subscription 00000000-0000-0000-0000-000000000000
36+
```
37+
38+
##### Delete a Site at subscription scope #####
39+
```
40+
az site delete --site-name TestSiteName --subscription 00000000-0000-0000-0000-000000000000
41+
```
42+
43+
##### List Sites at service group scope #####
44+
```
45+
az site list --service-group TestSGName
46+
```
47+
48+
##### List Sites at resource group scope #####
49+
```
50+
az site list --resource-group TestRGName --subscription 00000000000-0000-0000-0000-000000000000
51+
```
52+
53+
##### List Sites at subscription scope #####
54+
```
55+
az site list --subscription 00000000000-0000-0000-0000-000000000000
56+
```
57+
58+
##### Show a Site at service group scope #####
59+
```
60+
az site show --site-name TestSiteName --service-group TestSGName
61+
```
62+
63+
##### Show a Site at resource group scope #####
64+
```
65+
az site show --site-name TestSiteName --resource-group TestRGName --subscription 00000000-0000-0000-0000-000000000000
66+
```
67+
68+
##### Show a Site at subscription scope #####
69+
```
70+
az site show --site-name TestSiteName --subscription 00000000-0000-0000-0000-000000000000
71+
```
72+
73+
##### Update a Site at service group scope #####
74+
```
75+
az site update --site-name TestSiteName --service-group TestSGName --description "Test Site" --labels key1="value1" key2="value2" --street-address1="17 TOWNSEND ST" --street-address2="UNIT 2" --city="newyork" --state-or-province="CA" --country="US" --postal-code="94107"
76+
```
77+
78+
##### Update a Site at resource group scope #####
79+
```
80+
az site update --site-name TestSiteName --resource-group TestMSRG --subscription 00000000-0000-0000-0000-000000000000 --description "Test Site" --labels key1="value1" key2="value2" --street-address1="17 TOWNSEND ST" --street-address2="UNIT 2" --city="newyork" --state-or-province="CA" --country="US" --postal-code="94107"
81+
```
82+
83+
##### Update a Site at subscription scope #####
84+
```
85+
az site update --site-name TestSiteName --subscription 00000000-0000-0000-0000-000000000000 --description "Test Site" --labels key1="value1" key2="value2" --street-address1="17 TOWNSEND ST" --street-address2="UNIT 2" --city="newyork" --state-or-province="CA" --country="US" --postal-code="94107"
86+
```

src/site/azext_site/__init__.py

Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
1+
# --------------------------------------------------------------------------------------------
2+
# Copyright (c) Microsoft Corporation. All rights reserved.
3+
# Licensed under the MIT License. See License.txt in the project root for license information.
4+
#
5+
# Code generated by aaz-dev-tools
6+
# --------------------------------------------------------------------------------------------
7+
8+
from azure.cli.core import AzCommandsLoader
9+
from azext_site._help import helps # pylint: disable=unused-import
10+
11+
12+
class SiteCommandsLoader(AzCommandsLoader):
13+
14+
def __init__(self, cli_ctx=None):
15+
from azure.cli.core.commands import CliCommandType
16+
custom_command_type = CliCommandType(
17+
operations_tmpl='azext_site.custom#{}')
18+
super().__init__(cli_ctx=cli_ctx,
19+
custom_command_type=custom_command_type)
20+
21+
def load_command_table(self, args):
22+
from azext_site.commands import load_command_table
23+
from azure.cli.core.aaz import load_aaz_command_table
24+
try:
25+
from . import aaz
26+
except ImportError:
27+
aaz = None
28+
if aaz:
29+
load_aaz_command_table(
30+
loader=self,
31+
aaz_pkg_name=aaz.__name__,
32+
args=args
33+
)
34+
load_command_table(self, args)
35+
return self.command_table
36+
37+
def load_arguments(self, command):
38+
from azext_site._params import load_arguments
39+
load_arguments(self, command)
40+
41+
42+
COMMAND_LOADER_CLS = SiteCommandsLoader

src/site/azext_site/_help.py

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
# --------------------------------------------------------------------------------------------
2+
# Copyright (c) Microsoft Corporation. All rights reserved.
3+
# Licensed under the MIT License. See License.txt in the project root for license information.
4+
#
5+
# Code generated by aaz-dev-tools
6+
# --------------------------------------------------------------------------------------------
7+
8+
# pylint: disable=line-too-long
9+
# pylint: disable=too-many-lines
10+
11+
from knack.help_files import helps # pylint: disable=unused-import

src/site/azext_site/_params.py

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
# --------------------------------------------------------------------------------------------
2+
# Copyright (c) Microsoft Corporation. All rights reserved.
3+
# Licensed under the MIT License. See License.txt in the project root for license information.
4+
#
5+
# Code generated by aaz-dev-tools
6+
# --------------------------------------------------------------------------------------------
7+
8+
# pylint: disable=too-many-lines
9+
# pylint: disable=too-many-statements
10+
11+
12+
def load_arguments(self, _): # pylint: disable=unused-argument
13+
pass
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
# --------------------------------------------------------------------------------------------
2+
# Copyright (c) Microsoft Corporation. All rights reserved.
3+
# Licensed under the MIT License. See License.txt in the project root for license information.
4+
#
5+
# Code generated by aaz-dev-tools
6+
# --------------------------------------------------------------------------------------------
Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
# --------------------------------------------------------------------------------------------
2+
# Copyright (c) Microsoft Corporation. All rights reserved.
3+
# Licensed under the MIT License. See License.txt in the project root for license information.
4+
#
5+
# Code generated by aaz-dev-tools
6+
# --------------------------------------------------------------------------------------------
7+
8+
# pylint: skip-file
9+
# flake8: noqa
10+
Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
# --------------------------------------------------------------------------------------------
2+
# Copyright (c) Microsoft Corporation. All rights reserved.
3+
# Licensed under the MIT License. See License.txt in the project root for license information.
4+
#
5+
# Code generated by aaz-dev-tools
6+
# --------------------------------------------------------------------------------------------
7+
8+
# pylint: skip-file
9+
# flake8: noqa
10+
11+
from azure.cli.core.aaz import *
12+
13+
14+
@register_command_group(
15+
"site",
16+
)
17+
class __CMDGroup(AAZCommandGroup):
18+
"""Manage Site
19+
"""
20+
pass
21+
22+
23+
__all__ = ["__CMDGroup"]
Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
# --------------------------------------------------------------------------------------------
2+
# Copyright (c) Microsoft Corporation. All rights reserved.
3+
# Licensed under the MIT License. See License.txt in the project root for license information.
4+
#
5+
# Code generated by aaz-dev-tools
6+
# --------------------------------------------------------------------------------------------
7+
8+
# pylint: skip-file
9+
# flake8: noqa
10+
11+
from .__cmd_group import *
12+
from ._create import *
13+
from ._delete import *
14+
from ._list import *
15+
from ._show import *
16+
from ._update import *

0 commit comments

Comments
 (0)