Skip to content
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
7 changes: 7 additions & 0 deletions src/communication/HISTORY.rst
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,13 @@
Release History
===============

1.0.0
++++++
* GA release.

'az communication show-status' has been removed


0.1.0
++++++
* Initial release.
4 changes: 0 additions & 4 deletions src/communication/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,3 @@ az communication regenerate-key --name "MyCommunicationResource" --key-type "Pri
```
az communication delete --name "MyCommunicationResource" --resource-group "MyResourceGroup"
```
##### Show-status #####
```
az communication show-status --operation-id "db5f291f-284d-46e9-9152-d5c83f7c14b8" --location "westus2"
```
3 changes: 1 addition & 2 deletions src/communication/azext_communication/azext_metadata.json
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
{
"azext.isExperimental": true,
"azext.minCliCoreVersion": "2.11.0"
"azext.minCliCoreVersion": "2.15.0"
}
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,3 @@ def cf_communication_cl(cli_ctx, *_):

def cf_communication_service(cli_ctx, *_):
return cf_communication_cl(cli_ctx).communication_service


def cf_operation_statuses(cli_ctx, *_):
return cf_communication_cl(cli_ctx).operation_statuses
16 changes: 1 addition & 15 deletions src/communication/azext_communication/generated/_help.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@

helps['communication'] = """
type: group
short-summary: Manage service with communication
short-summary: Manage communication service with communication
"""

helps['communication list'] = """
Expand Down Expand Up @@ -111,17 +111,3 @@
text: |-
az communication wait --name "MyCommunicationResource" --resource-group "MyResourceGroup" --deleted
"""

helps['communication'] = """
type: group
short-summary: Manage status with communication
"""

helps['communication show-status'] = """
type: command
short-summary: "Gets the current status of an async operation."
examples:
- name: Get OperationStatus
text: |-
az communication show-status --operation-id "db5f291f-284d-46e9-9152-d5c83f7c14b8" --location "westus2"
"""
8 changes: 4 additions & 4 deletions src/communication/azext_communication/generated/_params.py
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,11 @@ def load_arguments(self, _):
c.argument('resource_group_name', resource_group_name_type)
c.argument('name', options_list=['--name', '-n'], type=str, help='The name of the CommunicationService '
'resource.', id_part='name')
c.argument('location', arg_type=get_location_type(self.cli_ctx), required=False,
validator=get_default_location_from_resource_group)
c.argument('tags', tags_type)
c.argument('data_location', type=str, help='The location where the communication service stores its data at '
'rest.')

with self.argument_context('communication delete') as c:
c.argument('resource_group_name', resource_group_name_type)
Expand Down Expand Up @@ -73,7 +77,3 @@ def load_arguments(self, _):
c.argument('resource_group_name', resource_group_name_type)
c.argument('name', options_list=['--name', '-n'], type=str, help='The name of the CommunicationService '
'resource.', id_part='name')

with self.argument_context('communication show-status') as c:
c.argument('location', arg_type=get_location_type(self.cli_ctx))
c.argument('operation_id', type=str, help='The ID of an ongoing async operation')
11 changes: 1 addition & 10 deletions src/communication/azext_communication/generated/commands.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ def load_command_table(self, _):
'ommunicationServiceOperations.{}',
client_factory=cf_communication_service)
with self.command_group('communication', communication_communication_service,
client_factory=cf_communication_service, is_preview=True) as g:
client_factory=cf_communication_service) as g:
g.custom_command('list', 'communication_list')
g.custom_show_command('show', 'communication_show')
g.custom_command('create', 'communication_create', supports_no_wait=True)
Expand All @@ -31,12 +31,3 @@ def load_command_table(self, _):
g.custom_command('list-key', 'communication_list_key')
g.custom_command('regenerate-key', 'communication_regenerate_key')
g.custom_wait_command('wait', 'communication_show')

from azext_communication.generated._client_factory import cf_operation_statuses
communication_operation_statuses = CliCommandType(
operations_tmpl='azext_communication.vendored_sdks.communication.operations._operation_statuses_operations#Oper'
'ationStatusesOperations.{}',
client_factory=cf_operation_statuses)
with self.command_group('communication', communication_operation_statuses, client_factory=cf_operation_statuses,
is_preview=True) as g:
g.custom_command('show-status', 'communication_show_status')
39 changes: 22 additions & 17 deletions src/communication/azext_communication/generated/custom.py
Original file line number Diff line number Diff line change
Expand Up @@ -33,22 +33,30 @@ def communication_create(client,
tags=None,
data_location=None,
no_wait=False):
parameters = {}
parameters['location'] = location
parameters['tags'] = tags
parameters['data_location'] = data_location
return sdk_no_wait(no_wait,
client.begin_create_or_update,
resource_group_name=resource_group_name,
communication_service_name=name,
location=location,
tags=tags,
data_location=data_location)
parameters=parameters)


