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

[Stack-hci] Upgrade api-version to 2022-05-01 #5132

Merged
merged 4 commits into from
Jul 28, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
30 changes: 30 additions & 0 deletions linter_exclusions.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2345,6 +2345,36 @@ ssh arc:
ssh_args:
rule_exclusions:
- no_positional_parameters
stack-hci arc-setting create:
parameters:
arc_application_client_id:
rule_exclusions:
- option_length_too_long
arc_application_object_id:
rule_exclusions:
- option_length_too_long
arc_application_tenant_id:
rule_exclusions:
- option_length_too_long
arc_service_principal_object_id:
rule_exclusions:
- option_length_too_long
connectivity_properties:
rule_exclusions:
- option_length_too_long
stack-hci arc-setting update:
parameters:
connectivity_properties:
rule_exclusions:
- option_length_too_long
stack-hci cluster create:
parameters:
aad_application_object_id:
rule_exclusions:
- option_length_too_long
aad_service_principal_object_id:
rule_exclusions:
- option_length_too_long
storage account create:
parameters:
hierarchical_namespace:
Expand Down
8 changes: 8 additions & 0 deletions src/stack-hci/HISTORY.rst
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,14 @@
Release History
===============

0.1.6
++++++
* Upgrade api-version to 2022-05-01
Jing-song marked this conversation as resolved.
Show resolved Hide resolved
* Add new command `az stack-hci arc-setting update` to support updating arc settings for HCI cluster
* Add new command `az stack-hci arc-setting create-identity` to support creating aad identity for arc settings
* Add new command `az stack-hci arc-setting generate-password` to support generating password for arc settings
* Add new command `az stack-hci cluster create-identity` to support creating cluster identity

0.1.5
++++++
* Support arc setting management
Expand Down
96 changes: 71 additions & 25 deletions src/stack-hci/README.md
Original file line number Diff line number Diff line change
@@ -1,51 +1,97 @@
# Azure CLI stack-hci Extension #
This package is for the 'stack-hci' extension, i.e. 'az stack-hci'
This is the extension for stack-hci

### How to use ###
Install this extension using the below CLI command
```
az extension add --name stack-hci
```

