Remove CLI mentions of Azure BareMetal instance and change to just baremetalinstance

This commit is contained in:
Page Bowers 2020-09-11 11:09:45 -07:00
Родитель dfca2a88c9
Коммит 503c983f3d
6 изменённых файлов: 50 добавлений и 50 удалений

Просмотреть файл

@ -10,58 +10,58 @@ az extension add --source $LATEST_RELEASE
# Usage
To list all AzureBareMetal instances for the subscription:
To list all BareMetal instances for the subscription:
```
az baremetalinstance list
```
To show details about a specific Azure Bare Metal instance:
To show details about a specific BareMetal instance:
```
az azurebaremetalinstance show --resource-group $RESOURCE_GROUP --instance-name $ABM_INSTANCE_NAME
az baremetalinstance show --resource-group $RESOURCE_GROUP --instance-name $BM_INSTANCE_NAME
```
To add a key-value pair to the Tags field of a specific Azure Bare Metal instance:
To add a key-value pair to the Tags field of a specific BareMetal instance:
```
az baremetalinstance update --resource-group $RESOURCE_GROUP --instance-name $ABM_INSTANCE_NAME --set tags.newKey=value
az baremetalinstance update --resource-group $RESOURCE_GROUP --instance-name $BM_INSTANCE_NAME --set tags.newKey=value
```
To update a key-value pair in the Tags field of a specific Azure Bare Metal instance:
To update a key-value pair in the Tags field of a specific BareMetal instance:
```
az baremetalinstance update --resource-group $RESOURCE_GROUP --instance-name $ABM_INSTANCE_NAME --set tags.key=updatedValue
az baremetalinstance update --resource-group $RESOURCE_GROUP --instance-name $BM_INSTANCE_NAME --set tags.key=updatedValue
```
To delete a key-value pair from the Tags field of a specific Azure Bare Metal instance:
To delete a key-value pair from the Tags field of a specific BareMetal instance:
```
az baremetalinstance update --resource-group $RESOURCE_GROUP --instance-name $ABM_INSTANCE_NAME --remove tags.key
az baremetalinstance update --resource-group $RESOURCE_GROUP --instance-name $BM_INSTANCE_NAME --remove tags.key
```
To delete all key-value pairs in the Tags field of a specific Azure Bare Metal instance:
To delete all key-value pairs in the Tags field of a specific BareMetal instance:
```
az baremetalinstance update --resource-group $RESOURCE_GROUP --instance-name $ABM_INSTANCE_NAME --set tags={}
az baremetalinstance update --resource-group $RESOURCE_GROUP --instance-name $BM_INSTANCE_NAME --set tags={}
```
To delete a Azure Bare Metal instance:
To delete a BareMetal instance:
```
az baremetalinstance delete --resource-group $RESOURCE_GROUP --instance-name $ABM_INSTANCE_NAME
az baremetalinstance delete --resource-group $RESOURCE_GROUP --instance-name $BM_INSTANCE_NAME
```
To start a specific Azure Bare Metal instance:
To start a specific BareMetal instance:
```
az baremetalinstance start --resource-group $RESOURCE_GROUP --instance-name $ABM_INSTANCE_NAME
az baremetalinstance start --resource-group $RESOURCE_GROUP --instance-name $BM_INSTANCE_NAME
```
To shutdown a specific Azure Bare Metal instance:
To shutdown a specific BareMetal instance:
```
az baremetalinstance shutdown --resource-group $RESOURCE_GROUP --instance-name $ABM_INSTANCE_NAME
az baremetalinstance shutdown --resource-group $RESOURCE_GROUP --instance-name $BM_INSTANCE_NAME
```
# Contributing

Просмотреть файл

