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

[ReleasePR communication] [Communication] Init Configuration for Azure CLI #2629

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
8 changes: 8 additions & 0 deletions src/communication/HISTORY.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
.. :changelog:

Release History
===============

0.1.0
++++++
* Initial release.
56 changes: 56 additions & 0 deletions src/communication/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
# Azure CLI communication Extension #
This is the extension for communication

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

### Included Features ###
#### communication service ####
##### Create #####
```
az communication service create --name "MyCommunicationResource" --location "Global" --data-location "United States" \
--resource-group "MyResourceGroup"

az communication service wait --created --name "{myCommunicationService}" --resource-group "{rg}"
```
##### Show #####
```
az communication service show --name "MyCommunicationResource" --resource-group "MyResourceGroup"
```
##### List #####
```
az communication service list --resource-group "MyResourceGroup"
```
##### Update #####
```
az communication service update --name "MyCommunicationResource" --tags newTag="newVal" \
--resource-group "MyResourceGroup"
```
##### Link-notification-hub #####
```
az communication service link-notification-hub --name "MyCommunicationResource" \
--connection-string "Endpoint=sb://MyNamespace.servicebus.windows.net/;SharedAccessKey=abcd1234" \
--resource-id "/subscriptions/12345/resourceGroups/MyOtherResourceGroup/providers/Microsoft.NotificationHubs/namespaces/MyNamespace/notificationHubs/MyHub" \
--resource-group "MyResourceGroup"
```
##### List-key #####
```
az communication service list-key --name "MyCommunicationResource" --resource-group "MyResourceGroup"
```
##### Regenerate-key #####
```
az communication service regenerate-key --name "MyCommunicationResource" --key-type "Primary" \
--resource-group "MyResourceGroup"
```
##### Delete #####
```
az communication service delete --name "MyCommunicationResource" --resource-group "MyResourceGroup"
```
#### communication status ####
##### Show #####
```
az communication status show --operation-id "db5f291f-284d-46e9-9152-d5c83f7c14b8" --location "westus2"
```
50 changes: 50 additions & 0 deletions src/communication/azext_communication/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
# --------------------------------------------------------------------------
# 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.
# --------------------------------------------------------------------------

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


class CommunicationServiceManagementClientCommandsLoader(AzCommandsLoader):

def __init__(self, cli_ctx=None):
from azure.cli.core.commands import CliCommandType
from azext_communication.generated._client_factory import cf_communication_cl
communication_custom = CliCommandType(
operations_tmpl='azext_communication.custom#{}',
client_factory=cf_communication_cl)
parent = super(CommunicationServiceManagementClientCommandsLoader, self)
parent.__init__(cli_ctx=cli_ctx, custom_command_type=communication_custom)

def load_command_table(self, args):
from azext_communication.generated.commands import load_command_table
load_command_table(self, args)
try:
from azext_communication.manual.commands import load_command_table as load_command_table_manual
load_command_table_manual(self, args)
except ImportError:
pass
return self.command_table

def load_arguments(self, command):
from azext_communication.generated._params import load_arguments
load_arguments(self, command)
try:
from azext_communication.manual._params import load_arguments as load_arguments_manual
load_arguments_manual(self, command)
except ImportError:
pass


COMMAND_LOADER_CLS = CommunicationServiceManagementClientCommandsLoader
17 changes: 17 additions & 0 deletions src/communication/azext_communication/action.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
# --------------------------------------------------------------------------
# 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

from .generated.action import * # noqa: F403
try:
from .manual.action import * # noqa: F403
except ImportError:
pass
4 changes: 4 additions & 0 deletions src/communication/azext_communication/azext_metadata.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
{
"azext.isPreview": true,
"azext.minCliCoreVersion": "2.11.0"
}
17 changes: 17 additions & 0 deletions src/communication/azext_communication/custom.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
# --------------------------------------------------------------------------
# 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

from .generated.custom import * # noqa: F403
try:
from .manual.custom import * # noqa: F403
except ImportError:
pass
12 changes: 12 additions & 0 deletions src/communication/azext_communication/generated/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
# coding=utf-8
# --------------------------------------------------------------------------
# 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.
# --------------------------------------------------------------------------

__path__ = __import__('pkgutil').extend_path(__path__, __name__)
24 changes: 24 additions & 0 deletions src/communication/azext_communication/generated/_client_factory.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
# --------------------------------------------------------------------------
# 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.
# --------------------------------------------------------------------------


def cf_communication_cl(cli_ctx, *_):
from azure.cli.core.commands.client_factory import get_mgmt_service_client
from ..vendored_sdks.communication import CommunicationServiceManagementClient
return get_mgmt_service_client(cli_ctx,
CommunicationServiceManagementClient)


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


def cf_status(cli_ctx, *_):
return cf_communication_cl(cli_ctx).operation_statuses
129 changes: 129 additions & 0 deletions src/communication/azext_communication/generated/_help.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,129 @@
# --------------------------------------------------------------------------
# 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=too-many-lines

from knack.help_files import helps


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

helps['communication service list'] = """
type: command
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 service list --resource-group "MyResourceGroup"
- name: List by subscription
text: |-
az communication service list
"""

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

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

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

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

helps['communication service link-notification-hub'] = """
type: command
short-summary: "Links an Azure Notification Hub to this communication service."
examples:
- name: Link notification hub
text: |-
az communication service link-notification-hub --name "MyCommunicationResource" --connection-string \
"Endpoint=sb://MyNamespace.servicebus.windows.net/;SharedAccessKey=abcd1234" --resource-id \
"/subscriptions/12345/resourceGroups/MyOtherResourceGroup/providers/Microsoft.NotificationHubs/namespaces/MyNamespace/n\
otificationHubs/MyHub" --resource-group "MyResourceGroup"
"""

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

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

helps['communication service wait'] = """
type: command
short-summary: Place the CLI in a waiting state until a condition of the communication service is met.
examples:
- name: Pause executing next line of CLI script until the communication service is successfully created.
text: |-
az communication service wait --name "MyCommunicationResource" --resource-group "MyResourceGroup" \
--created
- name: Pause executing next line of CLI script until the communication service is successfully deleted.
text: |-
az communication service wait --name "MyCommunicationResource" --resource-group "MyResourceGroup" \
--deleted
"""

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

helps['communication status show'] = """
type: command
short-summary: "Gets the current status of an async operation."
examples:
- name: Get OperationStatus
text: |-
az communication status show --operation-id "db5f291f-284d-46e9-9152-d5c83f7c14b8" --location "westus2"
"""
Loading