Skip to content

Commit d805e21

Browse files
authored
Release Python WebPubSub SDK (#36807)
* remove unnecessary params * change release date * remove unnecessary params * remove add_connections_to_groups and remove_connections_to_groups --------- Co-authored-by: Chuong Nguyen <[email protected]>
1 parent 131e9ab commit d805e21

File tree

4 files changed

+2
-589
lines changed

4 files changed

+2
-589
lines changed

sdk/webpubsub/azure-messaging-webpubsubservice/CHANGELOG.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
# Release History
22

3-
## 1.2.0 (2024-08-02)
3+
## 1.2.0 (2024-08-08)
44

55
### Features Added
66
- Change API version to `2024-01-01`

sdk/webpubsub/azure-messaging-webpubsubservice/azure/messaging/webpubsubservice/_operations/_operations.py

Lines changed: 0 additions & 322 deletions
Original file line numberDiff line numberDiff line change
@@ -38,35 +38,6 @@
3838
_SERIALIZER.client_side_validation = False
3939

4040

41-
def build_web_pub_sub_service_add_connections_to_groups_request( # pylint: disable=name-too-long
42-
hub: str, **kwargs: Any
43-
) -> HttpRequest:
44-
_headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
45-
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
46-
47-
content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None))
48-
api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-01-01"))
49-
accept = _headers.pop("Accept", "application/json")
50-
51-
# Construct URL
52-
_url = "/api/hubs/{hub}/:addToGroups"
53-
path_format_arguments = {
54-
"hub": _SERIALIZER.url("hub", hub, "str", pattern=r"^[A-Za-z][A-Za-z0-9_`,.[\]]{0,127}$"),
55-
}
56-
57-
_url: str = _url.format(**path_format_arguments) # type: ignore
58-
59-
# Construct parameters
60-
_params["api-version"] = _SERIALIZER.query("api_version", api_version, "str")
61-
62-
# Construct headers
63-
if content_type is not None:
64-
_headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str")
65-
_headers["Accept"] = _SERIALIZER.header("accept", accept, "str")
66-
67-
return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs)
68-
69-
7041
def build_web_pub_sub_service_close_all_connections_request( # pylint: disable=name-too-long
7142
hub: str, *, excluded: Optional[List[str]] = None, reason: Optional[str] = None, **kwargs: Any
7243
) -> HttpRequest:
@@ -140,35 +111,6 @@ def build_web_pub_sub_service_get_client_access_token_request( # pylint: disabl
140111
return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs)
141112

142113

