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

[webpubsub] Add kind property to support Web PubSub for Socket.IO #6582

Merged
merged 2 commits into from
Aug 1, 2023
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
4 changes: 4 additions & 0 deletions src/webpubsub/HISTORY.rst
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,10 @@
Release History
===============

1.3.0
+++++
* Add `kind` support for creating resource

1.2.0
+++++
* Drop python 3.6 support
Expand Down
3 changes: 3 additions & 0 deletions src/webpubsub/azext_webpubsub/_help.py
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,9 @@
- name: Create a WebPubSub Service with Standard SKU and unit 2.
text: >
az webpubsub create -n MyWebPubSub -g MyResourceGroup --sku Standard_S1 --unit-count 2
- name: Create a Web PubSub for Socket.IO with Premium SKU and unit 1.
text: >
az webpubsub create -n MyWebPubSub -g MyResourceGroup --sku Premium_P1 --unit-count 1 --kind SocketIO
"""

helps['webpubsub list'] = """
Expand Down
1 change: 1 addition & 0 deletions src/webpubsub/azext_webpubsub/_params.py
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@ def load_arguments(self, _):
with self.argument_context('webpubsub create') as c:
c.argument('sku', help='The sku name of the webpubsub service. Allowed values: Free_F1, Standard_S1, Premium_P1')
c.argument('unit_count', help='The number of webpubsub service unit count', type=int)
c.argument('kind', help='The kind of the webpubsub service. Allowed values: WebPubSub, SocketIO')

with self.argument_context('webpubsub update') as c:
c.argument('sku', help='The sku name of the webpubsub service. Allowed values: Free_F1, Standard_S1, Premium_P1')
Expand Down
5 changes: 3 additions & 2 deletions src/webpubsub/azext_webpubsub/custom.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,12 +14,13 @@
)


def webpubsub_create(client, resource_group_name, webpubsub_name, sku, unit_count=1, location=None, tags=None):
def webpubsub_create(client: WebPubSubOperations, resource_group_name, webpubsub_name, sku, unit_count=1, location=None, tags=None, kind=None):
sku = ResourceSku(name=sku, capacity=unit_count)
parameter = WebPubSubResource(
sku=sku,
location=location,
tags=tags
tags=tags,
kind=kind
)

return client.begin_create_or_update(resource_group_name, webpubsub_name, parameter)
Expand Down
8 changes: 6 additions & 2 deletions src/webpubsub/azext_webpubsub/network.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,13 @@
WebPubSubResource
)

from .vendored_sdks.azure_mgmt_webpubsub.operations import (
WebPubSubOperations
)


# pylint: disable=dangerous-default-value
def update_network_rules(client, webpubsub_name, resource_group_name, public_network, connection_name=[], allow=[], deny=[]):
def update_network_rules(client: WebPubSubOperations, webpubsub_name, resource_group_name, public_network, connection_name=[], allow=[], deny=[]):
resource = client.get(resource_group_name, webpubsub_name)
network_acl = resource.network_ac_ls
if public_network:
Expand All @@ -23,7 +27,7 @@ def update_network_rules(client, webpubsub_name, resource_group_name, public_net
x.allow = allow
x.deny = deny

return client.begin_update(resource_group_name, webpubsub_name, WebPubSubResource(network_ac_ls=network_acl))
return client.begin_update(resource_group_name, webpubsub_name, WebPubSubResource(location=resource.location, network_ac_ls=network_acl))


def list_network_rules(client, webpubsub_name, resource_group_name):
Expand Down
401 changes: 196 additions & 205 deletions src/webpubsub/azext_webpubsub/tests/latest/recordings/test_webpubsub.yaml

Large diffs are not rendered by default.

Large diffs are not rendered by default.

Loading