diff --git a/.github/CODEOWNERS b/.github/CODEOWNERS index 3a79cc31598..da58bc9d6d9 100644 --- a/.github/CODEOWNERS +++ b/.github/CODEOWNERS @@ -12,4 +12,6 @@ /src/aem/ @yugangw-msft +/src/relay/ @v-ajnava + /src/subscription/ @wilcobmsft diff --git a/src/relay/azext_relay/__init__.py b/src/relay/azext_relay/__init__.py new file mode 100644 index 00000000000..1e4361f4481 --- /dev/null +++ b/src/relay/azext_relay/__init__.py @@ -0,0 +1,31 @@ +# -------------------------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# -------------------------------------------------------------------------------------------- + +from azure.cli.core import AzCommandsLoader + +# pylint: disable=unused-import +# pylint: disable=line-too-long + +from ._help import helps + + +class RelayCommandsLoader(AzCommandsLoader): + + def __init__(self, cli_ctx=None): + from azure.cli.core.commands import CliCommandType + relay_custom = CliCommandType(operations_tmpl='azext_relay.custom#{}') + super(RelayCommandsLoader, self).__init__(cli_ctx=cli_ctx, custom_command_type=relay_custom, min_profile="2017-03-10-profile") + + def load_command_table(self, args): + from .commands import load_command_table + load_command_table(self, args) + return self.command_table + + def load_arguments(self, command): + from ._params import load_arguments_relayparams + load_arguments_relayparams(self, command) + + +COMMAND_LOADER_CLS = RelayCommandsLoader diff --git a/src/relay/azext_relay/_client_factory.py b/src/relay/azext_relay/_client_factory.py new file mode 100644 index 00000000000..eb91c4293c2 --- /dev/null +++ b/src/relay/azext_relay/_client_factory.py @@ -0,0 +1,22 @@ +# -------------------------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# -------------------------------------------------------------------------------------------- + + +def cf_relay(cli_ctx, **_): + from azure.cli.core.commands.client_factory import get_mgmt_service_client + from azext_relay.relay import RelayManagementClient + return get_mgmt_service_client(cli_ctx, RelayManagementClient) + + +def namespaces_mgmt_client_factory(cli_ctx, _): + return cf_relay(cli_ctx).namespaces + + +def wcfrelay_mgmt_client_factory(cli_ctx, _): + return cf_relay(cli_ctx).wcf_relays + + +def hydrid_connections_mgmt_client_factory(cli_ctx, _): + return cf_relay(cli_ctx).hybrid_connections diff --git a/src/relay/azext_relay/_help.py b/src/relay/azext_relay/_help.py new file mode 100644 index 00000000000..8386e067826 --- /dev/null +++ b/src/relay/azext_relay/_help.py @@ -0,0 +1,306 @@ +# -------------------------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# -------------------------------------------------------------------------------------------- + +from knack.help_files import helps + +helps['relay'] = """ + type: group + short-summary: Manage Azure Relay Namespace, WCF Relays and Hybrid Connections +""" + +helps['relay namespace'] = """ + type: group + short-summary: Manage Azure Relay Namespace and AuthorizationRule +""" + +helps['relay namespace authorization-rule'] = """ + type: group + short-summary: Manage Azure Relay AuthorizationRule for Namespace +""" + +helps['relay namespace authorization-rule keys'] = """ + type: group + short-summary: Manage Azure Relay AuthorizationRule connection strings for Namespace +""" + +helps['relay wcf-relay'] = """ + type: group + short-summary: Manage Azure Relay's WCF Relays and AuthorizationRule +""" + +helps['relay wcf-relay authorization-rule'] = """ + type: group + short-summary: Manage Azure Relay AuthorizationRule for WCF Relay +""" + +helps['relay wcf-relay authorization-rule keys'] = """ + type: group + short-summary: Manage Azure AuthorizationRule connection strings for WCF Relay +""" + +helps['relay hybrid-connections'] = """ + type: group + short-summary: Manage Azure Relay's Hybrid Connections and AuthorizationRule +""" + +helps['relay hybrid-connections authorization-rule'] = """ + type: group + short-summary: Manage Azure Relay AuthorizationRule for Hybrid Connections +""" + +helps['relay hybrid-connections authorization-rule keys'] = """ + type: group + short-summary: Manage Azure AuthorizationRule connection strings for Hybrid Connections +""" + +helps['relay namespace exists'] = """ + type: command + short-summary: check for the availability of the given name for the Namespace + examples: + - name: check for the availability of the given name for the Namespace. + text: az relay namespace exists --name mynamespace +""" + +helps['relay namespace create'] = """ + type: command + short-summary: Creates the Relay Namespace + examples: + - name: Create a new namespace. + text: az relay namespace create --resource-group myresourcegroup --name mynamespace --location westus --tags tag1=value1 tag2=value2 --sku-name Standard --sku-tier +""" + +helps['relay namespace show'] = """ + type: command + short-summary: shows the Relay Namespace Details + examples: + - name: shows the Namespace details. + text: az relay namespace show --resource-group myresourcegroup --name mynamespace +""" + +helps['relay namespace list'] = """ + type: command + short-summary: Lists the Relay Namespaces + examples: + - name: List the Relay Namespaces by resource group. + text: az relay namespace list --resource-group myresourcegroup + - name: Get the Namespaces by Subscription. + text: az relay namespace list +""" + +helps['relay namespace delete'] = """ + type: command + short-summary: Deletes the Namespaces + examples: + - name: Deletes the Namespace + text: az relay namespace delete --resource-group myresourcegroup --name mynamespace +""" + +helps['relay namespace authorization-rule create'] = """ + type: command + short-summary: Creates AuthorizationRule for the given Namespace + examples: + - name: Creates Authorization rules + text: az relay namespace authorization-rule create --resource-group myresourcegroup --namespace-name mynamespace --name myauthorule --access-rights Send Listen +""" + +helps['relay namespace authorization-rule show'] = """ + type: command + short-summary: Shows the details of AuthorizationRule + examples: + - name: Shows the details of AuthorizationRule + text: az relay namespace authorization-rule show --resource-group myresourcegroup --namespace-name mynamespace --name myauthorule +""" + +helps['relay namespace authorization-rule list'] = """ + type: command + short-summary: Shows the list of AuthorizationRule by Namespace + examples: + - name: Shows the list of AuthorizationRule by Namespace + text: az relay namespace authorization-rule show --resource-group myresourcegroup --namespace-name mynamespace +""" + +helps['relay namespace authorization-rule keys list'] = """ + type: command + short-summary: Shows the connection strings for namespace + examples: + - name: Shows the connectionstrings of AuthorizationRule for the namespace. + text: az relay namespace authorization-rule list-keys --resource-group myresourcegroup --namespace-name mynamespace --name myauthorule +""" + +helps['relay namespace authorization-rule keys renew'] = """ + type: command + short-summary: Regenerate the connection strings of AuthorizationRule for the namespace. + examples: + - name: Regenerate the connectionstrings of AuthorizationRule for the namespace. + text: az relay namespace authorization-rule regenerate-keys --resource-group myresourcegroup --namespace-name mynamespace --name myauthorule --key PrimaryKey +""" + +helps['relay namespace authorization-rule delete'] = """ + type: command + short-summary: Deletes the AuthorizationRule of the namespace. + examples: + - name: Deletes the AuthorizationRule of the namespace. + text: az relay namespace authorization-rule delete --resource-group myresourcegroup --namespace-name mynamespace --name myauthorule +""" + +helps['relay wcf-relay create'] = """ + type: command + short-summary: Creates the Relay's WCF Relays + examples: + - name: Create a new WCF Relays. + text: az relay wcf-relay create --resource-group myresourcegroup --namespace-name mynamespace --name mywcfrelay --relay-type NetTcp --requires-client-authorization true --requires-transport-security true --user-metadata 'User Metadata' +""" + +helps['relay wcf-relay show'] = """ + type: command + short-summary: shows the WCF Relays Details + examples: + - name: Shows the WCF Relays details. + text: az relay wcf-relay show --resource-group myresourcegroup --namespace-name mynamespace --name mywcfrelay +""" + +helps['relay wcf-relay list'] = """ + type: command + short-summary: List the WCF Relays by Namepsace + examples: + - name: Get the WCF Relays by Namespace. + text: az relay wcf-relay list --resource-group myresourcegroup --namespace-name mynamespace +""" + +helps['relay wcf-relay delete'] = """ + type: command + short-summary: Deletes the WCF Relays + examples: + - name: Deletes the WCF Relays + text: az relay wcf-relay delete --resource-group myresourcegroup --namespace-name mynamespace --name mywcfrelay +""" + +helps['relay wcf-relay authorization-rule create'] = """ + type: command + short-summary: Creates Authorization rule for the given WCF Relays + examples: + - name: Creates Authorization rules + text: az relay wcf-relay authorization-rule create --resource-group myresourcegroup --namespace-name mynamespace --wcfrelay-name mywcfrelay --name myauthorule --access-rights Listen +""" + +helps['relay wcf-relay authorization-rule show'] = """ + type: command + short-summary: shows the details of AuthorizationRule + examples: + - name: shows the details of AuthorizationRule + text: az relay wcf-relay authorization-rule show --resource-group myresourcegroup --namespace-name mynamespace --wcfrelay-name mywcfrelay --name myauthorule +""" + +helps['relay wcf-relay authorization-rule list'] = """ + type: command + short-summary: shows the list of AuthorizationRule by WCF Relays + examples: + - name: shows the list of AuthorizationRule by WCF Relays + text: az relay wcf-relay authorization-rule show --resource-group myresourcegroup --namespace-name mynamespace --wcfrelay-name mywcfrelay +""" + +helps['relay wcf-relay authorization-rule keys list'] = """ + type: command + short-summary: Shows the connection strings of AuthorizationRule for the WCF Relays. + examples: + - name: Shows the connection strings of AuthorizationRule for the WCF Relays. + text: az relay wcf-relay authorization-rule list-keys --resource-group myresourcegroup --namespace-name mynamespace --wcfrelay-name mywcfrelay --name myauthorule +""" + +helps['relay wcf-relay authorization-rule keys renew'] = """ + type: command + short-summary: Regenerate the connection strings of AuthorizationRule for the namespace. + examples: + - name: Regenerate the connection strings of AuthorizationRule for the namespace. + text: az relay wcf-relay authorization-rule regenerate-keys --resource-group myresourcegroup --namespace-name mynamespace --wcfrelay-name mywcfrelay --name myauthorule --key PrimaryKey +""" + +helps['relay wcf-relay authorization-rule delete'] = """ + type: command + short-summary: Deletes the AuthorizationRule of the WCF Relays + examples: + - name: Deletes the AuthorizationRule of the WCF Relays + text: az relay wcf-relay authorization-rule delete --resource-group myresourcegroup --namespace-name mynamespace --wcfrelay-name mywcfrelay --name myauthorule +""" + +helps['relay hybrid-connections create'] = """ + type: command + short-summary: Creates the Realy's Hybrid Connections + examples: + - name: Create a new Realy's Hybrid Connections. + text: az relay hybrid-connections create --resource-group myresourcegroup --namespace-name mynamespace --name myhybridconnection --requires-client-authorization true --user-metadata 'User Metadata' +""" + +helps['relay hybrid-connections show'] = """ + type: command + short-summary: shows the Hybrid Connections Details + examples: + - name: Shows the Hybrid Connections details. + text: az relay hybrid-connections show --resource-group myresourcegroup --namespace-name mynamespace --name myhybridconnection +""" + +helps['relay hybrid-connections list'] = """ + type: command + short-summary: List the Hybrid Connections by Namepsace + examples: + - name: Get the Hybrid Connections by Namespace. + text: az relay hybrid-connections list --resource-group myresourcegroup --namespace-name mynamespace +""" + +helps['relay hybrid-connections delete'] = """ + type: command + short-summary: Deletes the Hybrid Connections + examples: + - name: Deletes the Hybrid Connections + text: az relay hybrid-connections delete --resource-group myresourcegroup --namespace-name mynamespace --name myhybridconnection +""" + +helps['relay hybrid-connections authorization-rule create'] = """ + type: command + short-summary: Creates Authorization rule for the given Hybrid Connections + examples: + - name: Creates Authorization rules + text: az relay hybrid-connections authorization-rule create --resource-group myresourcegroup --namespace-name mynamespace --hybrid-connection-name myhybridconnection --name myauthorule --access-rights Listen +""" + +helps['relay hybrid-connections authorization-rule show'] = """ + type: command + short-summary: shows the details of AuthorizationRule + examples: + - name: shows the details of AuthorizationRule + text: az relay hybrid-connection authorization-rule show --resource-group myresourcegroup --namespace-name mynamespace --hybrid-connection-name myhybridconnection --name myauthorule +""" + +helps['relay hybrid-connection authorization-rule list'] = """ + type: command + short-summary: shows the list of AuthorizationRule by Hybrid Connections + examples: + - name: shows the list of AuthorizationRule by Hybrid Connections + text: az relay hybrid-connections authorization-rule show --resource-group myresourcegroup --namespace-name mynamespace --hybrid-connection-name myhybridconnection +""" + +helps['relay hybrid-connections authorization-rule keys list'] = """ + type: command + short-summary: Shows the connection strings of AuthorizationRule for the Hybrid Connections. + examples: + - name: Shows the connection strings of AuthorizationRule for the Hybrid Connections. + text: az relay hybrid-connections authorization-rule list-keys --resource-group myresourcegroup --namespace-name mynamespace --hybrid-connection-name myhybridconnection --name myauthorule +""" + +helps['relay hybrid-connections authorization-rule keys renew'] = """ + type: command + short-summary: Regenerate the connection strings of AuthorizationRule for the namespace. + examples: + - name: Regenerate the connection strings of AuthorizationRule for the namespace. + text: az relay hybrid-connections authorization-rule regenerate-keys --resource-group myresourcegroup --namespace-name mynamespace --hybrid-connection-name myhybridconnection --name myauthorule --key PrimaryKey +""" + +helps['relay hybrid-connections authorization-rule delete'] = """ + type: command + short-summary: Deletes the AuthorizationRule of the Hybrid Connections. + examples: + - name: Deletes the AuthorizationRule of the Hybrid Connections. + text: az relay hybrid-connections authorization-rule delete --resource-group myresourcegroup --namespace-name mynamespace --hybrid-connection-name myhybridconnection --name myauthorule +""" diff --git a/src/relay/azext_relay/_params.py b/src/relay/azext_relay/_params.py new file mode 100644 index 00000000000..b463fe84d43 --- /dev/null +++ b/src/relay/azext_relay/_params.py @@ -0,0 +1,79 @@ +# -------------------------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# -------------------------------------------------------------------------------------------- +# pylint: disable=line-too-long + +from azure.cli.core.commands.parameters import (tags_type, get_enum_type, get_location_type, name_type, resource_group_name_type, get_three_state_flag) +from knack.arguments import CLIArgumentType +from azext_relay.relay.models.relay_management_client_enums import AccessRights, KeyType, SkuTier, Relaytype + + +rights_arg_type = CLIArgumentType(options_list=['--access-rights'], nargs='+', type=str, arg_type=get_enum_type(AccessRights), help='Authorization rule rights of type list') +key_arg_type = CLIArgumentType(options_list=['--key-name'], arg_type=get_enum_type(KeyType), help='specifies Primary or Secondary key needs to be reset') + + +def load_arguments_relayparams(self, _): + with self.argument_context('relay') as c: + c.argument('resource_group_name', arg_type=resource_group_name_type) + c.argument('namespace_name', options_list=['--namespace-name'], help='name of the Namespace') + + with self.argument_context('relay namespace') as c: + c.argument('namespace_name', arg_type=name_type, help='name of the Namespace') + + with self.argument_context('relay namespace create') as c: + c.argument('tags', arg_type=tags_type) + c.argument('location', arg_type=get_location_type(self.cli_ctx)) + c.argument('skutier', options_list=['--sku-tier'], arg_type=get_enum_type(SkuTier)) + c.argument('capacity', options_list=['--capacity'], type=int, help='Capacity for Sku') + + for scope in ['relay namespace authorization-rule', 'relay namespace authorization-rule keys renew', 'relay namespace authorization-rule keys list']: + with self.argument_context(scope) as c: + c.argument('authorization_rule_name', arg_type=name_type, help='name of the Namespace AuthorizationRule') + c.argument('namespace_name', options_list=['--namespace-name'], help='name of the Namespace') + + with self.argument_context('relay namespace authorization-rule create') as c: + c.argument('accessrights', arg_type=rights_arg_type) + + with self.argument_context('relay namespace authorization-rule keys renew') as c: + c.argument('key_type', arg_type=key_arg_type) + +# region WCF Relay + with self.argument_context('relay wcf-relay') as c: + c.argument('relay_name', arg_type=name_type, help='Name of WCF Relay') + + with self.argument_context('relay wcf-relay create') as c: + c.argument('relay_type', options_list=['--relay-type'], arg_type=get_enum_type(Relaytype), help='WCF relay type.') + c.argument('requires_client_authorization', options_list=['--requires-client-authorization'], arg_type=get_three_state_flag(), help='True if client authorization is needed for this relay; otherwise, false.') + c.argument('requires_transport_security', options_list=['--requires-transport-security'], arg_type=get_three_state_flag(), help='True if transport security is needed for this relay; otherwise, false.') + c.argument('user_metadata', help='The usermetadata is a placeholder to store user-defined string data for the WCF Relay endpoint. For example, it can be used to store descriptive data, such as list of teams and their contact information. Also, user-defined configuration settings can be stored.') + + for scope in ['relay wcf-relay authorization-rule', 'relay wcf-relay authorization-rule keys list', 'relay wcf-relay authorization-rule keys renew']: + with self.argument_context(scope) as c: + c.argument('authorization_rule_name', arg_type=name_type, help='name of the WCF Relay AuthorizationRule') + c.argument('relay_name', options_list=['--wcfrelay-name'], help='name of the WCF Relay') + + with self.argument_context('relay wcf-relay authorization-rule create') as c: + c.argument('rights', arg_type=rights_arg_type) + + with self.argument_context('relay wcf-relay authorization-rule keys renew') as c: + c.argument('key_type', arg_type=key_arg_type) + +# region Hybrid Connection + with self.argument_context('relay hybrid-connections') as c: + c.argument('hybrid_connection_name', arg_type=name_type, help='Name of Hybrid Connection') + + with self.argument_context('relay hybrid-connections create') as c: + c.argument('requires_client_authorization', arg_type=get_three_state_flag(), help='True if client authorization is needed for this relay; otherwise, false.') + c.argument('user_metadata', help='The usermetadata is a placeholder to store user-defined string data for the Hybrid Connection endpoint. For example, it can be used to store descriptive data, such as list of teams and their contact information. Also, user-defined configuration settings can be stored.') + + for scope in ['relay hybrid-connections authorization-rule', 'relay hybrid-connections authorization-rule keys list', 'relay Hybrid Connection authorization-rule keys renew']: + with self.argument_context(scope) as c: + c.argument('authorization_rule_name', arg_type=name_type, help='name of the Hybrid Connection AuthorizationRule') + c.argument('hybrid_connection_name', options_list=['--hybrid-connection-name'], help='name of the Hybrid Connection') + + with self.argument_context('relay hybrid-connections authorization-rule create') as c: + c.argument('rights', arg_type=rights_arg_type) + + with self.argument_context('relay hybrid-connections authorization-rule keys renew') as c: + c.argument('key_type', arg_type=key_arg_type) diff --git a/src/relay/azext_relay/_utils.py b/src/relay/azext_relay/_utils.py new file mode 100644 index 00000000000..6badc458139 --- /dev/null +++ b/src/relay/azext_relay/_utils.py @@ -0,0 +1,18 @@ +# -------------------------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# -------------------------------------------------------------------------------------------- + +from azext_relay.relay.models.relay_management_client_enums import AccessRights + + +def accessrights_converter(accessrights): + accessrights_new = [] + if accessrights == 'Send': + accessrights_new.append(AccessRights.send) + if accessrights == 'Manage': + accessrights_new.append(AccessRights.manage) + if accessrights == 'Listen': + accessrights_new.append(AccessRights.listen) + + return accessrights_new diff --git a/src/relay/azext_relay/azext_metadata.json b/src/relay/azext_relay/azext_metadata.json new file mode 100644 index 00000000000..bbe67260f34 --- /dev/null +++ b/src/relay/azext_relay/azext_metadata.json @@ -0,0 +1,3 @@ +{ + "azext.minCliCoreVersion": "2.0.24" +} \ No newline at end of file diff --git a/src/relay/azext_relay/commands.py b/src/relay/azext_relay/commands.py new file mode 100644 index 00000000000..3aef862d401 --- /dev/null +++ b/src/relay/azext_relay/commands.py @@ -0,0 +1,78 @@ +# -------------------------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# -------------------------------------------------------------------------------------------- + +# pylint: disable=line-too-long +# pylint: disable=too-many-statements + +from azure.cli.core.commands import CliCommandType +from azext_relay._client_factory import (namespaces_mgmt_client_factory, wcfrelay_mgmt_client_factory, hydrid_connections_mgmt_client_factory) +from azext_relay.custom import empty_on_404 + + +def load_command_table(self, _): + + relay_namespace_util = CliCommandType( + operations_tmpl='azext_relay.relay.operations.namespaces_operations#NamespacesOperations.{}', + client_factory=namespaces_mgmt_client_factory, + client_arg_name='self' + ) + + relay_wcf_relay_util = CliCommandType( + operations_tmpl='azext_relay.relay.operations.wcf_relays_operations#WCFRelaysOperations.{}', + client_factory=wcfrelay_mgmt_client_factory, + client_arg_name='self' + ) + + relay_hybrid_connections_util = CliCommandType( + operations_tmpl='azext_relay.relay.operations.hybrid_connections_operations#HybridConnectionsOperations.{}', + client_factory=hydrid_connections_mgmt_client_factory, + client_arg_name='self' + ) + +# Namespace Region + with self.command_group('relay namespace', relay_namespace_util, client_factory=namespaces_mgmt_client_factory) as g: + g.custom_command('create', 'cli_namespace_create') + g.command('show', 'get', exception_handler=empty_on_404) + g.custom_command('list', 'cli_namespace_list', exception_handler=empty_on_404) + g.command('delete', 'delete') + g.command('exists', 'check_name_availability_method') + + with self.command_group('relay namespace authorization-rule', relay_namespace_util, client_factory=namespaces_mgmt_client_factory) as g: + g.custom_command('create', 'cli_namespaceautho_create') + g.command('show', 'get_authorization_rule', exception_handler=empty_on_404) + g.command('list', 'list_authorization_rules', exception_handler=empty_on_404) + g.command('keys list', 'list_keys') + g.command('keys renew', 'regenerate_keys') + g.command('delete', 'delete_authorization_rule') + +# WcfRelay Region + with self.command_group('relay wcf-relay', relay_wcf_relay_util, client_factory=wcfrelay_mgmt_client_factory) as g: + g.custom_command('create', 'cli_wcfrelay_create') + g.command('show', 'get', exception_handler=empty_on_404) + g.command('list', 'list_by_namespace', exception_handler=empty_on_404) + g.command('delete', 'delete') + + with self.command_group('relay wcf-relay authorization-rule', relay_wcf_relay_util, client_factory=wcfrelay_mgmt_client_factory) as g: + g.custom_command('create', 'cli_wcfrelayautho_create') + g.command('show', 'get_authorization_rule', exception_handler=empty_on_404) + g.command('list', 'list_authorization_rules', exception_handler=empty_on_404) + g.command('keys list', 'list_keys') + g.command('keys renew', 'regenerate_keys') + g.command('delete', 'delete_authorization_rule') + +# HybridConnections Region + with self.command_group('relay hybrid-connections', relay_hybrid_connections_util, client_factory=hydrid_connections_mgmt_client_factory) as g: + g.command('create', 'create_or_update') + g.command('show', 'get', exception_handler=empty_on_404) + g.command('list', 'list_by_namespace', exception_handler=empty_on_404) + g.command('delete', 'delete') + + with self.command_group('relay hybrid-connections authorization-rule', relay_hybrid_connections_util, client_factory=hydrid_connections_mgmt_client_factory) as g: + g.custom_command('create', 'cli_hybridconnectionsautho_create') + g.command('show', 'get_authorization_rule', exception_handler=empty_on_404) + g.command('list', 'list_authorization_rules', exception_handler=empty_on_404) + g.command('keys list', 'list_keys') + g.command('keys renew', 'regenerate_keys') + g.command('delete', 'delete_authorization_rule') diff --git a/src/relay/azext_relay/custom.py b/src/relay/azext_relay/custom.py new file mode 100644 index 00000000000..8cae2f82707 --- /dev/null +++ b/src/relay/azext_relay/custom.py @@ -0,0 +1,94 @@ +# -------------------------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# -------------------------------------------------------------------------------------------- + +# pylint: disable=line-too-long +# pylint: disable=too-many-lines +# pylint: disable=inconsistent-return-statements + + +# Namespace Region +def cli_namespace_create(client, resource_group_name, namespace_name, location, tags=None, skutier=None): + from azext_relay.relay.models import RelayNamespace, Sku + return client.create_or_update( + resource_group_name=resource_group_name, + namespace_name=namespace_name, + parameters=RelayNamespace(location, tags, Sku(skutier)) + ) + + +def cli_namespace_list(client, resource_group_name=None): + + if resource_group_name: + return client.list_by_resource_group(resource_group_name) + + if not resource_group_name: + return client.list() + + +# Namespace Authorization rule: +def cli_namespaceautho_create(client, resource_group_name, namespace_name, name, access_rights=None): + from azext_relay._utils import accessrights_converter + if not access_rights: + access_rights = access_rights.split() + return client.create_or_update_authorization_rule( + resource_group_name=resource_group_name, + namespace_name=namespace_name, + authorization_rule_name=name, + rights=accessrights_converter(access_rights) + ) + + +# WcfRelay Region +def cli_wcfrelay_create(client, resource_group_name, namespace_name, name, relay_type=None, requires_client_authorization=None, requires_transport_security=None, user_metadata=None): + from azext_relay.relay.models import WcfRelay + wcfrelayparameter1 = WcfRelay() + if relay_type: + wcfrelayparameter1.relay_type = relay_type + + if requires_client_authorization: + wcfrelayparameter1.requires_client_authorization = requires_client_authorization + + if requires_transport_security: + wcfrelayparameter1.requires_transport_security = requires_transport_security + + if user_metadata: + wcfrelayparameter1.user_metadata = user_metadata + + return client.create_or_update( + resource_group_name=resource_group_name, + namespace_name=namespace_name, + relay_name=name, + parameters=wcfrelayparameter1 + ) + + +def cli_wcfrelayautho_create(client, resource_group_name, namespace_name, wcfrelay_name, name, access_rights=None): + from azext_relay._utils import accessrights_converter + return client.create_or_update_authorization_rule( + resource_group_name=resource_group_name, + namespace_name=namespace_name, + relay_name=wcfrelay_name, + authorization_rule_name=name, + rights=accessrights_converter(access_rights) + ) + + +def cli_hybridconnectionsautho_create(client, resource_group_name, namespace_name, hybrid_connection_name, name, access_rights=None): + from azext_relay._utils import accessrights_converter + return client.create_or_update_authorization_rule( + resource_group_name=resource_group_name, + namespace_name=namespace_name, + hybrid_connection_name=hybrid_connection_name, + authorization_rule_name=name, + rights=accessrights_converter(access_rights) + ) + + +# pylint: disable=inconsistent-return-statements +def empty_on_404(ex): + from azext_relay.relay.models import ErrorResponseException + if isinstance(ex, ErrorResponseException) and ex.response.status_code == 404: + return None + raise ex diff --git a/src/relay/azext_relay/relay/__init__.py b/src/relay/azext_relay/relay/__init__.py new file mode 100644 index 00000000000..97c1241b590 --- /dev/null +++ b/src/relay/azext_relay/relay/__init__.py @@ -0,0 +1,17 @@ +# 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. +# -------------------------------------------------------------------------- + +from .relay_management_client import RelayManagementClient +from .version import VERSION + +__all__ = ['RelayManagementClient'] + +__version__ = VERSION diff --git a/src/relay/azext_relay/relay/models/__init__.py b/src/relay/azext_relay/relay/models/__init__.py new file mode 100644 index 00000000000..d5130b57dab --- /dev/null +++ b/src/relay/azext_relay/relay/models/__init__.py @@ -0,0 +1,70 @@ +# 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. +# -------------------------------------------------------------------------- + +from .tracked_resource import TrackedResource +from .resource_namespace_patch import ResourceNamespacePatch +from .resource import Resource +from .hybrid_connection import HybridConnection +from .wcf_relay import WcfRelay +from .sku import Sku +from .relay_namespace import RelayNamespace +from .relay_update_parameters import RelayUpdateParameters +from .authorization_rule import AuthorizationRule +from .access_keys import AccessKeys +from .regenerate_access_key_parameters import RegenerateAccessKeyParameters +from .check_name_availability import CheckNameAvailability +from .check_name_availability_result import CheckNameAvailabilityResult +from .operation_display import OperationDisplay +from .operation import Operation +from .error_response import ErrorResponse, ErrorResponseException +from .operation_paged import OperationPaged +from .relay_namespace_paged import RelayNamespacePaged +from .authorization_rule_paged import AuthorizationRulePaged +from .hybrid_connection_paged import HybridConnectionPaged +from .wcf_relay_paged import WcfRelayPaged +from .relay_management_client_enums import ( + Relaytype, + SkuTier, + ProvisioningStateEnum, + AccessRights, + KeyType, + UnavailableReason, +) + +__all__ = [ + 'TrackedResource', + 'ResourceNamespacePatch', + 'Resource', + 'HybridConnection', + 'WcfRelay', + 'Sku', + 'RelayNamespace', + 'RelayUpdateParameters', + 'AuthorizationRule', + 'AccessKeys', + 'RegenerateAccessKeyParameters', + 'CheckNameAvailability', + 'CheckNameAvailabilityResult', + 'OperationDisplay', + 'Operation', + 'ErrorResponse', 'ErrorResponseException', + 'OperationPaged', + 'RelayNamespacePaged', + 'AuthorizationRulePaged', + 'HybridConnectionPaged', + 'WcfRelayPaged', + 'Relaytype', + 'SkuTier', + 'ProvisioningStateEnum', + 'AccessRights', + 'KeyType', + 'UnavailableReason', +] diff --git a/src/relay/azext_relay/relay/models/access_keys.py b/src/relay/azext_relay/relay/models/access_keys.py new file mode 100644 index 00000000000..ad3ee4dcc53 --- /dev/null +++ b/src/relay/azext_relay/relay/models/access_keys.py @@ -0,0 +1,47 @@ +# 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. +# -------------------------------------------------------------------------- + +from msrest.serialization import Model + + +class AccessKeys(Model): + """Namespace/Relay Connection String. + + :param primary_connection_string: Primary connection string of the created + namespace authorization rule. + :type primary_connection_string: str + :param secondary_connection_string: Secondary connection string of the + created namespace authorization rule. + :type secondary_connection_string: str + :param primary_key: A base64-encoded 256-bit primary key for signing and + validating the SAS token. + :type primary_key: str + :param secondary_key: A base64-encoded 256-bit secondary key for signing + and validating the SAS token. + :type secondary_key: str + :param key_name: A string that describes the authorization rule. + :type key_name: str + """ + + _attribute_map = { + 'primary_connection_string': {'key': 'primaryConnectionString', 'type': 'str'}, + 'secondary_connection_string': {'key': 'secondaryConnectionString', 'type': 'str'}, + 'primary_key': {'key': 'primaryKey', 'type': 'str'}, + 'secondary_key': {'key': 'secondaryKey', 'type': 'str'}, + 'key_name': {'key': 'keyName', 'type': 'str'}, + } + + def __init__(self, primary_connection_string=None, secondary_connection_string=None, primary_key=None, secondary_key=None, key_name=None): + self.primary_connection_string = primary_connection_string + self.secondary_connection_string = secondary_connection_string + self.primary_key = primary_key + self.secondary_key = secondary_key + self.key_name = key_name diff --git a/src/relay/azext_relay/relay/models/authorization_rule.py b/src/relay/azext_relay/relay/models/authorization_rule.py new file mode 100644 index 00000000000..9d9674e92f5 --- /dev/null +++ b/src/relay/azext_relay/relay/models/authorization_rule.py @@ -0,0 +1,47 @@ +# 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. +# -------------------------------------------------------------------------- + +from .resource import Resource + + +class AuthorizationRule(Resource): + """Description of a namespace authorization rule. + + Variables are only populated by the server, and will be ignored when + sending a request. + + :ivar id: Resource ID. + :vartype id: str + :ivar name: Resource name. + :vartype name: str + :ivar type: Resource type. + :vartype type: str + :param rights: The rights associated with the rule. + :type rights: list[str or ~azure.mgmt.relay.models.AccessRights] + """ + + _validation = { + 'id': {'readonly': True}, + 'name': {'readonly': True}, + 'type': {'readonly': True}, + 'rights': {'unique': True}, + } + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + 'name': {'key': 'name', 'type': 'str'}, + 'type': {'key': 'type', 'type': 'str'}, + 'rights': {'key': 'properties.rights', 'type': '[AccessRights]'}, + } + + def __init__(self, rights=None): + super(AuthorizationRule, self).__init__() + self.rights = rights diff --git a/src/relay/azext_relay/relay/models/authorization_rule_paged.py b/src/relay/azext_relay/relay/models/authorization_rule_paged.py new file mode 100644 index 00000000000..f452ea050ef --- /dev/null +++ b/src/relay/azext_relay/relay/models/authorization_rule_paged.py @@ -0,0 +1,27 @@ +# 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. +# -------------------------------------------------------------------------- + +from msrest.paging import Paged + + +class AuthorizationRulePaged(Paged): + """ + A paging container for iterating over a list of :class:`AuthorizationRule ` object + """ + + _attribute_map = { + 'next_link': {'key': 'nextLink', 'type': 'str'}, + 'current_page': {'key': 'value', 'type': '[AuthorizationRule]'} + } + + def __init__(self, *args, **kwargs): + + super(AuthorizationRulePaged, self).__init__(*args, **kwargs) diff --git a/src/relay/azext_relay/relay/models/check_name_availability.py b/src/relay/azext_relay/relay/models/check_name_availability.py new file mode 100644 index 00000000000..b41c3fbebcd --- /dev/null +++ b/src/relay/azext_relay/relay/models/check_name_availability.py @@ -0,0 +1,33 @@ +# 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. +# -------------------------------------------------------------------------- + +from msrest.serialization import Model + + +class CheckNameAvailability(Model): + """Description of the check name availability request properties. + + :param name: The namespace name to check for availability. The namespace + name can contain only letters, numbers, and hyphens. The namespace must + start with a letter, and it must end with a letter or number. + :type name: str + """ + + _validation = { + 'name': {'required': True}, + } + + _attribute_map = { + 'name': {'key': 'name', 'type': 'str'}, + } + + def __init__(self, name): + self.name = name diff --git a/src/relay/azext_relay/relay/models/check_name_availability_result.py b/src/relay/azext_relay/relay/models/check_name_availability_result.py new file mode 100644 index 00000000000..920e6b849d0 --- /dev/null +++ b/src/relay/azext_relay/relay/models/check_name_availability_result.py @@ -0,0 +1,46 @@ +# 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. +# -------------------------------------------------------------------------- + +from msrest.serialization import Model + + +class CheckNameAvailabilityResult(Model): + """Description of the check name availability request properties. + + Variables are only populated by the server, and will be ignored when + sending a request. + + :ivar message: The detailed info regarding the reason associated with the + namespace. + :vartype message: str + :param name_available: Value indicating namespace is available. Returns + true if the namespace is available; otherwise, false. + :type name_available: bool + :param reason: The reason for unavailability of a namespace. Possible + values include: 'None', 'InvalidName', 'SubscriptionIsDisabled', + 'NameInUse', 'NameInLockdown', 'TooManyNamespaceInCurrentSubscription' + :type reason: str or ~azure.mgmt.relay.models.UnavailableReason + """ + + _validation = { + 'message': {'readonly': True}, + } + + _attribute_map = { + 'message': {'key': 'message', 'type': 'str'}, + 'name_available': {'key': 'nameAvailable', 'type': 'bool'}, + 'reason': {'key': 'reason', 'type': 'UnavailableReason'}, + } + + def __init__(self, name_available=None, reason=None): + self.message = None + self.name_available = name_available + self.reason = reason diff --git a/src/relay/azext_relay/relay/models/error_response.py b/src/relay/azext_relay/relay/models/error_response.py new file mode 100644 index 00000000000..33d628db541 --- /dev/null +++ b/src/relay/azext_relay/relay/models/error_response.py @@ -0,0 +1,45 @@ +# 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. +# -------------------------------------------------------------------------- + +from msrest.serialization import Model +from msrest.exceptions import HttpOperationError + + +class ErrorResponse(Model): + """Error reponse indicates Relay service is not able to process the incoming + request. The reason is provided in the error message. + + :param code: Error code. + :type code: str + :param message: Error message indicating why the operation failed. + :type message: str + """ + + _attribute_map = { + 'code': {'key': 'code', 'type': 'str'}, + 'message': {'key': 'message', 'type': 'str'}, + } + + def __init__(self, code=None, message=None): + self.code = code + self.message = message + + +class ErrorResponseException(HttpOperationError): + """Server responsed with exception of type: 'ErrorResponse'. + + :param deserialize: A deserializer + :param response: Server response to be deserialized. + """ + + def __init__(self, deserialize, response, *args): + + super(ErrorResponseException, self).__init__(deserialize, response, 'ErrorResponse', *args) diff --git a/src/relay/azext_relay/relay/models/hybrid_connection.py b/src/relay/azext_relay/relay/models/hybrid_connection.py new file mode 100644 index 00000000000..6f5d0655ef7 --- /dev/null +++ b/src/relay/azext_relay/relay/models/hybrid_connection.py @@ -0,0 +1,71 @@ +# 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. +# -------------------------------------------------------------------------- + +from .resource import Resource + + +class HybridConnection(Resource): + """Description of hybrid connection resource. + + Variables are only populated by the server, and will be ignored when + sending a request. + + :ivar id: Resource ID. + :vartype id: str + :ivar name: Resource name. + :vartype name: str + :ivar type: Resource type. + :vartype type: str + :ivar created_at: The time the hybrid connection was created. + :vartype created_at: datetime + :ivar updated_at: The time the namespace was updated. + :vartype updated_at: datetime + :ivar listener_count: The number of listeners for this hybrid connection. + Note that min : 1 and max:25 are supported. + :vartype listener_count: int + :param requires_client_authorization: Returns true if client authorization + is needed for this hybrid connection; otherwise, false. + :type requires_client_authorization: bool + :param user_metadata: The usermetadata is a placeholder to store + user-defined string data for the hybrid connection endpoint. For example, + it can be used to store descriptive data, such as a list of teams and + their contact information. Also, user-defined configuration settings can + be stored. + :type user_metadata: str + """ + + _validation = { + 'id': {'readonly': True}, + 'name': {'readonly': True}, + 'type': {'readonly': True}, + 'created_at': {'readonly': True}, + 'updated_at': {'readonly': True}, + 'listener_count': {'readonly': True, 'maximum': 25, 'minimum': 0}, + } + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + 'name': {'key': 'name', 'type': 'str'}, + 'type': {'key': 'type', 'type': 'str'}, + 'created_at': {'key': 'properties.createdAt', 'type': 'iso-8601'}, + 'updated_at': {'key': 'properties.updatedAt', 'type': 'iso-8601'}, + 'listener_count': {'key': 'properties.listenerCount', 'type': 'int'}, + 'requires_client_authorization': {'key': 'properties.requiresClientAuthorization', 'type': 'bool'}, + 'user_metadata': {'key': 'properties.userMetadata', 'type': 'str'}, + } + + def __init__(self, requires_client_authorization=None, user_metadata=None): + super(HybridConnection, self).__init__() + self.created_at = None + self.updated_at = None + self.listener_count = None + self.requires_client_authorization = requires_client_authorization + self.user_metadata = user_metadata diff --git a/src/relay/azext_relay/relay/models/hybrid_connection_paged.py b/src/relay/azext_relay/relay/models/hybrid_connection_paged.py new file mode 100644 index 00000000000..c2cdcac1cc2 --- /dev/null +++ b/src/relay/azext_relay/relay/models/hybrid_connection_paged.py @@ -0,0 +1,27 @@ +# 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. +# -------------------------------------------------------------------------- + +from msrest.paging import Paged + + +class HybridConnectionPaged(Paged): + """ + A paging container for iterating over a list of :class:`HybridConnection ` object + """ + + _attribute_map = { + 'next_link': {'key': 'nextLink', 'type': 'str'}, + 'current_page': {'key': 'value', 'type': '[HybridConnection]'} + } + + def __init__(self, *args, **kwargs): + + super(HybridConnectionPaged, self).__init__(*args, **kwargs) diff --git a/src/relay/azext_relay/relay/models/operation.py b/src/relay/azext_relay/relay/models/operation.py new file mode 100644 index 00000000000..ae068c0a200 --- /dev/null +++ b/src/relay/azext_relay/relay/models/operation.py @@ -0,0 +1,38 @@ +# 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. +# -------------------------------------------------------------------------- + +from msrest.serialization import Model + + +class Operation(Model): + """A Relay REST API operation. + + Variables are only populated by the server, and will be ignored when + sending a request. + + :ivar name: Operation name: {provider}/{resource}/{operation} + :vartype name: str + :param display: The object that represents the operation. + :type display: ~azure.mgmt.relay.models.OperationDisplay + """ + + _validation = { + 'name': {'readonly': True}, + } + + _attribute_map = { + 'name': {'key': 'name', 'type': 'str'}, + 'display': {'key': 'display', 'type': 'OperationDisplay'}, + } + + def __init__(self, display=None): + self.name = None + self.display = display diff --git a/src/relay/azext_relay/relay/models/operation_display.py b/src/relay/azext_relay/relay/models/operation_display.py new file mode 100644 index 00000000000..6ffa1505d83 --- /dev/null +++ b/src/relay/azext_relay/relay/models/operation_display.py @@ -0,0 +1,45 @@ +# 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. +# -------------------------------------------------------------------------- + +from msrest.serialization import Model + + +class OperationDisplay(Model): + """The object that represents the operation. + + Variables are only populated by the server, and will be ignored when + sending a request. + + :ivar provider: Service provider: Relay. + :vartype provider: str + :ivar resource: Resource on which the operation is performed: Invoice, + etc. + :vartype resource: str + :ivar operation: Operation type: Read, write, delete, etc. + :vartype operation: str + """ + + _validation = { + 'provider': {'readonly': True}, + 'resource': {'readonly': True}, + 'operation': {'readonly': True}, + } + + _attribute_map = { + 'provider': {'key': 'provider', 'type': 'str'}, + 'resource': {'key': 'resource', 'type': 'str'}, + 'operation': {'key': 'operation', 'type': 'str'}, + } + + def __init__(self): + self.provider = None + self.resource = None + self.operation = None diff --git a/src/relay/azext_relay/relay/models/operation_paged.py b/src/relay/azext_relay/relay/models/operation_paged.py new file mode 100644 index 00000000000..4cbe3ebcfde --- /dev/null +++ b/src/relay/azext_relay/relay/models/operation_paged.py @@ -0,0 +1,27 @@ +# 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. +# -------------------------------------------------------------------------- + +from msrest.paging import Paged + + +class OperationPaged(Paged): + """ + A paging container for iterating over a list of :class:`Operation ` object + """ + + _attribute_map = { + 'next_link': {'key': 'nextLink', 'type': 'str'}, + 'current_page': {'key': 'value', 'type': '[Operation]'} + } + + def __init__(self, *args, **kwargs): + + super(OperationPaged, self).__init__(*args, **kwargs) diff --git a/src/relay/azext_relay/relay/models/regenerate_access_key_parameters.py b/src/relay/azext_relay/relay/models/regenerate_access_key_parameters.py new file mode 100644 index 00000000000..803de61901e --- /dev/null +++ b/src/relay/azext_relay/relay/models/regenerate_access_key_parameters.py @@ -0,0 +1,38 @@ +# 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. +# -------------------------------------------------------------------------- + +from msrest.serialization import Model + + +class RegenerateAccessKeyParameters(Model): + """Parameters supplied to the regenerate authorization rule operation, + specifies which key neeeds to be reset. + + :param key_type: The access key to regenerate. Possible values include: + 'PrimaryKey', 'SecondaryKey' + :type key_type: str or ~azure.mgmt.relay.models.KeyType + :param key: Optional. If the key value is provided, this is set to key + type, or autogenerated key value set for key type. + :type key: str + """ + + _validation = { + 'key_type': {'required': True}, + } + + _attribute_map = { + 'key_type': {'key': 'keyType', 'type': 'KeyType'}, + 'key': {'key': 'key', 'type': 'str'}, + } + + def __init__(self, key_type, key=None): + self.key_type = key_type + self.key = key diff --git a/src/relay/azext_relay/relay/models/relay_management_client_enums.py b/src/relay/azext_relay/relay/models/relay_management_client_enums.py new file mode 100644 index 00000000000..2f825eff737 --- /dev/null +++ b/src/relay/azext_relay/relay/models/relay_management_client_enums.py @@ -0,0 +1,56 @@ +# 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. +# -------------------------------------------------------------------------- + +from enum import Enum + + +class Relaytype(Enum): + + net_tcp = "NetTcp" + http = "Http" + + +class SkuTier(Enum): + + standard = "Standard" + + +class ProvisioningStateEnum(Enum): + + created = "Created" + succeeded = "Succeeded" + deleted = "Deleted" + failed = "Failed" + updating = "Updating" + unknown = "Unknown" + + +class AccessRights(Enum): + + manage = "Manage" + send = "Send" + listen = "Listen" + + +class KeyType(Enum): + + primary_key = "PrimaryKey" + secondary_key = "SecondaryKey" + + +class UnavailableReason(Enum): + + none = "None" + invalid_name = "InvalidName" + subscription_is_disabled = "SubscriptionIsDisabled" + name_in_use = "NameInUse" + name_in_lockdown = "NameInLockdown" + too_many_namespace_in_current_subscription = "TooManyNamespaceInCurrentSubscription" diff --git a/src/relay/azext_relay/relay/models/relay_namespace.py b/src/relay/azext_relay/relay/models/relay_namespace.py new file mode 100644 index 00000000000..aabe904feac --- /dev/null +++ b/src/relay/azext_relay/relay/models/relay_namespace.py @@ -0,0 +1,81 @@ +# 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. +# -------------------------------------------------------------------------- + +from .tracked_resource import TrackedResource + + +class RelayNamespace(TrackedResource): + """Description of a namespace resource. + + Variables are only populated by the server, and will be ignored when + sending a request. + + :ivar id: Resource ID. + :vartype id: str + :ivar name: Resource name. + :vartype name: str + :ivar type: Resource type. + :vartype type: str + :param location: Resource location. + :type location: str + :param tags: Resource tags. + :type tags: dict[str, str] + :param sku: SKU of the namespace. + :type sku: ~azure.mgmt.relay.models.Sku + :ivar provisioning_state: Possible values include: 'Created', 'Succeeded', + 'Deleted', 'Failed', 'Updating', 'Unknown' + :vartype provisioning_state: str or + ~azure.mgmt.relay.models.ProvisioningStateEnum + :ivar created_at: The time the namespace was created. + :vartype created_at: datetime + :ivar updated_at: The time the namespace was updated. + :vartype updated_at: datetime + :ivar service_bus_endpoint: Endpoint you can use to perform Service Bus + operations. + :vartype service_bus_endpoint: str + :ivar metric_id: Identifier for Azure Insights metrics. + :vartype metric_id: str + """ + + _validation = { + 'id': {'readonly': True}, + 'name': {'readonly': True}, + 'type': {'readonly': True}, + 'location': {'required': True}, + 'provisioning_state': {'readonly': True}, + 'created_at': {'readonly': True}, + 'updated_at': {'readonly': True}, + 'service_bus_endpoint': {'readonly': True}, + 'metric_id': {'readonly': True}, + } + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + 'name': {'key': 'name', 'type': 'str'}, + 'type': {'key': 'type', 'type': 'str'}, + 'location': {'key': 'location', 'type': 'str'}, + 'tags': {'key': 'tags', 'type': '{str}'}, + 'sku': {'key': 'sku', 'type': 'Sku'}, + 'provisioning_state': {'key': 'properties.provisioningState', 'type': 'ProvisioningStateEnum'}, + 'created_at': {'key': 'properties.createdAt', 'type': 'iso-8601'}, + 'updated_at': {'key': 'properties.updatedAt', 'type': 'iso-8601'}, + 'service_bus_endpoint': {'key': 'properties.serviceBusEndpoint', 'type': 'str'}, + 'metric_id': {'key': 'properties.metricId', 'type': 'str'}, + } + + def __init__(self, location, tags=None, sku=None): + super(RelayNamespace, self).__init__(location=location, tags=tags) + self.sku = sku + self.provisioning_state = None + self.created_at = None + self.updated_at = None + self.service_bus_endpoint = None + self.metric_id = None diff --git a/src/relay/azext_relay/relay/models/relay_namespace_paged.py b/src/relay/azext_relay/relay/models/relay_namespace_paged.py new file mode 100644 index 00000000000..cc1223c5784 --- /dev/null +++ b/src/relay/azext_relay/relay/models/relay_namespace_paged.py @@ -0,0 +1,27 @@ +# 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. +# -------------------------------------------------------------------------- + +from msrest.paging import Paged + + +class RelayNamespacePaged(Paged): + """ + A paging container for iterating over a list of :class:`RelayNamespace ` object + """ + + _attribute_map = { + 'next_link': {'key': 'nextLink', 'type': 'str'}, + 'current_page': {'key': 'value', 'type': '[RelayNamespace]'} + } + + def __init__(self, *args, **kwargs): + + super(RelayNamespacePaged, self).__init__(*args, **kwargs) diff --git a/src/relay/azext_relay/relay/models/relay_update_parameters.py b/src/relay/azext_relay/relay/models/relay_update_parameters.py new file mode 100644 index 00000000000..ec0cf4f08fa --- /dev/null +++ b/src/relay/azext_relay/relay/models/relay_update_parameters.py @@ -0,0 +1,77 @@ +# 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. +# -------------------------------------------------------------------------- + +from .resource_namespace_patch import ResourceNamespacePatch + + +class RelayUpdateParameters(ResourceNamespacePatch): + """Description of a namespace resource. + + Variables are only populated by the server, and will be ignored when + sending a request. + + :ivar id: Resource ID. + :vartype id: str + :ivar name: Resource name. + :vartype name: str + :ivar type: Resource type. + :vartype type: str + :param tags: Resource tags. + :type tags: dict[str, str] + :param sku: SKU of the namespace. + :type sku: ~azure.mgmt.relay.models.Sku + :ivar provisioning_state: Possible values include: 'Created', 'Succeeded', + 'Deleted', 'Failed', 'Updating', 'Unknown' + :vartype provisioning_state: str or + ~azure.mgmt.relay.models.ProvisioningStateEnum + :ivar created_at: The time the namespace was created. + :vartype created_at: datetime + :ivar updated_at: The time the namespace was updated. + :vartype updated_at: datetime + :ivar service_bus_endpoint: Endpoint you can use to perform Service Bus + operations. + :vartype service_bus_endpoint: str + :ivar metric_id: Identifier for Azure Insights metrics. + :vartype metric_id: str + """ + + _validation = { + 'id': {'readonly': True}, + 'name': {'readonly': True}, + 'type': {'readonly': True}, + 'provisioning_state': {'readonly': True}, + 'created_at': {'readonly': True}, + 'updated_at': {'readonly': True}, + 'service_bus_endpoint': {'readonly': True}, + 'metric_id': {'readonly': True}, + } + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + 'name': {'key': 'name', 'type': 'str'}, + 'type': {'key': 'type', 'type': 'str'}, + 'tags': {'key': 'tags', 'type': '{str}'}, + 'sku': {'key': 'sku', 'type': 'Sku'}, + 'provisioning_state': {'key': 'properties.provisioningState', 'type': 'ProvisioningStateEnum'}, + 'created_at': {'key': 'properties.createdAt', 'type': 'iso-8601'}, + 'updated_at': {'key': 'properties.updatedAt', 'type': 'iso-8601'}, + 'service_bus_endpoint': {'key': 'properties.serviceBusEndpoint', 'type': 'str'}, + 'metric_id': {'key': 'properties.metricId', 'type': 'str'}, + } + + def __init__(self, tags=None, sku=None): + super(RelayUpdateParameters, self).__init__(tags=tags) + self.sku = sku + self.provisioning_state = None + self.created_at = None + self.updated_at = None + self.service_bus_endpoint = None + self.metric_id = None diff --git a/src/relay/azext_relay/relay/models/resource.py b/src/relay/azext_relay/relay/models/resource.py new file mode 100644 index 00000000000..db9636552cd --- /dev/null +++ b/src/relay/azext_relay/relay/models/resource.py @@ -0,0 +1,44 @@ +# 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. +# -------------------------------------------------------------------------- + +from msrest.serialization import Model + + +class Resource(Model): + """The resource definition. + + Variables are only populated by the server, and will be ignored when + sending a request. + + :ivar id: Resource ID. + :vartype id: str + :ivar name: Resource name. + :vartype name: str + :ivar type: Resource type. + :vartype type: str + """ + + _validation = { + 'id': {'readonly': True}, + 'name': {'readonly': True}, + 'type': {'readonly': True}, + } + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + 'name': {'key': 'name', 'type': 'str'}, + 'type': {'key': 'type', 'type': 'str'}, + } + + def __init__(self): + self.id = None + self.name = None + self.type = None diff --git a/src/relay/azext_relay/relay/models/resource_namespace_patch.py b/src/relay/azext_relay/relay/models/resource_namespace_patch.py new file mode 100644 index 00000000000..4978d97c194 --- /dev/null +++ b/src/relay/azext_relay/relay/models/resource_namespace_patch.py @@ -0,0 +1,46 @@ +# 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. +# -------------------------------------------------------------------------- + +from .resource import Resource + + +class ResourceNamespacePatch(Resource): + """Definition of resource. + + Variables are only populated by the server, and will be ignored when + sending a request. + + :ivar id: Resource ID. + :vartype id: str + :ivar name: Resource name. + :vartype name: str + :ivar type: Resource type. + :vartype type: str + :param tags: Resource tags. + :type tags: dict[str, str] + """ + + _validation = { + 'id': {'readonly': True}, + 'name': {'readonly': True}, + 'type': {'readonly': True}, + } + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + 'name': {'key': 'name', 'type': 'str'}, + 'type': {'key': 'type', 'type': 'str'}, + 'tags': {'key': 'tags', 'type': '{str}'}, + } + + def __init__(self, tags=None): + super(ResourceNamespacePatch, self).__init__() + self.tags = tags diff --git a/src/relay/azext_relay/relay/models/sku.py b/src/relay/azext_relay/relay/models/sku.py new file mode 100644 index 00000000000..bf39d0f7863 --- /dev/null +++ b/src/relay/azext_relay/relay/models/sku.py @@ -0,0 +1,39 @@ +# 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. +# -------------------------------------------------------------------------- + +from msrest.serialization import Model + + +class Sku(Model): + """SKU of the namespace. + + Variables are only populated by the server, and will be ignored when + sending a request. + + :ivar name: Name of this SKU. Default value: "Standard" . + :vartype name: str + :param tier: The tier of this SKU. Possible values include: 'Standard' + :type tier: str or ~azure.mgmt.relay.models.SkuTier + """ + + _validation = { + 'name': {'required': True, 'constant': True}, + } + + _attribute_map = { + 'name': {'key': 'name', 'type': 'str'}, + 'tier': {'key': 'tier', 'type': 'SkuTier'}, + } + + name = "Standard" + + def __init__(self, tier=None): + self.tier = tier diff --git a/src/relay/azext_relay/relay/models/tracked_resource.py b/src/relay/azext_relay/relay/models/tracked_resource.py new file mode 100644 index 00000000000..4618796cea1 --- /dev/null +++ b/src/relay/azext_relay/relay/models/tracked_resource.py @@ -0,0 +1,51 @@ +# 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. +# -------------------------------------------------------------------------- + +from .resource import Resource + + +class TrackedResource(Resource): + """Definition of resource. + + Variables are only populated by the server, and will be ignored when + sending a request. + + :ivar id: Resource ID. + :vartype id: str + :ivar name: Resource name. + :vartype name: str + :ivar type: Resource type. + :vartype type: str + :param location: Resource location. + :type location: str + :param tags: Resource tags. + :type tags: dict[str, str] + """ + + _validation = { + 'id': {'readonly': True}, + 'name': {'readonly': True}, + 'type': {'readonly': True}, + 'location': {'required': True}, + } + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + 'name': {'key': 'name', 'type': 'str'}, + 'type': {'key': 'type', 'type': 'str'}, + 'location': {'key': 'location', 'type': 'str'}, + 'tags': {'key': 'tags', 'type': '{str}'}, + } + + def __init__(self, location, tags=None): + super(TrackedResource, self).__init__() + self.location = location + self.tags = tags diff --git a/src/relay/azext_relay/relay/models/wcf_relay.py b/src/relay/azext_relay/relay/models/wcf_relay.py new file mode 100644 index 00000000000..ea59df614f7 --- /dev/null +++ b/src/relay/azext_relay/relay/models/wcf_relay.py @@ -0,0 +1,85 @@ +# 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. +# -------------------------------------------------------------------------- + +from .resource import Resource + + +class WcfRelay(Resource): + """Description of the WCF relay resource. + + Variables are only populated by the server, and will be ignored when + sending a request. + + :ivar id: Resource ID. + :vartype id: str + :ivar name: Resource name. + :vartype name: str + :ivar type: Resource type. + :vartype type: str + :ivar is_dynamic: Returns true if the relay is dynamic; otherwise, false. + :vartype is_dynamic: bool + :ivar created_at: The time the WCF relay was created. + :vartype created_at: datetime + :ivar updated_at: The time the namespace was updated. + :vartype updated_at: datetime + :ivar listener_count: The number of listeners for this relay. Note that + min :1 and max:25 are supported. + :vartype listener_count: int + :param relay_type: WCF relay type. Possible values include: 'NetTcp', + 'Http' + :type relay_type: str or ~azure.mgmt.relay.models.Relaytype + :param requires_client_authorization: Returns true if client authorization + is needed for this relay; otherwise, false. + :type requires_client_authorization: bool + :param requires_transport_security: Returns true if transport security is + needed for this relay; otherwise, false. + :type requires_transport_security: bool + :param user_metadata: The usermetadata is a placeholder to store + user-defined string data for the WCF Relay endpoint. For example, it can + be used to store descriptive data, such as list of teams and their contact + information. Also, user-defined configuration settings can be stored. + :type user_metadata: str + """ + + _validation = { + 'id': {'readonly': True}, + 'name': {'readonly': True}, + 'type': {'readonly': True}, + 'is_dynamic': {'readonly': True}, + 'created_at': {'readonly': True}, + 'updated_at': {'readonly': True}, + 'listener_count': {'readonly': True, 'maximum': 25, 'minimum': 0}, + } + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + 'name': {'key': 'name', 'type': 'str'}, + 'type': {'key': 'type', 'type': 'str'}, + 'is_dynamic': {'key': 'properties.isDynamic', 'type': 'bool'}, + 'created_at': {'key': 'properties.createdAt', 'type': 'iso-8601'}, + 'updated_at': {'key': 'properties.updatedAt', 'type': 'iso-8601'}, + 'listener_count': {'key': 'properties.listenerCount', 'type': 'int'}, + 'relay_type': {'key': 'properties.relayType', 'type': 'Relaytype'}, + 'requires_client_authorization': {'key': 'properties.requiresClientAuthorization', 'type': 'bool'}, + 'requires_transport_security': {'key': 'properties.requiresTransportSecurity', 'type': 'bool'}, + 'user_metadata': {'key': 'properties.userMetadata', 'type': 'str'}, + } + + def __init__(self, relay_type=None, requires_client_authorization=None, requires_transport_security=None, user_metadata=None): + super(WcfRelay, self).__init__() + self.is_dynamic = None + self.created_at = None + self.updated_at = None + self.listener_count = None + self.relay_type = relay_type + self.requires_client_authorization = requires_client_authorization + self.requires_transport_security = requires_transport_security + self.user_metadata = user_metadata diff --git a/src/relay/azext_relay/relay/models/wcf_relay_paged.py b/src/relay/azext_relay/relay/models/wcf_relay_paged.py new file mode 100644 index 00000000000..6235b75858e --- /dev/null +++ b/src/relay/azext_relay/relay/models/wcf_relay_paged.py @@ -0,0 +1,27 @@ +# 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. +# -------------------------------------------------------------------------- + +from msrest.paging import Paged + + +class WcfRelayPaged(Paged): + """ + A paging container for iterating over a list of :class:`WcfRelay ` object + """ + + _attribute_map = { + 'next_link': {'key': 'nextLink', 'type': 'str'}, + 'current_page': {'key': 'value', 'type': '[WcfRelay]'} + } + + def __init__(self, *args, **kwargs): + + super(WcfRelayPaged, self).__init__(*args, **kwargs) diff --git a/src/relay/azext_relay/relay/operations/__init__.py b/src/relay/azext_relay/relay/operations/__init__.py new file mode 100644 index 00000000000..20f9ef1c9a5 --- /dev/null +++ b/src/relay/azext_relay/relay/operations/__init__.py @@ -0,0 +1,22 @@ +# 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. +# -------------------------------------------------------------------------- + +from .operations import Operations +from .namespaces_operations import NamespacesOperations +from .hybrid_connections_operations import HybridConnectionsOperations +from .wcf_relays_operations import WCFRelaysOperations + +__all__ = [ + 'Operations', + 'NamespacesOperations', + 'HybridConnectionsOperations', + 'WCFRelaysOperations', +] diff --git a/src/relay/azext_relay/relay/operations/hybrid_connections_operations.py b/src/relay/azext_relay/relay/operations/hybrid_connections_operations.py new file mode 100644 index 00000000000..65f6e717bfc --- /dev/null +++ b/src/relay/azext_relay/relay/operations/hybrid_connections_operations.py @@ -0,0 +1,726 @@ +# 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. +# -------------------------------------------------------------------------- + +import uuid +from msrest.pipeline import ClientRawResponse + +from .. import models + + +class HybridConnectionsOperations(object): + """HybridConnectionsOperations operations. + + :param client: Client for service requests. + :param config: Configuration of service client. + :param serializer: An object model serializer. + :param deserializer: An objec model deserializer. + :ivar api_version: Client API version. Constant value: "2017-04-01". + """ + + def __init__(self, client, config, serializer, deserializer): + + self._client = client + self._serialize = serializer + self._deserialize = deserializer + self.api_version = "2017-04-01" + + self.config = config + + def list_by_namespace( + self, resource_group_name, namespace_name, custom_headers=None, raw=False, **operation_config): + """Lists the hybrid connection within the namespace. + + :param resource_group_name: Name of the Resource group within the + Azure subscription. + :type resource_group_name: str + :param namespace_name: The namespace name + :type namespace_name: str + :param dict custom_headers: headers that will be added to the request + :param bool raw: returns the direct response alongside the + deserialized response + :param operation_config: :ref:`Operation configuration + overrides`. + :return: An iterator like instance of HybridConnection + :rtype: + ~azure.mgmt.relay.models.HybridConnectionPaged[~azure.mgmt.relay.models.HybridConnection] + :raises: + :class:`ErrorResponseException` + """ + def internal_paging(next_link=None, raw=False): + + if not next_link: + # Construct URL + url = '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Relay/namespaces/{namespaceName}/hybridConnections' + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), + 'namespaceName': self._serialize.url("namespace_name", namespace_name, 'str', max_length=50, min_length=6), + 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str') + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} + query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + + else: + url = next_link + query_parameters = {} + + # Construct headers + header_parameters = {} + header_parameters['Content-Type'] = 'application/json; charset=utf-8' + if self.config.generate_client_request_id: + header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) + if custom_headers: + header_parameters.update(custom_headers) + if self.config.accept_language is not None: + header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') + + # Construct and send request + request = self._client.get(url, query_parameters) + response = self._client.send( + request, header_parameters, **operation_config) + + if response.status_code not in [200]: + raise models.ErrorResponseException(self._deserialize, response) + + return response + + # Deserialize response + deserialized = models.HybridConnectionPaged(internal_paging, self._deserialize.dependencies) + + if raw: + header_dict = {} + client_raw_response = models.HybridConnectionPaged(internal_paging, self._deserialize.dependencies, header_dict) + return client_raw_response + + return deserialized + + def create_or_update( + self, resource_group_name, namespace_name, hybrid_connection_name, requires_client_authorization=None, user_metadata=None, custom_headers=None, raw=False, **operation_config): + """Creates or updates a service hybrid connection. This operation is + idempotent. + + :param resource_group_name: Name of the Resource group within the + Azure subscription. + :type resource_group_name: str + :param namespace_name: The namespace name + :type namespace_name: str + :param hybrid_connection_name: The hybrid connection name. + :type hybrid_connection_name: str + :param requires_client_authorization: Returns true if client + authorization is needed for this hybrid connection; otherwise, false. + :type requires_client_authorization: bool + :param user_metadata: The usermetadata is a placeholder to store + user-defined string data for the hybrid connection endpoint. For + example, it can be used to store descriptive data, such as a list of + teams and their contact information. Also, user-defined configuration + settings can be stored. + :type user_metadata: str + :param dict custom_headers: headers that will be added to the request + :param bool raw: returns the direct response alongside the + deserialized response + :param operation_config: :ref:`Operation configuration + overrides`. + :return: HybridConnection or ClientRawResponse if raw=true + :rtype: ~azure.mgmt.relay.models.HybridConnection or + ~msrest.pipeline.ClientRawResponse + :raises: + :class:`ErrorResponseException` + """ + parameters = models.HybridConnection(requires_client_authorization=requires_client_authorization, user_metadata=user_metadata) + + # Construct URL + url = '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Relay/namespaces/{namespaceName}/hybridConnections/{hybridConnectionName}' + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), + 'namespaceName': self._serialize.url("namespace_name", namespace_name, 'str', max_length=50, min_length=6), + 'hybridConnectionName': self._serialize.url("hybrid_connection_name", hybrid_connection_name, 'str', min_length=1), + 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str') + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} + query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + + # Construct headers + header_parameters = {} + header_parameters['Content-Type'] = 'application/json; charset=utf-8' + if self.config.generate_client_request_id: + header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) + if custom_headers: + header_parameters.update(custom_headers) + if self.config.accept_language is not None: + header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') + + # Construct body + body_content = self._serialize.body(parameters, 'HybridConnection') + + # Construct and send request + request = self._client.put(url, query_parameters) + response = self._client.send( + request, header_parameters, body_content, **operation_config) + + if response.status_code not in [200]: + raise models.ErrorResponseException(self._deserialize, response) + + deserialized = None + + if response.status_code == 200: + deserialized = self._deserialize('HybridConnection', response) + + if raw: + client_raw_response = ClientRawResponse(deserialized, response) + return client_raw_response + + return deserialized + + def delete( + self, resource_group_name, namespace_name, hybrid_connection_name, custom_headers=None, raw=False, **operation_config): + """Deletes a hybrid connection. + + :param resource_group_name: Name of the Resource group within the + Azure subscription. + :type resource_group_name: str + :param namespace_name: The namespace name + :type namespace_name: str + :param hybrid_connection_name: The hybrid connection name. + :type hybrid_connection_name: str + :param dict custom_headers: headers that will be added to the request + :param bool raw: returns the direct response alongside the + deserialized response + :param operation_config: :ref:`Operation configuration + overrides`. + :return: None or ClientRawResponse if raw=true + :rtype: None or ~msrest.pipeline.ClientRawResponse + :raises: + :class:`ErrorResponseException` + """ + # Construct URL + url = '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Relay/namespaces/{namespaceName}/hybridConnections/{hybridConnectionName}' + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), + 'namespaceName': self._serialize.url("namespace_name", namespace_name, 'str', max_length=50, min_length=6), + 'hybridConnectionName': self._serialize.url("hybrid_connection_name", hybrid_connection_name, 'str', min_length=1), + 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str') + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} + query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + + # Construct headers + header_parameters = {} + header_parameters['Content-Type'] = 'application/json; charset=utf-8' + if self.config.generate_client_request_id: + header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) + if custom_headers: + header_parameters.update(custom_headers) + if self.config.accept_language is not None: + header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') + + # Construct and send request + request = self._client.delete(url, query_parameters) + response = self._client.send(request, header_parameters, **operation_config) + + if response.status_code not in [200, 204]: + raise models.ErrorResponseException(self._deserialize, response) + + if raw: + client_raw_response = ClientRawResponse(None, response) + return client_raw_response + + def get( + self, resource_group_name, namespace_name, hybrid_connection_name, custom_headers=None, raw=False, **operation_config): + """Returns the description for the specified hybrid connection. + + :param resource_group_name: Name of the Resource group within the + Azure subscription. + :type resource_group_name: str + :param namespace_name: The namespace name + :type namespace_name: str + :param hybrid_connection_name: The hybrid connection name. + :type hybrid_connection_name: str + :param dict custom_headers: headers that will be added to the request + :param bool raw: returns the direct response alongside the + deserialized response + :param operation_config: :ref:`Operation configuration + overrides`. + :return: HybridConnection or ClientRawResponse if raw=true + :rtype: ~azure.mgmt.relay.models.HybridConnection or + ~msrest.pipeline.ClientRawResponse + :raises: + :class:`ErrorResponseException` + """ + # Construct URL + url = '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Relay/namespaces/{namespaceName}/hybridConnections/{hybridConnectionName}' + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), + 'namespaceName': self._serialize.url("namespace_name", namespace_name, 'str', max_length=50, min_length=6), + 'hybridConnectionName': self._serialize.url("hybrid_connection_name", hybrid_connection_name, 'str', min_length=1), + 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str') + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} + query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + + # Construct headers + header_parameters = {} + header_parameters['Content-Type'] = 'application/json; charset=utf-8' + if self.config.generate_client_request_id: + header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) + if custom_headers: + header_parameters.update(custom_headers) + if self.config.accept_language is not None: + header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') + + # Construct and send request + request = self._client.get(url, query_parameters) + response = self._client.send(request, header_parameters, **operation_config) + + if response.status_code not in [200]: + raise models.ErrorResponseException(self._deserialize, response) + + deserialized = None + + if response.status_code == 200: + deserialized = self._deserialize('HybridConnection', response) + + if raw: + client_raw_response = ClientRawResponse(deserialized, response) + return client_raw_response + + return deserialized + + def list_authorization_rules( + self, resource_group_name, namespace_name, hybrid_connection_name, custom_headers=None, raw=False, **operation_config): + """Authorization rules for a hybrid connection. + + :param resource_group_name: Name of the Resource group within the + Azure subscription. + :type resource_group_name: str + :param namespace_name: The namespace name + :type namespace_name: str + :param hybrid_connection_name: The hybrid connection name. + :type hybrid_connection_name: str + :param dict custom_headers: headers that will be added to the request + :param bool raw: returns the direct response alongside the + deserialized response + :param operation_config: :ref:`Operation configuration + overrides`. + :return: An iterator like instance of AuthorizationRule + :rtype: + ~azure.mgmt.relay.models.AuthorizationRulePaged[~azure.mgmt.relay.models.AuthorizationRule] + :raises: + :class:`ErrorResponseException` + """ + def internal_paging(next_link=None, raw=False): + + if not next_link: + # Construct URL + url = '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Relay/namespaces/{namespaceName}/hybridConnections/{hybridConnectionName}/authorizationRules' + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), + 'namespaceName': self._serialize.url("namespace_name", namespace_name, 'str', max_length=50, min_length=6), + 'hybridConnectionName': self._serialize.url("hybrid_connection_name", hybrid_connection_name, 'str', min_length=1), + 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str') + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} + query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + + else: + url = next_link + query_parameters = {} + + # Construct headers + header_parameters = {} + header_parameters['Content-Type'] = 'application/json; charset=utf-8' + if self.config.generate_client_request_id: + header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) + if custom_headers: + header_parameters.update(custom_headers) + if self.config.accept_language is not None: + header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') + + # Construct and send request + request = self._client.get(url, query_parameters) + response = self._client.send( + request, header_parameters, **operation_config) + + if response.status_code not in [200]: + raise models.ErrorResponseException(self._deserialize, response) + + return response + + # Deserialize response + deserialized = models.AuthorizationRulePaged(internal_paging, self._deserialize.dependencies) + + if raw: + header_dict = {} + client_raw_response = models.AuthorizationRulePaged(internal_paging, self._deserialize.dependencies, header_dict) + return client_raw_response + + return deserialized + + def create_or_update_authorization_rule( + self, resource_group_name, namespace_name, hybrid_connection_name, authorization_rule_name, rights=None, custom_headers=None, raw=False, **operation_config): + """Creates or updates an authorization rule for a hybrid connection. + + :param resource_group_name: Name of the Resource group within the + Azure subscription. + :type resource_group_name: str + :param namespace_name: The namespace name + :type namespace_name: str + :param hybrid_connection_name: The hybrid connection name. + :type hybrid_connection_name: str + :param authorization_rule_name: The authorization rule name. + :type authorization_rule_name: str + :param rights: The rights associated with the rule. + :type rights: list[str or ~azure.mgmt.relay.models.AccessRights] + :param dict custom_headers: headers that will be added to the request + :param bool raw: returns the direct response alongside the + deserialized response + :param operation_config: :ref:`Operation configuration + overrides`. + :return: AuthorizationRule or ClientRawResponse if raw=true + :rtype: ~azure.mgmt.relay.models.AuthorizationRule or + ~msrest.pipeline.ClientRawResponse + :raises: + :class:`ErrorResponseException` + """ + parameters = models.AuthorizationRule(rights=rights) + + # Construct URL + url = '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Relay/namespaces/{namespaceName}/hybridConnections/{hybridConnectionName}/authorizationRules/{authorizationRuleName}' + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), + 'namespaceName': self._serialize.url("namespace_name", namespace_name, 'str', max_length=50, min_length=6), + 'hybridConnectionName': self._serialize.url("hybrid_connection_name", hybrid_connection_name, 'str', min_length=1), + 'authorizationRuleName': self._serialize.url("authorization_rule_name", authorization_rule_name, 'str', min_length=1), + 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str') + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} + query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + + # Construct headers + header_parameters = {} + header_parameters['Content-Type'] = 'application/json; charset=utf-8' + if self.config.generate_client_request_id: + header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) + if custom_headers: + header_parameters.update(custom_headers) + if self.config.accept_language is not None: + header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') + + # Construct body + body_content = self._serialize.body(parameters, 'AuthorizationRule') + + # Construct and send request + request = self._client.put(url, query_parameters) + response = self._client.send( + request, header_parameters, body_content, **operation_config) + + if response.status_code not in [200]: + raise models.ErrorResponseException(self._deserialize, response) + + deserialized = None + + if response.status_code == 200: + deserialized = self._deserialize('AuthorizationRule', response) + + if raw: + client_raw_response = ClientRawResponse(deserialized, response) + return client_raw_response + + return deserialized + + def delete_authorization_rule( + self, resource_group_name, namespace_name, hybrid_connection_name, authorization_rule_name, custom_headers=None, raw=False, **operation_config): + """Deletes a hybrid connection authorization rule. + + :param resource_group_name: Name of the Resource group within the + Azure subscription. + :type resource_group_name: str + :param namespace_name: The namespace name + :type namespace_name: str + :param hybrid_connection_name: The hybrid connection name. + :type hybrid_connection_name: str + :param authorization_rule_name: The authorization rule name. + :type authorization_rule_name: str + :param dict custom_headers: headers that will be added to the request + :param bool raw: returns the direct response alongside the + deserialized response + :param operation_config: :ref:`Operation configuration + overrides`. + :return: None or ClientRawResponse if raw=true + :rtype: None or ~msrest.pipeline.ClientRawResponse + :raises: + :class:`ErrorResponseException` + """ + # Construct URL + url = '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Relay/namespaces/{namespaceName}/hybridConnections/{hybridConnectionName}/authorizationRules/{authorizationRuleName}' + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), + 'namespaceName': self._serialize.url("namespace_name", namespace_name, 'str', max_length=50, min_length=6), + 'hybridConnectionName': self._serialize.url("hybrid_connection_name", hybrid_connection_name, 'str', min_length=1), + 'authorizationRuleName': self._serialize.url("authorization_rule_name", authorization_rule_name, 'str', min_length=1), + 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str') + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} + query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + + # Construct headers + header_parameters = {} + header_parameters['Content-Type'] = 'application/json; charset=utf-8' + if self.config.generate_client_request_id: + header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) + if custom_headers: + header_parameters.update(custom_headers) + if self.config.accept_language is not None: + header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') + + # Construct and send request + request = self._client.delete(url, query_parameters) + response = self._client.send(request, header_parameters, **operation_config) + + if response.status_code not in [200, 204]: + raise models.ErrorResponseException(self._deserialize, response) + + if raw: + client_raw_response = ClientRawResponse(None, response) + return client_raw_response + + def get_authorization_rule( + self, resource_group_name, namespace_name, hybrid_connection_name, authorization_rule_name, custom_headers=None, raw=False, **operation_config): + """Hybrid connection authorization rule for a hybrid connection by name. + + :param resource_group_name: Name of the Resource group within the + Azure subscription. + :type resource_group_name: str + :param namespace_name: The namespace name + :type namespace_name: str + :param hybrid_connection_name: The hybrid connection name. + :type hybrid_connection_name: str + :param authorization_rule_name: The authorization rule name. + :type authorization_rule_name: str + :param dict custom_headers: headers that will be added to the request + :param bool raw: returns the direct response alongside the + deserialized response + :param operation_config: :ref:`Operation configuration + overrides`. + :return: AuthorizationRule or ClientRawResponse if raw=true + :rtype: ~azure.mgmt.relay.models.AuthorizationRule or + ~msrest.pipeline.ClientRawResponse + :raises: + :class:`ErrorResponseException` + """ + # Construct URL + url = '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Relay/namespaces/{namespaceName}/hybridConnections/{hybridConnectionName}/authorizationRules/{authorizationRuleName}' + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), + 'namespaceName': self._serialize.url("namespace_name", namespace_name, 'str', max_length=50, min_length=6), + 'hybridConnectionName': self._serialize.url("hybrid_connection_name", hybrid_connection_name, 'str', min_length=1), + 'authorizationRuleName': self._serialize.url("authorization_rule_name", authorization_rule_name, 'str', min_length=1), + 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str') + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} + query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + + # Construct headers + header_parameters = {} + header_parameters['Content-Type'] = 'application/json; charset=utf-8' + if self.config.generate_client_request_id: + header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) + if custom_headers: + header_parameters.update(custom_headers) + if self.config.accept_language is not None: + header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') + + # Construct and send request + request = self._client.get(url, query_parameters) + response = self._client.send(request, header_parameters, **operation_config) + + if response.status_code not in [200]: + raise models.ErrorResponseException(self._deserialize, response) + + deserialized = None + + if response.status_code == 200: + deserialized = self._deserialize('AuthorizationRule', response) + + if raw: + client_raw_response = ClientRawResponse(deserialized, response) + return client_raw_response + + return deserialized + + def list_keys( + self, resource_group_name, namespace_name, hybrid_connection_name, authorization_rule_name, custom_headers=None, raw=False, **operation_config): + """Primary and secondary connection strings to the hybrid connection. + + :param resource_group_name: Name of the Resource group within the + Azure subscription. + :type resource_group_name: str + :param namespace_name: The namespace name + :type namespace_name: str + :param hybrid_connection_name: The hybrid connection name. + :type hybrid_connection_name: str + :param authorization_rule_name: The authorization rule name. + :type authorization_rule_name: str + :param dict custom_headers: headers that will be added to the request + :param bool raw: returns the direct response alongside the + deserialized response + :param operation_config: :ref:`Operation configuration + overrides`. + :return: AccessKeys or ClientRawResponse if raw=true + :rtype: ~azure.mgmt.relay.models.AccessKeys or + ~msrest.pipeline.ClientRawResponse + :raises: + :class:`ErrorResponseException` + """ + # Construct URL + url = '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Relay/namespaces/{namespaceName}/hybridConnections/{hybridConnectionName}/authorizationRules/{authorizationRuleName}/listKeys' + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), + 'namespaceName': self._serialize.url("namespace_name", namespace_name, 'str', max_length=50, min_length=6), + 'hybridConnectionName': self._serialize.url("hybrid_connection_name", hybrid_connection_name, 'str', min_length=1), + 'authorizationRuleName': self._serialize.url("authorization_rule_name", authorization_rule_name, 'str', min_length=1), + 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str') + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} + query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + + # Construct headers + header_parameters = {} + header_parameters['Content-Type'] = 'application/json; charset=utf-8' + if self.config.generate_client_request_id: + header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) + if custom_headers: + header_parameters.update(custom_headers) + if self.config.accept_language is not None: + header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') + + # Construct and send request + request = self._client.post(url, query_parameters) + response = self._client.send(request, header_parameters, **operation_config) + + if response.status_code not in [200]: + raise models.ErrorResponseException(self._deserialize, response) + + deserialized = None + + if response.status_code == 200: + deserialized = self._deserialize('AccessKeys', response) + + if raw: + client_raw_response = ClientRawResponse(deserialized, response) + return client_raw_response + + return deserialized + + def regenerate_keys( + self, resource_group_name, namespace_name, hybrid_connection_name, authorization_rule_name, key_type, key=None, custom_headers=None, raw=False, **operation_config): + """Regenerates the primary or secondary connection strings to the hybrid + connection. + + :param resource_group_name: Name of the Resource group within the + Azure subscription. + :type resource_group_name: str + :param namespace_name: The namespace name + :type namespace_name: str + :param hybrid_connection_name: The hybrid connection name. + :type hybrid_connection_name: str + :param authorization_rule_name: The authorization rule name. + :type authorization_rule_name: str + :param key_type: The access key to regenerate. Possible values + include: 'PrimaryKey', 'SecondaryKey' + :type key_type: str or ~azure.mgmt.relay.models.KeyType + :param key: Optional. If the key value is provided, this is set to key + type, or autogenerated key value set for key type. + :type key: str + :param dict custom_headers: headers that will be added to the request + :param bool raw: returns the direct response alongside the + deserialized response + :param operation_config: :ref:`Operation configuration + overrides`. + :return: AccessKeys or ClientRawResponse if raw=true + :rtype: ~azure.mgmt.relay.models.AccessKeys or + ~msrest.pipeline.ClientRawResponse + :raises: + :class:`ErrorResponseException` + """ + parameters = models.RegenerateAccessKeyParameters(key_type=key_type, key=key) + + # Construct URL + url = '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Relay/namespaces/{namespaceName}/hybridConnections/{hybridConnectionName}/authorizationRules/{authorizationRuleName}/regenerateKeys' + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), + 'namespaceName': self._serialize.url("namespace_name", namespace_name, 'str', max_length=50, min_length=6), + 'hybridConnectionName': self._serialize.url("hybrid_connection_name", hybrid_connection_name, 'str', min_length=1), + 'authorizationRuleName': self._serialize.url("authorization_rule_name", authorization_rule_name, 'str', min_length=1), + 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str') + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} + query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + + # Construct headers + header_parameters = {} + header_parameters['Content-Type'] = 'application/json; charset=utf-8' + if self.config.generate_client_request_id: + header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) + if custom_headers: + header_parameters.update(custom_headers) + if self.config.accept_language is not None: + header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') + + # Construct body + body_content = self._serialize.body(parameters, 'RegenerateAccessKeyParameters') + + # Construct and send request + request = self._client.post(url, query_parameters) + response = self._client.send( + request, header_parameters, body_content, **operation_config) + + if response.status_code not in [200]: + raise models.ErrorResponseException(self._deserialize, response) + + deserialized = None + + if response.status_code == 200: + deserialized = self._deserialize('AccessKeys', response) + + if raw: + client_raw_response = ClientRawResponse(deserialized, response) + return client_raw_response + + return deserialized diff --git a/src/relay/azext_relay/relay/operations/namespaces_operations.py b/src/relay/azext_relay/relay/operations/namespaces_operations.py new file mode 100644 index 00000000000..a3970cfab27 --- /dev/null +++ b/src/relay/azext_relay/relay/operations/namespaces_operations.py @@ -0,0 +1,939 @@ +# 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. +# -------------------------------------------------------------------------- + +import uuid +from msrest.pipeline import ClientRawResponse +from msrestazure.azure_operation import AzureOperationPoller + +from .. import models + + +class NamespacesOperations(object): + """NamespacesOperations operations. + + :param client: Client for service requests. + :param config: Configuration of service client. + :param serializer: An object model serializer. + :param deserializer: An objec model deserializer. + :ivar api_version: Client API version. Constant value: "2017-04-01". + """ + + def __init__(self, client, config, serializer, deserializer): + + self._client = client + self._serialize = serializer + self._deserialize = deserializer + self.api_version = "2017-04-01" + + self.config = config + + def check_name_availability_method( + self, name, custom_headers=None, raw=False, **operation_config): + """Check the specified namespace name availability. + + :param name: The namespace name to check for availability. The + namespace name can contain only letters, numbers, and hyphens. The + namespace must start with a letter, and it must end with a letter or + number. + :type name: str + :param dict custom_headers: headers that will be added to the request + :param bool raw: returns the direct response alongside the + deserialized response + :param operation_config: :ref:`Operation configuration + overrides`. + :return: CheckNameAvailabilityResult or ClientRawResponse if raw=true + :rtype: ~azure.mgmt.relay.models.CheckNameAvailabilityResult or + ~msrest.pipeline.ClientRawResponse + :raises: + :class:`ErrorResponseException` + """ + parameters = models.CheckNameAvailability(name=name) + + # Construct URL + url = '/subscriptions/{subscriptionId}/providers/Microsoft.Relay/checkNameAvailability' + path_format_arguments = { + 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str') + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} + query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + + # Construct headers + header_parameters = {} + header_parameters['Content-Type'] = 'application/json; charset=utf-8' + if self.config.generate_client_request_id: + header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) + if custom_headers: + header_parameters.update(custom_headers) + if self.config.accept_language is not None: + header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') + + # Construct body + body_content = self._serialize.body(parameters, 'CheckNameAvailability') + + # Construct and send request + request = self._client.post(url, query_parameters) + response = self._client.send( + request, header_parameters, body_content, **operation_config) + + if response.status_code not in [200]: + raise models.ErrorResponseException(self._deserialize, response) + + deserialized = None + + if response.status_code == 200: + deserialized = self._deserialize('CheckNameAvailabilityResult', response) + + if raw: + client_raw_response = ClientRawResponse(deserialized, response) + return client_raw_response + + return deserialized + + def list( + self, custom_headers=None, raw=False, **operation_config): + """Lists all the available namespaces within the subscription regardless + of the resourceGroups. + + :param dict custom_headers: headers that will be added to the request + :param bool raw: returns the direct response alongside the + deserialized response + :param operation_config: :ref:`Operation configuration + overrides`. + :return: An iterator like instance of RelayNamespace + :rtype: + ~azure.mgmt.relay.models.RelayNamespacePaged[~azure.mgmt.relay.models.RelayNamespace] + :raises: + :class:`ErrorResponseException` + """ + def internal_paging(next_link=None, raw=False): + + if not next_link: + # Construct URL + url = '/subscriptions/{subscriptionId}/providers/Microsoft.Relay/namespaces' + path_format_arguments = { + 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str') + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} + query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + + else: + url = next_link + query_parameters = {} + + # Construct headers + header_parameters = {} + header_parameters['Content-Type'] = 'application/json; charset=utf-8' + if self.config.generate_client_request_id: + header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) + if custom_headers: + header_parameters.update(custom_headers) + if self.config.accept_language is not None: + header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') + + # Construct and send request + request = self._client.get(url, query_parameters) + response = self._client.send( + request, header_parameters, **operation_config) + + if response.status_code not in [200]: + raise models.ErrorResponseException(self._deserialize, response) + + return response + + # Deserialize response + deserialized = models.RelayNamespacePaged(internal_paging, self._deserialize.dependencies) + + if raw: + header_dict = {} + client_raw_response = models.RelayNamespacePaged(internal_paging, self._deserialize.dependencies, header_dict) + return client_raw_response + + return deserialized + + def list_by_resource_group( + self, resource_group_name, custom_headers=None, raw=False, **operation_config): + """Lists all the available namespaces within the ResourceGroup. + + :param resource_group_name: Name of the Resource group within the + Azure subscription. + :type resource_group_name: str + :param dict custom_headers: headers that will be added to the request + :param bool raw: returns the direct response alongside the + deserialized response + :param operation_config: :ref:`Operation configuration + overrides`. + :return: An iterator like instance of RelayNamespace + :rtype: + ~azure.mgmt.relay.models.RelayNamespacePaged[~azure.mgmt.relay.models.RelayNamespace] + :raises: + :class:`ErrorResponseException` + """ + def internal_paging(next_link=None, raw=False): + + if not next_link: + # Construct URL + url = '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Relay/namespaces' + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), + 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str') + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} + query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + + else: + url = next_link + query_parameters = {} + + # Construct headers + header_parameters = {} + header_parameters['Content-Type'] = 'application/json; charset=utf-8' + if self.config.generate_client_request_id: + header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) + if custom_headers: + header_parameters.update(custom_headers) + if self.config.accept_language is not None: + header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') + + # Construct and send request + request = self._client.get(url, query_parameters) + response = self._client.send( + request, header_parameters, **operation_config) + + if response.status_code not in [200]: + raise models.ErrorResponseException(self._deserialize, response) + + return response + + # Deserialize response + deserialized = models.RelayNamespacePaged(internal_paging, self._deserialize.dependencies) + + if raw: + header_dict = {} + client_raw_response = models.RelayNamespacePaged(internal_paging, self._deserialize.dependencies, header_dict) + return client_raw_response + + return deserialized + + def create_or_update( + self, resource_group_name, namespace_name, parameters, custom_headers=None, raw=False, **operation_config): + """Create Azure Relay namespace. + + :param resource_group_name: Name of the Resource group within the + Azure subscription. + :type resource_group_name: str + :param namespace_name: The namespace name + :type namespace_name: str + :param parameters: Parameters supplied to create a namespace resource. + :type parameters: ~azure.mgmt.relay.models.RelayNamespace + :param dict custom_headers: headers that will be added to the request + :param bool raw: returns the direct response alongside the + deserialized response + :return: An instance of AzureOperationPoller that returns + RelayNamespace or ClientRawResponse if raw=true + :rtype: + ~msrestazure.azure_operation.AzureOperationPoller[~azure.mgmt.relay.models.RelayNamespace] + or ~msrest.pipeline.ClientRawResponse + :raises: + :class:`ErrorResponseException` + """ + # Construct URL + url = '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Relay/namespaces/{namespaceName}' + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), + 'namespaceName': self._serialize.url("namespace_name", namespace_name, 'str', max_length=50, min_length=6), + 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str') + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} + query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + + # Construct headers + header_parameters = {} + header_parameters['Content-Type'] = 'application/json; charset=utf-8' + if self.config.generate_client_request_id: + header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) + if custom_headers: + header_parameters.update(custom_headers) + if self.config.accept_language is not None: + header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') + + # Construct body + body_content = self._serialize.body(parameters, 'RelayNamespace') + + # Construct and send request + def long_running_send(): + + request = self._client.put(url, query_parameters) + return self._client.send( + request, header_parameters, body_content, **operation_config) + + def get_long_running_status(status_link, headers=None): + + request = self._client.get(status_link) + if headers: + request.headers.update(headers) + return self._client.send( + request, header_parameters, **operation_config) + + def get_long_running_output(response): + + if response.status_code not in [200, 201]: + raise models.ErrorResponseException(self._deserialize, response) + + deserialized = None + + if response.status_code == 200: + deserialized = self._deserialize('RelayNamespace', response) + if response.status_code == 201: + deserialized = self._deserialize('RelayNamespace', response) + + if raw: + client_raw_response = ClientRawResponse(deserialized, response) + return client_raw_response + + return deserialized + + if raw: + response = long_running_send() + return get_long_running_output(response) + + long_running_operation_timeout = operation_config.get( + 'long_running_operation_timeout', + self.config.long_running_operation_timeout) + return AzureOperationPoller( + long_running_send, get_long_running_output, + get_long_running_status, long_running_operation_timeout) + + def delete( + self, resource_group_name, namespace_name, custom_headers=None, raw=False, **operation_config): + """Deletes an existing namespace. This operation also removes all + associated resources under the namespace. + + :param resource_group_name: Name of the Resource group within the + Azure subscription. + :type resource_group_name: str + :param namespace_name: The namespace name + :type namespace_name: str + :param dict custom_headers: headers that will be added to the request + :param bool raw: returns the direct response alongside the + deserialized response + :return: An instance of AzureOperationPoller that returns None or + ClientRawResponse if raw=true + :rtype: ~msrestazure.azure_operation.AzureOperationPoller[None] or + ~msrest.pipeline.ClientRawResponse + :raises: + :class:`ErrorResponseException` + """ + # Construct URL + url = '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Relay/namespaces/{namespaceName}' + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), + 'namespaceName': self._serialize.url("namespace_name", namespace_name, 'str', max_length=50, min_length=6), + 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str') + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} + query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + + # Construct headers + header_parameters = {} + header_parameters['Content-Type'] = 'application/json; charset=utf-8' + if self.config.generate_client_request_id: + header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) + if custom_headers: + header_parameters.update(custom_headers) + if self.config.accept_language is not None: + header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') + + # Construct and send request + def long_running_send(): + + request = self._client.delete(url, query_parameters) + return self._client.send(request, header_parameters, **operation_config) + + def get_long_running_status(status_link, headers=None): + + request = self._client.get(status_link) + if headers: + request.headers.update(headers) + return self._client.send( + request, header_parameters, **operation_config) + + def get_long_running_output(response): + + if response.status_code not in [200, 202, 204]: + raise models.ErrorResponseException(self._deserialize, response) + + if raw: + client_raw_response = ClientRawResponse(None, response) + return client_raw_response + + if raw: + response = long_running_send() + return get_long_running_output(response) + + long_running_operation_timeout = operation_config.get( + 'long_running_operation_timeout', + self.config.long_running_operation_timeout) + return AzureOperationPoller( + long_running_send, get_long_running_output, + get_long_running_status, long_running_operation_timeout) + + def get( + self, resource_group_name, namespace_name, custom_headers=None, raw=False, **operation_config): + """Returns the description for the specified namespace. + + :param resource_group_name: Name of the Resource group within the + Azure subscription. + :type resource_group_name: str + :param namespace_name: The namespace name + :type namespace_name: str + :param dict custom_headers: headers that will be added to the request + :param bool raw: returns the direct response alongside the + deserialized response + :param operation_config: :ref:`Operation configuration + overrides`. + :return: RelayNamespace or ClientRawResponse if raw=true + :rtype: ~azure.mgmt.relay.models.RelayNamespace or + ~msrest.pipeline.ClientRawResponse + :raises: + :class:`ErrorResponseException` + """ + # Construct URL + url = '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Relay/namespaces/{namespaceName}' + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), + 'namespaceName': self._serialize.url("namespace_name", namespace_name, 'str', max_length=50, min_length=6), + 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str') + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} + query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + + # Construct headers + header_parameters = {} + header_parameters['Content-Type'] = 'application/json; charset=utf-8' + if self.config.generate_client_request_id: + header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) + if custom_headers: + header_parameters.update(custom_headers) + if self.config.accept_language is not None: + header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') + + # Construct and send request + request = self._client.get(url, query_parameters) + response = self._client.send(request, header_parameters, **operation_config) + + if response.status_code not in [200]: + raise models.ErrorResponseException(self._deserialize, response) + + deserialized = None + + if response.status_code == 200: + deserialized = self._deserialize('RelayNamespace', response) + + if raw: + client_raw_response = ClientRawResponse(deserialized, response) + return client_raw_response + + return deserialized + + def update( + self, resource_group_name, namespace_name, tags=None, sku=None, custom_headers=None, raw=False, **operation_config): + """Creates or updates a namespace. Once created, this namespace's resource + manifest is immutable. This operation is idempotent. + + :param resource_group_name: Name of the Resource group within the + Azure subscription. + :type resource_group_name: str + :param namespace_name: The namespace name + :type namespace_name: str + :param tags: Resource tags. + :type tags: dict[str, str] + :param sku: SKU of the namespace. + :type sku: ~azure.mgmt.relay.models.Sku + :param dict custom_headers: headers that will be added to the request + :param bool raw: returns the direct response alongside the + deserialized response + :param operation_config: :ref:`Operation configuration + overrides`. + :return: RelayNamespace or ClientRawResponse if raw=true + :rtype: ~azure.mgmt.relay.models.RelayNamespace or + ~msrest.pipeline.ClientRawResponse + :raises: + :class:`ErrorResponseException` + """ + parameters = models.RelayUpdateParameters(tags=tags, sku=sku) + + # Construct URL + url = '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Relay/namespaces/{namespaceName}' + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), + 'namespaceName': self._serialize.url("namespace_name", namespace_name, 'str', max_length=50, min_length=6), + 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str') + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} + query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + + # Construct headers + header_parameters = {} + header_parameters['Content-Type'] = 'application/json; charset=utf-8' + if self.config.generate_client_request_id: + header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) + if custom_headers: + header_parameters.update(custom_headers) + if self.config.accept_language is not None: + header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') + + # Construct body + body_content = self._serialize.body(parameters, 'RelayUpdateParameters') + + # Construct and send request + request = self._client.patch(url, query_parameters) + response = self._client.send( + request, header_parameters, body_content, **operation_config) + + if response.status_code not in [200, 201]: + raise models.ErrorResponseException(self._deserialize, response) + + deserialized = None + + if response.status_code == 200: + deserialized = self._deserialize('RelayNamespace', response) + if response.status_code == 201: + deserialized = self._deserialize('RelayNamespace', response) + + if raw: + client_raw_response = ClientRawResponse(deserialized, response) + return client_raw_response + + return deserialized + + def list_authorization_rules( + self, resource_group_name, namespace_name, custom_headers=None, raw=False, **operation_config): + """Authorization rules for a namespace. + + :param resource_group_name: Name of the Resource group within the + Azure subscription. + :type resource_group_name: str + :param namespace_name: The namespace name + :type namespace_name: str + :param dict custom_headers: headers that will be added to the request + :param bool raw: returns the direct response alongside the + deserialized response + :param operation_config: :ref:`Operation configuration + overrides`. + :return: An iterator like instance of AuthorizationRule + :rtype: + ~azure.mgmt.relay.models.AuthorizationRulePaged[~azure.mgmt.relay.models.AuthorizationRule] + :raises: + :class:`ErrorResponseException` + """ + def internal_paging(next_link=None, raw=False): + + if not next_link: + # Construct URL + url = '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Relay/namespaces/{namespaceName}/authorizationRules' + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), + 'namespaceName': self._serialize.url("namespace_name", namespace_name, 'str', max_length=50, min_length=6), + 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str') + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} + query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + + else: + url = next_link + query_parameters = {} + + # Construct headers + header_parameters = {} + header_parameters['Content-Type'] = 'application/json; charset=utf-8' + if self.config.generate_client_request_id: + header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) + if custom_headers: + header_parameters.update(custom_headers) + if self.config.accept_language is not None: + header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') + + # Construct and send request + request = self._client.get(url, query_parameters) + response = self._client.send( + request, header_parameters, **operation_config) + + if response.status_code not in [200]: + raise models.ErrorResponseException(self._deserialize, response) + + return response + + # Deserialize response + deserialized = models.AuthorizationRulePaged(internal_paging, self._deserialize.dependencies) + + if raw: + header_dict = {} + client_raw_response = models.AuthorizationRulePaged(internal_paging, self._deserialize.dependencies, header_dict) + return client_raw_response + + return deserialized + + def create_or_update_authorization_rule( + self, resource_group_name, namespace_name, authorization_rule_name, rights=None, custom_headers=None, raw=False, **operation_config): + """Creates or updates an authorization rule for a namespace. + + :param resource_group_name: Name of the Resource group within the + Azure subscription. + :type resource_group_name: str + :param namespace_name: The namespace name + :type namespace_name: str + :param authorization_rule_name: The authorization rule name. + :type authorization_rule_name: str + :param rights: The rights associated with the rule. + :type rights: list[str or ~azure.mgmt.relay.models.AccessRights] + :param dict custom_headers: headers that will be added to the request + :param bool raw: returns the direct response alongside the + deserialized response + :param operation_config: :ref:`Operation configuration + overrides`. + :return: AuthorizationRule or ClientRawResponse if raw=true + :rtype: ~azure.mgmt.relay.models.AuthorizationRule or + ~msrest.pipeline.ClientRawResponse + :raises: + :class:`ErrorResponseException` + """ + parameters = models.AuthorizationRule(rights=rights) + + # Construct URL + url = '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Relay/namespaces/{namespaceName}/authorizationRules/{authorizationRuleName}' + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), + 'namespaceName': self._serialize.url("namespace_name", namespace_name, 'str', max_length=50, min_length=6), + 'authorizationRuleName': self._serialize.url("authorization_rule_name", authorization_rule_name, 'str', min_length=1), + 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str') + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} + query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + + # Construct headers + header_parameters = {} + header_parameters['Content-Type'] = 'application/json; charset=utf-8' + if self.config.generate_client_request_id: + header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) + if custom_headers: + header_parameters.update(custom_headers) + if self.config.accept_language is not None: + header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') + + # Construct body + body_content = self._serialize.body(parameters, 'AuthorizationRule') + + # Construct and send request + request = self._client.put(url, query_parameters) + response = self._client.send( + request, header_parameters, body_content, **operation_config) + + if response.status_code not in [200]: + raise models.ErrorResponseException(self._deserialize, response) + + deserialized = None + + if response.status_code == 200: + deserialized = self._deserialize('AuthorizationRule', response) + + if raw: + client_raw_response = ClientRawResponse(deserialized, response) + return client_raw_response + + return deserialized + + def delete_authorization_rule( + self, resource_group_name, namespace_name, authorization_rule_name, custom_headers=None, raw=False, **operation_config): + """Deletes a namespace authorization rule. + + :param resource_group_name: Name of the Resource group within the + Azure subscription. + :type resource_group_name: str + :param namespace_name: The namespace name + :type namespace_name: str + :param authorization_rule_name: The authorization rule name. + :type authorization_rule_name: str + :param dict custom_headers: headers that will be added to the request + :param bool raw: returns the direct response alongside the + deserialized response + :param operation_config: :ref:`Operation configuration + overrides`. + :return: None or ClientRawResponse if raw=true + :rtype: None or ~msrest.pipeline.ClientRawResponse + :raises: + :class:`ErrorResponseException` + """ + # Construct URL + url = '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Relay/namespaces/{namespaceName}/authorizationRules/{authorizationRuleName}' + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), + 'namespaceName': self._serialize.url("namespace_name", namespace_name, 'str', max_length=50, min_length=6), + 'authorizationRuleName': self._serialize.url("authorization_rule_name", authorization_rule_name, 'str', min_length=1), + 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str') + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} + query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + + # Construct headers + header_parameters = {} + header_parameters['Content-Type'] = 'application/json; charset=utf-8' + if self.config.generate_client_request_id: + header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) + if custom_headers: + header_parameters.update(custom_headers) + if self.config.accept_language is not None: + header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') + + # Construct and send request + request = self._client.delete(url, query_parameters) + response = self._client.send(request, header_parameters, **operation_config) + + if response.status_code not in [200, 204]: + raise models.ErrorResponseException(self._deserialize, response) + + if raw: + client_raw_response = ClientRawResponse(None, response) + return client_raw_response + + def get_authorization_rule( + self, resource_group_name, namespace_name, authorization_rule_name, custom_headers=None, raw=False, **operation_config): + """Authorization rule for a namespace by name. + + :param resource_group_name: Name of the Resource group within the + Azure subscription. + :type resource_group_name: str + :param namespace_name: The namespace name + :type namespace_name: str + :param authorization_rule_name: The authorization rule name. + :type authorization_rule_name: str + :param dict custom_headers: headers that will be added to the request + :param bool raw: returns the direct response alongside the + deserialized response + :param operation_config: :ref:`Operation configuration + overrides`. + :return: AuthorizationRule or ClientRawResponse if raw=true + :rtype: ~azure.mgmt.relay.models.AuthorizationRule or + ~msrest.pipeline.ClientRawResponse + :raises: + :class:`ErrorResponseException` + """ + # Construct URL + url = '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Relay/namespaces/{namespaceName}/authorizationRules/{authorizationRuleName}' + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), + 'namespaceName': self._serialize.url("namespace_name", namespace_name, 'str', max_length=50, min_length=6), + 'authorizationRuleName': self._serialize.url("authorization_rule_name", authorization_rule_name, 'str', min_length=1), + 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str') + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} + query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + + # Construct headers + header_parameters = {} + header_parameters['Content-Type'] = 'application/json; charset=utf-8' + if self.config.generate_client_request_id: + header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) + if custom_headers: + header_parameters.update(custom_headers) + if self.config.accept_language is not None: + header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') + + # Construct and send request + request = self._client.get(url, query_parameters) + response = self._client.send(request, header_parameters, **operation_config) + + if response.status_code not in [200]: + raise models.ErrorResponseException(self._deserialize, response) + + deserialized = None + + if response.status_code == 200: + deserialized = self._deserialize('AuthorizationRule', response) + + if raw: + client_raw_response = ClientRawResponse(deserialized, response) + return client_raw_response + + return deserialized + + def list_keys( + self, resource_group_name, namespace_name, authorization_rule_name, custom_headers=None, raw=False, **operation_config): + """Primary and secondary connection strings to the namespace. + + :param resource_group_name: Name of the Resource group within the + Azure subscription. + :type resource_group_name: str + :param namespace_name: The namespace name + :type namespace_name: str + :param authorization_rule_name: The authorization rule name. + :type authorization_rule_name: str + :param dict custom_headers: headers that will be added to the request + :param bool raw: returns the direct response alongside the + deserialized response + :param operation_config: :ref:`Operation configuration + overrides`. + :return: AccessKeys or ClientRawResponse if raw=true + :rtype: ~azure.mgmt.relay.models.AccessKeys or + ~msrest.pipeline.ClientRawResponse + :raises: + :class:`ErrorResponseException` + """ + # Construct URL + url = '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Relay/namespaces/{namespaceName}/authorizationRules/{authorizationRuleName}/listKeys' + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), + 'namespaceName': self._serialize.url("namespace_name", namespace_name, 'str', max_length=50, min_length=6), + 'authorizationRuleName': self._serialize.url("authorization_rule_name", authorization_rule_name, 'str', min_length=1), + 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str') + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} + query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + + # Construct headers + header_parameters = {} + header_parameters['Content-Type'] = 'application/json; charset=utf-8' + if self.config.generate_client_request_id: + header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) + if custom_headers: + header_parameters.update(custom_headers) + if self.config.accept_language is not None: + header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') + + # Construct and send request + request = self._client.post(url, query_parameters) + response = self._client.send(request, header_parameters, **operation_config) + + if response.status_code not in [200]: + raise models.ErrorResponseException(self._deserialize, response) + + deserialized = None + + if response.status_code == 200: + deserialized = self._deserialize('AccessKeys', response) + + if raw: + client_raw_response = ClientRawResponse(deserialized, response) + return client_raw_response + + return deserialized + + def regenerate_keys( + self, resource_group_name, namespace_name, authorization_rule_name, key_type, key=None, custom_headers=None, raw=False, **operation_config): + """Regenerates the primary or secondary connection strings to the + namespace. + + :param resource_group_name: Name of the Resource group within the + Azure subscription. + :type resource_group_name: str + :param namespace_name: The namespace name + :type namespace_name: str + :param authorization_rule_name: The authorization rule name. + :type authorization_rule_name: str + :param key_type: The access key to regenerate. Possible values + include: 'PrimaryKey', 'SecondaryKey' + :type key_type: str or ~azure.mgmt.relay.models.KeyType + :param key: Optional. If the key value is provided, this is set to key + type, or autogenerated key value set for key type. + :type key: str + :param dict custom_headers: headers that will be added to the request + :param bool raw: returns the direct response alongside the + deserialized response + :param operation_config: :ref:`Operation configuration + overrides`. + :return: AccessKeys or ClientRawResponse if raw=true + :rtype: ~azure.mgmt.relay.models.AccessKeys or + ~msrest.pipeline.ClientRawResponse + :raises: + :class:`ErrorResponseException` + """ + parameters = models.RegenerateAccessKeyParameters(key_type=key_type, key=key) + + # Construct URL + url = '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Relay/namespaces/{namespaceName}/authorizationRules/{authorizationRuleName}/regenerateKeys' + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), + 'namespaceName': self._serialize.url("namespace_name", namespace_name, 'str', max_length=50, min_length=6), + 'authorizationRuleName': self._serialize.url("authorization_rule_name", authorization_rule_name, 'str', min_length=1), + 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str') + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} + query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + + # Construct headers + header_parameters = {} + header_parameters['Content-Type'] = 'application/json; charset=utf-8' + if self.config.generate_client_request_id: + header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) + if custom_headers: + header_parameters.update(custom_headers) + if self.config.accept_language is not None: + header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') + + # Construct body + body_content = self._serialize.body(parameters, 'RegenerateAccessKeyParameters') + + # Construct and send request + request = self._client.post(url, query_parameters) + response = self._client.send( + request, header_parameters, body_content, **operation_config) + + if response.status_code not in [200]: + raise models.ErrorResponseException(self._deserialize, response) + + deserialized = None + + if response.status_code == 200: + deserialized = self._deserialize('AccessKeys', response) + + if raw: + client_raw_response = ClientRawResponse(deserialized, response) + return client_raw_response + + return deserialized diff --git a/src/relay/azext_relay/relay/operations/operations.py b/src/relay/azext_relay/relay/operations/operations.py new file mode 100644 index 00000000000..b73983961fe --- /dev/null +++ b/src/relay/azext_relay/relay/operations/operations.py @@ -0,0 +1,94 @@ +# 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. +# -------------------------------------------------------------------------- + +import uuid +from msrest.pipeline import ClientRawResponse + +from .. import models + + +class Operations(object): + """Operations operations. + + :param client: Client for service requests. + :param config: Configuration of service client. + :param serializer: An object model serializer. + :param deserializer: An objec model deserializer. + :ivar api_version: Client API version. Constant value: "2017-04-01". + """ + + def __init__(self, client, config, serializer, deserializer): + + self._client = client + self._serialize = serializer + self._deserialize = deserializer + self.api_version = "2017-04-01" + + self.config = config + + def list( + self, custom_headers=None, raw=False, **operation_config): + """Lists all available Relay REST API operations. + + :param dict custom_headers: headers that will be added to the request + :param bool raw: returns the direct response alongside the + deserialized response + :param operation_config: :ref:`Operation configuration + overrides`. + :return: An iterator like instance of Operation + :rtype: + ~azure.mgmt.relay.models.OperationPaged[~azure.mgmt.relay.models.Operation] + :raises: + :class:`ErrorResponseException` + """ + def internal_paging(next_link=None, raw=False): + + if not next_link: + # Construct URL + url = '/providers/Microsoft.Relay/operations' + + # Construct parameters + query_parameters = {} + query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + + else: + url = next_link + query_parameters = {} + + # Construct headers + header_parameters = {} + header_parameters['Content-Type'] = 'application/json; charset=utf-8' + if self.config.generate_client_request_id: + header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) + if custom_headers: + header_parameters.update(custom_headers) + if self.config.accept_language is not None: + header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') + + # Construct and send request + request = self._client.get(url, query_parameters) + response = self._client.send( + request, header_parameters, **operation_config) + + if response.status_code not in [200]: + raise models.ErrorResponseException(self._deserialize, response) + + return response + + # Deserialize response + deserialized = models.OperationPaged(internal_paging, self._deserialize.dependencies) + + if raw: + header_dict = {} + client_raw_response = models.OperationPaged(internal_paging, self._deserialize.dependencies, header_dict) + return client_raw_response + + return deserialized diff --git a/src/relay/azext_relay/relay/operations/wcf_relays_operations.py b/src/relay/azext_relay/relay/operations/wcf_relays_operations.py new file mode 100644 index 00000000000..87a42a269e5 --- /dev/null +++ b/src/relay/azext_relay/relay/operations/wcf_relays_operations.py @@ -0,0 +1,718 @@ +# 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. +# -------------------------------------------------------------------------- + +import uuid +from msrest.pipeline import ClientRawResponse +from msrestazure.azure_exceptions import CloudError + +from .. import models + + +class WCFRelaysOperations(object): + """WCFRelaysOperations operations. + + :param client: Client for service requests. + :param config: Configuration of service client. + :param serializer: An object model serializer. + :param deserializer: An objec model deserializer. + :ivar api_version: Client API version. Constant value: "2017-04-01". + """ + + def __init__(self, client, config, serializer, deserializer): + + self._client = client + self._serialize = serializer + self._deserialize = deserializer + self.api_version = "2017-04-01" + + self.config = config + + def list_by_namespace( + self, resource_group_name, namespace_name, custom_headers=None, raw=False, **operation_config): + """Lists the WCF relays within the namespace. + + :param resource_group_name: Name of the Resource group within the + Azure subscription. + :type resource_group_name: str + :param namespace_name: The namespace name + :type namespace_name: str + :param dict custom_headers: headers that will be added to the request + :param bool raw: returns the direct response alongside the + deserialized response + :param operation_config: :ref:`Operation configuration + overrides`. + :return: An iterator like instance of WcfRelay + :rtype: + ~azure.mgmt.relay.models.WcfRelayPaged[~azure.mgmt.relay.models.WcfRelay] + :raises: + :class:`ErrorResponseException` + """ + def internal_paging(next_link=None, raw=False): + + if not next_link: + # Construct URL + url = '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Relay/namespaces/{namespaceName}/wcfRelays' + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), + 'namespaceName': self._serialize.url("namespace_name", namespace_name, 'str', max_length=50, min_length=6), + 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str') + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} + query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + + else: + url = next_link + query_parameters = {} + + # Construct headers + header_parameters = {} + header_parameters['Content-Type'] = 'application/json; charset=utf-8' + if self.config.generate_client_request_id: + header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) + if custom_headers: + header_parameters.update(custom_headers) + if self.config.accept_language is not None: + header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') + + # Construct and send request + request = self._client.get(url, query_parameters) + response = self._client.send( + request, header_parameters, **operation_config) + + if response.status_code not in [200]: + raise models.ErrorResponseException(self._deserialize, response) + + return response + + # Deserialize response + deserialized = models.WcfRelayPaged(internal_paging, self._deserialize.dependencies) + + if raw: + header_dict = {} + client_raw_response = models.WcfRelayPaged(internal_paging, self._deserialize.dependencies, header_dict) + return client_raw_response + + return deserialized + + def create_or_update( + self, resource_group_name, namespace_name, relay_name, parameters, custom_headers=None, raw=False, **operation_config): + """Creates or updates a WCF relay. This operation is idempotent. + + :param resource_group_name: Name of the Resource group within the + Azure subscription. + :type resource_group_name: str + :param namespace_name: The namespace name + :type namespace_name: str + :param relay_name: The relay name. + :type relay_name: str + :param parameters: Parameters supplied to create a WCF relay. + :type parameters: ~azure.mgmt.relay.models.WcfRelay + :param dict custom_headers: headers that will be added to the request + :param bool raw: returns the direct response alongside the + deserialized response + :param operation_config: :ref:`Operation configuration + overrides`. + :return: WcfRelay or ClientRawResponse if raw=true + :rtype: ~azure.mgmt.relay.models.WcfRelay or + ~msrest.pipeline.ClientRawResponse + :raises: + :class:`ErrorResponseException` + """ + # Construct URL + url = '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Relay/namespaces/{namespaceName}/wcfRelays/{relayName}' + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), + 'namespaceName': self._serialize.url("namespace_name", namespace_name, 'str', max_length=50, min_length=6), + 'relayName': self._serialize.url("relay_name", relay_name, 'str', min_length=1), + 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str') + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} + query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + + # Construct headers + header_parameters = {} + header_parameters['Content-Type'] = 'application/json; charset=utf-8' + if self.config.generate_client_request_id: + header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) + if custom_headers: + header_parameters.update(custom_headers) + if self.config.accept_language is not None: + header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') + + # Construct body + body_content = self._serialize.body(parameters, 'WcfRelay') + + # Construct and send request + request = self._client.put(url, query_parameters) + response = self._client.send( + request, header_parameters, body_content, **operation_config) + + if response.status_code not in [200]: + raise models.ErrorResponseException(self._deserialize, response) + + deserialized = None + + if response.status_code == 200: + deserialized = self._deserialize('WcfRelay', response) + + if raw: + client_raw_response = ClientRawResponse(deserialized, response) + return client_raw_response + + return deserialized + + def delete( + self, resource_group_name, namespace_name, relay_name, custom_headers=None, raw=False, **operation_config): + """Deletes a WCF relay. + + :param resource_group_name: Name of the Resource group within the + Azure subscription. + :type resource_group_name: str + :param namespace_name: The namespace name + :type namespace_name: str + :param relay_name: The relay name. + :type relay_name: str + :param dict custom_headers: headers that will be added to the request + :param bool raw: returns the direct response alongside the + deserialized response + :param operation_config: :ref:`Operation configuration + overrides`. + :return: None or ClientRawResponse if raw=true + :rtype: None or ~msrest.pipeline.ClientRawResponse + :raises: + :class:`ErrorResponseException` + """ + # Construct URL + url = '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Relay/namespaces/{namespaceName}/wcfRelays/{relayName}' + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), + 'namespaceName': self._serialize.url("namespace_name", namespace_name, 'str', max_length=50, min_length=6), + 'relayName': self._serialize.url("relay_name", relay_name, 'str', min_length=1), + 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str') + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} + query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + + # Construct headers + header_parameters = {} + header_parameters['Content-Type'] = 'application/json; charset=utf-8' + if self.config.generate_client_request_id: + header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) + if custom_headers: + header_parameters.update(custom_headers) + if self.config.accept_language is not None: + header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') + + # Construct and send request + request = self._client.delete(url, query_parameters) + response = self._client.send(request, header_parameters, **operation_config) + + if response.status_code not in [200, 204]: + raise models.ErrorResponseException(self._deserialize, response) + + if raw: + client_raw_response = ClientRawResponse(None, response) + return client_raw_response + + def get( + self, resource_group_name, namespace_name, relay_name, custom_headers=None, raw=False, **operation_config): + """Returns the description for the specified WCF relay. + + :param resource_group_name: Name of the Resource group within the + Azure subscription. + :type resource_group_name: str + :param namespace_name: The namespace name + :type namespace_name: str + :param relay_name: The relay name. + :type relay_name: str + :param dict custom_headers: headers that will be added to the request + :param bool raw: returns the direct response alongside the + deserialized response + :param operation_config: :ref:`Operation configuration + overrides`. + :return: WcfRelay or ClientRawResponse if raw=true + :rtype: ~azure.mgmt.relay.models.WcfRelay or + ~msrest.pipeline.ClientRawResponse + :raises: + :class:`ErrorResponseException` + """ + # Construct URL + url = '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Relay/namespaces/{namespaceName}/wcfRelays/{relayName}' + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), + 'namespaceName': self._serialize.url("namespace_name", namespace_name, 'str', max_length=50, min_length=6), + 'relayName': self._serialize.url("relay_name", relay_name, 'str', min_length=1), + 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str') + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} + query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + + # Construct headers + header_parameters = {} + header_parameters['Content-Type'] = 'application/json; charset=utf-8' + if self.config.generate_client_request_id: + header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) + if custom_headers: + header_parameters.update(custom_headers) + if self.config.accept_language is not None: + header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') + + # Construct and send request + request = self._client.get(url, query_parameters) + response = self._client.send(request, header_parameters, **operation_config) + + if response.status_code not in [200, 204]: + raise models.ErrorResponseException(self._deserialize, response) + + deserialized = None + + if response.status_code == 200: + deserialized = self._deserialize('WcfRelay', response) + + if raw: + client_raw_response = ClientRawResponse(deserialized, response) + return client_raw_response + + return deserialized + + def list_authorization_rules( + self, resource_group_name, namespace_name, relay_name, custom_headers=None, raw=False, **operation_config): + """Authorization rules for a WCF relay. + + :param resource_group_name: Name of the Resource group within the + Azure subscription. + :type resource_group_name: str + :param namespace_name: The namespace name + :type namespace_name: str + :param relay_name: The relay name. + :type relay_name: str + :param dict custom_headers: headers that will be added to the request + :param bool raw: returns the direct response alongside the + deserialized response + :param operation_config: :ref:`Operation configuration + overrides`. + :return: An iterator like instance of AuthorizationRule + :rtype: + ~azure.mgmt.relay.models.AuthorizationRulePaged[~azure.mgmt.relay.models.AuthorizationRule] + :raises: :class:`CloudError` + """ + def internal_paging(next_link=None, raw=False): + + if not next_link: + # Construct URL + url = '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Relay/namespaces/{namespaceName}/wcfRelays/{relayName}/authorizationRules' + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), + 'namespaceName': self._serialize.url("namespace_name", namespace_name, 'str', max_length=50, min_length=6), + 'relayName': self._serialize.url("relay_name", relay_name, 'str', min_length=1), + 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str') + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} + query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + + else: + url = next_link + query_parameters = {} + + # Construct headers + header_parameters = {} + header_parameters['Content-Type'] = 'application/json; charset=utf-8' + if self.config.generate_client_request_id: + header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) + if custom_headers: + header_parameters.update(custom_headers) + if self.config.accept_language is not None: + header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') + + # Construct and send request + request = self._client.get(url, query_parameters) + response = self._client.send( + request, header_parameters, **operation_config) + + if response.status_code not in [200]: + exp = CloudError(response) + exp.request_id = response.headers.get('x-ms-request-id') + raise exp + + return response + + # Deserialize response + deserialized = models.AuthorizationRulePaged(internal_paging, self._deserialize.dependencies) + + if raw: + header_dict = {} + client_raw_response = models.AuthorizationRulePaged(internal_paging, self._deserialize.dependencies, header_dict) + return client_raw_response + + return deserialized + + def create_or_update_authorization_rule( + self, resource_group_name, namespace_name, relay_name, authorization_rule_name, rights=None, custom_headers=None, raw=False, **operation_config): + """Creates or updates an authorization rule for a WCF relay. + + :param resource_group_name: Name of the Resource group within the + Azure subscription. + :type resource_group_name: str + :param namespace_name: The namespace name + :type namespace_name: str + :param relay_name: The relay name. + :type relay_name: str + :param authorization_rule_name: The authorization rule name. + :type authorization_rule_name: str + :param rights: The rights associated with the rule. + :type rights: list[str or ~azure.mgmt.relay.models.AccessRights] + :param dict custom_headers: headers that will be added to the request + :param bool raw: returns the direct response alongside the + deserialized response + :param operation_config: :ref:`Operation configuration + overrides`. + :return: AuthorizationRule or ClientRawResponse if raw=true + :rtype: ~azure.mgmt.relay.models.AuthorizationRule or + ~msrest.pipeline.ClientRawResponse + :raises: + :class:`ErrorResponseException` + """ + parameters = models.AuthorizationRule(rights=rights) + + # Construct URL + url = '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Relay/namespaces/{namespaceName}/wcfRelays/{relayName}/authorizationRules/{authorizationRuleName}' + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), + 'namespaceName': self._serialize.url("namespace_name", namespace_name, 'str', max_length=50, min_length=6), + 'relayName': self._serialize.url("relay_name", relay_name, 'str', min_length=1), + 'authorizationRuleName': self._serialize.url("authorization_rule_name", authorization_rule_name, 'str', min_length=1), + 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str') + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} + query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + + # Construct headers + header_parameters = {} + header_parameters['Content-Type'] = 'application/json; charset=utf-8' + if self.config.generate_client_request_id: + header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) + if custom_headers: + header_parameters.update(custom_headers) + if self.config.accept_language is not None: + header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') + + # Construct body + body_content = self._serialize.body(parameters, 'AuthorizationRule') + + # Construct and send request + request = self._client.put(url, query_parameters) + response = self._client.send( + request, header_parameters, body_content, **operation_config) + + if response.status_code not in [200]: + raise models.ErrorResponseException(self._deserialize, response) + + deserialized = None + + if response.status_code == 200: + deserialized = self._deserialize('AuthorizationRule', response) + + if raw: + client_raw_response = ClientRawResponse(deserialized, response) + return client_raw_response + + return deserialized + + def delete_authorization_rule( + self, resource_group_name, namespace_name, relay_name, authorization_rule_name, custom_headers=None, raw=False, **operation_config): + """Deletes a WCF relay authorization rule. + + :param resource_group_name: Name of the Resource group within the + Azure subscription. + :type resource_group_name: str + :param namespace_name: The namespace name + :type namespace_name: str + :param relay_name: The relay name. + :type relay_name: str + :param authorization_rule_name: The authorization rule name. + :type authorization_rule_name: str + :param dict custom_headers: headers that will be added to the request + :param bool raw: returns the direct response alongside the + deserialized response + :param operation_config: :ref:`Operation configuration + overrides`. + :return: None or ClientRawResponse if raw=true + :rtype: None or ~msrest.pipeline.ClientRawResponse + :raises: + :class:`ErrorResponseException` + """ + # Construct URL + url = '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Relay/namespaces/{namespaceName}/wcfRelays/{relayName}/authorizationRules/{authorizationRuleName}' + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), + 'namespaceName': self._serialize.url("namespace_name", namespace_name, 'str', max_length=50, min_length=6), + 'relayName': self._serialize.url("relay_name", relay_name, 'str', min_length=1), + 'authorizationRuleName': self._serialize.url("authorization_rule_name", authorization_rule_name, 'str', min_length=1), + 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str') + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} + query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + + # Construct headers + header_parameters = {} + header_parameters['Content-Type'] = 'application/json; charset=utf-8' + if self.config.generate_client_request_id: + header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) + if custom_headers: + header_parameters.update(custom_headers) + if self.config.accept_language is not None: + header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') + + # Construct and send request + request = self._client.delete(url, query_parameters) + response = self._client.send(request, header_parameters, **operation_config) + + if response.status_code not in [200, 204]: + raise models.ErrorResponseException(self._deserialize, response) + + if raw: + client_raw_response = ClientRawResponse(None, response) + return client_raw_response + + def get_authorization_rule( + self, resource_group_name, namespace_name, relay_name, authorization_rule_name, custom_headers=None, raw=False, **operation_config): + """Get authorizationRule for a WCF relay by name. + + :param resource_group_name: Name of the Resource group within the + Azure subscription. + :type resource_group_name: str + :param namespace_name: The namespace name + :type namespace_name: str + :param relay_name: The relay name. + :type relay_name: str + :param authorization_rule_name: The authorization rule name. + :type authorization_rule_name: str + :param dict custom_headers: headers that will be added to the request + :param bool raw: returns the direct response alongside the + deserialized response + :param operation_config: :ref:`Operation configuration + overrides`. + :return: AuthorizationRule or ClientRawResponse if raw=true + :rtype: ~azure.mgmt.relay.models.AuthorizationRule or + ~msrest.pipeline.ClientRawResponse + :raises: + :class:`ErrorResponseException` + """ + # Construct URL + url = '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Relay/namespaces/{namespaceName}/wcfRelays/{relayName}/authorizationRules/{authorizationRuleName}' + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), + 'namespaceName': self._serialize.url("namespace_name", namespace_name, 'str', max_length=50, min_length=6), + 'relayName': self._serialize.url("relay_name", relay_name, 'str', min_length=1), + 'authorizationRuleName': self._serialize.url("authorization_rule_name", authorization_rule_name, 'str', min_length=1), + 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str') + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} + query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + + # Construct headers + header_parameters = {} + header_parameters['Content-Type'] = 'application/json; charset=utf-8' + if self.config.generate_client_request_id: + header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) + if custom_headers: + header_parameters.update(custom_headers) + if self.config.accept_language is not None: + header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') + + # Construct and send request + request = self._client.get(url, query_parameters) + response = self._client.send(request, header_parameters, **operation_config) + + if response.status_code not in [200]: + raise models.ErrorResponseException(self._deserialize, response) + + deserialized = None + + if response.status_code == 200: + deserialized = self._deserialize('AuthorizationRule', response) + + if raw: + client_raw_response = ClientRawResponse(deserialized, response) + return client_raw_response + + return deserialized + + def list_keys( + self, resource_group_name, namespace_name, relay_name, authorization_rule_name, custom_headers=None, raw=False, **operation_config): + """Primary and secondary connection strings to the WCF relay. + + :param resource_group_name: Name of the Resource group within the + Azure subscription. + :type resource_group_name: str + :param namespace_name: The namespace name + :type namespace_name: str + :param relay_name: The relay name. + :type relay_name: str + :param authorization_rule_name: The authorization rule name. + :type authorization_rule_name: str + :param dict custom_headers: headers that will be added to the request + :param bool raw: returns the direct response alongside the + deserialized response + :param operation_config: :ref:`Operation configuration + overrides`. + :return: AccessKeys or ClientRawResponse if raw=true + :rtype: ~azure.mgmt.relay.models.AccessKeys or + ~msrest.pipeline.ClientRawResponse + :raises: + :class:`ErrorResponseException` + """ + # Construct URL + url = '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Relay/namespaces/{namespaceName}/wcfRelays/{relayName}/authorizationRules/{authorizationRuleName}/listKeys' + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), + 'namespaceName': self._serialize.url("namespace_name", namespace_name, 'str', max_length=50, min_length=6), + 'relayName': self._serialize.url("relay_name", relay_name, 'str', min_length=1), + 'authorizationRuleName': self._serialize.url("authorization_rule_name", authorization_rule_name, 'str', min_length=1), + 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str') + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} + query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + + # Construct headers + header_parameters = {} + header_parameters['Content-Type'] = 'application/json; charset=utf-8' + if self.config.generate_client_request_id: + header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) + if custom_headers: + header_parameters.update(custom_headers) + if self.config.accept_language is not None: + header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') + + # Construct and send request + request = self._client.post(url, query_parameters) + response = self._client.send(request, header_parameters, **operation_config) + + if response.status_code not in [200]: + raise models.ErrorResponseException(self._deserialize, response) + + deserialized = None + + if response.status_code == 200: + deserialized = self._deserialize('AccessKeys', response) + + if raw: + client_raw_response = ClientRawResponse(deserialized, response) + return client_raw_response + + return deserialized + + def regenerate_keys( + self, resource_group_name, namespace_name, relay_name, authorization_rule_name, key_type, key=None, custom_headers=None, raw=False, **operation_config): + """Regenerates the primary or secondary connection strings to the WCF + relay. + + :param resource_group_name: Name of the Resource group within the + Azure subscription. + :type resource_group_name: str + :param namespace_name: The namespace name + :type namespace_name: str + :param relay_name: The relay name. + :type relay_name: str + :param authorization_rule_name: The authorization rule name. + :type authorization_rule_name: str + :param key_type: The access key to regenerate. Possible values + include: 'PrimaryKey', 'SecondaryKey' + :type key_type: str or ~azure.mgmt.relay.models.KeyType + :param key: Optional. If the key value is provided, this is set to key + type, or autogenerated key value set for key type. + :type key: str + :param dict custom_headers: headers that will be added to the request + :param bool raw: returns the direct response alongside the + deserialized response + :param operation_config: :ref:`Operation configuration + overrides`. + :return: AccessKeys or ClientRawResponse if raw=true + :rtype: ~azure.mgmt.relay.models.AccessKeys or + ~msrest.pipeline.ClientRawResponse + :raises: + :class:`ErrorResponseException` + """ + parameters = models.RegenerateAccessKeyParameters(key_type=key_type, key=key) + + # Construct URL + url = '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Relay/namespaces/{namespaceName}/wcfRelays/{relayName}/authorizationRules/{authorizationRuleName}/regenerateKeys' + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), + 'namespaceName': self._serialize.url("namespace_name", namespace_name, 'str', max_length=50, min_length=6), + 'relayName': self._serialize.url("relay_name", relay_name, 'str', min_length=1), + 'authorizationRuleName': self._serialize.url("authorization_rule_name", authorization_rule_name, 'str', min_length=1), + 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str') + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} + query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + + # Construct headers + header_parameters = {} + header_parameters['Content-Type'] = 'application/json; charset=utf-8' + if self.config.generate_client_request_id: + header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) + if custom_headers: + header_parameters.update(custom_headers) + if self.config.accept_language is not None: + header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') + + # Construct body + body_content = self._serialize.body(parameters, 'RegenerateAccessKeyParameters') + + # Construct and send request + request = self._client.post(url, query_parameters) + response = self._client.send( + request, header_parameters, body_content, **operation_config) + + if response.status_code not in [200]: + raise models.ErrorResponseException(self._deserialize, response) + + deserialized = None + + if response.status_code == 200: + deserialized = self._deserialize('AccessKeys', response) + + if raw: + client_raw_response = ClientRawResponse(deserialized, response) + return client_raw_response + + return deserialized diff --git a/src/relay/azext_relay/relay/relay_management_client.py b/src/relay/azext_relay/relay/relay_management_client.py new file mode 100644 index 00000000000..329c6e8172a --- /dev/null +++ b/src/relay/azext_relay/relay/relay_management_client.py @@ -0,0 +1,100 @@ +# 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. +# -------------------------------------------------------------------------- + +from msrest.service_client import ServiceClient +from msrest import Serializer, Deserializer +from msrestazure import AzureConfiguration +from .version import VERSION +from .operations.operations import Operations +from .operations.namespaces_operations import NamespacesOperations +from .operations.hybrid_connections_operations import HybridConnectionsOperations +from .operations.wcf_relays_operations import WCFRelaysOperations +from . import models + + +class RelayManagementClientConfiguration(AzureConfiguration): + """Configuration for RelayManagementClient + Note that all parameters used to create this instance are saved as instance + attributes. + + :param credentials: Credentials needed for the client to connect to Azure. + :type credentials: :mod:`A msrestazure Credentials + object` + :param subscription_id: Subscription credentials which uniquely identify + the Microsoft Azure subscription. The subscription ID forms part of the + URI for every service call. + :type subscription_id: str + :param str base_url: Service URL + """ + + def __init__( + self, credentials, subscription_id, base_url=None): + + if credentials is None: + raise ValueError("Parameter 'credentials' must not be None.") + if subscription_id is None: + raise ValueError("Parameter 'subscription_id' must not be None.") + if not base_url: + base_url = 'https://management.azure.com' + + super(RelayManagementClientConfiguration, self).__init__(base_url) + + self.add_user_agent('azure-mgmt-relay/{}'.format(VERSION)) + self.add_user_agent('Azure-SDK-For-Python') + + self.credentials = credentials + self.subscription_id = subscription_id + + +class RelayManagementClient(object): + """Use these API to manage Azure Relay resources through Azure Resource Manager. + + :ivar config: Configuration for client. + :vartype config: RelayManagementClientConfiguration + + :ivar operations: Operations operations + :vartype operations: azure.mgmt.relay.operations.Operations + :ivar namespaces: Namespaces operations + :vartype namespaces: azure.mgmt.relay.operations.NamespacesOperations + :ivar hybrid_connections: HybridConnections operations + :vartype hybrid_connections: azure.mgmt.relay.operations.HybridConnectionsOperations + :ivar wcf_relays: WCFRelays operations + :vartype wcf_relays: azure.mgmt.relay.operations.WCFRelaysOperations + + :param credentials: Credentials needed for the client to connect to Azure. + :type credentials: :mod:`A msrestazure Credentials + object` + :param subscription_id: Subscription credentials which uniquely identify + the Microsoft Azure subscription. The subscription ID forms part of the + URI for every service call. + :type subscription_id: str + :param str base_url: Service URL + """ + + def __init__( + self, credentials, subscription_id, base_url=None): + + self.config = RelayManagementClientConfiguration(credentials, subscription_id, base_url) + self._client = ServiceClient(self.config.credentials, self.config) + + client_models = {k: v for k, v in models.__dict__.items() if isinstance(v, type)} + self.api_version = '2017-04-01' + self._serialize = Serializer(client_models) + self._deserialize = Deserializer(client_models) + + self.operations = Operations( + self._client, self.config, self._serialize, self._deserialize) + self.namespaces = NamespacesOperations( + self._client, self.config, self._serialize, self._deserialize) + self.hybrid_connections = HybridConnectionsOperations( + self._client, self.config, self._serialize, self._deserialize) + self.wcf_relays = WCFRelaysOperations( + self._client, self.config, self._serialize, self._deserialize) diff --git a/src/relay/azext_relay/relay/version.py b/src/relay/azext_relay/relay/version.py new file mode 100644 index 00000000000..fb0159ed93d --- /dev/null +++ b/src/relay/azext_relay/relay/version.py @@ -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. +# -------------------------------------------------------------------------- + +VERSION = "0.1.0" diff --git a/src/relay/azext_relay/tests/__init__.py b/src/relay/azext_relay/tests/__init__.py new file mode 100644 index 00000000000..34913fb394d --- /dev/null +++ b/src/relay/azext_relay/tests/__init__.py @@ -0,0 +1,4 @@ +# -------------------------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# -------------------------------------------------------------------------------------------- diff --git a/src/relay/azext_relay/tests/recordings/test_relay_hybridconnection.yaml b/src/relay/azext_relay/tests/recordings/test_relay_hybridconnection.yaml new file mode 100644 index 00000000000..c8f61873804 --- /dev/null +++ b/src/relay/azext_relay/tests/recordings/test_relay_hybridconnection.yaml @@ -0,0 +1,493 @@ +interactions: +- request: + body: '{"location": "westus", "tags": {"use": "az-test"}}' + headers: + Accept: [application/json] + Accept-Encoding: ['gzip, deflate'] + CommandName: [group create] + Connection: [keep-alive] + Content-Length: ['50'] + Content-Type: [application/json; charset=utf-8] + User-Agent: [python/3.6.3 (Windows-10-10.0.16299-SP0) requests/2.18.4 msrest/0.4.22 + msrest_azure/0.4.19 resourcemanagementclient/1.2.1 Azure-SDK-For-Python + AZURECLI/2.0.27] + accept-language: [en-US] + method: PUT + uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourcegroups/cli_test_relay_hybridconnection000001?api-version=2017-05-10 + response: + body: {string: '{"id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli_test_relay_hybridconnection000001","name":"cli_test_relay_hybridconnection000001","location":"westus","tags":{"use":"az-test"},"properties":{"provisioningState":"Succeeded"}}'} + headers: + cache-control: [no-cache] + content-length: ['328'] + content-type: [application/json; charset=utf-8] + date: ['Fri, 09 Feb 2018 23:05:18 GMT'] + expires: ['-1'] + pragma: [no-cache] + strict-transport-security: [max-age=31536000; includeSubDomains] + x-ms-ratelimit-remaining-subscription-writes: ['1199'] + status: {code: 201, message: Created} +- request: + body: '{"location": "westus2", "tags": {"{tag2: value2,": "", "tag1: value1}": + ""}, "sku": {"name": "Standard", "tier": "Standard"}}' + headers: + Accept: [application/json] + Accept-Encoding: ['gzip, deflate'] + CommandName: [relay namespace create] + Connection: [keep-alive] + Content-Length: ['125'] + Content-Type: [application/json; charset=utf-8] + User-Agent: [python/3.6.3 (Windows-10-10.0.16299-SP0) requests/2.18.4 msrest/0.4.22 + msrest_azure/0.4.19 azure-mgmt-relay/0.1.0 Azure-SDK-For-Python AZURECLI/2.0.27] + accept-language: [en-US] + method: PUT + uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli_test_relay_hybridconnection000001/providers/Microsoft.Relay/namespaces/relay-nscli000002?api-version=2017-04-01 + response: + body: {string: '{"sku":{"name":"Standard","tier":"Standard"},"id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli_test_relay_hybridconnection000001/providers/Microsoft.Relay/namespaces/relay-nscli000002","name":"relay-nscli000002","type":"Microsoft.Relay/Namespaces","location":"West + US 2","tags":{"{tag2: value2,":"","tag1: value1}":""},"properties":{"provisioningState":"Created","metricId":"55f3dcd4-cac7-43b4-990b-a139d62a1eb2:relay-nscli000002","createdAt":"2018-02-09T23:05:19.93Z","updatedAt":"2018-02-09T23:05:19.93Z","serviceBusEndpoint":"https://relay-nscli000002.servicebus.windows.net:443/","status":"Activating"}}'} + headers: + cache-control: [no-cache] + content-length: ['684'] + content-type: [application/json; charset=utf-8] + date: ['Fri, 09 Feb 2018 23:05:19 GMT'] + expires: ['-1'] + pragma: [no-cache] + server: [Service-Bus-Resource-Provider/SN1, Microsoft-HTTPAPI/2.0] + server-sb: [Service-Bus-Resource-Provider/SN1] + strict-transport-security: [max-age=31536000; includeSubDomains] + transfer-encoding: [chunked] + vary: [Accept-Encoding] + x-ms-ratelimit-remaining-subscription-writes: ['1199'] + status: {code: 200, message: OK} +- request: + body: null + headers: + Accept: [application/json] + Accept-Encoding: ['gzip, deflate'] + CommandName: [relay namespace create] + Connection: [keep-alive] + Content-Type: [application/json; charset=utf-8] + User-Agent: [python/3.6.3 (Windows-10-10.0.16299-SP0) requests/2.18.4 msrest/0.4.22 + msrest_azure/0.4.19 azure-mgmt-relay/0.1.0 Azure-SDK-For-Python AZURECLI/2.0.27] + accept-language: [en-US] + method: GET + uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli_test_relay_hybridconnection000001/providers/Microsoft.Relay/namespaces/relay-nscli000002?api-version=2017-04-01 + response: + body: {string: '{"sku":{"name":"Standard","tier":"Standard"},"id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli_test_relay_hybridconnection000001/providers/Microsoft.Relay/namespaces/relay-nscli000002","name":"relay-nscli000002","type":"Microsoft.Relay/Namespaces","location":"West + US 2","tags":{"{tag2: value2,":"","tag1: value1}":""},"properties":{"provisioningState":"Succeeded","metricId":"55f3dcd4-cac7-43b4-990b-a139d62a1eb2:relay-nscli000002","createdAt":"2018-02-09T23:05:19.93Z","updatedAt":"2018-02-09T23:05:45.093Z","serviceBusEndpoint":"https://relay-nscli000002.servicebus.windows.net:443/","status":"Active"}}'} + headers: + cache-control: [no-cache] + content-length: ['683'] + content-type: [application/json; charset=utf-8] + date: ['Fri, 09 Feb 2018 23:05:55 GMT'] + expires: ['-1'] + pragma: [no-cache] + server: [Service-Bus-Resource-Provider/SN1, Microsoft-HTTPAPI/2.0] + server-sb: [Service-Bus-Resource-Provider/SN1] + strict-transport-security: [max-age=31536000; includeSubDomains] + transfer-encoding: [chunked] + vary: [Accept-Encoding] + status: {code: 200, message: OK} +- request: + body: null + headers: + Accept: [application/json] + Accept-Encoding: ['gzip, deflate'] + CommandName: [relay namespace show] + Connection: [keep-alive] + Content-Type: [application/json; charset=utf-8] + User-Agent: [python/3.6.3 (Windows-10-10.0.16299-SP0) requests/2.18.4 msrest/0.4.22 + msrest_azure/0.4.19 azure-mgmt-relay/0.1.0 Azure-SDK-For-Python AZURECLI/2.0.27] + accept-language: [en-US] + method: GET + uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli_test_relay_hybridconnection000001/providers/Microsoft.Relay/namespaces/relay-nscli000002?api-version=2017-04-01 + response: + body: {string: '{"sku":{"name":"Standard","tier":"Standard"},"id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli_test_relay_hybridconnection000001/providers/Microsoft.Relay/namespaces/relay-nscli000002","name":"relay-nscli000002","type":"Microsoft.Relay/Namespaces","location":"West + US 2","tags":{"{tag2: value2,":"","tag1: value1}":""},"properties":{"provisioningState":"Succeeded","metricId":"55f3dcd4-cac7-43b4-990b-a139d62a1eb2:relay-nscli000002","createdAt":"2018-02-09T23:05:19.93Z","updatedAt":"2018-02-09T23:05:45.093Z","serviceBusEndpoint":"https://relay-nscli000002.servicebus.windows.net:443/","status":"Active"}}'} + headers: + cache-control: [no-cache] + content-length: ['683'] + content-type: [application/json; charset=utf-8] + date: ['Fri, 09 Feb 2018 23:06:34 GMT'] + expires: ['-1'] + pragma: [no-cache] + server: [Service-Bus-Resource-Provider/SN1, Microsoft-HTTPAPI/2.0] + server-sb: [Service-Bus-Resource-Provider/SN1] + strict-transport-security: [max-age=31536000; includeSubDomains] + transfer-encoding: [chunked] + vary: [Accept-Encoding] + status: {code: 200, message: OK} +- request: + body: '{"properties": {"requiresClientAuthorization": true, "userMetadata": "UserMetadata"}}' + headers: + Accept: [application/json] + Accept-Encoding: ['gzip, deflate'] + CommandName: [relay hybrid-connections create] + Connection: [keep-alive] + Content-Length: ['85'] + Content-Type: [application/json; charset=utf-8] + User-Agent: [python/3.6.3 (Windows-10-10.0.16299-SP0) requests/2.18.4 msrest/0.4.22 + msrest_azure/0.4.19 azure-mgmt-relay/0.1.0 Azure-SDK-For-Python AZURECLI/2.0.27] + accept-language: [en-US] + method: PUT + uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli_test_relay_hybridconnection000001/providers/Microsoft.Relay/namespaces/relay-nscli000002/hybridConnections/relay-hybridcli000004?api-version=2017-04-01 + response: + body: {string: '{"id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli_test_relay_hybridconnection000001/providers/Microsoft.Relay/namespaces/relay-nscli000002/hybridConnections/relay-hybridcli000004","name":"relay-hybridcli000004","type":"Microsoft.Relay/Namespaces/HybridConnections","location":"West + US 2","properties":{"createdAt":"2018-02-09T23:06:09.1458152Z","updatedAt":"2018-02-09T23:06:09.1458152Z","listenerCount":0,"requiresClientAuthorization":true,"userMetadata":"UserMetadata"}}'} + headers: + cache-control: [no-cache] + content-length: ['549'] + content-type: [application/json; charset=utf-8] + date: ['Fri, 09 Feb 2018 23:06:09 GMT'] + expires: ['-1'] + pragma: [no-cache] + server: [Service-Bus-Resource-Provider/SN1, Microsoft-HTTPAPI/2.0] + server-sb: [Service-Bus-Resource-Provider/SN1] + strict-transport-security: [max-age=31536000; includeSubDomains] + transfer-encoding: [chunked] + vary: [Accept-Encoding] + x-ms-ratelimit-remaining-subscription-writes: ['1199'] + status: {code: 200, message: OK} +- request: + body: null + headers: + Accept: [application/json] + Accept-Encoding: ['gzip, deflate'] + CommandName: [relay hybrid-connections show] + Connection: [keep-alive] + Content-Type: [application/json; charset=utf-8] + User-Agent: [python/3.6.3 (Windows-10-10.0.16299-SP0) requests/2.18.4 msrest/0.4.22 + msrest_azure/0.4.19 azure-mgmt-relay/0.1.0 Azure-SDK-For-Python AZURECLI/2.0.27] + accept-language: [en-US] + method: GET + uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli_test_relay_hybridconnection000001/providers/Microsoft.Relay/namespaces/relay-nscli000002/hybridConnections/relay-hybridcli000004?api-version=2017-04-01 + response: + body: {string: '{"id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli_test_relay_hybridconnection000001/providers/Microsoft.Relay/namespaces/relay-nscli000002/hybridConnections/relay-hybridcli000004","name":"relay-hybridcli000004","type":"Microsoft.Relay/Namespaces/HybridConnections","location":"West + US 2","properties":{"createdAt":"2018-02-09T23:06:09.1458152Z","updatedAt":"2018-02-09T23:06:09.1458152Z","listenerCount":0,"requiresClientAuthorization":true,"userMetadata":"UserMetadata"}}'} + headers: + cache-control: [no-cache] + content-length: ['549'] + content-type: [application/json; charset=utf-8] + date: ['Fri, 09 Feb 2018 23:06:14 GMT'] + expires: ['-1'] + pragma: [no-cache] + server: [Service-Bus-Resource-Provider/SN1, Microsoft-HTTPAPI/2.0] + server-sb: [Service-Bus-Resource-Provider/SN1] + strict-transport-security: [max-age=31536000; includeSubDomains] + transfer-encoding: [chunked] + vary: [Accept-Encoding] + status: {code: 200, message: OK} +- request: + body: null + headers: + Accept: [application/json] + Accept-Encoding: ['gzip, deflate'] + CommandName: [relay hybrid-connections list] + Connection: [keep-alive] + Content-Type: [application/json; charset=utf-8] + User-Agent: [python/3.6.3 (Windows-10-10.0.16299-SP0) requests/2.18.4 msrest/0.4.22 + msrest_azure/0.4.19 azure-mgmt-relay/0.1.0 Azure-SDK-For-Python AZURECLI/2.0.27] + accept-language: [en-US] + method: GET + uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli_test_relay_hybridconnection000001/providers/Microsoft.Relay/namespaces/relay-nscli000002/hybridConnections?api-version=2017-04-01 + response: + body: {string: '{"value":[{"id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli_test_relay_hybridconnection000001/providers/Microsoft.Relay/namespaces/relay-nscli000002/hybridConnections/relay-hybridcli000004","name":"relay-hybridcli000004","type":"Microsoft.Relay/Namespaces/HybridConnections","location":"West + US 2","properties":{"createdAt":"2018-02-09T23:06:09.1458152Z","updatedAt":"2018-02-09T23:06:09.1458152Z","listenerCount":0,"requiresClientAuthorization":true,"userMetadata":"UserMetadata"}}]}'} + headers: + cache-control: [no-cache] + content-length: ['561'] + content-type: [application/json; charset=utf-8] + date: ['Fri, 09 Feb 2018 23:06:16 GMT'] + expires: ['-1'] + pragma: [no-cache] + server: [Service-Bus-Resource-Provider/SN1, Microsoft-HTTPAPI/2.0] + server-sb: [Service-Bus-Resource-Provider/SN1] + strict-transport-security: [max-age=31536000; includeSubDomains] + transfer-encoding: [chunked] + vary: [Accept-Encoding] + x-ms-inline-count: [''] + status: {code: 200, message: OK} +- request: + body: '{"properties": {"rights": ["Send"]}}' + headers: + Accept: [application/json] + Accept-Encoding: ['gzip, deflate'] + CommandName: [relay hybrid-connections authorization-rule create] + Connection: [keep-alive] + Content-Length: ['36'] + Content-Type: [application/json; charset=utf-8] + User-Agent: [python/3.6.3 (Windows-10-10.0.16299-SP0) requests/2.18.4 msrest/0.4.22 + msrest_azure/0.4.19 azure-mgmt-relay/0.1.0 Azure-SDK-For-Python AZURECLI/2.0.27] + accept-language: [en-US] + method: PUT + uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli_test_relay_hybridconnection000001/providers/Microsoft.Relay/namespaces/relay-nscli000002/hybridConnections/relay-hybridcli000004/authorizationRules/clihybridAutho000005?api-version=2017-04-01 + response: + body: {string: '{"id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli_test_relay_hybridconnection000001/providers/Microsoft.Relay/namespaces/relay-nscli000002/hybridConnections/relay-hybridcli000004/authorizationRules/clihybridAutho000005","name":"clihybridAutho000005","type":"Microsoft.Relay/Namespaces/HybridConnections/AuthorizationRules","location":"West + US 2","properties":{"rights":["Send"]}}'} + headers: + cache-control: [no-cache] + content-length: ['462'] + content-type: [application/json; charset=utf-8] + date: ['Fri, 09 Feb 2018 23:06:16 GMT'] + expires: ['-1'] + pragma: [no-cache] + server: [Service-Bus-Resource-Provider/SN1, Microsoft-HTTPAPI/2.0] + server-sb: [Service-Bus-Resource-Provider/SN1] + strict-transport-security: [max-age=31536000; includeSubDomains] + transfer-encoding: [chunked] + vary: [Accept-Encoding] + x-ms-ratelimit-remaining-subscription-writes: ['1198'] + status: {code: 200, message: OK} +- request: + body: null + headers: + Accept: [application/json] + Accept-Encoding: ['gzip, deflate'] + CommandName: [relay hybrid-connections authorization-rule show] + Connection: [keep-alive] + Content-Type: [application/json; charset=utf-8] + User-Agent: [python/3.6.3 (Windows-10-10.0.16299-SP0) requests/2.18.4 msrest/0.4.22 + msrest_azure/0.4.19 azure-mgmt-relay/0.1.0 Azure-SDK-For-Python AZURECLI/2.0.27] + accept-language: [en-US] + method: GET + uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli_test_relay_hybridconnection000001/providers/Microsoft.Relay/namespaces/relay-nscli000002/hybridConnections/relay-hybridcli000004/authorizationRules/clihybridAutho000005?api-version=2017-04-01 + response: + body: {string: '{"id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli_test_relay_hybridconnection000001/providers/Microsoft.Relay/namespaces/relay-nscli000002/hybridConnections/relay-hybridcli000004/authorizationRules/clihybridAutho000005","name":"clihybridAutho000005","type":"Microsoft.Relay/Namespaces/HybridConnections/AuthorizationRules","location":"West + US 2","properties":{"rights":["Send"]}}'} + headers: + cache-control: [no-cache] + content-length: ['462'] + content-type: [application/json; charset=utf-8] + date: ['Fri, 09 Feb 2018 23:06:16 GMT'] + expires: ['-1'] + pragma: [no-cache] + server: [Service-Bus-Resource-Provider/SN1, Microsoft-HTTPAPI/2.0] + server-sb: [Service-Bus-Resource-Provider/SN1] + strict-transport-security: [max-age=31536000; includeSubDomains] + transfer-encoding: [chunked] + vary: [Accept-Encoding] + status: {code: 200, message: OK} +- request: + body: null + headers: + Accept: [application/json] + Accept-Encoding: ['gzip, deflate'] + CommandName: [relay hybrid-connections authorization-rule keys list] + Connection: [keep-alive] + Content-Length: ['0'] + Content-Type: [application/json; charset=utf-8] + User-Agent: [python/3.6.3 (Windows-10-10.0.16299-SP0) requests/2.18.4 msrest/0.4.22 + msrest_azure/0.4.19 azure-mgmt-relay/0.1.0 Azure-SDK-For-Python AZURECLI/2.0.27] + accept-language: [en-US] + method: POST + uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli_test_relay_hybridconnection000001/providers/Microsoft.Relay/namespaces/relay-nscli000002/hybridConnections/relay-hybridcli000004/authorizationRules/clihybridAutho000005/listKeys?api-version=2017-04-01 + response: + body: {string: '{"primaryConnectionString":"Endpoint=sb://relay-nscli000002.servicebus.windows.net/;SharedAccessKeyName=clihybridAutho000005;SharedAccessKey=8bwsG2YMQ7aS4zOm1tfttggJk6dpCocxmMX4Z6kF3do=;EntityPath=relay-hybridcli000004","secondaryConnectionString":"Endpoint=sb://relay-nscli000002.servicebus.windows.net/;SharedAccessKeyName=clihybridAutho000005;SharedAccessKey=O0O1A/4uUAT+v8Ue4bGnGVZBNq+BhPEjKUPZcBZt0RA=;EntityPath=relay-hybridcli000004","primaryKey":"8bwsG2YMQ7aS4zOm1tfttggJk6dpCocxmMX4Z6kF3do=","secondaryKey":"O0O1A/4uUAT+v8Ue4bGnGVZBNq+BhPEjKUPZcBZt0RA=","keyName":"clihybridAutho000005"}'} + headers: + cache-control: [no-cache] + content-length: ['625'] + content-type: [application/json; charset=utf-8] + date: ['Fri, 09 Feb 2018 23:06:17 GMT'] + expires: ['-1'] + pragma: [no-cache] + server: [Service-Bus-Resource-Provider/SN1, Microsoft-HTTPAPI/2.0] + server-sb: [Service-Bus-Resource-Provider/SN1] + strict-transport-security: [max-age=31536000; includeSubDomains] + transfer-encoding: [chunked] + vary: [Accept-Encoding] + x-ms-ratelimit-remaining-subscription-writes: ['1198'] + status: {code: 200, message: OK} +- request: + body: '{"keyType": "PrimaryKey"}' + headers: + Accept: [application/json] + Accept-Encoding: ['gzip, deflate'] + CommandName: [relay hybrid-connections authorization-rule keys renew] + Connection: [keep-alive] + Content-Length: ['25'] + Content-Type: [application/json; charset=utf-8] + User-Agent: [python/3.6.3 (Windows-10-10.0.16299-SP0) requests/2.18.4 msrest/0.4.22 + msrest_azure/0.4.19 azure-mgmt-relay/0.1.0 Azure-SDK-For-Python AZURECLI/2.0.27] + accept-language: [en-US] + method: POST + uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli_test_relay_hybridconnection000001/providers/Microsoft.Relay/namespaces/relay-nscli000002/hybridConnections/relay-hybridcli000004/authorizationRules/clihybridAutho000005/regenerateKeys?api-version=2017-04-01 + response: + body: {string: '{"primaryConnectionString":"Endpoint=sb://relay-nscli000002.servicebus.windows.net/;SharedAccessKeyName=clihybridAutho000005;SharedAccessKey=LfNCFfmrEaFHA+3taYS6W0DVNHK92lPdTqRUsdv7lJA=;EntityPath=relay-hybridcli000004","secondaryConnectionString":"Endpoint=sb://relay-nscli000002.servicebus.windows.net/;SharedAccessKeyName=clihybridAutho000005;SharedAccessKey=O0O1A/4uUAT+v8Ue4bGnGVZBNq+BhPEjKUPZcBZt0RA=;EntityPath=relay-hybridcli000004","primaryKey":"LfNCFfmrEaFHA+3taYS6W0DVNHK92lPdTqRUsdv7lJA=","secondaryKey":"O0O1A/4uUAT+v8Ue4bGnGVZBNq+BhPEjKUPZcBZt0RA=","keyName":"clihybridAutho000005"}'} + headers: + cache-control: [no-cache] + content-length: ['625'] + content-type: [application/json; charset=utf-8] + date: ['Fri, 09 Feb 2018 23:06:18 GMT'] + expires: ['-1'] + pragma: [no-cache] + server: [Service-Bus-Resource-Provider/SN1, Microsoft-HTTPAPI/2.0] + server-sb: [Service-Bus-Resource-Provider/SN1] + strict-transport-security: [max-age=31536000; includeSubDomains] + transfer-encoding: [chunked] + vary: [Accept-Encoding] + x-ms-ratelimit-remaining-subscription-writes: ['1199'] + status: {code: 200, message: OK} +- request: + body: '{"keyType": "SecondaryKey"}' + headers: + Accept: [application/json] + Accept-Encoding: ['gzip, deflate'] + CommandName: [relay hybrid-connections authorization-rule keys renew] + Connection: [keep-alive] + Content-Length: ['27'] + Content-Type: [application/json; charset=utf-8] + User-Agent: [python/3.6.3 (Windows-10-10.0.16299-SP0) requests/2.18.4 msrest/0.4.22 + msrest_azure/0.4.19 azure-mgmt-relay/0.1.0 Azure-SDK-For-Python AZURECLI/2.0.27] + accept-language: [en-US] + method: POST + uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli_test_relay_hybridconnection000001/providers/Microsoft.Relay/namespaces/relay-nscli000002/hybridConnections/relay-hybridcli000004/authorizationRules/clihybridAutho000005/regenerateKeys?api-version=2017-04-01 + response: + body: {string: '{"primaryConnectionString":"Endpoint=sb://relay-nscli000002.servicebus.windows.net/;SharedAccessKeyName=clihybridAutho000005;SharedAccessKey=LfNCFfmrEaFHA+3taYS6W0DVNHK92lPdTqRUsdv7lJA=;EntityPath=relay-hybridcli000004","secondaryConnectionString":"Endpoint=sb://relay-nscli000002.servicebus.windows.net/;SharedAccessKeyName=clihybridAutho000005;SharedAccessKey=WI390eCdmNhBjWKnBtXQg2Z/AYyTczS4aAgKFHAWgzQ=;EntityPath=relay-hybridcli000004","primaryKey":"LfNCFfmrEaFHA+3taYS6W0DVNHK92lPdTqRUsdv7lJA=","secondaryKey":"WI390eCdmNhBjWKnBtXQg2Z/AYyTczS4aAgKFHAWgzQ=","keyName":"clihybridAutho000005"}'} + headers: + cache-control: [no-cache] + content-length: ['625'] + content-type: [application/json; charset=utf-8] + date: ['Fri, 09 Feb 2018 23:06:19 GMT'] + expires: ['-1'] + pragma: [no-cache] + server: [Service-Bus-Resource-Provider/SN1, Microsoft-HTTPAPI/2.0] + server-sb: [Service-Bus-Resource-Provider/SN1] + strict-transport-security: [max-age=31536000; includeSubDomains] + transfer-encoding: [chunked] + vary: [Accept-Encoding] + x-ms-ratelimit-remaining-subscription-writes: ['1198'] + status: {code: 200, message: OK} +- request: + body: null + headers: + Accept: [application/json] + Accept-Encoding: ['gzip, deflate'] + CommandName: [relay hybrid-connections authorization-rule delete] + Connection: [keep-alive] + Content-Length: ['0'] + Content-Type: [application/json; charset=utf-8] + User-Agent: [python/3.6.3 (Windows-10-10.0.16299-SP0) requests/2.18.4 msrest/0.4.22 + msrest_azure/0.4.19 azure-mgmt-relay/0.1.0 Azure-SDK-For-Python AZURECLI/2.0.27] + accept-language: [en-US] + method: DELETE + uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli_test_relay_hybridconnection000001/providers/Microsoft.Relay/namespaces/relay-nscli000002/hybridConnections/relay-hybridcli000004/authorizationRules/clihybridAutho000005?api-version=2017-04-01 + response: + body: {string: ''} + headers: + cache-control: [no-cache] + content-length: ['0'] + date: ['Fri, 09 Feb 2018 23:06:18 GMT'] + expires: ['-1'] + pragma: [no-cache] + server: [Service-Bus-Resource-Provider/SN1, Microsoft-HTTPAPI/2.0] + server-sb: [Service-Bus-Resource-Provider/SN1] + strict-transport-security: [max-age=31536000; includeSubDomains] + x-ms-ratelimit-remaining-subscription-writes: ['1199'] + status: {code: 200, message: OK} +- request: + body: null + headers: + Accept: [application/json] + Accept-Encoding: ['gzip, deflate'] + CommandName: [relay hybrid-connections delete] + Connection: [keep-alive] + Content-Length: ['0'] + Content-Type: [application/json; charset=utf-8] + User-Agent: [python/3.6.3 (Windows-10-10.0.16299-SP0) requests/2.18.4 msrest/0.4.22 + msrest_azure/0.4.19 azure-mgmt-relay/0.1.0 Azure-SDK-For-Python AZURECLI/2.0.27] + accept-language: [en-US] + method: DELETE + uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli_test_relay_hybridconnection000001/providers/Microsoft.Relay/namespaces/relay-nscli000002/hybridConnections/relay-hybridcli000004?api-version=2017-04-01 + response: + body: {string: ''} + headers: + cache-control: [no-cache] + content-length: ['0'] + date: ['Fri, 09 Feb 2018 23:06:23 GMT'] + expires: ['-1'] + pragma: [no-cache] + server: [Service-Bus-Resource-Provider/SN1, Microsoft-HTTPAPI/2.0] + server-sb: [Service-Bus-Resource-Provider/SN1] + strict-transport-security: [max-age=31536000; includeSubDomains] + x-ms-ratelimit-remaining-subscription-writes: ['1199'] + status: {code: 200, message: OK} +- request: + body: null + headers: + Accept: [application/json] + Accept-Encoding: ['gzip, deflate'] + CommandName: [relay namespace delete] + Connection: [keep-alive] + Content-Length: ['0'] + Content-Type: [application/json; charset=utf-8] + User-Agent: [python/3.6.3 (Windows-10-10.0.16299-SP0) requests/2.18.4 msrest/0.4.22 + msrest_azure/0.4.19 azure-mgmt-relay/0.1.0 Azure-SDK-For-Python AZURECLI/2.0.27] + accept-language: [en-US] + method: DELETE + uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli_test_relay_hybridconnection000001/providers/Microsoft.Relay/namespaces/relay-nscli000002?api-version=2017-04-01 + response: + body: {string: ''} + headers: + cache-control: [no-cache] + content-length: ['0'] + date: ['Fri, 09 Feb 2018 23:06:25 GMT'] + expires: ['-1'] + location: ['https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli_test_relay_hybridconnection000001/providers/Microsoft.Relay/namespaces/relay-nscli000002/operationresults/relay-nscli000002?api-version=2017-04-01'] + pragma: [no-cache] + server: [Service-Bus-Resource-Provider/SN1, Microsoft-HTTPAPI/2.0] + server-sb: [Service-Bus-Resource-Provider/SN1] + strict-transport-security: [max-age=31536000; includeSubDomains] + x-ms-ratelimit-remaining-subscription-writes: ['1195'] + status: {code: 202, message: Accepted} +- request: + body: null + headers: + Accept: [application/json] + Accept-Encoding: ['gzip, deflate'] + CommandName: [relay namespace delete] + Connection: [keep-alive] + Content-Type: [application/json; charset=utf-8] + User-Agent: [python/3.6.3 (Windows-10-10.0.16299-SP0) requests/2.18.4 msrest/0.4.22 + msrest_azure/0.4.19 azure-mgmt-relay/0.1.0 Azure-SDK-For-Python AZURECLI/2.0.27] + accept-language: [en-US] + method: GET + uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli_test_relay_hybridconnection000001/providers/Microsoft.Relay/namespaces/relay-nscli000002/operationresults/relay-nscli000002?api-version=2017-04-01 + response: + body: {string: ''} + headers: + cache-control: [no-cache] + content-length: ['0'] + date: ['Fri, 09 Feb 2018 23:06:56 GMT'] + expires: ['-1'] + pragma: [no-cache] + server: [Service-Bus-Resource-Provider/SN1, Microsoft-HTTPAPI/2.0] + server-sb: [Service-Bus-Resource-Provider/SN1] + strict-transport-security: [max-age=31536000; includeSubDomains] + status: {code: 200, message: OK} +- request: + body: null + headers: + Accept: [application/json] + Accept-Encoding: ['gzip, deflate'] + CommandName: [group delete] + Connection: [keep-alive] + Content-Length: ['0'] + Content-Type: [application/json; charset=utf-8] + User-Agent: [python/3.6.3 (Windows-10-10.0.16299-SP0) requests/2.18.4 msrest/0.4.22 + msrest_azure/0.4.19 resourcemanagementclient/1.2.1 Azure-SDK-For-Python + AZURECLI/2.0.27] + accept-language: [en-US] + method: DELETE + uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourcegroups/cli_test_relay_hybridconnection000001?api-version=2017-05-10 + response: + body: {string: ''} + headers: + cache-control: [no-cache] + content-length: ['0'] + date: ['Fri, 09 Feb 2018 23:06:57 GMT'] + expires: ['-1'] + location: ['https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/operationresults/eyJqb2JJZCI6IlJFU09VUkNFR1JPVVBERUxFVElPTkpPQi1DTEk6NUZURVNUOjVGUkVMQVk6NUZIWUJSSURDT05ORUNUSU9OVkxYUlBVUTJaT3xEM0IyNTA4MkJGMURFOTg5LVdFU1RVUyIsImpvYkxvY2F0aW9uIjoid2VzdHVzIn0?api-version=2017-05-10'] + pragma: [no-cache] + strict-transport-security: [max-age=31536000; includeSubDomains] + x-ms-ratelimit-remaining-subscription-writes: ['1198'] + status: {code: 202, message: Accepted} +version: 1 diff --git a/src/relay/azext_relay/tests/recordings/test_relay_namespace.yaml b/src/relay/azext_relay/tests/recordings/test_relay_namespace.yaml new file mode 100644 index 00000000000..11c9b588a9a --- /dev/null +++ b/src/relay/azext_relay/tests/recordings/test_relay_namespace.yaml @@ -0,0 +1,498 @@ +interactions: +- request: + body: '{"location": "westus", "tags": {"use": "az-test"}}' + headers: + Accept: [application/json] + Accept-Encoding: ['gzip, deflate'] + CommandName: [group create] + Connection: [keep-alive] + Content-Length: ['50'] + Content-Type: [application/json; charset=utf-8] + User-Agent: [python/3.6.3 (Windows-10-10.0.16299-SP0) requests/2.18.4 msrest/0.4.22 + msrest_azure/0.4.19 resourcemanagementclient/1.2.1 Azure-SDK-For-Python + AZURECLI/2.0.27] + accept-language: [en-US] + method: PUT + uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourcegroups/cli_test_eh_namespace000001?api-version=2017-05-10 + response: + body: {string: '{"id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli_test_eh_namespace000001","name":"cli_test_eh_namespace000001","location":"westus","tags":{"use":"az-test"},"properties":{"provisioningState":"Succeeded"}}'} + headers: + cache-control: [no-cache] + content-length: ['328'] + content-type: [application/json; charset=utf-8] + date: ['Fri, 09 Feb 2018 23:06:57 GMT'] + expires: ['-1'] + pragma: [no-cache] + strict-transport-security: [max-age=31536000; includeSubDomains] + x-ms-ratelimit-remaining-subscription-writes: ['1199'] + status: {code: 201, message: Created} +- request: + body: 'b''{"name": "relay-nscli000002"}''' + headers: + Accept: [application/json] + Accept-Encoding: ['gzip, deflate'] + CommandName: [relay namespace exists] + Connection: [keep-alive] + Content-Length: ['32'] + Content-Type: [application/json; charset=utf-8] + User-Agent: [python/3.6.3 (Windows-10-10.0.16299-SP0) requests/2.18.4 msrest/0.4.22 + msrest_azure/0.4.19 azure-mgmt-relay/0.1.0 Azure-SDK-For-Python AZURECLI/2.0.27] + accept-language: [en-US] + method: POST + uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.Relay/checkNameAvailability?api-version=2017-04-01 + response: + body: {string: '{"nameAvailable":true,"reason":"None","message":null}'} + headers: + cache-control: [no-cache] + content-length: ['53'] + content-type: [application/json; charset=utf-8] + date: ['Fri, 09 Feb 2018 23:06:59 GMT'] + expires: ['-1'] + pragma: [no-cache] + server: [Service-Bus-Resource-Provider/SN1, Microsoft-HTTPAPI/2.0] + server-sb: [Service-Bus-Resource-Provider/SN1] + strict-transport-security: [max-age=31536000; includeSubDomains] + transfer-encoding: [chunked] + vary: [Accept-Encoding] + x-ms-ratelimit-remaining-subscription-writes: ['1199'] + status: {code: 200, message: OK} +- request: + body: '{"location": "westus2", "tags": {"{tag1: value1}": ""}, "sku": {"name": + "Standard", "tier": "Standard"}}' + headers: + Accept: [application/json] + Accept-Encoding: ['gzip, deflate'] + CommandName: [relay namespace create] + Connection: [keep-alive] + Content-Length: ['104'] + Content-Type: [application/json; charset=utf-8] + User-Agent: [python/3.6.3 (Windows-10-10.0.16299-SP0) requests/2.18.4 msrest/0.4.22 + msrest_azure/0.4.19 azure-mgmt-relay/0.1.0 Azure-SDK-For-Python AZURECLI/2.0.27] + accept-language: [en-US] + method: PUT + uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli_test_eh_namespace000001/providers/Microsoft.Relay/namespaces/relay-nscli000002?api-version=2017-04-01 + response: + body: {string: '{"sku":{"name":"Standard","tier":"Standard"},"id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli_test_eh_namespace000001/providers/Microsoft.Relay/namespaces/relay-nscli000002","name":"relay-nscli000002","type":"Microsoft.Relay/Namespaces","location":"West + US 2","tags":{"{tag1: value1}":""},"properties":{"provisioningState":"Created","metricId":"55f3dcd4-cac7-43b4-990b-a139d62a1eb2:relay-nscli000002","createdAt":"2018-02-09T23:07:00.92Z","updatedAt":"2018-02-09T23:07:00.92Z","serviceBusEndpoint":"https://relay-nscli000002.servicebus.windows.net:443/","status":"Activating"}}'} + headers: + cache-control: [no-cache] + content-length: ['665'] + content-type: [application/json; charset=utf-8] + date: ['Fri, 09 Feb 2018 23:07:01 GMT'] + expires: ['-1'] + pragma: [no-cache] + server: [Service-Bus-Resource-Provider/SN1, Microsoft-HTTPAPI/2.0] + server-sb: [Service-Bus-Resource-Provider/SN1] + strict-transport-security: [max-age=31536000; includeSubDomains] + transfer-encoding: [chunked] + vary: [Accept-Encoding] + x-ms-ratelimit-remaining-subscription-writes: ['1199'] + status: {code: 200, message: OK} +- request: + body: null + headers: + Accept: [application/json] + Accept-Encoding: ['gzip, deflate'] + CommandName: [relay namespace create] + Connection: [keep-alive] + Content-Type: [application/json; charset=utf-8] + User-Agent: [python/3.6.3 (Windows-10-10.0.16299-SP0) requests/2.18.4 msrest/0.4.22 + msrest_azure/0.4.19 azure-mgmt-relay/0.1.0 Azure-SDK-For-Python AZURECLI/2.0.27] + accept-language: [en-US] + method: GET + uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli_test_eh_namespace000001/providers/Microsoft.Relay/namespaces/relay-nscli000002?api-version=2017-04-01 + response: + body: {string: '{"sku":{"name":"Standard","tier":"Standard"},"id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli_test_eh_namespace000001/providers/Microsoft.Relay/namespaces/relay-nscli000002","name":"relay-nscli000002","type":"Microsoft.Relay/Namespaces","location":"West + US 2","tags":{"{tag1: value1}":""},"properties":{"provisioningState":"Succeeded","metricId":"55f3dcd4-cac7-43b4-990b-a139d62a1eb2:relay-nscli000002","createdAt":"2018-02-09T23:07:00.92Z","updatedAt":"2018-02-09T23:07:22.3Z","serviceBusEndpoint":"https://relay-nscli000002.servicebus.windows.net:443/","status":"Active"}}'} + headers: + cache-control: [no-cache] + content-length: ['662'] + content-type: [application/json; charset=utf-8] + date: ['Fri, 09 Feb 2018 23:07:32 GMT'] + expires: ['-1'] + pragma: [no-cache] + server: [Service-Bus-Resource-Provider/SN1, Microsoft-HTTPAPI/2.0] + server-sb: [Service-Bus-Resource-Provider/SN1] + strict-transport-security: [max-age=31536000; includeSubDomains] + transfer-encoding: [chunked] + vary: [Accept-Encoding] + status: {code: 200, message: OK} +- request: + body: null + headers: + Accept: [application/json] + Accept-Encoding: ['gzip, deflate'] + CommandName: [relay namespace show] + Connection: [keep-alive] + Content-Type: [application/json; charset=utf-8] + User-Agent: [python/3.6.3 (Windows-10-10.0.16299-SP0) requests/2.18.4 msrest/0.4.22 + msrest_azure/0.4.19 azure-mgmt-relay/0.1.0 Azure-SDK-For-Python AZURECLI/2.0.27] + accept-language: [en-US] + method: GET + uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli_test_eh_namespace000001/providers/Microsoft.Relay/namespaces/relay-nscli000002?api-version=2017-04-01 + response: + body: {string: '{"sku":{"name":"Standard","tier":"Standard"},"id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli_test_eh_namespace000001/providers/Microsoft.Relay/namespaces/relay-nscli000002","name":"relay-nscli000002","type":"Microsoft.Relay/Namespaces","location":"West + US 2","tags":{"{tag1: value1}":""},"properties":{"provisioningState":"Succeeded","metricId":"55f3dcd4-cac7-43b4-990b-a139d62a1eb2:relay-nscli000002","createdAt":"2018-02-09T23:07:00.92Z","updatedAt":"2018-02-09T23:07:22.3Z","serviceBusEndpoint":"https://relay-nscli000002.servicebus.windows.net:443/","status":"Active"}}'} + headers: + cache-control: [no-cache] + content-length: ['662'] + content-type: [application/json; charset=utf-8] + date: ['Fri, 09 Feb 2018 23:07:33 GMT'] + expires: ['-1'] + pragma: [no-cache] + server: [Service-Bus-Resource-Provider/SN1, Microsoft-HTTPAPI/2.0] + server-sb: [Service-Bus-Resource-Provider/SN1] + strict-transport-security: [max-age=31536000; includeSubDomains] + transfer-encoding: [chunked] + vary: [Accept-Encoding] + status: {code: 200, message: OK} +- request: + body: null + headers: + Accept: [application/json] + Accept-Encoding: ['gzip, deflate'] + CommandName: [relay namespace list] + Connection: [keep-alive] + Content-Type: [application/json; charset=utf-8] + User-Agent: [python/3.6.3 (Windows-10-10.0.16299-SP0) requests/2.18.4 msrest/0.4.22 + msrest_azure/0.4.19 azure-mgmt-relay/0.1.0 Azure-SDK-For-Python AZURECLI/2.0.27] + accept-language: [en-US] + method: GET + uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.Relay/namespaces?api-version=2017-04-01 + response: + body: {string: '{"value":[{"sku":{"name":"Standard","tier":"Standard"},"id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli_test_eh_alias2mv7ov6fsgikow24xobpownip4z7mijgbqjghkrz5zav4njw5lcf6lf7px/providers/Microsoft.Relay/namespaces/TestingRelay99","name":"TestingRelay99","type":"Microsoft.Relay/Namespaces","location":"West + US","tags":{},"properties":{"provisioningState":"Succeeded","metricId":"55f3dcd4-cac7-43b4-990b-a139d62a1eb2:testingrelay99","createdAt":"2018-02-05T22:40:33.257Z","updatedAt":"2018-02-05T22:41:00.467Z","serviceBusEndpoint":"https://TestingRelay99.servicebus.windows.net:443/","status":"Active"}},{"sku":{"name":"Standard","tier":"Standard"},"id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/SDKTests/providers/Microsoft.Relay/namespaces/TestingIgniteNamespaceRelay","name":"TestingIgniteNamespaceRelay","type":"Microsoft.Relay/Namespaces","location":"West + US 2","tags":{},"properties":{"provisioningState":"Succeeded","metricId":"55f3dcd4-cac7-43b4-990b-a139d62a1eb2:testingignitenamespacerelay","createdAt":"2017-09-22T23:10:13.723Z","updatedAt":"2017-09-22T23:11:10.827Z","serviceBusEndpoint":"https://TestingIgniteNamespaceRelay.servicebus.windows.net:443/","status":"Active"}},{"sku":{"name":"Standard","tier":"Standard"},"id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli_test_eh_namespace000001/providers/Microsoft.Relay/namespaces/relay-nscli000002","name":"relay-nscli000002","type":"Microsoft.Relay/Namespaces","location":"West + US 2","tags":{"{tag1: value1}":""},"properties":{"provisioningState":"Succeeded","metricId":"55f3dcd4-cac7-43b4-990b-a139d62a1eb2:relay-nscli000002","createdAt":"2018-02-09T23:07:00.92Z","updatedAt":"2018-02-09T23:07:22.3Z","serviceBusEndpoint":"https://relay-nscli000002.servicebus.windows.net:443/","status":"Active"}},{"sku":{"name":"Standard","tier":"Standard"},"id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/RGName-onesdk9880/providers/Microsoft.Relay/namespaces/testingnamespaceforwcfRelay","name":"testingnamespaceforwcfRelay","type":"Microsoft.Relay/Namespaces","location":"West + US 2","tags":{},"properties":{"provisioningState":"Succeeded","metricId":"55f3dcd4-cac7-43b4-990b-a139d62a1eb2:testingnamespaceforwcfrelay","createdAt":"2017-11-10T18:07:19.713Z","updatedAt":"2017-11-10T18:07:45.843Z","serviceBusEndpoint":"https://testingnamespaceforwcfRelay.servicebus.windows.net:443/","status":"Active"}},{"sku":{"name":"Standard","tier":"Standard"},"id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/Default-Storage-WestUS/providers/Microsoft.Relay/namespaces/RelayTest1234","name":"RelayTest1234","type":"Microsoft.Relay/Namespaces","location":"West + US","tags":{},"properties":{"provisioningState":"Succeeded","metricId":"55f3dcd4-cac7-43b4-990b-a139d62a1eb2:relaytest1234","createdAt":"2017-04-26T00:38:15.667Z","updatedAt":"2017-08-25T02:09:28.613Z","serviceBusEndpoint":"https://RelayTest1234.servicebus.windows.net:443/","status":"Active"}},{"sku":{"name":"Standard","tier":"Standard"},"id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli_test_eh_alias2mv7ov6fsgikow24xobpownip4z7mijgbqjghkrz5zav4njw5lcf6lf7px/providers/Microsoft.Relay/namespaces/testingrelay1","name":"testingrelay1","type":"Microsoft.Relay/Namespaces","location":"West + US","tags":{"tage":"value1"},"properties":{"provisioningState":"Succeeded","metricId":"55f3dcd4-cac7-43b4-990b-a139d62a1eb2:testingrelay1","createdAt":"2018-02-05T18:09:29.373Z","updatedAt":"2018-02-05T18:09:57.353Z","serviceBusEndpoint":"https://testingrelay1.servicebus.windows.net:443/","status":"Active"}}]}'} + headers: + cache-control: [no-cache] + content-length: ['3716'] + content-type: [application/json; charset=utf-8] + date: ['Fri, 09 Feb 2018 23:07:33 GMT'] + expires: ['-1'] + pragma: [no-cache] + server: [Service-Bus-Resource-Provider/SN1, Microsoft-HTTPAPI/2.0] + server-sb: [Service-Bus-Resource-Provider/SN1] + strict-transport-security: [max-age=31536000; includeSubDomains] + transfer-encoding: [chunked] + vary: [Accept-Encoding] + status: {code: 200, message: OK} +- request: + body: null + headers: + Accept: [application/json] + Accept-Encoding: ['gzip, deflate'] + CommandName: [relay namespace list] + Connection: [keep-alive] + Content-Type: [application/json; charset=utf-8] + User-Agent: [python/3.6.3 (Windows-10-10.0.16299-SP0) requests/2.18.4 msrest/0.4.22 + msrest_azure/0.4.19 azure-mgmt-relay/0.1.0 Azure-SDK-For-Python AZURECLI/2.0.27] + accept-language: [en-US] + method: GET + uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli_test_eh_namespace000001/providers/Microsoft.Relay/namespaces?api-version=2017-04-01 + response: + body: {string: '{"value":[{"sku":{"name":"Standard","tier":"Standard"},"id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli_test_eh_namespace000001/providers/Microsoft.Relay/namespaces/relay-nscli000002","name":"relay-nscli000002","type":"Microsoft.Relay/Namespaces","location":"West + US 2","tags":{"{tag1: value1}":""},"properties":{"provisioningState":"Succeeded","metricId":"55f3dcd4-cac7-43b4-990b-a139d62a1eb2:relay-nscli000002","createdAt":"2018-02-09T23:07:00.92Z","updatedAt":"2018-02-09T23:07:22.3Z","serviceBusEndpoint":"https://relay-nscli000002.servicebus.windows.net:443/","status":"Active"}}]}'} + headers: + cache-control: [no-cache] + content-length: ['674'] + content-type: [application/json; charset=utf-8] + date: ['Fri, 09 Feb 2018 23:07:33 GMT'] + expires: ['-1'] + pragma: [no-cache] + server: [Service-Bus-Resource-Provider/SN1, Microsoft-HTTPAPI/2.0] + server-sb: [Service-Bus-Resource-Provider/SN1] + strict-transport-security: [max-age=31536000; includeSubDomains] + transfer-encoding: [chunked] + vary: [Accept-Encoding] + status: {code: 200, message: OK} +- request: + body: '{"properties": {"rights": ["Send"]}}' + headers: + Accept: [application/json] + Accept-Encoding: ['gzip, deflate'] + CommandName: [relay namespace authorization-rule create] + Connection: [keep-alive] + Content-Length: ['36'] + Content-Type: [application/json; charset=utf-8] + User-Agent: [python/3.6.3 (Windows-10-10.0.16299-SP0) requests/2.18.4 msrest/0.4.22 + msrest_azure/0.4.19 azure-mgmt-relay/0.1.0 Azure-SDK-For-Python AZURECLI/2.0.27] + accept-language: [en-US] + method: PUT + uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli_test_eh_namespace000001/providers/Microsoft.Relay/namespaces/relay-nscli000002/authorizationRules/cliAutho000003?api-version=2017-04-01 + response: + body: {string: '{"id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli_test_eh_namespace000001/providers/Microsoft.Relay/namespaces/relay-nscli000002/authorizationRules/cliAutho000003","name":"cliAutho000003","type":"Microsoft.Relay/Namespaces/AuthorizationRules","location":"West + US 2","properties":{"rights":["Send"]}}'} + headers: + cache-control: [no-cache] + content-length: ['390'] + content-type: [application/json; charset=utf-8] + date: ['Fri, 09 Feb 2018 23:08:06 GMT'] + expires: ['-1'] + pragma: [no-cache] + server: [Service-Bus-Resource-Provider/SN1, Microsoft-HTTPAPI/2.0] + server-sb: [Service-Bus-Resource-Provider/SN1] + strict-transport-security: [max-age=31536000; includeSubDomains] + transfer-encoding: [chunked] + vary: [Accept-Encoding] + x-ms-ratelimit-remaining-subscription-writes: ['1198'] + status: {code: 200, message: OK} +- request: + body: null + headers: + Accept: [application/json] + Accept-Encoding: ['gzip, deflate'] + CommandName: [relay namespace authorization-rule show] + Connection: [keep-alive] + Content-Type: [application/json; charset=utf-8] + User-Agent: [python/3.6.3 (Windows-10-10.0.16299-SP0) requests/2.18.4 msrest/0.4.22 + msrest_azure/0.4.19 azure-mgmt-relay/0.1.0 Azure-SDK-For-Python AZURECLI/2.0.27] + accept-language: [en-US] + method: GET + uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli_test_eh_namespace000001/providers/Microsoft.Relay/namespaces/relay-nscli000002/authorizationRules/cliAutho000003?api-version=2017-04-01 + response: + body: {string: '{"id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli_test_eh_namespace000001/providers/Microsoft.Relay/namespaces/relay-nscli000002/authorizationRules/cliAutho000003","name":"cliAutho000003","type":"Microsoft.Relay/Namespaces/AuthorizationRules","location":"West + US 2","properties":{"rights":["Send"]}}'} + headers: + cache-control: [no-cache] + content-length: ['390'] + content-type: [application/json; charset=utf-8] + date: ['Fri, 09 Feb 2018 23:08:08 GMT'] + expires: ['-1'] + pragma: [no-cache] + server: [Service-Bus-Resource-Provider/SN1, Microsoft-HTTPAPI/2.0] + server-sb: [Service-Bus-Resource-Provider/SN1] + strict-transport-security: [max-age=31536000; includeSubDomains] + transfer-encoding: [chunked] + vary: [Accept-Encoding] + status: {code: 200, message: OK} +- request: + body: null + headers: + Accept: [application/json] + Accept-Encoding: ['gzip, deflate'] + CommandName: [relay namespace authorization-rule show] + Connection: [keep-alive] + Content-Type: [application/json; charset=utf-8] + User-Agent: [python/3.6.3 (Windows-10-10.0.16299-SP0) requests/2.18.4 msrest/0.4.22 + msrest_azure/0.4.19 azure-mgmt-relay/0.1.0 Azure-SDK-For-Python AZURECLI/2.0.27] + accept-language: [en-US] + method: GET + uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli_test_eh_namespace000001/providers/Microsoft.Relay/namespaces/relay-nscli000002/authorizationRules/RootManageSharedAccessKey?api-version=2017-04-01 + response: + body: {string: '{"id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli_test_eh_namespace000001/providers/Microsoft.Relay/namespaces/relay-nscli000002/authorizationRules/RootManageSharedAccessKey","name":"RootManageSharedAccessKey","type":"Microsoft.Relay/Namespaces/AuthorizationRules","location":"West + US 2","properties":{"rights":["Listen","Manage","Send"]}}'} + headers: + cache-control: [no-cache] + content-length: ['418'] + content-type: [application/json; charset=utf-8] + date: ['Fri, 09 Feb 2018 23:08:09 GMT'] + expires: ['-1'] + pragma: [no-cache] + server: [Service-Bus-Resource-Provider/SN1, Microsoft-HTTPAPI/2.0] + server-sb: [Service-Bus-Resource-Provider/SN1] + strict-transport-security: [max-age=31536000; includeSubDomains] + transfer-encoding: [chunked] + vary: [Accept-Encoding] + status: {code: 200, message: OK} +- request: + body: null + headers: + Accept: [application/json] + Accept-Encoding: ['gzip, deflate'] + CommandName: [relay namespace authorization-rule keys list] + Connection: [keep-alive] + Content-Length: ['0'] + Content-Type: [application/json; charset=utf-8] + User-Agent: [python/3.6.3 (Windows-10-10.0.16299-SP0) requests/2.18.4 msrest/0.4.22 + msrest_azure/0.4.19 azure-mgmt-relay/0.1.0 Azure-SDK-For-Python AZURECLI/2.0.27] + accept-language: [en-US] + method: POST + uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli_test_eh_namespace000001/providers/Microsoft.Relay/namespaces/relay-nscli000002/authorizationRules/cliAutho000003/listKeys?api-version=2017-04-01 + response: + body: {string: '{"primaryConnectionString":"Endpoint=sb://relay-nscli000002.servicebus.windows.net/;SharedAccessKeyName=cliAutho000003;SharedAccessKey=4tWtA0d/XwXKmPFrrWMzSuAH/VSTYI4u843zQEJNaR8=","secondaryConnectionString":"Endpoint=sb://relay-nscli000002.servicebus.windows.net/;SharedAccessKeyName=cliAutho000003;SharedAccessKey=HWBd33USWCa5Ccg0lftrK5AfYVlbl/UYtUl+H5nwEZg=","primaryKey":"4tWtA0d/XwXKmPFrrWMzSuAH/VSTYI4u843zQEJNaR8=","secondaryKey":"HWBd33USWCa5Ccg0lftrK5AfYVlbl/UYtUl+H5nwEZg=","keyName":"cliAutho000003"}'} + headers: + cache-control: [no-cache] + content-length: ['536'] + content-type: [application/json; charset=utf-8] + date: ['Fri, 09 Feb 2018 23:08:10 GMT'] + expires: ['-1'] + pragma: [no-cache] + server: [Service-Bus-Resource-Provider/SN1, Microsoft-HTTPAPI/2.0] + server-sb: [Service-Bus-Resource-Provider/SN1] + strict-transport-security: [max-age=31536000; includeSubDomains] + transfer-encoding: [chunked] + vary: [Accept-Encoding] + x-ms-ratelimit-remaining-subscription-writes: ['1199'] + status: {code: 200, message: OK} +- request: + body: '{"keyType": "PrimaryKey"}' + headers: + Accept: [application/json] + Accept-Encoding: ['gzip, deflate'] + CommandName: [relay namespace authorization-rule keys renew] + Connection: [keep-alive] + Content-Length: ['25'] + Content-Type: [application/json; charset=utf-8] + User-Agent: [python/3.6.3 (Windows-10-10.0.16299-SP0) requests/2.18.4 msrest/0.4.22 + msrest_azure/0.4.19 azure-mgmt-relay/0.1.0 Azure-SDK-For-Python AZURECLI/2.0.27] + accept-language: [en-US] + method: POST + uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli_test_eh_namespace000001/providers/Microsoft.Relay/namespaces/relay-nscli000002/authorizationRules/cliAutho000003/regenerateKeys?api-version=2017-04-01 + response: + body: {string: '{"primaryConnectionString":"Endpoint=sb://relay-nscli000002.servicebus.windows.net/;SharedAccessKeyName=cliAutho000003;SharedAccessKey=4ALvnsCLkCZ03GUg/lDyyO+NrPTVUglfOQaKHOM6WCk=","secondaryConnectionString":"Endpoint=sb://relay-nscli000002.servicebus.windows.net/;SharedAccessKeyName=cliAutho000003;SharedAccessKey=HWBd33USWCa5Ccg0lftrK5AfYVlbl/UYtUl+H5nwEZg=","primaryKey":"4ALvnsCLkCZ03GUg/lDyyO+NrPTVUglfOQaKHOM6WCk=","secondaryKey":"HWBd33USWCa5Ccg0lftrK5AfYVlbl/UYtUl+H5nwEZg=","keyName":"cliAutho000003"}'} + headers: + cache-control: [no-cache] + content-length: ['536'] + content-type: [application/json; charset=utf-8] + date: ['Fri, 09 Feb 2018 23:08:27 GMT'] + expires: ['-1'] + pragma: [no-cache] + server: [Service-Bus-Resource-Provider/SN1, Microsoft-HTTPAPI/2.0] + server-sb: [Service-Bus-Resource-Provider/SN1] + strict-transport-security: [max-age=31536000; includeSubDomains] + transfer-encoding: [chunked] + vary: [Accept-Encoding] + x-ms-ratelimit-remaining-subscription-writes: ['1198'] + status: {code: 200, message: OK} +- request: + body: '{"keyType": "SecondaryKey"}' + headers: + Accept: [application/json] + Accept-Encoding: ['gzip, deflate'] + CommandName: [relay namespace authorization-rule keys renew] + Connection: [keep-alive] + Content-Length: ['27'] + Content-Type: [application/json; charset=utf-8] + User-Agent: [python/3.6.3 (Windows-10-10.0.16299-SP0) requests/2.18.4 msrest/0.4.22 + msrest_azure/0.4.19 azure-mgmt-relay/0.1.0 Azure-SDK-For-Python AZURECLI/2.0.27] + accept-language: [en-US] + method: POST + uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli_test_eh_namespace000001/providers/Microsoft.Relay/namespaces/relay-nscli000002/authorizationRules/cliAutho000003/regenerateKeys?api-version=2017-04-01 + response: + body: {string: '{"primaryConnectionString":"Endpoint=sb://relay-nscli000002.servicebus.windows.net/;SharedAccessKeyName=cliAutho000003;SharedAccessKey=4ALvnsCLkCZ03GUg/lDyyO+NrPTVUglfOQaKHOM6WCk=","secondaryConnectionString":"Endpoint=sb://relay-nscli000002.servicebus.windows.net/;SharedAccessKeyName=cliAutho000003;SharedAccessKey=60mSnpTdhu+a/J7oR0WU8IYgZ7v+tG0e0CQu40tfsIY=","primaryKey":"4ALvnsCLkCZ03GUg/lDyyO+NrPTVUglfOQaKHOM6WCk=","secondaryKey":"60mSnpTdhu+a/J7oR0WU8IYgZ7v+tG0e0CQu40tfsIY=","keyName":"cliAutho000003"}'} + headers: + cache-control: [no-cache] + content-length: ['536'] + content-type: [application/json; charset=utf-8] + date: ['Fri, 09 Feb 2018 23:08:43 GMT'] + expires: ['-1'] + pragma: [no-cache] + server: [Service-Bus-Resource-Provider/SN1, Microsoft-HTTPAPI/2.0] + server-sb: [Service-Bus-Resource-Provider/SN1] + strict-transport-security: [max-age=31536000; includeSubDomains] + transfer-encoding: [chunked] + vary: [Accept-Encoding] + x-ms-ratelimit-remaining-subscription-writes: ['1199'] + status: {code: 200, message: OK} +- request: + body: null + headers: + Accept: [application/json] + Accept-Encoding: ['gzip, deflate'] + CommandName: [relay namespace authorization-rule delete] + Connection: [keep-alive] + Content-Length: ['0'] + Content-Type: [application/json; charset=utf-8] + User-Agent: [python/3.6.3 (Windows-10-10.0.16299-SP0) requests/2.18.4 msrest/0.4.22 + msrest_azure/0.4.19 azure-mgmt-relay/0.1.0 Azure-SDK-For-Python AZURECLI/2.0.27] + accept-language: [en-US] + method: DELETE + uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli_test_eh_namespace000001/providers/Microsoft.Relay/namespaces/relay-nscli000002/authorizationRules/cliAutho000003?api-version=2017-04-01 + response: + body: {string: ''} + headers: + cache-control: [no-cache] + content-length: ['0'] + date: ['Fri, 09 Feb 2018 23:08:59 GMT'] + expires: ['-1'] + pragma: [no-cache] + server: [Service-Bus-Resource-Provider/SN1, Microsoft-HTTPAPI/2.0] + server-sb: [Service-Bus-Resource-Provider/SN1] + strict-transport-security: [max-age=31536000; includeSubDomains] + x-ms-ratelimit-remaining-subscription-writes: ['1197'] + status: {code: 200, message: OK} +- request: + body: null + headers: + Accept: [application/json] + Accept-Encoding: ['gzip, deflate'] + CommandName: [relay namespace delete] + Connection: [keep-alive] + Content-Length: ['0'] + Content-Type: [application/json; charset=utf-8] + User-Agent: [python/3.6.3 (Windows-10-10.0.16299-SP0) requests/2.18.4 msrest/0.4.22 + msrest_azure/0.4.19 azure-mgmt-relay/0.1.0 Azure-SDK-For-Python AZURECLI/2.0.27] + accept-language: [en-US] + method: DELETE + uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli_test_eh_namespace000001/providers/Microsoft.Relay/namespaces/relay-nscli000002?api-version=2017-04-01 + response: + body: {string: ''} + headers: + cache-control: [no-cache] + content-length: ['0'] + date: ['Fri, 09 Feb 2018 23:09:00 GMT'] + expires: ['-1'] + location: ['https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli_test_eh_namespace000001/providers/Microsoft.Relay/namespaces/relay-nscli000002/operationresults/relay-nscli000002?api-version=2017-04-01'] + pragma: [no-cache] + server: [Service-Bus-Resource-Provider/SN1, Microsoft-HTTPAPI/2.0] + server-sb: [Service-Bus-Resource-Provider/SN1] + strict-transport-security: [max-age=31536000; includeSubDomains] + x-ms-ratelimit-remaining-subscription-writes: ['1198'] + status: {code: 202, message: Accepted} +- request: + body: null + headers: + Accept: [application/json] + Accept-Encoding: ['gzip, deflate'] + CommandName: [relay namespace delete] + Connection: [keep-alive] + Content-Type: [application/json; charset=utf-8] + User-Agent: [python/3.6.3 (Windows-10-10.0.16299-SP0) requests/2.18.4 msrest/0.4.22 + msrest_azure/0.4.19 azure-mgmt-relay/0.1.0 Azure-SDK-For-Python AZURECLI/2.0.27] + accept-language: [en-US] + method: GET + uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli_test_eh_namespace000001/providers/Microsoft.Relay/namespaces/relay-nscli000002/operationresults/relay-nscli000002?api-version=2017-04-01 + response: + body: {string: ''} + headers: + cache-control: [no-cache] + content-length: ['0'] + date: ['Fri, 09 Feb 2018 23:09:30 GMT'] + expires: ['-1'] + pragma: [no-cache] + server: [Service-Bus-Resource-Provider/SN1, Microsoft-HTTPAPI/2.0] + server-sb: [Service-Bus-Resource-Provider/SN1] + strict-transport-security: [max-age=31536000; includeSubDomains] + status: {code: 200, message: OK} +- request: + body: null + headers: + Accept: [application/json] + Accept-Encoding: ['gzip, deflate'] + CommandName: [group delete] + Connection: [keep-alive] + Content-Length: ['0'] + Content-Type: [application/json; charset=utf-8] + User-Agent: [python/3.6.3 (Windows-10-10.0.16299-SP0) requests/2.18.4 msrest/0.4.22 + msrest_azure/0.4.19 resourcemanagementclient/1.2.1 Azure-SDK-For-Python + AZURECLI/2.0.27] + accept-language: [en-US] + method: DELETE + uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourcegroups/cli_test_eh_namespace000001?api-version=2017-05-10 + response: + body: {string: ''} + headers: + cache-control: [no-cache] + content-length: ['0'] + date: ['Fri, 09 Feb 2018 23:09:32 GMT'] + expires: ['-1'] + location: ['https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/operationresults/eyJqb2JJZCI6IlJFU09VUkNFR1JPVVBERUxFVElPTkpPQi1DTEk6NUZURVNUOjVGRUg6NUZOQU1FU1BBQ0U1U1pYVUpTN1NWSEhSSk9ZQVkzVXxFOTY0Q0Y1NjEyM0Y2Q0U4LVdFU1RVUyIsImpvYkxvY2F0aW9uIjoid2VzdHVzIn0?api-version=2017-05-10'] + pragma: [no-cache] + strict-transport-security: [max-age=31536000; includeSubDomains] + x-ms-ratelimit-remaining-subscription-writes: ['1198'] + status: {code: 202, message: Accepted} +version: 1 diff --git a/src/relay/azext_relay/tests/recordings/test_relay_wcfrelay.yaml b/src/relay/azext_relay/tests/recordings/test_relay_wcfrelay.yaml new file mode 100644 index 00000000000..0cffbfb98a6 --- /dev/null +++ b/src/relay/azext_relay/tests/recordings/test_relay_wcfrelay.yaml @@ -0,0 +1,494 @@ +interactions: +- request: + body: '{"location": "westus", "tags": {"use": "az-test"}}' + headers: + Accept: [application/json] + Accept-Encoding: ['gzip, deflate'] + CommandName: [group create] + Connection: [keep-alive] + Content-Length: ['50'] + Content-Type: [application/json; charset=utf-8] + User-Agent: [python/3.6.3 (Windows-10-10.0.16299-SP0) requests/2.18.4 msrest/0.4.22 + msrest_azure/0.4.19 resourcemanagementclient/1.2.1 Azure-SDK-For-Python + AZURECLI/2.0.27] + accept-language: [en-US] + method: PUT + uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourcegroups/cli_test_relay_wcfrelay000001?api-version=2017-05-10 + response: + body: {string: '{"id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli_test_relay_wcfrelay000001","name":"cli_test_relay_wcfrelay000001","location":"westus","tags":{"use":"az-test"},"properties":{"provisioningState":"Succeeded"}}'} + headers: + cache-control: [no-cache] + content-length: ['328'] + content-type: [application/json; charset=utf-8] + date: ['Fri, 09 Feb 2018 23:09:33 GMT'] + expires: ['-1'] + pragma: [no-cache] + strict-transport-security: [max-age=31536000; includeSubDomains] + x-ms-ratelimit-remaining-subscription-writes: ['1198'] + status: {code: 201, message: Created} +- request: + body: '{"location": "westus2", "tags": {"{tag2: value2,": "", "tag1: value1}": + ""}, "sku": {"name": "Standard", "tier": "Standard"}}' + headers: + Accept: [application/json] + Accept-Encoding: ['gzip, deflate'] + CommandName: [relay namespace create] + Connection: [keep-alive] + Content-Length: ['125'] + Content-Type: [application/json; charset=utf-8] + User-Agent: [python/3.6.3 (Windows-10-10.0.16299-SP0) requests/2.18.4 msrest/0.4.22 + msrest_azure/0.4.19 azure-mgmt-relay/0.1.0 Azure-SDK-For-Python AZURECLI/2.0.27] + accept-language: [en-US] + method: PUT + uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli_test_relay_wcfrelay000001/providers/Microsoft.Relay/namespaces/relay-nscli000002?api-version=2017-04-01 + response: + body: {string: '{"sku":{"name":"Standard","tier":"Standard"},"id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli_test_relay_wcfrelay000001/providers/Microsoft.Relay/namespaces/relay-nscli000002","name":"relay-nscli000002","type":"Microsoft.Relay/Namespaces","location":"West + US 2","tags":{"{tag2: value2,":"","tag1: value1}":""},"properties":{"provisioningState":"Created","metricId":"55f3dcd4-cac7-43b4-990b-a139d62a1eb2:relay-nscli000002","createdAt":"2018-02-09T23:09:35.173Z","updatedAt":"2018-02-09T23:09:35.173Z","serviceBusEndpoint":"https://relay-nscli000002.servicebus.windows.net:443/","status":"Activating"}}'} + headers: + cache-control: [no-cache] + content-length: ['686'] + content-type: [application/json; charset=utf-8] + date: ['Fri, 09 Feb 2018 23:09:34 GMT'] + expires: ['-1'] + pragma: [no-cache] + server: [Service-Bus-Resource-Provider/SN1, Microsoft-HTTPAPI/2.0] + server-sb: [Service-Bus-Resource-Provider/SN1] + strict-transport-security: [max-age=31536000; includeSubDomains] + transfer-encoding: [chunked] + vary: [Accept-Encoding] + x-ms-ratelimit-remaining-subscription-writes: ['1199'] + status: {code: 200, message: OK} +- request: + body: null + headers: + Accept: [application/json] + Accept-Encoding: ['gzip, deflate'] + CommandName: [relay namespace create] + Connection: [keep-alive] + Content-Type: [application/json; charset=utf-8] + User-Agent: [python/3.6.3 (Windows-10-10.0.16299-SP0) requests/2.18.4 msrest/0.4.22 + msrest_azure/0.4.19 azure-mgmt-relay/0.1.0 Azure-SDK-For-Python AZURECLI/2.0.27] + accept-language: [en-US] + method: GET + uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli_test_relay_wcfrelay000001/providers/Microsoft.Relay/namespaces/relay-nscli000002?api-version=2017-04-01 + response: + body: {string: '{"sku":{"name":"Standard","tier":"Standard"},"id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli_test_relay_wcfrelay000001/providers/Microsoft.Relay/namespaces/relay-nscli000002","name":"relay-nscli000002","type":"Microsoft.Relay/Namespaces","location":"West + US 2","tags":{"{tag2: value2,":"","tag1: value1}":""},"properties":{"provisioningState":"Succeeded","metricId":"55f3dcd4-cac7-43b4-990b-a139d62a1eb2:relay-nscli000002","createdAt":"2018-02-09T23:09:35.173Z","updatedAt":"2018-02-09T23:10:00.07Z","serviceBusEndpoint":"https://relay-nscli000002.servicebus.windows.net:443/","status":"Active"}}'} + headers: + cache-control: [no-cache] + content-length: ['683'] + content-type: [application/json; charset=utf-8] + date: ['Fri, 09 Feb 2018 23:10:05 GMT'] + expires: ['-1'] + pragma: [no-cache] + server: [Service-Bus-Resource-Provider/SN1, Microsoft-HTTPAPI/2.0] + server-sb: [Service-Bus-Resource-Provider/SN1] + strict-transport-security: [max-age=31536000; includeSubDomains] + transfer-encoding: [chunked] + vary: [Accept-Encoding] + status: {code: 200, message: OK} +- request: + body: null + headers: + Accept: [application/json] + Accept-Encoding: ['gzip, deflate'] + CommandName: [relay namespace show] + Connection: [keep-alive] + Content-Type: [application/json; charset=utf-8] + User-Agent: [python/3.6.3 (Windows-10-10.0.16299-SP0) requests/2.18.4 msrest/0.4.22 + msrest_azure/0.4.19 azure-mgmt-relay/0.1.0 Azure-SDK-For-Python AZURECLI/2.0.27] + accept-language: [en-US] + method: GET + uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli_test_relay_wcfrelay000001/providers/Microsoft.Relay/namespaces/relay-nscli000002?api-version=2017-04-01 + response: + body: {string: '{"sku":{"name":"Standard","tier":"Standard"},"id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli_test_relay_wcfrelay000001/providers/Microsoft.Relay/namespaces/relay-nscli000002","name":"relay-nscli000002","type":"Microsoft.Relay/Namespaces","location":"West + US 2","tags":{"{tag2: value2,":"","tag1: value1}":""},"properties":{"provisioningState":"Succeeded","metricId":"55f3dcd4-cac7-43b4-990b-a139d62a1eb2:relay-nscli000002","createdAt":"2018-02-09T23:09:35.173Z","updatedAt":"2018-02-09T23:10:00.07Z","serviceBusEndpoint":"https://relay-nscli000002.servicebus.windows.net:443/","status":"Active"}}'} + headers: + cache-control: [no-cache] + content-length: ['683'] + content-type: [application/json; charset=utf-8] + date: ['Fri, 09 Feb 2018 23:10:05 GMT'] + expires: ['-1'] + pragma: [no-cache] + server: [Service-Bus-Resource-Provider/SN1, Microsoft-HTTPAPI/2.0] + server-sb: [Service-Bus-Resource-Provider/SN1] + strict-transport-security: [max-age=31536000; includeSubDomains] + transfer-encoding: [chunked] + vary: [Accept-Encoding] + status: {code: 200, message: OK} +- request: + body: '{"properties": {"relayType": "NetTcp", "requiresClientAuthorization": true, + "requiresTransportSecurity": true, "userMetadata": "UserMetadata"}}' + headers: + Accept: [application/json] + Accept-Encoding: ['gzip, deflate'] + CommandName: [relay wcf-relay create] + Connection: [keep-alive] + Content-Length: ['143'] + Content-Type: [application/json; charset=utf-8] + User-Agent: [python/3.6.3 (Windows-10-10.0.16299-SP0) requests/2.18.4 msrest/0.4.22 + msrest_azure/0.4.19 azure-mgmt-relay/0.1.0 Azure-SDK-For-Python AZURECLI/2.0.27] + accept-language: [en-US] + method: PUT + uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli_test_relay_wcfrelay000001/providers/Microsoft.Relay/namespaces/relay-nscli000002/wcfRelays/relay-wcfrelaycli000004?api-version=2017-04-01 + response: + body: {string: '{"id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli_test_relay_wcfrelay000001/providers/Microsoft.Relay/namespaces/relay-nscli000002/wcfRelays/relay-wcfrelaycli000004","name":"relay-wcfrelaycli000004","type":"Microsoft.Relay/Namespaces/WcfRelays","location":"West + US 2","properties":{"createdAt":"2018-02-09T23:10:08.9954294Z","updatedAt":"2018-02-09T23:10:08.9954294Z","listenerCount":0,"requiresClientAuthorization":true,"relayType":"NetTcp","requiresTransportSecurity":true,"isDynamic":false,"userMetadata":"UserMetadata"}}'} + headers: + cache-control: [no-cache] + content-length: ['605'] + content-type: [application/json; charset=utf-8] + date: ['Fri, 09 Feb 2018 23:10:08 GMT'] + expires: ['-1'] + pragma: [no-cache] + server: [Service-Bus-Resource-Provider/SN1, Microsoft-HTTPAPI/2.0] + server-sb: [Service-Bus-Resource-Provider/SN1] + strict-transport-security: [max-age=31536000; includeSubDomains] + transfer-encoding: [chunked] + vary: [Accept-Encoding] + x-ms-ratelimit-remaining-subscription-writes: ['1198'] + status: {code: 200, message: OK} +- request: + body: null + headers: + Accept: [application/json] + Accept-Encoding: ['gzip, deflate'] + CommandName: [relay wcf-relay show] + Connection: [keep-alive] + Content-Type: [application/json; charset=utf-8] + User-Agent: [python/3.6.3 (Windows-10-10.0.16299-SP0) requests/2.18.4 msrest/0.4.22 + msrest_azure/0.4.19 azure-mgmt-relay/0.1.0 Azure-SDK-For-Python AZURECLI/2.0.27] + accept-language: [en-US] + method: GET + uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli_test_relay_wcfrelay000001/providers/Microsoft.Relay/namespaces/relay-nscli000002/wcfRelays/relay-wcfrelaycli000004?api-version=2017-04-01 + response: + body: {string: '{"id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli_test_relay_wcfrelay000001/providers/Microsoft.Relay/namespaces/relay-nscli000002/wcfRelays/relay-wcfrelaycli000004","name":"relay-wcfrelaycli000004","type":"Microsoft.Relay/Namespaces/WcfRelays","location":"West + US 2","properties":{"createdAt":"2018-02-09T23:10:08.9954294Z","updatedAt":"2018-02-09T23:10:08.9954294Z","listenerCount":0,"requiresClientAuthorization":true,"relayType":"NetTcp","requiresTransportSecurity":true,"isDynamic":false,"userMetadata":"UserMetadata"}}'} + headers: + cache-control: [no-cache] + content-length: ['605'] + content-type: [application/json; charset=utf-8] + date: ['Fri, 09 Feb 2018 23:10:09 GMT'] + expires: ['-1'] + pragma: [no-cache] + server: [Service-Bus-Resource-Provider/SN1, Microsoft-HTTPAPI/2.0] + server-sb: [Service-Bus-Resource-Provider/SN1] + strict-transport-security: [max-age=31536000; includeSubDomains] + transfer-encoding: [chunked] + vary: [Accept-Encoding] + status: {code: 200, message: OK} +- request: + body: null + headers: + Accept: [application/json] + Accept-Encoding: ['gzip, deflate'] + CommandName: [relay wcf-relay list] + Connection: [keep-alive] + Content-Type: [application/json; charset=utf-8] + User-Agent: [python/3.6.3 (Windows-10-10.0.16299-SP0) requests/2.18.4 msrest/0.4.22 + msrest_azure/0.4.19 azure-mgmt-relay/0.1.0 Azure-SDK-For-Python AZURECLI/2.0.27] + accept-language: [en-US] + method: GET + uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli_test_relay_wcfrelay000001/providers/Microsoft.Relay/namespaces/relay-nscli000002/wcfRelays?api-version=2017-04-01 + response: + body: {string: '{"value":[{"id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli_test_relay_wcfrelay000001/providers/Microsoft.Relay/namespaces/relay-nscli000002/wcfRelays/relay-wcfrelaycli000004","name":"relay-wcfrelaycli000004","type":"Microsoft.Relay/Namespaces/WcfRelays","location":"West + US 2","properties":{"createdAt":"2018-02-09T23:10:08.9954294Z","updatedAt":"2018-02-09T23:10:08.9954294Z","listenerCount":0,"requiresClientAuthorization":true,"relayType":"NetTcp","requiresTransportSecurity":true,"isDynamic":false,"userMetadata":"UserMetadata"}}]}'} + headers: + cache-control: [no-cache] + content-length: ['617'] + content-type: [application/json; charset=utf-8] + date: ['Fri, 09 Feb 2018 23:10:11 GMT'] + expires: ['-1'] + pragma: [no-cache] + server: [Service-Bus-Resource-Provider/SN1, Microsoft-HTTPAPI/2.0] + server-sb: [Service-Bus-Resource-Provider/SN1] + strict-transport-security: [max-age=31536000; includeSubDomains] + transfer-encoding: [chunked] + vary: [Accept-Encoding] + x-ms-inline-count: [''] + status: {code: 200, message: OK} +- request: + body: '{"properties": {"rights": ["Send"]}}' + headers: + Accept: [application/json] + Accept-Encoding: ['gzip, deflate'] + CommandName: [relay wcf-relay authorization-rule create] + Connection: [keep-alive] + Content-Length: ['36'] + Content-Type: [application/json; charset=utf-8] + User-Agent: [python/3.6.3 (Windows-10-10.0.16299-SP0) requests/2.18.4 msrest/0.4.22 + msrest_azure/0.4.19 azure-mgmt-relay/0.1.0 Azure-SDK-For-Python AZURECLI/2.0.27] + accept-language: [en-US] + method: PUT + uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli_test_relay_wcfrelay000001/providers/Microsoft.Relay/namespaces/relay-nscli000002/wcfRelays/relay-wcfrelaycli000004/authorizationRules/cliwcfrelayAutho000005?api-version=2017-04-01 + response: + body: {string: '{"id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli_test_relay_wcfrelay000001/providers/Microsoft.Relay/namespaces/relay-nscli000002/wcfRelays/relay-wcfrelaycli000004/authorizationRules/cliwcfrelayAutho000005","name":"cliwcfrelayAutho000005","type":"Microsoft.Relay/Namespaces/WcfRelays/AuthorizationRules","location":"West + US 2","properties":{"rights":["Send"]}}'} + headers: + cache-control: [no-cache] + content-length: ['446'] + content-type: [application/json; charset=utf-8] + date: ['Fri, 09 Feb 2018 23:10:43 GMT'] + expires: ['-1'] + pragma: [no-cache] + server: [Service-Bus-Resource-Provider/SN1, Microsoft-HTTPAPI/2.0] + server-sb: [Service-Bus-Resource-Provider/SN1] + strict-transport-security: [max-age=31536000; includeSubDomains] + transfer-encoding: [chunked] + vary: [Accept-Encoding] + x-ms-ratelimit-remaining-subscription-writes: ['1199'] + status: {code: 200, message: OK} +- request: + body: null + headers: + Accept: [application/json] + Accept-Encoding: ['gzip, deflate'] + CommandName: [relay wcf-relay authorization-rule show] + Connection: [keep-alive] + Content-Type: [application/json; charset=utf-8] + User-Agent: [python/3.6.3 (Windows-10-10.0.16299-SP0) requests/2.18.4 msrest/0.4.22 + msrest_azure/0.4.19 azure-mgmt-relay/0.1.0 Azure-SDK-For-Python AZURECLI/2.0.27] + accept-language: [en-US] + method: GET + uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli_test_relay_wcfrelay000001/providers/Microsoft.Relay/namespaces/relay-nscli000002/wcfRelays/relay-wcfrelaycli000004/authorizationRules/cliwcfrelayAutho000005?api-version=2017-04-01 + response: + body: {string: '{"id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli_test_relay_wcfrelay000001/providers/Microsoft.Relay/namespaces/relay-nscli000002/wcfRelays/relay-wcfrelaycli000004/authorizationRules/cliwcfrelayAutho000005","name":"cliwcfrelayAutho000005","type":"Microsoft.Relay/Namespaces/WcfRelays/AuthorizationRules","location":"West + US 2","properties":{"rights":["Send"]}}'} + headers: + cache-control: [no-cache] + content-length: ['446'] + content-type: [application/json; charset=utf-8] + date: ['Fri, 09 Feb 2018 23:10:13 GMT'] + expires: ['-1'] + pragma: [no-cache] + server: [Service-Bus-Resource-Provider/SN1, Microsoft-HTTPAPI/2.0] + server-sb: [Service-Bus-Resource-Provider/SN1] + strict-transport-security: [max-age=31536000; includeSubDomains] + transfer-encoding: [chunked] + vary: [Accept-Encoding] + status: {code: 200, message: OK} +- request: + body: null + headers: + Accept: [application/json] + Accept-Encoding: ['gzip, deflate'] + CommandName: [relay wcf-relay authorization-rule keys list] + Connection: [keep-alive] + Content-Length: ['0'] + Content-Type: [application/json; charset=utf-8] + User-Agent: [python/3.6.3 (Windows-10-10.0.16299-SP0) requests/2.18.4 msrest/0.4.22 + msrest_azure/0.4.19 azure-mgmt-relay/0.1.0 Azure-SDK-For-Python AZURECLI/2.0.27] + accept-language: [en-US] + method: POST + uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli_test_relay_wcfrelay000001/providers/Microsoft.Relay/namespaces/relay-nscli000002/wcfRelays/relay-wcfrelaycli000004/authorizationRules/cliwcfrelayAutho000005/listKeys?api-version=2017-04-01 + response: + body: {string: '{"primaryConnectionString":"Endpoint=sb://relay-nscli000002.servicebus.windows.net/;SharedAccessKeyName=cliwcfrelayAutho000005;SharedAccessKey=ktDmJIbKDDj9iTdrrZn6ShoduH8Yw5kzDlqzL68Rcsg=;EntityPath=relay-wcfrelaycli000004","secondaryConnectionString":"Endpoint=sb://relay-nscli000002.servicebus.windows.net/;SharedAccessKeyName=cliwcfrelayAutho000005;SharedAccessKey=K8oPPee/xALfUQzflFnrcxf5xA/YNqrR4Oys8BD6XW8=;EntityPath=relay-wcfrelaycli000004","primaryKey":"ktDmJIbKDDj9iTdrrZn6ShoduH8Yw5kzDlqzL68Rcsg=","secondaryKey":"K8oPPee/xALfUQzflFnrcxf5xA/YNqrR4Oys8BD6XW8=","keyName":"cliwcfrelayAutho000005"}'} + headers: + cache-control: [no-cache] + content-length: ['625'] + content-type: [application/json; charset=utf-8] + date: ['Fri, 09 Feb 2018 23:10:13 GMT'] + expires: ['-1'] + pragma: [no-cache] + server: [Service-Bus-Resource-Provider/SN1, Microsoft-HTTPAPI/2.0] + server-sb: [Service-Bus-Resource-Provider/SN1] + strict-transport-security: [max-age=31536000; includeSubDomains] + transfer-encoding: [chunked] + vary: [Accept-Encoding] + x-ms-ratelimit-remaining-subscription-writes: ['1198'] + status: {code: 200, message: OK} +- request: + body: '{"keyType": "PrimaryKey"}' + headers: + Accept: [application/json] + Accept-Encoding: ['gzip, deflate'] + CommandName: [relay wcf-relay authorization-rule keys renew] + Connection: [keep-alive] + Content-Length: ['25'] + Content-Type: [application/json; charset=utf-8] + User-Agent: [python/3.6.3 (Windows-10-10.0.16299-SP0) requests/2.18.4 msrest/0.4.22 + msrest_azure/0.4.19 azure-mgmt-relay/0.1.0 Azure-SDK-For-Python AZURECLI/2.0.27] + accept-language: [en-US] + method: POST + uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli_test_relay_wcfrelay000001/providers/Microsoft.Relay/namespaces/relay-nscli000002/wcfRelays/relay-wcfrelaycli000004/authorizationRules/cliwcfrelayAutho000005/regenerateKeys?api-version=2017-04-01 + response: + body: {string: '{"primaryConnectionString":"Endpoint=sb://relay-nscli000002.servicebus.windows.net/;SharedAccessKeyName=cliwcfrelayAutho000005;SharedAccessKey=QergKndRJM/azhWHVBsKcjgLW5dOd9+HLfpnMj7ehHg=;EntityPath=relay-wcfrelaycli000004","secondaryConnectionString":"Endpoint=sb://relay-nscli000002.servicebus.windows.net/;SharedAccessKeyName=cliwcfrelayAutho000005;SharedAccessKey=K8oPPee/xALfUQzflFnrcxf5xA/YNqrR4Oys8BD6XW8=;EntityPath=relay-wcfrelaycli000004","primaryKey":"QergKndRJM/azhWHVBsKcjgLW5dOd9+HLfpnMj7ehHg=","secondaryKey":"K8oPPee/xALfUQzflFnrcxf5xA/YNqrR4Oys8BD6XW8=","keyName":"cliwcfrelayAutho000005"}'} + headers: + cache-control: [no-cache] + content-length: ['625'] + content-type: [application/json; charset=utf-8] + date: ['Fri, 09 Feb 2018 23:10:14 GMT'] + expires: ['-1'] + pragma: [no-cache] + server: [Service-Bus-Resource-Provider/SN1, Microsoft-HTTPAPI/2.0] + server-sb: [Service-Bus-Resource-Provider/SN1] + strict-transport-security: [max-age=31536000; includeSubDomains] + transfer-encoding: [chunked] + vary: [Accept-Encoding] + x-ms-ratelimit-remaining-subscription-writes: ['1199'] + status: {code: 200, message: OK} +- request: + body: '{"keyType": "SecondaryKey"}' + headers: + Accept: [application/json] + Accept-Encoding: ['gzip, deflate'] + CommandName: [relay wcf-relay authorization-rule keys renew] + Connection: [keep-alive] + Content-Length: ['27'] + Content-Type: [application/json; charset=utf-8] + User-Agent: [python/3.6.3 (Windows-10-10.0.16299-SP0) requests/2.18.4 msrest/0.4.22 + msrest_azure/0.4.19 azure-mgmt-relay/0.1.0 Azure-SDK-For-Python AZURECLI/2.0.27] + accept-language: [en-US] + method: POST + uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli_test_relay_wcfrelay000001/providers/Microsoft.Relay/namespaces/relay-nscli000002/wcfRelays/relay-wcfrelaycli000004/authorizationRules/cliwcfrelayAutho000005/regenerateKeys?api-version=2017-04-01 + response: + body: {string: '{"primaryConnectionString":"Endpoint=sb://relay-nscli000002.servicebus.windows.net/;SharedAccessKeyName=cliwcfrelayAutho000005;SharedAccessKey=QergKndRJM/azhWHVBsKcjgLW5dOd9+HLfpnMj7ehHg=;EntityPath=relay-wcfrelaycli000004","secondaryConnectionString":"Endpoint=sb://relay-nscli000002.servicebus.windows.net/;SharedAccessKeyName=cliwcfrelayAutho000005;SharedAccessKey=5Lf5gv6RcITA53D1XOAgz4Y9/etJ8J5csD1UHDE7Ba0=;EntityPath=relay-wcfrelaycli000004","primaryKey":"QergKndRJM/azhWHVBsKcjgLW5dOd9+HLfpnMj7ehHg=","secondaryKey":"5Lf5gv6RcITA53D1XOAgz4Y9/etJ8J5csD1UHDE7Ba0=","keyName":"cliwcfrelayAutho000005"}'} + headers: + cache-control: [no-cache] + content-length: ['625'] + content-type: [application/json; charset=utf-8] + date: ['Fri, 09 Feb 2018 23:10:15 GMT'] + expires: ['-1'] + pragma: [no-cache] + server: [Service-Bus-Resource-Provider/SN1, Microsoft-HTTPAPI/2.0] + server-sb: [Service-Bus-Resource-Provider/SN1] + strict-transport-security: [max-age=31536000; includeSubDomains] + transfer-encoding: [chunked] + vary: [Accept-Encoding] + x-ms-ratelimit-remaining-subscription-writes: ['1199'] + status: {code: 200, message: OK} +- request: + body: null + headers: + Accept: [application/json] + Accept-Encoding: ['gzip, deflate'] + CommandName: [relay wcf-relay authorization-rule delete] + Connection: [keep-alive] + Content-Length: ['0'] + Content-Type: [application/json; charset=utf-8] + User-Agent: [python/3.6.3 (Windows-10-10.0.16299-SP0) requests/2.18.4 msrest/0.4.22 + msrest_azure/0.4.19 azure-mgmt-relay/0.1.0 Azure-SDK-For-Python AZURECLI/2.0.27] + accept-language: [en-US] + method: DELETE + uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli_test_relay_wcfrelay000001/providers/Microsoft.Relay/namespaces/relay-nscli000002/wcfRelays/relay-wcfrelaycli000004/authorizationRules/cliwcfrelayAutho000005?api-version=2017-04-01 + response: + body: {string: ''} + headers: + cache-control: [no-cache] + content-length: ['0'] + date: ['Fri, 09 Feb 2018 23:10:16 GMT'] + expires: ['-1'] + pragma: [no-cache] + server: [Service-Bus-Resource-Provider/SN1, Microsoft-HTTPAPI/2.0] + server-sb: [Service-Bus-Resource-Provider/SN1] + strict-transport-security: [max-age=31536000; includeSubDomains] + x-ms-ratelimit-remaining-subscription-writes: ['1198'] + status: {code: 200, message: OK} +- request: + body: null + headers: + Accept: [application/json] + Accept-Encoding: ['gzip, deflate'] + CommandName: [relay wcf-relay delete] + Connection: [keep-alive] + Content-Length: ['0'] + Content-Type: [application/json; charset=utf-8] + User-Agent: [python/3.6.3 (Windows-10-10.0.16299-SP0) requests/2.18.4 msrest/0.4.22 + msrest_azure/0.4.19 azure-mgmt-relay/0.1.0 Azure-SDK-For-Python AZURECLI/2.0.27] + accept-language: [en-US] + method: DELETE + uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli_test_relay_wcfrelay000001/providers/Microsoft.Relay/namespaces/relay-nscli000002/wcfRelays/relay-wcfrelaycli000004?api-version=2017-04-01 + response: + body: {string: ''} + headers: + cache-control: [no-cache] + content-length: ['0'] + date: ['Fri, 09 Feb 2018 23:10:17 GMT'] + expires: ['-1'] + pragma: [no-cache] + server: [Service-Bus-Resource-Provider/SN1, Microsoft-HTTPAPI/2.0] + server-sb: [Service-Bus-Resource-Provider/SN1] + strict-transport-security: [max-age=31536000; includeSubDomains] + x-ms-ratelimit-remaining-subscription-writes: ['1199'] + status: {code: 200, message: OK} +- request: + body: null + headers: + Accept: [application/json] + Accept-Encoding: ['gzip, deflate'] + CommandName: [relay namespace delete] + Connection: [keep-alive] + Content-Length: ['0'] + Content-Type: [application/json; charset=utf-8] + User-Agent: [python/3.6.3 (Windows-10-10.0.16299-SP0) requests/2.18.4 msrest/0.4.22 + msrest_azure/0.4.19 azure-mgmt-relay/0.1.0 Azure-SDK-For-Python AZURECLI/2.0.27] + accept-language: [en-US] + method: DELETE + uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli_test_relay_wcfrelay000001/providers/Microsoft.Relay/namespaces/relay-nscli000002?api-version=2017-04-01 + response: + body: {string: ''} + headers: + cache-control: [no-cache] + content-length: ['0'] + date: ['Fri, 09 Feb 2018 23:10:18 GMT'] + expires: ['-1'] + location: ['https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli_test_relay_wcfrelay000001/providers/Microsoft.Relay/namespaces/relay-nscli000002/operationresults/relay-nscli000002?api-version=2017-04-01'] + pragma: [no-cache] + server: [Service-Bus-Resource-Provider/SN1, Microsoft-HTTPAPI/2.0] + server-sb: [Service-Bus-Resource-Provider/SN1] + strict-transport-security: [max-age=31536000; includeSubDomains] + x-ms-ratelimit-remaining-subscription-writes: ['1199'] + status: {code: 202, message: Accepted} +- request: + body: null + headers: + Accept: [application/json] + Accept-Encoding: ['gzip, deflate'] + CommandName: [relay namespace delete] + Connection: [keep-alive] + Content-Type: [application/json; charset=utf-8] + User-Agent: [python/3.6.3 (Windows-10-10.0.16299-SP0) requests/2.18.4 msrest/0.4.22 + msrest_azure/0.4.19 azure-mgmt-relay/0.1.0 Azure-SDK-For-Python AZURECLI/2.0.27] + accept-language: [en-US] + method: GET + uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli_test_relay_wcfrelay000001/providers/Microsoft.Relay/namespaces/relay-nscli000002/operationresults/relay-nscli000002?api-version=2017-04-01 + response: + body: {string: ''} + headers: + cache-control: [no-cache] + content-length: ['0'] + date: ['Fri, 09 Feb 2018 23:10:49 GMT'] + expires: ['-1'] + pragma: [no-cache] + server: [Service-Bus-Resource-Provider/SN1, Microsoft-HTTPAPI/2.0] + server-sb: [Service-Bus-Resource-Provider/SN1] + strict-transport-security: [max-age=31536000; includeSubDomains] + status: {code: 200, message: OK} +- request: + body: null + headers: + Accept: [application/json] + Accept-Encoding: ['gzip, deflate'] + CommandName: [group delete] + Connection: [keep-alive] + Content-Length: ['0'] + Content-Type: [application/json; charset=utf-8] + User-Agent: [python/3.6.3 (Windows-10-10.0.16299-SP0) requests/2.18.4 msrest/0.4.22 + msrest_azure/0.4.19 resourcemanagementclient/1.2.1 Azure-SDK-For-Python + AZURECLI/2.0.27] + accept-language: [en-US] + method: DELETE + uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourcegroups/cli_test_relay_wcfrelay000001?api-version=2017-05-10 + response: + body: {string: ''} + headers: + cache-control: [no-cache] + content-length: ['0'] + date: ['Fri, 09 Feb 2018 23:10:51 GMT'] + expires: ['-1'] + location: ['https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/operationresults/eyJqb2JJZCI6IlJFU09VUkNFR1JPVVBERUxFVElPTkpPQi1DTEk6NUZURVNUOjVGUkVMQVk6NUZXQ0ZSRUxBWTRHTkFGWUsyNUVCTUczV1VWRnw3OTFCN0Y1RDMwMkZBRjFGLVdFU1RVUyIsImpvYkxvY2F0aW9uIjoid2VzdHVzIn0?api-version=2017-05-10'] + pragma: [no-cache] + strict-transport-security: [max-age=31536000; includeSubDomains] + x-ms-ratelimit-remaining-subscription-writes: ['1199'] + status: {code: 202, message: Accepted} +version: 1 diff --git a/src/relay/azext_relay/tests/test_relay_commands.py b/src/relay/azext_relay/tests/test_relay_commands.py new file mode 100644 index 00000000000..350a7bfdc00 --- /dev/null +++ b/src/relay/azext_relay/tests/test_relay_commands.py @@ -0,0 +1,228 @@ +# -------------------------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# -------------------------------------------------------------------------------------------- + +# AZURE CLI Relay - NAMESPACE TEST DEFINITIONS + +from azure.cli.testsdk import (ScenarioTest, ResourceGroupPreparer) + + +# pylint: disable=line-too-long +# pylint: disable=too-many-lines + + +class RelayScenarioTest(ScenarioTest): + @ResourceGroupPreparer(name_prefix='cli_test_eh_namespace') + def test_relay_namespace(self, resource_group): + self.kwargs.update({ + 'loc': 'westus2', + 'rg': resource_group, + 'namespacename': self.create_random_name(prefix='relay-nscli', length=20), + 'tags': {'tag1: value1'}, + 'sku': 'Standard', + 'tier': 'Standard', + 'authoname': self.create_random_name(prefix='cliAutho', length=20), + 'defaultauthorizationrule': 'RootManageSharedAccessKey', + 'accessrights': 'Send', + 'primary': 'PrimaryKey', + 'secondary': 'SecondaryKey' + }) + + # Check for the NameSpace name Availability + + self.cmd('relay namespace exists --name {namespacename}', + checks=[self.check('nameAvailable', True)]) + + # Create Namespace + self.cmd( + 'relay namespace create --resource-group {rg} --name {namespacename} --location {loc} --tags {tags} --sku-tier {tier}', + checks=[self.check('sku.tier', self.kwargs['tier'])]) + + # Get Created Namespace + self.cmd('relay namespace show --resource-group {rg} --name {namespacename}', + checks=[self.check('sku.tier', self.kwargs['tier'])]) + + # Get Created Namespace list by subscription + listnamespaceresult = self.cmd('relay namespace list').output + self.assertGreater(len(listnamespaceresult), 0) + + # Get Created Namespace list by ResourceGroup + listnamespacebyresourcegroupresult = self.cmd('relay namespace list --resource-group {rg}').output + self.assertGreater(len(listnamespacebyresourcegroupresult), 0) + + # Create Authoriazation Rule + self.cmd( + 'relay namespace authorization-rule create --resource-group {rg} --namespace-name {namespacename} --name {authoname} --access-rights {accessrights}', + checks=[self.check('name', self.kwargs['authoname'])]) + + # Get Authorization Rule + self.cmd( + 'relay namespace authorization-rule show --resource-group {rg} --namespace-name {namespacename} --name {authoname}', + checks=[self.check('name', self.kwargs['authoname'])]) + + # Get Default Authorization Rule + self.cmd( + 'relay namespace authorization-rule show --resource-group {rg} --namespace-name {namespacename} --name {defaultauthorizationrule}', + checks=[self.check('name', self.kwargs['defaultauthorizationrule'])]) + + # Get Authorization Rule Listkeys + self.cmd( + 'relay namespace authorization-rule keys list --resource-group {rg} --namespace-name {namespacename} --name {authoname}') + + # Regeneratekeys - Primary + self.cmd( + 'relay namespace authorization-rule keys renew --resource-group {rg} --namespace-name {namespacename} --name {authoname} --key-name {primary}') + + # Regeneratekeys - Secondary + self.cmd( + 'relay namespace authorization-rule keys renew --resource-group {rg} --namespace-name {namespacename} --name {authoname} --key-name {secondary}') + + # Delete AuthorizationRule + self.cmd( + 'relay namespace authorization-rule delete --resource-group {rg} --namespace-name {namespacename} --name {authoname}') + + # Delete Namespace + self.cmd('relay namespace delete --resource-group {rg} --name {namespacename}') + + @ResourceGroupPreparer(name_prefix='cli_test_relay_wcfrelay') + def test_relay_wcfrelay(self, resource_group): + self.kwargs.update({ + 'loc': 'westus2', + 'rg': resource_group, + 'namespacename': self.create_random_name(prefix='relay-nscli', length=20), + 'tags': {'tag1: value1', 'tag2: value2'}, + 'sku': 'Standard', + 'tier': 'Standard', + 'authoname': self.create_random_name(prefix='cliAutho', length=20), + 'defaultauthorizationrule': 'RootManageSharedAccessKey', + 'accessrights': 'Send', + 'primary': 'PrimaryKey', + 'secondary': 'SecondaryKey', + 'wcfrelayname': self.create_random_name(prefix='relay-wcfrelaycli', length=25), + 'wcfrelayauthoname': self.create_random_name(prefix='cliwcfrelayAutho', length=25), + 'requiresclientauthorization': 'True', + 'requirestransportsecurity': 'True', + 'usermetadata': 'UserMetadata', + 'relaytype': 'NetTcp' + }) + + # Create Namespace + self.cmd( + 'relay namespace create --resource-group {rg} --name {namespacename} --location {loc} --tags {tags} --sku-tier {tier}', + checks=[self.check('sku.tier', self.kwargs['tier'])]) + + # Get Created Namespace + self.cmd('relay namespace show --resource-group {rg} --name {namespacename}', + checks=[self.check('sku.tier', self.kwargs['tier'])]) + + # Create WCFRelay + self.cmd( + 'relay wcf-relay create --resource-group {rg} --namespace-name {namespacename} --name {wcfrelayname} --relay-type {relaytype} --requires-client-authorization {requiresclientauthorization} --requires-transport-security {requirestransportsecurity} --user-metadata {usermetadata}', + checks=[self.check('name', self.kwargs['wcfrelayname'])]) + + # Get WCFRelay + self.cmd('relay wcf-relay show --resource-group {rg} --namespace-name {namespacename} --name {wcfrelayname}', + checks=[self.check('name', self.kwargs['wcfrelayname'])]) + + # WCFRelay List + listwcfrelay = self.cmd('relay wcf-relay list --resource-group {rg} --namespace-name {namespacename}').output + self.assertGreater(len(listwcfrelay), 0) + + # Create Authoriazation Rule + self.cmd( + 'relay wcf-relay authorization-rule create --resource-group {rg} --namespace-name {namespacename} --wcfrelay-name {wcfrelayname} --name {wcfrelayauthoname} --access-rights {accessrights}', + checks=[self.check('name', self.kwargs['wcfrelayauthoname'])]) + + # Get Create Authorization Rule + self.cmd( + 'relay wcf-relay authorization-rule show --resource-group {rg} --namespace-name {namespacename} --wcfrelay-name {wcfrelayname} --name {wcfrelayauthoname}', + checks=[self.check('name', self.kwargs['wcfrelayauthoname'])]) + + # Get Authorization Rule Listkeys + self.cmd( + 'relay wcf-relay authorization-rule keys list --resource-group {rg} --namespace-name {namespacename} --wcfrelay-name {wcfrelayname} --name {wcfrelayauthoname}') + + # Regeneratekeys - Primary + regenrateprimarykeyresult = self.cmd( + 'relay wcf-relay authorization-rule keys renew --resource-group {rg} --namespace-name {namespacename} --wcfrelay-name {wcfrelayname} --name {wcfrelayauthoname} --key-name {primary}') + self.assertIsNotNone(regenrateprimarykeyresult) + + # Regeneratekeys - Secondary + regenratesecondarykeyresult = self.cmd( + 'relay wcf-relay authorization-rule keys renew --resource-group {rg} --namespace-name {namespacename} --wcfrelay-name {wcfrelayname} --name {wcfrelayauthoname} --key-name {secondary}') + self.assertIsNotNone(regenratesecondarykeyresult) + + # Delete WCFRelay AuthorizationRule + self.cmd( + 'relay wcf-relay authorization-rule delete --resource-group {rg} --namespace-name {namespacename} --wcfrelay-name {wcfrelayname} --name {wcfrelayauthoname}') + + # Delete WCFRelay + self.cmd('relay wcf-relay delete --resource-group {rg} --namespace-name {namespacename} --name {wcfrelayname}') + + # Delete Namespace + self.cmd('relay namespace delete --resource-group {rg} --name {namespacename}') + + @ResourceGroupPreparer(name_prefix='cli_test_relay_hybridconnection') + def test_relay_hybridconnection(self, resource_group): + self.kwargs.update({ + 'loc': 'westus2', + 'rg': resource_group, + 'namespacename': self.create_random_name(prefix='relay-nscli', length=20), + 'tags': {'tag1: value1', 'tag2: value2'}, + 'sku': 'Standard', + 'tier': 'Standard', + 'authoname': self.create_random_name(prefix='cliAutho', length=20), + 'defaultauthorizationrule': 'RootManageSharedAccessKey', + 'accessrights': 'Send', + 'primary': 'PrimaryKey', + 'secondary': 'SecondaryKey', + 'hybridconnectionname': self.create_random_name(prefix='relay-hybridcli', length=25), + 'hybridconnectionauthoname': self.create_random_name(prefix='clihybridAutho', length=25), + 'requiresclientauthorization': 'True', + 'usermetadata': 'UserMetadata' + }) + + # Create Namespace + self.cmd('relay namespace create --resource-group {rg} --name {namespacename} --location {loc} --tags {tags} --sku-tier {tier}', + checks=[self.check('sku.tier', self.kwargs['tier'])]) + + # Get Created Namespace + self.cmd('relay namespace show --resource-group {rg} --name {namespacename}', + checks=[self.check('sku.tier', self.kwargs['tier'])]) + + # Create Hybrid Connections + self.cmd('relay hybrid-connections create --resource-group {rg} --namespace-name {namespacename} --name {hybridconnectionname} --requires-client-authorization {requiresclientauthorization} --user-metadata {usermetadata}', checks=[self.check('name', self.kwargs['hybridconnectionname'])]) + + # Get Hybrid Connections + self.cmd('relay hybrid-connections show --resource-group {rg} --namespace-name {namespacename} --name {hybridconnectionname}', checks=[self.check('name', self.kwargs['hybridconnectionname'])]) + + # Hybrid Connections List + listhybirdconnection = self.cmd('relay hybrid-connections list --resource-group {rg} --namespace-name {namespacename}').output + self.assertGreater(len(listhybirdconnection), 0) + + # Create Authoriazation Rule + self.cmd('relay hybrid-connections authorization-rule create --resource-group {rg} --namespace-name {namespacename} --hybrid-connection-name {hybridconnectionname} --name {hybridconnectionauthoname} --access-rights {accessrights}', checks=[self.check('name', self.kwargs['hybridconnectionauthoname'])]) + + # Get Create Authorization Rule + self.cmd('relay hybrid-connections authorization-rule show --resource-group {rg} --namespace-name {namespacename} --hybrid-connection-name {hybridconnectionname} --name {hybridconnectionauthoname}', checks=[self.check('name', self.kwargs['hybridconnectionauthoname'])]) + + # Get Authorization Rule Listkeys + self.cmd('relay hybrid-connections authorization-rule keys list --resource-group {rg} --namespace-name {namespacename} --hybrid-connection-name {hybridconnectionname} --name {hybridconnectionauthoname}') + + # Regeneratekeys - Primary + regenrateprimarykeyresult = self.cmd('relay hybrid-connections authorization-rule keys renew --resource-group {rg} --namespace-name {namespacename} --hybrid-connection-name {hybridconnectionname} --name {hybridconnectionauthoname} --key-name {primary}') + self.assertIsNotNone(regenrateprimarykeyresult) + + # Regeneratekeys - Secondary + regenratesecondarykeyresult = self.cmd('relay hybrid-connections authorization-rule keys renew --resource-group {rg} --namespace-name {namespacename} --hybrid-connection-name {hybridconnectionname} --name {hybridconnectionauthoname} --key-name {secondary}') + self.assertIsNotNone(regenratesecondarykeyresult) + + # Delete Hybrid Connections AuthorizationRule + self.cmd('relay hybrid-connections authorization-rule delete --resource-group {rg} --namespace-name {namespacename} --hybrid-connection-name {hybridconnectionname} --name {hybridconnectionauthoname}') + + # Delete Hybrid Connections + self.cmd('relay hybrid-connections delete --resource-group {rg} --namespace-name {namespacename} --name {hybridconnectionname}') + + # Delete Namespace + self.cmd('relay namespace delete --resource-group {rg} --name {namespacename}') diff --git a/src/relay/setup.cfg b/src/relay/setup.cfg new file mode 100644 index 00000000000..3c6e79cf31d --- /dev/null +++ b/src/relay/setup.cfg @@ -0,0 +1,2 @@ +[bdist_wheel] +universal=1 diff --git a/src/relay/setup.py b/src/relay/setup.py new file mode 100644 index 00000000000..f5d91e22732 --- /dev/null +++ b/src/relay/setup.py @@ -0,0 +1,41 @@ +#!/usr/bin/env python + +# -------------------------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# -------------------------------------------------------------------------------------------- + +from codecs import open +from setuptools import setup, find_packages + +VERSION = "0.0.1" + +CLASSIFIERS = [ + 'Development Status :: 4 - Beta', + 'Intended Audience :: Developers', + 'Intended Audience :: System Administrators', + 'Programming Language :: Python', + 'Programming Language :: Python :: 2', + 'Programming Language :: Python :: 2.7', + 'Programming Language :: Python :: 3', + 'Programming Language :: Python :: 3.4', + 'Programming Language :: Python :: 3.5', + 'Programming Language :: Python :: 3.6', + 'License :: OSI Approved :: MIT License', +] + +DEPENDENCIES = [] + +setup( + name='relay', + version=VERSION, + description='An Azure CLI Extension to manage Relay resources', + long_description='An Azure CLI Extension to manage Relay resources', + license='MIT', + author='Ajit Navasare', + author_email='v-ajnava@microsoft.com', + url='https://github.com/Azure/azure-cli-extensions', + classifiers=CLASSIFIERS, + packages=find_packages(exclude=["tests"]), + install_requires=DEPENDENCIES +)