143-
def build_web_pub_sub_service_remove_connections_from_groups_request( # pylint: disable=name-too-long
144-
hub: str, **kwargs: Any
145-
) -> HttpRequest:
146-
_headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
147-
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
148-
149-
content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None))
150-
api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-01-01"))
151-
accept = _headers.pop("Accept", "application/json")
152-
153-
# Construct URL
154-
_url = "/api/hubs/{hub}/:removeFromGroups"
155-
path_format_arguments = {
156-
"hub": _SERIALIZER.url("hub", hub, "str", pattern=r"^[A-Za-z][A-Za-z0-9_`,.[\]]{0,127}$"),
157-
}
158-
159-
_url: str = _url.format(**path_format_arguments) # type: ignore
160-
161-
# Construct parameters
162-
_params["api-version"] = _SERIALIZER.query("api_version", api_version, "str")
163-
164-
# Construct headers
165-
if content_type is not None:
166-
_headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str")
167-
_headers["Accept"] = _SERIALIZER.header("accept", accept, "str")
168-
169-
return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs)
170-
171-
172114
def build_web_pub_sub_service_send_to_all_request( # pylint: disable=name-too-long
173115
hub: str,
174116
*,
@@ -739,138 +681,6 @@ def build_web_pub_sub_service_add_user_to_group_request( # pylint: disable=name
739681

740682
class WebPubSubServiceClientOperationsMixin(WebPubSubServiceClientMixinABC): # pylint: disable=too-many-public-methods
741683

742-
@overload
743-
def add_connections_to_groups( # pylint: disable=inconsistent-return-statements
744-
self, hub: str, groups_to_add: JSON, *, content_type: str = "application/json", **kwargs: Any
745-
) -> None:
746-
"""Add filtered connections to multiple groups.
747-
748-
Add filtered connections to multiple groups.
749-
750-
:param hub: Target hub name, which should start with alphabetic characters and only contain
751-
alpha-numeric characters or underscore. Required.
752-
:type hub: str
753-
:param groups_to_add: Target groups and connection filter. Required.
754-
:type groups_to_add: JSON
755-
:keyword content_type: Body Parameter content-type. Content type parameter for JSON body.
756-
Default value is "application/json".
757-
:paramtype content_type: str
758-
:return: None
759-
:rtype: None
760-
:raises ~azure.core.exceptions.HttpResponseError:
761-
762-
Example:
763-
.. code-block:: python
764-
765-
# JSON input template you can fill out and use as your body input.
766-
groups_to_add = {
767-
"filter": "str",
768-
"groups": [
769-
"str"
770-
]
771-
}
772-
"""
773-
774-
@overload
775-
def add_connections_to_groups( # pylint: disable=inconsistent-return-statements
776-
self, hub: str, groups_to_add: IO[bytes], *, content_type: str = "application/json", **kwargs: Any
777-
) -> None:
778-
"""Add filtered connections to multiple groups.
779-
780-
Add filtered connections to multiple groups.
781-
782-
:param hub: Target hub name, which should start with alphabetic characters and only contain
783-
alpha-numeric characters or underscore. Required.
784-
:type hub: str
785-
:param groups_to_add: Target groups and connection filter. Required.
786-
:type groups_to_add: IO[bytes]
787-
:keyword content_type: Body Parameter content-type. Content type parameter for binary body.
788-
Default value is "application/json".
789-
:paramtype content_type: str
790-
:return: None
791-
:rtype: None
792-
:raises ~azure.core.exceptions.HttpResponseError:
793-
"""
794-
795-
@distributed_trace
796-
def add_connections_to_groups( # pylint: disable=inconsistent-return-statements
797-
self, hub: str, groups_to_add: Union[JSON, IO[bytes]], **kwargs: Any
798-
) -> None:
799-
"""Add filtered connections to multiple groups.
800-
801-
Add filtered connections to multiple groups.
802-
803-
:param hub: Target hub name, which should start with alphabetic characters and only contain
804-
alpha-numeric characters or underscore. Required.
805-
:type hub: str
806-
:param groups_to_add: Target groups and connection filter. Is either a JSON type or a IO[bytes]
807-
type. Required.
808-
:type groups_to_add: JSON or IO[bytes]
809-
:return: None
810-
:rtype: None
811-
:raises ~azure.core.exceptions.HttpResponseError:
812-
813-
Example:
814-
.. code-block:: python
815-
816-
# JSON input template you can fill out and use as your body input.
817-
groups_to_add = {
818-
"filter": "str",
819-
"groups": [
820-
"str"
821-
]
822-
}
823-
"""
824-
error_map: MutableMapping[int, Type[HttpResponseError]] = {
825-
401: ClientAuthenticationError,
826-
404: ResourceNotFoundError,
827-
409: ResourceExistsError,
828-
304: ResourceNotModifiedError,
829-
}
830-
error_map.update(kwargs.pop("error_map", {}) or {})
831-
832-
_headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
833-
_params = kwargs.pop("params", {}) or {}
834-
835-
content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None))
836-
cls: ClsType[None] = kwargs.pop("cls", None)
837-
838-
content_type = content_type or "application/json"
839-
_json = None
840-
_content = None
841-
if isinstance(groups_to_add, (IOBase, bytes)):
842-
_content = groups_to_add
843-
else:
844-
_json = groups_to_add
845-
846-
_request = build_web_pub_sub_service_add_connections_to_groups_request(
847-
hub=hub,
848-
content_type=content_type,
849-
api_version=self._config.api_version,
850-
json=_json,
851-
content=_content,
852-
headers=_headers,
853-
params=_params,
854-
)
855-
path_format_arguments = {
856-
"endpoint": self._serialize.url("self._config.endpoint", self._config.endpoint, "str", skip_quote=True),
857-
}
858-
_request.url = self._client.format_url(_request.url, **path_format_arguments)
859-
860-
_stream = False
861-
pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access
862-
_request, stream=_stream, **kwargs
863-
)
864-
865-
response = pipeline_response.http_response
866-
867-
if response.status_code not in [200]:
868-
map_error(status_code=response.status_code, response=response, error_map=error_map)
869-
raise HttpResponseError(response=response)
870-
871-
if cls:
872-
return cls(pipeline_response, None, {}) # type: ignore
873-
874684
@distributed_trace
875685
def close_all_connections( # pylint: disable=inconsistent-return-statements
876686
self, *, excluded: Optional[List[str]] = None, reason: Optional[str] = None, **kwargs: Any
@@ -1018,138 +828,6 @@ def get_client_access_token(
1018828

1019829
return cast(JSON, deserialized) # type: ignore
1020830

1021-
@overload
1022-
def remove_connections_from_groups( # pylint: disable=inconsistent-return-statements
1023-
self, hub: str, groups_to_remove: JSON, *, content_type: str = "application/json", **kwargs: Any
1024-
) -> None:
1025-
"""Remove filtered connections from multiple groups.
1026-
1027-
Remove filtered connections from multiple groups.
1028-
1029-
:param hub: Target hub name, which should start with alphabetic characters and only contain
1030-
alpha-numeric characters or underscore. Required.
1031-
:type hub: str
1032-
:param groups_to_remove: Target groups and connection filter. Required.
1033-
:type groups_to_remove: JSON
1034-
:keyword content_type: Body Parameter content-type. Content type parameter for JSON body.
1035-
Default value is "application/json".
1036-
:paramtype content_type: str
1037-
:return: None
1038-
:rtype: None
1039-
:raises ~azure.core.exceptions.HttpResponseError:
1040-
1041-
Example:
1042-
.. code-block:: python
1043-
1044-
# JSON input template you can fill out and use as your body input.
1045-
groups_to_remove = {
1046-
"filter": "str",
1047-
"groups": [
1048-
"str"
1049-
]
1050-
}
1051-
"""
1052-
1053-
@overload
1054-
def remove_connections_from_groups( # pylint: disable=inconsistent-return-statements
1055-
self, hub: str, groups_to_remove: IO[bytes], *, content_type: str = "application/json", **kwargs: Any
1056-
) -> None:
1057-
"""Remove filtered connections from multiple groups.
1058-
1059-
Remove filtered connections from multiple groups.
1060-
1061-
:param hub: Target hub name, which should start with alphabetic characters and only contain
1062-
alpha-numeric characters or underscore. Required.
1063-
:type hub: str
1064-
:param groups_to_remove: Target groups and connection filter. Required.
1065-
:type groups_to_remove: IO[bytes]
1066-
:keyword content_type: Body Parameter content-type. Content type parameter for binary body.
1067-
Default value is "application/json".
1068-
:paramtype content_type: str
1069-
:return: None
1070-
:rtype: None
1071-
:raises ~azure.core.exceptions.HttpResponseError:
1072-
"""
1073-
1074-
@distributed_trace
1075-
def remove_connections_from_groups( # pylint: disable=inconsistent-return-statements
1076-
self, hub: str, groups_to_remove: Union[JSON, IO[bytes]], **kwargs: Any
1077-
) -> None:
1078-
"""Remove filtered connections from multiple groups.
1079-
1080-
Remove filtered connections from multiple groups.
1081-
1082-
:param hub: Target hub name, which should start with alphabetic characters and only contain
1083-
alpha-numeric characters or underscore. Required.
1084-
:type hub: str
1085-
:param groups_to_remove: Target groups and connection filter. Is either a JSON type or a
1086-
IO[bytes] type. Required.
1087-
:type groups_to_remove: JSON or IO[bytes]
1088-
:return: None
1089-
:rtype: None
1090-
:raises ~azure.core.exceptions.HttpResponseError:
1091-
1092-
Example:
1093-
.. code-block:: python
1094-
1095-
# JSON input template you can fill out and use as your body input.
1096-
groups_to_remove = {
1097-
"filter": "str",
1098-
"groups": [
1099-
"str"
1100-
]
1101-
}
1102-
"""
1103-
error_map: MutableMapping[int, Type[HttpResponseError]] = {
1104-
401: ClientAuthenticationError,
1105-
404: ResourceNotFoundError,
1106-
409: ResourceExistsError,
1107-
304: ResourceNotModifiedError,
1108-
}
1109-
error_map.update(kwargs.pop("error_map", {}) or {})
1110-
1111-
_headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
1112-
_params = kwargs.pop("params", {}) or {}
1113-
1114-
content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None))
1115-
cls: ClsType[None] = kwargs.pop("cls", None)
1116-
1117-
content_type = content_type or "application/json"
1118-
_json = None
1119-
_content = None
1120-
if isinstance(groups_to_remove, (IOBase, bytes)):
1121-
_content = groups_to_remove
1122-
else:
1123-
_json = groups_to_remove
1124-
1125-
_request = build_web_pub_sub_service_remove_connections_from_groups_request(
1126-
hub=hub,
1127-
content_type=content_type,
1128-
api_version=self._config.api_version,
1129-
json=_json,
1130-
content=_content,
1131-
headers=_headers,
1132-
params=_params,
1133-
)
1134-
path_format_arguments = {
1135-
"endpoint": self._serialize.url("self._config.endpoint", self._config.endpoint, "str", skip_quote=True),
1136-
}
1137-
_request.url = self._client.format_url(_request.url, **path_format_arguments)
1138-
1139-
_stream = False
1140-
pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access
1141-
_request, stream=_stream, **kwargs
1142-
)
1143-
1144-
response = pipeline_response.http_response
1145-
1146-
if response.status_code not in [200]:
1147-
map_error(status_code=response.status_code, response=response, error_map=error_map)
1148-
raise HttpResponseError(response=response)
1149-
1150-
if cls:
1151-
return cls(pipeline_response, None, {}) # type: ignore
1152-
1153831
@distributed_trace
1154832
def send_to_all( # pylint: disable=inconsistent-return-statements
1155833
self,

0 commit comments

Comments
 (0)