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

[AutoPR healthbot] Add optional location property to patch body #1871

Closed
wants to merge 1 commit into from
Closed
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
13 changes: 9 additions & 4 deletions src/healthbot/azext_healthbot/generated/_help.py
Original file line number Diff line number Diff line change
Expand Up @@ -41,12 +41,14 @@

helps['healthbot create'] = """
type: command
short-summary: "Create a new HealthBot."
short-summary: "Create a new Azure Health Bot."
examples:
- name: BotCreate
text: |-
az healthbot create --name "samplebotname" --location "East US" --sku "F0" --resource-group \
"healthbotClient"
az healthbot create --bot-name "samplebotname" --type "SystemAssigned, UserAssigned" \
--user-assigned-identities "{\\"/subscriptions/subscription-id/resourcegroups/myrg/providers/microsoft.managedidentity/\
userassignedidentities/my-mi\\":{},\\"/subscriptions/subscription-id/resourcegroups/myrg/providers/microsoft.managedide\
ntity/userassignedidentities/my-mi2\\":{}}" --location "East US" --name "F0" --resource-group "healthbotClient"
"""

helps['healthbot update'] = """
Expand All @@ -55,7 +57,10 @@
examples:
- name: BotUpdate
text: |-
az healthbot update --bot-name "samplebotname" --name "F0" --resource-group "healthbotClient"
az healthbot update --bot-name "samplebotname" --type "SystemAssigned, UserAssigned" \
--user-assigned-identities "{\\"/subscriptions/subscription-id/resourcegroups/myrg/providers/microsoft.managedidentity/\
userassignedidentities/my-mi\\":{},\\"/subscriptions/subscription-id/resourcegroups/myrg/providers/microsoft.managedide\
ntity/userassignedidentities/my-mi2\\":{}}" --name "F0" --resource-group "healthbotClient"
"""