def communication_update(client,
resource_group_name,
name,
tags=None):
location=None,
tags=None,
data_location=None):
parameters = {}
parameters['location'] = location
parameters['tags'] = tags
parameters['data_location'] = data_location
return client.update(resource_group_name=resource_group_name,
communication_service_name=name,
tags=tags)
parameters=parameters)


def communication_delete(client,
Expand All @@ -66,30 +74,27 @@ def communication_link_notification_hub(client,
name,
resource_id=None,
connection_string=None):
link_notification_hub_parameters = {}
link_notification_hub_parameters['resource_id'] = resource_id
link_notification_hub_parameters['connection_string'] = connection_string
return client.link_notification_hub(resource_group_name=resource_group_name,
communication_service_name=name,
resource_id=resource_id,
connection_string=connection_string)
link_notification_hub_parameters=link_notification_hub_parameters)


def communication_list_key(client,
resource_group_name,
name):
return client.list_key(resource_group_name=resource_group_name,
communication_service_name=name)
return client.list_keys(resource_group_name=resource_group_name,
communication_service_name=name)


def communication_regenerate_key(client,
resource_group_name,
name,
key_type=None):
parameters = {}
parameters['key_type'] = key_type
return client.regenerate_key(resource_group_name=resource_group_name,
communication_service_name=name,
key_type=key_type)


def communication_show_status(client,
location,
operation_id):
return client.get(location=location,
operation_id=operation_id)
parameters=parameters)
63 changes: 28 additions & 35 deletions src/communication/azext_communication/manual/_help.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,61 +14,65 @@

helps['communication'] = """
type: group
short-summary: Manage communication service
short-summary: Manage communication service with communication
"""

helps['communication list'] = """
type: command
short-summary: "List all resources in a subscription or a resource group."
short-summary: "Handles requests to list all resources in a resource group. And Handles requests to list all \
resources in a subscription."
examples:
- name: List by resource group
text: |-
az communication list --resource-group "MyResourceGroup"
- name: List by subscription
text: |-
az communication list
"""

helps['communication show'] = """
type: command
short-summary: "Get the Communication Service and its properties."
short-summary: "Get the CommunicationService and its properties."
examples:
- name: Get the detail of a Communication Service
- name: Get resource
text: |-
az communication show --name "MyCommunicationResource" --resource-group "MyResourceGroup"
"""

helps['communication create'] = """
type: command
short-summary: "Create a new Communication Service or update an existing Communication Service."
short-summary: "Create a new CommunicationService or update an existing CommunicationService."
examples:
- name: Create a Communication Service
- name: Create or update resource
text: |-
az communication create --name "MyCommunicationResource" --location "Global" --data-location \
"United States" --resource-group "MyResourceGroup"
az communication create --name "MyCommunicationResource" --location "Global" --data-location "United \
States" --resource-group "MyResourceGroup"
"""

helps['communication update'] = """
type: command
short-summary: "Operation to update an existing Communication Service."
short-summary: "Operation to update an existing CommunicationService."
examples:
- name: Update a Communication Service
- name: Update resource
text: |-
az communication update --name "MyCommunicationResource" --tags newTag="newVal" \
--resource-group "MyResourceGroup"
az communication update --name "MyCommunicationResource" --tags newTag="newVal" --resource-group \
"MyResourceGroup"
"""

helps['communication delete'] = """
type: command
short-summary: "Operation to delete a Communication Service."
short-summary: "Operation to delete a CommunicationService."
examples:
- name: Delete a Communication Service
- name: Delete resource
text: |-
az communication delete --name "MyCommunicationResource" --resource-group "MyResourceGroup"
"""