### Included Features
#### Stack HCI Management:
Manage Stack HCI: [more info](https://docs.microsoft.com/en-us/azure-stack/hci/) \
*Examples:*

##### Create an HCI cluster
### Included Features ###
#### stack-hci arc-setting ####
##### Create #####
```
az stack-hci cluster create \
--location "East US" \
--aad-client-id "24a6e53d-04e5-44d2-b7cc-1b732a847dfc" \
--aad-tenant-id "7e589cc1-a8b6-4dff-91bd-5ec0fa18db94" \
--name "myCluster" \
--resource-group "test-rg"
az stack-hci arc-setting create --name "default" --cluster-name "myCluster" --resource-group "test-rg"
```

##### Delete an HCI cluster
##### Show #####
```
az stack-hci cluster delete --name "myCluster" --resource-group "test-rg"
az stack-hci arc-setting show --name "default" --cluster-name "myCluster" --resource-group "test-rg"
```

##### List the HCI clusters
##### List #####
```
az stack-hci arc-setting list --cluster-name "myCluster" --resource-group "test-rg"
```
##### Update #####
```
az stack-hci arc-setting update --connectivity-properties "{\\"enabled\\":true}" --name "default" \
--cluster-name "myCluster" --resource-group "test-rg"
```
##### Create-identity #####
```
az stack-hci arc-setting create-identity --name "default" --cluster-name "myCluster" --resource-group "test-rg"
```
##### Generate-password #####
```
az stack-hci arc-setting generate-password --name "default" --cluster-name "myCluster" --resource-group "test-rg"
```
##### Delete #####
```
az stack-hci arc-setting delete --name "default" --cluster-name "myCluster" --resource-group "test-rg"
```
az stack-hci cluster list
#### stack-hci cluster ####
##### Create #####
```
az stack-hci cluster create --location "East US" --aad-client-id "24a6e53d-04e5-44d2-b7cc-1b732a847dfc" \
--aad-tenant-id "7e589cc1-a8b6-4dff-91bd-5ec0fa18db94" \
--endpoint "https://98294836-31be-4668-aeae-698667faf99b.waconazure.com" --name "myCluster" \
--resource-group "test-rg"
```
##### Show #####
```
az stack-hci cluster show --name "myCluster" --resource-group "test-rg"
```
##### List #####
```
az stack-hci cluster list --resource-group "test-rg"
```
##### Update #####
```
az stack-hci cluster update --endpoint "https://98294836-31be-4668-aeae-698667faf99b.waconazure.com" \
--desired-properties diagnostic-level="Basic" windows-server-subscription="Enabled" \
--tags tag1="value1" tag2="value2" --name "myCluster" --resource-group "test-rg"
```
##### Create-identity #####
```
az stack-hci cluster list --subscription "test-sub"
az stack-hci cluster create-identity --name "myCluster" --resource-group "test-rg"
```

##### Get details about the specified HCI cluster
##### Delete #####
```
az stack-hci cluster show --name "myCluster" --resource-group "test-rg"
az stack-hci cluster delete --name "myCluster" --resource-group "test-rg"
```
#### stack-hci extension ####
##### Create #####
```
az stack-hci extension create --arc-setting-name "default" --cluster-name "myCluster" \
--type "MicrosoftMonitoringAgent" --protected-settings "{\\"workspaceKey\\":\\"xx\\"}" \
--publisher "Microsoft.Compute" --settings "{\\"workspaceId\\":\\"xx\\"}" --type-handler-version "1.10" \
--name "MicrosoftMonitoringAgent" --resource-group "test-rg"

##### Update an HCI cluster
az stack-hci extension wait --created --arc-setting-name "{myArcSetting}" --cluster-name "{myCluster}" \
--name "{myExtension}" --resource-group "{rg}"
```
##### Show #####
```
az stack-hci cluster update --tags tag1="value1" tag2="value2" --name "myCluster" --resource-group "test-rg"
az stack-hci extension show --arc-setting-name "default" --cluster-name "myCluster" --name "MicrosoftMonitoringAgent" \
--resource-group "test-rg"
```
##### List #####
```
az stack-hci extension list --arc-setting-name "default" --cluster-name "myCluster" --resource-group "test-rg"
```

If you have issues, please give feedback by opening an issue at https://github.com/Azure/azure-cli-extensions/issues.
##### Delete #####
```
az stack-hci extension delete --arc-setting-name "default" --cluster-name "myCluster" \
--name "MicrosoftMonitoringAgent" --resource-group "test-rg"
```
55 changes: 55 additions & 0 deletions src/stack-hci/azext_stack_hci/generated/_help.py
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,16 @@
az stack-hci arc-setting create --name "default" --cluster-name "myCluster" --resource-group "test-rg"
"""

helps['stack-hci arc-setting update'] = """
type: command
short-summary: "Update ArcSettings for HCI cluster."
examples:
- name: Patch ArcSetting
text: |-
az stack-hci arc-setting update --connectivity-properties "{\\"enabled\\":true}" --name "default" \
--cluster-name "myCluster" --resource-group "test-rg"
"""

helps['stack-hci arc-setting delete'] = """
type: command
short-summary: "Delete ArcSetting resource details of HCI Cluster."
Expand All @@ -58,6 +68,26 @@
az stack-hci arc-setting delete --name "default" --cluster-name "myCluster" --resource-group "test-rg"
"""

helps['stack-hci arc-setting create-identity'] = """
type: command
short-summary: "Create Aad identity for arc settings."
examples:
- name: Create Arc Identity
text: |-
az stack-hci arc-setting create-identity --name "default" --cluster-name "myCluster" --resource-group \
"test-rg"
"""

helps['stack-hci arc-setting generate-password'] = """
type: command
short-summary: "Generate password for arc settings."
examples:
- name: Generate Password
text: |-
az stack-hci arc-setting generate-password --name "default" --cluster-name "myCluster" --resource-group \
"test-rg"
"""

helps['stack-hci arc-setting wait'] = """
type: command
short-summary: Place the CLI in a waiting state until a condition of the stack-hci arc-setting is met.
Expand All @@ -66,6 +96,10 @@
text: |-
az stack-hci arc-setting wait --name "default" --cluster-name "myCluster" --resource-group "test-rg" \
--deleted
- name: Pause executing next line of CLI script until the stack-hci arc-setting is successfully created.
text: |-
az stack-hci arc-setting wait --name "default" --cluster-name "myCluster" --resource-group "test-rg" \
--created
"""

helps['stack-hci cluster'] = """
Expand Down Expand Up @@ -141,6 +175,27 @@
az stack-hci cluster delete --name "myCluster" --resource-group "test-rg"
"""

helps['stack-hci cluster create-identity'] = """
type: command
short-summary: "Create cluster identity."
examples:
- name: Create cluster Identity
text: |-
az stack-hci cluster create-identity --name "myCluster" --resource-group "test-rg"
"""

helps['stack-hci cluster wait'] = """
type: command
short-summary: Place the CLI in a waiting state until a condition of the stack-hci cluster is met.
examples:
- name: Pause executing next line of CLI script until the stack-hci cluster is successfully deleted.
text: |-
az stack-hci cluster wait --name "myCluster" --resource-group "test-rg" --deleted
- name: Pause executing next line of CLI script until the stack-hci cluster is successfully created.
text: |-
az stack-hci cluster wait --name "myCluster" --resource-group "test-rg" --created
"""

helps['stack-hci extension'] = """
type: group
short-summary: Manage extension with stack hci
Expand Down
39 changes: 39 additions & 0 deletions src/stack-hci/azext_stack_hci/generated/_params.py
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,12 @@ def load_arguments(self, _):
'of the proxy resource holding details of HCI ArcSetting information.')
c.argument('arc_instance_resource_group', options_list=['--instance-rg'], type=str, help='The resource group '
'that hosts the Arc agents, ie. Hybrid Compute Machine resources.')
c.argument('arc_application_client_id', type=str, help='App id of arc AAD identity.')
Jing-song marked this conversation as resolved.
Show resolved Hide resolved
c.argument('arc_application_tenant_id', type=str, help='Tenant id of arc AAD identity.')
c.argument('arc_service_principal_object_id', type=str, help='Object id of arc AAD service principal.')
c.argument('arc_application_object_id', type=str, help='Object id of arc AAD identity.')
c.argument('connectivity_properties', type=validate_file_or_dict, help='contains connectivity related '
'configuration for ARC resources Expected value: json-string/json-file/@json-file.')
c.argument('created_by', type=str, help='The identity that created the resource.', arg_group='System Data')
c.argument('created_by_type', arg_type=get_enum_type(['User', 'Application', 'ManagedIdentity', 'Key']),
help='The type of identity that created the resource.', arg_group='System Data')
Expand All @@ -54,12 +60,33 @@ def load_arguments(self, _):
c.argument('last_modified_at', help='The timestamp of resource last modification (UTC)', arg_group='System '
'Data')