@ -8,11 +8,11 @@ from azure.cli.core import AzCommandsLoader
import azext_baremetalinfrastructure._help # pylint: disable=unused-import
class AzureBareMetalInstanceCommandsLoader(AzCommandsLoader):
class BareMetalInstanceCommandsLoader(AzCommandsLoader):
def __init__(self, cli_ctx=None):
from azure.cli.core.commands import CliCommandType
custom_type = CliCommandType(operations_tmpl='azext_baremetalinfrastructure.custom#{}')
super(AzureBareMetalInstanceCommandsLoader, self).__init__(cli_ctx=cli_ctx,
super(BareMetalInstanceCommandsLoader, self).__init__(cli_ctx=cli_ctx,
custom_command_type=custom_type)
def load_command_table(self, args):
@ -24,4 +24,4 @@ class AzureBareMetalInstanceCommandsLoader(AzCommandsLoader):
from azext_baremetalinfrastructure._params import load_arguments
load_arguments(self, command)
COMMAND_LOADER_CLS = AzureBareMetalInstanceCommandsLoader
COMMAND_LOADER_CLS = BareMetalInstanceCommandsLoader

Просмотреть файл

@ -3,10 +3,10 @@
# Licensed under the MIT License. See License.txt in the project root for license information.
# --------------------------------------------------------------------------------------------
def _azurebaremetal_instance_client_factory(cli_ctx, *_):
def _baremetal_instance_client_factory(cli_ctx, *_):
from azext_baremetalinfrastructure.modules_sdk import BareMetalInfrastructureClient
from azure.cli.core.commands.client_factory import get_mgmt_service_client
return get_mgmt_service_client(cli_ctx, BareMetalInfrastructureClient)
def cf_azurebaremetalinstance_groups(cli_ctx, *_):
return _azurebaremetal_instance_client_factory(cli_ctx).azure_bare_metal_instances
def cf_baremetalinstance_groups(cli_ctx, *_):
return _baremetal_instance_client_factory(cli_ctx).azure_bare_metal_instances

Просмотреть файл

@ -9,40 +9,40 @@ from knack.help_files import helps
helps['baremetalinstance'] = """
type: group
short-summary: (PREVIEW) Manage Azure Bare Metal Instance.
short-summary: (PREVIEW) Manage Bare Metal Instances.
"""
helps['baremetalinstance show'] = """
type: command
short-summary: Get the details of an Azure Bare Metal Instance.
short-summary: Get the details of a Bare Metal Instance.
"""
helps['baremetalinstance list'] = """
type: command
short-summary: List Azure Bare Metal Instances.
short-summary: List Bare Metal Instances.
"""
helps['baremetalinstance restart'] = """
type: command
short-summary: Restart an Azure Bare Metal Instance.
short-summary: Restart a Bare Metal Instance.
"""
helps['baremetalinstance start'] = """
type: command
short-summary: Start an Azure Bare Metal Instance.
short-summary: Start a Bare Metal Instance.
"""
helps['baremetalinstance shutdown'] = """
type: command
short-summary: Shutdown an Azure Bare Metal Instance.
short-summary: Shutdown a BareMetal Instance.
"""
helps['baremetalinstance update'] = """
type: command
short-summary: Update the tags field of an Azure Bare Metal Instance.
short-summary: Update the tags field of a Bare Metal Instance.
"""
helps['baremetalinstance delete'] = """
type: command
short-summary: Delete an Azure Bare Metal Instance.
short-summary: Delete a Bare Metal Instance.
"""

Просмотреть файл

@ -6,19 +6,19 @@
# pylint: disable=line-too-long
from azure.cli.core.util import empty_on_404
from ._client_factory import cf_azurebaremetalinstance_groups
from ._client_factory import cf_baremetalinstance_groups
from azure.cli.core.commands import CliCommandType
def load_command_table(self, _):
custom_tmpl = 'azext_baremetalinfrastructure.custom#{}'
custom_type = CliCommandType(operations_tmpl=custom_tmpl)
with self.command_group('baremetalinstance', client_factory=cf_azurebaremetalinstance_groups) as g:
g.custom_command('list', 'list_azurebaremetalinstance')
g.custom_command('show', 'show_azurebaremetalinstance', exception_handler=empty_on_404)
g.custom_command('restart', 'restart_azurebaremetalinstance')
g.custom_command('start', 'start_azurebaremetalinstance')
g.custom_command('shutdown', 'shutdown_azurebaremetalinstance')
g.generic_update_command('update', getter_name='show_azurebaremetalinstance', setter_name='update_azurebaremetalinstance',
with self.command_group('baremetalinstance', client_factory=cf_baremetalinstance_groups) as g:
g.custom_command('list', 'list_baremetalinstance')
g.custom_command('show', 'show_baremetalinstance', exception_handler=empty_on_404)
g.custom_command('restart', 'restart_baremetalinstance')
g.custom_command('start', 'start_baremetalinstance')
g.custom_command('shutdown', 'shutdown_baremetalinstance')
g.generic_update_command('update', getter_name='show_baremetalinstance', setter_name='update_baremetalinstance',
command_type=custom_type, supports_no_wait=True)
g.custom_command('delete', 'delete_azurebaremetalinstance')
g.custom_command('delete', 'delete_baremetalinstance')

Просмотреть файл

@ -6,17 +6,17 @@
# pylint: disable=no-self-use,too-many-lines
def show_azurebaremetalinstance(client, resource_group_name, instance_name):
def show_baremetalinstance(client, resource_group_name, instance_name):
return client.get(resource_group_name, instance_name)
def list_azurebaremetalinstance(client, resource_group_name=None):
def list_baremetalinstance(client, resource_group_name=None):
if resource_group_name is None:
return client.list_by_subscription()
return client.list(resource_group_name)
def restart_azurebaremetalinstance(client, resource_group_name, instance_name):
# The restart azurebaremetalinstance REST API is a POST with no body.
def restart_baremetalinstance(client, resource_group_name, instance_name):
# The restart baremetalinstance REST API is a POST with no body.
# The HaaS RP API requires the Content-Type to be set.
# Swagger does not add the Content-Type in the header if there is no body.
# We need to add a custom header to force the API call to add the Content-Type.
@ -24,8 +24,8 @@ def restart_azurebaremetalinstance(client, resource_group_name, instance_name):
custom_header['Content-Type'] = 'application/json; charset=utf-8'
return client.restart(resource_group_name, instance_name, custom_header)
def start_azurebaremetalinstance(client, resource_group_name, instance_name):
# The start azurebaremetalinstance REST API is a POST with no body.
def start_baremetalinstance(client, resource_group_name, instance_name):
# The start baremetalinstance REST API is a POST with no body.
# The HaaS RP API requires the Content-Type to be set.
# Swagger does not add the Content-Type in the header if there is no body.
# We need to add a custom header to force the API call to add the Content-Type.
@ -33,8 +33,8 @@ def start_azurebaremetalinstance(client, resource_group_name, instance_name):
custom_header['Content-Type'] = 'application/json; charset=utf-8'
return client.start(resource_group_name, instance_name, custom_header)
def shutdown_azurebaremetalinstance(client, resource_group_name, instance_name):
# The shutdown azurebaremetalinstance REST API is a POST with no body.
def shutdown_baremetalinstance(client, resource_group_name, instance_name):
# The shutdown baremetalinstance REST API is a POST with no body.
# The HaaS RP API requires the Content-Type to be set.
# Swagger does not add the Content-Type in the header if there is no body.
# We need to add a custom header to force the API call to add the Content-Type.
@ -42,8 +42,8 @@ def shutdown_azurebaremetalinstance(client, resource_group_name, instance_name):
custom_header['Content-Type'] = 'application/json; charset=utf-8'
return client.shutdown(resource_group_name, instance_name, custom_header)
def update_azurebaremetalinstance(client, resource_group_name, instance_name, **kwargs):
def update_baremetalinstance(client, resource_group_name, instance_name, **kwargs):
return client.update(resource_group_name, instance_name, kwargs['parameters'].tags)
def delete_azurebaremetalinstance(client, resource_group_name, instance_name):
def delete_baremetalinstance(client, resource_group_name, instance_name):
return client.delete(resource_group_name, instance_name)