Skip to content

Commit

Permalink
[Hardwaresecuritymodules] Bump up sdk and az dedicated-hsm: add par…
Browse files Browse the repository at this point in the history
…ameters `--mgmt-network-subnet` and `--mgmt-network-interfaces` (#4870)

* {Hardwaresecuritymodules}Bump up sdk

* update

* [HardwareSecurityModules]  Bump up SDK

Bump up SDK and 'az dedicated-hsm': add parameters

* update

* Apply suggestions from code review

* update

* Update setup.py

Co-authored-by: Yu Chen <[email protected]>
  • Loading branch information
ZengTaoxu and jsntcy authored May 26, 2022
1 parent 8b0804d commit e92f423
Show file tree
Hide file tree
Showing 40 changed files with 13,710 additions and 559 deletions.
3 changes: 3 additions & 0 deletions src/hardware-security-modules/HISTORY.rst
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,9 @@
Release History
===============
0.2.0
++++++
* 'az dedicated-hsm': Add parameters '--mgmt-network-subnet' and '--mgmt-network-interfaces'

0.1.0
++++++
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,35 +7,34 @@
# Changes may cause incorrect behavior and will be lost if the code is
# regenerated.
# --------------------------------------------------------------------------
# pylint: disable=unused-import

import azext_hardware_security_modules._help
from azure.cli.core import AzCommandsLoader
from azext_hardware_security_modules.generated._help import helps # pylint: disable=unused-import
try:
from azext_hardware_security_modules.manual._help import helps # pylint: disable=reimported
except ImportError:
pass


class AzureDedicatedHSMResourceProviderCommandsLoader(AzCommandsLoader):

def __init__(self, cli_ctx=None):
from azure.cli.core.commands import CliCommandType
from azext_hardware_security_modules.generated._client_factory import cf_hardwaresecuritymodules
hardwaresecuritymodules_custom = CliCommandType(
from azext_hardware_security_modules.generated._client_factory import cf_hardware_security_modules_cl
hardware_security_modules_custom = CliCommandType(
operations_tmpl='azext_hardware_security_modules.custom#{}',
client_factory=cf_hardwaresecuritymodules)
super(AzureDedicatedHSMResourceProviderCommandsLoader,
self).__init__(
cli_ctx=cli_ctx, custom_command_type=hardwaresecuritymodules_custom)
client_factory=cf_hardware_security_modules_cl)
parent = super(AzureDedicatedHSMResourceProviderCommandsLoader, self)
parent.__init__(cli_ctx=cli_ctx, custom_command_type=hardware_security_modules_custom)

def load_command_table(self, args):
from azext_hardware_security_modules.generated.commands import load_command_table
load_command_table(self, args)
try:
from azext_hardware_security_modules.manual.commands import load_command_table as load_command_table_manual
load_command_table_manual(self, args)
except ImportError:
pass
except ImportError as e:
if e.name.endswith('manual.commands'):
pass
else:
raise e
return self.command_table

def load_arguments(self, command):
Expand All @@ -44,8 +43,11 @@ def load_arguments(self, command):
try:
from azext_hardware_security_modules.manual._params import load_arguments as load_arguments_manual
load_arguments_manual(self, command)
except ImportError:
pass
except ImportError as e:
if e.name.endswith('manual._params'):
pass
else:
raise e


COMMAND_LOADER_CLS = AzureDedicatedHSMResourceProviderCommandsLoader
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
# --------------------------------------------------------------------------
# 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 Microsoft (R) AutoRest Code Generator.
# Changes may cause incorrect behavior and will be lost if the code is
# regenerated.
# --------------------------------------------------------------------------
# pylint: disable=wildcard-import
# pylint: disable=unused-wildcard-import
# pylint: disable=unused-import
from .generated._help import helps # pylint: disable=reimported
try:
from .manual._help import helps # pylint: disable=reimported
except ImportError as e:
if e.name.endswith('manual._help'):
pass
else:
raise e
Original file line number Diff line number Diff line change
Expand Up @@ -13,5 +13,8 @@
from .generated.action import * # noqa: F403
try:
from .manual.action import * # noqa: F403
except ImportError:
pass
except ImportError as e:
if e.name.endswith('manual.action'):
pass
else:
raise e
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
{
"azext.isExperimental": true,
"azext.minCliCoreVersion": "2.3.1"
"azext.minCliCoreVersion": "2.15.0"
}
Original file line number Diff line number Diff line change
Expand Up @@ -13,5 +13,8 @@
from .generated.custom import * # noqa: F403
try:
from .manual.custom import * # noqa: F403
except ImportError:
pass
except ImportError as e:
if e.name.endswith('manual.custom'):
pass
else:
raise e
Original file line number Diff line number Diff line change
Expand Up @@ -9,11 +9,12 @@
# --------------------------------------------------------------------------


def cf_hardwaresecuritymodules(cli_ctx, *_):
def cf_hardware_security_modules_cl(cli_ctx, *_):
from azure.cli.core.commands.client_factory import get_mgmt_service_client
from ..vendored_sdks.hardwaresecuritymodules import AzureDedicatedHSMResourceProvider
return get_mgmt_service_client(cli_ctx, AzureDedicatedHSMResourceProvider)
from azext_hardware_security_modules.vendored_sdks.hardwaresecuritymodules import AzureDedicatedHSMResourceProvider
return get_mgmt_service_client(cli_ctx,
AzureDedicatedHSMResourceProvider)


def cf_dedicated_hsm(cli_ctx, *_):
return cf_hardwaresecuritymodules(cli_ctx).dedicated_hsm
return cf_hardware_security_modules_cl(cli_ctx).dedicated_hsm
Original file line number Diff line number Diff line change
Expand Up @@ -14,71 +14,155 @@

helps['dedicated-hsm'] = """
type: group
short-summary: dedicated-hsm to create, update, list, show, and delete HSMs
short-summary: Manage dedicated hsm with hardware security modules
"""

helps['dedicated-hsm list'] = """
type: command
short-summary: The List operation gets information about the dedicated HSMs associated with the resrouce group.
short-summary: "The List operation gets information about the dedicated hsms associated with the subscription and \
within the specified resource group. And The List operation gets information about the dedicated HSMs associated with \
the subscription."
examples:
- name: List dedicated HSM devices in a resource group
text: |-
az dedicated-hsm list -g "hsm-group"
"""

helps['dedicated-hsm list'] = """
type: command
short-summary: The List operation gets information about the dedicated HSMs associated with the subscription.
examples:
az dedicated-hsm list --resource-group "hsm-group"
- name: List dedicated HSM devices in a resource group including payment HSM
text: |-
az dedicated-hsm list --resource-group "hsm-group"
- name: List dedicated HSM devices in a subscription
text: |-
az dedicated-hsm list
- name: List dedicated HSM devices in a subscription including payment HSM
text: |-
az dedicated-hsm list
"""

helps['dedicated-hsm show'] = """
type: command
short-summary: Gets the specified Azure dedicated HSM.
short-summary: "Gets the specified Azure dedicated HSM."
examples:
- name: Get a dedicated HSM
text: |-
az dedicated-hsm show -n "hsm1" -g "hsm-group"
az dedicated-hsm show --name "hsm1" --resource-group "hsm-group"
- name: Get a payment HSM
text: |-
az dedicated-hsm show --name "hsm1" --resource-group "hsm-group"
- name: Get a payment HSM with 2018-10-31Preview api version
text: |-
az dedicated-hsm show --name "hsm1" --resource-group "hsm-group"
"""

helps['dedicated-hsm create'] = """
type: command
short-summary: Create a dedicated HSM in the specified subscription.
short-summary: "Create a dedicated HSM in the specified subscription."
parameters:
- name: --subnet
short-summary: "Specifies the identifier of the subnet."
long-summary: |
Usage: --subnet id=XX
id: The ARM resource id in the form of /subscriptions/{SubscriptionId}/resourceGroups/{ResourceGroupName}/.\
..
- name: --network-interfaces -i
short-summary: "Specifies the list of resource Ids for the network interfaces associated with the dedicated \
HSM."
long-summary: |
Usage: --network-interfaces private-ip-address=XX
private-ip-address: Private Ip address of the interface
Multiple actions can be specified by using more than one --network-interfaces argument.
- name: --mgmt-network-subnet
short-summary: "Specifies the identifier of the subnet."
long-summary: |
Usage: --mgmt-network-subnet id=XX
id: The ARM resource id in the form of /subscriptions/{SubscriptionId}/resourceGroups/{ResourceGroupName}/.\
..
- name: --mgmt-network-interfaces -m
short-summary: "Specifies the list of resource Ids for the network interfaces associated with the dedicated \
HSM."
long-summary: |
Usage: --mgmt-network-interfaces private-ip-address=XX
private-ip-address: Private Ip address of the interface
Multiple actions can be specified by using more than one --mgmt-network-interfaces argument.
examples:
- name: Create a new dedicated HSM
- name: Create a new or update an existing dedicated HSM
text: |-
az dedicated-hsm create --name "hsm1" --location "westus" \
--network-interfaces private-ip-address="1.0.0.1" --subnet \
id="/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/hsm-group/providers/Microsoft.Network/virtualNet\
works/stamp01/subnets/stamp01" --stamp-id "stamp01" --sku "SafeNet Luna Network HSM A790" --tags Dept="hsm" \
Environment="dogfood" --resource-group "hsm-group"
- name: Create a new or update an existing payment HSM
text: |-
az dedicated-hsm create --name "hsm1" --location "westus" \
--mgmt-network-interfaces private-ip-address="1.0.0.1" --mgmt-network-subnet \
id="/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/hsm-group/providers/Microsoft.Network/virtualNet\
works/stamp01/subnets/stamp01" --stamp-id "stamp01" --sku "payShield10K_LMK1_CPS60" --tags Dept="hsm" \
Environment="dogfood" --resource-group "hsm-group"
- name: Create a new or update an existing payment HSM with management profile
text: |-
az dedicated-hsm create -n "hsm1" -l "japanwest" -i private-ip-address="1.0.0.1" \
-s id="/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/hsm-group/providers/Microsoft.Network/virtualNetworks/hsm/subnets/hsm" \
--stamp-id "stamp1" --sku name="SafeNet Luna Network HSM A790" --tags Dept="hsm" Environment="dogfood" -g "hsm-group"
az dedicated-hsm create --name "hsm1" --location "westus" \
--network-interfaces private-ip-address="1.0.0.2" --subnet id="/subscriptions/00000000-0000-0000-0000-000000000000/reso\
urceGroups/hsm-group/providers/Microsoft.Network/virtualNetworks/stamp01/subnets/stamp01" \
--mgmt-network-interfaces private-ip-address="1.0.0.1" --mgmt-network-subnet \
id="/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/hsm-group/providers/Microsoft.Network/virtualNet\
works/stamp01/subnets/stamp01" --stamp-id "stamp02" --sku "payShield10K_LMK1_CPS60" --tags Dept="hsm" \
Environment="dogfood" --resource-group "hsm-group"
"""

helps['dedicated-hsm update'] = """
type: command
short-summary: Update a dedicated HSM in the specified subscription.
short-summary: "Update a dedicated HSM in the specified subscription."
examples:
- name: Update an existing dedicated HSM
text: |-
az dedicated-hsm update -n "hsm1" --tags Dept="hsm" Environment="dogfood" Sl\
ice="A" -g "hsm-group"
az dedicated-hsm update --name "hsm1" --tags Dept="hsm" Environment="dogfood" \
Slice="A" --resource-group "hsm-group"
- name: Update an existing payment HSM
text: |-
az dedicated-hsm update --name "hsm1" --tags Dept="hsm" Environment="dogfood" \
Slice="A" --resource-group "hsm-group"
"""

helps['dedicated-hsm delete'] = """
type: command
short-summary: Deletes the specified Azure Dedicated HSM.
short-summary: "Deletes the specified Azure Dedicated HSM."
examples:
- name: Delete a dedicated HSM
text: |-
az dedicated-hsm delete -n "hsm1" -g "hsm-group"
az dedicated-hsm delete --name "hsm1" --resource-group "hsm-group"
"""

helps['dedicated-hsm list-outbound-network-dependency-endpoint'] = """
type: command
short-summary: "Gets a list of egress endpoints (network endpoints of all outbound dependencies) in the specified \
dedicated hsm resource. The operation returns properties of each egress endpoint."
examples:
- name: List OutboundNetworkDependenciesEndpoints by Managed Cluster
text: |-
az dedicated-hsm list-outbound-network-dependency-endpoint --name "hsm1" \
--resource-group "hsm-group"
"""

helps['dedicated-hsm wait'] = """
type: command
short-summary: Waits for operation to complete
short-summary: Place the CLI in a waiting state until a condition of the dedicated-hsm \
is met.
examples:
- name: Delete a dedicated HSM
- name: Pause executing next line of CLI script until the dedicated-hsm is \
successfully created.
text: |-
az dedicated-hsm wait --name "hsm1" --resource-group "hsm-group" --created
- name: Pause executing next line of CLI script until the dedicated-hsm is \
successfully updated.
text: |-
az dedicated-hsm wait --name "hsm1" --resource-group "hsm-group" --updated
- name: Pause executing next line of CLI script until the dedicated-hsm is \
successfully deleted.
text: |-
az dedicated-hsm wait --created -g "hsm-group" --name "hsm1"
az dedicated-hsm wait --name "hsm1" --resource-group "hsm-group" --deleted
"""
Loading

0 comments on commit e92f423

Please sign in to comment.