with self.argument_context('stack-hci arc-setting update') as c:
c.argument('resource_group_name', resource_group_name_type)
c.argument('cluster_name', type=str, help='The name of the cluster.', id_part='name')
c.argument('arc_setting_name', options_list=['--name', '-n', '--arc-setting-name'], type=str, help='The name '
'of the proxy resource holding details of HCI ArcSetting information.', id_part='child_name_1')
c.argument('tags', tags_type)
c.argument('connectivity_properties', type=validate_file_or_dict, help='contains connectivity related '
'configuration for ARC resources Expected value: json-string/json-file/@json-file.')

with self.argument_context('stack-hci arc-setting delete') as c:
c.argument('resource_group_name', resource_group_name_type)
c.argument('cluster_name', type=str, help='The name of the cluster.', id_part='name')
c.argument('arc_setting_name', options_list=['--name', '-n', '--arc-setting-name'], type=str, help='The name '
'of the proxy resource holding details of HCI ArcSetting information.', id_part='child_name_1')

with self.argument_context('stack-hci arc-setting create-identity') as c:
c.argument('resource_group_name', resource_group_name_type)
c.argument('cluster_name', type=str, help='The name of the cluster.')
c.argument('arc_setting_name', options_list=['--name', '-n', '--arc-setting-name'], type=str, help='The name '
'of the proxy resource holding details of HCI ArcSetting information.')

with self.argument_context('stack-hci arc-setting generate-password') as c:
c.argument('resource_group_name', resource_group_name_type)
c.argument('cluster_name', type=str, help='The name of the cluster.', id_part='name')
c.argument('arc_setting_name', options_list=['--name', '-n', '--arc-setting-name'], type=str, help='The name '
'of the proxy resource holding details of HCI ArcSetting information.', id_part='child_name_1')