helps['communication link-notification-hub'] = """
type: command
short-summary: "Link an Azure Notification Hub to this communication."
short-summary: "Links an Azure Notification Hub to this communication service."
examples:
- name: Link a Communication Service to a existing notification hub
- name: Link notification hub
text: |-
az communication link-notification-hub --name "MyCommunicationResource" --connection-string \
"Endpoint=sb://MyNamespace.servicebus.windows.net/;SharedAccessKey=abcd1234" --resource-id \
Expand All @@ -78,22 +82,22 @@

helps['communication list-key'] = """
type: command
short-summary: "Get the access keys of the Communication Service resource."
short-summary: "Get the access keys of the CommunicationService resource."
examples:
- name: List access keys of a Communication Service
- name: List keys
text: |-
az communication list-key --name "MyCommunicationResource" --resource-group "MyResourceGroup"
"""

helps['communication regenerate-key'] = """
type: command
short-summary: "Regenerate Communication Service access key. PrimaryKey and SecondaryKey cannot be regenerated at \
short-summary: "Regenerate CommunicationService access key. PrimaryKey and SecondaryKey cannot be regenerated at \
the same time."
examples:
- name: Regenerate primary access keys of a Communication Service
- name: Regenerate key
text: |-
az communication regenerate-key --name "MyCommunicationResource" --key-type "Primary" \
--resource-group "MyResourceGroup"
az communication regenerate-key --name "MyCommunicationResource" --key-type "Primary" --resource-group \
"MyResourceGroup"
"""

helps['communication wait'] = """
Expand All @@ -102,19 +106,8 @@
examples:
- name: Pause executing next line of CLI script until the communication is successfully created.
text: |-
az communication wait --name "MyCommunicationResource" --resource-group "MyResourceGroup" \
--created
az communication wait --name "MyCommunicationResource" --resource-group "MyResourceGroup" --created
- name: Pause executing next line of CLI script until the communication is successfully deleted.
text: |-
az communication wait --name "MyCommunicationResource" --resource-group "MyResourceGroup" \
--deleted
"""

helps['communication show-status'] = """
type: command
short-summary: "Get the current status of an async operation."
examples:
- name: Get the current status of a specific operation
text: |-
az communication show-status --operation-id "db5f291f-284d-46e9-9152-d5c83f7c14b8" --location "westus2"
az communication wait --name "MyCommunicationResource" --resource-group "MyResourceGroup" --deleted
"""
9 changes: 9 additions & 0 deletions src/communication/azext_communication/manual/_params.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
# --------------------------------------------------------------------------------------------
# Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License. See License.txt in the project root for license information.
# --------------------------------------------------------------------------------------------


def load_arguments(self, _):
with self.argument_context('communication update') as c:
c.argument('location', validator=None)
8 changes: 5 additions & 3 deletions src/communication/azext_communication/tests/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -31,8 +31,8 @@
def try_manual(func):
def import_manual_function(origin_func):
from importlib import import_module
decorated_path = inspect.getfile(origin_func)
module_path = __path__[0]
decorated_path = inspect.getfile(origin_func).lower()
module_path = __path__[0].lower()
if not decorated_path.startswith(module_path):
raise Exception("Decorator can only be used in submodules!")
manual_path = os.path.join(
Expand All @@ -46,7 +46,6 @@ def import_manual_function(origin_func):
def get_func_to_call():
func_to_call = func
try:
func_to_call = import_manual_function(func)
func_to_call = import_manual_function(func)
logger.info("Found manual override for %s(...)", func.__name__)
except (ImportError, AttributeError):
Expand All @@ -66,6 +65,9 @@ def wrapper(*args, **kwargs):
ret = func_to_call(*args, **kwargs)
except (AssertionError, AzureError, CliTestError, CliExecutionError, SystemExit,
JMESPathCheckAssertionError) as e:
use_exception_cache = os.getenv("TEST_EXCEPTION_CACHE")
if use_exception_cache is None or use_exception_cache.lower() != "true":
raise
test_map[func.__name__]["end_dt"] = dt.datetime.utcnow()
test_map[func.__name__]["result"] = FAILED
test_map[func.__name__]["error_message"] = str(e).replace("\r\n", " ").replace("\n", " ")[:500]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,8 +25,7 @@ def step_create(test, rg_2, rg, checks=None):
checks=checks)
test.cmd('az communication wait --created '
'--name "{myCommunicationService}" '
'--resource-group "{rg}"',
checks=[])
'--resource-group "{rg}"')


# EXAMPLE: /CommunicationService/get/Get resource
Expand Down Expand Up @@ -119,13 +118,3 @@ def step_delete(test, rg_2, rg, checks=None):
'--resource-group "{rg}"',
checks=checks)


# EXAMPLE: /OperationStatuses/get/Get OperationStatus
@try_manual
def step_show_status(test, rg_2, rg, checks=None):
if checks is None:
checks = []
test.cmd('az communication show-status '
'--operation-id "db5f291f-284d-46e9-9152-d5c83f7c14b8" '
'--location "westus2"',
checks=checks)
Loading