Skip to content

Commit

Permalink
Relay: Fixed issue #8775 : (#9900)
Browse files Browse the repository at this point in the history
* Fixed issue #8775 : Cannot create hybrid connection with disabled client authroization

* added help for relay wcfrelay update, `requires_transport_security`

* fixed lint

* fixed pylint

* updated histroy and review comments
  • Loading branch information
Ajit Navasare authored and tjprescott committed Jul 10, 2019
1 parent a9c6948 commit 2c54f65
Show file tree
Hide file tree
Showing 7 changed files with 2,956 additions and 1,556 deletions.
5 changes: 5 additions & 0 deletions src/azure-cli/HISTORY.rst
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,11 @@ Release History
* Add optional parameter to specify replica SKU for create replica command.
* Fix the issue with CI test failure with creating MySQL replica.

**Relay**

* Fixed issue #8775 : Cannot create hybrid connection with disabled client authroization
* Added parameter "--requires-transport-security" to az relay wcfrelay create

**Storage**

* Enable Files AADDS for storage account update.
Expand Down
19 changes: 5 additions & 14 deletions src/azure-cli/azure/cli/command_modules/relay/_params.py
Original file line number Diff line number Diff line change
Expand Up @@ -61,24 +61,15 @@ def load_arguments_sb(self, _):
with self.argument_context('relay wcfrelay') as c:
c.argument('relay_name', arg_type=name_type, id_part='child_name_1', completer=get_wcfrelay_command_completion_list, help='Name of WCF Relay')

# region - WCF Relay Create
for scope in ['relay wcfrelay show', 'relay wcfrelay delete']:
for scope in ['relay wcfrelay create', 'relay wcfrelay update']:
with self.argument_context(scope) as c:
c.argument('relay_name', arg_type=name_type, id_part='child_name_1', completer=get_wcfrelay_command_completion_list, help='Name of WCF Relay')
c.argument('status', arg_type=get_enum_type(['Active', 'Disabled', 'SendDisabled', 'ReceiveDisabled']), help='Enumerates the possible values for the status of a messaging entity.')
c.argument('relay_type', arg_type=get_enum_type(['Http', 'NetTcp']), default='NetTcp', help='Relay type')
c.argument('user_metadata', help='Endpoint metadata')

with self.argument_context('relay wcfrelay create') as c:
c.argument('relay_name', arg_type=name_type, id_part='child_name_1', help='Name of WCF Relay')
c.argument('status', arg_type=get_enum_type(['Active', 'Disabled', 'SendDisabled', 'ReceiveDisabled']), help='Enumerates the possible values for the status of a messaging entity.')
c.argument('relay_type', arg_type=get_enum_type(['Http', 'NetTcp']), default='NetTcp', help='Relay type')
c.argument('requires_client_authorization', arg_type=get_three_state_flag(), help='Indicates whether client authorization is required')
c.argument('user_metadata', help='Endpoint metadata')

with self.argument_context('relay wcfrelay update') as c:
c.argument('relay_name', arg_type=name_type, id_part='child_name_1', help='Name of WCF Relay')
c.argument('status', arg_type=get_enum_type(['Active', 'Disabled', 'SendDisabled', 'ReceiveDisabled']), help='Enumerates the possible values for the status of a messaging entity.')
c.argument('relay_type', arg_type=get_enum_type(['Http', 'NetTcp']), default='NetTcp', help='Relay type')
c.argument('requires_client_authorization', arg_type=get_three_state_flag(), help='Indicates whether client authorization is required')
c.argument('user_metadata', help='Endpoint metadata')
c.argument('requires_transport_security', arg_type=get_three_state_flag(), help='Indicates whether transport security is required')

with self.argument_context('relay wcfrelay list') as c:
c.argument('namespace_name', id_part=None, options_list=['--namespace-name'], help='Name of Namespace')
Expand Down
18 changes: 6 additions & 12 deletions src/azure-cli/azure/cli/command_modules/relay/custom.py
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ def cli_namespaceautho_update(instance, rights):

# WCF Relay Region
def cli_wcfrelay_create(client, resource_group_name, namespace_name, relay_name, relay_type,
requires_client_authorization=None, user_metadata=None):
requires_client_authorization=None, requires_transport_security=None, user_metadata=None):

from azure.mgmt.relay.models import WcfRelay, Relaytype

Expand All @@ -70,6 +70,7 @@ def cli_wcfrelay_create(client, resource_group_name, namespace_name, relay_name,
wcfrelay_params = WcfRelay(
relay_type=set_relay_type,
requires_client_authorization=requires_client_authorization,
requires_transport_security=requires_transport_security,
user_metadata=user_metadata
)

Expand All @@ -80,20 +81,17 @@ def cli_wcfrelay_create(client, resource_group_name, namespace_name, relay_name,
parameters=wcfrelay_params)


def cli_wcfrelay_update(instance, relay_type=None,
requires_client_authorization=None, user_metadata=None, status=None):
def cli_wcfrelay_update(instance, relay_type=None, user_metadata=None, status=None):

from azure.mgmt.relay.models import WcfRelay
returnobj = WcfRelay(relay_type=instance.relay_type,
requires_client_authorization=instance.requires_client_authorization,
requires_transport_security=instance.requires_transport_security,
user_metadata=instance.user_metadata)

if relay_type:
returnobj.relay_type = relay_type

if requires_client_authorization:
returnobj.requires_client_authorization = requires_client_authorization

if user_metadata:
returnobj.user_metadata = user_metadata

Expand All @@ -106,16 +104,12 @@ def cli_wcfrelay_update(instance, relay_type=None,
# Hybrid Connection Region
def cli_hyco_create(client, resource_group_name, namespace_name, hybrid_connection_name,
requires_client_authorization=None, user_metadata=None):
from azure.mgmt.relay.models import HybridConnection
hyco_params = HybridConnection(
requires_client_authorization=requires_client_authorization,
user_metadata=user_metadata
)

return client.create_or_update(
resource_group_name=resource_group_name,
namespace_name=namespace_name,
hybrid_connection_name=hybrid_connection_name,
parameters=hyco_params)
requires_client_authorization=requires_client_authorization, user_metadata=user_metadata)


def cli_hyco_update(instance, requires_client_authorization=None, status=None, user_metadata=None):
Expand Down
Loading

0 comments on commit 2c54f65

Please sign in to comment.