with self.argument_context('stack-hci arc-setting wait') as c:
c.argument('resource_group_name', resource_group_name_type)
c.argument('cluster_name', type=str, help='The name of the cluster.', id_part='name')
Expand All @@ -85,6 +112,8 @@ def load_arguments(self, _):
'management from the Azure portal.')
c.argument('aad_client_id', type=str, help='App id of cluster AAD identity.')
c.argument('aad_tenant_id', type=str, help='Tenant id of cluster AAD identity.')
c.argument('aad_application_object_id', type=str, help='Object id of cluster AAD identity.')
c.argument('aad_service_principal_object_id', type=str, help='Id of cluster identity service principal.')
c.argument('desired_properties', action=AddDesiredProperties, nargs='+', help='Desired properties of the '
'cluster.')
c.argument('created_by', type=str, help='The identity that created the resource.', arg_group='System Data')
Expand Down Expand Up @@ -115,6 +144,16 @@ def load_arguments(self, _):
c.argument('cluster_name', options_list=['--name', '-n', '--cluster-name'], type=str, help='The name of the '
'cluster.', id_part='name')

with self.argument_context('stack-hci cluster create-identity') as c:
c.argument('resource_group_name', resource_group_name_type)
c.argument('cluster_name', options_list=['--name', '-n', '--cluster-name'], type=str, help='The name of the '
'cluster.')

with self.argument_context('stack-hci cluster wait') as c:
c.argument('resource_group_name', resource_group_name_type)
c.argument('cluster_name', options_list=['--name', '-n', '--cluster-name'], type=str, help='The name of the '
'cluster.', id_part='name')

with self.argument_context('stack-hci extension list') as c:
c.argument('resource_group_name', resource_group_name_type)
c.argument('cluster_name', type=str, help='The name of the cluster.')
Expand Down
11 changes: 9 additions & 2 deletions src/stack-hci/azext_stack_hci/generated/commands.py
Original file line number Diff line number Diff line change
Expand Up @@ -44,21 +44,28 @@ def load_command_table(self, _):
g.custom_command('list', 'stack_hci_arc_setting_list')
g.custom_show_command('show', 'stack_hci_arc_setting_show')
g.custom_command('create', 'stack_hci_arc_setting_create')
g.custom_command('update', 'stack_hci_arc_setting_update')
g.custom_command('delete', 'stack_hci_arc_setting_delete', supports_no_wait=True, confirmation=True)
g.custom_command('create-identity', 'stack_hci_arc_setting_create_identity', supports_no_wait=True)
g.custom_command('generate-password', 'stack_hci_arc_setting_generate_password')
g.custom_wait_command('wait', 'stack_hci_arc_setting_show')

with self.command_group('stack-hci cluster', stack_hci_cluster, client_factory=cf_cluster) as g:
g.custom_command('list', 'stack_hci_cluster_list')
g.custom_show_command('show', 'stack_hci_cluster_show')
g.custom_command('create', 'stack_hci_cluster_create')
g.custom_command('update', 'stack_hci_cluster_update')
g.custom_command('delete', 'stack_hci_cluster_delete', confirmation=True)
g.custom_command('delete', 'stack_hci_cluster_delete', supports_no_wait=True, confirmation=True)
g.custom_command('create-identity', 'stack_hci_cluster_create_identity', supports_no_wait=True)
# service team found a bug on this api: Operation returned an invalid status 'OK'
# g.custom_command('upload-certificate', 'stack_hci_cluster_upload_certificate', supports_no_wait=True)
Jing-song marked this conversation as resolved.
Show resolved Hide resolved
g.custom_wait_command('wait', 'stack_hci_cluster_show')

with self.command_group('stack-hci extension', stack_hci_extension, client_factory=cf_extension) as g:
g.custom_command('list', 'stack_hci_extension_list')
g.custom_show_command('show', 'stack_hci_extension_show')
g.custom_command('create', 'stack_hci_extension_create', supports_no_wait=True)
# service team found a bug on this api
# service team found a bug on this api: Operation returned an invalid status 'OK'
# g.custom_command('update', 'stack_hci_extension_update', supports_no_wait=True)
g.custom_command('delete', 'stack_hci_extension_delete', supports_no_wait=True, confirmation=True)
g.custom_wait_command('wait', 'stack_hci_extension_show')
Loading