helps['healthbot delete'] = """
Expand Down
35 changes: 30 additions & 5 deletions src/healthbot/azext_healthbot/generated/_params.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,10 @@
resource_group_name_type,
get_location_type
)
from azure.cli.core.commands.validators import get_default_location_from_resource_group
from azure.cli.core.commands.validators import (
get_default_location_from_resource_group,
validate_file_or_dict
)


def load_arguments(self, _):
Expand All @@ -31,18 +34,40 @@ def load_arguments(self, _):

with self.argument_context('healthbot create') as c:
c.argument('resource_group_name', resource_group_name_type)
c.argument('bot_name', options_list=['--name', '-n', '--bot-name'], type=str, help='The name of the Bot resource.')
c.argument('bot_name', type=str, help='The name of the Bot resource.')
c.argument('tags', tags_type)
c.argument('location', arg_type=get_location_type(self.cli_ctx), required=False,
validator=get_default_location_from_resource_group)
c.argument('sku', arg_type=get_enum_type(['F0', 'S1', 'C0']), help='The name of the HealthBot SKU',
c.argument('type_', options_list=['--type'], arg_type=get_enum_type(['SystemAssigned', 'UserAssigned',
'SystemAssigned, UserAssigned', 'None']),
help='The identity type. The type \'SystemAssigned, UserAssigned\' includes both an implicitly '
'created identity and a set of user assigned identities. The type \'None\' will remove any '
'identities from the Azure Health Bot', arg_group='Identity')
c.argument('user_assigned_identities', type=validate_file_or_dict, help='The list of user identities '
'associated with the resource. The user identity dictionary key references will be ARM resource ids '
'in the form: \'/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microso'
'ft.ManagedIdentity/userAssignedIdentities/{identityName}\'. Expected value: '
'json-string/@json-file.', arg_group='Identity')
c.argument('name', arg_type=get_enum_type(['F0', 'S1', 'C0']), help='The name of the Azure Health Bot SKU',
arg_group='Sku')

with self.argument_context('healthbot update') as c:
c.argument('resource_group_name', resource_group_name_type)
c.argument('bot_name', options_list=['--name', '-n', '--bot-name'], type=str, help='The name of the Bot resource.', id_part='name')
c.argument('bot_name', type=str, help='The name of the Bot resource.', id_part='name')
c.argument('tags', tags_type)
c.argument('sku', arg_type=get_enum_type(['F0', 'S1', 'C0']), help='The name of the HealthBot SKU',
c.argument('location', arg_type=get_location_type(self.cli_ctx), required=False,
validator=get_default_location_from_resource_group)
c.argument('type_', options_list=['--type'], arg_type=get_enum_type(['SystemAssigned', 'UserAssigned',
'SystemAssigned, UserAssigned', 'None']),
help='The identity type. The type \'SystemAssigned, UserAssigned\' includes both an implicitly '
'created identity and a set of user assigned identities. The type \'None\' will remove any '
'identities from the Azure Health Bot', arg_group='Identity')
c.argument('user_assigned_identities', type=validate_file_or_dict, help='The list of user identities '
'associated with the resource. The user identity dictionary key references will be ARM resource ids '
'in the form: \'/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microso'
'ft.ManagedIdentity/userAssignedIdentities/{identityName}\'. Expected value: '
'json-string/@json-file.', arg_group='Identity')
c.argument('name', arg_type=get_enum_type(['F0', 'S1', 'C0']), help='The name of the Azure Health Bot SKU',
arg_group='Sku')

with self.argument_context('healthbot delete') as c:
Expand Down
20 changes: 16 additions & 4 deletions src/healthbot/azext_healthbot/generated/custom.py
Original file line number Diff line number Diff line change
Expand Up @@ -30,14 +30,19 @@ def healthbot_create(client,
resource_group_name,
bot_name,
location,
sku,
name,
tags=None,
type_=None,
user_assigned_identities=None,
no_wait=False):
parameters = {}
parameters['tags'] = tags
parameters['location'] = location
parameters['identity'] = {}
parameters['identity']['type'] = type_
parameters['identity']['user_assigned_identities'] = user_assigned_identities
parameters['sku'] = {}
parameters['sku']['name'] = sku
parameters['sku']['name'] = name
return sdk_no_wait(no_wait,
client.begin_create,
resource_group_name=resource_group_name,
Expand All @@ -49,11 +54,18 @@ def healthbot_update(client,
resource_group_name,
bot_name,
tags=None,
sku=None):
location=None,
type_=None,
user_assigned_identities=None,
name=None):
parameters = {}
parameters['tags'] = tags
parameters['location'] = location
parameters['identity'] = {}
parameters['identity']['type'] = type_
parameters['identity']['user_assigned_identities'] = user_assigned_identities
parameters['sku'] = {}
parameters['sku']['name'] = sku
parameters['sku']['name'] = name
return client.update(resource_group_name=resource_group_name,
bot_name=bot_name,
parameters=parameters)
Expand Down
27 changes: 18 additions & 9 deletions src/healthbot/azext_healthbot/tests/latest/example_steps.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,10 +18,14 @@ def step_create(test, rg, rg_2, checks=None):
if checks is None:
checks = []
test.cmd('az healthbot create '
'--name "{myBot}" '
'--location "eastus" '
'--sku "F0" '
'--resource-group "{rg}"',
'--bot-name "{myBot}" '
'--type "SystemAssigned, UserAssigned" '
'--user-assigned-identities "{{\\"/subscriptions/subscription-id/resourcegroups/myrg/providers/microsoft.m'
'anagedidentity/userassignedidentities/my-mi\\":{{}},\\"/subscriptions/subscription-id/resourcegroups/myrg'
'/providers/microsoft.managedidentity/userassignedidentities/my-mi2\\":{{}}}}" '
'--location "East US" '
'--name "F0" '
'--resource-group "{rg_2}"',
checks=checks)


Expand Down Expand Up @@ -52,7 +56,7 @@ def step_show(test, rg, rg_2, checks=None):
checks = []
test.cmd('az healthbot show '
'--name "{myBot}" '
'--resource-group "{rg}"',
'--resource-group "{rg_2}"',
checks=checks)


Expand All @@ -62,9 +66,13 @@ def step_update(test, rg, rg_2, checks=None):
if checks is None:
checks = []
test.cmd('az healthbot update '
'--name "{myBot}" '
'--sku "F0" '
'--resource-group "{rg}"',
'--bot-name "{myBot}" '
'--type "SystemAssigned, UserAssigned" '
'--user-assigned-identities "{{\\"/subscriptions/subscription-id/resourcegroups/myrg/providers/microsoft.m'
'anagedidentity/userassignedidentities/my-mi\\":{{}},\\"/subscriptions/subscription-id/resourcegroups/myrg'
'/providers/microsoft.managedidentity/userassignedidentities/my-mi2\\":{{}}}}" '
'--name "F0" '
'--resource-group "{rg_2}"',
checks=checks)


Expand All @@ -75,5 +83,6 @@ def step_delete(test, rg, rg_2, checks=None):
checks = []
test.cmd('az healthbot delete -y '
'--name "{myBot}" '
'--resource-group "{rg}"',
'--resource-group "{rg_2}"',
checks=checks)

Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,12 @@ def call_scenario(test, rg, rg_2):
setup_scenario(test, rg, rg_2)
step_create(test, rg, rg_2, checks=[
test.check("name", "{myBot}", case_sensitive=False),
test.check("location", "eastus", case_sensitive=False),
test.check("identity.type", "SystemAssigned, UserAssigned", case_sensitive=False),
test.check("identity.userAssignedIdentities./subscriptions/{subscription_id}/resourcegroups/{rg_3}/providers/mi"
"crosoft.managedidentity/userassignedidentities/my-mi.", {}),
test.check("identity.userAssignedIdentities./subscriptions/{subscription_id}/resourcegroups/{rg_3}/providers/mi"
"crosoft.managedidentity/userassignedidentities/my-mi2.", {}),
test.check("location", "East US", case_sensitive=False),
test.check("sku.name", "F0", case_sensitive=False),
])
step_list(test, rg, rg_2, checks=[])
Expand All @@ -54,12 +59,22 @@ def call_scenario(test, rg, rg_2):
])
step_show(test, rg, rg_2, checks=[
test.check("name", "{myBot}", case_sensitive=False),
test.check("location", "eastus", case_sensitive=False),
test.check("identity.type", "SystemAssigned, UserAssigned", case_sensitive=False),
test.check("identity.userAssignedIdentities./subscriptions/{subscription_id}/resourcegroups/{rg_3}/providers/mi"
"crosoft.managedidentity/userassignedidentities/my-mi.", {}),
test.check("identity.userAssignedIdentities./subscriptions/{subscription_id}/resourcegroups/{rg_3}/providers/mi"
"crosoft.managedidentity/userassignedidentities/my-mi2.", {}),
test.check("location", "East US", case_sensitive=False),
test.check("sku.name", "F0", case_sensitive=False),
])
step_update(test, rg, rg_2, checks=[
test.check("name", "{myBot}", case_sensitive=False),
test.check("location", "eastus", case_sensitive=False),
test.check("identity.type", "SystemAssigned, UserAssigned", case_sensitive=False),
test.check("identity.userAssignedIdentities./subscriptions/{subscription_id}/resourcegroups/{rg_3}/providers/mi"
"crosoft.managedidentity/userassignedidentities/my-mi.", {}),
test.check("identity.userAssignedIdentities./subscriptions/{subscription_id}/resourcegroups/{rg_3}/providers/mi"
"crosoft.managedidentity/userassignedidentities/my-mi2.", {}),
test.check("location", "East US", case_sensitive=False),
test.check("sku.name", "F0", case_sensitive=False),
])
step_delete(test, rg, rg_2, checks=[])
Expand All @@ -76,9 +91,11 @@ def __init__(self, *args, **kwargs):
'myBot': 'samplebotname',
})

@ResourceGroupPreparer(name_prefix='clitest', random_name_length=20, key='rg', parameter_name='rg')
@ResourceGroupPreparer(name_prefix='clitest', random_name_length=20, key='rg_2', parameter_name='rg_2')

@ResourceGroupPreparer(name_prefix='clitesthealthbot_OneResourceGroupName'[:7], key='rg', parameter_name='rg')
@ResourceGroupPreparer(name_prefix='clitesthealthbot_healthbotClient'[:7], key='rg_2', parameter_name='rg_2')
def test_healthbot_Scenario(self, rg, rg_2):
call_scenario(self, rg, rg_2)
calc_coverage(__file__)
raise_if()

Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ def __init__(

self.credential = credential
self.subscription_id = subscription_id
self.api_version = "2020-12-08"
self.api_version = "2021-06-10"
self.credential_scopes = kwargs.pop('credential_scopes', ['https://management.azure.com/.default'])
kwargs.setdefault('sdk_moniker', 'mgmt-healthbot/{}'.format(VERSION))
self._configure(**kwargs)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@


class HealthbotClient(object):
"""Microsoft Healthcare Bot is a cloud platform that empowers developers in Healthcare organizations to build and deploy their compliant, AI-powered virtual health assistants and health bots, that help them improve processes and reduce costs.
"""Azure Health Bot is a cloud platform that empowers developers in Healthcare organizations to build and deploy their compliant, AI-powered virtual health assistants and health bots, that help them improve processes and reduce costs.

:ivar bots: BotsOperations operations
:vartype bots: azure.mgmt.healthbot.operations.BotsOperations
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ def __init__(

self.credential = credential
self.subscription_id = subscription_id
self.api_version = "2020-12-08"
self.api_version = "2021-06-10"
self.credential_scopes = kwargs.pop('credential_scopes', ['https://management.azure.com/.default'])
kwargs.setdefault('sdk_moniker', 'mgmt-healthbot/{}'.format(VERSION))
self._configure(**kwargs)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@


class HealthbotClient(object):
"""Microsoft Healthcare Bot is a cloud platform that empowers developers in Healthcare organizations to build and deploy their compliant, AI-powered virtual health assistants and health bots, that help them improve processes and reduce costs.
"""Azure Health Bot is a cloud platform that empowers developers in Healthcare organizations to build and deploy their compliant, AI-powered virtual health assistants and health bots, that help them improve processes and reduce costs.

:ivar bots: BotsOperations operations
:vartype bots: azure.mgmt.healthbot.aio.operations.BotsOperations
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ async def _create_initial(
401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError
}
error_map.update(kwargs.pop('error_map', {}))
api_version = "2020-12-08"
api_version = "2021-06-10"
content_type = kwargs.pop("content_type", "application/json")
accept = "application/json"

Expand Down Expand Up @@ -108,13 +108,13 @@ async def begin_create(
parameters: "models.HealthBot",
**kwargs
) -> AsyncLROPoller["models.HealthBot"]:
"""Create a new HealthBot.
"""Create a new Azure Health Bot.

:param resource_group_name: The name of the Bot resource group in the user subscription.
:type resource_group_name: str
:param bot_name: The name of the Bot resource.
:type bot_name: str
:param parameters: The parameters to provide for the created bot.
:param parameters: The parameters to provide for the created Azure Health Bot.
:type parameters: ~azure.mgmt.healthbot.models.HealthBot
:keyword callable cls: A custom type or function that will be passed the direct response
:keyword str continuation_token: A continuation token to restart a poller from a saved state.
Expand Down Expand Up @@ -194,7 +194,7 @@ async def get(
401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError
}
error_map.update(kwargs.pop('error_map', {}))
api_version = "2020-12-08"
api_version = "2021-06-10"
accept = "application/json"

# Construct URL
Expand Down Expand Up @@ -244,7 +244,7 @@ async def update(
:type resource_group_name: str
:param bot_name: The name of the Bot resource.
:type bot_name: str
:param parameters: The parameters to provide for the required bot.
:param parameters: The parameters to provide for the required Azure Health Bot.
:type parameters: ~azure.mgmt.healthbot.models.HealthBotUpdateParameters
:keyword callable cls: A custom type or function that will be passed the direct response
:return: HealthBot, or the result of cls(response)
Expand All @@ -256,7 +256,7 @@ async def update(
401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError
}
error_map.update(kwargs.pop('error_map', {}))
api_version = "2020-12-08"
api_version = "2021-06-10"
content_type = kwargs.pop("content_type", "application/json")
accept = "application/json"

Expand Down Expand Up @@ -313,7 +313,7 @@ async def _delete_initial(
401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError
}
error_map.update(kwargs.pop('error_map', {}))
api_version = "2020-12-08"
api_version = "2021-06-10"
accept = "application/json"

# Construct URL
Expand Down Expand Up @@ -430,7 +430,7 @@ def list_by_resource_group(
401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError
}
error_map.update(kwargs.pop('error_map', {}))
api_version = "2020-12-08"
api_version = "2021-06-10"
accept = "application/json"

def prepare_request(next_link=None):
Expand Down Expand Up @@ -498,7 +498,7 @@ def list(
401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError
}
error_map.update(kwargs.pop('error_map', {}))
api_version = "2020-12-08"
api_version = "2021-06-10"
accept = "application/json"

def prepare_request(next_link=None):
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ def list(
self,
**kwargs
) -> AsyncIterable["models.AvailableOperations"]:
"""Lists all the available HealthBot operations.
"""Lists all the available Azure Health Bot operations.

:keyword callable cls: A custom type or function that will be passed the direct response
:return: An iterator like instance of either AvailableOperations or the result of cls(response)
Expand All @@ -57,7 +57,7 @@ def list(
401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError
}
error_map.update(kwargs.pop('error_map', {}))
api_version = "2020-12-08"
api_version = "2021-06-10"
accept = "application/json"

def prepare_request(next_link=None):
Expand Down
Loading