Skip to content

Commit 6c488e4

Browse files
shirleyqin-msftanujissarMSwangrui-msftramneettung-msftelavarasidc
authored
ACS Rooms public preview changes for Python SDK (Azure#25554)
* Add Rooms directory and files Add files needed for new rooms python sdk. As right now there is no api review accepted, add swagger file directly to the swagger folder. Added README.md in swagger directory to list options needed to run autorest for update. * Generate autorest models * Update generated files and use new models * Add unit tests * Add E2E tests * Remove participant mris * Update ReadMe * Update ci,yml and tets.yml * Solve pylint issues * Remove RoomRequest and flatten the parameters Add new apis for add and remove participants * Update e-e test * Update API to accept participant list instead of dict * initial rbac feature * Fix e2e tests Add new update role tests. * Adding idempotency changes for the python SDK. * Adding idempotency headers. * Regnerating the python SDK with idempotency changes. * Adding recordings. * regenerate models using the spec file * update models and tests * pylint fix * add tests for participant methods * use enum role names * fix pylint and documentations * update samples * include change for participant API response * add sanitizer for sensitive information * Updating PYTHON SDK with Open Rooms changes. Related work items: 2812274, 2866897 Updating with the new RoomJoinPolicy for open/closed rooms. Adding new generated files for the room join policy. Adding changes for open rooms. Fixing imports. Updating to using generated enum. Adjusting the imports. * Fixing some documentation issues. * Removing redundant parameter from swagger generation file. * fix documentations * disable initializing with token credential * remove removeAllParticipants and fix unit test * remove removeAllParticipants and fix unit test * address comments * address comments * update recordings * address comments from board review * update docstring and pylint * update type * fix spelling and dependency for pipeline checks * address pr review comments * add file and docs for pipeline check * fix spelling and sdlist * minor fixes for review * typo * fix sample file * update test config Co-authored-by: anujissarMS <anujissar@microsoft.com> Co-authored-by: Rui Wang <wangrui@microsoft.com> Co-authored-by: Ramneet Tung <ramneettung@microsoft.com> Co-authored-by: elavarasidc <101957302+elavarasidc@users.noreply.github.com> Co-authored-by: anujissarMS <89051164+anujissarMS@users.noreply.github.com>
1 parent c88a588 commit 6c488e4

File tree

122 files changed

+28178
-0
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

122 files changed

+28178
-0
lines changed

eng/ignore-links.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,3 +5,4 @@ https://docs.microsoft.com/azure/digital-twins/how-to-query-graph#query-limitati
55
https://docs.microsoft.com/samples/azure-samples/azure-samples-python-management/{{package_doc_id}}
66
https://pypi.org/project/azure-messaging-webpubsubservice/
77
https://github.com/Azure/azure-rest-api-specs-pr
8+
https://github.com/Azure/azure-sdk-for-python/tree/main/sdk/communication/azure-communication-rooms/samples
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
# Release History
2+
3+
## 1.0.0b1 (2022-02-15)
4+
5+
- Initial version
6+
Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
Copyright (c) Microsoft Corporation.
2+
3+
MIT License
4+
5+
Permission is hereby granted, free of charge, to any person obtaining a copy
6+
of this software and associated documentation files (the "Software"), to deal
7+
in the Software without restriction, including without limitation the rights
8+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9+
copies of the Software, and to permit persons to whom the Software is
10+
furnished to do so, subject to the following conditions:
11+
12+
The above copyright notice and this permission notice shall be included in all
13+
copies or substantial portions of the Software.
14+
15+
THE SOFTWARE IS PROVIDED *AS IS*, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21+
SOFTWARE.
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
include *.md
2+
include azure/__init__.py
3+
include azure/communication/__init__.py
4+
include LICENSE
5+
recursive-include tests *.py
6+
recursive-include samples *.py *.md
7+
include azure/communication/rooms/py.typed
Lines changed: 156 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,156 @@
1+
# Azure Communication Rooms client library for Python
2+
This package contains a Python SDK for Azure Communication Services for Rooms.
3+
Read more about Azure Communication Services [here](https://docs.microsoft.com/azure/communication-services/overview)
4+
5+
## _Disclaimer_
6+
7+
_Azure SDK Python packages support for Python 2.7 has ended 01 January 2022. For more information and questions, please
8+
refer to https://github.com/Azure/azure-sdk-for-python/issues/20691_
9+
10+
## Key concepts
11+
12+
The Azure Communication Rooms package is used to do following:
13+
- Create scheduled meetings
14+
- Create meetings with managed permissions for its participants
15+
## Getting started
16+
17+
### Installating the package
18+
19+
```bash
20+
python -m pip install azure-communication-rooms
21+
```
22+
23+
#### Prequisites
24+
25+
- Python 3.6 or later is required to use this package.
26+
- You need an [Azure subscription][azure_sub] to use this package.
27+
- A deployed Communication Services resource. You can use the [Azure Portal](https://docs.microsoft.com/azure/communication-services/quickstarts/create-communication-resource?tabs=windows&pivots=platform-azp) or the [Azure PowerShell](https://docs.microsoft.com/powershell/module/az.communication/new-azcommunicationservice) to set it up.
28+
29+
30+
### Client Initialization
31+
32+
To initialize the Rooms Client, the connection string can be used to instantiate.
33+
34+
```python
35+
from azure.communication.rooms import RoomsClient
36+
37+
client = RoomsClient.from_connection_string(conn_str='<connection_str>' )
38+
```
39+
## Examples
40+
41+
### Key parameters
42+
43+
- `valid_from`: A datetime object from which room will start existing
44+
- `valid_until`: A datetime object after which room meeting would end
45+
- `room_join_policy`: The join policy of the room. Allows only participants or any communication
46+
service users to join
47+
- `participants`: A list of RoomParticipant containing MRI's of invitees to the room
48+
All the above attributes are optional. The service provides default values of valid_until and
49+
valid_from if they are missing.
50+
51+
### Create Room
52+
```python
53+
from azure.communication.rooms import RoomsClient
54+
from azure.core.exceptions import HttpResponseError
55+
from datetime import datetime, timedelta
56+
57+
client = RoomsClient.from_connection_string(conn_str='<connection_str>')
58+
try:
59+
response = client.create_room(
60+
valid_from=datetime.now(),
61+
valid_until=valid_from + timedelta(weeks=4)
62+
participants=["first-participant", "second-participant"]
63+
)
64+
except HttpResponseError as e:
65+
print('service responds error: {}'.format(e))
66+
67+
```
68+
### Update Room
69+
```python
70+
from azure.communication.rooms import RoomsClient
71+
from azure.core.exceptions import HttpResponseError
72+
from datetime import datetime, timedelta
73+
74+
client = RoomsClient.from_connection_string(conn_str='<connection_str>')
75+
try:
76+
response = client.update_room(
77+
room_id="id of the room to be updated",
78+
valid_from=datetime.now(),
79+
valid_until=valid_from + timedelta(weeks=4)
80+
)
81+
except HttpResponseError as e:
82+
print('service responds error: {}'.format(e))
83+
84+
```
85+
86+
### Delete a Room
87+
```python
88+
from azure.communication.rooms import RoomsClient
89+
from azure.core.exceptions import HttpResponseError
90+
91+
client = RoomsClient.from_connection_string(conn_str='<connection_str>' )
92+
try:
93+
client.delete_room(
94+
room_id="id of the room to be deleted")
95+
except HttpResponseError as e:
96+
print('service responds error: {}'.format(e))
97+
98+
```
99+
100+
### Add participants to Room
101+
```python
102+
from azure.communication.rooms import RoomsClient
103+
from azure.core.exceptions import HttpResponseError
104+
105+
client = RoomsClient.from_connection_string(conn_str='<connection_str>' )
106+
try:
107+
response = client.add_participants(
108+
room_id="id of the room to be updated",
109+
participants=["new-participant-one", "new-participant-two"]
110+
)
111+
except HttpResponseError as e:
112+
print('service responds error: {}'.format(e))
113+
114+
```
115+
116+
Please take a look at the [samples](https://github.com/Azure/azure-sdk-for-python/tree/main/sdk/communication/azure-communication-rooms/samples) directory for detailed examples of how to use this library to create and manage rooms.
117+
118+
## Troubleshooting
119+
120+
Rooms operations will throw an exception if the request to the server fails. The Rooms client will raise exceptions defined in [Azure Core](https://github.com/Azure/azure-sdk-for-python/blob/main/sdk/core/azure-core/README.md).
121+
122+
123+
## Next steps
124+
### More sample code
125+
126+
More examples are coming soon...
127+
128+
## Provide Feedback
129+
130+
If you encounter any bugs or have suggestions, please file an issue in the [Issues](https://github.com/Azure/azure-sdk-for-python/issues) section of the project
131+
132+
## Contributing
133+
134+
This project welcomes contributions and suggestions. Most contributions require
135+
you to agree to a Contributor License Agreement (CLA) declaring that you have
136+
the right to, and actually do, grant us the rights to use your contribution.
137+
For details, visit https://cla.microsoft.com.
138+
139+
When you submit a pull request, a CLA-bot will automatically determine whether
140+
you need to provide a CLA and decorate the PR appropriately (e.g., label,
141+
comment). Simply follow the instructions provided by the bot. You will only
142+
need to do this once across all repos using our CLA.
143+
144+
This project has adopted the
145+
[Microsoft Open Source Code of Conduct][code_of_conduct]. For more information,
146+
see the Code of Conduct FAQ or contact opencode@microsoft.com with any
147+
additional questions or comments.
148+
149+
<!-- LINKS -->
150+
[code_of_conduct]: https://opensource.microsoft.com/codeofconduct/
151+
[authenticate_with_token]: https://docs.microsoft.com/azure/cognitive-services/authentication?tabs=powershell#authenticate-with-an-authentication-token
152+
[azure_identity_credentials]: https://github.com/Azure/azure-sdk-for-python/tree/main/sdk/identity/azure-identity#credentials
153+
[azure_identity_pip]: https://pypi.org/project/azure-identity/
154+
[default_azure_credential]: https://github.com/Azure/azure-sdk-for-python/tree/main/sdk/identity/azure-identity#defaultazurecredential
155+
[pip]: https://pypi.org/project/pip/
156+
[azure_sub]: https://azure.microsoft.com/free/
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
__path__ = __import__("pkgutil").extend_path(__path__, __name__)
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
__path__ = __import__("pkgutil").extend_path(__path__, __name__)
Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
# -------------------------------------------------------------------------
2+
# Copyright (c) Microsoft Corporation. All rights reserved.
3+
# Licensed under the MIT License. See License.txt in the project root for
4+
# license information.
5+
# --------------------------------------------------------------------------
6+
from ._rooms_client import RoomsClient
7+
from ._generated.models._enums import (
8+
RoomJoinPolicy,
9+
RoleType
10+
)
11+
from ._models import (
12+
CommunicationRoom,
13+
RoomParticipant,
14+
ParticipantsCollection
15+
)
16+
from ._version import VERSION
17+
18+
__all__ = [
19+
'CommunicationRoom',
20+
'RoomsClient',
21+
'RoomParticipant',
22+
'RoomJoinPolicy',
23+
'RoleType',
24+
'ParticipantsCollection'
25+
]
26+
27+
__VERSION__ = VERSION
Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
# ------------------------------------
2+
# Copyright (c) Microsoft Corporation.
3+
# Licensed under the MIT License.
4+
# ------------------------------------
5+
6+
from enum import Enum
7+
from azure.core import CaseInsensitiveEnumMeta
8+
9+
# pylint: disable=enum-must-be-uppercase
10+
class ApiVersion(str, Enum, metaclass=CaseInsensitiveEnumMeta):
11+
V2021_04_07_preview = "2021-04-07"
12+
V2022_02_01_preview = "2022-02-01"
13+
14+
DEFAULT_VERSION = ApiVersion.V2022_02_01_preview
Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
# coding=utf-8
2+
# --------------------------------------------------------------------------
3+
# Copyright (c) Microsoft Corporation. All rights reserved.
4+
# Licensed under the MIT License. See License.txt in the project root for license information.
5+
# Code generated by Microsoft (R) AutoRest Code Generator.
6+
# Changes may cause incorrect behavior and will be lost if the code is regenerated.
7+
# --------------------------------------------------------------------------
8+
9+
from ._client import AzureCommunicationRoomsService
10+
11+
try:
12+
from ._patch import __all__ as _patch_all
13+
from ._patch import * # type: ignore # pylint: disable=unused-wildcard-import
14+
except ImportError:
15+
_patch_all = []
16+
from ._patch import patch_sdk as _patch_sdk
17+
18+
__all__ = ["AzureCommunicationRoomsService"]
19+
__all__.extend([p for p in _patch_all if p not in __all__])
20+
21+
_patch_sdk()

0 commit comments

Comments
 (0)