diff --git a/src/network-manager/HISTORY.rst b/src/network-manager/HISTORY.rst index f31690b85c4..bf9d0f814f9 100644 --- a/src/network-manager/HISTORY.rst +++ b/src/network-manager/HISTORY.rst @@ -3,6 +3,16 @@ Release History =============== +0.4.0 ++++++ +* Add new cmd `az network manager connection` +* Add new cmd `az network manager connection management-group` +* Add new cmd `az network manager scope connection` +* Add new cmd `az network manager group static-member` +* `az network manager group delete`: add parameter `force` +* `az network manager security-admin-config delete`: add parameter `force` and add parameter `recursive` +* Bump up azure-mgmt-network SDK to 2021_05_01_preview + 0.3.0 +++++ * `az network manager list-active-connectivity-config`: rename parameter `region` to `regions` diff --git a/src/network-manager/azext_network_manager/_client_factory.py b/src/network-manager/azext_network_manager/_client_factory.py index f179932e2f6..aa3cfad7fc1 100644 --- a/src/network-manager/azext_network_manager/_client_factory.py +++ b/src/network-manager/azext_network_manager/_client_factory.py @@ -15,14 +15,6 @@ def cf_network_cl(cli_ctx, *_): return get_mgmt_service_client(cli_ctx, NetworkManagementClient) -def cf_activeconnectivityconfiguration(cli_ctx, *_): - return cf_network_cl(cli_ctx).active_connectivity_configurations - - -def cf_activesecurityadminrule(cli_ctx, *_): - return cf_network_cl(cli_ctx).active_security_admin_rules - - def cf_activesecurityuserrule(cli_ctx, *_): return cf_network_cl(cli_ctx).active_security_user_rules @@ -39,14 +31,18 @@ def cf_connectivityconfiguration(cli_ctx, *_): return cf_network_cl(cli_ctx).connectivity_configurations -def cf_effectiveconnectivityconfiguration(cli_ctx, *_): - return cf_network_cl(cli_ctx).effective_connectivity_configurations +def cf_listeffectivevirtualnetwork(cli_ctx, *_): + return cf_network_cl(cli_ctx).list_effective_virtual_networks def cf_effectivevirtualnetwork(cli_ctx, *_): return cf_network_cl(cli_ctx).effective_virtual_networks +def cf_networkmanagementclient(cli_ctx, *_): + return cf_network_cl(cli_ctx) + + def cf_networkgroup(cli_ctx, *_): return cf_network_cl(cli_ctx).network_groups @@ -59,10 +55,6 @@ def cf_networkmanagerdeploymentstatus(cli_ctx, *_): return cf_network_cl(cli_ctx).network_manager_deployment_status -def cf_effectivesecurityadminrule(cli_ctx, *_): - return cf_network_cl(cli_ctx).network_manager_effective_security_admin_rules - - def cf_networkmanager(cli_ctx, *_): return cf_network_cl(cli_ctx).network_managers @@ -81,3 +73,19 @@ def cf_userrulecollection(cli_ctx, *_): def cf_userrule(cli_ctx, *_): return cf_network_cl(cli_ctx).user_rules + + +def cf_scopeconnection(cli_ctx, *_): + return cf_network_cl(cli_ctx).scope_connections + + +def cf_staticmembers(cli_ctx, *_): + return cf_network_cl(cli_ctx).static_members + + +def cf_subscriptionconnection(cli_ctx, *_): + return cf_network_cl(cli_ctx).subscription_network_manager_connections + + +def cf_managementgroupconnection(cli_ctx, *_): + return cf_network_cl(cli_ctx).management_group_network_manager_connections diff --git a/src/network-manager/azext_network_manager/_help.py b/src/network-manager/azext_network_manager/_help.py index 819d7d9e5a8..7c4b47a2e6f 100644 --- a/src/network-manager/azext_network_manager/_help.py +++ b/src/network-manager/azext_network_manager/_help.py @@ -322,7 +322,7 @@ - name: Delete Azure Virtual Network Manager Group text: |- az network manager group delete --name "TestNetworkGroup" --network-manager-name "testNetworkManager" \ ---resource-group "rg1" +--resource-group "rg1" --force """ helps['network manager group list-effect-vnet'] = """ @@ -436,7 +436,7 @@ - name: Delete network manager security admin Configuration text: |- az network manager security-admin-config delete --configuration-name "myTestSecurityConfig" \ ---network-manager-name "testNetworkManager" --resource-group "rg1" +--network-manager-name "testNetworkManager" --resource-group "rg1" --force """ helps['network manager security-admin-config rule-collection'] = """ @@ -740,3 +740,227 @@ az network manager security-user-config rule-collection rule delete --configuration-name "myTestSecurityConfig" --network-manager-name \ "testNetworkManager" --resource-group "rg1" --rule-collection-name "myTestCollection" --rule-name "SampleUserRule" """ + +helps['network manager connection subscription'] = """ + type: group + short-summary: Manage subscription-group connection with network +""" + +helps['network manager connection subscription list'] = """ + type: command + short-summary: "List all network manager connections created by this subscription." + examples: + - name: List network manager connections in a network manager + text: |- + az network manager connection subscription list +""" + +helps['network manager connection subscription show'] = """ + type: command + short-summary: "Get a specified connection created by this subscription." + examples: + - name: Get network manager connection + text: |- + az network manager connection subscription show --connection-name "testNetworkManagerConnection" +""" + +helps['network manager connection subscription create'] = """ + type: command + short-summary: "Create a connection from this subscription to a cross tenant network manager." + examples: + - name: Create network manager connection + text: |- + az network manager connection subscription create --connection-name "testNetworkManagerConnection" \ +--description "A sample policy" --network-manager-id /subscriptions/00000000-0000-0000-0000-000000000000\ +/resourceGroups/rg1/providers/Microsoft.Network/networkManagers/testManagerName +""" + +helps['network manager connection subscription update'] = """ + type: command + short-summary: "Update a connection from this subscription to a cross tenant network manager." + examples: + - name: Update network manager connection + text: |- + az network manager connection subscription update --connection-name "testNetworkManagerConnection" \ +--description "A sample policy" +""" + +helps['network manager connection subscription delete'] = """ + type: command + short-summary: "Deletes a network manager connection." + examples: + - name: Delete network manager connection + text: |- + az network manager connection subscription delete --connection-name "testNetworkManagerConnection" +""" + +helps['network manager connection'] = """ + type: group + short-summary: Manage connection with network manager +""" + +# helps['network manager connection management-group'] = """ +# type: group +# short-summary: Manage management-group connection with network +# """ +# +# helps['network manager connection management-group list'] = """ +# type: command +# short-summary: "List all network manager connections created by this management group." +# examples: +# - name: List management-group connections in a network manager +# text: |- +# az network manager connection management-group list --management-group-id "testManagementGroupId" \ +# --resource-group "rg1" +# """ +# +# helps['network manager connection management-group show'] = """ +# type: command +# short-summary: "Get a specified connection created by this management group." +# examples: +# - name: Get network manager connection management-group +# text: |- +# az network manager connection management-group show --management-group-id "testManagementGroupId" \ +# --connection-name "testNetworkManagerConnection" --resource-group "rg1" +# """ +# +# helps['network manager connection management-group create'] = """ +# type: command +# short-summary: Create a connection to a cross tenant network manager" +# examples: +# - name: Create network manager connection management-group +# text: |- +# az network manager connection management-group create --management-group-id "testManagementGroupId" \ +# --connection-name "testNetworkManagerConnection" --resource-group "rg1" --network-manager "testNetworkManagerId" \ +# --description "A sample policy" +# """ +# +# helps['network manager connection management-group update'] = """ +# type: command +# short-summary: "Update a connection to a cross tenant network manager" +# """ +# +# helps['network manager connection management-group delete'] = """ +# type: command +# short-summary: "Delete specified pending connection created by this management group." +# examples: +# - name: Delete network manager connection management-group +# text: |- +# az network manager connection management-group delete --management-group-id "testManagementGroupId" \ +# --connection-name "testNetworkManagerConnection" --resource-group "rg1" +# """ + +helps['network manager scope-connection'] = """ + type: group + short-summary: Manage scope connection with network +""" + +helps['network manager scope-connection list'] = """ + type: command + short-summary: "List all scope connections created by this network manager." + examples: + - name: List scope connections in a network manager + text: |- + az network manager scope-connection list --network-manager-name "testNetworkManager" --resource-group \ +"rg1" +""" + +helps['network manager scope-connection show'] = """ + type: command + short-summary: "Get specified scope connection created by this Network Manager." + examples: + - name: Get network manager scope-connection + text: |- + az network manager scope-connection show --name "TestScopeConnect" \ +--network-manager-name "testNetworkManager" --resource-group "rg1" +""" + +helps['network manager scope-connection create'] = """ + type: command + short-summary: "Creates scope connection from Network Manager." + examples: + - name: Create network manager scope-connection + text: |- + az network manager scope-connection create --name "TestScopeConnect" \ +--network-manager-name "testNetworkManager" --resource-group "rg1" --description "A sample policy" \ +--tenant-id 00000000-0000-0000-0000-000000000000 --resource-id /subscriptions/00000000-0000-0000-0000-000000000000 +""" + +helps['network manager scope-connection update'] = """ + type: command + short-summary: "Update scope connection from Network Manager." + examples: + - name: Update network manager scope-connection + text: |- + az network manager scope-connection update --name "TestScopeConnect" \ +--network-manager-name "testNetworkManager" --resource-group "rg1" --description "A sample policy" +""" + +helps['network manager scope-connection delete'] = """ + type: command + short-summary: "Delete the pending scope connection created by this network manager." + examples: + - name: Delete network manager scope connection + text: |- + az network manager scope-connection delete --name "TestScopeConnect" \ +--network-manager-name "testNetworkManager" --resource-group "rg1" +""" + +helps['network manager group static-member'] = """ + type: group + short-summary: Manage static members with network +""" + +helps['network manager group static-member list'] = """ + type: command + short-summary: "Lists the specified static member." + examples: + - name: List static member in a network manager + text: |- + az network manager group static-member list --network-manager-name "testNetworkManager" \ +--resource-group "rg1" --network-group-name "testNetworkManagerGroup" +""" + +helps['network manager group static-member show'] = """ + type: command + short-summary: "Gets the specified static member." + examples: + - name: Get network manager group static-member + text: |- + az network manager group static-member show --network-group-name "testNetworkManagerGroup" \ +--network-manager-name "testNetworkManager" --resource-group "rg1" --static-member-name "testStaticMember" +""" + +helps['network manager group static-member create'] = """ + type: command + short-summary: "Creates a static member." + examples: + - name: Create network manager security admin Configuration + text: |- + az network manager group static-member create --network-group-name "testNetworkManagerGroup" \ +--network-manager-name "testNetworkManager" --resource-group "rg1" --static-member-name "testStaticMember" \ +--resource-id="/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/rg/providers/ \ +Microsoft.Network/virtualnetworks/virtual_network" +""" + +helps['network manager group static-member update'] = """ + type: command + short-summary: "Update a static member." + examples: + - name: Update network manager security admin Configuration + text: |- + az network manager group static-member update --network-group-name "testNetworkManagerGroup" \ +--network-manager-name "testNetworkManager" --resource-group "rg1" --static-member-name "testStaticMember" \ +--resource-id="/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/rg/providers/ \ +Microsoft.Network/virtualnetworks/virtual_network" +""" + +helps['network manager group static-member delete'] = """ + type: command + short-summary: "Deletes a static member." + examples: + - name: Delete network manager group static-member + text: |- + az network manager group static-member delete --network-group-name "testNetworkManagerGroup" \ +--network-manager-name "testNetworkManager" --resource-group "rg1" --static-member-name "testStaticMember" +""" diff --git a/src/network-manager/azext_network_manager/_params.py b/src/network-manager/azext_network_manager/_params.py index 669a93ff748..37dd7713533 100644 --- a/src/network-manager/azext_network_manager/_params.py +++ b/src/network-manager/azext_network_manager/_params.py @@ -9,7 +9,6 @@ # -------------------------------------------------------------------------- # pylint: disable=too-many-lines # pylint: disable=too-many-statements - from azure.cli.core.commands.parameters import ( tags_type, get_three_state_flag, @@ -258,6 +257,8 @@ def load_arguments(self, _): c.argument('network_manager_name', options_list=['--network-manager-name'], type=str, help='The name of the network manager.', id_part='name') c.argument('network_group_name', options_list=['--name', '-n', '--network-group-name'], type=str, help='The ' 'name of the network group to get.', id_part='child_name_1') + c.argument('force', arg_type=get_three_state_flag(), + help='Deletes the resource even if it is part of a deployed configuration.') with self.argument_context('network manager security-user-config list') as c: c.argument('resource_group_name', resource_group_name_type) @@ -354,6 +355,9 @@ def load_arguments(self, _): c.argument('network_manager_name', type=str, help='The name of the network manager.', id_part='name') c.argument('configuration_name', type=str, help='The name of the network manager security Configuration.', id_part='child_name_1') + c.argument('force', arg_type=get_three_state_flag(), + help='Deletes the resource even if it is part of a deployed configuration.') + c.argument('recursive', arg_type=get_three_state_flag(), help='Deletes the resource recursively.') with self.argument_context('network manager security-admin-config rule-collection create') as c: c.argument('resource_group_name', resource_group_name_type) @@ -536,3 +540,145 @@ def load_arguments(self, _): c.argument('flag', type=str, help='Default rule flag.') c.argument('kind', type=str, help='Required. Whether the rule is custom or default.Constant filled by server.', arg_type=get_enum_type(['Custom', 'Default'])) c.ignore('user_rule') + + with self.argument_context('network manager connection subscription create') as c: + c.argument('network_manager_connection_name', options_list=['--name', '-n', '--connection-name'], + type=str, help='The name of the network manager connection.') + c.argument('network_manager_id', options_list=['--network-manager', '--network-manager-id'], type=str, + help='the id of the network manager.') + c.argument('description', type=str, help='A description of the scope connection.') + + with self.argument_context('network manager connection subscription update') as c: + c.argument('network_manager_connection_name', options_list=['--name', '-n', '--connection-name'], + type=str, help='The name of the network manager connection.', id_part='name') + c.argument('description', type=str, help='A description of the scope connection.') + c.ignore('parameters') + + with self.argument_context('network manager connection subscription list') as c: + c.argument('top', type=int, help='An optional query parameter which specifies the maximum number of records to ' + 'be returned by the server.') + c.argument('skip_token', type=str, help='SkipToken is only used if a previous operation returned a partial ' + 'result. If a previous response contains a nextLink element, the value of the nextLink element will ' + 'include a skipToken parameter that specifies a starting point to use for subsequent calls.') + + with self.argument_context('network manager connection subscription show') as c: + c.argument('network_manager_connection_name', options_list=['--name', '-n', '--connection-name'], + type=str, help='The name of the network manager connection.', id_part='name') + + with self.argument_context('network manager connection subscription delete') as c: + c.argument('network_manager_connection_name', options_list=['--name', '-n', '--connection-name'], + type=str, help='The name of the network manager connection.', id_part='name') + +# with self.argument_context('network manager connection management-group create') as c: +# c.argument('network_manager_connection_name', options_list=['--name', '-n', '--connection-name'], type=str, +# help='The name of the network manager connection.') +# c.argument('management_group_id', type=str, +# help='The management group id which uniquely identify the microsoft azure management group') +# c.argument('network_manager_id', options_list=['--network-manager', '--network-manager-id'], type=str, +# help='the name or id of the network manager.', validator=validate_network_manager) +# c.argument('description', type=str, help='A description of the scope connection.') +# +# with self.argument_context('network manager connection management-group update') as c: +# c.argument('network_manager_connection_name', options_list=['--name', '-n', '--connection-name'], type=str, +# help='The name of the network manager connection.', id_part='child_name_1') +# c.argument('management_group_id', type=str, help='The management group id which uniquely identify ' +# 'the microsoft azure management group', id_part='name') +# c.argument('network_manager_id', options_list=['--network-manager', '--network-manager-id'], type=str, +# help='the name or id of the network manager.', validator=validate_network_manager) +# c.argument('description', type=str, help='A description of the scope connection.') +# c.ignore('parameters') +# +# with self.argument_context('network manager connection management-group list') as c: +# c.argument('management_group_id', type=str, +# help='The management group id which uniquely identify the microsoft azure management group') +# c.argument('top', type=int, help='An optional query parameter which specifies the maximum number of records to ' +# 'be returned by the server.') +# c.argument('skip_token', type=str, help='SkipToken is only used if a previous operation returned a partial ' +# 'result. If a previous response contains a nextLink element, the value of the nextLink element will ' +# 'include a skipToken parameter that specifies a starting point to use for subsequent calls.') +# +# with self.argument_context('network manager connection management-group show') as c: +# c.argument('network_manager_connection_name', options_list=['--name', '-n', '--connection-name'], type=str, +# help='The name of the network manager connection.', id_part='name') +# c.argument('management_group_id', type=str, +# help='The management group id which uniquely identify the microsoft azure management group') +# +# with self.argument_context('network manager connection management-group delete') as c: +# c.argument('network_manager_connection_name', options_list=['--name', '-n', '--connection-name'], type=str, +# help='The name of the network manager connection.', id_part='name') +# c.argument('management_group_id', type=str, +# help='The management group id which uniquely identify the microsoft azure management group') + + with self.argument_context('network manager scope-connection create') as c: + c.argument('resource_group_name', resource_group_name_type) + c.argument('network_manager_name', options_list=['--network-manager', '--network-manager-name'], type=str, help='The name of the network manager') + c.argument('scope_connection_name', options_list=['--name', '-n', '--connection-name'], type=str, help='The name of the network manager scope connection.') + c.argument('tenant_id', type=str, help='The id of tenant') + c.argument('resource_id', type=str, help='The id of resource') + c.argument('description', type=str, help='A description of the scope connection.') + + with self.argument_context('network manager scope-connection update') as c: + c.argument('resource_group_name', resource_group_name_type) + c.argument('network_manager_name', options_list=['--network-manager', '--network-manager-name'], type=str, help='The name of the network manager', id_part='name') + c.argument('scope_connection_name', options_list=['--name', '-n', '--connection-name'], type=str, help='The name of the network manager scope connection.', + id_part='child_name_1') + c.argument('description', type=str, help='A description of the scope connection.') + c.ignore('parameters') + + with self.argument_context('network manager scope-connection list') as c: + c.argument('resource_group_name', resource_group_name_type) + c.argument('network_manager_name', options_list=['--network-manager', '--network-manager-name'], type=str, help='The name of the network manager', id_part=None) + c.argument('top', type=int, help='An optional query parameter which specifies the maximum number of records to ' + 'be returned by the server.') + c.argument('skip_token', type=str, help='SkipToken is only used if a previous operation returned a partial ' + 'result. If a previous response contains a nextLink element, the value of the nextLink element will ' + 'include a skipToken parameter that specifies a starting point to use for subsequent calls.') + + with self.argument_context('network manager scope-connection show') as c: + c.argument('resource_group_name', resource_group_name_type) + c.argument('network_manager_name', options_list=['--network-manager', '--network-manager-name'], type=str, help='The name of the network manager', id_part='name') + c.argument('scope_connection_name', options_list=['--name', '-n', '--connection-name'], type=str, help='The name of the network manager scope connection.', + id_part='child_name_1') + + with self.argument_context('network manager scope-connection delete') as c: + c.argument('resource_group_name', resource_group_name_type) + c.argument('network_manager_name', options_list=['--network-manager', '--network-manager-name'], type=str, help='The name of the network manager', id_part='name') + c.argument('scope_connection_name', options_list=['--name', '-n', '--connection-name'], type=str, help='The name of the network manager scope connection.', + id_part='child_name_1') + + with self.argument_context('network manager group static-member create') as c: + c.argument('resource_group_name', resource_group_name_type) + c.argument('network_manager_name', options_list=['--network-manager', '--network-manager-name'], type=str, help='The name of the network manager.') + c.argument('network_group_name', options_list=['--network-group', '--network-group-name'], type=str, help='The name of the network group.') + c.argument('static_member_name', options_list=['--name', '-n', '--static-member-name'], type=str, help='The name of the static member.') + c.argument('resource_id', type=str, help='The id of resource') + + with self.argument_context('network manager group static-member update') as c: + c.argument('resource_group_name', resource_group_name_type) + c.argument('network_manager_name', options_list=['--network-manager', '--network-manager-name'], type=str, help='The name of the network manager.') + c.argument('network_group_name', options_list=['--network-group', '--network-group-name'], type=str, help='The name of the network group.') + c.argument('static_member_name', options_list=['--name', '-n', '--static-member-name'], type=str, help='The name of the static member.') + c.argument('resource_id', type=str, help='The id of resource') + c.ignore('parameters') + + with self.argument_context('network manager group static-member list') as c: + c.argument('resource_group_name', resource_group_name_type) + c.argument('network_manager_name', options_list=['--network-manager', '--network-manager-name'], type=str, help='The name of the network manager.', id_part=None) + c.argument('network_group_name', options_list=['--network-group', '--network-group-name'], type=str, help='The name of the network group.', id_part=None) + c.argument('top', type=int, help='An optional query parameter which specifies the maximum number of records to ' + 'be returned by the server.') + c.argument('skip_token', type=str, help='SkipToken is only used if a previous operation returned a partial ' + 'result. If a previous response contains a nextLink element, the value of the nextLink element will ' + 'include a skipToken parameter that specifies a starting point to use for subsequent calls.') + + with self.argument_context('network manager group static-member show') as c: + c.argument('resource_group_name', resource_group_name_type) + c.argument('network_manager_name', options_list=['--network-manager', '--network-manager-name'], type=str, help='The name of the network manager.') + c.argument('network_group_name', options_list=['--network-group', '--network-group-name'], type=str, help='The name of the network group.') + c.argument('static_member_name', options_list=['--name', '-n', '--static-member-name'], type=str, help='The name of the static member.') + + with self.argument_context('network manager group static-member delete') as c: + c.argument('resource_group_name', resource_group_name_type) + c.argument('network_manager_name', options_list=['--network-manager', '--network-manager-name'], type=str, help='The name of the network manager.') + c.argument('network_group_name', options_list=['--network-group', '--network-group-name'], type=str, help='The name of the network group.') + c.argument('static_member_name', options_list=['--name', '-n', '--static-member-name'], type=str, help='The name of the static member.') diff --git a/src/network-manager/azext_network_manager/commands.py b/src/network-manager/azext_network_manager/commands.py index 95eecf89ea6..28d17979f06 100644 --- a/src/network-manager/azext_network_manager/commands.py +++ b/src/network-manager/azext_network_manager/commands.py @@ -8,14 +8,16 @@ # regenerated. # -------------------------------------------------------------------------- # pylint: disable=too-many-statements -# pylint: disable=too-many-locals +# pylint: disable=too-many-locals option_length_too_long from azure.cli.core.commands import CliCommandType from azext_network_manager._client_factory import ( - cf_networkmanager, cf_networkmanagercommit, cf_networkmanagerdeploymentstatus, cf_effectivevirtualnetwork, - cf_activeconnectivityconfiguration, cf_connectivityconfiguration, cf_networkgroup, cf_userrule, - cf_userrulecollection, cf_adminrule, cf_adminrulecollection, cf_securityadminconfiguration, cf_securityuserconfiguration, - cf_activesecurityadminrule, cf_activesecurityuserrule, cf_effectiveconnectivityconfiguration, cf_effectivesecurityadminrule) + cf_networkmanager, cf_networkmanagercommit, cf_networkmanagerdeploymentstatus, + cf_connectivityconfiguration, cf_networkgroup, cf_userrule, + cf_userrulecollection, cf_adminrule, cf_adminrulecollection, cf_securityadminconfiguration, + cf_securityuserconfiguration, cf_activesecurityuserrule, + cf_scopeconnection, cf_staticmembers, cf_listeffectivevirtualnetwork, + cf_subscriptionconnection, cf_managementgroupconnection, cf_effectivevirtualnetwork) def load_command_table(self, _): @@ -64,6 +66,26 @@ def load_command_table(self, _): client_factory=cf_userrulecollection ) + network_scopeconnection = CliCommandType( + operations_tmpl='azext_network_manager.vendored_sdks.operations._scope_connections_operations#ScopeConnectionsOperations.{}', + client_factory=cf_scopeconnection + ) + + network_staticmembers = CliCommandType( + operations_tmpl='azext_network_manager.vendored_sdks.operations._static_members_operations#StaticMembersOperations.{}', + client_factory=cf_staticmembers + ) + + network_subscriptionconnection = CliCommandType( + operations_tmpl='azext_network_manager.vendored_sdks.operations._subscription_network_manager_connections_operations#SubscriptionNetworkManagerConnectionsOperations.{}', + client_factory=cf_subscriptionconnection + ) + +# network_managementgroupconnection = CliCommandType( +# operations_tmpl='azext_network_manager.vendored_sdks.operations._management_group_network_manager_connections_operations#ManagementGroupNetworkManagerConnectionsOperations.{}', +# client_factory=cf_managementgroupconnection +# ) + with self.command_group('network manager', network_networkmanager, client_factory=cf_networkmanager) as g: g.custom_command('create', 'network_manager_create') g.custom_command('list', 'network_manager_list') @@ -135,3 +157,31 @@ def load_command_table(self, _): g.custom_command('list', 'network_manager_user_rule_collection_list') g.custom_show_command('show', 'network_manager_user_rule_collection_show') g.custom_command('delete', 'network_manager_user_rule_collection_delete', confirmation=True) + + with self.command_group('network manager connection subscription', network_subscriptionconnection, client_factory=cf_subscriptionconnection) as g: + g.custom_command('create', 'network_manager_connection_subscription_create') + g.generic_update_command('update', custom_func_name='network_manager_connection_subscription_update') + g.custom_command('list', 'network_manager_connection_subscription_list') + g.custom_show_command('show', 'network_manager_connection_subscription_show') + g.custom_command('delete', 'network_manager_connection_subscription_delete', confirmation=True) + +# with self.command_group('network manager connection management-group', network_managementgroupconnection, client_factory=cf_managementgroupconnection) as g: +# g.custom_command('create', 'network_manager_connection_management_group_create') +# g.generic_update_command('update', setter_arg_name='connection_management_group', custom_func_name='network_manager_connection_management_group_update') +# g.custom_command('list', 'network_manager_connection_management_group_list') +# g.custom_show_command('show', 'network_manager_connection_management_group_show') +# g.custom_command('delete', 'network_manager_connection_management_group_delete', confirmation=True) + + with self.command_group('network manager scope-connection', network_scopeconnection, client_factory=cf_scopeconnection) as g: + g.custom_command('create', 'network_manager_scope_connection_create') + g.generic_update_command('update', custom_func_name='network_manager_scope_connection_update') + g.custom_command('list', 'network_manager_scope_connection_list') + g.custom_show_command('show', 'network_manager_scope_connection_show') + g.custom_command('delete', 'network_manager_scope_connection_delete', confirmation=True) + + with self.command_group('network manager group static-member', network_staticmembers, client_factory=cf_staticmembers) as g: + g.custom_command('create', 'network_manager_group_static_member_create') + g.generic_update_command('update', custom_func_name='network_manager_group_static_member_update') + g.custom_command('list', 'network_manager_group_static_member_list') + g.custom_show_command('show', 'network_manager_group_static_member_show') + g.custom_command('delete', 'network_manager_group_static_member_delete', confirmation=True) diff --git a/src/network-manager/azext_network_manager/custom.py b/src/network-manager/azext_network_manager/custom.py index 8944940fc55..9db8a9876d2 100644 --- a/src/network-manager/azext_network_manager/custom.py +++ b/src/network-manager/azext_network_manager/custom.py @@ -9,16 +9,15 @@ # -------------------------------------------------------------------------- # pylint: disable=too-many-lines # pylint: disable=unused-argument +from knack.util import CLIError from ._client_factory import ( cf_networkmanagercommit, cf_networkmanagerdeploymentstatus, + cf_networkmanagementclient, + cf_activesecurityuserrule, cf_effectivevirtualnetwork, - cf_activeconnectivityconfiguration, - cf_effectiveconnectivityconfiguration, - cf_effectivesecurityadminrule, - cf_activesecurityadminrule, - cf_activesecurityuserrule + cf_listeffectivevirtualnetwork ) @@ -135,13 +134,13 @@ def network_manager_effect_vnet_list_by_network_group(cmd, network_manager_name, network_group_name, skip_token=None): - client = cf_effectivevirtualnetwork(cmd.cli_ctx) + client = cf_listeffectivevirtualnetwork(cmd.cli_ctx) parameters = {} parameters['skip_token'] = skip_token - return client.list_by_network_group(resource_group_name=resource_group_name, - network_manager_name=network_manager_name, - network_group_name=network_group_name, - parameters=parameters) + return client.by_network_group(resource_group_name=resource_group_name, + network_manager_name=network_manager_name, + network_group_name=network_group_name, + parameters=parameters) def network_manager_effect_vnet_list_by_network_manager(cmd, @@ -168,13 +167,13 @@ def network_manager_active_config_list(cmd, network_manager_name, skip_token=None, regions=None): - client = cf_activeconnectivityconfiguration(cmd.cli_ctx) + client = cf_networkmanagementclient(cmd.cli_ctx) parameters = {} parameters['skip_token'] = skip_token parameters['regions'] = regions - return client.list(resource_group_name=resource_group_name, - network_manager_name=network_manager_name, - parameters=parameters) + return client.list_active_connectivity_configurations(resource_group_name=resource_group_name, + network_manager_name=network_manager_name, + parameters=parameters) def network_manager_effective_config_list(cmd, @@ -182,12 +181,12 @@ def network_manager_effective_config_list(cmd, resource_group_name, virtual_network_name, skip_token=None): - client = cf_effectiveconnectivityconfiguration(cmd.cli_ctx) + client = cf_networkmanagementclient(cmd.cli_ctx) parameters = {} parameters['skip_token'] = skip_token - return client.list(resource_group_name=resource_group_name, - virtual_network_name=virtual_network_name, - parameters=parameters) + return client.list_network_manager_effective_connectivity_configurations(resource_group_name=resource_group_name, + virtual_network_name=virtual_network_name, + parameters=parameters) def network_manager_effective_security_admin_rule_list(cmd, @@ -195,12 +194,12 @@ def network_manager_effective_security_admin_rule_list(cmd, resource_group_name, virtual_network_name, skip_token=None): - client = cf_effectivesecurityadminrule(cmd.cli_ctx) + client = cf_networkmanagementclient(cmd.cli_ctx) parameters = {} parameters['skip_token'] = skip_token - return client.list(resource_group_name=resource_group_name, - virtual_network_name=virtual_network_name, - parameters=parameters) + return client.list_network_manager_effective_security_admin_rules(resource_group_name=resource_group_name, + virtual_network_name=virtual_network_name, + parameters=parameters) def network_manager_active_security_admin_rule_list(cmd, @@ -209,13 +208,13 @@ def network_manager_active_security_admin_rule_list(cmd, network_manager_name, skip_token=None, regions=None): - client = cf_activesecurityadminrule(cmd.cli_ctx) + client = cf_networkmanagementclient(cmd.cli_ctx) parameters = {} parameters['skip_token'] = skip_token parameters['region'] = regions - return client.list(resource_group_name=resource_group_name, - network_manager_name=network_manager_name, - parameters=parameters) + return client.list_active_security_admin_rules(resource_group_name=resource_group_name, + network_manager_name=network_manager_name, + parameters=parameters) def network_manager_active_security_user_rule_list(cmd, @@ -397,10 +396,12 @@ def network_manager_group_update(instance, def network_manager_group_delete(client, resource_group_name, network_manager_name, - network_group_name): + network_group_name, + force): return client.delete(resource_group_name=resource_group_name, network_manager_name=network_manager_name, - network_group_name=network_group_name) + network_group_name=network_group_name, + force=force) def network_manager_security_user_config_list(client, @@ -524,10 +525,16 @@ def network_manager_security_admin_config_update(instance, def network_manager_security_admin_config_delete(client, resource_group_name, network_manager_name, - configuration_name): + configuration_name, + force=None, + recursive=None): + if force is not None and recursive is not None: + raise CLIError('force and recursive cannot be selected at the same time') return client.delete(resource_group_name=resource_group_name, network_manager_name=network_manager_name, - configuration_name=configuration_name) + configuration_name=configuration_name, + force=force, + recursive=recursive) def network_manager_admin_rule_collection_list(client, @@ -964,3 +971,197 @@ def network_manager_vnet_security_perimeter_delete(client, def network_manager_perimeter_associable_resource_type_list(client, location): return client.get(location=location) + + +def network_manager_connection_subscription_list(client, + top=None, + skip_token=None): + return client.list(top=top, + skip_token=skip_token) + + +def network_manager_connection_subscription_create(client, + network_manager_connection_name, + network_manager_id, + description=None): + parameters = {} + parameters['network_manager_id'] = network_manager_id + parameters['description'] = description + return client.create_or_update(network_manager_connection_name=network_manager_connection_name, + parameters=parameters) + + +def network_manager_connection_subscription_update(instance, + description=None): + if description is not None: + instance.description = description + return instance + + +def network_manager_connection_subscription_show(client, + network_manager_connection_name): + return client.get(network_manager_connection_name=network_manager_connection_name) + + +def network_manager_connection_subscription_delete(client, + network_manager_connection_name): + return client.delete(network_manager_connection_name=network_manager_connection_name) + + +# def network_manager_connection_management_group_list(client, +# top=None, +# skip_token=None): +# return client.list(top=top, +# skip_token=skip_token) +# +# +# def network_manager_connection_management_group_create(client, +# resource_group_name, +# network_manager_connection_name, +# management_group_id, +# network_manager_id, +# description=None): +# parameters = {} +# parameters['description'] = description +# parameters['network_manager_id'] = network_manager_id +# return client.create_or_update(resource_group_name=resource_group_name, +# network_manager_connection_name=network_manager_connection_name, +# management_group_id=management_group_id, +# parameters=parameters) +# +# +# def network_manager_connection_management_group_update(instance, +# management_group_id, +# description=None): +# if description is not None: +# instance.description = description +# if management_group_id is not None: +# instance.management_group_id = management_group_id +# return instance +# +# +# def network_manager_connection_management_group_show(client, +# resource_group_name, +# network_manager_connection_name, +# management_group_id): +# return client.get(resource_group_name=resource_group_name, +# network_manager_connection_name=network_manager_connection_name, +# management_group_id=management_group_id) +# +# +# def network_manager_connection_management_group_delete(client, +# resource_group_name, +# network_manager_connection_name, +# management_group_id): +# return client.delete(resource_group_name=resource_group_name, +# network_manager_connection_name=network_manager_connection_name, +# management_group_id=management_group_id) + + +def network_manager_scope_connection_list(client, + resource_group_name, + network_manager_name, + top=None, + skip_token=None): + return client.list(resource_group_name=resource_group_name, + network_manager_name=network_manager_name, + top=top, + skip_token=skip_token) + + +def network_manager_scope_connection_create(client, + resource_group_name, + network_manager_name, + scope_connection_name, + tenant_id, + resource_id, + description=None): + parameters = {} + parameters['tenant_id'] = tenant_id + parameters['resource_id'] = resource_id + parameters['description'] = description + return client.create_or_update(resource_group_name=resource_group_name, + network_manager_name=network_manager_name, + scope_connection_name=scope_connection_name, + parameters=parameters) + + +def network_manager_scope_connection_update(instance, + description=None): + if description is not None: + instance.description = description + return instance + + +def network_manager_scope_connection_show(client, + resource_group_name, + network_manager_name, + scope_connection_name): + return client.get(resource_group_name=resource_group_name, + network_manager_name=network_manager_name, + scope_connection_name=scope_connection_name) + + +def network_manager_scope_connection_delete(client, + resource_group_name, + network_manager_name, + scope_connection_name): + return client.delete(resource_group_name=resource_group_name, + network_manager_name=network_manager_name, + scope_connection_name=scope_connection_name) + + +def network_manager_group_static_member_list(client, + resource_group_name, + network_manager_name, + network_group_name, + top=None, + skip_token=None): + return client.list(resource_group_name=resource_group_name, + network_manager_name=network_manager_name, + network_group_name=network_group_name, + top=top, + skip_token=skip_token) + + +def network_manager_group_static_member_create(client, + resource_group_name, + network_manager_name, + network_group_name, + static_member_name, + resource_id): + parameters = {} + parameters['resource_id'] = resource_id + return client.create_or_update(resource_group_name=resource_group_name, + network_manager_name=network_manager_name, + network_group_name=network_group_name, + static_member_name=static_member_name, + parameters=parameters) + + +def network_manager_group_static_member_update(instance, resource_id): + if resource_id is not None: + instance.resource_id = resource_id + return instance + + +def network_manager_group_static_member_show(client, + resource_group_name, + network_manager_name, + network_group_name, + static_member_name): + return client.get(resource_group_name=resource_group_name, + network_manager_name=network_manager_name, + network_group_name=network_group_name, + static_member_name=static_member_name) + + +def network_manager_group_static_member_delete(client, + resource_group_name, + network_manager_name, + network_group_name, + static_member_name): + return client.delete(resource_group_name=resource_group_name, + network_manager_name=network_manager_name, + network_group_name=network_group_name, + static_member_name=static_member_name) diff --git a/src/network-manager/azext_network_manager/tests/latest/recordings/test_network_manager_admin_rule_collection_crud.yaml b/src/network-manager/azext_network_manager/tests/latest/recordings/test_network_manager_admin_rule_collection_crud.yaml index be0f352a118..d828a56016b 100644 --- a/src/network-manager/azext_network_manager/tests/latest/recordings/test_network_manager_admin_rule_collection_crud.yaml +++ b/src/network-manager/azext_network_manager/tests/latest/recordings/test_network_manager_admin_rule_collection_crud.yaml @@ -21,22 +21,22 @@ interactions: - --name --description --display-name --scope-accesses --network-manager-scopes -l --resource-group User-Agent: - - AZURECLI/2.30.0 azsdk-python-mgmt-network/1.0.0b1 Python/3.8.3 (Windows-10-10.0.18362-SP0) + - AZURECLI/2.31.0 azsdk-python-mgmt-network/1.0.0b1 Python/3.9.5 (Windows-10-10.0.17763-SP0) method: PUT - uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/test_network_manager_admin_rule_collection_crud000001/providers/Microsoft.Network/networkManagers/TestNetworkManager?api-version=2021-02-01-preview + uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/test_network_manager_admin_rule_collection_crud000001/providers/Microsoft.Network/networkManagers/TestNetworkManager?api-version=2021-05-01-preview response: body: string: '{"name":"TestNetworkManager","id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/test_network_manager_admin_rule_collection_crud000001/providers/Microsoft.Network/networkManagers/TestNetworkManager","location":"eastus2euap","type":"Microsoft.Network/networkManagers","tags":{},"etag":"","properties":{"displayName":"TestNetworkManager","description":"My - Test Network Manager","networkManagerScopes":{"managementGroups":[],"subscriptions":["/subscriptions/00000000-0000-0000-0000-000000000000"]},"provisioningState":"Succeeded","networkManagerScopeAccesses":["SecurityAdmin","Connectivity"],"resourceGuid":"5cc9a1f9-95fa-4598-82f3-b6b114177ba5"},"systemData":{"createdBy":"v-kaisun@microsoft.com","createdByType":"User","createdAt":"2021-11-02T09:30:57.6588252Z","lastModifiedBy":"v-kaisun@microsoft.com","lastModifiedByType":"User","lastModifiedAt":"2021-11-02T09:30:57.6588252Z"}}' + Test Network Manager","networkManagerScopes":{"managementGroups":[],"subscriptions":["/subscriptions/00000000-0000-0000-0000-000000000000"],"multiTenantScopes":[]},"provisioningState":"Succeeded","networkManagerScopeAccesses":["SecurityAdmin","Connectivity"],"resourceGuid":"9362aa58-c71e-4664-87ef-7275f6e6abd9"},"systemData":{"createdBy":"v-taoxuzeng@microsoft.com","createdByType":"User","createdAt":"2022-03-07T09:45:50.8404298Z","lastModifiedBy":"v-taoxuzeng@microsoft.com","lastModifiedByType":"User","lastModifiedAt":"2022-03-07T09:45:50.8404298Z"}}' headers: cache-control: - no-cache content-length: - - '924' + - '931' content-type: - application/json; charset=utf-8 date: - - Tue, 02 Nov 2021 09:31:05 GMT + - Mon, 07 Mar 2022 09:45:55 GMT expires: - '-1' pragma: @@ -52,15 +52,13 @@ interactions: x-content-type-options: - nosniff x-ms-ratelimit-remaining-subscription-writes: - - '1199' + - '1197' status: code: 200 message: OK - request: body: '{"properties": {"displayName": "ASampleGroup", "description": "A sample - policy", "memberType": "Microsoft.Network/virtualNetworks", "groupMembers": - [{"resourceId": "/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/test_network_manager_admin_rule_collection_crud000001/providers/Microsoft.Network/virtualnetworks/clitest.vn000002"}], - "conditionalMembership": ""}}' + policy", "memberType": "Microsoft.Network/virtualNetworks"}}' headers: Accept: - application/json @@ -71,29 +69,80 @@ interactions: Connection: - keep-alive Content-Length: - - '410' + - '132' Content-Type: - application/json ParameterSetName: - - --name --network-manager-name --description --conditional-membership --display-name - --member-type -g --group-members + - --name --network-manager-name --description --display-name --member-type -g User-Agent: - - AZURECLI/2.30.0 azsdk-python-mgmt-network/1.0.0b1 Python/3.8.3 (Windows-10-10.0.18362-SP0) + - AZURECLI/2.31.0 azsdk-python-mgmt-network/1.0.0b1 Python/3.9.5 (Windows-10-10.0.17763-SP0) method: PUT - uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/test_network_manager_admin_rule_collection_crud000001/providers/Microsoft.Network/networkManagers/TestNetworkManager/networkGroups/TestNetworkGroup?api-version=2021-02-01-preview + uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/test_network_manager_admin_rule_collection_crud000001/providers/Microsoft.Network/networkManagers/TestNetworkManager/networkGroups/TestNetworkGroup?api-version=2021-05-01-preview response: body: string: '{"name":"TestNetworkGroup","id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/test_network_manager_admin_rule_collection_crud000001/providers/Microsoft.Network/networkManagers/TestNetworkManager/networkGroups/TestNetworkGroup","type":"Microsoft.Network/networkManagers/networkGroups","etag":"","properties":{"displayName":"ASampleGroup","description":"A - sample policy","groupMembers":[{"resourceId":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/test_network_manager_admin_rule_collection_crud000001/providers/Microsoft.Network/virtualnetworks/clitest.vn000002"}],"conditionalMembership":"","provisioningState":"Succeeded","resourceGuid":"e7e71bda-6417-4694-a8ea-8ca9b89cf054"},"systemData":{"createdBy":"v-kaisun@microsoft.com","createdByType":"User","createdAt":"2021-11-02T09:31:06.8137691Z","lastModifiedBy":"v-kaisun@microsoft.com","lastModifiedByType":"User","lastModifiedAt":"2021-11-02T09:31:06.8137691Z"}}' + sample policy","groupMembers":[],"conditionalMembership":"","provisioningState":"Succeeded","resourceGuid":"352993d0-2c3b-40b1-8fd2-8a7f9966e2dd"},"systemData":{"createdBy":"v-taoxuzeng@microsoft.com","createdByType":"User","createdAt":"2022-03-07T09:45:57.4332835Z","lastModifiedBy":"v-taoxuzeng@microsoft.com","lastModifiedByType":"User","lastModifiedAt":"2022-03-07T09:45:57.4332835Z"}}' headers: cache-control: - no-cache content-length: - - '1009' + - '765' content-type: - application/json; charset=utf-8 date: - - Tue, 02 Nov 2021 09:31:08 GMT + - Mon, 07 Mar 2022 09:45:57 GMT + expires: + - '-1' + pragma: + - no-cache + server: + - Kestrel + strict-transport-security: + - max-age=31536000; includeSubDomains + transfer-encoding: + - chunked + vary: + - Accept-Encoding + x-content-type-options: + - nosniff + x-ms-ratelimit-remaining-subscription-writes: + - '1198' + status: + code: 200 + message: OK +- request: + body: '{"properties": {"resourceId": "/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/test_network_manager_admin_rule_collection_crud000001/providers/Microsoft.Network/virtualnetworks/clitest.vn000002"}}' + headers: + Accept: + - application/json + Accept-Encoding: + - gzip, deflate + CommandName: + - network manager group static-member create + Connection: + - keep-alive + Content-Length: + - '215' + Content-Type: + - application/json + ParameterSetName: + - --name --network-group-name --network-manager-name --resource-id -g + User-Agent: + - AZURECLI/2.31.0 azsdk-python-mgmt-network/1.0.0b1 Python/3.9.5 (Windows-10-10.0.17763-SP0) + method: PUT + uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/test_network_manager_admin_rule_collection_crud000001/providers/Microsoft.Network/networkManagers/TestNetworkManager/networkGroups/TestNetworkGroup/staticMembers/TestStaticMember?api-version=2021-05-01-preview + response: + body: + string: '{"name":"TestStaticMember","id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/test_network_manager_admin_rule_collection_crud000001/providers/Microsoft.Network/networkManagers/TestNetworkManager/networkGroups/TestNetworkGroup/staticMembers/TestStaticMember","type":"Microsoft.Network/networkManagers/networkGroups/staticMembers","etag":"","properties":{"resourceId":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/test_network_manager_admin_rule_collection_crud000001/providers/Microsoft.Network/virtualnetworks/clitest.vn000002"},"systemData":{"createdBy":"v-taoxuzeng@microsoft.com","createdByType":"User","createdAt":"2022-03-07T09:45:59.3065046Z","lastModifiedBy":"v-taoxuzeng@microsoft.com","lastModifiedByType":"User","lastModifiedAt":"2022-03-07T09:45:59.3065046Z"}}' + headers: + cache-control: + - no-cache + content-length: + - '815' + content-type: + - application/json; charset=utf-8 + date: + - Mon, 07 Mar 2022 09:46:00 GMT expires: - '-1' pragma: @@ -115,7 +164,7 @@ interactions: message: OK - request: body: '{"properties": {"displayName": "MyTestConfig", "description": "A sample - policy", "securityType": "AdminPolicy", "deleteExistingNSGs": "True"}}' + policy", "deleteExistingNSGs": "True"}}' headers: Accept: - application/json @@ -126,29 +175,29 @@ interactions: Connection: - keep-alive Content-Length: - - '142' + - '111' Content-Type: - application/json ParameterSetName: - --configuration-name --network-manager-name -g --description --delete-existing-ns-gs - --security-type --display-name + --display-name User-Agent: - - AZURECLI/2.30.0 azsdk-python-mgmt-network/1.0.0b1 Python/3.8.3 (Windows-10-10.0.18362-SP0) + - AZURECLI/2.31.0 azsdk-python-mgmt-network/1.0.0b1 Python/3.9.5 (Windows-10-10.0.17763-SP0) method: PUT - uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/test_network_manager_admin_rule_collection_crud000001/providers/Microsoft.Network/networkManagers/TestNetworkManager/securityAdminConfigurations/myTestSecurityConfig?api-version=2021-02-01-preview + uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/test_network_manager_admin_rule_collection_crud000001/providers/Microsoft.Network/networkManagers/TestNetworkManager/securityAdminConfigurations/myTestSecurityConfig?api-version=2021-05-01-preview response: body: string: '{"name":"myTestSecurityConfig","id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/test_network_manager_admin_rule_collection_crud000001/providers/Microsoft.Network/networkManagers/TestNetworkManager/securityAdminConfigurations/myTestSecurityConfig","type":"Microsoft.Network/networkManagers/securityAdminConfigurations","etag":"","properties":{"displayName":"MyTestConfig","description":"A - sample policy","provisioningState":"Succeeded","resourceGuid":"06ccbba6-e1d0-4c4e-ad90-77a7f65f50e2"},"systemData":{"createdBy":"v-kaisun@microsoft.com","createdByType":"User","createdAt":"2021-11-02T09:31:09.9493744Z","lastModifiedBy":"v-kaisun@microsoft.com","lastModifiedByType":"User","lastModifiedAt":"2021-11-02T09:31:09.9493744Z"}}' + sample policy","provisioningState":"Succeeded","resourceGuid":"78fa239e-a688-4fee-959e-ef2787ca1cfa","applyOnNetworkIntentPolicyBasedServices":[]},"systemData":{"createdBy":"v-taoxuzeng@microsoft.com","createdByType":"User","createdAt":"2022-03-07T09:46:01.5202463Z","lastModifiedBy":"v-taoxuzeng@microsoft.com","lastModifiedByType":"User","lastModifiedAt":"2022-03-07T09:46:01.5202463Z"}}' headers: cache-control: - no-cache content-length: - - '772' + - '801' content-type: - application/json; charset=utf-8 date: - - Tue, 02 Nov 2021 09:31:11 GMT + - Mon, 07 Mar 2022 09:46:02 GMT expires: - '-1' pragma: @@ -164,7 +213,7 @@ interactions: x-content-type-options: - nosniff x-ms-ratelimit-remaining-subscription-writes: - - '1199' + - '1195' status: code: 200 message: OK @@ -181,29 +230,29 @@ interactions: Connection: - keep-alive Content-Length: - - '367' + - '345' Content-Type: - application/json ParameterSetName: - --configuration-name --network-manager-name -g --rule-collection-name --description --display-name --applies-to-groups User-Agent: - - AZURECLI/2.30.0 azsdk-python-mgmt-network/1.0.0b1 Python/3.8.3 (Windows-10-10.0.18362-SP0) + - AZURECLI/2.31.0 azsdk-python-mgmt-network/1.0.0b1 Python/3.9.5 (Windows-10-10.0.17763-SP0) method: PUT - uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/test_network_manager_admin_rule_collection_crud000001/providers/Microsoft.Network/networkManagers/TestNetworkManager/securityAdminConfigurations/myTestSecurityConfig/ruleCollections/myTestCollection?api-version=2021-02-01-preview + uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/test_network_manager_admin_rule_collection_crud000001/providers/Microsoft.Network/networkManagers/TestNetworkManager/securityAdminConfigurations/myTestSecurityConfig/ruleCollections/myTestCollection?api-version=2021-05-01-preview response: body: string: '{"name":"myTestCollection","id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/test_network_manager_admin_rule_collection_crud000001/providers/Microsoft.Network/networkManagers/TestNetworkManager/securityAdminConfigurations/myTestSecurityConfig/ruleCollections/myTestCollection","type":"Microsoft.Network/networkManagers/securityAdminConfigurations/ruleCollections","etag":"","properties":{"displayName":"ASampleCollection","description":"A - sample policy","appliesToGroups":[{"networkGroupId":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/test_network_manager_admin_rule_collection_crud000001/providers/Microsoft.Network/networkManagers/TestNetworkManager/networkGroups/TestNetworkGroup"}],"provisioningState":"Succeeded","resourceGuid":"4c497579-81d0-48bd-ba01-82cef3b4e91c"},"systemData":{"createdBy":"v-kaisun@microsoft.com","createdByType":"User","createdAt":"2021-11-02T09:31:12.8746342Z","lastModifiedBy":"v-kaisun@microsoft.com","lastModifiedByType":"User","lastModifiedAt":"2021-11-02T09:31:12.8746342Z"}}' + sample policy","appliesToGroups":[{"networkGroupId":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/test_network_manager_admin_rule_collection_crud000001/providers/Microsoft.Network/networkManagers/TestNetworkManager/networkGroups/TestNetworkGroup"}],"provisioningState":"Succeeded","resourceGuid":"241ea4f3-def7-4e22-a910-0bc4d93449a4"},"systemData":{"createdBy":"v-taoxuzeng@microsoft.com","createdByType":"User","createdAt":"2022-03-07T09:46:03.3642498Z","lastModifiedBy":"v-taoxuzeng@microsoft.com","lastModifiedByType":"User","lastModifiedAt":"2022-03-07T09:46:03.3642498Z"}}' headers: cache-control: - no-cache content-length: - - '1100' + - '1062' content-type: - application/json; charset=utf-8 date: - - Tue, 02 Nov 2021 09:31:14 GMT + - Mon, 07 Mar 2022 09:46:03 GMT expires: - '-1' pragma: @@ -219,7 +268,7 @@ interactions: x-content-type-options: - nosniff x-ms-ratelimit-remaining-subscription-writes: - - '1199' + - '1197' status: code: 200 message: OK @@ -237,22 +286,22 @@ interactions: ParameterSetName: - -g --configuration-name --network-manager-name --rule-collection-name User-Agent: - - AZURECLI/2.30.0 azsdk-python-mgmt-network/1.0.0b1 Python/3.8.3 (Windows-10-10.0.18362-SP0) + - AZURECLI/2.31.0 azsdk-python-mgmt-network/1.0.0b1 Python/3.9.5 (Windows-10-10.0.17763-SP0) method: GET - uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/test_network_manager_admin_rule_collection_crud000001/providers/Microsoft.Network/networkManagers/TestNetworkManager/securityAdminConfigurations/myTestSecurityConfig/ruleCollections/myTestCollection?api-version=2021-02-01-preview + uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/test_network_manager_admin_rule_collection_crud000001/providers/Microsoft.Network/networkManagers/TestNetworkManager/securityAdminConfigurations/myTestSecurityConfig/ruleCollections/myTestCollection?api-version=2021-05-01-preview response: body: - string: '{"name":"myTestCollection","id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/test_network_manager_admin_rule_collection_crud000001/providers/Microsoft.Network/networkManagers/TestNetworkManager/securityAdminConfigurations/myTestSecurityConfig/ruleCollections/myTestCollection","type":"Microsoft.Network/networkManagers/securityAdminConfigurations/ruleCollections","etag":"\"2100dbb0-0000-3400-0000-618105620000\"","properties":{"displayName":"ASampleCollection","description":"A - sample policy","appliesToGroups":[{"networkGroupId":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/test_network_manager_admin_rule_collection_crud000001/providers/Microsoft.Network/networkManagers/TestNetworkManager/networkGroups/TestNetworkGroup"}],"provisioningState":"Succeeded","resourceGuid":"4c497579-81d0-48bd-ba01-82cef3b4e91c"},"systemData":{"createdBy":"v-kaisun@microsoft.com","createdByType":"User","createdAt":"2021-11-02T09:31:12.8746342Z","lastModifiedBy":"v-kaisun@microsoft.com","lastModifiedByType":"User","lastModifiedAt":"2021-11-02T09:31:12.8746342Z"}}' + string: '{"name":"myTestCollection","id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/test_network_manager_admin_rule_collection_crud000001/providers/Microsoft.Network/networkManagers/TestNetworkManager/securityAdminConfigurations/myTestSecurityConfig/ruleCollections/myTestCollection","type":"Microsoft.Network/networkManagers/securityAdminConfigurations/ruleCollections","etag":"\"0000d77a-0000-3400-0000-6225d45c0000\"","properties":{"displayName":"ASampleCollection","description":"A + sample policy","appliesToGroups":[{"networkGroupId":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/test_network_manager_admin_rule_collection_crud000001/providers/Microsoft.Network/networkManagers/TestNetworkManager/networkGroups/TestNetworkGroup"}],"provisioningState":"Succeeded","resourceGuid":"241ea4f3-def7-4e22-a910-0bc4d93449a4"},"systemData":{"createdBy":"v-taoxuzeng@microsoft.com","createdByType":"User","createdAt":"2022-03-07T09:46:03.3642498Z","lastModifiedBy":"v-taoxuzeng@microsoft.com","lastModifiedByType":"User","lastModifiedAt":"2022-03-07T09:46:03.3642498Z"}}' headers: cache-control: - no-cache content-length: - - '1140' + - '1102' content-type: - application/json; charset=utf-8 date: - - Tue, 02 Nov 2021 09:31:16 GMT + - Mon, 07 Mar 2022 09:46:06 GMT expires: - '-1' pragma: @@ -284,22 +333,22 @@ interactions: ParameterSetName: - -g --configuration-name --network-manager-name --rule-collection-name --display-name User-Agent: - - AZURECLI/2.30.0 azsdk-python-mgmt-network/1.0.0b1 Python/3.8.3 (Windows-10-10.0.18362-SP0) + - AZURECLI/2.31.0 azsdk-python-mgmt-network/1.0.0b1 Python/3.9.5 (Windows-10-10.0.17763-SP0) method: GET - uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/test_network_manager_admin_rule_collection_crud000001/providers/Microsoft.Network/networkManagers/TestNetworkManager/securityAdminConfigurations/myTestSecurityConfig/ruleCollections/myTestCollection?api-version=2021-02-01-preview + uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/test_network_manager_admin_rule_collection_crud000001/providers/Microsoft.Network/networkManagers/TestNetworkManager/securityAdminConfigurations/myTestSecurityConfig/ruleCollections/myTestCollection?api-version=2021-05-01-preview response: body: - string: '{"name":"myTestCollection","id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/test_network_manager_admin_rule_collection_crud000001/providers/Microsoft.Network/networkManagers/TestNetworkManager/securityAdminConfigurations/myTestSecurityConfig/ruleCollections/myTestCollection","type":"Microsoft.Network/networkManagers/securityAdminConfigurations/ruleCollections","etag":"\"2100dbb0-0000-3400-0000-618105620000\"","properties":{"displayName":"ASampleCollection","description":"A - sample policy","appliesToGroups":[{"networkGroupId":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/test_network_manager_admin_rule_collection_crud000001/providers/Microsoft.Network/networkManagers/TestNetworkManager/networkGroups/TestNetworkGroup"}],"provisioningState":"Succeeded","resourceGuid":"4c497579-81d0-48bd-ba01-82cef3b4e91c"},"systemData":{"createdBy":"v-kaisun@microsoft.com","createdByType":"User","createdAt":"2021-11-02T09:31:12.8746342Z","lastModifiedBy":"v-kaisun@microsoft.com","lastModifiedByType":"User","lastModifiedAt":"2021-11-02T09:31:12.8746342Z"}}' + string: '{"name":"myTestCollection","id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/test_network_manager_admin_rule_collection_crud000001/providers/Microsoft.Network/networkManagers/TestNetworkManager/securityAdminConfigurations/myTestSecurityConfig/ruleCollections/myTestCollection","type":"Microsoft.Network/networkManagers/securityAdminConfigurations/ruleCollections","etag":"\"0000d77a-0000-3400-0000-6225d45c0000\"","properties":{"displayName":"ASampleCollection","description":"A + sample policy","appliesToGroups":[{"networkGroupId":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/test_network_manager_admin_rule_collection_crud000001/providers/Microsoft.Network/networkManagers/TestNetworkManager/networkGroups/TestNetworkGroup"}],"provisioningState":"Succeeded","resourceGuid":"241ea4f3-def7-4e22-a910-0bc4d93449a4"},"systemData":{"createdBy":"v-taoxuzeng@microsoft.com","createdByType":"User","createdAt":"2022-03-07T09:46:03.3642498Z","lastModifiedBy":"v-taoxuzeng@microsoft.com","lastModifiedByType":"User","lastModifiedAt":"2022-03-07T09:46:03.3642498Z"}}' headers: cache-control: - no-cache content-length: - - '1140' + - '1102' content-type: - application/json; charset=utf-8 date: - - Tue, 02 Nov 2021 09:31:19 GMT + - Mon, 07 Mar 2022 09:46:07 GMT expires: - '-1' pragma: @@ -330,28 +379,28 @@ interactions: Connection: - keep-alive Content-Length: - - '368' + - '346' Content-Type: - application/json ParameterSetName: - -g --configuration-name --network-manager-name --rule-collection-name --display-name User-Agent: - - AZURECLI/2.30.0 azsdk-python-mgmt-network/1.0.0b1 Python/3.8.3 (Windows-10-10.0.18362-SP0) + - AZURECLI/2.31.0 azsdk-python-mgmt-network/1.0.0b1 Python/3.9.5 (Windows-10-10.0.17763-SP0) method: PUT - uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/test_network_manager_admin_rule_collection_crud000001/providers/Microsoft.Network/networkManagers/TestNetworkManager/securityAdminConfigurations/myTestSecurityConfig/ruleCollections/myTestCollection?api-version=2021-02-01-preview + uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/test_network_manager_admin_rule_collection_crud000001/providers/Microsoft.Network/networkManagers/TestNetworkManager/securityAdminConfigurations/myTestSecurityConfig/ruleCollections/myTestCollection?api-version=2021-05-01-preview response: body: string: '{"name":"myTestCollection","id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/test_network_manager_admin_rule_collection_crud000001/providers/Microsoft.Network/networkManagers/TestNetworkManager/securityAdminConfigurations/myTestSecurityConfig/ruleCollections/myTestCollection","type":"Microsoft.Network/networkManagers/securityAdminConfigurations/ruleCollections","etag":"","properties":{"displayName":"ASampleCollection2","description":"A - sample policy","appliesToGroups":[{"networkGroupId":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/test_network_manager_admin_rule_collection_crud000001/providers/Microsoft.Network/networkManagers/TestNetworkManager/networkGroups/TestNetworkGroup"}],"provisioningState":"Succeeded","resourceGuid":"4c497579-81d0-48bd-ba01-82cef3b4e91c"},"systemData":{"createdBy":"v-kaisun@microsoft.com","createdByType":"User","createdAt":"2021-11-02T09:31:12.8746342Z","lastModifiedBy":"v-kaisun@microsoft.com","lastModifiedByType":"User","lastModifiedAt":"2021-11-02T09:31:22.1427868Z"}}' + sample policy","appliesToGroups":[{"networkGroupId":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/test_network_manager_admin_rule_collection_crud000001/providers/Microsoft.Network/networkManagers/TestNetworkManager/networkGroups/TestNetworkGroup"}],"provisioningState":"Succeeded","resourceGuid":"241ea4f3-def7-4e22-a910-0bc4d93449a4"},"systemData":{"createdBy":"v-taoxuzeng@microsoft.com","createdByType":"User","createdAt":"2022-03-07T09:46:03.3642498Z","lastModifiedBy":"v-taoxuzeng@microsoft.com","lastModifiedByType":"User","lastModifiedAt":"2022-03-07T09:46:08.6642311Z"}}' headers: cache-control: - no-cache content-length: - - '1101' + - '1063' content-type: - application/json; charset=utf-8 date: - - Tue, 02 Nov 2021 09:31:22 GMT + - Mon, 07 Mar 2022 09:46:08 GMT expires: - '-1' pragma: @@ -367,7 +416,7 @@ interactions: x-content-type-options: - nosniff x-ms-ratelimit-remaining-subscription-writes: - - '1196' + - '1194' status: code: 200 message: OK @@ -385,22 +434,22 @@ interactions: ParameterSetName: - -g --configuration-name --network-manager-name User-Agent: - - AZURECLI/2.30.0 azsdk-python-mgmt-network/1.0.0b1 Python/3.8.3 (Windows-10-10.0.18362-SP0) + - AZURECLI/2.31.0 azsdk-python-mgmt-network/1.0.0b1 Python/3.9.5 (Windows-10-10.0.17763-SP0) method: GET - uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/test_network_manager_admin_rule_collection_crud000001/providers/Microsoft.Network/networkManagers/TestNetworkManager/securityAdminConfigurations/myTestSecurityConfig/ruleCollections?api-version=2021-02-01-preview + uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/test_network_manager_admin_rule_collection_crud000001/providers/Microsoft.Network/networkManagers/TestNetworkManager/securityAdminConfigurations/myTestSecurityConfig/ruleCollections?api-version=2021-05-01-preview response: body: - string: '{"nextLink":"","value":[{"name":"myTestCollection","id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/test_network_manager_admin_rule_collection_crud000001/providers/Microsoft.Network/networkManagers/TestNetworkManager/securityAdminConfigurations/myTestSecurityConfig/ruleCollections/myTestCollection","type":"Microsoft.Network/networkManagers/securityAdminConfigurations/ruleCollections","etag":"\"2100dfb0-0000-3400-0000-6181056b0000\"","properties":{"displayName":"ASampleCollection2","description":"A - sample policy","appliesToGroups":[{"networkGroupId":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/test_network_manager_admin_rule_collection_crud000001/providers/Microsoft.Network/networkManagers/TestNetworkManager/networkGroups/TestNetworkGroup"}],"provisioningState":"Succeeded","resourceGuid":"4c497579-81d0-48bd-ba01-82cef3b4e91c"},"systemData":{"createdBy":"v-kaisun@microsoft.com","createdByType":"User","createdAt":"2021-11-02T09:31:12.8746342Z","lastModifiedBy":"v-kaisun@microsoft.com","lastModifiedByType":"User","lastModifiedAt":"2021-11-02T09:31:22.1427868Z"}}]}' + string: '{"nextLink":"","value":[{"name":"myTestCollection","id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/test_network_manager_admin_rule_collection_crud000001/providers/Microsoft.Network/networkManagers/TestNetworkManager/securityAdminConfigurations/myTestSecurityConfig/ruleCollections/myTestCollection","type":"Microsoft.Network/networkManagers/securityAdminConfigurations/ruleCollections","etag":"\"0000d87a-0000-3400-0000-6225d4610000\"","properties":{"displayName":"ASampleCollection2","description":"A + sample policy","appliesToGroups":[{"networkGroupId":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/test_network_manager_admin_rule_collection_crud000001/providers/Microsoft.Network/networkManagers/TestNetworkManager/networkGroups/TestNetworkGroup"}],"provisioningState":"Succeeded","resourceGuid":"241ea4f3-def7-4e22-a910-0bc4d93449a4"},"systemData":{"createdBy":"v-taoxuzeng@microsoft.com","createdByType":"User","createdAt":"2022-03-07T09:46:03.3642498Z","lastModifiedBy":"v-taoxuzeng@microsoft.com","lastModifiedByType":"User","lastModifiedAt":"2022-03-07T09:46:08.6642311Z"}}]}' headers: cache-control: - no-cache content-length: - - '1167' + - '1129' content-type: - application/json; charset=utf-8 date: - - Tue, 02 Nov 2021 09:31:26 GMT + - Mon, 07 Mar 2022 09:46:10 GMT expires: - '-1' pragma: @@ -434,9 +483,9 @@ interactions: ParameterSetName: - -g --configuration-name --network-manager-name --rule-collection-name --yes User-Agent: - - AZURECLI/2.30.0 azsdk-python-mgmt-network/1.0.0b1 Python/3.8.3 (Windows-10-10.0.18362-SP0) + - AZURECLI/2.31.0 azsdk-python-mgmt-network/1.0.0b1 Python/3.9.5 (Windows-10-10.0.17763-SP0) method: DELETE - uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/test_network_manager_admin_rule_collection_crud000001/providers/Microsoft.Network/networkManagers/TestNetworkManager/securityAdminConfigurations/myTestSecurityConfig/ruleCollections/myTestCollection?api-version=2021-02-01-preview + uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/test_network_manager_admin_rule_collection_crud000001/providers/Microsoft.Network/networkManagers/TestNetworkManager/securityAdminConfigurations/myTestSecurityConfig/ruleCollections/myTestCollection?api-version=2021-05-01-preview response: body: string: '' @@ -446,7 +495,7 @@ interactions: content-length: - '0' date: - - Tue, 02 Nov 2021 09:31:31 GMT + - Mon, 07 Mar 2022 09:46:13 GMT expires: - '-1' pragma: @@ -458,7 +507,7 @@ interactions: x-content-type-options: - nosniff x-ms-ratelimit-remaining-subscription-deletes: - - '14998' + - '14996' status: code: 200 message: OK @@ -476,11 +525,11 @@ interactions: Content-Length: - '0' ParameterSetName: - - --configuration-name --network-manager-name -g --yes + - --configuration-name --network-manager-name -g --force --yes User-Agent: - - AZURECLI/2.30.0 azsdk-python-mgmt-network/1.0.0b1 Python/3.8.3 (Windows-10-10.0.18362-SP0) + - AZURECLI/2.31.0 azsdk-python-mgmt-network/1.0.0b1 Python/3.9.5 (Windows-10-10.0.17763-SP0) method: DELETE - uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/test_network_manager_admin_rule_collection_crud000001/providers/Microsoft.Network/networkManagers/TestNetworkManager/securityAdminConfigurations/myTestSecurityConfig?api-version=2021-02-01-preview + uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/test_network_manager_admin_rule_collection_crud000001/providers/Microsoft.Network/networkManagers/TestNetworkManager/securityAdminConfigurations/myTestSecurityConfig?api-version=2021-05-01-preview&force=true response: body: string: '' @@ -490,7 +539,7 @@ interactions: content-length: - '0' date: - - Tue, 02 Nov 2021 09:31:33 GMT + - Mon, 07 Mar 2022 09:46:14 GMT expires: - '-1' pragma: @@ -502,7 +551,7 @@ interactions: x-content-type-options: - nosniff x-ms-ratelimit-remaining-subscription-deletes: - - '14997' + - '14998' status: code: 200 message: OK @@ -520,11 +569,55 @@ interactions: Content-Length: - '0' ParameterSetName: - - -g --name --network-manager-name --yes + - -g --name --network-manager-name --force --yes + User-Agent: + - AZURECLI/2.31.0 azsdk-python-mgmt-network/1.0.0b1 Python/3.9.5 (Windows-10-10.0.17763-SP0) + method: DELETE + uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/test_network_manager_admin_rule_collection_crud000001/providers/Microsoft.Network/networkManagers/TestNetworkManager/networkGroups/TestNetworkGroup?api-version=2021-05-01-preview&force=true + response: + body: + string: '' + headers: + cache-control: + - no-cache + content-length: + - '0' + date: + - Mon, 07 Mar 2022 09:46:16 GMT + expires: + - '-1' + pragma: + - no-cache + server: + - Kestrel + strict-transport-security: + - max-age=31536000; includeSubDomains + x-content-type-options: + - nosniff + x-ms-ratelimit-remaining-subscription-deletes: + - '14998' + status: + code: 200 + message: OK +- request: + body: null + headers: + Accept: + - application/json + Accept-Encoding: + - gzip, deflate + CommandName: + - network manager delete + Connection: + - keep-alive + Content-Length: + - '0' + ParameterSetName: + - --resource-group --name --yes User-Agent: - - AZURECLI/2.30.0 azsdk-python-mgmt-network/1.0.0b1 Python/3.8.3 (Windows-10-10.0.18362-SP0) + - AZURECLI/2.31.0 azsdk-python-mgmt-network/1.0.0b1 Python/3.9.5 (Windows-10-10.0.17763-SP0) method: DELETE - uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/test_network_manager_admin_rule_collection_crud000001/providers/Microsoft.Network/networkManagers/TestNetworkManager/networkGroups/TestNetworkGroup?api-version=2021-02-01-preview + uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/test_network_manager_admin_rule_collection_crud000001/providers/Microsoft.Network/networkManagers/TestNetworkManager?api-version=2021-05-01-preview response: body: string: '' @@ -534,7 +627,7 @@ interactions: content-length: - '0' date: - - Tue, 02 Nov 2021 09:31:36 GMT + - Mon, 07 Mar 2022 09:46:22 GMT expires: - '-1' pragma: diff --git a/src/network-manager/azext_network_manager/tests/latest/recordings/test_network_manager_admin_rule_crud.yaml b/src/network-manager/azext_network_manager/tests/latest/recordings/test_network_manager_admin_rule_crud.yaml index ed91bee183f..8e25422133c 100644 --- a/src/network-manager/azext_network_manager/tests/latest/recordings/test_network_manager_admin_rule_crud.yaml +++ b/src/network-manager/azext_network_manager/tests/latest/recordings/test_network_manager_admin_rule_crud.yaml @@ -21,22 +21,22 @@ interactions: - --name --description --display-name --scope-accesses --network-manager-scopes -l --resource-group User-Agent: - - AZURECLI/2.30.0 azsdk-python-mgmt-network/1.0.0b1 Python/3.8.3 (Windows-10-10.0.18362-SP0) + - AZURECLI/2.31.0 azsdk-python-mgmt-network/1.0.0b1 Python/3.9.5 (Windows-10-10.0.17763-SP0) method: PUT - uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/test_network_manager_admin_rule_crud000001/providers/Microsoft.Network/networkManagers/TestNetworkManager?api-version=2021-02-01-preview + uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/test_network_manager_admin_rule_crud000001/providers/Microsoft.Network/networkManagers/TestNetworkManager?api-version=2021-05-01-preview response: body: string: '{"name":"TestNetworkManager","id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/test_network_manager_admin_rule_crud000001/providers/Microsoft.Network/networkManagers/TestNetworkManager","location":"eastus2euap","type":"Microsoft.Network/networkManagers","tags":{},"etag":"","properties":{"displayName":"TestNetworkManager","description":"My - Test Network Manager","networkManagerScopes":{"managementGroups":[],"subscriptions":["/subscriptions/00000000-0000-0000-0000-000000000000"]},"provisioningState":"Succeeded","networkManagerScopeAccesses":["SecurityAdmin","Connectivity"],"resourceGuid":"3303ac9d-7813-4c90-b707-0aff2de44477"},"systemData":{"createdBy":"v-kaisun@microsoft.com","createdByType":"User","createdAt":"2021-11-02T09:34:44.0297289Z","lastModifiedBy":"v-kaisun@microsoft.com","lastModifiedByType":"User","lastModifiedAt":"2021-11-02T09:34:44.0297289Z"}}' + Test Network Manager","networkManagerScopes":{"managementGroups":[],"subscriptions":["/subscriptions/00000000-0000-0000-0000-000000000000"],"multiTenantScopes":[]},"provisioningState":"Succeeded","networkManagerScopeAccesses":["SecurityAdmin","Connectivity"],"resourceGuid":"6ad2e227-9c0e-4cbb-8d1d-db222590a713"},"systemData":{"createdBy":"v-taoxuzeng@microsoft.com","createdByType":"User","createdAt":"2022-03-07T09:42:49.2067703Z","lastModifiedBy":"v-taoxuzeng@microsoft.com","lastModifiedByType":"User","lastModifiedAt":"2022-03-07T09:42:49.2067703Z"}}' headers: cache-control: - no-cache content-length: - - '924' + - '920' content-type: - application/json; charset=utf-8 date: - - Tue, 02 Nov 2021 09:34:51 GMT + - Mon, 07 Mar 2022 09:42:55 GMT expires: - '-1' pragma: @@ -52,15 +52,13 @@ interactions: x-content-type-options: - nosniff x-ms-ratelimit-remaining-subscription-writes: - - '1198' + - '1199' status: code: 200 message: OK - request: body: '{"properties": {"displayName": "ASampleGroup", "description": "A sample - policy", "memberType": "Microsoft.Network/virtualNetworks", "groupMembers": - [{"resourceId": "/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/test_network_manager_admin_rule_crud000001/providers/Microsoft.Network/virtualnetworks/clitest.vn000002"}], - "conditionalMembership": ""}}' + policy", "memberType": "Microsoft.Network/virtualNetworks"}}' headers: Accept: - application/json @@ -71,29 +69,28 @@ interactions: Connection: - keep-alive Content-Length: - - '410' + - '132' Content-Type: - application/json ParameterSetName: - - --name --network-manager-name --description --conditional-membership --display-name - --member-type -g --group-members + - --name --network-manager-name --description --display-name --member-type -g User-Agent: - - AZURECLI/2.30.0 azsdk-python-mgmt-network/1.0.0b1 Python/3.8.3 (Windows-10-10.0.18362-SP0) + - AZURECLI/2.31.0 azsdk-python-mgmt-network/1.0.0b1 Python/3.9.5 (Windows-10-10.0.17763-SP0) method: PUT - uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/test_network_manager_admin_rule_crud000001/providers/Microsoft.Network/networkManagers/TestNetworkManager/networkGroups/TestNetworkGroup?api-version=2021-02-01-preview + uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/test_network_manager_admin_rule_crud000001/providers/Microsoft.Network/networkManagers/TestNetworkManager/networkGroups/TestNetworkGroup?api-version=2021-05-01-preview response: body: string: '{"name":"TestNetworkGroup","id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/test_network_manager_admin_rule_crud000001/providers/Microsoft.Network/networkManagers/TestNetworkManager/networkGroups/TestNetworkGroup","type":"Microsoft.Network/networkManagers/networkGroups","etag":"","properties":{"displayName":"ASampleGroup","description":"A - sample policy","groupMembers":[{"resourceId":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/test_network_manager_admin_rule_crud000001/providers/Microsoft.Network/virtualnetworks/clitest.vn000002"}],"conditionalMembership":"","provisioningState":"Succeeded","resourceGuid":"870e117b-4fdb-4b71-9b41-2675bc63f4ca"},"systemData":{"createdBy":"v-kaisun@microsoft.com","createdByType":"User","createdAt":"2021-11-02T09:34:52.7678129Z","lastModifiedBy":"v-kaisun@microsoft.com","lastModifiedByType":"User","lastModifiedAt":"2021-11-02T09:34:52.7678129Z"}}' + sample policy","groupMembers":[],"conditionalMembership":"","provisioningState":"Succeeded","resourceGuid":"efcafcc2-0630-44b2-98d2-69c99b257da8"},"systemData":{"createdBy":"v-taoxuzeng@microsoft.com","createdByType":"User","createdAt":"2022-03-07T09:42:57.1362102Z","lastModifiedBy":"v-taoxuzeng@microsoft.com","lastModifiedByType":"User","lastModifiedAt":"2022-03-07T09:42:57.1362102Z"}}' headers: cache-control: - no-cache content-length: - - '1009' + - '754' content-type: - application/json; charset=utf-8 date: - - Tue, 02 Nov 2021 09:34:53 GMT + - Mon, 07 Mar 2022 09:42:57 GMT expires: - '-1' pragma: @@ -109,13 +106,65 @@ interactions: x-content-type-options: - nosniff x-ms-ratelimit-remaining-subscription-writes: - - '1197' + - '1196' + status: + code: 200 + message: OK +- request: + body: '{"properties": {"resourceId": "/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/test_network_manager_admin_rule_crud000001/providers/Microsoft.Network/virtualnetworks/clitest.vn000002"}}' + headers: + Accept: + - application/json + Accept-Encoding: + - gzip, deflate + CommandName: + - network manager group static-member create + Connection: + - keep-alive + Content-Length: + - '204' + Content-Type: + - application/json + ParameterSetName: + - --name --network-group-name --network-manager-name --resource-id -g + User-Agent: + - AZURECLI/2.31.0 azsdk-python-mgmt-network/1.0.0b1 Python/3.9.5 (Windows-10-10.0.17763-SP0) + method: PUT + uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/test_network_manager_admin_rule_crud000001/providers/Microsoft.Network/networkManagers/TestNetworkManager/networkGroups/TestNetworkGroup/staticMembers/TestStaticMember?api-version=2021-05-01-preview + response: + body: + string: '{"name":"TestStaticMember","id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/test_network_manager_admin_rule_crud000001/providers/Microsoft.Network/networkManagers/TestNetworkManager/networkGroups/TestNetworkGroup/staticMembers/TestStaticMember","type":"Microsoft.Network/networkManagers/networkGroups/staticMembers","etag":"","properties":{"resourceId":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/test_network_manager_admin_rule_crud000001/providers/Microsoft.Network/virtualnetworks/clitest.vn000002"},"systemData":{"createdBy":"v-taoxuzeng@microsoft.com","createdByType":"User","createdAt":"2022-03-07T09:42:59.0320115Z","lastModifiedBy":"v-taoxuzeng@microsoft.com","lastModifiedByType":"User","lastModifiedAt":"2022-03-07T09:42:59.0320115Z"}}' + headers: + cache-control: + - no-cache + content-length: + - '793' + content-type: + - application/json; charset=utf-8 + date: + - Mon, 07 Mar 2022 09:42:59 GMT + expires: + - '-1' + pragma: + - no-cache + server: + - Kestrel + strict-transport-security: + - max-age=31536000; includeSubDomains + transfer-encoding: + - chunked + vary: + - Accept-Encoding + x-content-type-options: + - nosniff + x-ms-ratelimit-remaining-subscription-writes: + - '1198' status: code: 200 message: OK - request: body: '{"properties": {"displayName": "MyTestConfig", "description": "A sample - policy", "securityType": "AdminPolicy", "deleteExistingNSGs": "True"}}' + policy", "deleteExistingNSGs": "True"}}' headers: Accept: - application/json @@ -126,29 +175,29 @@ interactions: Connection: - keep-alive Content-Length: - - '142' + - '111' Content-Type: - application/json ParameterSetName: - --configuration-name --network-manager-name -g --description --delete-existing-ns-gs - --security-type --display-name + --display-name User-Agent: - - AZURECLI/2.30.0 azsdk-python-mgmt-network/1.0.0b1 Python/3.8.3 (Windows-10-10.0.18362-SP0) + - AZURECLI/2.31.0 azsdk-python-mgmt-network/1.0.0b1 Python/3.9.5 (Windows-10-10.0.17763-SP0) method: PUT - uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/test_network_manager_admin_rule_crud000001/providers/Microsoft.Network/networkManagers/TestNetworkManager/securityAdminConfigurations/myTestSecurityConfig?api-version=2021-02-01-preview + uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/test_network_manager_admin_rule_crud000001/providers/Microsoft.Network/networkManagers/TestNetworkManager/securityAdminConfigurations/myTestSecurityConfig?api-version=2021-05-01-preview response: body: string: '{"name":"myTestSecurityConfig","id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/test_network_manager_admin_rule_crud000001/providers/Microsoft.Network/networkManagers/TestNetworkManager/securityAdminConfigurations/myTestSecurityConfig","type":"Microsoft.Network/networkManagers/securityAdminConfigurations","etag":"","properties":{"displayName":"MyTestConfig","description":"A - sample policy","provisioningState":"Succeeded","resourceGuid":"6c954841-f9ac-4c14-9a23-bdb0d858e716"},"systemData":{"createdBy":"v-kaisun@microsoft.com","createdByType":"User","createdAt":"2021-11-02T09:34:57.2881450Z","lastModifiedBy":"v-kaisun@microsoft.com","lastModifiedByType":"User","lastModifiedAt":"2021-11-02T09:34:57.2881450Z"}}' + sample policy","provisioningState":"Succeeded","resourceGuid":"e99306b0-0976-4587-8a92-3733abdf35d2","applyOnNetworkIntentPolicyBasedServices":[]},"systemData":{"createdBy":"v-taoxuzeng@microsoft.com","createdByType":"User","createdAt":"2022-03-07T09:43:00.4592693Z","lastModifiedBy":"v-taoxuzeng@microsoft.com","lastModifiedByType":"User","lastModifiedAt":"2022-03-07T09:43:00.4592693Z"}}' headers: cache-control: - no-cache content-length: - - '772' + - '790' content-type: - application/json; charset=utf-8 date: - - Tue, 02 Nov 2021 09:34:58 GMT + - Mon, 07 Mar 2022 09:43:00 GMT expires: - '-1' pragma: @@ -164,7 +213,7 @@ interactions: x-content-type-options: - nosniff x-ms-ratelimit-remaining-subscription-writes: - - '1199' + - '1198' status: code: 200 message: OK @@ -181,29 +230,29 @@ interactions: Connection: - keep-alive Content-Length: - - '367' + - '334' Content-Type: - application/json ParameterSetName: - --configuration-name --network-manager-name -g --rule-collection-name --description --display-name --applies-to-groups User-Agent: - - AZURECLI/2.30.0 azsdk-python-mgmt-network/1.0.0b1 Python/3.8.3 (Windows-10-10.0.18362-SP0) + - AZURECLI/2.31.0 azsdk-python-mgmt-network/1.0.0b1 Python/3.9.5 (Windows-10-10.0.17763-SP0) method: PUT - uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/test_network_manager_admin_rule_crud000001/providers/Microsoft.Network/networkManagers/TestNetworkManager/securityAdminConfigurations/myTestSecurityConfig/ruleCollections/myTestCollection?api-version=2021-02-01-preview + uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/test_network_manager_admin_rule_crud000001/providers/Microsoft.Network/networkManagers/TestNetworkManager/securityAdminConfigurations/myTestSecurityConfig/ruleCollections/myTestCollection?api-version=2021-05-01-preview response: body: string: '{"name":"myTestCollection","id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/test_network_manager_admin_rule_crud000001/providers/Microsoft.Network/networkManagers/TestNetworkManager/securityAdminConfigurations/myTestSecurityConfig/ruleCollections/myTestCollection","type":"Microsoft.Network/networkManagers/securityAdminConfigurations/ruleCollections","etag":"","properties":{"displayName":"ASampleCollection","description":"A - sample policy","appliesToGroups":[{"networkGroupId":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/test_network_manager_admin_rule_crud000001/providers/Microsoft.Network/networkManagers/TestNetworkManager/networkGroups/TestNetworkGroup"}],"provisioningState":"Succeeded","resourceGuid":"f5d157c4-76f0-43bf-88f0-780265bc47c8"},"systemData":{"createdBy":"v-kaisun@microsoft.com","createdByType":"User","createdAt":"2021-11-02T09:35:02.2431372Z","lastModifiedBy":"v-kaisun@microsoft.com","lastModifiedByType":"User","lastModifiedAt":"2021-11-02T09:35:02.2431372Z"}}' + sample policy","appliesToGroups":[{"networkGroupId":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/test_network_manager_admin_rule_crud000001/providers/Microsoft.Network/networkManagers/TestNetworkManager/networkGroups/TestNetworkGroup"}],"provisioningState":"Succeeded","resourceGuid":"75dbfefd-2373-4fe3-8a47-1b35dc8f4fea"},"systemData":{"createdBy":"v-taoxuzeng@microsoft.com","createdByType":"User","createdAt":"2022-03-07T09:43:02.3556656Z","lastModifiedBy":"v-taoxuzeng@microsoft.com","lastModifiedByType":"User","lastModifiedAt":"2022-03-07T09:43:02.3556656Z"}}' headers: cache-control: - no-cache content-length: - - '1100' + - '1040' content-type: - application/json; charset=utf-8 date: - - Tue, 02 Nov 2021 09:35:02 GMT + - Mon, 07 Mar 2022 09:43:02 GMT expires: - '-1' pragma: @@ -243,21 +292,21 @@ interactions: - -g --network-manager-name --configuration-name --rule-collection-name --rule-name --kind --protocol --access --priority --direction User-Agent: - - AZURECLI/2.30.0 azsdk-python-mgmt-network/1.0.0b1 Python/3.8.3 (Windows-10-10.0.18362-SP0) + - AZURECLI/2.31.0 azsdk-python-mgmt-network/1.0.0b1 Python/3.9.5 (Windows-10-10.0.17763-SP0) method: PUT - uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/test_network_manager_admin_rule_crud000001/providers/Microsoft.Network/networkManagers/TestNetworkManager/securityAdminConfigurations/myTestSecurityConfig/ruleCollections/myTestCollection/rules/myRule?api-version=2021-02-01-preview + uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/test_network_manager_admin_rule_crud000001/providers/Microsoft.Network/networkManagers/TestNetworkManager/securityAdminConfigurations/myTestSecurityConfig/ruleCollections/myTestCollection/rules/myRule?api-version=2021-05-01-preview response: body: - string: '{"name":"myRule","id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/test_network_manager_admin_rule_crud000001/providers/Microsoft.Network/networkManagers/TestNetworkManager/securityAdminConfigurations/myTestSecurityConfig/ruleCollections/myTestCollection/rules/myRule","type":"Microsoft.Network/networkManagers/securityAdminConfigurations/ruleCollections/rules","etag":"","properties":{"displayName":"","description":"","flag":"","priority":32,"protocol":"Tcp","direction":"Inbound","access":"Allow","sources":[],"destinations":[],"sourcePortRanges":[],"destinationPortRanges":[],"provisioningState":"Succeeded","resourceGuid":"7d63c5e7-a868-4100-9237-10c7002e2d28"},"kind":"Custom","systemData":{"createdBy":"v-kaisun@microsoft.com","createdByType":"User","createdAt":"2021-11-02T09:35:04.5602508Z","lastModifiedBy":"v-kaisun@microsoft.com","lastModifiedByType":"User","lastModifiedAt":"2021-11-02T09:35:04.5602508Z"}}' + string: '{"name":"myRule","id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/test_network_manager_admin_rule_crud000001/providers/Microsoft.Network/networkManagers/TestNetworkManager/securityAdminConfigurations/myTestSecurityConfig/ruleCollections/myTestCollection/rules/myRule","type":"Microsoft.Network/networkManagers/securityAdminConfigurations/ruleCollections/rules","etag":"","properties":{"displayName":"","description":"","flag":"","priority":32,"protocol":"Tcp","direction":"Inbound","access":"Allow","sources":[],"destinations":[],"sourcePortRanges":[],"destinationPortRanges":[],"provisioningState":"Succeeded","resourceGuid":"409c2cb3-0dc4-4c2d-9138-0d10defbf0aa"},"kind":"Custom","systemData":{"createdBy":"v-taoxuzeng@microsoft.com","createdByType":"User","createdAt":"2022-03-07T09:43:04.1703455Z","lastModifiedBy":"v-taoxuzeng@microsoft.com","lastModifiedByType":"User","lastModifiedAt":"2022-03-07T09:43:04.1703455Z"}}' headers: cache-control: - no-cache content-length: - - '975' + - '948' content-type: - application/json; charset=utf-8 date: - - Tue, 02 Nov 2021 09:35:05 GMT + - Mon, 07 Mar 2022 09:43:04 GMT expires: - '-1' pragma: @@ -273,7 +322,7 @@ interactions: x-content-type-options: - nosniff x-ms-ratelimit-remaining-subscription-writes: - - '1195' + - '1194' status: code: 200 message: OK @@ -291,21 +340,21 @@ interactions: ParameterSetName: - -g --network-manager-name --configuration-name --rule-collection-name --rule-name User-Agent: - - AZURECLI/2.30.0 azsdk-python-mgmt-network/1.0.0b1 Python/3.8.3 (Windows-10-10.0.18362-SP0) + - AZURECLI/2.31.0 azsdk-python-mgmt-network/1.0.0b1 Python/3.9.5 (Windows-10-10.0.17763-SP0) method: GET - uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/test_network_manager_admin_rule_crud000001/providers/Microsoft.Network/networkManagers/TestNetworkManager/securityAdminConfigurations/myTestSecurityConfig/ruleCollections/myTestCollection/rules/myRule?api-version=2021-02-01-preview + uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/test_network_manager_admin_rule_crud000001/providers/Microsoft.Network/networkManagers/TestNetworkManager/securityAdminConfigurations/myTestSecurityConfig/ruleCollections/myTestCollection/rules/myRule?api-version=2021-05-01-preview response: body: - string: '{"name":"myRule","id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/test_network_manager_admin_rule_crud000001/providers/Microsoft.Network/networkManagers/TestNetworkManager/securityAdminConfigurations/myTestSecurityConfig/ruleCollections/myTestCollection/rules/myRule","type":"Microsoft.Network/networkManagers/securityAdminConfigurations/ruleCollections/rules","etag":"\"2100eab2-0000-3400-0000-618106490000\"","properties":{"displayName":"","description":"","flag":"","priority":32,"protocol":"Tcp","direction":"Inbound","access":"Allow","sources":[],"destinations":[],"sourcePortRanges":[],"destinationPortRanges":[],"provisioningState":"Succeeded","resourceGuid":"7d63c5e7-a868-4100-9237-10c7002e2d28"},"kind":"Custom","systemData":{"createdBy":"v-kaisun@microsoft.com","createdByType":"User","createdAt":"2021-11-02T09:35:04.5602508Z","lastModifiedBy":"v-kaisun@microsoft.com","lastModifiedByType":"User","lastModifiedAt":"2021-11-02T09:35:04.5602508Z"}}' + string: '{"name":"myRule","id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/test_network_manager_admin_rule_crud000001/providers/Microsoft.Network/networkManagers/TestNetworkManager/securityAdminConfigurations/myTestSecurityConfig/ruleCollections/myTestCollection/rules/myRule","type":"Microsoft.Network/networkManagers/securityAdminConfigurations/ruleCollections/rules","etag":"\"0000c87a-0000-3400-0000-6225d3a90000\"","properties":{"displayName":"","description":"","flag":"","priority":32,"protocol":"Tcp","direction":"Inbound","access":"Allow","sources":[],"destinations":[],"sourcePortRanges":[],"destinationPortRanges":[],"provisioningState":"Succeeded","resourceGuid":"409c2cb3-0dc4-4c2d-9138-0d10defbf0aa"},"kind":"Custom","systemData":{"createdBy":"v-taoxuzeng@microsoft.com","createdByType":"User","createdAt":"2022-03-07T09:43:04.1703455Z","lastModifiedBy":"v-taoxuzeng@microsoft.com","lastModifiedByType":"User","lastModifiedAt":"2022-03-07T09:43:04.1703455Z"}}' headers: cache-control: - no-cache content-length: - - '1015' + - '988' content-type: - application/json; charset=utf-8 date: - - Tue, 02 Nov 2021 09:35:09 GMT + - Mon, 07 Mar 2022 09:43:06 GMT expires: - '-1' pragma: @@ -338,21 +387,21 @@ interactions: - -g --network-manager-name --configuration-name --rule-collection-name --rule-name --access User-Agent: - - AZURECLI/2.30.0 azsdk-python-mgmt-network/1.0.0b1 Python/3.8.3 (Windows-10-10.0.18362-SP0) + - AZURECLI/2.31.0 azsdk-python-mgmt-network/1.0.0b1 Python/3.9.5 (Windows-10-10.0.17763-SP0) method: GET - uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/test_network_manager_admin_rule_crud000001/providers/Microsoft.Network/networkManagers/TestNetworkManager/securityAdminConfigurations/myTestSecurityConfig/ruleCollections/myTestCollection/rules/myRule?api-version=2021-02-01-preview + uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/test_network_manager_admin_rule_crud000001/providers/Microsoft.Network/networkManagers/TestNetworkManager/securityAdminConfigurations/myTestSecurityConfig/ruleCollections/myTestCollection/rules/myRule?api-version=2021-05-01-preview response: body: - string: '{"name":"myRule","id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/test_network_manager_admin_rule_crud000001/providers/Microsoft.Network/networkManagers/TestNetworkManager/securityAdminConfigurations/myTestSecurityConfig/ruleCollections/myTestCollection/rules/myRule","type":"Microsoft.Network/networkManagers/securityAdminConfigurations/ruleCollections/rules","etag":"\"2100eab2-0000-3400-0000-618106490000\"","properties":{"displayName":"","description":"","flag":"","priority":32,"protocol":"Tcp","direction":"Inbound","access":"Allow","sources":[],"destinations":[],"sourcePortRanges":[],"destinationPortRanges":[],"provisioningState":"Succeeded","resourceGuid":"7d63c5e7-a868-4100-9237-10c7002e2d28"},"kind":"Custom","systemData":{"createdBy":"v-kaisun@microsoft.com","createdByType":"User","createdAt":"2021-11-02T09:35:04.5602508Z","lastModifiedBy":"v-kaisun@microsoft.com","lastModifiedByType":"User","lastModifiedAt":"2021-11-02T09:35:04.5602508Z"}}' + string: '{"name":"myRule","id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/test_network_manager_admin_rule_crud000001/providers/Microsoft.Network/networkManagers/TestNetworkManager/securityAdminConfigurations/myTestSecurityConfig/ruleCollections/myTestCollection/rules/myRule","type":"Microsoft.Network/networkManagers/securityAdminConfigurations/ruleCollections/rules","etag":"\"0000c87a-0000-3400-0000-6225d3a90000\"","properties":{"displayName":"","description":"","flag":"","priority":32,"protocol":"Tcp","direction":"Inbound","access":"Allow","sources":[],"destinations":[],"sourcePortRanges":[],"destinationPortRanges":[],"provisioningState":"Succeeded","resourceGuid":"409c2cb3-0dc4-4c2d-9138-0d10defbf0aa"},"kind":"Custom","systemData":{"createdBy":"v-taoxuzeng@microsoft.com","createdByType":"User","createdAt":"2022-03-07T09:43:04.1703455Z","lastModifiedBy":"v-taoxuzeng@microsoft.com","lastModifiedByType":"User","lastModifiedAt":"2022-03-07T09:43:04.1703455Z"}}' headers: cache-control: - no-cache content-length: - - '1015' + - '988' content-type: - application/json; charset=utf-8 date: - - Tue, 02 Nov 2021 09:35:12 GMT + - Mon, 07 Mar 2022 09:43:08 GMT expires: - '-1' pragma: @@ -392,21 +441,21 @@ interactions: - -g --network-manager-name --configuration-name --rule-collection-name --rule-name --access User-Agent: - - AZURECLI/2.30.0 azsdk-python-mgmt-network/1.0.0b1 Python/3.8.3 (Windows-10-10.0.18362-SP0) + - AZURECLI/2.31.0 azsdk-python-mgmt-network/1.0.0b1 Python/3.9.5 (Windows-10-10.0.17763-SP0) method: PUT - uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/test_network_manager_admin_rule_crud000001/providers/Microsoft.Network/networkManagers/TestNetworkManager/securityAdminConfigurations/myTestSecurityConfig/ruleCollections/myTestCollection/rules/myRule?api-version=2021-02-01-preview + uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/test_network_manager_admin_rule_crud000001/providers/Microsoft.Network/networkManagers/TestNetworkManager/securityAdminConfigurations/myTestSecurityConfig/ruleCollections/myTestCollection/rules/myRule?api-version=2021-05-01-preview response: body: - string: '{"name":"myRule","id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/test_network_manager_admin_rule_crud000001/providers/Microsoft.Network/networkManagers/TestNetworkManager/securityAdminConfigurations/myTestSecurityConfig/ruleCollections/myTestCollection/rules/myRule","type":"Microsoft.Network/networkManagers/securityAdminConfigurations/ruleCollections/rules","etag":"","properties":{"displayName":"","description":"","flag":"","priority":32,"protocol":"Tcp","direction":"Inbound","access":"Deny","sources":[],"destinations":[],"sourcePortRanges":[],"destinationPortRanges":[],"provisioningState":"Succeeded","resourceGuid":"7d63c5e7-a868-4100-9237-10c7002e2d28"},"kind":"Custom","systemData":{"createdBy":"v-kaisun@microsoft.com","createdByType":"User","createdAt":"2021-11-02T09:35:04.5602508Z","lastModifiedBy":"v-kaisun@microsoft.com","lastModifiedByType":"User","lastModifiedAt":"2021-11-02T09:35:16.7990966Z"}}' + string: '{"name":"myRule","id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/test_network_manager_admin_rule_crud000001/providers/Microsoft.Network/networkManagers/TestNetworkManager/securityAdminConfigurations/myTestSecurityConfig/ruleCollections/myTestCollection/rules/myRule","type":"Microsoft.Network/networkManagers/securityAdminConfigurations/ruleCollections/rules","etag":"","properties":{"displayName":"","description":"","flag":"","priority":32,"protocol":"Tcp","direction":"Inbound","access":"Deny","sources":[],"destinations":[],"sourcePortRanges":[],"destinationPortRanges":[],"provisioningState":"Succeeded","resourceGuid":"409c2cb3-0dc4-4c2d-9138-0d10defbf0aa"},"kind":"Custom","systemData":{"createdBy":"v-taoxuzeng@microsoft.com","createdByType":"User","createdAt":"2022-03-07T09:43:04.1703455Z","lastModifiedBy":"v-taoxuzeng@microsoft.com","lastModifiedByType":"User","lastModifiedAt":"2022-03-07T09:43:09.5048486Z"}}' headers: cache-control: - no-cache content-length: - - '974' + - '947' content-type: - application/json; charset=utf-8 date: - - Tue, 02 Nov 2021 09:35:19 GMT + - Mon, 07 Mar 2022 09:43:09 GMT expires: - '-1' pragma: @@ -422,7 +471,7 @@ interactions: x-content-type-options: - nosniff x-ms-ratelimit-remaining-subscription-writes: - - '1199' + - '1197' status: code: 200 message: OK @@ -440,21 +489,21 @@ interactions: ParameterSetName: - -g --network-manager-name --configuration-name --rule-collection-name User-Agent: - - AZURECLI/2.30.0 azsdk-python-mgmt-network/1.0.0b1 Python/3.8.3 (Windows-10-10.0.18362-SP0) + - AZURECLI/2.31.0 azsdk-python-mgmt-network/1.0.0b1 Python/3.9.5 (Windows-10-10.0.17763-SP0) method: GET - uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/test_network_manager_admin_rule_crud000001/providers/Microsoft.Network/networkManagers/TestNetworkManager/securityAdminConfigurations/myTestSecurityConfig/ruleCollections/myTestCollection/rules?api-version=2021-02-01-preview + uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/test_network_manager_admin_rule_crud000001/providers/Microsoft.Network/networkManagers/TestNetworkManager/securityAdminConfigurations/myTestSecurityConfig/ruleCollections/myTestCollection/rules?api-version=2021-05-01-preview response: body: - string: '{"nextLink":"","value":[{"name":"myRule","id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/test_network_manager_admin_rule_crud000001/providers/Microsoft.Network/networkManagers/TestNetworkManager/securityAdminConfigurations/myTestSecurityConfig/ruleCollections/myTestCollection/rules/myRule","type":"Microsoft.Network/networkManagers/securityAdminConfigurations/ruleCollections/rules","etag":"\"2100efb2-0000-3400-0000-618106570000\"","properties":{"displayName":"","description":"","flag":"","priority":32,"protocol":"Tcp","direction":"Inbound","access":"Deny","sources":[],"destinations":[],"sourcePortRanges":[],"destinationPortRanges":[],"provisioningState":"Succeeded","resourceGuid":"7d63c5e7-a868-4100-9237-10c7002e2d28"},"kind":"Custom","systemData":{"createdBy":"v-kaisun@microsoft.com","createdByType":"User","createdAt":"2021-11-02T09:35:04.5602508Z","lastModifiedBy":"v-kaisun@microsoft.com","lastModifiedByType":"User","lastModifiedAt":"2021-11-02T09:35:16.7990966Z"}}]}' + string: '{"nextLink":"","value":[{"name":"myRule","id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/test_network_manager_admin_rule_crud000001/providers/Microsoft.Network/networkManagers/TestNetworkManager/securityAdminConfigurations/myTestSecurityConfig/ruleCollections/myTestCollection/rules/myRule","type":"Microsoft.Network/networkManagers/securityAdminConfigurations/ruleCollections/rules","etag":"\"0000c97a-0000-3400-0000-6225d3ae0000\"","properties":{"displayName":"","description":"","flag":"","priority":32,"protocol":"Tcp","direction":"Inbound","access":"Deny","sources":[],"destinations":[],"sourcePortRanges":[],"destinationPortRanges":[],"provisioningState":"Succeeded","resourceGuid":"409c2cb3-0dc4-4c2d-9138-0d10defbf0aa"},"kind":"Custom","systemData":{"createdBy":"v-taoxuzeng@microsoft.com","createdByType":"User","createdAt":"2022-03-07T09:43:04.1703455Z","lastModifiedBy":"v-taoxuzeng@microsoft.com","lastModifiedByType":"User","lastModifiedAt":"2022-03-07T09:43:09.5048486Z"}}]}' headers: cache-control: - no-cache content-length: - - '1040' + - '1013' content-type: - application/json; charset=utf-8 date: - - Tue, 02 Nov 2021 09:35:22 GMT + - Mon, 07 Mar 2022 09:43:11 GMT expires: - '-1' pragma: @@ -489,9 +538,139 @@ interactions: - -g --network-manager-name --configuration-name --rule-collection-name --rule-name --yes User-Agent: - - AZURECLI/2.30.0 azsdk-python-mgmt-network/1.0.0b1 Python/3.8.3 (Windows-10-10.0.18362-SP0) + - AZURECLI/2.31.0 azsdk-python-mgmt-network/1.0.0b1 Python/3.9.5 (Windows-10-10.0.17763-SP0) + method: DELETE + uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/test_network_manager_admin_rule_crud000001/providers/Microsoft.Network/networkManagers/TestNetworkManager/securityAdminConfigurations/myTestSecurityConfig/ruleCollections/myTestCollection/rules/myRule?api-version=2021-05-01-preview + response: + body: + string: '' + headers: + cache-control: + - no-cache + content-length: + - '0' + date: + - Mon, 07 Mar 2022 09:43:12 GMT + expires: + - '-1' + pragma: + - no-cache + server: + - Kestrel + strict-transport-security: + - max-age=31536000; includeSubDomains + x-content-type-options: + - nosniff + x-ms-ratelimit-remaining-subscription-deletes: + - '14999' + status: + code: 200 + message: OK +- request: + body: null + headers: + Accept: + - application/json + Accept-Encoding: + - gzip, deflate + CommandName: + - network manager security-admin-config delete + Connection: + - keep-alive + Content-Length: + - '0' + ParameterSetName: + - --configuration-name --network-manager-name -g --force --yes + User-Agent: + - AZURECLI/2.31.0 azsdk-python-mgmt-network/1.0.0b1 Python/3.9.5 (Windows-10-10.0.17763-SP0) + method: DELETE + uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/test_network_manager_admin_rule_crud000001/providers/Microsoft.Network/networkManagers/TestNetworkManager/securityAdminConfigurations/TestStaticMember?api-version=2021-05-01-preview&force=true + response: + body: + string: '' + headers: + cache-control: + - no-cache + date: + - Mon, 07 Mar 2022 09:43:14 GMT + expires: + - '-1' + pragma: + - no-cache + server: + - Kestrel + strict-transport-security: + - max-age=31536000; includeSubDomains + x-content-type-options: + - nosniff + x-ms-ratelimit-remaining-subscription-deletes: + - '14991' + status: + code: 204 + message: No Content +- request: + body: null + headers: + Accept: + - application/json + Accept-Encoding: + - gzip, deflate + CommandName: + - network manager group delete + Connection: + - keep-alive + Content-Length: + - '0' + ParameterSetName: + - -g --name --network-manager-name --force --yes + User-Agent: + - AZURECLI/2.31.0 azsdk-python-mgmt-network/1.0.0b1 Python/3.9.5 (Windows-10-10.0.17763-SP0) + method: DELETE + uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/test_network_manager_admin_rule_crud000001/providers/Microsoft.Network/networkManagers/TestNetworkManager/networkGroups/TestNetworkGroup?api-version=2021-05-01-preview&force=true + response: + body: + string: '' + headers: + cache-control: + - no-cache + content-length: + - '0' + date: + - Mon, 07 Mar 2022 09:43:15 GMT + expires: + - '-1' + pragma: + - no-cache + server: + - Kestrel + strict-transport-security: + - max-age=31536000; includeSubDomains + x-content-type-options: + - nosniff + x-ms-ratelimit-remaining-subscription-deletes: + - '14998' + status: + code: 200 + message: OK +- request: + body: null + headers: + Accept: + - application/json + Accept-Encoding: + - gzip, deflate + CommandName: + - network manager delete + Connection: + - keep-alive + Content-Length: + - '0' + ParameterSetName: + - --resource-group --name --yes + User-Agent: + - AZURECLI/2.31.0 azsdk-python-mgmt-network/1.0.0b1 Python/3.9.5 (Windows-10-10.0.17763-SP0) method: DELETE - uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/test_network_manager_admin_rule_crud000001/providers/Microsoft.Network/networkManagers/TestNetworkManager/securityAdminConfigurations/myTestSecurityConfig/ruleCollections/myTestCollection/rules/myRule?api-version=2021-02-01-preview + uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/test_network_manager_admin_rule_crud000001/providers/Microsoft.Network/networkManagers/TestNetworkManager?api-version=2021-05-01-preview response: body: string: '' @@ -501,7 +680,7 @@ interactions: content-length: - '0' date: - - Tue, 02 Nov 2021 09:35:24 GMT + - Mon, 07 Mar 2022 09:43:23 GMT expires: - '-1' pragma: @@ -513,7 +692,7 @@ interactions: x-content-type-options: - nosniff x-ms-ratelimit-remaining-subscription-deletes: - - '14996' + - '14999' status: code: 200 message: OK diff --git a/src/network-manager/azext_network_manager/tests/latest/recordings/test_network_manager_connect_config_crud.yaml b/src/network-manager/azext_network_manager/tests/latest/recordings/test_network_manager_connect_config_crud.yaml index a4ce72e96f2..d43280e2b06 100644 --- a/src/network-manager/azext_network_manager/tests/latest/recordings/test_network_manager_connect_config_crud.yaml +++ b/src/network-manager/azext_network_manager/tests/latest/recordings/test_network_manager_connect_config_crud.yaml @@ -21,13 +21,13 @@ interactions: - --name --description --display-name --scope-accesses --network-manager-scopes -l --resource-group User-Agent: - - AZURECLI/2.30.0 azsdk-python-mgmt-network/1.0.0b1 Python/3.8.3 (Windows-10-10.0.18362-SP0) + - AZURECLI/2.31.0 azsdk-python-mgmt-network/1.0.0b1 Python/3.9.5 (Windows-10-10.0.17763-SP0) method: PUT - uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/test_network_manager_connect_config_crud000001/providers/Microsoft.Network/networkManagers/TestNetworkManager?api-version=2021-02-01-preview + uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/test_network_manager_connect_config_crud000001/providers/Microsoft.Network/networkManagers/TestNetworkManager?api-version=2021-05-01-preview response: body: string: '{"name":"TestNetworkManager","id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/test_network_manager_connect_config_crud000001/providers/Microsoft.Network/networkManagers/TestNetworkManager","location":"eastus2euap","type":"Microsoft.Network/networkManagers","tags":{},"etag":"","properties":{"displayName":"TestNetworkManager","description":"My - Test Network Manager","networkManagerScopes":{"managementGroups":[],"subscriptions":["/subscriptions/00000000-0000-0000-0000-000000000000"]},"provisioningState":"Succeeded","networkManagerScopeAccesses":["SecurityAdmin","Connectivity"],"resourceGuid":"9dd5db45-31a3-4f71-ae40-12667f94087e"},"systemData":{"createdBy":"v-kaisun@microsoft.com","createdByType":"User","createdAt":"2021-11-03T03:00:37.3863975Z","lastModifiedBy":"v-kaisun@microsoft.com","lastModifiedByType":"User","lastModifiedAt":"2021-11-03T03:00:37.3863975Z"}}' + Test Network Manager","networkManagerScopes":{"managementGroups":[],"subscriptions":["/subscriptions/00000000-0000-0000-0000-000000000000"],"multiTenantScopes":[]},"provisioningState":"Succeeded","networkManagerScopeAccesses":["SecurityAdmin","Connectivity"],"resourceGuid":"c0170de8-34ea-4f82-b1cb-159c1adf3077"},"systemData":{"createdBy":"v-taoxuzeng@microsoft.com","createdByType":"User","createdAt":"2022-03-07T09:47:52.9731831Z","lastModifiedBy":"v-taoxuzeng@microsoft.com","lastModifiedByType":"User","lastModifiedAt":"2022-03-07T09:47:52.9731831Z"}}' headers: cache-control: - no-cache @@ -36,7 +36,7 @@ interactions: content-type: - application/json; charset=utf-8 date: - - Wed, 03 Nov 2021 03:00:42 GMT + - Mon, 07 Mar 2022 09:47:58 GMT expires: - '-1' pragma: @@ -52,15 +52,13 @@ interactions: x-content-type-options: - nosniff x-ms-ratelimit-remaining-subscription-writes: - - '1199' + - '1198' status: code: 200 message: OK - request: body: '{"properties": {"displayName": "ASampleGroup", "description": "A sample - policy", "memberType": "Microsoft.Network/virtualNetworks", "groupMembers": - [{"resourceId": "/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/test_network_manager_connect_config_crud000001/providers/Microsoft.Network/virtualnetworks/clitest.vn000002"}], - "conditionalMembership": ""}}' + policy", "memberType": "Microsoft.Network/virtualNetworks"}}' headers: Accept: - application/json @@ -71,29 +69,28 @@ interactions: Connection: - keep-alive Content-Length: - - '410' + - '132' Content-Type: - application/json ParameterSetName: - - --name --network-manager-name --description --conditional-membership --display-name - --member-type -g --group-members + - --name --network-manager-name --description --display-name --member-type -g User-Agent: - - AZURECLI/2.30.0 azsdk-python-mgmt-network/1.0.0b1 Python/3.8.3 (Windows-10-10.0.18362-SP0) + - AZURECLI/2.31.0 azsdk-python-mgmt-network/1.0.0b1 Python/3.9.5 (Windows-10-10.0.17763-SP0) method: PUT - uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/test_network_manager_connect_config_crud000001/providers/Microsoft.Network/networkManagers/TestNetworkManager/networkGroups/TestNetworkGroup?api-version=2021-02-01-preview + uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/test_network_manager_connect_config_crud000001/providers/Microsoft.Network/networkManagers/TestNetworkManager/networkGroups/TestNetworkGroup?api-version=2021-05-01-preview response: body: string: '{"name":"TestNetworkGroup","id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/test_network_manager_connect_config_crud000001/providers/Microsoft.Network/networkManagers/TestNetworkManager/networkGroups/TestNetworkGroup","type":"Microsoft.Network/networkManagers/networkGroups","etag":"","properties":{"displayName":"ASampleGroup","description":"A - sample policy","groupMembers":[{"resourceId":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/test_network_manager_connect_config_crud000001/providers/Microsoft.Network/virtualnetworks/clitest.vn000002"}],"conditionalMembership":"","provisioningState":"Succeeded","resourceGuid":"719919e8-daa3-4be2-904b-4f0fdeb708b0"},"systemData":{"createdBy":"v-kaisun@microsoft.com","createdByType":"User","createdAt":"2021-11-03T03:00:44.5975072Z","lastModifiedBy":"v-kaisun@microsoft.com","lastModifiedByType":"User","lastModifiedAt":"2021-11-03T03:00:44.5975072Z"}}' + sample policy","groupMembers":[],"conditionalMembership":"","provisioningState":"Succeeded","resourceGuid":"9561e275-5f09-42ed-8df7-3b778114b126"},"systemData":{"createdBy":"v-taoxuzeng@microsoft.com","createdByType":"User","createdAt":"2022-03-07T09:47:59.1562176Z","lastModifiedBy":"v-taoxuzeng@microsoft.com","lastModifiedByType":"User","lastModifiedAt":"2022-03-07T09:47:59.1562176Z"}}' headers: cache-control: - no-cache content-length: - - '1009' + - '758' content-type: - application/json; charset=utf-8 date: - - Wed, 03 Nov 2021 03:00:45 GMT + - Mon, 07 Mar 2022 09:48:00 GMT expires: - '-1' pragma: @@ -109,7 +106,59 @@ interactions: x-content-type-options: - nosniff x-ms-ratelimit-remaining-subscription-writes: - - '1198' + - '1194' + status: + code: 200 + message: OK +- request: + body: '{"properties": {"resourceId": "/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/test_network_manager_connect_config_crud000001/providers/Microsoft.Network/virtualnetworks/clitest.vn000002"}}' + headers: + Accept: + - application/json + Accept-Encoding: + - gzip, deflate + CommandName: + - network manager group static-member create + Connection: + - keep-alive + Content-Length: + - '208' + Content-Type: + - application/json + ParameterSetName: + - --name --network-group-name --network-manager-name --resource-id -g + User-Agent: + - AZURECLI/2.31.0 azsdk-python-mgmt-network/1.0.0b1 Python/3.9.5 (Windows-10-10.0.17763-SP0) + method: PUT + uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/test_network_manager_connect_config_crud000001/providers/Microsoft.Network/networkManagers/TestNetworkManager/networkGroups/TestNetworkGroup/staticMembers/TestStaticMember?api-version=2021-05-01-preview + response: + body: + string: '{"name":"TestStaticMember","id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/test_network_manager_connect_config_crud000001/providers/Microsoft.Network/networkManagers/TestNetworkManager/networkGroups/TestNetworkGroup/staticMembers/TestStaticMember","type":"Microsoft.Network/networkManagers/networkGroups/staticMembers","etag":"","properties":{"resourceId":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/test_network_manager_connect_config_crud000001/providers/Microsoft.Network/virtualnetworks/clitest.vn000002"},"systemData":{"createdBy":"v-taoxuzeng@microsoft.com","createdByType":"User","createdAt":"2022-03-07T09:48:01.0797604Z","lastModifiedBy":"v-taoxuzeng@microsoft.com","lastModifiedByType":"User","lastModifiedAt":"2022-03-07T09:48:01.0797604Z"}}' + headers: + cache-control: + - no-cache + content-length: + - '801' + content-type: + - application/json; charset=utf-8 + date: + - Mon, 07 Mar 2022 09:48:01 GMT + expires: + - '-1' + pragma: + - no-cache + server: + - Kestrel + strict-transport-security: + - max-age=31536000; includeSubDomains + transfer-encoding: + - chunked + vary: + - Accept-Encoding + x-content-type-options: + - nosniff + x-ms-ratelimit-remaining-subscription-writes: + - '1199' status: code: 200 message: OK @@ -130,29 +179,29 @@ interactions: Connection: - keep-alive Content-Length: - - '797' + - '731' Content-Type: - application/json ParameterSetName: - --configuration-name --network-manager-name -g --applies-to-groups --connectivity-topology --delete-existing-peering --hubs --description --is-global User-Agent: - - AZURECLI/2.30.0 azsdk-python-mgmt-network/1.0.0b1 Python/3.8.3 (Windows-10-10.0.18362-SP0) + - AZURECLI/2.31.0 azsdk-python-mgmt-network/1.0.0b1 Python/3.9.5 (Windows-10-10.0.17763-SP0) method: PUT - uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/test_network_manager_connect_config_crud000001/providers/Microsoft.Network/networkManagers/TestNetworkManager/connectivityConfigurations/myTestSecurityConfig?api-version=2021-02-01-preview + uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/test_network_manager_connect_config_crud000001/providers/Microsoft.Network/networkManagers/TestNetworkManager/connectivityConfigurations/myTestSecurityConfig?api-version=2021-05-01-preview response: body: string: '{"name":"myTestSecurityConfig","id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/test_network_manager_connect_config_crud000001/providers/Microsoft.Network/networkManagers/TestNetworkManager/connectivityConfigurations/myTestSecurityConfig","type":"Microsoft.Network/networkManagers/connectivityConfigurations","etag":"","properties":{"displayName":"","description":"Sample - Configuration","connectivityTopology":"HubAndSpoke","hubs":[{"resourceType":"Microsoft.Network/virtualNetworks","resourceId":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/test_network_manager_connect_config_crud000001/providers/Microsoft.Network/virtualnetworks/clitest.vn000002"}],"appliesToGroups":[{"networkGroupId":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/test_network_manager_connect_config_crud000001/providers/Microsoft.Network/networkManagers/TestNetworkManager/networkGroups/TestNetworkGroup","groupConnectivity":"None","useHubGateway":"True","isGlobal":"False"}],"provisioningState":"Succeeded","deleteExistingPeering":"True","isGlobal":"True","resourceGuid":"4bb0d0d8-c751-4714-8567-42378a12a63a"},"systemData":{"createdBy":"v-kaisun@microsoft.com","createdByType":"User","createdAt":"2021-11-03T03:00:47.9613470Z","lastModifiedBy":"v-kaisun@microsoft.com","lastModifiedByType":"User","lastModifiedAt":"2021-11-03T03:00:47.9613470Z"}}' + Configuration","connectivityTopology":"HubAndSpoke","hubs":[{"resourceType":"Microsoft.Network/virtualNetworks","resourceId":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/test_network_manager_connect_config_crud000001/providers/Microsoft.Network/virtualnetworks/clitest.vn000002"}],"appliesToGroups":[{"networkGroupId":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/test_network_manager_connect_config_crud000001/providers/Microsoft.Network/networkManagers/TestNetworkManager/networkGroups/TestNetworkGroup","groupConnectivity":"None","useHubGateway":"True","isGlobal":"False"}],"provisioningState":"Succeeded","deleteExistingPeering":"True","isGlobal":"True","resourceGuid":"eacdacaa-4471-4d1e-935f-d1c0a7418cb7"},"systemData":{"createdBy":"v-taoxuzeng@microsoft.com","createdByType":"User","createdAt":"2022-03-07T09:48:03.0672393Z","lastModifiedBy":"v-taoxuzeng@microsoft.com","lastModifiedByType":"User","lastModifiedAt":"2022-03-07T09:48:03.0672393Z"}}' headers: cache-control: - no-cache content-length: - - '1485' + - '1396' content-type: - application/json; charset=utf-8 date: - - Wed, 03 Nov 2021 03:00:49 GMT + - Mon, 07 Mar 2022 09:48:03 GMT expires: - '-1' pragma: @@ -168,7 +217,7 @@ interactions: x-content-type-options: - nosniff x-ms-ratelimit-remaining-subscription-writes: - - '1198' + - '1197' status: code: 200 message: OK @@ -186,22 +235,22 @@ interactions: ParameterSetName: - --configuration-name --network-manager-name -g User-Agent: - - AZURECLI/2.30.0 azsdk-python-mgmt-network/1.0.0b1 Python/3.8.3 (Windows-10-10.0.18362-SP0) + - AZURECLI/2.31.0 azsdk-python-mgmt-network/1.0.0b1 Python/3.9.5 (Windows-10-10.0.17763-SP0) method: GET - uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/test_network_manager_connect_config_crud000001/providers/Microsoft.Network/networkManagers/TestNetworkManager/connectivityConfigurations/myTestSecurityConfig?api-version=2021-02-01-preview + uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/test_network_manager_connect_config_crud000001/providers/Microsoft.Network/networkManagers/TestNetworkManager/connectivityConfigurations/myTestSecurityConfig?api-version=2021-05-01-preview response: body: - string: '{"name":"myTestSecurityConfig","id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/test_network_manager_connect_config_crud000001/providers/Microsoft.Network/networkManagers/TestNetworkManager/connectivityConfigurations/myTestSecurityConfig","type":"Microsoft.Network/networkManagers/connectivityConfigurations","etag":"\"2300c160-0000-3400-0000-6181fb610000\"","properties":{"displayName":"","description":"Sample - Configuration","connectivityTopology":"HubAndSpoke","hubs":[{"resourceType":"Microsoft.Network/virtualNetworks","resourceId":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/test_network_manager_connect_config_crud000001/providers/Microsoft.Network/virtualnetworks/clitest.vn000002"}],"appliesToGroups":[{"networkGroupId":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/test_network_manager_connect_config_crud000001/providers/Microsoft.Network/networkManagers/TestNetworkManager/networkGroups/TestNetworkGroup","groupConnectivity":"None","useHubGateway":"True","isGlobal":"False"}],"provisioningState":"Succeeded","deleteExistingPeering":"True","isGlobal":"True","resourceGuid":"4bb0d0d8-c751-4714-8567-42378a12a63a"},"systemData":{"createdBy":"v-kaisun@microsoft.com","createdByType":"User","createdAt":"2021-11-03T03:00:47.9613470Z","lastModifiedBy":"v-kaisun@microsoft.com","lastModifiedByType":"User","lastModifiedAt":"2021-11-03T03:00:47.9613470Z"}}' + string: '{"name":"myTestSecurityConfig","id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/test_network_manager_connect_config_crud000001/providers/Microsoft.Network/networkManagers/TestNetworkManager/connectivityConfigurations/myTestSecurityConfig","type":"Microsoft.Network/networkManagers/connectivityConfigurations","etag":"\"0000e17a-0000-3400-0000-6225d4d30000\"","properties":{"displayName":"","description":"Sample + Configuration","connectivityTopology":"HubAndSpoke","hubs":[{"resourceType":"Microsoft.Network/virtualNetworks","resourceId":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/test_network_manager_connect_config_crud000001/providers/Microsoft.Network/virtualnetworks/clitest.vn000002"}],"appliesToGroups":[{"networkGroupId":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/test_network_manager_connect_config_crud000001/providers/Microsoft.Network/networkManagers/TestNetworkManager/networkGroups/TestNetworkGroup","groupConnectivity":"None","useHubGateway":"True","isGlobal":"False"}],"provisioningState":"Succeeded","deleteExistingPeering":"True","isGlobal":"True","resourceGuid":"eacdacaa-4471-4d1e-935f-d1c0a7418cb7"},"systemData":{"createdBy":"v-taoxuzeng@microsoft.com","createdByType":"User","createdAt":"2022-03-07T09:48:03.0672393Z","lastModifiedBy":"v-taoxuzeng@microsoft.com","lastModifiedByType":"User","lastModifiedAt":"2022-03-07T09:48:03.0672393Z"}}' headers: cache-control: - no-cache content-length: - - '1525' + - '1436' content-type: - application/json; charset=utf-8 date: - - Wed, 03 Nov 2021 03:00:52 GMT + - Mon, 07 Mar 2022 09:48:05 GMT expires: - '-1' pragma: @@ -233,22 +282,22 @@ interactions: ParameterSetName: - --configuration-name --network-manager-name -g User-Agent: - - AZURECLI/2.30.0 azsdk-python-mgmt-network/1.0.0b1 Python/3.8.3 (Windows-10-10.0.18362-SP0) + - AZURECLI/2.31.0 azsdk-python-mgmt-network/1.0.0b1 Python/3.9.5 (Windows-10-10.0.17763-SP0) method: GET - uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/test_network_manager_connect_config_crud000001/providers/Microsoft.Network/networkManagers/TestNetworkManager/connectivityConfigurations/myTestSecurityConfig?api-version=2021-02-01-preview + uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/test_network_manager_connect_config_crud000001/providers/Microsoft.Network/networkManagers/TestNetworkManager/connectivityConfigurations/myTestSecurityConfig?api-version=2021-05-01-preview response: body: - string: '{"name":"myTestSecurityConfig","id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/test_network_manager_connect_config_crud000001/providers/Microsoft.Network/networkManagers/TestNetworkManager/connectivityConfigurations/myTestSecurityConfig","type":"Microsoft.Network/networkManagers/connectivityConfigurations","etag":"\"2300c160-0000-3400-0000-6181fb610000\"","properties":{"displayName":"","description":"Sample - Configuration","connectivityTopology":"HubAndSpoke","hubs":[{"resourceType":"Microsoft.Network/virtualNetworks","resourceId":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/test_network_manager_connect_config_crud000001/providers/Microsoft.Network/virtualnetworks/clitest.vn000002"}],"appliesToGroups":[{"networkGroupId":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/test_network_manager_connect_config_crud000001/providers/Microsoft.Network/networkManagers/TestNetworkManager/networkGroups/TestNetworkGroup","groupConnectivity":"None","useHubGateway":"True","isGlobal":"False"}],"provisioningState":"Succeeded","deleteExistingPeering":"True","isGlobal":"True","resourceGuid":"4bb0d0d8-c751-4714-8567-42378a12a63a"},"systemData":{"createdBy":"v-kaisun@microsoft.com","createdByType":"User","createdAt":"2021-11-03T03:00:47.9613470Z","lastModifiedBy":"v-kaisun@microsoft.com","lastModifiedByType":"User","lastModifiedAt":"2021-11-03T03:00:47.9613470Z"}}' + string: '{"name":"myTestSecurityConfig","id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/test_network_manager_connect_config_crud000001/providers/Microsoft.Network/networkManagers/TestNetworkManager/connectivityConfigurations/myTestSecurityConfig","type":"Microsoft.Network/networkManagers/connectivityConfigurations","etag":"\"0000e17a-0000-3400-0000-6225d4d30000\"","properties":{"displayName":"","description":"Sample + Configuration","connectivityTopology":"HubAndSpoke","hubs":[{"resourceType":"Microsoft.Network/virtualNetworks","resourceId":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/test_network_manager_connect_config_crud000001/providers/Microsoft.Network/virtualnetworks/clitest.vn000002"}],"appliesToGroups":[{"networkGroupId":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/test_network_manager_connect_config_crud000001/providers/Microsoft.Network/networkManagers/TestNetworkManager/networkGroups/TestNetworkGroup","groupConnectivity":"None","useHubGateway":"True","isGlobal":"False"}],"provisioningState":"Succeeded","deleteExistingPeering":"True","isGlobal":"True","resourceGuid":"eacdacaa-4471-4d1e-935f-d1c0a7418cb7"},"systemData":{"createdBy":"v-taoxuzeng@microsoft.com","createdByType":"User","createdAt":"2022-03-07T09:48:03.0672393Z","lastModifiedBy":"v-taoxuzeng@microsoft.com","lastModifiedByType":"User","lastModifiedAt":"2022-03-07T09:48:03.0672393Z"}}' headers: cache-control: - no-cache content-length: - - '1525' + - '1436' content-type: - application/json; charset=utf-8 date: - - Wed, 03 Nov 2021 03:00:56 GMT + - Mon, 07 Mar 2022 09:48:07 GMT expires: - '-1' pragma: @@ -283,28 +332,28 @@ interactions: Connection: - keep-alive Content-Length: - - '816' + - '750' Content-Type: - application/json ParameterSetName: - --configuration-name --network-manager-name -g User-Agent: - - AZURECLI/2.30.0 azsdk-python-mgmt-network/1.0.0b1 Python/3.8.3 (Windows-10-10.0.18362-SP0) + - AZURECLI/2.31.0 azsdk-python-mgmt-network/1.0.0b1 Python/3.9.5 (Windows-10-10.0.17763-SP0) method: PUT - uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/test_network_manager_connect_config_crud000001/providers/Microsoft.Network/networkManagers/TestNetworkManager/connectivityConfigurations/myTestSecurityConfig?api-version=2021-02-01-preview + uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/test_network_manager_connect_config_crud000001/providers/Microsoft.Network/networkManagers/TestNetworkManager/connectivityConfigurations/myTestSecurityConfig?api-version=2021-05-01-preview response: body: string: '{"name":"myTestSecurityConfig","id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/test_network_manager_connect_config_crud000001/providers/Microsoft.Network/networkManagers/TestNetworkManager/connectivityConfigurations/myTestSecurityConfig","type":"Microsoft.Network/networkManagers/connectivityConfigurations","etag":"","properties":{"displayName":"","description":"Sample - Configuration","connectivityTopology":"HubAndSpoke","hubs":[{"resourceType":"Microsoft.Network/virtualNetworks","resourceId":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/test_network_manager_connect_config_crud000001/providers/Microsoft.Network/virtualnetworks/clitest.vn000002"}],"appliesToGroups":[{"networkGroupId":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/test_network_manager_connect_config_crud000001/providers/Microsoft.Network/networkManagers/TestNetworkManager/networkGroups/TestNetworkGroup","groupConnectivity":"None","useHubGateway":"True","isGlobal":"False"}],"provisioningState":"Succeeded","deleteExistingPeering":"True","isGlobal":"True","resourceGuid":"4bb0d0d8-c751-4714-8567-42378a12a63a"},"systemData":{"createdBy":"v-kaisun@microsoft.com","createdByType":"User","createdAt":"2021-11-03T03:00:47.9613470Z","lastModifiedBy":"v-kaisun@microsoft.com","lastModifiedByType":"User","lastModifiedAt":"2021-11-03T03:00:58.8038991Z"}}' + Configuration","connectivityTopology":"HubAndSpoke","hubs":[{"resourceType":"Microsoft.Network/virtualNetworks","resourceId":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/test_network_manager_connect_config_crud000001/providers/Microsoft.Network/virtualnetworks/clitest.vn000002"}],"appliesToGroups":[{"networkGroupId":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/test_network_manager_connect_config_crud000001/providers/Microsoft.Network/networkManagers/TestNetworkManager/networkGroups/TestNetworkGroup","groupConnectivity":"None","useHubGateway":"True","isGlobal":"False"}],"provisioningState":"Succeeded","deleteExistingPeering":"True","isGlobal":"True","resourceGuid":"eacdacaa-4471-4d1e-935f-d1c0a7418cb7"},"systemData":{"createdBy":"v-taoxuzeng@microsoft.com","createdByType":"User","createdAt":"2022-03-07T09:48:03.0672393Z","lastModifiedBy":"v-taoxuzeng@microsoft.com","lastModifiedByType":"User","lastModifiedAt":"2022-03-07T09:48:08.4215097Z"}}' headers: cache-control: - no-cache content-length: - - '1485' + - '1396' content-type: - application/json; charset=utf-8 date: - - Wed, 03 Nov 2021 03:00:59 GMT + - Mon, 07 Mar 2022 09:48:09 GMT expires: - '-1' pragma: @@ -320,7 +369,7 @@ interactions: x-content-type-options: - nosniff x-ms-ratelimit-remaining-subscription-writes: - - '1199' + - '1196' status: code: 200 message: OK @@ -338,22 +387,22 @@ interactions: ParameterSetName: - --network-manager-name -g User-Agent: - - AZURECLI/2.30.0 azsdk-python-mgmt-network/1.0.0b1 Python/3.8.3 (Windows-10-10.0.18362-SP0) + - AZURECLI/2.31.0 azsdk-python-mgmt-network/1.0.0b1 Python/3.9.5 (Windows-10-10.0.17763-SP0) method: GET - uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/test_network_manager_connect_config_crud000001/providers/Microsoft.Network/networkManagers/TestNetworkManager/connectivityConfigurations?api-version=2021-02-01-preview + uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/test_network_manager_connect_config_crud000001/providers/Microsoft.Network/networkManagers/TestNetworkManager/connectivityConfigurations?api-version=2021-05-01-preview response: body: - string: '{"nextLink":"","value":[{"name":"myTestSecurityConfig","id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/test_network_manager_connect_config_crud000001/providers/Microsoft.Network/networkManagers/TestNetworkManager/connectivityConfigurations/myTestSecurityConfig","type":"Microsoft.Network/networkManagers/connectivityConfigurations","etag":"\"2300c760-0000-3400-0000-6181fb6b0000\"","properties":{"displayName":"","description":"Sample - Configuration","connectivityTopology":"HubAndSpoke","hubs":[{"resourceType":"Microsoft.Network/virtualNetworks","resourceId":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/test_network_manager_connect_config_crud000001/providers/Microsoft.Network/virtualnetworks/clitest.vn000002"}],"appliesToGroups":[{"networkGroupId":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/test_network_manager_connect_config_crud000001/providers/Microsoft.Network/networkManagers/TestNetworkManager/networkGroups/TestNetworkGroup","groupConnectivity":"None","useHubGateway":"True","isGlobal":"False"}],"provisioningState":"Succeeded","deleteExistingPeering":"True","isGlobal":"True","resourceGuid":"4bb0d0d8-c751-4714-8567-42378a12a63a"},"systemData":{"createdBy":"v-kaisun@microsoft.com","createdByType":"User","createdAt":"2021-11-03T03:00:47.9613470Z","lastModifiedBy":"v-kaisun@microsoft.com","lastModifiedByType":"User","lastModifiedAt":"2021-11-03T03:00:58.8038991Z"}}]}' + string: '{"nextLink":"","value":[{"name":"myTestSecurityConfig","id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/test_network_manager_connect_config_crud000001/providers/Microsoft.Network/networkManagers/TestNetworkManager/connectivityConfigurations/myTestSecurityConfig","type":"Microsoft.Network/networkManagers/connectivityConfigurations","etag":"\"0000e27a-0000-3400-0000-6225d4d90000\"","properties":{"displayName":"","description":"Sample + Configuration","connectivityTopology":"HubAndSpoke","hubs":[{"resourceType":"Microsoft.Network/virtualNetworks","resourceId":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/test_network_manager_connect_config_crud000001/providers/Microsoft.Network/virtualnetworks/clitest.vn000002"}],"appliesToGroups":[{"networkGroupId":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/test_network_manager_connect_config_crud000001/providers/Microsoft.Network/networkManagers/TestNetworkManager/networkGroups/TestNetworkGroup","groupConnectivity":"None","useHubGateway":"True","isGlobal":"False"}],"provisioningState":"Succeeded","deleteExistingPeering":"True","isGlobal":"True","resourceGuid":"eacdacaa-4471-4d1e-935f-d1c0a7418cb7"},"systemData":{"createdBy":"v-taoxuzeng@microsoft.com","createdByType":"User","createdAt":"2022-03-07T09:48:03.0672393Z","lastModifiedBy":"v-taoxuzeng@microsoft.com","lastModifiedByType":"User","lastModifiedAt":"2022-03-07T09:48:08.4215097Z"}}]}' headers: cache-control: - no-cache content-length: - - '1551' + - '1462' content-type: - application/json; charset=utf-8 date: - - Wed, 03 Nov 2021 03:01:03 GMT + - Mon, 07 Mar 2022 09:48:10 GMT expires: - '-1' pragma: @@ -387,9 +436,9 @@ interactions: ParameterSetName: - --configuration-name --network-manager-name -g --yes User-Agent: - - AZURECLI/2.30.0 azsdk-python-mgmt-network/1.0.0b1 Python/3.8.3 (Windows-10-10.0.18362-SP0) + - AZURECLI/2.31.0 azsdk-python-mgmt-network/1.0.0b1 Python/3.9.5 (Windows-10-10.0.17763-SP0) method: DELETE - uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/test_network_manager_connect_config_crud000001/providers/Microsoft.Network/networkManagers/TestNetworkManager/connectivityConfigurations/myTestSecurityConfig?api-version=2021-02-01-preview + uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/test_network_manager_connect_config_crud000001/providers/Microsoft.Network/networkManagers/TestNetworkManager/connectivityConfigurations/myTestSecurityConfig?api-version=2021-05-01-preview response: body: string: '' @@ -399,7 +448,7 @@ interactions: content-length: - '0' date: - - Wed, 03 Nov 2021 03:01:06 GMT + - Mon, 07 Mar 2022 09:48:12 GMT expires: - '-1' pragma: @@ -415,4 +464,92 @@ interactions: status: code: 200 message: OK +- request: + body: null + headers: + Accept: + - application/json + Accept-Encoding: + - gzip, deflate + CommandName: + - network manager group delete + Connection: + - keep-alive + Content-Length: + - '0' + ParameterSetName: + - -g --name --network-manager-name --force --yes + User-Agent: + - AZURECLI/2.31.0 azsdk-python-mgmt-network/1.0.0b1 Python/3.9.5 (Windows-10-10.0.17763-SP0) + method: DELETE + uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/test_network_manager_connect_config_crud000001/providers/Microsoft.Network/networkManagers/TestNetworkManager/networkGroups/TestNetworkGroup?api-version=2021-05-01-preview&force=true + response: + body: + string: '' + headers: + cache-control: + - no-cache + content-length: + - '0' + date: + - Mon, 07 Mar 2022 09:48:13 GMT + expires: + - '-1' + pragma: + - no-cache + server: + - Kestrel + strict-transport-security: + - max-age=31536000; includeSubDomains + x-content-type-options: + - nosniff + x-ms-ratelimit-remaining-subscription-deletes: + - '14999' + status: + code: 200 + message: OK +- request: + body: null + headers: + Accept: + - application/json + Accept-Encoding: + - gzip, deflate + CommandName: + - network manager delete + Connection: + - keep-alive + Content-Length: + - '0' + ParameterSetName: + - --resource-group --name --yes + User-Agent: + - AZURECLI/2.31.0 azsdk-python-mgmt-network/1.0.0b1 Python/3.9.5 (Windows-10-10.0.17763-SP0) + method: DELETE + uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/test_network_manager_connect_config_crud000001/providers/Microsoft.Network/networkManagers/TestNetworkManager?api-version=2021-05-01-preview + response: + body: + string: '' + headers: + cache-control: + - no-cache + content-length: + - '0' + date: + - Mon, 07 Mar 2022 09:48:19 GMT + expires: + - '-1' + pragma: + - no-cache + server: + - Kestrel + strict-transport-security: + - max-age=31536000; includeSubDomains + x-content-type-options: + - nosniff + x-ms-ratelimit-remaining-subscription-deletes: + - '14997' + status: + code: 200 + message: OK version: 1 diff --git a/src/network-manager/azext_network_manager/tests/latest/recordings/test_network_manager_connection_subscription.yaml b/src/network-manager/azext_network_manager/tests/latest/recordings/test_network_manager_connection_subscription.yaml new file mode 100644 index 00000000000..be51c798f6b --- /dev/null +++ b/src/network-manager/azext_network_manager/tests/latest/recordings/test_network_manager_connection_subscription.yaml @@ -0,0 +1,395 @@ +interactions: +- request: + body: '{"location": "eastus2euap", "properties": {"displayName": "TestNetworkManager", + "description": "My Test Network Manager", "networkManagerScopes": {"subscriptions": + ["/subscriptions/00000000-0000-0000-0000-000000000000"]}, "networkManagerScopeAccesses": + ["SecurityAdmin", "Connectivity"]}}' + headers: + Accept: + - application/json + Accept-Encoding: + - gzip, deflate + CommandName: + - network manager create + Connection: + - keep-alive + Content-Length: + - '288' + Content-Type: + - application/json + ParameterSetName: + - --name --description --display-name --scope-accesses --network-manager-scopes + -l --resource-group + User-Agent: + - AZURECLI/2.31.0 azsdk-python-mgmt-network/1.0.0b1 Python/3.9.5 (Windows-10-10.0.17763-SP0) + method: PUT + uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/test_network_manager_connection_subscription000001/providers/Microsoft.Network/networkManagers/TestNetworkManager?api-version=2021-05-01-preview + response: + body: + string: '{"name":"TestNetworkManager","id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/test_network_manager_connection_subscription000001/providers/Microsoft.Network/networkManagers/TestNetworkManager","location":"eastus2euap","type":"Microsoft.Network/networkManagers","tags":{},"etag":"","properties":{"displayName":"TestNetworkManager","description":"My + Test Network Manager","networkManagerScopes":{"managementGroups":[],"subscriptions":["/subscriptions/00000000-0000-0000-0000-000000000000"],"multiTenantScopes":[]},"provisioningState":"Succeeded","networkManagerScopeAccesses":["SecurityAdmin","Connectivity"],"resourceGuid":"a10535d2-8be0-469f-93ba-9fc26969a3a6"},"systemData":{"createdBy":"v-taoxuzeng@microsoft.com","createdByType":"User","createdAt":"2022-03-07T15:17:35.1646038Z","lastModifiedBy":"v-taoxuzeng@microsoft.com","lastModifiedByType":"User","lastModifiedAt":"2022-03-07T15:17:35.1646038Z"}}' + headers: + cache-control: + - no-cache + content-length: + - '928' + content-type: + - application/json; charset=utf-8 + date: + - Mon, 07 Mar 2022 15:17:40 GMT + expires: + - '-1' + pragma: + - no-cache + server: + - Kestrel + strict-transport-security: + - max-age=31536000; includeSubDomains + transfer-encoding: + - chunked + vary: + - Accept-Encoding + x-content-type-options: + - nosniff + x-ms-ratelimit-remaining-subscription-writes: + - '1197' + status: + code: 200 + message: OK +- request: + body: '{"properties": {"networkManagerId": "/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/test_network_manager_connection_subscription000001/providers/Microsoft.Network/networkManagers/TestNetworkManager", + "description": "My Test Network Manager Connection"}}' + headers: + Accept: + - application/json + Accept-Encoding: + - gzip, deflate + CommandName: + - network manager connection subscription create + Connection: + - keep-alive + Content-Length: + - '273' + Content-Type: + - application/json + ParameterSetName: + - --connection-name --description --network-manager-id + User-Agent: + - AZURECLI/2.31.0 azsdk-python-mgmt-network/1.0.0b1 Python/3.9.5 (Windows-10-10.0.17763-SP0) + method: PUT + uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.Network/networkManagerConnections/myTestNetworkManagerConnection?api-version=2021-05-01-preview + response: + body: + string: '{"id":"/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.Network/networkManagerConnections/myTestNetworkManagerConnection","name":"myTestNetworkManagerConnection","type":"Microsoft.Network/networkManagers/networkManagerConnections","location":"","properties":{"networkManagerId":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/test_network_manager_connection_subscription000001/providers/Microsoft.Network/networkManagers/TestNetworkManager","connectionState":"Pending","description":"My + Test Network Manager Connection"}}' + headers: + cache-control: + - no-cache + content-length: + - '564' + content-type: + - application/json; charset=utf-8 + date: + - Mon, 07 Mar 2022 15:17:44 GMT + expires: + - '-1' + pragma: + - no-cache + server: + - Kestrel + strict-transport-security: + - max-age=31536000; includeSubDomains + transfer-encoding: + - chunked + vary: + - Accept-Encoding + x-content-type-options: + - nosniff + x-ms-ratelimit-remaining-subscription-writes: + - '1197' + status: + code: 200 + message: OK +- request: + body: null + headers: + Accept: + - application/json + Accept-Encoding: + - gzip, deflate + CommandName: + - network manager connection subscription show + Connection: + - keep-alive + ParameterSetName: + - --connection-name + User-Agent: + - AZURECLI/2.31.0 azsdk-python-mgmt-network/1.0.0b1 Python/3.9.5 (Windows-10-10.0.17763-SP0) + method: GET + uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.Network/networkManagerConnections/myTestNetworkManagerConnection?api-version=2021-05-01-preview + response: + body: + string: '{"id":"/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.Network/networkManagerConnections/myTestNetworkManagerConnection","name":"myTestNetworkManagerConnection","type":"Microsoft.Network/networkManagers/networkManagerConnections","location":"","properties":{"networkManagerId":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/test_network_manager_connection_subscription000001/providers/Microsoft.Network/networkManagers/TestNetworkManager","connectionState":"Pending","description":"My + Test Network Manager Connection"}}' + headers: + cache-control: + - no-cache + content-length: + - '564' + content-type: + - application/json; charset=utf-8 + date: + - Mon, 07 Mar 2022 15:17:47 GMT + expires: + - '-1' + pragma: + - no-cache + server: + - Kestrel + strict-transport-security: + - max-age=31536000; includeSubDomains + transfer-encoding: + - chunked + vary: + - Accept-Encoding + x-content-type-options: + - nosniff + status: + code: 200 + message: OK +- request: + body: null + headers: + Accept: + - application/json + Accept-Encoding: + - gzip, deflate + CommandName: + - network manager connection subscription update + Connection: + - keep-alive + ParameterSetName: + - --connection-name --description + User-Agent: + - AZURECLI/2.31.0 azsdk-python-mgmt-network/1.0.0b1 Python/3.9.5 (Windows-10-10.0.17763-SP0) + method: GET + uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.Network/networkManagerConnections/myTestNetworkManagerConnection?api-version=2021-05-01-preview + response: + body: + string: '{"id":"/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.Network/networkManagerConnections/myTestNetworkManagerConnection","name":"myTestNetworkManagerConnection","type":"Microsoft.Network/networkManagers/networkManagerConnections","location":"","properties":{"networkManagerId":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/test_network_manager_connection_subscription000001/providers/Microsoft.Network/networkManagers/TestNetworkManager","connectionState":"Pending","description":"My + Test Network Manager Connection"}}' + headers: + cache-control: + - no-cache + content-length: + - '564' + content-type: + - application/json; charset=utf-8 + date: + - Mon, 07 Mar 2022 15:17:49 GMT + expires: + - '-1' + pragma: + - no-cache + server: + - Kestrel + strict-transport-security: + - max-age=31536000; includeSubDomains + transfer-encoding: + - chunked + vary: + - Accept-Encoding + x-content-type-options: + - nosniff + status: + code: 200 + message: OK +- request: + body: '{"properties": {"networkManagerId": "/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/test_network_manager_connection_subscription000001/providers/Microsoft.Network/networkManagers/TestNetworkManager", + "description": "My Test Network Manager Connection Updated Description"}}' + headers: + Accept: + - application/json + Accept-Encoding: + - gzip, deflate + CommandName: + - network manager connection subscription update + Connection: + - keep-alive + Content-Length: + - '293' + Content-Type: + - application/json + ParameterSetName: + - --connection-name --description + User-Agent: + - AZURECLI/2.31.0 azsdk-python-mgmt-network/1.0.0b1 Python/3.9.5 (Windows-10-10.0.17763-SP0) + method: PUT + uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.Network/networkManagerConnections/myTestNetworkManagerConnection?api-version=2021-05-01-preview + response: + body: + string: '{"id":"/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.Network/networkManagerConnections/myTestNetworkManagerConnection","name":"myTestNetworkManagerConnection","type":"Microsoft.Network/networkManagers/networkManagerConnections","location":"","properties":{"networkManagerId":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/test_network_manager_connection_subscription000001/providers/Microsoft.Network/networkManagers/TestNetworkManager","connectionState":"Pending","description":"My + Test Network Manager Connection Updated Description"}}' + headers: + cache-control: + - no-cache + content-length: + - '584' + content-type: + - application/json; charset=utf-8 + date: + - Mon, 07 Mar 2022 15:17:52 GMT + expires: + - '-1' + pragma: + - no-cache + server: + - Kestrel + strict-transport-security: + - max-age=31536000; includeSubDomains + transfer-encoding: + - chunked + vary: + - Accept-Encoding + x-content-type-options: + - nosniff + x-ms-ratelimit-remaining-subscription-writes: + - '1197' + status: + code: 200 + message: OK +- request: + body: null + headers: + Accept: + - application/json + Accept-Encoding: + - gzip, deflate + CommandName: + - network manager connection subscription list + Connection: + - keep-alive + User-Agent: + - AZURECLI/2.31.0 azsdk-python-mgmt-network/1.0.0b1 Python/3.9.5 (Windows-10-10.0.17763-SP0) + method: GET + uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.Network/networkManagerConnections?api-version=2021-05-01-preview + response: + body: + string: '{"value":[{"id":"/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.Network/networkManagerConnections/testConnection","name":"testConnection","type":"Microsoft.Network/networkManagers/networkManagerConnections","location":"","properties":{"networkManagerId":"","connectionState":"Pending","description":"My + Test Network Manager Connection"}},{"id":"/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.Network/networkManagerConnections/myTestNetworkManagerConnection","name":"myTestNetworkManagerConnection","type":"Microsoft.Network/networkManagers/networkManagerConnections","location":"","properties":{"networkManagerId":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/test_network_manager_connection_subscription000001/providers/Microsoft.Network/networkManagers/TestNetworkManager","connectionState":"Pending","description":"My + Test Network Manager Connection Updated Description"}}],"nextLink":""}' + headers: + cache-control: + - no-cache + content-length: + - '963' + content-type: + - application/json; charset=utf-8 + date: + - Mon, 07 Mar 2022 15:17:54 GMT + expires: + - '-1' + pragma: + - no-cache + server: + - Kestrel + strict-transport-security: + - max-age=31536000; includeSubDomains + transfer-encoding: + - chunked + vary: + - Accept-Encoding + x-content-type-options: + - nosniff + status: + code: 200 + message: OK +- request: + body: null + headers: + Accept: + - application/json + Accept-Encoding: + - gzip, deflate + CommandName: + - network manager connection subscription delete + Connection: + - keep-alive + Content-Length: + - '0' + ParameterSetName: + - --connection-name --yes + User-Agent: + - AZURECLI/2.31.0 azsdk-python-mgmt-network/1.0.0b1 Python/3.9.5 (Windows-10-10.0.17763-SP0) + method: DELETE + uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.Network/networkManagerConnections/myTestNetworkManagerConnection?api-version=2021-05-01-preview + response: + body: + string: '' + headers: + cache-control: + - no-cache + content-length: + - '0' + date: + - Mon, 07 Mar 2022 15:17:58 GMT + expires: + - '-1' + pragma: + - no-cache + server: + - Kestrel + strict-transport-security: + - max-age=31536000; includeSubDomains + x-content-type-options: + - nosniff + x-ms-ratelimit-remaining-subscription-deletes: + - '14997' + status: + code: 200 + message: OK +- request: + body: null + headers: + Accept: + - application/json + Accept-Encoding: + - gzip, deflate + CommandName: + - network manager delete + Connection: + - keep-alive + Content-Length: + - '0' + ParameterSetName: + - --resource-group --name --yes + User-Agent: + - AZURECLI/2.31.0 azsdk-python-mgmt-network/1.0.0b1 Python/3.9.5 (Windows-10-10.0.17763-SP0) + method: DELETE + uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/test_network_manager_connection_subscription000001/providers/Microsoft.Network/networkManagers/TestNetworkManager?api-version=2021-05-01-preview + response: + body: + string: '' + headers: + cache-control: + - no-cache + content-length: + - '0' + date: + - Mon, 07 Mar 2022 15:18:03 GMT + expires: + - '-1' + pragma: + - no-cache + server: + - Kestrel + strict-transport-security: + - max-age=31536000; includeSubDomains + x-content-type-options: + - nosniff + x-ms-ratelimit-remaining-subscription-deletes: + - '14995' + status: + code: 200 + message: OK +version: 1 diff --git a/src/network-manager/azext_network_manager/tests/latest/recordings/test_network_manager_crud.yaml b/src/network-manager/azext_network_manager/tests/latest/recordings/test_network_manager_crud.yaml index c05527c079d..357b1a70027 100644 --- a/src/network-manager/azext_network_manager/tests/latest/recordings/test_network_manager_crud.yaml +++ b/src/network-manager/azext_network_manager/tests/latest/recordings/test_network_manager_crud.yaml @@ -21,22 +21,22 @@ interactions: - --name --description --display-name --scope-accesses --network-manager-scopes -l --resource-group User-Agent: - - AZURECLI/2.30.0 azsdk-python-mgmt-network/1.0.0b1 Python/3.8.3 (Windows-10-10.0.18362-SP0) + - AZURECLI/2.31.0 azsdk-python-mgmt-network/1.0.0b1 Python/3.9.5 (Windows-10-10.0.17763-SP0) method: PUT - uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/test_network_manager000001/providers/Microsoft.Network/networkManagers/TestNetworkManager?api-version=2021-02-01-preview + uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/test_network_manager_crud000001/providers/Microsoft.Network/networkManagers/TestNetworkManager?api-version=2021-05-01-preview response: body: - string: '{"name":"TestNetworkManager","id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/test_network_manager000001/providers/Microsoft.Network/networkManagers/TestNetworkManager","location":"eastus2euap","type":"Microsoft.Network/networkManagers","tags":{},"etag":"","properties":{"displayName":"TestNetworkManager","description":"My - Test Network Manager","networkManagerScopes":{"managementGroups":[],"subscriptions":["/subscriptions/00000000-0000-0000-0000-000000000000"]},"provisioningState":"Succeeded","networkManagerScopeAccesses":["Connectivity"],"resourceGuid":"8d070ee4-5208-4663-a470-7f1c92e0a5da"},"systemData":{"createdBy":"v-kaisun@microsoft.com","createdByType":"User","createdAt":"2021-11-02T09:45:15.6699961Z","lastModifiedBy":"v-kaisun@microsoft.com","lastModifiedByType":"User","lastModifiedAt":"2021-11-02T09:45:15.6699961Z"}}' + string: '{"name":"TestNetworkManager","id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/test_network_manager_crud000001/providers/Microsoft.Network/networkManagers/TestNetworkManager","location":"eastus2euap","type":"Microsoft.Network/networkManagers","tags":{},"etag":"","properties":{"displayName":"TestNetworkManager","description":"My + Test Network Manager","networkManagerScopes":{"managementGroups":[],"subscriptions":["/subscriptions/00000000-0000-0000-0000-000000000000"],"multiTenantScopes":[]},"provisioningState":"Succeeded","networkManagerScopeAccesses":["Connectivity"],"resourceGuid":"c23470b9-a24c-4d16-924d-eb6cf6861da6"},"systemData":{"createdBy":"v-taoxuzeng@microsoft.com","createdByType":"User","createdAt":"2022-03-07T15:30:59.4610174Z","lastModifiedBy":"v-taoxuzeng@microsoft.com","lastModifiedByType":"User","lastModifiedAt":"2022-03-07T15:30:59.4610174Z"}}' headers: cache-control: - no-cache content-length: - - '908' + - '893' content-type: - application/json; charset=utf-8 date: - - Tue, 02 Nov 2021 09:45:22 GMT + - Mon, 07 Mar 2022 15:31:04 GMT expires: - '-1' pragma: @@ -52,7 +52,7 @@ interactions: x-content-type-options: - nosniff x-ms-ratelimit-remaining-subscription-writes: - - '1199' + - '1197' status: code: 200 message: OK @@ -70,22 +70,22 @@ interactions: ParameterSetName: - --resource-group --name User-Agent: - - AZURECLI/2.30.0 azsdk-python-mgmt-network/1.0.0b1 Python/3.8.3 (Windows-10-10.0.18362-SP0) + - AZURECLI/2.31.0 azsdk-python-mgmt-network/1.0.0b1 Python/3.9.5 (Windows-10-10.0.17763-SP0) method: GET - uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/test_network_manager000001/providers/Microsoft.Network/networkManagers/TestNetworkManager?api-version=2021-02-01-preview + uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/test_network_manager_crud000001/providers/Microsoft.Network/networkManagers/TestNetworkManager?api-version=2021-05-01-preview response: body: - string: '{"name":"TestNetworkManager","id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/test_network_manager000001/providers/Microsoft.Network/networkManagers/TestNetworkManager","location":"eastus2euap","type":"Microsoft.Network/networkManagers","tags":{},"etag":"\"21000dbc-0000-3400-0000-618108b10000\"","properties":{"displayName":"TestNetworkManager","description":"My - Test Network Manager","networkManagerScopes":{"managementGroups":[],"subscriptions":["/subscriptions/00000000-0000-0000-0000-000000000000"]},"provisioningState":"Succeeded","networkManagerScopeAccesses":["Connectivity"],"resourceGuid":"8d070ee4-5208-4663-a470-7f1c92e0a5da"},"systemData":{"createdBy":"v-kaisun@microsoft.com","createdByType":"User","createdAt":"2021-11-02T09:45:15.6699961Z","lastModifiedBy":"v-kaisun@microsoft.com","lastModifiedByType":"User","lastModifiedAt":"2021-11-02T09:45:15.6699961Z"}}' + string: '{"name":"TestNetworkManager","id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/test_network_manager_crud000001/providers/Microsoft.Network/networkManagers/TestNetworkManager","location":"eastus2euap","type":"Microsoft.Network/networkManagers","tags":{},"etag":"\"0000397f-0000-3400-0000-622625370000\"","properties":{"displayName":"TestNetworkManager","description":"My + Test Network Manager","networkManagerScopes":{"managementGroups":[],"subscriptions":["/subscriptions/00000000-0000-0000-0000-000000000000"],"multiTenantScopes":[]},"provisioningState":"Succeeded","networkManagerScopeAccesses":["Connectivity"],"resourceGuid":"c23470b9-a24c-4d16-924d-eb6cf6861da6"},"systemData":{"createdBy":"v-taoxuzeng@microsoft.com","createdByType":"User","createdAt":"2022-03-07T15:30:59.4610174Z","lastModifiedBy":"v-taoxuzeng@microsoft.com","lastModifiedByType":"User","lastModifiedAt":"2022-03-07T15:30:59.4610174Z"}}' headers: cache-control: - no-cache content-length: - - '948' + - '933' content-type: - application/json; charset=utf-8 date: - - Tue, 02 Nov 2021 09:45:25 GMT + - Mon, 07 Mar 2022 15:31:05 GMT expires: - '-1' pragma: @@ -117,22 +117,22 @@ interactions: ParameterSetName: - --resource-group User-Agent: - - AZURECLI/2.30.0 azsdk-python-mgmt-network/1.0.0b1 Python/3.8.3 (Windows-10-10.0.18362-SP0) + - AZURECLI/2.31.0 azsdk-python-mgmt-network/1.0.0b1 Python/3.9.5 (Windows-10-10.0.17763-SP0) method: GET - uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/test_network_manager000001/providers/Microsoft.Network/networkManagers?api-version=2021-02-01-preview + uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/test_network_manager_crud000001/providers/Microsoft.Network/networkManagers?api-version=2021-05-01-preview response: body: - string: '{"nextLink":"","value":[{"name":"TestNetworkManager","id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/test_network_manager000001/providers/Microsoft.Network/networkManagers/TestNetworkManager","location":"eastus2euap","type":"Microsoft.Network/networkManagers","tags":{},"etag":"\"21000dbc-0000-3400-0000-618108b10000\"","properties":{"displayName":"TestNetworkManager","description":"My - Test Network Manager","networkManagerScopes":{"managementGroups":[],"subscriptions":["/subscriptions/00000000-0000-0000-0000-000000000000"]},"provisioningState":"Succeeded","networkManagerScopeAccesses":["Connectivity"],"resourceGuid":"8d070ee4-5208-4663-a470-7f1c92e0a5da"},"systemData":{"createdBy":"v-kaisun@microsoft.com","createdByType":"User","createdAt":"2021-11-02T09:45:15.6699961Z","lastModifiedBy":"v-kaisun@microsoft.com","lastModifiedByType":"User","lastModifiedAt":"2021-11-02T09:45:15.6699961Z"}}]}' + string: '{"nextLink":"","value":[{"name":"TestNetworkManager","id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/test_network_manager_crud000001/providers/Microsoft.Network/networkManagers/TestNetworkManager","location":"eastus2euap","type":"Microsoft.Network/networkManagers","tags":{},"etag":"\"0000397f-0000-3400-0000-622625370000\"","properties":{"displayName":"TestNetworkManager","description":"My + Test Network Manager","networkManagerScopes":{"managementGroups":[],"subscriptions":["/subscriptions/00000000-0000-0000-0000-000000000000"],"multiTenantScopes":[]},"provisioningState":"Succeeded","networkManagerScopeAccesses":["Connectivity"],"resourceGuid":"c23470b9-a24c-4d16-924d-eb6cf6861da6"},"systemData":{"createdBy":"v-taoxuzeng@microsoft.com","createdByType":"User","createdAt":"2022-03-07T15:30:59.4610174Z","lastModifiedBy":"v-taoxuzeng@microsoft.com","lastModifiedByType":"User","lastModifiedAt":"2022-03-07T15:30:59.4610174Z"}}]}' headers: cache-control: - no-cache content-length: - - '974' + - '959' content-type: - application/json; charset=utf-8 date: - - Tue, 02 Nov 2021 09:45:28 GMT + - Mon, 07 Mar 2022 15:31:08 GMT expires: - '-1' pragma: @@ -166,9 +166,9 @@ interactions: ParameterSetName: - --resource-group --name --yes User-Agent: - - AZURECLI/2.30.0 azsdk-python-mgmt-network/1.0.0b1 Python/3.8.3 (Windows-10-10.0.18362-SP0) + - AZURECLI/2.31.0 azsdk-python-mgmt-network/1.0.0b1 Python/3.9.5 (Windows-10-10.0.17763-SP0) method: DELETE - uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/test_network_manager000001/providers/Microsoft.Network/networkManagers/TestNetworkManager?api-version=2021-02-01-preview + uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/test_network_manager_crud000001/providers/Microsoft.Network/networkManagers/TestNetworkManager?api-version=2021-05-01-preview response: body: string: '' @@ -178,7 +178,7 @@ interactions: content-length: - '0' date: - - Tue, 02 Nov 2021 09:45:36 GMT + - Mon, 07 Mar 2022 15:31:15 GMT expires: - '-1' pragma: diff --git a/src/network-manager/azext_network_manager/tests/latest/recordings/test_network_manager_group_crud.yaml b/src/network-manager/azext_network_manager/tests/latest/recordings/test_network_manager_group_crud.yaml index ba4316e9e7e..5b8d4b23aef 100644 --- a/src/network-manager/azext_network_manager/tests/latest/recordings/test_network_manager_group_crud.yaml +++ b/src/network-manager/azext_network_manager/tests/latest/recordings/test_network_manager_group_crud.yaml @@ -21,22 +21,22 @@ interactions: - --name --description --display-name --scope-accesses --network-manager-scopes -l --resource-group User-Agent: - - AZURECLI/2.30.0 azsdk-python-mgmt-network/1.0.0b1 Python/3.8.3 (Windows-10-10.0.18362-SP0) + - AZURECLI/2.31.0 azsdk-python-mgmt-network/1.0.0b1 Python/3.9.5 (Windows-10-10.0.17763-SP0) method: PUT - uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/test_network_manager_group000001/providers/Microsoft.Network/networkManagers/TestNetworkManager?api-version=2021-02-01-preview + uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/test_network_manager_group000001/providers/Microsoft.Network/networkManagers/TestNetworkManager?api-version=2021-05-01-preview response: body: string: '{"name":"TestNetworkManager","id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/test_network_manager_group000001/providers/Microsoft.Network/networkManagers/TestNetworkManager","location":"eastus2euap","type":"Microsoft.Network/networkManagers","tags":{},"etag":"","properties":{"displayName":"TestNetworkManager","description":"My - Test Network Manager","networkManagerScopes":{"managementGroups":[],"subscriptions":["/subscriptions/00000000-0000-0000-0000-000000000000"]},"provisioningState":"Succeeded","networkManagerScopeAccesses":["Connectivity"],"resourceGuid":"ddf760e4-4e95-4664-9351-28d52b4716b6"},"systemData":{"createdBy":"v-kaisun@microsoft.com","createdByType":"User","createdAt":"2021-11-02T09:42:58.2186451Z","lastModifiedBy":"v-kaisun@microsoft.com","lastModifiedByType":"User","lastModifiedAt":"2021-11-02T09:42:58.2186451Z"}}' + Test Network Manager","networkManagerScopes":{"managementGroups":[],"subscriptions":["/subscriptions/00000000-0000-0000-0000-000000000000"],"multiTenantScopes":[]},"provisioningState":"Succeeded","networkManagerScopeAccesses":["Connectivity"],"resourceGuid":"c9aa8da7-596b-4650-abb7-2ed34ec46229"},"systemData":{"createdBy":"v-taoxuzeng@microsoft.com","createdByType":"User","createdAt":"2022-03-08T02:01:52.5044074Z","lastModifiedBy":"v-taoxuzeng@microsoft.com","lastModifiedByType":"User","lastModifiedAt":"2022-03-08T02:01:52.5044074Z"}}' headers: cache-control: - no-cache content-length: - - '908' + - '894' content-type: - application/json; charset=utf-8 date: - - Tue, 02 Nov 2021 09:43:04 GMT + - Tue, 08 Mar 2022 02:01:57 GMT expires: - '-1' pragma: @@ -52,15 +52,13 @@ interactions: x-content-type-options: - nosniff x-ms-ratelimit-remaining-subscription-writes: - - '1198' + - '1199' status: code: 200 message: OK - request: body: '{"properties": {"displayName": "MyNetworkGroup", "description": "A sample - group", "memberType": "Microsoft.Network/virtualNetworks", "groupMembers": [{"resourceId": - "/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/test_network_manager_group000001/providers/Microsoft.Network/virtualnetworks/clitest.vn000002"}], - "conditionalMembership": ""}}' + group", "memberType": "Microsoft.Network/virtualNetworks"}}' headers: Accept: - application/json @@ -71,29 +69,28 @@ interactions: Connection: - keep-alive Content-Length: - - '411' + - '133' Content-Type: - application/json ParameterSetName: - - --name --network-manager-name --description --conditional-membership --display-name - --member-type -g --group-members + - --name --network-manager-name --description --display-name --member-type -g User-Agent: - - AZURECLI/2.30.0 azsdk-python-mgmt-network/1.0.0b1 Python/3.8.3 (Windows-10-10.0.18362-SP0) + - AZURECLI/2.31.0 azsdk-python-mgmt-network/1.0.0b1 Python/3.9.5 (Windows-10-10.0.17763-SP0) method: PUT - uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/test_network_manager_group000001/providers/Microsoft.Network/networkManagers/TestNetworkManager/networkGroups/TestNetworkGroup?api-version=2021-02-01-preview + uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/test_network_manager_group000001/providers/Microsoft.Network/networkManagers/TestNetworkManager/networkGroups/TestNetworkGroup?api-version=2021-05-01-preview response: body: string: '{"name":"TestNetworkGroup","id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/test_network_manager_group000001/providers/Microsoft.Network/networkManagers/TestNetworkManager/networkGroups/TestNetworkGroup","type":"Microsoft.Network/networkManagers/networkGroups","etag":"","properties":{"displayName":"MyNetworkGroup","description":"A - sample group","groupMembers":[{"resourceId":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/test_network_manager_group000001/providers/Microsoft.Network/virtualnetworks/clitest.vn000002"}],"conditionalMembership":"","provisioningState":"Succeeded","resourceGuid":"b260d304-cb2d-4897-a6fc-614d0914f5fd"},"systemData":{"createdBy":"v-kaisun@microsoft.com","createdByType":"User","createdAt":"2021-11-02T09:43:06.7234820Z","lastModifiedBy":"v-kaisun@microsoft.com","lastModifiedByType":"User","lastModifiedAt":"2021-11-02T09:43:06.7234820Z"}}' + sample group","groupMembers":[],"conditionalMembership":"","provisioningState":"Succeeded","resourceGuid":"dac82a3c-1da0-4e3c-b5e6-76ff4b886231"},"systemData":{"createdBy":"v-taoxuzeng@microsoft.com","createdByType":"User","createdAt":"2022-03-08T02:01:59.2970505Z","lastModifiedBy":"v-taoxuzeng@microsoft.com","lastModifiedByType":"User","lastModifiedAt":"2022-03-08T02:01:59.2970505Z"}}' headers: cache-control: - no-cache content-length: - - '1010' + - '745' content-type: - application/json; charset=utf-8 date: - - Tue, 02 Nov 2021 09:43:07 GMT + - Tue, 08 Mar 2022 02:01:59 GMT expires: - '-1' pragma: @@ -109,7 +106,7 @@ interactions: x-content-type-options: - nosniff x-ms-ratelimit-remaining-subscription-writes: - - '1197' + - '1198' status: code: 200 message: OK @@ -127,22 +124,22 @@ interactions: ParameterSetName: - -g --name --network-manager-name --description User-Agent: - - AZURECLI/2.30.0 azsdk-python-mgmt-network/1.0.0b1 Python/3.8.3 (Windows-10-10.0.18362-SP0) + - AZURECLI/2.31.0 azsdk-python-mgmt-network/1.0.0b1 Python/3.9.5 (Windows-10-10.0.17763-SP0) method: GET - uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/test_network_manager_group000001/providers/Microsoft.Network/networkManagers/TestNetworkManager/networkGroups/TestNetworkGroup?api-version=2021-02-01-preview + uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/test_network_manager_group000001/providers/Microsoft.Network/networkManagers/TestNetworkManager/networkGroups/TestNetworkGroup?api-version=2021-05-01-preview response: body: - string: '{"name":"TestNetworkGroup","id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/test_network_manager_group000001/providers/Microsoft.Network/networkManagers/TestNetworkManager/networkGroups/TestNetworkGroup","type":"Microsoft.Network/networkManagers/networkGroups","etag":"\"21005eb9-0000-3400-0000-6181082b0000\"","properties":{"displayName":"MyNetworkGroup","description":"A - sample group","groupMembers":[{"resourceId":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/test_network_manager_group000001/providers/Microsoft.Network/virtualnetworks/clitest.vn000002"}],"conditionalMembership":"","provisioningState":"Succeeded","resourceGuid":"b260d304-cb2d-4897-a6fc-614d0914f5fd"},"systemData":{"createdBy":"v-kaisun@microsoft.com","createdByType":"User","createdAt":"2021-11-02T09:43:06.7234820Z","lastModifiedBy":"v-kaisun@microsoft.com","lastModifiedByType":"User","lastModifiedAt":"2021-11-02T09:43:06.7234820Z"}}' + string: '{"name":"TestNetworkGroup","id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/test_network_manager_group000001/providers/Microsoft.Network/networkManagers/TestNetworkManager/networkGroups/TestNetworkGroup","type":"Microsoft.Network/networkManagers/networkGroups","etag":"\"00005086-0000-3400-0000-6226b9180000\"","properties":{"displayName":"MyNetworkGroup","description":"A + sample group","provisioningState":"Succeeded","resourceGuid":"dac82a3c-1da0-4e3c-b5e6-76ff4b886231"},"systemData":{"createdBy":"v-taoxuzeng@microsoft.com","createdByType":"User","createdAt":"2022-03-08T02:01:59.2970505Z","lastModifiedBy":"v-taoxuzeng@microsoft.com","lastModifiedByType":"User","lastModifiedAt":"2022-03-08T02:01:59.2970505Z"}}' headers: cache-control: - no-cache content-length: - - '1050' + - '740' content-type: - application/json; charset=utf-8 date: - - Tue, 02 Nov 2021 09:43:10 GMT + - Tue, 08 Mar 2022 02:02:01 GMT expires: - '-1' pragma: @@ -161,9 +158,7 @@ interactions: code: 200 message: OK - request: - body: '{"properties": {"displayName": "MyNetworkGroup", "description": "Desc changed.", - "groupMembers": [{"resourceId": "/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/test_network_manager_group000001/providers/Microsoft.Network/virtualnetworks/clitest.vn000002"}], - "conditionalMembership": ""}}' + body: '{"properties": {"displayName": "MyNetworkGroup", "description": "Desc changed."}}' headers: Accept: - application/json @@ -174,28 +169,28 @@ interactions: Connection: - keep-alive Content-Length: - - '359' + - '81' Content-Type: - application/json ParameterSetName: - -g --name --network-manager-name --description User-Agent: - - AZURECLI/2.30.0 azsdk-python-mgmt-network/1.0.0b1 Python/3.8.3 (Windows-10-10.0.18362-SP0) + - AZURECLI/2.31.0 azsdk-python-mgmt-network/1.0.0b1 Python/3.9.5 (Windows-10-10.0.17763-SP0) method: PUT - uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/test_network_manager_group000001/providers/Microsoft.Network/networkManagers/TestNetworkManager/networkGroups/TestNetworkGroup?api-version=2021-02-01-preview + uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/test_network_manager_group000001/providers/Microsoft.Network/networkManagers/TestNetworkManager/networkGroups/TestNetworkGroup?api-version=2021-05-01-preview response: body: string: '{"name":"TestNetworkGroup","id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/test_network_manager_group000001/providers/Microsoft.Network/networkManagers/TestNetworkManager/networkGroups/TestNetworkGroup","type":"Microsoft.Network/networkManagers/networkGroups","etag":"","properties":{"displayName":"MyNetworkGroup","description":"Desc - changed.","groupMembers":[{"resourceId":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/test_network_manager_group000001/providers/Microsoft.Network/virtualnetworks/clitest.vn000002"}],"conditionalMembership":"","provisioningState":"Succeeded","resourceGuid":"b260d304-cb2d-4897-a6fc-614d0914f5fd"},"systemData":{"createdBy":"v-kaisun@microsoft.com","createdByType":"User","createdAt":"2021-11-02T09:43:06.7234820Z","lastModifiedBy":"v-kaisun@microsoft.com","lastModifiedByType":"User","lastModifiedAt":"2021-11-02T09:43:12.6833333Z"}}' + changed.","groupMembers":[],"conditionalMembership":"","provisioningState":"Succeeded","resourceGuid":"dac82a3c-1da0-4e3c-b5e6-76ff4b886231"},"systemData":{"createdBy":"v-taoxuzeng@microsoft.com","createdByType":"User","createdAt":"2022-03-08T02:01:59.2970505Z","lastModifiedBy":"v-taoxuzeng@microsoft.com","lastModifiedByType":"User","lastModifiedAt":"2022-03-08T02:02:03.0831419Z"}}' headers: cache-control: - no-cache content-length: - - '1009' + - '744' content-type: - application/json; charset=utf-8 date: - - Tue, 02 Nov 2021 09:43:14 GMT + - Tue, 08 Mar 2022 02:02:03 GMT expires: - '-1' pragma: @@ -229,22 +224,22 @@ interactions: ParameterSetName: - -g --name --network-manager-name User-Agent: - - AZURECLI/2.30.0 azsdk-python-mgmt-network/1.0.0b1 Python/3.8.3 (Windows-10-10.0.18362-SP0) + - AZURECLI/2.31.0 azsdk-python-mgmt-network/1.0.0b1 Python/3.9.5 (Windows-10-10.0.17763-SP0) method: GET - uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/test_network_manager_group000001/providers/Microsoft.Network/networkManagers/TestNetworkManager/networkGroups/TestNetworkGroup?api-version=2021-02-01-preview + uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/test_network_manager_group000001/providers/Microsoft.Network/networkManagers/TestNetworkManager/networkGroups/TestNetworkGroup?api-version=2021-05-01-preview response: body: - string: '{"name":"TestNetworkGroup","id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/test_network_manager_group000001/providers/Microsoft.Network/networkManagers/TestNetworkManager/networkGroups/TestNetworkGroup","type":"Microsoft.Network/networkManagers/networkGroups","etag":"\"21007fb9-0000-3400-0000-618108320000\"","properties":{"displayName":"MyNetworkGroup","description":"Desc - changed.","groupMembers":[{"resourceId":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/test_network_manager_group000001/providers/Microsoft.Network/virtualnetworks/clitest.vn000002"}],"conditionalMembership":"","provisioningState":"Succeeded","resourceGuid":"b260d304-cb2d-4897-a6fc-614d0914f5fd"},"systemData":{"createdBy":"v-kaisun@microsoft.com","createdByType":"User","createdAt":"2021-11-02T09:43:06.7234820Z","lastModifiedBy":"v-kaisun@microsoft.com","lastModifiedByType":"User","lastModifiedAt":"2021-11-02T09:43:12.6833333Z"}}' + string: '{"name":"TestNetworkGroup","id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/test_network_manager_group000001/providers/Microsoft.Network/networkManagers/TestNetworkManager/networkGroups/TestNetworkGroup","type":"Microsoft.Network/networkManagers/networkGroups","etag":"\"00005186-0000-3400-0000-6226b91b0000\"","properties":{"displayName":"MyNetworkGroup","description":"Desc + changed.","provisioningState":"Succeeded","resourceGuid":"dac82a3c-1da0-4e3c-b5e6-76ff4b886231"},"systemData":{"createdBy":"v-taoxuzeng@microsoft.com","createdByType":"User","createdAt":"2022-03-08T02:01:59.2970505Z","lastModifiedBy":"v-taoxuzeng@microsoft.com","lastModifiedByType":"User","lastModifiedAt":"2022-03-08T02:02:03.0831419Z"}}' headers: cache-control: - no-cache content-length: - - '1049' + - '739' content-type: - application/json; charset=utf-8 date: - - Tue, 02 Nov 2021 09:43:16 GMT + - Tue, 08 Mar 2022 02:02:07 GMT expires: - '-1' pragma: @@ -276,22 +271,22 @@ interactions: ParameterSetName: - -g --network-manager-name User-Agent: - - AZURECLI/2.30.0 azsdk-python-mgmt-network/1.0.0b1 Python/3.8.3 (Windows-10-10.0.18362-SP0) + - AZURECLI/2.31.0 azsdk-python-mgmt-network/1.0.0b1 Python/3.9.5 (Windows-10-10.0.17763-SP0) method: GET - uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/test_network_manager_group000001/providers/Microsoft.Network/networkManagers/TestNetworkManager/networkGroups?api-version=2021-02-01-preview + uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/test_network_manager_group000001/providers/Microsoft.Network/networkManagers/TestNetworkManager/networkGroups?api-version=2021-05-01-preview response: body: string: '{"nextLink":"","value":[{"name":"TestNetworkGroup","id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/test_network_manager_group000001/providers/Microsoft.Network/networkManagers/TestNetworkManager/networkGroups/TestNetworkGroup","type":"Microsoft.Network/networkManagers/networkGroups","etag":"","properties":{"displayName":"MyNetworkGroup","description":"Desc - changed.","groupMembers":[{"resourceId":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/test_network_manager_group000001/providers/Microsoft.Network/virtualnetworks/clitest.vn000002"}],"conditionalMembership":"","provisioningState":"Succeeded","resourceGuid":"b260d304-cb2d-4897-a6fc-614d0914f5fd"},"systemData":{"createdBy":"v-kaisun@microsoft.com","createdByType":"User","createdAt":"2021-11-02T09:43:06.7234820Z","lastModifiedBy":"v-kaisun@microsoft.com","lastModifiedByType":"User","lastModifiedAt":"2021-11-02T09:43:12.6833333Z"}}]}' + changed.","groupMembers":[],"conditionalMembership":"","provisioningState":"Succeeded","resourceGuid":"dac82a3c-1da0-4e3c-b5e6-76ff4b886231"},"systemData":{"createdBy":"v-taoxuzeng@microsoft.com","createdByType":"User","createdAt":"2022-03-08T02:01:59.2970505Z","lastModifiedBy":"v-taoxuzeng@microsoft.com","lastModifiedByType":"User","lastModifiedAt":"2022-03-08T02:02:03.0831419Z"}}]}' headers: cache-control: - no-cache content-length: - - '1035' + - '770' content-type: - application/json; charset=utf-8 date: - - Tue, 02 Nov 2021 09:43:19 GMT + - Tue, 08 Mar 2022 02:02:08 GMT expires: - '-1' pragma: @@ -323,11 +318,55 @@ interactions: Content-Length: - '0' ParameterSetName: - - -g --name --network-manager-name --yes + - -g --name --network-manager-name --force --yes + User-Agent: + - AZURECLI/2.31.0 azsdk-python-mgmt-network/1.0.0b1 Python/3.9.5 (Windows-10-10.0.17763-SP0) + method: DELETE + uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/test_network_manager_group000001/providers/Microsoft.Network/networkManagers/TestNetworkManager/networkGroups/TestNetworkGroup?api-version=2021-05-01-preview&force=true + response: + body: + string: '' + headers: + cache-control: + - no-cache + content-length: + - '0' + date: + - Tue, 08 Mar 2022 02:02:09 GMT + expires: + - '-1' + pragma: + - no-cache + server: + - Kestrel + strict-transport-security: + - max-age=31536000; includeSubDomains + x-content-type-options: + - nosniff + x-ms-ratelimit-remaining-subscription-deletes: + - '14999' + status: + code: 200 + message: OK +- request: + body: null + headers: + Accept: + - application/json + Accept-Encoding: + - gzip, deflate + CommandName: + - network manager delete + Connection: + - keep-alive + Content-Length: + - '0' + ParameterSetName: + - --resource-group --name --yes User-Agent: - - AZURECLI/2.30.0 azsdk-python-mgmt-network/1.0.0b1 Python/3.8.3 (Windows-10-10.0.18362-SP0) + - AZURECLI/2.31.0 azsdk-python-mgmt-network/1.0.0b1 Python/3.9.5 (Windows-10-10.0.17763-SP0) method: DELETE - uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/test_network_manager_group000001/providers/Microsoft.Network/networkManagers/TestNetworkManager/networkGroups/TestNetworkGroup?api-version=2021-02-01-preview + uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/test_network_manager_group000001/providers/Microsoft.Network/networkManagers/TestNetworkManager?api-version=2021-05-01-preview response: body: string: '' @@ -337,7 +376,7 @@ interactions: content-length: - '0' date: - - Tue, 02 Nov 2021 09:43:23 GMT + - Tue, 08 Mar 2022 02:02:18 GMT expires: - '-1' pragma: @@ -349,7 +388,7 @@ interactions: x-content-type-options: - nosniff x-ms-ratelimit-remaining-subscription-deletes: - - '14995' + - '14999' status: code: 200 message: OK diff --git a/src/network-manager/azext_network_manager/tests/latest/recordings/test_network_manager_list_queries.yaml b/src/network-manager/azext_network_manager/tests/latest/recordings/test_network_manager_list_queries.yaml index e3ed39f8d69..30e30a74a6e 100644 --- a/src/network-manager/azext_network_manager/tests/latest/recordings/test_network_manager_list_queries.yaml +++ b/src/network-manager/azext_network_manager/tests/latest/recordings/test_network_manager_list_queries.yaml @@ -21,22 +21,22 @@ interactions: - --name --description --display-name --scope-accesses --network-manager-scopes -l --resource-group User-Agent: - - AZURECLI/2.30.0 azsdk-python-mgmt-network/1.0.0b1 Python/3.8.3 (Windows-10-10.0.18362-SP0) + - AZURECLI/2.31.0 azsdk-python-mgmt-network/1.0.0b1 Python/3.9.5 (Windows-10-10.0.17763-SP0) method: PUT - uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/test_network_manager_list_queries000001/providers/Microsoft.Network/networkManagers/TestNetworkManager?api-version=2021-02-01-preview + uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/test_network_manager_list_queries000001/providers/Microsoft.Network/networkManagers/TestNetworkManager?api-version=2021-05-01-preview response: body: string: '{"name":"TestNetworkManager","id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/test_network_manager_list_queries000001/providers/Microsoft.Network/networkManagers/TestNetworkManager","location":"eastus2euap","type":"Microsoft.Network/networkManagers","tags":{},"etag":"","properties":{"displayName":"TestNetworkManager","description":"My - Test Network Manager","networkManagerScopes":{"managementGroups":[],"subscriptions":["/subscriptions/00000000-0000-0000-0000-000000000000"]},"provisioningState":"Succeeded","networkManagerScopeAccesses":["SecurityAdmin","Connectivity"],"resourceGuid":"66947698-fce5-4b19-a5c3-020c12ffb383"},"systemData":{"createdBy":"v-kaisun@microsoft.com","createdByType":"User","createdAt":"2021-11-23T09:31:19.7844891Z","lastModifiedBy":"v-kaisun@microsoft.com","lastModifiedByType":"User","lastModifiedAt":"2021-11-23T09:31:19.7844891Z"}}' + Test Network Manager","networkManagerScopes":{"managementGroups":[],"subscriptions":["/subscriptions/00000000-0000-0000-0000-000000000000"],"multiTenantScopes":[]},"provisioningState":"Succeeded","networkManagerScopeAccesses":["SecurityAdmin","Connectivity"],"resourceGuid":"60d0db6a-93b0-4453-b510-68aa9aa4db5f"},"systemData":{"createdBy":"v-taoxuzeng@microsoft.com","createdByType":"User","createdAt":"2022-03-07T10:40:09.6417283Z","lastModifiedBy":"v-taoxuzeng@microsoft.com","lastModifiedByType":"User","lastModifiedAt":"2022-03-07T10:40:09.6417283Z"}}' headers: cache-control: - no-cache content-length: - - '924' + - '917' content-type: - application/json; charset=utf-8 date: - - Tue, 23 Nov 2021 09:31:34 GMT + - Mon, 07 Mar 2022 10:40:14 GMT expires: - '-1' pragma: @@ -52,15 +52,13 @@ interactions: x-content-type-options: - nosniff x-ms-ratelimit-remaining-subscription-writes: - - '1199' + - '1197' status: code: 200 message: OK - request: body: '{"properties": {"displayName": "ASampleGroup", "description": "A sample - policy", "memberType": "Microsoft.Network/virtualNetworks", "groupMembers": - [{"resourceId": "/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/test_network_manager_list_queries000001/providers/Microsoft.Network/virtualnetworks/clitest.vn000002"}], - "conditionalMembership": ""}}' + policy", "memberType": "Microsoft.Network/virtualNetworks"}}' headers: Accept: - application/json @@ -71,29 +69,80 @@ interactions: Connection: - keep-alive Content-Length: - - '410' + - '132' Content-Type: - application/json ParameterSetName: - - --name --network-manager-name --description --conditional-membership --display-name - --member-type -g --group-members + - --name --network-manager-name --description --display-name --member-type -g User-Agent: - - AZURECLI/2.30.0 azsdk-python-mgmt-network/1.0.0b1 Python/3.8.3 (Windows-10-10.0.18362-SP0) + - AZURECLI/2.31.0 azsdk-python-mgmt-network/1.0.0b1 Python/3.9.5 (Windows-10-10.0.17763-SP0) method: PUT - uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/test_network_manager_list_queries000001/providers/Microsoft.Network/networkManagers/TestNetworkManager/networkGroups/TestNetworkGroup?api-version=2021-02-01-preview + uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/test_network_manager_list_queries000001/providers/Microsoft.Network/networkManagers/TestNetworkManager/networkGroups/TestNetworkGroup?api-version=2021-05-01-preview response: body: string: '{"name":"TestNetworkGroup","id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/test_network_manager_list_queries000001/providers/Microsoft.Network/networkManagers/TestNetworkManager/networkGroups/TestNetworkGroup","type":"Microsoft.Network/networkManagers/networkGroups","etag":"","properties":{"displayName":"ASampleGroup","description":"A - sample policy","groupMembers":[{"resourceId":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/test_network_manager_list_queries000001/providers/Microsoft.Network/virtualnetworks/clitest.vn000002"}],"conditionalMembership":"","provisioningState":"Succeeded","resourceGuid":"e431d73e-eca0-41db-a801-fec1974e46a5"},"systemData":{"createdBy":"v-kaisun@microsoft.com","createdByType":"User","createdAt":"2021-11-23T09:31:35.8326688Z","lastModifiedBy":"v-kaisun@microsoft.com","lastModifiedByType":"User","lastModifiedAt":"2021-11-23T09:31:35.8326688Z"}}' + sample policy","groupMembers":[],"conditionalMembership":"","provisioningState":"Succeeded","resourceGuid":"aac286eb-13b4-4d8a-a0a5-235e0f2b3d45"},"systemData":{"createdBy":"v-taoxuzeng@microsoft.com","createdByType":"User","createdAt":"2022-03-07T10:40:15.6472382Z","lastModifiedBy":"v-taoxuzeng@microsoft.com","lastModifiedByType":"User","lastModifiedAt":"2022-03-07T10:40:15.6472382Z"}}' + headers: + cache-control: + - no-cache + content-length: + - '751' + content-type: + - application/json; charset=utf-8 + date: + - Mon, 07 Mar 2022 10:40:16 GMT + expires: + - '-1' + pragma: + - no-cache + server: + - Kestrel + strict-transport-security: + - max-age=31536000; includeSubDomains + transfer-encoding: + - chunked + vary: + - Accept-Encoding + x-content-type-options: + - nosniff + x-ms-ratelimit-remaining-subscription-writes: + - '1197' + status: + code: 200 + message: OK +- request: + body: '{"properties": {"resourceId": "/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/test_network_manager_list_queries000001/providers/Microsoft.Network/virtualnetworks/clitest.vn000002"}}' + headers: + Accept: + - application/json + Accept-Encoding: + - gzip, deflate + CommandName: + - network manager group static-member create + Connection: + - keep-alive + Content-Length: + - '201' + Content-Type: + - application/json + ParameterSetName: + - --name --network-group-name --network-manager-name --resource-id -g + User-Agent: + - AZURECLI/2.31.0 azsdk-python-mgmt-network/1.0.0b1 Python/3.9.5 (Windows-10-10.0.17763-SP0) + method: PUT + uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/test_network_manager_list_queries000001/providers/Microsoft.Network/networkManagers/TestNetworkManager/networkGroups/TestNetworkGroup/staticMembers/TestStaticMember?api-version=2021-05-01-preview + response: + body: + string: '{"name":"TestStaticMember","id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/test_network_manager_list_queries000001/providers/Microsoft.Network/networkManagers/TestNetworkManager/networkGroups/TestNetworkGroup/staticMembers/TestStaticMember","type":"Microsoft.Network/networkManagers/networkGroups/staticMembers","etag":"","properties":{"resourceId":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/test_network_manager_list_queries000001/providers/Microsoft.Network/virtualnetworks/clitest.vn000002"},"systemData":{"createdBy":"v-taoxuzeng@microsoft.com","createdByType":"User","createdAt":"2022-03-07T10:40:17.6337176Z","lastModifiedBy":"v-taoxuzeng@microsoft.com","lastModifiedByType":"User","lastModifiedAt":"2022-03-07T10:40:17.6337176Z"}}' headers: cache-control: - no-cache content-length: - - '1009' + - '787' content-type: - application/json; charset=utf-8 date: - - Tue, 23 Nov 2021 09:31:38 GMT + - Mon, 07 Mar 2022 10:40:18 GMT expires: - '-1' pragma: @@ -131,9 +180,9 @@ interactions: ParameterSetName: - --network-manager-name --deployment-types --regions --resource-group User-Agent: - - AZURECLI/2.30.0 azsdk-python-mgmt-network/1.0.0b1 Python/3.8.3 (Windows-10-10.0.18362-SP0) + - AZURECLI/2.31.0 azsdk-python-mgmt-network/1.0.0b1 Python/3.9.5 (Windows-10-10.0.17763-SP0) method: POST - uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/test_network_manager_list_queries000001/providers/Microsoft.Network/networkManagers/TestNetworkManager/listDeploymentStatus?api-version=2021-02-01-preview + uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/test_network_manager_list_queries000001/providers/Microsoft.Network/networkManagers/TestNetworkManager/listDeploymentStatus?api-version=2021-05-01-preview response: body: string: '{"skipToken":"","value":[]}' @@ -145,7 +194,7 @@ interactions: content-type: - application/json; charset=utf-8 date: - - Tue, 23 Nov 2021 09:31:39 GMT + - Mon, 07 Mar 2022 10:40:20 GMT expires: - '-1' pragma: @@ -183,21 +232,21 @@ interactions: ParameterSetName: - --network-group-name --network-manager-name --resource-group User-Agent: - - AZURECLI/2.30.0 azsdk-python-mgmt-network/1.0.0b1 Python/3.8.3 (Windows-10-10.0.18362-SP0) + - AZURECLI/2.31.0 azsdk-python-mgmt-network/1.0.0b1 Python/3.9.5 (Windows-10-10.0.17763-SP0) method: POST - uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/test_network_manager_list_queries000001/providers/Microsoft.Network/networkManagers/TestNetworkManager/networkGroups/TestNetworkGroup/listEffectiveVirtualNetworks?api-version=2021-02-01-preview + uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/test_network_manager_list_queries000001/providers/Microsoft.Network/networkManagers/TestNetworkManager/networkGroups/TestNetworkGroup/listEffectiveVirtualNetworks?api-version=2021-05-01-preview response: body: - string: '{"skipToken":"","value":[{"id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/test_network_manager_list_queries000001/providers/Microsoft.Network/virtualNetworks/clitest.vn000002","location":"eastus2euap","membershipType":"Dynamic"}]}' + string: '{"skipToken":"MTA=","value":[{"id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/bez-rg/providers/Microsoft.Network/virtualNetworks/bezvnet","location":"westus","membershipType":"Dynamic"},{"id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli_netappfiles_test_snapshot_vpshzlob7c63iuglneagoxjxa45dqn6eoglhf37oo5cms/providers/Microsoft.Network/virtualNetworks/cli-vnet-lefr-02","location":"westus2","membershipType":"Dynamic"},{"id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli_test_cannotdelete_resource_lockbfuaftaa7m4m77urywe56rs3yfr4sr3ybmrsclix/providers/Microsoft.Network/virtualNetworks/cli.lock.rsrchikdj2r5lezlez4w6","location":"westus","membershipType":"Dynamic"},{"id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli_test_capacity_reservation_3tlf6fnaho6xh2k67p5k2gzrdwsz6shx7wiovzaqqgrv6/providers/Microsoft.Network/virtualNetworks/vme2gol3cqVNET","location":"centraluseuap","membershipType":"Dynamic"},{"id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli_test_capacity_reservation_3ye3fknhdgsj3emasgvno7ha6pbu7kl7u7zfgrkrqvxfy/providers/Microsoft.Network/virtualNetworks/vmymwxa64iVNET","location":"centraluseuap","membershipType":"Dynamic"},{"id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli_test_capacity_reservation_a2bft34ibubuugccpmc6c4zuixspwci77rpr6brqyr5jb/providers/Microsoft.Network/virtualNetworks/vmqvhbocfjVNET","location":"centraluseuap","membershipType":"Dynamic"},{"id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli_test_capacity_reservation_aorgdxvqiasmoxu6rnetf22jmzhqns5aousc7zygvltqg/providers/Microsoft.Network/virtualNetworks/vmrvrfjdlmVNET","location":"centraluseuap","membershipType":"Dynamic"},{"id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli_test_capacity_reservation_aymyxfviyz6aokyxy3cedxjplbojtxqgwnuiwcgfgkq5o/providers/Microsoft.Network/virtualNetworks/vmzrx5qdb3VNET","location":"centraluseuap","membershipType":"Dynamic"},{"id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli_test_capacity_reservation_ctb5edywpqrnmw6fyhfp6db2kg6cl2yynycdrwl6uwqs5/providers/Microsoft.Network/virtualNetworks/vmqwnatidzVNET","location":"centraluseuap","membershipType":"Dynamic"},{"id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli_test_capacity_reservation_dfv7ckxck7r52gyblbxd5vcipcs7izfdjgx25d7iygamg/providers/Microsoft.Network/virtualNetworks/vmwgtm6ebaVNET","location":"centraluseuap","membershipType":"Dynamic"}]}' headers: cache-control: - no-cache content-length: - - '299' + - '2602' content-type: - application/json; charset=utf-8 date: - - Tue, 23 Nov 2021 09:31:43 GMT + - Mon, 07 Mar 2022 10:40:22 GMT expires: - '-1' pragma: @@ -213,7 +262,7 @@ interactions: x-content-type-options: - nosniff x-ms-ratelimit-remaining-subscription-writes: - - '1198' + - '1199' status: code: 200 message: OK @@ -235,9 +284,9 @@ interactions: ParameterSetName: - --network-manager-name --resource-group User-Agent: - - AZURECLI/2.30.0 azsdk-python-mgmt-network/1.0.0b1 Python/3.8.3 (Windows-10-10.0.18362-SP0) + - AZURECLI/2.31.0 azsdk-python-mgmt-network/1.0.0b1 Python/3.9.5 (Windows-10-10.0.17763-SP0) method: POST - uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/test_network_manager_list_queries000001/providers/Microsoft.Network/networkManagers/TestNetworkManager/listEffectiveVirtualNetworks?api-version=2021-02-01-preview + uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/test_network_manager_list_queries000001/providers/Microsoft.Network/networkManagers/TestNetworkManager/listEffectiveVirtualNetworks?api-version=2021-05-01-preview response: body: string: '{"skipToken":"","value":[]}' @@ -249,7 +298,7 @@ interactions: content-type: - application/json; charset=utf-8 date: - - Tue, 23 Nov 2021 09:31:46 GMT + - Mon, 07 Mar 2022 10:40:24 GMT expires: - '-1' pragma: @@ -287,9 +336,9 @@ interactions: ParameterSetName: - --network-manager-name --resource-group --regions User-Agent: - - AZURECLI/2.30.0 azsdk-python-mgmt-network/1.0.0b1 Python/3.8.3 (Windows-10-10.0.18362-SP0) + - AZURECLI/2.31.0 azsdk-python-mgmt-network/1.0.0b1 Python/3.9.5 (Windows-10-10.0.17763-SP0) method: POST - uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/test_network_manager_list_queries000001/providers/Microsoft.Network/networkManagers/TestNetworkManager/listActiveConnectivityConfigurations?api-version=2021-02-01-preview + uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/test_network_manager_list_queries000001/providers/Microsoft.Network/networkManagers/TestNetworkManager/listActiveConnectivityConfigurations?api-version=2021-05-01-preview response: body: string: '{"skipToken":"","value":[]}' @@ -301,7 +350,7 @@ interactions: content-type: - application/json; charset=utf-8 date: - - Tue, 23 Nov 2021 09:31:50 GMT + - Mon, 07 Mar 2022 10:40:26 GMT expires: - '-1' pragma: @@ -339,9 +388,9 @@ interactions: ParameterSetName: - --virtual-network-name -g User-Agent: - - AZURECLI/2.30.0 azsdk-python-mgmt-network/1.0.0b1 Python/3.8.3 (Windows-10-10.0.18362-SP0) + - AZURECLI/2.31.0 azsdk-python-mgmt-network/1.0.0b1 Python/3.9.5 (Windows-10-10.0.17763-SP0) method: POST - uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/test_network_manager_list_queries000001/providers/Microsoft.Network/virtualNetworks/clitest.vn000002/listNetworkManagerEffectiveConnectivityConfigurations?api-version=2021-02-01-preview + uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/test_network_manager_list_queries000001/providers/Microsoft.Network/virtualNetworks/clitest.vn000002/listNetworkManagerEffectiveConnectivityConfigurations?api-version=2021-05-01-preview response: body: string: '{"skipToken":"","value":[]}' @@ -353,7 +402,7 @@ interactions: content-type: - application/json; charset=utf-8 date: - - Tue, 23 Nov 2021 09:31:54 GMT + - Mon, 07 Mar 2022 10:40:28 GMT expires: - '-1' pragma: @@ -369,7 +418,7 @@ interactions: x-content-type-options: - nosniff x-ms-ratelimit-remaining-subscription-writes: - - '1199' + - '1198' status: code: 200 message: OK @@ -391,9 +440,9 @@ interactions: ParameterSetName: - --virtual-network-name -g User-Agent: - - AZURECLI/2.30.0 azsdk-python-mgmt-network/1.0.0b1 Python/3.8.3 (Windows-10-10.0.18362-SP0) + - AZURECLI/2.31.0 azsdk-python-mgmt-network/1.0.0b1 Python/3.9.5 (Windows-10-10.0.17763-SP0) method: POST - uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/test_network_manager_list_queries000001/providers/Microsoft.Network/virtualNetworks/clitest.vn000002/listNetworkManagerEffectiveSecurityAdminRules?api-version=2021-02-01-preview + uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/test_network_manager_list_queries000001/providers/Microsoft.Network/virtualNetworks/clitest.vn000002/listNetworkManagerEffectiveSecurityAdminRules?api-version=2021-05-01-preview response: body: string: '{"skipToken":"","value":[]}' @@ -405,7 +454,7 @@ interactions: content-type: - application/json; charset=utf-8 date: - - Tue, 23 Nov 2021 09:31:58 GMT + - Mon, 07 Mar 2022 10:40:30 GMT expires: - '-1' pragma: @@ -421,7 +470,7 @@ interactions: x-content-type-options: - nosniff x-ms-ratelimit-remaining-subscription-writes: - - '1199' + - '1198' status: code: 200 message: OK @@ -443,9 +492,9 @@ interactions: ParameterSetName: - --network-manager-name -g --regions User-Agent: - - AZURECLI/2.30.0 azsdk-python-mgmt-network/1.0.0b1 Python/3.8.3 (Windows-10-10.0.18362-SP0) + - AZURECLI/2.31.0 azsdk-python-mgmt-network/1.0.0b1 Python/3.9.5 (Windows-10-10.0.17763-SP0) method: POST - uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/test_network_manager_list_queries000001/providers/Microsoft.Network/networkManagers/TestNetworkManager/listActiveSecurityAdminRules?api-version=2021-02-01-preview + uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/test_network_manager_list_queries000001/providers/Microsoft.Network/networkManagers/TestNetworkManager/listActiveSecurityAdminRules?api-version=2021-05-01-preview response: body: string: '{"skipToken":"","value":[]}' @@ -457,7 +506,7 @@ interactions: content-type: - application/json; charset=utf-8 date: - - Tue, 23 Nov 2021 09:32:02 GMT + - Mon, 07 Mar 2022 10:40:32 GMT expires: - '-1' pragma: @@ -473,7 +522,95 @@ interactions: x-content-type-options: - nosniff x-ms-ratelimit-remaining-subscription-writes: - - '1199' + - '1198' + status: + code: 200 + message: OK +- request: + body: null + headers: + Accept: + - application/json + Accept-Encoding: + - gzip, deflate + CommandName: + - network manager group delete + Connection: + - keep-alive + Content-Length: + - '0' + ParameterSetName: + - -g --name --network-manager-name --force --yes + User-Agent: + - AZURECLI/2.31.0 azsdk-python-mgmt-network/1.0.0b1 Python/3.9.5 (Windows-10-10.0.17763-SP0) + method: DELETE + uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/test_network_manager_list_queries000001/providers/Microsoft.Network/networkManagers/TestNetworkManager/networkGroups/TestNetworkGroup?api-version=2021-05-01-preview&force=true + response: + body: + string: '' + headers: + cache-control: + - no-cache + content-length: + - '0' + date: + - Mon, 07 Mar 2022 10:40:33 GMT + expires: + - '-1' + pragma: + - no-cache + server: + - Kestrel + strict-transport-security: + - max-age=31536000; includeSubDomains + x-content-type-options: + - nosniff + x-ms-ratelimit-remaining-subscription-deletes: + - '14996' + status: + code: 200 + message: OK +- request: + body: null + headers: + Accept: + - application/json + Accept-Encoding: + - gzip, deflate + CommandName: + - network manager delete + Connection: + - keep-alive + Content-Length: + - '0' + ParameterSetName: + - --resource-group --name --yes + User-Agent: + - AZURECLI/2.31.0 azsdk-python-mgmt-network/1.0.0b1 Python/3.9.5 (Windows-10-10.0.17763-SP0) + method: DELETE + uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/test_network_manager_list_queries000001/providers/Microsoft.Network/networkManagers/TestNetworkManager?api-version=2021-05-01-preview + response: + body: + string: '' + headers: + cache-control: + - no-cache + content-length: + - '0' + date: + - Mon, 07 Mar 2022 10:40:39 GMT + expires: + - '-1' + pragma: + - no-cache + server: + - Kestrel + strict-transport-security: + - max-age=31536000; includeSubDomains + x-content-type-options: + - nosniff + x-ms-ratelimit-remaining-subscription-deletes: + - '14998' status: code: 200 message: OK diff --git a/src/network-manager/azext_network_manager/tests/latest/recordings/test_network_manager_scope_connection.yaml b/src/network-manager/azext_network_manager/tests/latest/recordings/test_network_manager_scope_connection.yaml new file mode 100644 index 00000000000..6833997760d --- /dev/null +++ b/src/network-manager/azext_network_manager/tests/latest/recordings/test_network_manager_scope_connection.yaml @@ -0,0 +1,398 @@ +interactions: +- request: + body: '{"location": "eastus2euap", "properties": {"displayName": "TestNetworkManager", + "description": "My Test Network Manager", "networkManagerScopes": {"subscriptions": + ["/subscriptions/00000000-0000-0000-0000-000000000000"]}, "networkManagerScopeAccesses": + ["SecurityAdmin", "Connectivity"]}}' + headers: + Accept: + - application/json + Accept-Encoding: + - gzip, deflate + CommandName: + - network manager create + Connection: + - keep-alive + Content-Length: + - '288' + Content-Type: + - application/json + ParameterSetName: + - --name --description --display-name --scope-accesses --network-manager-scopes + -l --resource-group + User-Agent: + - AZURECLI/2.31.0 azsdk-python-mgmt-network/1.0.0b1 Python/3.9.5 (Windows-10-10.0.17763-SP0) + method: PUT + uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/test_network_manager_scope_connection000001/providers/Microsoft.Network/networkManagers/TestNetworkManager?api-version=2021-05-01-preview + response: + body: + string: '{"name":"TestNetworkManager","id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/test_network_manager_scope_connection000001/providers/Microsoft.Network/networkManagers/TestNetworkManager","location":"eastus2euap","type":"Microsoft.Network/networkManagers","tags":{},"etag":"","properties":{"displayName":"TestNetworkManager","description":"My + Test Network Manager","networkManagerScopes":{"managementGroups":[],"subscriptions":["/subscriptions/00000000-0000-0000-0000-000000000000"],"multiTenantScopes":[]},"provisioningState":"Succeeded","networkManagerScopeAccesses":["SecurityAdmin","Connectivity"],"resourceGuid":"61cf787e-e90b-4454-9735-2a75954ebfda"},"systemData":{"createdBy":"v-taoxuzeng@microsoft.com","createdByType":"User","createdAt":"2022-03-07T14:40:24.6561562Z","lastModifiedBy":"v-taoxuzeng@microsoft.com","lastModifiedByType":"User","lastModifiedAt":"2022-03-07T14:40:24.6561562Z"}}' + headers: + cache-control: + - no-cache + content-length: + - '921' + content-type: + - application/json; charset=utf-8 + date: + - Mon, 07 Mar 2022 14:40:28 GMT + expires: + - '-1' + pragma: + - no-cache + server: + - Kestrel + strict-transport-security: + - max-age=31536000; includeSubDomains + transfer-encoding: + - chunked + vary: + - Accept-Encoding + x-content-type-options: + - nosniff + x-ms-ratelimit-remaining-subscription-writes: + - '1199' + status: + code: 200 + message: OK +- request: + body: '{"properties": {"tenantId": "54826b22-38d6-4fb2-bad9-b7b93a3e9c5a", "resourceId": + "/subscriptions/00000000-0000-0000-0000-000000000000", "description": "My Test + Network Manager Scope Connection"}}' + headers: + Accept: + - application/json + Accept-Encoding: + - gzip, deflate + CommandName: + - network manager scope-connection create + Connection: + - keep-alive + Content-Length: + - '196' + Content-Type: + - application/json + ParameterSetName: + - --resource-group --network-manager-name --name --description --tenant-id --resource-id + User-Agent: + - AZURECLI/2.31.0 azsdk-python-mgmt-network/1.0.0b1 Python/3.9.5 (Windows-10-10.0.17763-SP0) + method: PUT + uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/test_network_manager_scope_connection000001/providers/Microsoft.Network/networkManagers/TestNetworkManager/scopeConnections/myTestScopeConnection?api-version=2021-05-01-preview + response: + body: + string: '{"id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/test_network_manager_scope_connection000001/providers/Microsoft.Network/networkManagers/TestNetworkManager/scopeConnections/myTestScopeConnection","name":"myTestScopeConnection","type":"Microsoft.Network/networkManagers/scopeConnections","properties":{"tenantId":"54826b22-38d6-4fb2-bad9-b7b93a3e9c5a","resourceId":"/subscriptions/00000000-0000-0000-0000-000000000000","connectionState":"Pending","description":"My + Test Network Manager Scope Connection"},"systemData":{"createdBy":"v-taoxuzeng@microsoft.com","createdByType":"User","createdAt":"2022-03-07T14:40:29.8915587Z","lastModifiedBy":"v-taoxuzeng@microsoft.com","lastModifiedByType":"User","lastModifiedAt":"2022-03-07T14:40:29.8915587Z"}}' + headers: + cache-control: + - no-cache + content-length: + - '771' + content-type: + - application/json; charset=utf-8 + date: + - Mon, 07 Mar 2022 14:40:31 GMT + expires: + - '-1' + pragma: + - no-cache + server: + - Kestrel + strict-transport-security: + - max-age=31536000; includeSubDomains + transfer-encoding: + - chunked + vary: + - Accept-Encoding + x-content-type-options: + - nosniff + x-ms-ratelimit-remaining-subscription-writes: + - '1199' + status: + code: 200 + message: OK +- request: + body: null + headers: + Accept: + - application/json + Accept-Encoding: + - gzip, deflate + CommandName: + - network manager scope-connection show + Connection: + - keep-alive + ParameterSetName: + - -g --network-manager-name --name + User-Agent: + - AZURECLI/2.31.0 azsdk-python-mgmt-network/1.0.0b1 Python/3.9.5 (Windows-10-10.0.17763-SP0) + method: GET + uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/test_network_manager_scope_connection000001/providers/Microsoft.Network/networkManagers/TestNetworkManager/scopeConnections/myTestScopeConnection?api-version=2021-05-01-preview + response: + body: + string: '{"id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/test_network_manager_scope_connection000001/providers/Microsoft.Network/networkManagers/TestNetworkManager/scopeConnections/myTestScopeConnection","name":"myTestScopeConnection","type":"Microsoft.Network/networkManagers/scopeConnections","properties":{"tenantId":"54826b22-38d6-4fb2-bad9-b7b93a3e9c5a","resourceId":"/subscriptions/00000000-0000-0000-0000-000000000000","connectionState":"Pending","description":"My + Test Network Manager Scope Connection"},"systemData":{"createdBy":"v-taoxuzeng@microsoft.com","createdByType":"User","createdAt":"2022-03-07T14:40:29.8915587Z","lastModifiedBy":"v-taoxuzeng@microsoft.com","lastModifiedByType":"User","lastModifiedAt":"2022-03-07T14:40:29.8915587Z"}}' + headers: + cache-control: + - no-cache + content-length: + - '771' + content-type: + - application/json; charset=utf-8 + date: + - Mon, 07 Mar 2022 14:40:33 GMT + expires: + - '-1' + pragma: + - no-cache + server: + - Kestrel + strict-transport-security: + - max-age=31536000; includeSubDomains + transfer-encoding: + - chunked + vary: + - Accept-Encoding + x-content-type-options: + - nosniff + status: + code: 200 + message: OK +- request: + body: null + headers: + Accept: + - application/json + Accept-Encoding: + - gzip, deflate + CommandName: + - network manager scope-connection update + Connection: + - keep-alive + ParameterSetName: + - -g --network-manager-name --name --description + User-Agent: + - AZURECLI/2.31.0 azsdk-python-mgmt-network/1.0.0b1 Python/3.9.5 (Windows-10-10.0.17763-SP0) + method: GET + uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/test_network_manager_scope_connection000001/providers/Microsoft.Network/networkManagers/TestNetworkManager/scopeConnections/myTestScopeConnection?api-version=2021-05-01-preview + response: + body: + string: '{"id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/test_network_manager_scope_connection000001/providers/Microsoft.Network/networkManagers/TestNetworkManager/scopeConnections/myTestScopeConnection","name":"myTestScopeConnection","type":"Microsoft.Network/networkManagers/scopeConnections","properties":{"tenantId":"54826b22-38d6-4fb2-bad9-b7b93a3e9c5a","resourceId":"/subscriptions/00000000-0000-0000-0000-000000000000","connectionState":"Pending","description":"My + Test Network Manager Scope Connection"},"systemData":{"createdBy":"v-taoxuzeng@microsoft.com","createdByType":"User","createdAt":"2022-03-07T14:40:29.8915587Z","lastModifiedBy":"v-taoxuzeng@microsoft.com","lastModifiedByType":"User","lastModifiedAt":"2022-03-07T14:40:29.8915587Z"}}' + headers: + cache-control: + - no-cache + content-length: + - '771' + content-type: + - application/json; charset=utf-8 + date: + - Mon, 07 Mar 2022 14:40:34 GMT + expires: + - '-1' + pragma: + - no-cache + server: + - Kestrel + strict-transport-security: + - max-age=31536000; includeSubDomains + transfer-encoding: + - chunked + vary: + - Accept-Encoding + x-content-type-options: + - nosniff + status: + code: 200 + message: OK +- request: + body: '{"properties": {"tenantId": "54826b22-38d6-4fb2-bad9-b7b93a3e9c5a", "resourceId": + "/subscriptions/00000000-0000-0000-0000-000000000000", "description": "My Test + Network Manager Scope Connection Updated Description"}}' + headers: + Accept: + - application/json + Accept-Encoding: + - gzip, deflate + CommandName: + - network manager scope-connection update + Connection: + - keep-alive + Content-Length: + - '216' + Content-Type: + - application/json + ParameterSetName: + - -g --network-manager-name --name --description + User-Agent: + - AZURECLI/2.31.0 azsdk-python-mgmt-network/1.0.0b1 Python/3.9.5 (Windows-10-10.0.17763-SP0) + method: PUT + uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/test_network_manager_scope_connection000001/providers/Microsoft.Network/networkManagers/TestNetworkManager/scopeConnections/myTestScopeConnection?api-version=2021-05-01-preview + response: + body: + string: '{"id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/test_network_manager_scope_connection000001/providers/Microsoft.Network/networkManagers/TestNetworkManager/scopeConnections/myTestScopeConnection","name":"myTestScopeConnection","type":"Microsoft.Network/networkManagers/scopeConnections","properties":{"tenantId":"54826b22-38d6-4fb2-bad9-b7b93a3e9c5a","resourceId":"/subscriptions/00000000-0000-0000-0000-000000000000","connectionState":"Pending","description":"My + Test Network Manager Scope Connection Updated Description"},"systemData":{"createdBy":"v-taoxuzeng@microsoft.com","createdByType":"User","createdAt":"2022-03-07T14:40:36.1688494Z","lastModifiedBy":"v-taoxuzeng@microsoft.com","lastModifiedByType":"User","lastModifiedAt":"2022-03-07T14:40:36.1688494Z"}}' + headers: + cache-control: + - no-cache + content-length: + - '791' + content-type: + - application/json; charset=utf-8 + date: + - Mon, 07 Mar 2022 14:40:39 GMT + expires: + - '-1' + pragma: + - no-cache + server: + - Kestrel + strict-transport-security: + - max-age=31536000; includeSubDomains + transfer-encoding: + - chunked + vary: + - Accept-Encoding + x-content-type-options: + - nosniff + x-ms-ratelimit-remaining-subscription-writes: + - '1199' + status: + code: 200 + message: OK +- request: + body: null + headers: + Accept: + - application/json + Accept-Encoding: + - gzip, deflate + CommandName: + - network manager scope-connection list + Connection: + - keep-alive + ParameterSetName: + - -g --network-manager-name + User-Agent: + - AZURECLI/2.31.0 azsdk-python-mgmt-network/1.0.0b1 Python/3.9.5 (Windows-10-10.0.17763-SP0) + method: GET + uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/test_network_manager_scope_connection000001/providers/Microsoft.Network/networkManagers/TestNetworkManager/scopeConnections?api-version=2021-05-01-preview + response: + body: + string: '{"value":[{"id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/test_network_manager_scope_connection000001/providers/Microsoft.Network/networkManagers/TestNetworkManager/scopeConnections/myTestScopeConnection","name":"myTestScopeConnection","type":"Microsoft.Network/networkManagers/scopeConnections","properties":{"tenantId":"54826b22-38d6-4fb2-bad9-b7b93a3e9c5a","resourceId":"/subscriptions/00000000-0000-0000-0000-000000000000","connectionState":"Pending","description":"My + Test Network Manager Scope Connection Updated Description"},"systemData":{"createdBy":"v-taoxuzeng@microsoft.com","createdByType":"User","createdAt":"2022-03-07T14:40:36.1688494Z","lastModifiedBy":"v-taoxuzeng@microsoft.com","lastModifiedByType":"User","lastModifiedAt":"2022-03-07T14:40:36.1688494Z"}}],"nextLink":""}' + headers: + cache-control: + - no-cache + content-length: + - '817' + content-type: + - application/json; charset=utf-8 + date: + - Mon, 07 Mar 2022 14:40:41 GMT + expires: + - '-1' + pragma: + - no-cache + server: + - Kestrel + strict-transport-security: + - max-age=31536000; includeSubDomains + transfer-encoding: + - chunked + vary: + - Accept-Encoding + x-content-type-options: + - nosniff + status: + code: 200 + message: OK +- request: + body: null + headers: + Accept: + - application/json + Accept-Encoding: + - gzip, deflate + CommandName: + - network manager scope-connection delete + Connection: + - keep-alive + Content-Length: + - '0' + ParameterSetName: + - -g --network-manager-name --name --yes + User-Agent: + - AZURECLI/2.31.0 azsdk-python-mgmt-network/1.0.0b1 Python/3.9.5 (Windows-10-10.0.17763-SP0) + method: DELETE + uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/test_network_manager_scope_connection000001/providers/Microsoft.Network/networkManagers/TestNetworkManager/scopeConnections/myTestScopeConnection?api-version=2021-05-01-preview + response: + body: + string: '' + headers: + cache-control: + - no-cache + content-length: + - '0' + date: + - Mon, 07 Mar 2022 14:40:43 GMT + expires: + - '-1' + pragma: + - no-cache + server: + - Kestrel + strict-transport-security: + - max-age=31536000; includeSubDomains + x-content-type-options: + - nosniff + x-ms-ratelimit-remaining-subscription-deletes: + - '14999' + status: + code: 200 + message: OK +- request: + body: null + headers: + Accept: + - application/json + Accept-Encoding: + - gzip, deflate + CommandName: + - network manager delete + Connection: + - keep-alive + Content-Length: + - '0' + ParameterSetName: + - --resource-group --name --yes + User-Agent: + - AZURECLI/2.31.0 azsdk-python-mgmt-network/1.0.0b1 Python/3.9.5 (Windows-10-10.0.17763-SP0) + method: DELETE + uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/test_network_manager_scope_connection000001/providers/Microsoft.Network/networkManagers/TestNetworkManager?api-version=2021-05-01-preview + response: + body: + string: '' + headers: + cache-control: + - no-cache + content-length: + - '0' + date: + - Mon, 07 Mar 2022 14:40:49 GMT + expires: + - '-1' + pragma: + - no-cache + server: + - Kestrel + strict-transport-security: + - max-age=31536000; includeSubDomains + x-content-type-options: + - nosniff + x-ms-ratelimit-remaining-subscription-deletes: + - '14999' + status: + code: 200 + message: OK +version: 1 diff --git a/src/network-manager/azext_network_manager/tests/latest/recordings/test_network_manager_security_admin_config_crud.yaml b/src/network-manager/azext_network_manager/tests/latest/recordings/test_network_manager_security_admin_config_crud.yaml index ca0e9de7559..90971416894 100644 --- a/src/network-manager/azext_network_manager/tests/latest/recordings/test_network_manager_security_admin_config_crud.yaml +++ b/src/network-manager/azext_network_manager/tests/latest/recordings/test_network_manager_security_admin_config_crud.yaml @@ -21,22 +21,22 @@ interactions: - --name --description --display-name --scope-accesses --network-manager-scopes -l --resource-group User-Agent: - - AZURECLI/2.30.0 azsdk-python-mgmt-network/1.0.0b1 Python/3.8.3 (Windows-10-10.0.18362-SP0) + - AZURECLI/2.31.0 azsdk-python-mgmt-network/1.0.0b1 Python/3.9.5 (Windows-10-10.0.17763-SP0) method: PUT - uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/test_network_manager_security_admin_config000001/providers/Microsoft.Network/networkManagers/TestNetworkManager?api-version=2021-02-01-preview + uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/test_network_manager_security_admin_config000001/providers/Microsoft.Network/networkManagers/TestNetworkManager?api-version=2021-05-01-preview response: body: string: '{"name":"TestNetworkManager","id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/test_network_manager_security_admin_config000001/providers/Microsoft.Network/networkManagers/TestNetworkManager","location":"eastus2euap","type":"Microsoft.Network/networkManagers","tags":{},"etag":"","properties":{"displayName":"TestNetworkManager","description":"My - Test Network Manager","networkManagerScopes":{"managementGroups":[],"subscriptions":["/subscriptions/00000000-0000-0000-0000-000000000000"]},"provisioningState":"Succeeded","networkManagerScopeAccesses":["SecurityAdmin","Connectivity"],"resourceGuid":"5cb2b39c-3caf-42ab-abea-d6a84cf9604f"},"systemData":{"createdBy":"v-kaisun@microsoft.com","createdByType":"User","createdAt":"2021-11-02T09:39:30.1058021Z","lastModifiedBy":"v-kaisun@microsoft.com","lastModifiedByType":"User","lastModifiedAt":"2021-11-02T09:39:30.1058021Z"}}' + Test Network Manager","networkManagerScopes":{"managementGroups":[],"subscriptions":["/subscriptions/00000000-0000-0000-0000-000000000000"],"multiTenantScopes":[]},"provisioningState":"Succeeded","networkManagerScopeAccesses":["SecurityAdmin","Connectivity"],"resourceGuid":"9a3583de-78cb-497b-a2a8-d2d5290d7943"},"systemData":{"createdBy":"v-taoxuzeng@microsoft.com","createdByType":"User","createdAt":"2022-03-07T09:36:37.1959036Z","lastModifiedBy":"v-taoxuzeng@microsoft.com","lastModifiedByType":"User","lastModifiedAt":"2022-03-07T09:36:37.1959036Z"}}' headers: cache-control: - no-cache content-length: - - '924' + - '926' content-type: - application/json; charset=utf-8 date: - - Tue, 02 Nov 2021 09:39:35 GMT + - Mon, 07 Mar 2022 09:36:42 GMT expires: - '-1' pragma: @@ -58,7 +58,7 @@ interactions: message: OK - request: body: '{"properties": {"displayName": "MyTestConfig", "description": "A sample - policy", "securityType": "AdminPolicy", "deleteExistingNSGs": "True"}}' + policy", "deleteExistingNSGs": "True"}}' headers: Accept: - application/json @@ -69,29 +69,29 @@ interactions: Connection: - keep-alive Content-Length: - - '142' + - '111' Content-Type: - application/json ParameterSetName: - --configuration-name --network-manager-name -g --description --delete-existing-ns-gs - --security-type --display-name + --display-name User-Agent: - - AZURECLI/2.30.0 azsdk-python-mgmt-network/1.0.0b1 Python/3.8.3 (Windows-10-10.0.18362-SP0) + - AZURECLI/2.31.0 azsdk-python-mgmt-network/1.0.0b1 Python/3.9.5 (Windows-10-10.0.17763-SP0) method: PUT - uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/test_network_manager_security_admin_config000001/providers/Microsoft.Network/networkManagers/TestNetworkManager/securityAdminConfigurations/myTestSecurityConfig?api-version=2021-02-01-preview + uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/test_network_manager_security_admin_config000001/providers/Microsoft.Network/networkManagers/TestNetworkManager/securityAdminConfigurations/myTestSecurityConfig?api-version=2021-05-01-preview response: body: string: '{"name":"myTestSecurityConfig","id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/test_network_manager_security_admin_config000001/providers/Microsoft.Network/networkManagers/TestNetworkManager/securityAdminConfigurations/myTestSecurityConfig","type":"Microsoft.Network/networkManagers/securityAdminConfigurations","etag":"","properties":{"displayName":"MyTestConfig","description":"A - sample policy","provisioningState":"Succeeded","resourceGuid":"374cffaf-642f-4715-8d6e-a12986d76f84"},"systemData":{"createdBy":"v-kaisun@microsoft.com","createdByType":"User","createdAt":"2021-11-02T09:39:37.2057552Z","lastModifiedBy":"v-kaisun@microsoft.com","lastModifiedByType":"User","lastModifiedAt":"2021-11-02T09:39:37.2057552Z"}}' + sample policy","provisioningState":"Succeeded","resourceGuid":"3455890a-2c32-49b0-a376-bd12ce812625","applyOnNetworkIntentPolicyBasedServices":[]},"systemData":{"createdBy":"v-taoxuzeng@microsoft.com","createdByType":"User","createdAt":"2022-03-07T09:36:43.9402828Z","lastModifiedBy":"v-taoxuzeng@microsoft.com","lastModifiedByType":"User","lastModifiedAt":"2022-03-07T09:36:43.9402828Z"}}' headers: cache-control: - no-cache content-length: - - '772' + - '796' content-type: - application/json; charset=utf-8 date: - - Tue, 02 Nov 2021 09:39:37 GMT + - Mon, 07 Mar 2022 09:36:44 GMT expires: - '-1' pragma: @@ -107,7 +107,7 @@ interactions: x-content-type-options: - nosniff x-ms-ratelimit-remaining-subscription-writes: - - '1197' + - '1199' status: code: 200 message: OK @@ -125,22 +125,22 @@ interactions: ParameterSetName: - --configuration-name --network-manager-name -g --description User-Agent: - - AZURECLI/2.30.0 azsdk-python-mgmt-network/1.0.0b1 Python/3.8.3 (Windows-10-10.0.18362-SP0) + - AZURECLI/2.31.0 azsdk-python-mgmt-network/1.0.0b1 Python/3.9.5 (Windows-10-10.0.17763-SP0) method: GET - uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/test_network_manager_security_admin_config000001/providers/Microsoft.Network/networkManagers/TestNetworkManager/securityAdminConfigurations/myTestSecurityConfig?api-version=2021-02-01-preview + uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/test_network_manager_security_admin_config000001/providers/Microsoft.Network/networkManagers/TestNetworkManager/securityAdminConfigurations/myTestSecurityConfig?api-version=2021-05-01-preview response: body: - string: '{"name":"myTestSecurityConfig","id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/test_network_manager_security_admin_config000001/providers/Microsoft.Network/networkManagers/TestNetworkManager/securityAdminConfigurations/myTestSecurityConfig","type":"Microsoft.Network/networkManagers/securityAdminConfigurations","etag":"\"210031b7-0000-3400-0000-618107590000\"","properties":{"displayName":"MyTestConfig","description":"A - sample policy","provisioningState":"Succeeded","resourceGuid":"374cffaf-642f-4715-8d6e-a12986d76f84"},"systemData":{"createdBy":"v-kaisun@microsoft.com","createdByType":"User","createdAt":"2021-11-02T09:39:37.2057552Z","lastModifiedBy":"v-kaisun@microsoft.com","lastModifiedByType":"User","lastModifiedAt":"2021-11-02T09:39:37.2057552Z"}}' + string: '{"name":"myTestSecurityConfig","id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/test_network_manager_security_admin_config000001/providers/Microsoft.Network/networkManagers/TestNetworkManager/securityAdminConfigurations/myTestSecurityConfig","type":"Microsoft.Network/networkManagers/securityAdminConfigurations","etag":"\"0000ad7a-0000-3400-0000-6225d22c0000\"","properties":{"displayName":"MyTestConfig","description":"A + sample policy","provisioningState":"Succeeded","resourceGuid":"3455890a-2c32-49b0-a376-bd12ce812625","applyOnNetworkIntentPolicyBasedServices":[]},"systemData":{"createdBy":"v-taoxuzeng@microsoft.com","createdByType":"User","createdAt":"2022-03-07T09:36:43.9402828Z","lastModifiedBy":"v-taoxuzeng@microsoft.com","lastModifiedByType":"User","lastModifiedAt":"2022-03-07T09:36:43.9402828Z"}}' headers: cache-control: - no-cache content-length: - - '812' + - '836' content-type: - application/json; charset=utf-8 date: - - Tue, 02 Nov 2021 09:39:40 GMT + - Mon, 07 Mar 2022 09:36:46 GMT expires: - '-1' pragma: @@ -159,7 +159,8 @@ interactions: code: 200 message: OK - request: - body: '{"properties": {"displayName": "MyTestConfig", "description": "test_description"}}' + body: '{"properties": {"displayName": "MyTestConfig", "description": "test_description", + "applyOnNetworkIntentPolicyBasedServices": []}}' headers: Accept: - application/json @@ -170,27 +171,27 @@ interactions: Connection: - keep-alive Content-Length: - - '82' + - '129' Content-Type: - application/json ParameterSetName: - --configuration-name --network-manager-name -g --description User-Agent: - - AZURECLI/2.30.0 azsdk-python-mgmt-network/1.0.0b1 Python/3.8.3 (Windows-10-10.0.18362-SP0) + - AZURECLI/2.31.0 azsdk-python-mgmt-network/1.0.0b1 Python/3.9.5 (Windows-10-10.0.17763-SP0) method: PUT - uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/test_network_manager_security_admin_config000001/providers/Microsoft.Network/networkManagers/TestNetworkManager/securityAdminConfigurations/myTestSecurityConfig?api-version=2021-02-01-preview + uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/test_network_manager_security_admin_config000001/providers/Microsoft.Network/networkManagers/TestNetworkManager/securityAdminConfigurations/myTestSecurityConfig?api-version=2021-05-01-preview response: body: - string: '{"name":"myTestSecurityConfig","id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/test_network_manager_security_admin_config000001/providers/Microsoft.Network/networkManagers/TestNetworkManager/securityAdminConfigurations/myTestSecurityConfig","type":"Microsoft.Network/networkManagers/securityAdminConfigurations","etag":"","properties":{"displayName":"MyTestConfig","description":"test_description","provisioningState":"Succeeded","resourceGuid":"374cffaf-642f-4715-8d6e-a12986d76f84"},"systemData":{"createdBy":"v-kaisun@microsoft.com","createdByType":"User","createdAt":"2021-11-02T09:39:37.2057552Z","lastModifiedBy":"v-kaisun@microsoft.com","lastModifiedByType":"User","lastModifiedAt":"2021-11-02T09:39:43.3557565Z"}}' + string: '{"name":"myTestSecurityConfig","id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/test_network_manager_security_admin_config000001/providers/Microsoft.Network/networkManagers/TestNetworkManager/securityAdminConfigurations/myTestSecurityConfig","type":"Microsoft.Network/networkManagers/securityAdminConfigurations","etag":"","properties":{"displayName":"MyTestConfig","description":"test_description","provisioningState":"Succeeded","resourceGuid":"3455890a-2c32-49b0-a376-bd12ce812625","applyOnNetworkIntentPolicyBasedServices":[]},"systemData":{"createdBy":"v-taoxuzeng@microsoft.com","createdByType":"User","createdAt":"2022-03-07T09:36:43.9402828Z","lastModifiedBy":"v-taoxuzeng@microsoft.com","lastModifiedByType":"User","lastModifiedAt":"2022-03-07T09:36:47.1871258Z"}}' headers: cache-control: - no-cache content-length: - - '773' + - '797' content-type: - application/json; charset=utf-8 date: - - Tue, 02 Nov 2021 09:39:43 GMT + - Mon, 07 Mar 2022 09:36:47 GMT expires: - '-1' pragma: @@ -206,7 +207,7 @@ interactions: x-content-type-options: - nosniff x-ms-ratelimit-remaining-subscription-writes: - - '1196' + - '1199' status: code: 200 message: OK @@ -224,21 +225,21 @@ interactions: ParameterSetName: - --network-manager-name -g User-Agent: - - AZURECLI/2.30.0 azsdk-python-mgmt-network/1.0.0b1 Python/3.8.3 (Windows-10-10.0.18362-SP0) + - AZURECLI/2.31.0 azsdk-python-mgmt-network/1.0.0b1 Python/3.9.5 (Windows-10-10.0.17763-SP0) method: GET - uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/test_network_manager_security_admin_config000001/providers/Microsoft.Network/networkManagers/TestNetworkManager/securityAdminConfigurations?api-version=2021-02-01-preview + uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/test_network_manager_security_admin_config000001/providers/Microsoft.Network/networkManagers/TestNetworkManager/securityAdminConfigurations?api-version=2021-05-01-preview response: body: - string: '{"nextLink":"","value":[{"name":"myTestSecurityConfig","id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/test_network_manager_security_admin_config000001/providers/Microsoft.Network/networkManagers/TestNetworkManager/securityAdminConfigurations/myTestSecurityConfig","type":"Microsoft.Network/networkManagers/securityAdminConfigurations","etag":"\"210045b7-0000-3400-0000-6181075f0000\"","properties":{"displayName":"MyTestConfig","description":"test_description","provisioningState":"Succeeded","resourceGuid":"374cffaf-642f-4715-8d6e-a12986d76f84"},"systemData":{"createdBy":"v-kaisun@microsoft.com","createdByType":"User","createdAt":"2021-11-02T09:39:37.2057552Z","lastModifiedBy":"v-kaisun@microsoft.com","lastModifiedByType":"User","lastModifiedAt":"2021-11-02T09:39:43.3557565Z"}}]}' + string: '{"nextLink":"","value":[{"name":"myTestSecurityConfig","id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/test_network_manager_security_admin_config000001/providers/Microsoft.Network/networkManagers/TestNetworkManager/securityAdminConfigurations/myTestSecurityConfig","type":"Microsoft.Network/networkManagers/securityAdminConfigurations","etag":"\"0000ae7a-0000-3400-0000-6225d2300000\"","properties":{"displayName":"MyTestConfig","description":"test_description","provisioningState":"Succeeded","resourceGuid":"3455890a-2c32-49b0-a376-bd12ce812625","applyOnNetworkIntentPolicyBasedServices":[]},"systemData":{"createdBy":"v-taoxuzeng@microsoft.com","createdByType":"User","createdAt":"2022-03-07T09:36:43.9402828Z","lastModifiedBy":"v-taoxuzeng@microsoft.com","lastModifiedByType":"User","lastModifiedAt":"2022-03-07T09:36:47.1871258Z"}}]}' headers: cache-control: - no-cache content-length: - - '839' + - '863' content-type: - application/json; charset=utf-8 date: - - Tue, 02 Nov 2021 09:39:46 GMT + - Mon, 07 Mar 2022 09:36:49 GMT expires: - '-1' pragma: @@ -270,21 +271,21 @@ interactions: ParameterSetName: - --configuration-name --network-manager-name -g User-Agent: - - AZURECLI/2.30.0 azsdk-python-mgmt-network/1.0.0b1 Python/3.8.3 (Windows-10-10.0.18362-SP0) + - AZURECLI/2.31.0 azsdk-python-mgmt-network/1.0.0b1 Python/3.9.5 (Windows-10-10.0.17763-SP0) method: GET - uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/test_network_manager_security_admin_config000001/providers/Microsoft.Network/networkManagers/TestNetworkManager/securityAdminConfigurations/myTestSecurityConfig?api-version=2021-02-01-preview + uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/test_network_manager_security_admin_config000001/providers/Microsoft.Network/networkManagers/TestNetworkManager/securityAdminConfigurations/myTestSecurityConfig?api-version=2021-05-01-preview response: body: - string: '{"name":"myTestSecurityConfig","id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/test_network_manager_security_admin_config000001/providers/Microsoft.Network/networkManagers/TestNetworkManager/securityAdminConfigurations/myTestSecurityConfig","type":"Microsoft.Network/networkManagers/securityAdminConfigurations","etag":"\"210045b7-0000-3400-0000-6181075f0000\"","properties":{"displayName":"MyTestConfig","description":"test_description","provisioningState":"Succeeded","resourceGuid":"374cffaf-642f-4715-8d6e-a12986d76f84"},"systemData":{"createdBy":"v-kaisun@microsoft.com","createdByType":"User","createdAt":"2021-11-02T09:39:37.2057552Z","lastModifiedBy":"v-kaisun@microsoft.com","lastModifiedByType":"User","lastModifiedAt":"2021-11-02T09:39:43.3557565Z"}}' + string: '{"name":"myTestSecurityConfig","id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/test_network_manager_security_admin_config000001/providers/Microsoft.Network/networkManagers/TestNetworkManager/securityAdminConfigurations/myTestSecurityConfig","type":"Microsoft.Network/networkManagers/securityAdminConfigurations","etag":"\"0000ae7a-0000-3400-0000-6225d2300000\"","properties":{"displayName":"MyTestConfig","description":"test_description","provisioningState":"Succeeded","resourceGuid":"3455890a-2c32-49b0-a376-bd12ce812625","applyOnNetworkIntentPolicyBasedServices":[]},"systemData":{"createdBy":"v-taoxuzeng@microsoft.com","createdByType":"User","createdAt":"2022-03-07T09:36:43.9402828Z","lastModifiedBy":"v-taoxuzeng@microsoft.com","lastModifiedByType":"User","lastModifiedAt":"2022-03-07T09:36:47.1871258Z"}}' headers: cache-control: - no-cache content-length: - - '813' + - '837' content-type: - application/json; charset=utf-8 date: - - Tue, 02 Nov 2021 09:39:49 GMT + - Mon, 07 Mar 2022 09:36:51 GMT expires: - '-1' pragma: @@ -316,11 +317,11 @@ interactions: Content-Length: - '0' ParameterSetName: - - --configuration-name --network-manager-name -g --yes + - --configuration-name --network-manager-name -g --force --yes User-Agent: - - AZURECLI/2.30.0 azsdk-python-mgmt-network/1.0.0b1 Python/3.8.3 (Windows-10-10.0.18362-SP0) + - AZURECLI/2.31.0 azsdk-python-mgmt-network/1.0.0b1 Python/3.9.5 (Windows-10-10.0.17763-SP0) method: DELETE - uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/test_network_manager_security_admin_config000001/providers/Microsoft.Network/networkManagers/TestNetworkManager/securityAdminConfigurations/myTestSecurityConfig?api-version=2021-02-01-preview + uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/test_network_manager_security_admin_config000001/providers/Microsoft.Network/networkManagers/TestNetworkManager/securityAdminConfigurations/myTestSecurityConfig?api-version=2021-05-01-preview&force=true response: body: string: '' @@ -330,7 +331,7 @@ interactions: content-length: - '0' date: - - Tue, 02 Nov 2021 09:39:51 GMT + - Mon, 07 Mar 2022 09:36:52 GMT expires: - '-1' pragma: @@ -342,7 +343,51 @@ interactions: x-content-type-options: - nosniff x-ms-ratelimit-remaining-subscription-deletes: - - '14997' + - '14998' + status: + code: 200 + message: OK +- request: + body: null + headers: + Accept: + - application/json + Accept-Encoding: + - gzip, deflate + CommandName: + - network manager delete + Connection: + - keep-alive + Content-Length: + - '0' + ParameterSetName: + - --resource-group --name --yes + User-Agent: + - AZURECLI/2.31.0 azsdk-python-mgmt-network/1.0.0b1 Python/3.9.5 (Windows-10-10.0.17763-SP0) + method: DELETE + uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/test_network_manager_security_admin_config000001/providers/Microsoft.Network/networkManagers/TestNetworkManager?api-version=2021-05-01-preview + response: + body: + string: '' + headers: + cache-control: + - no-cache + content-length: + - '0' + date: + - Mon, 07 Mar 2022 09:37:00 GMT + expires: + - '-1' + pragma: + - no-cache + server: + - Kestrel + strict-transport-security: + - max-age=31536000; includeSubDomains + x-content-type-options: + - nosniff + x-ms-ratelimit-remaining-subscription-deletes: + - '14998' status: code: 200 message: OK diff --git a/src/network-manager/azext_network_manager/tests/latest/recordings/test_network_manager_static_member_crud.yaml b/src/network-manager/azext_network_manager/tests/latest/recordings/test_network_manager_static_member_crud.yaml new file mode 100644 index 00000000000..d61ace6515a --- /dev/null +++ b/src/network-manager/azext_network_manager/tests/latest/recordings/test_network_manager_static_member_crud.yaml @@ -0,0 +1,487 @@ +interactions: +- request: + body: '{"location": "eastus2euap", "properties": {"displayName": "TestNetworkManager", + "description": "My Test Network Manager", "networkManagerScopes": {"subscriptions": + ["/subscriptions/00000000-0000-0000-0000-000000000000"]}, "networkManagerScopeAccesses": + ["Connectivity"]}}' + headers: + Accept: + - application/json + Accept-Encoding: + - gzip, deflate + CommandName: + - network manager create + Connection: + - keep-alive + Content-Length: + - '271' + Content-Type: + - application/json + ParameterSetName: + - --name --description --display-name --scope-accesses --network-manager-scopes + -l --resource-group + User-Agent: + - AZURECLI/2.31.0 azsdk-python-mgmt-network/1.0.0b1 Python/3.9.5 (Windows-10-10.0.17763-SP0) + method: PUT + uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/test_network_manager_static_member000001/providers/Microsoft.Network/networkManagers/TestNetworkManager?api-version=2021-05-01-preview + response: + body: + string: '{"name":"TestNetworkManager","id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/test_network_manager_static_member000001/providers/Microsoft.Network/networkManagers/TestNetworkManager","location":"eastus2euap","type":"Microsoft.Network/networkManagers","tags":{},"etag":"","properties":{"displayName":"TestNetworkManager","description":"My + Test Network Manager","networkManagerScopes":{"managementGroups":[],"subscriptions":["/subscriptions/00000000-0000-0000-0000-000000000000"],"multiTenantScopes":[]},"provisioningState":"Succeeded","networkManagerScopeAccesses":["Connectivity"],"resourceGuid":"f2f60508-67e3-4f64-b8f0-1437e40e8363"},"systemData":{"createdBy":"v-taoxuzeng@microsoft.com","createdByType":"User","createdAt":"2022-03-08T02:04:07.0272378Z","lastModifiedBy":"v-taoxuzeng@microsoft.com","lastModifiedByType":"User","lastModifiedAt":"2022-03-08T02:04:07.0272378Z"}}' + headers: + cache-control: + - no-cache + content-length: + - '902' + content-type: + - application/json; charset=utf-8 + date: + - Tue, 08 Mar 2022 02:04:11 GMT + expires: + - '-1' + pragma: + - no-cache + server: + - Kestrel + strict-transport-security: + - max-age=31536000; includeSubDomains + transfer-encoding: + - chunked + vary: + - Accept-Encoding + x-content-type-options: + - nosniff + x-ms-ratelimit-remaining-subscription-writes: + - '1199' + status: + code: 200 + message: OK +- request: + body: '{"properties": {"displayName": "MyNetworkGroup", "description": "A sample + group", "memberType": "Microsoft.Network/virtualNetworks"}}' + headers: + Accept: + - application/json + Accept-Encoding: + - gzip, deflate + CommandName: + - network manager group create + Connection: + - keep-alive + Content-Length: + - '133' + Content-Type: + - application/json + ParameterSetName: + - --name --network-manager-name --description --display-name --member-type -g + User-Agent: + - AZURECLI/2.31.0 azsdk-python-mgmt-network/1.0.0b1 Python/3.9.5 (Windows-10-10.0.17763-SP0) + method: PUT + uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/test_network_manager_static_member000001/providers/Microsoft.Network/networkManagers/TestNetworkManager/networkGroups/TestNetworkGroup?api-version=2021-05-01-preview + response: + body: + string: '{"name":"TestNetworkGroup","id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/test_network_manager_static_member000001/providers/Microsoft.Network/networkManagers/TestNetworkManager/networkGroups/TestNetworkGroup","type":"Microsoft.Network/networkManagers/networkGroups","etag":"","properties":{"displayName":"MyNetworkGroup","description":"A + sample group","groupMembers":[],"conditionalMembership":"","provisioningState":"Succeeded","resourceGuid":"b74ef60c-ff18-4e6b-9fab-b7667f5e3b0c"},"systemData":{"createdBy":"v-taoxuzeng@microsoft.com","createdByType":"User","createdAt":"2022-03-08T02:04:12.5537611Z","lastModifiedBy":"v-taoxuzeng@microsoft.com","lastModifiedByType":"User","lastModifiedAt":"2022-03-08T02:04:12.5537611Z"}}' + headers: + cache-control: + - no-cache + content-length: + - '753' + content-type: + - application/json; charset=utf-8 + date: + - Tue, 08 Mar 2022 02:04:14 GMT + expires: + - '-1' + pragma: + - no-cache + server: + - Kestrel + strict-transport-security: + - max-age=31536000; includeSubDomains + transfer-encoding: + - chunked + vary: + - Accept-Encoding + x-content-type-options: + - nosniff + x-ms-ratelimit-remaining-subscription-writes: + - '1199' + status: + code: 200 + message: OK +- request: + body: '{"properties": {"resourceId": "/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/test_network_manager_static_member000001/providers/Microsoft.Network/virtualnetworks/clitest.vn000002"}}' + headers: + Accept: + - application/json + Accept-Encoding: + - gzip, deflate + CommandName: + - network manager group static-member create + Connection: + - keep-alive + Content-Length: + - '202' + Content-Type: + - application/json + ParameterSetName: + - --name --network-group-name --network-manager-name --resource-id -g + User-Agent: + - AZURECLI/2.31.0 azsdk-python-mgmt-network/1.0.0b1 Python/3.9.5 (Windows-10-10.0.17763-SP0) + method: PUT + uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/test_network_manager_static_member000001/providers/Microsoft.Network/networkManagers/TestNetworkManager/networkGroups/TestNetworkGroup/staticMembers/TestStaticMember?api-version=2021-05-01-preview + response: + body: + string: '{"name":"TestStaticMember","id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/test_network_manager_static_member000001/providers/Microsoft.Network/networkManagers/TestNetworkManager/networkGroups/TestNetworkGroup/staticMembers/TestStaticMember","type":"Microsoft.Network/networkManagers/networkGroups/staticMembers","etag":"","properties":{"resourceId":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/test_network_manager_static_member000001/providers/Microsoft.Network/virtualnetworks/clitest.vn000002"},"systemData":{"createdBy":"v-taoxuzeng@microsoft.com","createdByType":"User","createdAt":"2022-03-08T02:04:15.7028252Z","lastModifiedBy":"v-taoxuzeng@microsoft.com","lastModifiedByType":"User","lastModifiedAt":"2022-03-08T02:04:15.7028252Z"}}' + headers: + cache-control: + - no-cache + content-length: + - '789' + content-type: + - application/json; charset=utf-8 + date: + - Tue, 08 Mar 2022 02:04:16 GMT + expires: + - '-1' + pragma: + - no-cache + server: + - Kestrel + strict-transport-security: + - max-age=31536000; includeSubDomains + transfer-encoding: + - chunked + vary: + - Accept-Encoding + x-content-type-options: + - nosniff + x-ms-ratelimit-remaining-subscription-writes: + - '1196' + status: + code: 200 + message: OK +- request: + body: null + headers: + Accept: + - application/json + Accept-Encoding: + - gzip, deflate + CommandName: + - network manager group static-member update + Connection: + - keep-alive + ParameterSetName: + - -g --name --network-group-name --network-manager-name --resource-id + User-Agent: + - AZURECLI/2.31.0 azsdk-python-mgmt-network/1.0.0b1 Python/3.9.5 (Windows-10-10.0.17763-SP0) + method: GET + uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/test_network_manager_static_member000001/providers/Microsoft.Network/networkManagers/TestNetworkManager/networkGroups/TestNetworkGroup/staticMembers/TestStaticMember?api-version=2021-05-01-preview + response: + body: + string: '{"name":"TestStaticMember","id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/test_network_manager_static_member000001/providers/Microsoft.Network/networkManagers/TestNetworkManager/networkGroups/TestNetworkGroup/staticMembers/TestStaticMember","type":"Microsoft.Network/networkManagers/networkGroups/staticMembers","etag":"\"00006b86-0000-3400-0000-6226b9a00000\"","properties":{"resourceId":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/test_network_manager_static_member000001/providers/Microsoft.Network/virtualnetworks/clitest.vn000002"},"systemData":{"createdBy":"v-taoxuzeng@microsoft.com","createdByType":"User","createdAt":"2022-03-08T02:04:15.7028252Z","lastModifiedBy":"v-taoxuzeng@microsoft.com","lastModifiedByType":"User","lastModifiedAt":"2022-03-08T02:04:15.7028252Z"}}' + headers: + cache-control: + - no-cache + content-length: + - '829' + content-type: + - application/json; charset=utf-8 + date: + - Tue, 08 Mar 2022 02:04:17 GMT + expires: + - '-1' + pragma: + - no-cache + server: + - Kestrel + strict-transport-security: + - max-age=31536000; includeSubDomains + transfer-encoding: + - chunked + vary: + - Accept-Encoding + x-content-type-options: + - nosniff + status: + code: 200 + message: OK +- request: + body: '{"properties": {"resourceId": "/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/test_network_manager_static_member000001/providers/Microsoft.Network/virtualnetworks/clitest.vn000002"}}' + headers: + Accept: + - application/json + Accept-Encoding: + - gzip, deflate + CommandName: + - network manager group static-member update + Connection: + - keep-alive + Content-Length: + - '202' + Content-Type: + - application/json + ParameterSetName: + - -g --name --network-group-name --network-manager-name --resource-id + User-Agent: + - AZURECLI/2.31.0 azsdk-python-mgmt-network/1.0.0b1 Python/3.9.5 (Windows-10-10.0.17763-SP0) + method: PUT + uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/test_network_manager_static_member000001/providers/Microsoft.Network/networkManagers/TestNetworkManager/networkGroups/TestNetworkGroup/staticMembers/TestStaticMember?api-version=2021-05-01-preview + response: + body: + string: '{"name":"TestStaticMember","id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/test_network_manager_static_member000001/providers/Microsoft.Network/networkManagers/TestNetworkManager/networkGroups/TestNetworkGroup/staticMembers/TestStaticMember","type":"Microsoft.Network/networkManagers/networkGroups/staticMembers","etag":"","properties":{"resourceId":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/test_network_manager_static_member000001/providers/Microsoft.Network/virtualnetworks/clitest.vn000002"},"systemData":{"createdBy":"v-taoxuzeng@microsoft.com","createdByType":"User","createdAt":"2022-03-08T02:04:15.7028252Z","lastModifiedBy":"v-taoxuzeng@microsoft.com","lastModifiedByType":"User","lastModifiedAt":"2022-03-08T02:04:19.3966048Z"}}' + headers: + cache-control: + - no-cache + content-length: + - '789' + content-type: + - application/json; charset=utf-8 + date: + - Tue, 08 Mar 2022 02:04:19 GMT + expires: + - '-1' + pragma: + - no-cache + server: + - Kestrel + strict-transport-security: + - max-age=31536000; includeSubDomains + transfer-encoding: + - chunked + vary: + - Accept-Encoding + x-content-type-options: + - nosniff + x-ms-ratelimit-remaining-subscription-writes: + - '1198' + status: + code: 200 + message: OK +- request: + body: null + headers: + Accept: + - application/json + Accept-Encoding: + - gzip, deflate + CommandName: + - network manager group static-member show + Connection: + - keep-alive + ParameterSetName: + - -g --name --network-group-name --network-manager-name + User-Agent: + - AZURECLI/2.31.0 azsdk-python-mgmt-network/1.0.0b1 Python/3.9.5 (Windows-10-10.0.17763-SP0) + method: GET + uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/test_network_manager_static_member000001/providers/Microsoft.Network/networkManagers/TestNetworkManager/networkGroups/TestNetworkGroup/staticMembers/TestStaticMember?api-version=2021-05-01-preview + response: + body: + string: '{"name":"TestStaticMember","id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/test_network_manager_static_member000001/providers/Microsoft.Network/networkManagers/TestNetworkManager/networkGroups/TestNetworkGroup/staticMembers/TestStaticMember","type":"Microsoft.Network/networkManagers/networkGroups/staticMembers","etag":"\"00006e86-0000-3400-0000-6226b9a60000\"","properties":{"resourceId":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/test_network_manager_static_member000001/providers/Microsoft.Network/virtualnetworks/clitest.vn000002"},"systemData":{"createdBy":"v-taoxuzeng@microsoft.com","createdByType":"User","createdAt":"2022-03-08T02:04:15.7028252Z","lastModifiedBy":"v-taoxuzeng@microsoft.com","lastModifiedByType":"User","lastModifiedAt":"2022-03-08T02:04:19.3966048Z"}}' + headers: + cache-control: + - no-cache + content-length: + - '829' + content-type: + - application/json; charset=utf-8 + date: + - Tue, 08 Mar 2022 02:04:21 GMT + expires: + - '-1' + pragma: + - no-cache + server: + - Kestrel + strict-transport-security: + - max-age=31536000; includeSubDomains + transfer-encoding: + - chunked + vary: + - Accept-Encoding + x-content-type-options: + - nosniff + status: + code: 200 + message: OK +- request: + body: null + headers: + Accept: + - application/json + Accept-Encoding: + - gzip, deflate + CommandName: + - network manager group static-member list + Connection: + - keep-alive + ParameterSetName: + - -g --network-group-name --network-manager-name + User-Agent: + - AZURECLI/2.31.0 azsdk-python-mgmt-network/1.0.0b1 Python/3.9.5 (Windows-10-10.0.17763-SP0) + method: GET + uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/test_network_manager_static_member000001/providers/Microsoft.Network/networkManagers/TestNetworkManager/networkGroups/TestNetworkGroup/staticMembers?api-version=2021-05-01-preview + response: + body: + string: '{"nextLink":"","value":[{"name":"TestStaticMember","id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/test_network_manager_static_member000001/providers/Microsoft.Network/networkManagers/TestNetworkManager/networkGroups/TestNetworkGroup/staticMembers/TestStaticMember","type":"Microsoft.Network/networkManagers/networkGroups/staticMembers","etag":"","properties":{"resourceId":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/test_network_manager_static_member000001/providers/Microsoft.Network/virtualnetworks/clitest.vn000002"},"systemData":{"createdBy":"v-taoxuzeng@microsoft.com","createdByType":"User","createdAt":"2022-03-08T02:04:15.7028252Z","lastModifiedBy":"v-taoxuzeng@microsoft.com","lastModifiedByType":"User","lastModifiedAt":"2022-03-08T02:04:19.3966048Z"}}]}' + headers: + cache-control: + - no-cache + content-length: + - '815' + content-type: + - application/json; charset=utf-8 + date: + - Tue, 08 Mar 2022 02:04:23 GMT + expires: + - '-1' + pragma: + - no-cache + server: + - Kestrel + strict-transport-security: + - max-age=31536000; includeSubDomains + transfer-encoding: + - chunked + vary: + - Accept-Encoding + x-content-type-options: + - nosniff + status: + code: 200 + message: OK +- request: + body: null + headers: + Accept: + - application/json + Accept-Encoding: + - gzip, deflate + CommandName: + - network manager group static-member delete + Connection: + - keep-alive + Content-Length: + - '0' + ParameterSetName: + - -g --name --network-group-name --network-manager-name --yes + User-Agent: + - AZURECLI/2.31.0 azsdk-python-mgmt-network/1.0.0b1 Python/3.9.5 (Windows-10-10.0.17763-SP0) + method: DELETE + uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/test_network_manager_static_member000001/providers/Microsoft.Network/networkManagers/TestNetworkManager/networkGroups/TestNetworkGroup/staticMembers/TestStaticMember?api-version=2021-05-01-preview + response: + body: + string: '' + headers: + cache-control: + - no-cache + content-length: + - '0' + date: + - Tue, 08 Mar 2022 02:04:25 GMT + expires: + - '-1' + pragma: + - no-cache + server: + - Kestrel + strict-transport-security: + - max-age=31536000; includeSubDomains + x-content-type-options: + - nosniff + x-ms-ratelimit-remaining-subscription-deletes: + - '14999' + status: + code: 200 + message: OK +- request: + body: null + headers: + Accept: + - application/json + Accept-Encoding: + - gzip, deflate + CommandName: + - network manager group delete + Connection: + - keep-alive + Content-Length: + - '0' + ParameterSetName: + - -g --name --network-manager-name --force --yes + User-Agent: + - AZURECLI/2.31.0 azsdk-python-mgmt-network/1.0.0b1 Python/3.9.5 (Windows-10-10.0.17763-SP0) + method: DELETE + uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/test_network_manager_static_member000001/providers/Microsoft.Network/networkManagers/TestNetworkManager/networkGroups/TestNetworkGroup?api-version=2021-05-01-preview&force=true + response: + body: + string: '' + headers: + cache-control: + - no-cache + content-length: + - '0' + date: + - Tue, 08 Mar 2022 02:04:28 GMT + expires: + - '-1' + pragma: + - no-cache + server: + - Kestrel + strict-transport-security: + - max-age=31536000; includeSubDomains + x-content-type-options: + - nosniff + x-ms-ratelimit-remaining-subscription-deletes: + - '14999' + status: + code: 200 + message: OK +- request: + body: null + headers: + Accept: + - application/json + Accept-Encoding: + - gzip, deflate + CommandName: + - network manager delete + Connection: + - keep-alive + Content-Length: + - '0' + ParameterSetName: + - --resource-group --name --yes + User-Agent: + - AZURECLI/2.31.0 azsdk-python-mgmt-network/1.0.0b1 Python/3.9.5 (Windows-10-10.0.17763-SP0) + method: DELETE + uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/test_network_manager_static_member000001/providers/Microsoft.Network/networkManagers/TestNetworkManager?api-version=2021-05-01-preview + response: + body: + string: '' + headers: + cache-control: + - no-cache + content-length: + - '0' + date: + - Tue, 08 Mar 2022 02:04:34 GMT + expires: + - '-1' + pragma: + - no-cache + server: + - Kestrel + strict-transport-security: + - max-age=31536000; includeSubDomains + x-content-type-options: + - nosniff + x-ms-ratelimit-remaining-subscription-deletes: + - '14999' + status: + code: 200 + message: OK +version: 1 diff --git a/src/network-manager/azext_network_manager/tests/latest/test_network_scenario.py b/src/network-manager/azext_network_manager/tests/latest/test_network_scenario.py index 512dc2a1292..7e5e317d05b 100644 --- a/src/network-manager/azext_network_manager/tests/latest/test_network_scenario.py +++ b/src/network-manager/azext_network_manager/tests/latest/test_network_scenario.py @@ -27,19 +27,17 @@ class NetworkScenarioTest(ScenarioTest): def __init__(self, *args, **kwargs): super(NetworkScenarioTest, self).__init__(*args, **kwargs) - @ResourceGroupPreparer(name_prefix='test_network_manager', location='eastus2euap') + @ResourceGroupPreparer(name_prefix='test_network_manager_crud', location='eastus2euap') def test_network_manager_crud(self, resource_group): self.kwargs.update({ 'name': 'TestNetworkManager', - 'description': '"My Test Network Manager"', - 'display_name': 'TestNetworkManager', 'sub': '/subscriptions/{}'.format(self.get_subscription_id()) }) - self.cmd('network manager create --name {name} --description {description} --display-name {display_name} ' + self.cmd('network manager create --name {name} --description "My Test Network Manager" --display-name "TestNetworkManager" ' '--scope-accesses "Connectivity" ' '--network-manager-scopes ' - ' subscriptions={sub} ' + 'subscriptions={sub} ' '-l eastus2euap ' '--resource-group {rg}') @@ -53,8 +51,7 @@ def test_network_manager_crud(self, resource_group): self.cmd('network manager delete --resource-group {rg} --name {name} --yes') @ResourceGroupPreparer(name_prefix='test_network_manager_group', location='eastus2euap') - @VirtualNetworkPreparer() - def test_network_manager_group_crud(self, virtual_network, resource_group): + def test_network_manager_group_crud(self, resource_group): self.kwargs.update({ 'name': 'TestNetworkGroup', @@ -62,8 +59,7 @@ def test_network_manager_group_crud(self, virtual_network, resource_group): 'description': '"A sample group"', 'display_name': 'MyNetworkGroup', 'member_type': 'Microsoft.Network/virtualNetworks', - 'sub': '/subscriptions/{}'.format(self.get_subscription_id()), - 'virtual_network': virtual_network + 'sub': '/subscriptions/{}'.format(self.get_subscription_id()) }) self.cmd('network manager create --name {manager_name} --description "My Test Network Manager" --display-name "TestNetworkManager" ' @@ -73,15 +69,51 @@ def test_network_manager_group_crud(self, virtual_network, resource_group): '-l eastus2euap ' '--resource-group {rg}') - self.cmd('network manager group create --name {name} --network-manager-name {manager_name} --description {description} ' - '--conditional-membership "" --display-name {display_name} --member-type "{member_type}" -g {rg} ' - '--group-members resource-id="{sub}/resourceGroups/{rg}/providers/Microsoft.Network/virtualnetworks/{virtual_network}" ') + self.cmd('network manager group create --name {name} --network-manager-name {manager_name} ' + '--description {description} --display-name {display_name} --member-type {member_type} -g {rg} ') self.cmd('network manager group update -g {rg} --name {name} --network-manager-name {manager_name} --description "Desc changed."') self.cmd('network manager group show -g {rg} --name {name} --network-manager-name {manager_name}') self.cmd('network manager group list -g {rg} --network-manager-name {manager_name}') - self.cmd('network manager group delete -g {rg} --name {name} --network-manager-name {manager_name} --yes') + self.cmd('network manager group delete -g {rg} --name {name} --network-manager-name {manager_name} --force --yes') + self.cmd('network manager delete --resource-group {rg} --name {manager_name} --yes') + @ResourceGroupPreparer(name_prefix='test_network_manager_static_member', location='eastus2euap') + @VirtualNetworkPreparer() + def test_network_manager_static_member_crud(self, virtual_network, resource_group): + self.kwargs.update({ + 'name': 'TestStaticMember', + 'group_name': 'TestNetworkGroup', + 'manager_name': 'TestNetworkManager', + 'description': '"A sample group"', + 'display_name': 'MyNetworkGroup', + 'member_type': 'Microsoft.Network/virtualNetworks', + 'sub': '/subscriptions/{}'.format(self.get_subscription_id()), + 'virtual_network': virtual_network + }) + self.cmd('network manager create --name {manager_name} --description "My Test Network Manager" --display-name "TestNetworkManager" ' + '--scope-accesses "Connectivity" ' + '--network-manager-scopes ' + ' subscriptions={sub} ' + '-l eastus2euap ' + '--resource-group {rg}') + + self.cmd('network manager group create --name {group_name} --network-manager-name {manager_name} --description {description} ' + '--display-name {display_name} --member-type {member_type} -g {rg} ') + + self.cmd('network manager group static-member create --name {name} --network-group-name {group_name} --network-manager-name {manager_name} ' + '--resource-id="{sub}/resourceGroups/{rg}/providers/Microsoft.Network/virtualnetworks/{virtual_network}" -g {rg}') + + self.cmd('network manager group static-member update -g {rg} --name {name} --network-group-name {group_name} --network-manager-name {manager_name} ' + '--resource-id="{sub}/resourceGroups/{rg}/providers/Microsoft.Network/virtualnetworks/{virtual_network}"') + self.cmd('network manager group static-member show -g {rg} --name {name} --network-group-name {group_name} --network-manager-name {manager_name}') + self.cmd('network manager group static-member list -g {rg} --network-group-name {group_name} --network-manager-name {manager_name}') + self.cmd('network manager group static-member delete -g {rg} --name {name} --network-group-name {group_name} --network-manager-name {manager_name} --yes') + + self.cmd('network manager group delete -g {rg} --name {group_name} --network-manager-name {manager_name} --force --yes') + self.cmd('network manager delete --resource-group {rg} --name {manager_name} --yes') + + @unittest.skip('skip') @ResourceGroupPreparer(name_prefix='test_network_manager_security_user_config', location='eastus2euap') def test_network_manager_security_user_config_crud(self, resource_group): @@ -140,8 +172,8 @@ def test_network_manager_security_admin_config_crud(self, resource_group): # test nm uncommit # self.cmd('network manager post-commit --network-manager-name {manager_name} --commit-type "SecurityAdmin" --target-locations "eastus2euap" -g {rg} ') - self.cmd('network manager security-admin-config delete --configuration-name {name} --network-manager-name {manager_name} -g {rg} --yes') - + self.cmd('network manager security-admin-config delete --configuration-name {name} --network-manager-name {manager_name} -g {rg} --force --yes') + self.cmd('network manager delete --resource-group {rg} --name {manager_name} --yes') @ResourceGroupPreparer(name_prefix='test_network_manager_admin_rule_crud', location='eastus2euap') @VirtualNetworkPreparer() @@ -155,7 +187,8 @@ def test_network_manager_admin_rule_crud(self, virtual_network, resource_group): 'group_name': 'TestNetworkGroup', 'description': '"A sample policy"', 'sub': '/subscriptions/{}'.format(self.get_subscription_id()), - 'virtual_network': virtual_network + 'virtual_network': virtual_network, + 'name': 'TestStaticMember' }) @@ -167,8 +200,10 @@ def test_network_manager_admin_rule_crud(self, virtual_network, resource_group): '--resource-group {rg}') self.cmd('network manager group create --name {group_name} --network-manager-name {manager_name} --description {description} ' - '--conditional-membership "" --display-name ASampleGroup --member-type "Microsoft.Network/virtualNetworks" -g {rg} ' - '--group-members resource-id="{sub}/resourceGroups/{rg}/providers/Microsoft.Network/virtualnetworks/{virtual_network}" ') + ' --display-name ASampleGroup --member-type "Microsoft.Network/virtualNetworks" -g {rg} ') + + self.cmd('network manager group static-member create --name {name} --network-group-name {group_name} --network-manager-name {manager_name} ' + '--resource-id="{sub}/resourceGroups/{rg}/providers/Microsoft.Network/virtualnetworks/{virtual_network}" -g {rg} ') self.cmd('network manager security-admin-config create --configuration-name {config_name} --network-manager-name {manager_name} -g {rg} ' '--description {description} --delete-existing-ns-gs true --display-name MyTestConfig') @@ -186,6 +221,10 @@ def test_network_manager_admin_rule_crud(self, virtual_network, resource_group): self.cmd('network manager security-admin-config rule-collection rule list -g {rg} --network-manager-name {manager_name} --configuration-name {config_name} --rule-collection-name {collection_name}') self.cmd('network manager security-admin-config rule-collection rule delete -g {rg} --network-manager-name {manager_name} --configuration-name {config_name} --rule-collection-name {collection_name} --rule-name {rule_name} --yes') + self.cmd('network manager security-admin-config delete --configuration-name {name} --network-manager-name {manager_name} -g {rg} --force --yes') + self.cmd('network manager group delete -g {rg} --name {group_name} --network-manager-name {manager_name} --force --yes') + self.cmd('network manager delete --resource-group {rg} --name {manager_name} --yes') + @ResourceGroupPreparer(name_prefix='test_network_manager_admin_rule_collection_crud', location='eastus2euap') @VirtualNetworkPreparer() @@ -198,7 +237,8 @@ def test_network_manager_admin_rule_collection_crud(self, virtual_network, resou 'group_name': 'TestNetworkGroup', 'description': '"A sample policy"', 'sub': '/subscriptions/{}'.format(self.get_subscription_id()), - 'virtual_network': virtual_network + 'virtual_network': virtual_network, + 'name': 'TestStaticMember' }) self.cmd('network manager create --name {manager_name} --description "My Test Network Manager" --display-name "TestNetworkManager" ' @@ -209,8 +249,10 @@ def test_network_manager_admin_rule_collection_crud(self, virtual_network, resou '--resource-group {rg}') self.cmd('network manager group create --name {group_name} --network-manager-name {manager_name} --description {description} ' - '--conditional-membership "" --display-name ASampleGroup --member-type "Microsoft.Network/virtualNetworks" -g {rg} ' - '--group-members resource-id="{sub}/resourceGroups/{rg}/providers/Microsoft.Network/virtualnetworks/{virtual_network}" ') + '--display-name ASampleGroup --member-type "Microsoft.Network/virtualNetworks" -g {rg} ') + + self.cmd('network manager group static-member create --name {name} --network-group-name {group_name} --network-manager-name {manager_name} ' + '--resource-id="{sub}/resourceGroups/{rg}/providers/Microsoft.Network/virtualnetworks/{virtual_network}" -g {rg} ') self.cmd('network manager security-admin-config create --configuration-name {config_name} --network-manager-name {manager_name} -g {rg} ' '--description {description} --delete-existing-ns-gs true --display-name MyTestConfig') @@ -227,10 +269,11 @@ def test_network_manager_admin_rule_collection_crud(self, virtual_network, resou self.cmd('network manager security-admin-config rule-collection list -g {rg} --configuration-name {config_name} --network-manager-name {manager_name}') self.cmd('network manager security-admin-config rule-collection delete -g {rg} --configuration-name {config_name} --network-manager-name {manager_name} --rule-collection-name {collection_name} --yes') - self.cmd('network manager security-admin-config delete --configuration-name {config_name} --network-manager-name {manager_name} -g {rg} --yes') - self.cmd('network manager group delete -g {rg} --name {group_name} --network-manager-name {manager_name} --yes') - + self.cmd('network manager security-admin-config delete --configuration-name {config_name} --network-manager-name {manager_name} -g {rg} --force --yes') + self.cmd('network manager group delete -g {rg} --name {group_name} --network-manager-name {manager_name} --force --yes') + self.cmd('network manager delete --resource-group {rg} --name {manager_name} --yes') + @unittest.skip('skip') @ResourceGroupPreparer(name_prefix='test_network_manager_user_rule_crud', location='eastus2euap') @VirtualNetworkPreparer() def test_network_manager_user_rule_crud(self, virtual_network, resource_group): @@ -253,8 +296,10 @@ def test_network_manager_user_rule_crud(self, virtual_network, resource_group): '--resource-group {rg}') self.cmd('network manager group create --name {group_name} --network-manager-name {manager_name} --description {description} ' - '--conditional-membership "" --display-name ASampleGroup --member-type "Microsoft.Network/virtualNetworks" -g {rg} ' - '--group-members resource-id="{sub}/resourceGroups/{rg}/providers/Microsoft.Network/virtualnetworks/{virtual_network}" ') + '--display-name ASampleGroup --member-type "Microsoft.Network/virtualNetworks" -g {rg} ') + + self.cmd('network manager group static-member create --name {name} --network-group-name {group_name} --network-manager-name {manager_name} ' + '--resource-id="{sub}/resourceGroups/{rg}/providers/Microsoft.Network/virtualnetworks/{virtual_network}" -g {rg} ') self.cmd('network manager security-user-config create --configuration-name {config_name} --network-manager-name {manager_name} -g {rg} ' '--description {description} --delete-existing-ns-gs true --display-name MyTestConfig') @@ -271,6 +316,7 @@ def test_network_manager_user_rule_crud(self, virtual_network, resource_group): self.cmd('network manager security-user-config rule-collection rule list -g {rg} --network-manager-name {manager_name} --configuration-name {config_name} --rule-collection-name {collection_name}') self.cmd('network manager security-user-config rule-collection rule delete -g {rg} --network-manager-name {manager_name} --configuration-name {config_name} --rule-collection-name {collection_name} --rule-name {rule_name} --yes') + @unittest.skip('skip') @ResourceGroupPreparer(name_prefix='test_network_manager_user_rule_collection_crud', location='eastus2') @VirtualNetworkPreparer() def test_network_manager_user_rule_collection_crud(self, virtual_network, resource_group): @@ -293,8 +339,10 @@ def test_network_manager_user_rule_collection_crud(self, virtual_network, resour '--resource-group {rg}') self.cmd('network manager group create --name {group_name} --network-manager-name {manager_name} --description {description} ' - '--conditional-membership "" --display-name ASampleGroup --member-type "Microsoft.Network/virtualNetworks" -g {rg} ' - '--group-members resource-id="{sub}/resourceGroups/{rg}/providers/Microsoft.Network/virtualnetworks/{virtual_network}" ') + '--display-name ASampleGroup --member-type "Microsoft.Network/virtualNetworks" -g {rg} ') + + self.cmd('network manager group static-member create --name {name} --network-group-name {group_name} --network-manager-name {manager_name} ' + '--resource-id="{sub}/resourceGroups/{rg}/providers/Microsoft.Network/virtualnetworks/{virtual_network}" -g {rg} ') self.cmd('network manager security-user-config create --configuration-name {config_name} --network-manager-name {manager_name} -g {rg} ' '--description {description} --delete-existing-ns-gs true --display-name MyTestConfig') @@ -320,7 +368,8 @@ def test_network_manager_connect_config_crud(self, virtual_network, resource_gro 'group_name': 'TestNetworkGroup', 'description': '"A sample policy"', 'sub': '/subscriptions/{}'.format(self.get_subscription_id()), - 'virtual_network': virtual_network + 'virtual_network': virtual_network, + 'name': 'TestStaticMember' }) self.cmd('network manager create --name {manager_name} --description "My Test Network Manager" --display-name "TestNetworkManager" ' @@ -331,8 +380,10 @@ def test_network_manager_connect_config_crud(self, virtual_network, resource_gro '--resource-group {rg}') self.cmd('network manager group create --name {group_name} --network-manager-name {manager_name} --description {description} ' - '--conditional-membership "" --display-name ASampleGroup --member-type "Microsoft.Network/virtualNetworks" -g {rg} ' - '--group-members resource-id="{sub}/resourceGroups/{rg}/providers/Microsoft.Network/virtualnetworks/{virtual_network}" ') + '--display-name ASampleGroup --member-type "Microsoft.Network/virtualNetworks" -g {rg} ') + + self.cmd('network manager group static-member create --name {name} --network-group-name {group_name} --network-manager-name {manager_name} ' + '--resource-id="{sub}/resourceGroups/{rg}/providers/Microsoft.Network/virtualnetworks/{virtual_network}" -g {rg} ') self.cmd('network manager connect-config create --configuration-name {config_name} --network-manager-name {manager_name} -g {rg} ' '--applies-to-groups group-connectivity="None" network-group-id={sub}/resourceGroups/{rg}/providers/Microsoft.Network/networkManagers/{manager_name}/networkGroups/{group_name} ' @@ -344,6 +395,9 @@ def test_network_manager_connect_config_crud(self, virtual_network, resource_gro self.cmd('network manager connect-config list --network-manager-name {manager_name} -g {rg}') self.cmd('network manager connect-config delete --configuration-name {config_name} --network-manager-name {manager_name} -g {rg} --yes') + self.cmd('network manager group delete -g {rg} --name {group_name} --network-manager-name {manager_name} --force --yes') + self.cmd('network manager delete --resource-group {rg} --name {manager_name} --yes') + @ResourceGroupPreparer(name_prefix='test_network_manager_list_queries', location='eastus2euap') @VirtualNetworkPreparer() @@ -354,7 +408,8 @@ def test_network_manager_list_queries(self, virtual_network, resource_group): 'group_name': 'TestNetworkGroup', 'description': '"A sample policy"', 'sub': '/subscriptions/{}'.format(self.get_subscription_id()), - 'virtual_network': virtual_network + 'virtual_network': virtual_network, + 'name': 'TestStaticMember' }) self.cmd('network manager create --name {manager_name} --description "My Test Network Manager" --display-name "TestNetworkManager" ' @@ -365,8 +420,10 @@ def test_network_manager_list_queries(self, virtual_network, resource_group): '--resource-group {rg}') self.cmd('network manager group create --name {group_name} --network-manager-name {manager_name} --description {description} ' - '--conditional-membership "" --display-name ASampleGroup --member-type "Microsoft.Network/virtualNetworks" -g {rg} ' - '--group-members resource-id="{sub}/resourceGroups/{rg}/providers/Microsoft.Network/virtualnetworks/{virtual_network}" ') + '--display-name ASampleGroup --member-type "Microsoft.Network/virtualNetworks" -g {rg} ') + + self.cmd('network manager group static-member create --name {name} --network-group-name {group_name} --network-manager-name {manager_name} ' + '--resource-id="{sub}/resourceGroups/{rg}/providers/Microsoft.Network/virtualnetworks/{virtual_network}" -g {rg} ') self.cmd('network manager list-deploy-status --network-manager-name {manager_name} --deployment-types "Connectivity" --regions "eastus2euap" --resource-group {rg}') self.cmd('network manager group list-effect-vnet --network-group-name {group_name} --network-manager-name {manager_name} --resource-group {rg}') @@ -377,3 +434,98 @@ def test_network_manager_list_queries(self, virtual_network, resource_group): self.cmd('network manager list-active-security-admin-rule --network-manager-name {manager_name} -g {rg} --regions eastus2euap') # Internal Server Error # self.cmd('network manager list-active-security-user-rule --network-manager-name {manager_name} -g {rg} --region eastus2euap') + + self.cmd('network manager group delete -g {rg} --name {group_name} --network-manager-name {manager_name} --force --yes') + self.cmd('network manager delete --resource-group {rg} --name {manager_name} --yes') + + + @ResourceGroupPreparer(name_prefix='test_network_manager_scope_connection', location='eastus2euap') + def test_network_manager_scope_connection(self, resource_group): + tenant_id = self.cmd('account list --query "[?isDefault].tenantId" -o tsv').output.strip() + self.kwargs.update({ + 'connection_name': 'myTestScopeConnection', + 'manager_name': 'TestNetworkManager', + 'sub': '/subscriptions/{}'.format(self.get_subscription_id()), + 'tenant_id': tenant_id + }) + + self.cmd('network manager create --name {manager_name} --description "My Test Network Manager" --display-name "TestNetworkManager" ' + '--scope-accesses "SecurityAdmin" "Connectivity" ' + '--network-manager-scopes ' + ' subscriptions={sub} ' + '-l eastus2euap ' + '--resource-group {rg}') + + self.cmd('network manager scope-connection create --resource-group {rg} --network-manager-name {manager_name} ' + '--name {connection_name} --description "My Test Network Manager Scope Connection" ' + '--tenant-id {tenant_id} --resource-id {sub}') + + self.cmd('network manager scope-connection show -g {rg} --network-manager-name {manager_name} --name {connection_name}') + + self.cmd('network manager scope-connection update -g {rg} --network-manager-name {manager_name} ' + '--name {connection_name} --description "My Test Network Manager Scope Connection Updated Description"') + + self.cmd('network manager scope-connection list -g {rg} --network-manager-name {manager_name} ') + + self.cmd('network manager scope-connection delete -g {rg} --network-manager-name {manager_name} --name {connection_name} --yes') + + self.cmd('network manager delete --resource-group {rg} --name {manager_name} --yes') + + @ResourceGroupPreparer(name_prefix='test_network_manager_connection_subscription', location='eastus2euap') + def test_network_manager_connection_subscription(self, resource_group): + + self.kwargs.update({ + 'subId': self.get_subscription_id(), + 'sub': '/subscriptions/{}'.format(self.get_subscription_id()), + 'manager_name': 'TestNetworkManager', + 'connection_name': 'myTestNetworkManagerConnection' + }) + + network_manager = self.cmd('network manager create --name {manager_name} --description "My Test Network Manager" --display-name "TestNetworkManager" ' + '--scope-accesses "SecurityAdmin" "Connectivity" ' + '--network-manager-scopes ' + ' subscriptions={sub} ' + '-l eastus2euap ' + '--resource-group {rg}').get_output_in_json() + self.kwargs['manager_id'] = network_manager['id'] + self.cmd('network manager connection subscription create --connection-name {connection_name} --description "My Test Network Manager Connection" --network-manager-id {manager_id}') + + self.cmd('network manager connection subscription show --connection-name {connection_name} ') + + self.cmd('network manager connection subscription update --connection-name {connection_name} --description "My Test Network Manager Connection Updated Description"') + + self.cmd('network manager connection subscription list') + + self.cmd('network manager connection subscription delete --connection-name {connection_name} --yes') + self.cmd('network manager delete --resource-group {rg} --name {manager_name} --yes') + +# @ResourceGroupPreparer(name_prefix='test_network_manager_connection_crud', location='eastus2euap') +# def test_network_manager_scope_connection(self, resource_group): +# +# self.kwargs.update({ +# 'sub': '/subscriptions/{}'.format(self.get_subscription_id()), +# 'manager_id': '/subscriptions/{}/resourceGroups/{rg}/providers/Microsoft.Network/networkManagers/{connection_name}'.format(self.get_subscription_id()), +# 'manager_name': 'TestNetworkManager', +# 'connection_name': 'myTestNetworkManagerConnection', +# 'mgId': 'testManagementGroupId' +# }) +# +# self.cmd('network manager create --name {manager_name} --description "My Test Network Manager" --display-name "TestNetworkManager" ' +# '--scope-accesses "SecurityAdmin" "Connectivity" ' +# '--network-manager-scopes ' +# ' subscriptions={sub} ' +# '-l eastus2euap ' +# '--resource-group {rg}') +# +# self.cmd('network manager connection create --management-group-id {mgId} --connection-name {connection_name} ' +# '--description "My Test Network Manager Connection"' +# '--network-manager-id {manager_id}') +# +# self.cmd('network manager connection show --management-group-id {mgId} --connection-name {connection_name} ') +# +# self.cmd('network manager scope-connection update --management-group-id {mgId} --connection-name {connection_name} ' +# '--description "My Test Network Manager Connection Updated Description"') +# +# self.cmd('network manager scope-connection list --management-group-id {mgId} ') +# +# self.cmd('network manager scope-connection delete --management-group-id {mgId} --connection-name {connection_name} ') \ No newline at end of file diff --git a/src/network-manager/azext_network_manager/vendored_sdks/__init__.py b/src/network-manager/azext_network_manager/vendored_sdks/__init__.py index cbe2d6051b9..3afadffd3a4 100644 --- a/src/network-manager/azext_network_manager/vendored_sdks/__init__.py +++ b/src/network-manager/azext_network_manager/vendored_sdks/__init__.py @@ -12,8 +12,7 @@ __version__ = VERSION __all__ = ['NetworkManagementClient'] -try: - from ._patch import patch_sdk # type: ignore - patch_sdk() -except ImportError: - pass +# `._patch.py` is used for handwritten extensions to the generated code +# Example: https://github.com/Azure/azure-sdk-for-python/blob/main/doc/dev/customize_code/how-to-patch-sdk-code.md +from ._patch import patch_sdk +patch_sdk() diff --git a/src/network-manager/azext_network_manager/vendored_sdks/_configuration.py b/src/network-manager/azext_network_manager/vendored_sdks/_configuration.py index d3ec9ffb0ec..7e6c2259672 100644 --- a/src/network-manager/azext_network_manager/vendored_sdks/_configuration.py +++ b/src/network-manager/azext_network_manager/vendored_sdks/_configuration.py @@ -6,18 +6,16 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import TYPE_CHECKING +from typing import Any, TYPE_CHECKING from azure.core.configuration import Configuration from azure.core.pipeline import policies -from azure.mgmt.core.policies import ARMHttpLoggingPolicy +from azure.mgmt.core.policies import ARMChallengeAuthenticationPolicy, ARMHttpLoggingPolicy from ._version import VERSION if TYPE_CHECKING: # pylint: disable=unused-import,ungrouped-imports - from typing import Any - from azure.core.credentials import TokenCredential @@ -35,20 +33,19 @@ class NetworkManagementClientConfiguration(Configuration): def __init__( self, - credential, # type: "TokenCredential" - subscription_id, # type: str - **kwargs # type: Any - ): - # type: (...) -> None + credential: "TokenCredential", + subscription_id: str, + **kwargs: Any + ) -> None: + super(NetworkManagementClientConfiguration, self).__init__(**kwargs) if credential is None: raise ValueError("Parameter 'credential' must not be None.") if subscription_id is None: raise ValueError("Parameter 'subscription_id' must not be None.") - super(NetworkManagementClientConfiguration, self).__init__(**kwargs) self.credential = credential self.subscription_id = subscription_id - self.api_version = "2021-02-01-preview" + self.api_version = "2021-05-01-preview" self.credential_scopes = kwargs.pop('credential_scopes', ['https://management.azure.com/.default']) kwargs.setdefault('sdk_moniker', 'mgmt-network/{}'.format(VERSION)) self._configure(**kwargs) @@ -68,4 +65,4 @@ def _configure( self.redirect_policy = kwargs.get('redirect_policy') or policies.RedirectPolicy(**kwargs) self.authentication_policy = kwargs.get('authentication_policy') if self.credential and not self.authentication_policy: - self.authentication_policy = policies.BearerTokenCredentialPolicy(self.credential, *self.credential_scopes, **kwargs) + self.authentication_policy = ARMChallengeAuthenticationPolicy(self.credential, *self.credential_scopes, **kwargs) diff --git a/src/network-manager/azext_network_manager/vendored_sdks/_metadata.json b/src/network-manager/azext_network_manager/vendored_sdks/_metadata.json deleted file mode 100644 index 3b8e77f02a2..00000000000 --- a/src/network-manager/azext_network_manager/vendored_sdks/_metadata.json +++ /dev/null @@ -1,121 +0,0 @@ -{ - "chosen_version": "2021-02-01-preview", - "total_api_version_list": ["2021-02-01-preview"], - "client": { - "name": "NetworkManagementClient", - "filename": "_network_management_client", - "description": "Network Client.", - "base_url": "\u0027https://management.azure.com\u0027", - "custom_base_url": null, - "azure_arm": true, - "has_lro_operations": false, - "client_side_validation": false, - "sync_imports": "{\"typing\": {\"azurecore\": {\"azure.core.credentials\": [\"TokenCredential\"]}}, \"regular\": {\"azurecore\": {\"azure.profiles\": [\"KnownProfiles\", \"ProfileDefinition\"], \"azure.profiles.multiapiclient\": [\"MultiApiClientMixin\"], \"msrest\": [\"Deserializer\", \"Serializer\"], \"azure.mgmt.core\": [\"ARMPipelineClient\"]}, \"local\": {\"._configuration\": [\"NetworkManagementClientConfiguration\"]}}, \"conditional\": {\"stdlib\": {\"typing\": [\"Any\", \"Optional\"]}, \"azurecore\": {\"azure.core.pipeline.transport\": [\"HttpRequest\", \"HttpResponse\"]}}}", - "async_imports": "{\"typing\": {\"azurecore\": {\"azure.core.credentials_async\": [\"AsyncTokenCredential\"]}}, \"regular\": {\"azurecore\": {\"azure.profiles\": [\"KnownProfiles\", \"ProfileDefinition\"], \"azure.profiles.multiapiclient\": [\"MultiApiClientMixin\"], \"msrest\": [\"Deserializer\", \"Serializer\"], \"azure.mgmt.core\": [\"AsyncARMPipelineClient\"]}, \"local\": {\"._configuration\": [\"NetworkManagementClientConfiguration\"]}}, \"conditional\": {\"stdlib\": {\"typing\": [\"Any\", \"Optional\"]}, \"azurecore\": {\"azure.core.pipeline.transport\": [\"AsyncHttpResponse\", \"HttpRequest\"]}}}" - }, - "global_parameters": { - "sync": { - "credential": { - "signature": "credential, # type: \"TokenCredential\"", - "description": "Credential needed for the client to connect to Azure.", - "docstring_type": "~azure.core.credentials.TokenCredential", - "required": true - }, - "subscription_id": { - "signature": "subscription_id, # type: str", - "description": "The subscription credentials which uniquely identify the Microsoft Azure subscription. The subscription ID forms part of the URI for every service call.", - "docstring_type": "str", - "required": true - } - }, - "async": { - "credential": { - "signature": "credential: \"AsyncTokenCredential\",", - "description": "Credential needed for the client to connect to Azure.", - "docstring_type": "~azure.core.credentials_async.AsyncTokenCredential", - "required": true - }, - "subscription_id": { - "signature": "subscription_id: str,", - "description": "The subscription credentials which uniquely identify the Microsoft Azure subscription. The subscription ID forms part of the URI for every service call.", - "docstring_type": "str", - "required": true - } - }, - "constant": { - }, - "call": "credential, subscription_id", - "service_client_specific": { - "sync": { - "api_version": { - "signature": "api_version=None, # type: Optional[str]", - "description": "API version to use if no profile is provided, or if missing in profile.", - "docstring_type": "str", - "required": false - }, - "base_url": { - "signature": "base_url=None, # type: Optional[str]", - "description": "Service URL", - "docstring_type": "str", - "required": false - }, - "profile": { - "signature": "profile=KnownProfiles.default, # type: KnownProfiles", - "description": "A profile definition, from KnownProfiles to dict.", - "docstring_type": "azure.profiles.KnownProfiles", - "required": false - } - }, - "async": { - "api_version": { - "signature": "api_version: Optional[str] = None,", - "description": "API version to use if no profile is provided, or if missing in profile.", - "docstring_type": "str", - "required": false - }, - "base_url": { - "signature": "base_url: Optional[str] = None,", - "description": "Service URL", - "docstring_type": "str", - "required": false - }, - "profile": { - "signature": "profile: KnownProfiles = KnownProfiles.default,", - "description": "A profile definition, from KnownProfiles to dict.", - "docstring_type": "azure.profiles.KnownProfiles", - "required": false - } - } - } - }, - "config": { - "credential": true, - "credential_scopes": ["https://management.azure.com/.default"], - "credential_default_policy_type": "BearerTokenCredentialPolicy", - "credential_default_policy_type_has_async_version": true, - "credential_key_header_name": null, - "sync_imports": "{\"regular\": {\"azurecore\": {\"azure.core.configuration\": [\"Configuration\"], \"azure.core.pipeline\": [\"policies\"], \"azure.mgmt.core.policies\": [\"ARMHttpLoggingPolicy\"]}, \"local\": {\"._version\": [\"VERSION\"]}}, \"conditional\": {\"stdlib\": {\"typing\": [\"Any\"]}}, \"typing\": {\"azurecore\": {\"azure.core.credentials\": [\"TokenCredential\"]}}}", - "async_imports": "{\"regular\": {\"azurecore\": {\"azure.core.configuration\": [\"Configuration\"], \"azure.core.pipeline\": [\"policies\"], \"azure.mgmt.core.policies\": [\"ARMHttpLoggingPolicy\"]}, \"local\": {\".._version\": [\"VERSION\"]}}, \"conditional\": {\"stdlib\": {\"typing\": [\"Any\"]}}, \"typing\": {\"azurecore\": {\"azure.core.credentials_async\": [\"AsyncTokenCredential\"]}}}" - }, - "operation_groups": { - "network_managers": "NetworkManagersOperations", - "network_manager_commits": "NetworkManagerCommitsOperations", - "network_manager_deployment_status": "NetworkManagerDeploymentStatusOperations", - "effective_virtual_networks": "EffectiveVirtualNetworksOperations", - "active_connectivity_configurations": "ActiveConnectivityConfigurationsOperations", - "active_security_admin_rules": "ActiveSecurityAdminRulesOperations", - "active_security_user_rules": "ActiveSecurityUserRulesOperations", - "connectivity_configurations": "ConnectivityConfigurationsOperations", - "effective_connectivity_configurations": "EffectiveConnectivityConfigurationsOperations", - "network_manager_effective_security_admin_rules": "NetworkManagerEffectiveSecurityAdminRulesOperations", - "network_groups": "NetworkGroupsOperations", - "security_user_configurations": "SecurityUserConfigurationsOperations", - "user_rule_collections": "UserRuleCollectionsOperations", - "user_rules": "UserRulesOperations", - "security_admin_configurations": "SecurityAdminConfigurationsOperations", - "admin_rule_collections": "AdminRuleCollectionsOperations", - "admin_rules": "AdminRulesOperations", - "network_security_perimeters": "NetworkSecurityPerimetersOperations", - "perimeter_associable_resource_types": "PerimeterAssociableResourceTypesOperations" - } -} \ No newline at end of file diff --git a/src/network-manager/azext_network_manager/vendored_sdks/_network_management_client.py b/src/network-manager/azext_network_manager/vendored_sdks/_network_management_client.py index 7ff3d376174..f56f51db37e 100644 --- a/src/network-manager/azext_network_manager/vendored_sdks/_network_management_client.py +++ b/src/network-manager/azext_network_manager/vendored_sdks/_network_management_client.py @@ -6,163 +6,142 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import TYPE_CHECKING +from copy import deepcopy +from typing import Any, Optional, TYPE_CHECKING +from azure.core.rest import HttpRequest, HttpResponse from azure.mgmt.core import ARMPipelineClient from msrest import Deserializer, Serializer +from . import models +from ._configuration import NetworkManagementClientConfiguration +from .operations import AdminRuleCollectionsOperations, AdminRulesOperations, ConnectivityConfigurationsOperations, EffectiveVirtualNetworksOperations, ListEffectiveVirtualNetworksOperations, ManagementGroupNetworkManagerConnectionsOperations, NetworkGroupsOperations, NetworkManagementClientOperationsMixin, NetworkManagerCommitsOperations, NetworkManagerDeploymentStatusOperations, NetworkManagersOperations, ScopeConnectionsOperations, SecurityAdminConfigurationsOperations, SecurityUserConfigurationsOperations, StaticMembersOperations, SubscriptionNetworkManagerConnectionsOperations, UserRuleCollectionsOperations, UserRulesOperations + if TYPE_CHECKING: # pylint: disable=unused-import,ungrouped-imports - from typing import Any, Optional - from azure.core.credentials import TokenCredential - from azure.core.pipeline.transport import HttpRequest, HttpResponse - -from ._configuration import NetworkManagementClientConfiguration -from .operations import NetworkManagersOperations -from .operations import NetworkManagerCommitsOperations -from .operations import NetworkManagerDeploymentStatusOperations -from .operations import EffectiveVirtualNetworksOperations -from .operations import ActiveConnectivityConfigurationsOperations -from .operations import ActiveSecurityAdminRulesOperations -from .operations import ActiveSecurityUserRulesOperations -from .operations import ConnectivityConfigurationsOperations -from .operations import EffectiveConnectivityConfigurationsOperations -from .operations import NetworkManagerEffectiveSecurityAdminRulesOperations -from .operations import NetworkGroupsOperations -from .operations import SecurityUserConfigurationsOperations -from .operations import UserRuleCollectionsOperations -from .operations import UserRulesOperations -from .operations import SecurityAdminConfigurationsOperations -from .operations import AdminRuleCollectionsOperations -from .operations import AdminRulesOperations -from .operations import NetworkSecurityPerimetersOperations -from .operations import PerimeterAssociableResourceTypesOperations -from . import models - -class NetworkManagementClient(object): +class NetworkManagementClient(NetworkManagementClientOperationsMixin): """Network Client. :ivar network_managers: NetworkManagersOperations operations - :vartype network_managers: azure.mgmt.network.v2021_02_01_preview.operations.NetworkManagersOperations + :vartype network_managers: + azure.mgmt.network.v2021_05_01_preview.operations.NetworkManagersOperations :ivar network_manager_commits: NetworkManagerCommitsOperations operations - :vartype network_manager_commits: azure.mgmt.network.v2021_02_01_preview.operations.NetworkManagerCommitsOperations + :vartype network_manager_commits: + azure.mgmt.network.v2021_05_01_preview.operations.NetworkManagerCommitsOperations :ivar network_manager_deployment_status: NetworkManagerDeploymentStatusOperations operations - :vartype network_manager_deployment_status: azure.mgmt.network.v2021_02_01_preview.operations.NetworkManagerDeploymentStatusOperations + :vartype network_manager_deployment_status: + azure.mgmt.network.v2021_05_01_preview.operations.NetworkManagerDeploymentStatusOperations :ivar effective_virtual_networks: EffectiveVirtualNetworksOperations operations - :vartype effective_virtual_networks: azure.mgmt.network.v2021_02_01_preview.operations.EffectiveVirtualNetworksOperations - :ivar active_connectivity_configurations: ActiveConnectivityConfigurationsOperations operations - :vartype active_connectivity_configurations: azure.mgmt.network.v2021_02_01_preview.operations.ActiveConnectivityConfigurationsOperations - :ivar active_security_admin_rules: ActiveSecurityAdminRulesOperations operations - :vartype active_security_admin_rules: azure.mgmt.network.v2021_02_01_preview.operations.ActiveSecurityAdminRulesOperations - :ivar active_security_user_rules: ActiveSecurityUserRulesOperations operations - :vartype active_security_user_rules: azure.mgmt.network.v2021_02_01_preview.operations.ActiveSecurityUserRulesOperations + :vartype effective_virtual_networks: + azure.mgmt.network.v2021_05_01_preview.operations.EffectiveVirtualNetworksOperations :ivar connectivity_configurations: ConnectivityConfigurationsOperations operations - :vartype connectivity_configurations: azure.mgmt.network.v2021_02_01_preview.operations.ConnectivityConfigurationsOperations - :ivar effective_connectivity_configurations: EffectiveConnectivityConfigurationsOperations operations - :vartype effective_connectivity_configurations: azure.mgmt.network.v2021_02_01_preview.operations.EffectiveConnectivityConfigurationsOperations - :ivar network_manager_effective_security_admin_rules: NetworkManagerEffectiveSecurityAdminRulesOperations operations - :vartype network_manager_effective_security_admin_rules: azure.mgmt.network.v2021_02_01_preview.operations.NetworkManagerEffectiveSecurityAdminRulesOperations + :vartype connectivity_configurations: + azure.mgmt.network.v2021_05_01_preview.operations.ConnectivityConfigurationsOperations :ivar network_groups: NetworkGroupsOperations operations - :vartype network_groups: azure.mgmt.network.v2021_02_01_preview.operations.NetworkGroupsOperations + :vartype network_groups: + azure.mgmt.network.v2021_05_01_preview.operations.NetworkGroupsOperations + :ivar list_effective_virtual_networks: ListEffectiveVirtualNetworksOperations operations + :vartype list_effective_virtual_networks: + azure.mgmt.network.v2021_05_01_preview.operations.ListEffectiveVirtualNetworksOperations + :ivar static_members: StaticMembersOperations operations + :vartype static_members: + azure.mgmt.network.v2021_05_01_preview.operations.StaticMembersOperations :ivar security_user_configurations: SecurityUserConfigurationsOperations operations - :vartype security_user_configurations: azure.mgmt.network.v2021_02_01_preview.operations.SecurityUserConfigurationsOperations + :vartype security_user_configurations: + azure.mgmt.network.v2021_05_01_preview.operations.SecurityUserConfigurationsOperations :ivar user_rule_collections: UserRuleCollectionsOperations operations - :vartype user_rule_collections: azure.mgmt.network.v2021_02_01_preview.operations.UserRuleCollectionsOperations + :vartype user_rule_collections: + azure.mgmt.network.v2021_05_01_preview.operations.UserRuleCollectionsOperations :ivar user_rules: UserRulesOperations operations - :vartype user_rules: azure.mgmt.network.v2021_02_01_preview.operations.UserRulesOperations + :vartype user_rules: azure.mgmt.network.v2021_05_01_preview.operations.UserRulesOperations :ivar security_admin_configurations: SecurityAdminConfigurationsOperations operations - :vartype security_admin_configurations: azure.mgmt.network.v2021_02_01_preview.operations.SecurityAdminConfigurationsOperations + :vartype security_admin_configurations: + azure.mgmt.network.v2021_05_01_preview.operations.SecurityAdminConfigurationsOperations :ivar admin_rule_collections: AdminRuleCollectionsOperations operations - :vartype admin_rule_collections: azure.mgmt.network.v2021_02_01_preview.operations.AdminRuleCollectionsOperations + :vartype admin_rule_collections: + azure.mgmt.network.v2021_05_01_preview.operations.AdminRuleCollectionsOperations :ivar admin_rules: AdminRulesOperations operations - :vartype admin_rules: azure.mgmt.network.v2021_02_01_preview.operations.AdminRulesOperations - :ivar network_security_perimeters: NetworkSecurityPerimetersOperations operations - :vartype network_security_perimeters: azure.mgmt.network.v2021_02_01_preview.operations.NetworkSecurityPerimetersOperations - :ivar perimeter_associable_resource_types: PerimeterAssociableResourceTypesOperations operations - :vartype perimeter_associable_resource_types: azure.mgmt.network.v2021_02_01_preview.operations.PerimeterAssociableResourceTypesOperations + :vartype admin_rules: azure.mgmt.network.v2021_05_01_preview.operations.AdminRulesOperations + :ivar subscription_network_manager_connections: SubscriptionNetworkManagerConnectionsOperations + operations + :vartype subscription_network_manager_connections: + azure.mgmt.network.v2021_05_01_preview.operations.SubscriptionNetworkManagerConnectionsOperations + :ivar management_group_network_manager_connections: + ManagementGroupNetworkManagerConnectionsOperations operations + :vartype management_group_network_manager_connections: + azure.mgmt.network.v2021_05_01_preview.operations.ManagementGroupNetworkManagerConnectionsOperations + :ivar scope_connections: ScopeConnectionsOperations operations + :vartype scope_connections: + azure.mgmt.network.v2021_05_01_preview.operations.ScopeConnectionsOperations :param credential: Credential needed for the client to connect to Azure. :type credential: ~azure.core.credentials.TokenCredential - :param subscription_id: The subscription credentials which uniquely identify the Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. + :param subscription_id: The 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 + :param base_url: Service URL. Default value is 'https://management.azure.com'. + :type base_url: str """ def __init__( self, - credential, # type: "TokenCredential" - subscription_id, # type: str - base_url=None, # type: Optional[str] - **kwargs # type: Any - ): - # type: (...) -> None - if not base_url: - base_url = 'https://management.azure.com' - self._config = NetworkManagementClientConfiguration(credential, subscription_id, **kwargs) + credential: "TokenCredential", + subscription_id: str, + base_url: str = "https://management.azure.com", + **kwargs: Any + ) -> None: + self._config = NetworkManagementClientConfiguration(credential=credential, subscription_id=subscription_id, **kwargs) self._client = ARMPipelineClient(base_url=base_url, config=self._config, **kwargs) client_models = {k: v for k, v in models.__dict__.items() if isinstance(v, type)} self._serialize = Serializer(client_models) - self._serialize.client_side_validation = False self._deserialize = Deserializer(client_models) - - self.network_managers = NetworkManagersOperations( - self._client, self._config, self._serialize, self._deserialize) - self.network_manager_commits = NetworkManagerCommitsOperations( - self._client, self._config, self._serialize, self._deserialize) - self.network_manager_deployment_status = NetworkManagerDeploymentStatusOperations( - self._client, self._config, self._serialize, self._deserialize) - self.effective_virtual_networks = EffectiveVirtualNetworksOperations( - self._client, self._config, self._serialize, self._deserialize) - self.active_connectivity_configurations = ActiveConnectivityConfigurationsOperations( - self._client, self._config, self._serialize, self._deserialize) - self.active_security_admin_rules = ActiveSecurityAdminRulesOperations( - self._client, self._config, self._serialize, self._deserialize) - self.active_security_user_rules = ActiveSecurityUserRulesOperations( - self._client, self._config, self._serialize, self._deserialize) - self.connectivity_configurations = ConnectivityConfigurationsOperations( - self._client, self._config, self._serialize, self._deserialize) - self.effective_connectivity_configurations = EffectiveConnectivityConfigurationsOperations( - self._client, self._config, self._serialize, self._deserialize) - self.network_manager_effective_security_admin_rules = NetworkManagerEffectiveSecurityAdminRulesOperations( - self._client, self._config, self._serialize, self._deserialize) - self.network_groups = NetworkGroupsOperations( - self._client, self._config, self._serialize, self._deserialize) - self.security_user_configurations = SecurityUserConfigurationsOperations( - self._client, self._config, self._serialize, self._deserialize) - self.user_rule_collections = UserRuleCollectionsOperations( - self._client, self._config, self._serialize, self._deserialize) - self.user_rules = UserRulesOperations( - self._client, self._config, self._serialize, self._deserialize) - self.security_admin_configurations = SecurityAdminConfigurationsOperations( - self._client, self._config, self._serialize, self._deserialize) - self.admin_rule_collections = AdminRuleCollectionsOperations( - self._client, self._config, self._serialize, self._deserialize) - self.admin_rules = AdminRulesOperations( - self._client, self._config, self._serialize, self._deserialize) - self.network_security_perimeters = NetworkSecurityPerimetersOperations( - self._client, self._config, self._serialize, self._deserialize) - self.perimeter_associable_resource_types = PerimeterAssociableResourceTypesOperations( - self._client, self._config, self._serialize, self._deserialize) - - def _send_request(self, http_request, **kwargs): - # type: (HttpRequest, Any) -> HttpResponse + self._serialize.client_side_validation = False + self.network_managers = NetworkManagersOperations(self._client, self._config, self._serialize, self._deserialize) + self.network_manager_commits = NetworkManagerCommitsOperations(self._client, self._config, self._serialize, self._deserialize) + self.network_manager_deployment_status = NetworkManagerDeploymentStatusOperations(self._client, self._config, self._serialize, self._deserialize) + self.effective_virtual_networks = EffectiveVirtualNetworksOperations(self._client, self._config, self._serialize, self._deserialize) + self.connectivity_configurations = ConnectivityConfigurationsOperations(self._client, self._config, self._serialize, self._deserialize) + self.network_groups = NetworkGroupsOperations(self._client, self._config, self._serialize, self._deserialize) + self.list_effective_virtual_networks = ListEffectiveVirtualNetworksOperations(self._client, self._config, self._serialize, self._deserialize) + self.static_members = StaticMembersOperations(self._client, self._config, self._serialize, self._deserialize) + self.security_user_configurations = SecurityUserConfigurationsOperations(self._client, self._config, self._serialize, self._deserialize) + self.user_rule_collections = UserRuleCollectionsOperations(self._client, self._config, self._serialize, self._deserialize) + self.user_rules = UserRulesOperations(self._client, self._config, self._serialize, self._deserialize) + self.security_admin_configurations = SecurityAdminConfigurationsOperations(self._client, self._config, self._serialize, self._deserialize) + self.admin_rule_collections = AdminRuleCollectionsOperations(self._client, self._config, self._serialize, self._deserialize) + self.admin_rules = AdminRulesOperations(self._client, self._config, self._serialize, self._deserialize) + self.subscription_network_manager_connections = SubscriptionNetworkManagerConnectionsOperations(self._client, self._config, self._serialize, self._deserialize) + self.management_group_network_manager_connections = ManagementGroupNetworkManagerConnectionsOperations(self._client, self._config, self._serialize, self._deserialize) + self.scope_connections = ScopeConnectionsOperations(self._client, self._config, self._serialize, self._deserialize) + + + def _send_request( + self, + request, # type: HttpRequest + **kwargs: Any + ) -> HttpResponse: """Runs the network request through the client's chained policies. - :param http_request: The network request you want to make. Required. - :type http_request: ~azure.core.pipeline.transport.HttpRequest - :keyword bool stream: Whether the response payload will be streamed. Defaults to True. + >>> from azure.core.rest import HttpRequest + >>> request = HttpRequest("GET", "https://www.example.org/") + + >>> response = client._send_request(request) + + + For more information on this code flow, see https://aka.ms/azsdk/python/protocol/quickstart + + :param request: The network request you want to make. Required. + :type request: ~azure.core.rest.HttpRequest + :keyword bool stream: Whether the response payload will be streamed. Defaults to False. :return: The response of your network call. Does not do error handling on your response. - :rtype: ~azure.core.pipeline.transport.HttpResponse + :rtype: ~azure.core.rest.HttpResponse """ - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - } - http_request.url = self._client.format_url(http_request.url, **path_format_arguments) - stream = kwargs.pop("stream", True) - pipeline_response = self._client._pipeline.run(http_request, stream=stream, **kwargs) - return pipeline_response.http_response + + request_copy = deepcopy(request) + request_copy.url = self._client.format_url(request_copy.url) + return self._client.send_request(request_copy, **kwargs) def close(self): # type: () -> None diff --git a/src/network-manager/azext_network_manager/vendored_sdks/_patch.py b/src/network-manager/azext_network_manager/vendored_sdks/_patch.py new file mode 100644 index 00000000000..74e48ecd07c --- /dev/null +++ b/src/network-manager/azext_network_manager/vendored_sdks/_patch.py @@ -0,0 +1,31 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# +# Copyright (c) Microsoft Corporation. All rights reserved. +# +# The MIT License (MIT) +# +# Permission is hereby granted, free of charge, to any person obtaining a copy +# of this software and associated documentation files (the ""Software""), to +# deal in the Software without restriction, including without limitation the +# rights to use, copy, modify, merge, publish, distribute, sublicense, and/or +# sell copies of the Software, and to permit persons to whom the Software is +# furnished to do so, subject to the following conditions: +# +# The above copyright notice and this permission notice shall be included in +# all copies or substantial portions of the Software. +# +# THE SOFTWARE IS PROVIDED *AS IS*, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING +# FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS +# IN THE SOFTWARE. +# +# -------------------------------------------------------------------------- + +# This file is used for handwritten extensions to the generated code. Example: +# https://github.com/Azure/azure-sdk-for-python/blob/main/doc/dev/customize_code/how-to-patch-sdk-code.md +def patch_sdk(): + pass \ No newline at end of file diff --git a/src/network-manager/azext_network_manager/vendored_sdks/_vendor.py b/src/network-manager/azext_network_manager/vendored_sdks/_vendor.py new file mode 100644 index 00000000000..138f663c53a --- /dev/null +++ b/src/network-manager/azext_network_manager/vendored_sdks/_vendor.py @@ -0,0 +1,27 @@ +# -------------------------------------------------------------------------- +# 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 azure.core.pipeline.transport import HttpRequest + +def _convert_request(request, files=None): + data = request.content if not files else None + request = HttpRequest(method=request.method, url=request.url, headers=request.headers, data=data) + if files: + request.set_formdata_body(files) + return request + +def _format_url_section(template, **kwargs): + components = template.split("/") + while components: + try: + return template.format(**kwargs) + except KeyError as key: + formatted_components = template.split("/") + components = [ + c for c in formatted_components if "{}".format(key.args[0]) not in c + ] + template = "/".join(components) diff --git a/src/network-manager/azext_network_manager/vendored_sdks/aio/__init__.py b/src/network-manager/azext_network_manager/vendored_sdks/aio/__init__.py index 1c78defcf22..6affaa922de 100644 --- a/src/network-manager/azext_network_manager/vendored_sdks/aio/__init__.py +++ b/src/network-manager/azext_network_manager/vendored_sdks/aio/__init__.py @@ -8,3 +8,8 @@ from ._network_management_client import NetworkManagementClient __all__ = ['NetworkManagementClient'] + +# `._patch.py` is used for handwritten extensions to the generated code +# Example: https://github.com/Azure/azure-sdk-for-python/blob/main/doc/dev/customize_code/how-to-patch-sdk-code.md +from ._patch import patch_sdk +patch_sdk() diff --git a/src/network-manager/azext_network_manager/vendored_sdks/aio/_configuration.py b/src/network-manager/azext_network_manager/vendored_sdks/aio/_configuration.py index 05295a7364a..2c996372539 100644 --- a/src/network-manager/azext_network_manager/vendored_sdks/aio/_configuration.py +++ b/src/network-manager/azext_network_manager/vendored_sdks/aio/_configuration.py @@ -10,7 +10,7 @@ from azure.core.configuration import Configuration from azure.core.pipeline import policies -from azure.mgmt.core.policies import ARMHttpLoggingPolicy +from azure.mgmt.core.policies import ARMHttpLoggingPolicy, AsyncARMChallengeAuthenticationPolicy from .._version import VERSION @@ -37,15 +37,15 @@ def __init__( subscription_id: str, **kwargs: Any ) -> None: + super(NetworkManagementClientConfiguration, self).__init__(**kwargs) if credential is None: raise ValueError("Parameter 'credential' must not be None.") if subscription_id is None: raise ValueError("Parameter 'subscription_id' must not be None.") - super(NetworkManagementClientConfiguration, self).__init__(**kwargs) self.credential = credential self.subscription_id = subscription_id - self.api_version = "2021-02-01-preview" + self.api_version = "2021-05-01-preview" self.credential_scopes = kwargs.pop('credential_scopes', ['https://management.azure.com/.default']) kwargs.setdefault('sdk_moniker', 'mgmt-network/{}'.format(VERSION)) self._configure(**kwargs) @@ -64,4 +64,4 @@ def _configure( self.redirect_policy = kwargs.get('redirect_policy') or policies.AsyncRedirectPolicy(**kwargs) self.authentication_policy = kwargs.get('authentication_policy') if self.credential and not self.authentication_policy: - self.authentication_policy = policies.AsyncBearerTokenCredentialPolicy(self.credential, *self.credential_scopes, **kwargs) + self.authentication_policy = AsyncARMChallengeAuthenticationPolicy(self.credential, *self.credential_scopes, **kwargs) diff --git a/src/network-manager/azext_network_manager/vendored_sdks/aio/_network_management_client.py b/src/network-manager/azext_network_manager/vendored_sdks/aio/_network_management_client.py index 9de340f52e3..8814cce0479 100644 --- a/src/network-manager/azext_network_manager/vendored_sdks/aio/_network_management_client.py +++ b/src/network-manager/azext_network_manager/vendored_sdks/aio/_network_management_client.py @@ -6,159 +6,143 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import Any, Optional, TYPE_CHECKING +from copy import deepcopy +from typing import Any, Awaitable, Optional, TYPE_CHECKING -from azure.core.pipeline.transport import AsyncHttpResponse, HttpRequest +from azure.core.rest import AsyncHttpResponse, HttpRequest from azure.mgmt.core import AsyncARMPipelineClient from msrest import Deserializer, Serializer +from .. import models +from ._configuration import NetworkManagementClientConfiguration +from .operations import AdminRuleCollectionsOperations, AdminRulesOperations, ConnectivityConfigurationsOperations, EffectiveVirtualNetworksOperations, ListEffectiveVirtualNetworksOperations, ManagementGroupNetworkManagerConnectionsOperations, NetworkGroupsOperations, NetworkManagementClientOperationsMixin, NetworkManagerCommitsOperations, NetworkManagerDeploymentStatusOperations, NetworkManagersOperations, ScopeConnectionsOperations, SecurityAdminConfigurationsOperations, SecurityUserConfigurationsOperations, StaticMembersOperations, SubscriptionNetworkManagerConnectionsOperations, UserRuleCollectionsOperations, UserRulesOperations + if TYPE_CHECKING: # pylint: disable=unused-import,ungrouped-imports from azure.core.credentials_async import AsyncTokenCredential -from ._configuration import NetworkManagementClientConfiguration -from .operations import NetworkManagersOperations -from .operations import NetworkManagerCommitsOperations -from .operations import NetworkManagerDeploymentStatusOperations -from .operations import EffectiveVirtualNetworksOperations -from .operations import ActiveConnectivityConfigurationsOperations -from .operations import ActiveSecurityAdminRulesOperations -from .operations import ActiveSecurityUserRulesOperations -from .operations import ConnectivityConfigurationsOperations -from .operations import EffectiveConnectivityConfigurationsOperations -from .operations import NetworkManagerEffectiveSecurityAdminRulesOperations -from .operations import NetworkGroupsOperations -from .operations import SecurityUserConfigurationsOperations -from .operations import UserRuleCollectionsOperations -from .operations import UserRulesOperations -from .operations import SecurityAdminConfigurationsOperations -from .operations import AdminRuleCollectionsOperations -from .operations import AdminRulesOperations -from .operations import NetworkSecurityPerimetersOperations -from .operations import PerimeterAssociableResourceTypesOperations -from .. import models - - -class NetworkManagementClient(object): +class NetworkManagementClient(NetworkManagementClientOperationsMixin): """Network Client. :ivar network_managers: NetworkManagersOperations operations - :vartype network_managers: azure.mgmt.network.v2021_02_01_preview.aio.operations.NetworkManagersOperations + :vartype network_managers: + azure.mgmt.network.v2021_05_01_preview.aio.operations.NetworkManagersOperations :ivar network_manager_commits: NetworkManagerCommitsOperations operations - :vartype network_manager_commits: azure.mgmt.network.v2021_02_01_preview.aio.operations.NetworkManagerCommitsOperations + :vartype network_manager_commits: + azure.mgmt.network.v2021_05_01_preview.aio.operations.NetworkManagerCommitsOperations :ivar network_manager_deployment_status: NetworkManagerDeploymentStatusOperations operations - :vartype network_manager_deployment_status: azure.mgmt.network.v2021_02_01_preview.aio.operations.NetworkManagerDeploymentStatusOperations + :vartype network_manager_deployment_status: + azure.mgmt.network.v2021_05_01_preview.aio.operations.NetworkManagerDeploymentStatusOperations :ivar effective_virtual_networks: EffectiveVirtualNetworksOperations operations - :vartype effective_virtual_networks: azure.mgmt.network.v2021_02_01_preview.aio.operations.EffectiveVirtualNetworksOperations - :ivar active_connectivity_configurations: ActiveConnectivityConfigurationsOperations operations - :vartype active_connectivity_configurations: azure.mgmt.network.v2021_02_01_preview.aio.operations.ActiveConnectivityConfigurationsOperations - :ivar active_security_admin_rules: ActiveSecurityAdminRulesOperations operations - :vartype active_security_admin_rules: azure.mgmt.network.v2021_02_01_preview.aio.operations.ActiveSecurityAdminRulesOperations - :ivar active_security_user_rules: ActiveSecurityUserRulesOperations operations - :vartype active_security_user_rules: azure.mgmt.network.v2021_02_01_preview.aio.operations.ActiveSecurityUserRulesOperations + :vartype effective_virtual_networks: + azure.mgmt.network.v2021_05_01_preview.aio.operations.EffectiveVirtualNetworksOperations :ivar connectivity_configurations: ConnectivityConfigurationsOperations operations - :vartype connectivity_configurations: azure.mgmt.network.v2021_02_01_preview.aio.operations.ConnectivityConfigurationsOperations - :ivar effective_connectivity_configurations: EffectiveConnectivityConfigurationsOperations operations - :vartype effective_connectivity_configurations: azure.mgmt.network.v2021_02_01_preview.aio.operations.EffectiveConnectivityConfigurationsOperations - :ivar network_manager_effective_security_admin_rules: NetworkManagerEffectiveSecurityAdminRulesOperations operations - :vartype network_manager_effective_security_admin_rules: azure.mgmt.network.v2021_02_01_preview.aio.operations.NetworkManagerEffectiveSecurityAdminRulesOperations + :vartype connectivity_configurations: + azure.mgmt.network.v2021_05_01_preview.aio.operations.ConnectivityConfigurationsOperations :ivar network_groups: NetworkGroupsOperations operations - :vartype network_groups: azure.mgmt.network.v2021_02_01_preview.aio.operations.NetworkGroupsOperations + :vartype network_groups: + azure.mgmt.network.v2021_05_01_preview.aio.operations.NetworkGroupsOperations + :ivar list_effective_virtual_networks: ListEffectiveVirtualNetworksOperations operations + :vartype list_effective_virtual_networks: + azure.mgmt.network.v2021_05_01_preview.aio.operations.ListEffectiveVirtualNetworksOperations + :ivar static_members: StaticMembersOperations operations + :vartype static_members: + azure.mgmt.network.v2021_05_01_preview.aio.operations.StaticMembersOperations :ivar security_user_configurations: SecurityUserConfigurationsOperations operations - :vartype security_user_configurations: azure.mgmt.network.v2021_02_01_preview.aio.operations.SecurityUserConfigurationsOperations + :vartype security_user_configurations: + azure.mgmt.network.v2021_05_01_preview.aio.operations.SecurityUserConfigurationsOperations :ivar user_rule_collections: UserRuleCollectionsOperations operations - :vartype user_rule_collections: azure.mgmt.network.v2021_02_01_preview.aio.operations.UserRuleCollectionsOperations + :vartype user_rule_collections: + azure.mgmt.network.v2021_05_01_preview.aio.operations.UserRuleCollectionsOperations :ivar user_rules: UserRulesOperations operations - :vartype user_rules: azure.mgmt.network.v2021_02_01_preview.aio.operations.UserRulesOperations + :vartype user_rules: azure.mgmt.network.v2021_05_01_preview.aio.operations.UserRulesOperations :ivar security_admin_configurations: SecurityAdminConfigurationsOperations operations - :vartype security_admin_configurations: azure.mgmt.network.v2021_02_01_preview.aio.operations.SecurityAdminConfigurationsOperations + :vartype security_admin_configurations: + azure.mgmt.network.v2021_05_01_preview.aio.operations.SecurityAdminConfigurationsOperations :ivar admin_rule_collections: AdminRuleCollectionsOperations operations - :vartype admin_rule_collections: azure.mgmt.network.v2021_02_01_preview.aio.operations.AdminRuleCollectionsOperations + :vartype admin_rule_collections: + azure.mgmt.network.v2021_05_01_preview.aio.operations.AdminRuleCollectionsOperations :ivar admin_rules: AdminRulesOperations operations - :vartype admin_rules: azure.mgmt.network.v2021_02_01_preview.aio.operations.AdminRulesOperations - :ivar network_security_perimeters: NetworkSecurityPerimetersOperations operations - :vartype network_security_perimeters: azure.mgmt.network.v2021_02_01_preview.aio.operations.NetworkSecurityPerimetersOperations - :ivar perimeter_associable_resource_types: PerimeterAssociableResourceTypesOperations operations - :vartype perimeter_associable_resource_types: azure.mgmt.network.v2021_02_01_preview.aio.operations.PerimeterAssociableResourceTypesOperations + :vartype admin_rules: + azure.mgmt.network.v2021_05_01_preview.aio.operations.AdminRulesOperations + :ivar subscription_network_manager_connections: SubscriptionNetworkManagerConnectionsOperations + operations + :vartype subscription_network_manager_connections: + azure.mgmt.network.v2021_05_01_preview.aio.operations.SubscriptionNetworkManagerConnectionsOperations + :ivar management_group_network_manager_connections: + ManagementGroupNetworkManagerConnectionsOperations operations + :vartype management_group_network_manager_connections: + azure.mgmt.network.v2021_05_01_preview.aio.operations.ManagementGroupNetworkManagerConnectionsOperations + :ivar scope_connections: ScopeConnectionsOperations operations + :vartype scope_connections: + azure.mgmt.network.v2021_05_01_preview.aio.operations.ScopeConnectionsOperations :param credential: Credential needed for the client to connect to Azure. :type credential: ~azure.core.credentials_async.AsyncTokenCredential - :param subscription_id: The subscription credentials which uniquely identify the Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. + :param subscription_id: The 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 + :param base_url: Service URL. Default value is 'https://management.azure.com'. + :type base_url: str """ def __init__( self, credential: "AsyncTokenCredential", subscription_id: str, - base_url: Optional[str] = None, + base_url: str = "https://management.azure.com", **kwargs: Any ) -> None: - if not base_url: - base_url = 'https://management.azure.com' - self._config = NetworkManagementClientConfiguration(credential, subscription_id, **kwargs) + self._config = NetworkManagementClientConfiguration(credential=credential, subscription_id=subscription_id, **kwargs) self._client = AsyncARMPipelineClient(base_url=base_url, config=self._config, **kwargs) client_models = {k: v for k, v in models.__dict__.items() if isinstance(v, type)} self._serialize = Serializer(client_models) - self._serialize.client_side_validation = False self._deserialize = Deserializer(client_models) + self._serialize.client_side_validation = False + self.network_managers = NetworkManagersOperations(self._client, self._config, self._serialize, self._deserialize) + self.network_manager_commits = NetworkManagerCommitsOperations(self._client, self._config, self._serialize, self._deserialize) + self.network_manager_deployment_status = NetworkManagerDeploymentStatusOperations(self._client, self._config, self._serialize, self._deserialize) + self.effective_virtual_networks = EffectiveVirtualNetworksOperations(self._client, self._config, self._serialize, self._deserialize) + self.connectivity_configurations = ConnectivityConfigurationsOperations(self._client, self._config, self._serialize, self._deserialize) + self.network_groups = NetworkGroupsOperations(self._client, self._config, self._serialize, self._deserialize) + self.list_effective_virtual_networks = ListEffectiveVirtualNetworksOperations(self._client, self._config, self._serialize, self._deserialize) + self.static_members = StaticMembersOperations(self._client, self._config, self._serialize, self._deserialize) + self.security_user_configurations = SecurityUserConfigurationsOperations(self._client, self._config, self._serialize, self._deserialize) + self.user_rule_collections = UserRuleCollectionsOperations(self._client, self._config, self._serialize, self._deserialize) + self.user_rules = UserRulesOperations(self._client, self._config, self._serialize, self._deserialize) + self.security_admin_configurations = SecurityAdminConfigurationsOperations(self._client, self._config, self._serialize, self._deserialize) + self.admin_rule_collections = AdminRuleCollectionsOperations(self._client, self._config, self._serialize, self._deserialize) + self.admin_rules = AdminRulesOperations(self._client, self._config, self._serialize, self._deserialize) + self.subscription_network_manager_connections = SubscriptionNetworkManagerConnectionsOperations(self._client, self._config, self._serialize, self._deserialize) + self.management_group_network_manager_connections = ManagementGroupNetworkManagerConnectionsOperations(self._client, self._config, self._serialize, self._deserialize) + self.scope_connections = ScopeConnectionsOperations(self._client, self._config, self._serialize, self._deserialize) + - self.network_managers = NetworkManagersOperations( - self._client, self._config, self._serialize, self._deserialize) - self.network_manager_commits = NetworkManagerCommitsOperations( - self._client, self._config, self._serialize, self._deserialize) - self.network_manager_deployment_status = NetworkManagerDeploymentStatusOperations( - self._client, self._config, self._serialize, self._deserialize) - self.effective_virtual_networks = EffectiveVirtualNetworksOperations( - self._client, self._config, self._serialize, self._deserialize) - self.active_connectivity_configurations = ActiveConnectivityConfigurationsOperations( - self._client, self._config, self._serialize, self._deserialize) - self.active_security_admin_rules = ActiveSecurityAdminRulesOperations( - self._client, self._config, self._serialize, self._deserialize) - self.active_security_user_rules = ActiveSecurityUserRulesOperations( - self._client, self._config, self._serialize, self._deserialize) - self.connectivity_configurations = ConnectivityConfigurationsOperations( - self._client, self._config, self._serialize, self._deserialize) - self.effective_connectivity_configurations = EffectiveConnectivityConfigurationsOperations( - self._client, self._config, self._serialize, self._deserialize) - self.network_manager_effective_security_admin_rules = NetworkManagerEffectiveSecurityAdminRulesOperations( - self._client, self._config, self._serialize, self._deserialize) - self.network_groups = NetworkGroupsOperations( - self._client, self._config, self._serialize, self._deserialize) - self.security_user_configurations = SecurityUserConfigurationsOperations( - self._client, self._config, self._serialize, self._deserialize) - self.user_rule_collections = UserRuleCollectionsOperations( - self._client, self._config, self._serialize, self._deserialize) - self.user_rules = UserRulesOperations( - self._client, self._config, self._serialize, self._deserialize) - self.security_admin_configurations = SecurityAdminConfigurationsOperations( - self._client, self._config, self._serialize, self._deserialize) - self.admin_rule_collections = AdminRuleCollectionsOperations( - self._client, self._config, self._serialize, self._deserialize) - self.admin_rules = AdminRulesOperations( - self._client, self._config, self._serialize, self._deserialize) - self.network_security_perimeters = NetworkSecurityPerimetersOperations( - self._client, self._config, self._serialize, self._deserialize) - self.perimeter_associable_resource_types = PerimeterAssociableResourceTypesOperations( - self._client, self._config, self._serialize, self._deserialize) - - async def _send_request(self, http_request: HttpRequest, **kwargs: Any) -> AsyncHttpResponse: + def _send_request( + self, + request: HttpRequest, + **kwargs: Any + ) -> Awaitable[AsyncHttpResponse]: """Runs the network request through the client's chained policies. - :param http_request: The network request you want to make. Required. - :type http_request: ~azure.core.pipeline.transport.HttpRequest - :keyword bool stream: Whether the response payload will be streamed. Defaults to True. + >>> from azure.core.rest import HttpRequest + >>> request = HttpRequest("GET", "https://www.example.org/") + + >>> response = await client._send_request(request) + + + For more information on this code flow, see https://aka.ms/azsdk/python/protocol/quickstart + + :param request: The network request you want to make. Required. + :type request: ~azure.core.rest.HttpRequest + :keyword bool stream: Whether the response payload will be streamed. Defaults to False. :return: The response of your network call. Does not do error handling on your response. - :rtype: ~azure.core.pipeline.transport.AsyncHttpResponse + :rtype: ~azure.core.rest.AsyncHttpResponse """ - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - } - http_request.url = self._client.format_url(http_request.url, **path_format_arguments) - stream = kwargs.pop("stream", True) - pipeline_response = await self._client._pipeline.run(http_request, stream=stream, **kwargs) - return pipeline_response.http_response + + request_copy = deepcopy(request) + request_copy.url = self._client.format_url(request_copy.url) + return self._client.send_request(request_copy, **kwargs) async def close(self) -> None: await self._client.close() diff --git a/src/network-manager/azext_network_manager/vendored_sdks/aio/_patch.py b/src/network-manager/azext_network_manager/vendored_sdks/aio/_patch.py new file mode 100644 index 00000000000..74e48ecd07c --- /dev/null +++ b/src/network-manager/azext_network_manager/vendored_sdks/aio/_patch.py @@ -0,0 +1,31 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# +# Copyright (c) Microsoft Corporation. All rights reserved. +# +# The MIT License (MIT) +# +# Permission is hereby granted, free of charge, to any person obtaining a copy +# of this software and associated documentation files (the ""Software""), to +# deal in the Software without restriction, including without limitation the +# rights to use, copy, modify, merge, publish, distribute, sublicense, and/or +# sell copies of the Software, and to permit persons to whom the Software is +# furnished to do so, subject to the following conditions: +# +# The above copyright notice and this permission notice shall be included in +# all copies or substantial portions of the Software. +# +# THE SOFTWARE IS PROVIDED *AS IS*, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING +# FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS +# IN THE SOFTWARE. +# +# -------------------------------------------------------------------------- + +# This file is used for handwritten extensions to the generated code. Example: +# https://github.com/Azure/azure-sdk-for-python/blob/main/doc/dev/customize_code/how-to-patch-sdk-code.md +def patch_sdk(): + pass \ No newline at end of file diff --git a/src/network-manager/azext_network_manager/vendored_sdks/aio/operations/__init__.py b/src/network-manager/azext_network_manager/vendored_sdks/aio/operations/__init__.py index e3ab4d13aca..4a8edd7c584 100644 --- a/src/network-manager/azext_network_manager/vendored_sdks/aio/operations/__init__.py +++ b/src/network-manager/azext_network_manager/vendored_sdks/aio/operations/__init__.py @@ -10,40 +10,38 @@ from ._network_manager_commits_operations import NetworkManagerCommitsOperations from ._network_manager_deployment_status_operations import NetworkManagerDeploymentStatusOperations from ._effective_virtual_networks_operations import EffectiveVirtualNetworksOperations -from ._active_connectivity_configurations_operations import ActiveConnectivityConfigurationsOperations -from ._active_security_admin_rules_operations import ActiveSecurityAdminRulesOperations -from ._active_security_user_rules_operations import ActiveSecurityUserRulesOperations +from ._network_management_client_operations import NetworkManagementClientOperationsMixin from ._connectivity_configurations_operations import ConnectivityConfigurationsOperations -from ._effective_connectivity_configurations_operations import EffectiveConnectivityConfigurationsOperations -from ._network_manager_effective_security_admin_rules_operations import NetworkManagerEffectiveSecurityAdminRulesOperations from ._network_groups_operations import NetworkGroupsOperations +from ._list_effective_virtual_networks_operations import ListEffectiveVirtualNetworksOperations +from ._static_members_operations import StaticMembersOperations from ._security_user_configurations_operations import SecurityUserConfigurationsOperations from ._user_rule_collections_operations import UserRuleCollectionsOperations from ._user_rules_operations import UserRulesOperations from ._security_admin_configurations_operations import SecurityAdminConfigurationsOperations from ._admin_rule_collections_operations import AdminRuleCollectionsOperations from ._admin_rules_operations import AdminRulesOperations -from ._network_security_perimeters_operations import NetworkSecurityPerimetersOperations -from ._perimeter_associable_resource_types_operations import PerimeterAssociableResourceTypesOperations +from ._subscription_network_manager_connections_operations import SubscriptionNetworkManagerConnectionsOperations +from ._management_group_network_manager_connections_operations import ManagementGroupNetworkManagerConnectionsOperations +from ._scope_connections_operations import ScopeConnectionsOperations __all__ = [ 'NetworkManagersOperations', 'NetworkManagerCommitsOperations', 'NetworkManagerDeploymentStatusOperations', 'EffectiveVirtualNetworksOperations', - 'ActiveConnectivityConfigurationsOperations', - 'ActiveSecurityAdminRulesOperations', - 'ActiveSecurityUserRulesOperations', + 'NetworkManagementClientOperationsMixin', 'ConnectivityConfigurationsOperations', - 'EffectiveConnectivityConfigurationsOperations', - 'NetworkManagerEffectiveSecurityAdminRulesOperations', 'NetworkGroupsOperations', + 'ListEffectiveVirtualNetworksOperations', + 'StaticMembersOperations', 'SecurityUserConfigurationsOperations', 'UserRuleCollectionsOperations', 'UserRulesOperations', 'SecurityAdminConfigurationsOperations', 'AdminRuleCollectionsOperations', 'AdminRulesOperations', - 'NetworkSecurityPerimetersOperations', - 'PerimeterAssociableResourceTypesOperations', + 'SubscriptionNetworkManagerConnectionsOperations', + 'ManagementGroupNetworkManagerConnectionsOperations', + 'ScopeConnectionsOperations', ] diff --git a/src/network-manager/azext_network_manager/vendored_sdks/aio/operations/_active_connectivity_configurations_operations.py b/src/network-manager/azext_network_manager/vendored_sdks/aio/operations/_active_connectivity_configurations_operations.py deleted file mode 100644 index 3abf2e35153..00000000000 --- a/src/network-manager/azext_network_manager/vendored_sdks/aio/operations/_active_connectivity_configurations_operations.py +++ /dev/null @@ -1,107 +0,0 @@ -# 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 typing import Any, Callable, Dict, Generic, Optional, TypeVar -import warnings - -from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error -from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import AsyncHttpResponse, HttpRequest -from azure.mgmt.core.exceptions import ARMErrorFormat - -from ... import models as _models - -T = TypeVar('T') -ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] - -class ActiveConnectivityConfigurationsOperations: - """ActiveConnectivityConfigurationsOperations async operations. - - You should not instantiate this class directly. Instead, you should create a Client instance that - instantiates it for you and attaches it as an attribute. - - :ivar models: Alias to model classes used in this operation group. - :type models: ~azure.mgmt.network.v2021_02_01_preview.models - :param client: Client for service requests. - :param config: Configuration of service client. - :param serializer: An object model serializer. - :param deserializer: An object model deserializer. - """ - - models = _models - - def __init__(self, client, config, serializer, deserializer) -> None: - self._client = client - self._serialize = serializer - self._deserialize = deserializer - self._config = config - - async def list( - self, - resource_group_name: str, - network_manager_name: str, - parameters: "_models.ActiveConfigurationParameter", - **kwargs: Any - ) -> "_models.ActiveConnectivityConfigurationsListResult": - """Lists active connectivity configurations in a network manager. - - :param resource_group_name: The name of the resource group. - :type resource_group_name: str - :param network_manager_name: The name of the network manager. - :type network_manager_name: str - :param parameters: Active Configuration Parameter. - :type parameters: ~azure.mgmt.network.v2021_02_01_preview.models.ActiveConfigurationParameter - :keyword callable cls: A custom type or function that will be passed the direct response - :return: ActiveConnectivityConfigurationsListResult, or the result of cls(response) - :rtype: ~azure.mgmt.network.v2021_02_01_preview.models.ActiveConnectivityConfigurationsListResult - :raises: ~azure.core.exceptions.HttpResponseError - """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.ActiveConnectivityConfigurationsListResult"] - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-02-01-preview" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self.list.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'networkManagerName': self._serialize.url("network_manager_name", network_manager_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(parameters, 'ActiveConfigurationParameter') - body_content_kwargs['content'] = body_content - request = self._client.post(url, query_parameters, header_parameters, **body_content_kwargs) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - deserialized = self._deserialize('ActiveConnectivityConfigurationsListResult', pipeline_response) - - if cls: - return cls(pipeline_response, deserialized, {}) - - return deserialized - list.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/networkManagers/{networkManagerName}/listActiveConnectivityConfigurations'} # type: ignore diff --git a/src/network-manager/azext_network_manager/vendored_sdks/aio/operations/_active_security_user_rules_operations.py b/src/network-manager/azext_network_manager/vendored_sdks/aio/operations/_active_security_user_rules_operations.py deleted file mode 100644 index 8cef3bdce40..00000000000 --- a/src/network-manager/azext_network_manager/vendored_sdks/aio/operations/_active_security_user_rules_operations.py +++ /dev/null @@ -1,107 +0,0 @@ -# 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 typing import Any, Callable, Dict, Generic, Optional, TypeVar -import warnings - -from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error -from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import AsyncHttpResponse, HttpRequest -from azure.mgmt.core.exceptions import ARMErrorFormat - -from ... import models as _models - -T = TypeVar('T') -ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] - -class ActiveSecurityUserRulesOperations: - """ActiveSecurityUserRulesOperations async operations. - - You should not instantiate this class directly. Instead, you should create a Client instance that - instantiates it for you and attaches it as an attribute. - - :ivar models: Alias to model classes used in this operation group. - :type models: ~azure.mgmt.network.v2021_02_01_preview.models - :param client: Client for service requests. - :param config: Configuration of service client. - :param serializer: An object model serializer. - :param deserializer: An object model deserializer. - """ - - models = _models - - def __init__(self, client, config, serializer, deserializer) -> None: - self._client = client - self._serialize = serializer - self._deserialize = deserializer - self._config = config - - async def list( - self, - resource_group_name: str, - network_manager_name: str, - parameters: "_models.ActiveConfigurationParameter", - **kwargs: Any - ) -> "_models.ActiveSecurityUserRulesListResult": - """Lists Active Security User Rules in a network manager. - - :param resource_group_name: The name of the resource group. - :type resource_group_name: str - :param network_manager_name: The name of the network manager. - :type network_manager_name: str - :param parameters: Active Configuration Parameter. - :type parameters: ~azure.mgmt.network.v2021_02_01_preview.models.ActiveConfigurationParameter - :keyword callable cls: A custom type or function that will be passed the direct response - :return: ActiveSecurityUserRulesListResult, or the result of cls(response) - :rtype: ~azure.mgmt.network.v2021_02_01_preview.models.ActiveSecurityUserRulesListResult - :raises: ~azure.core.exceptions.HttpResponseError - """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.ActiveSecurityUserRulesListResult"] - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-02-01-preview" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self.list.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'networkManagerName': self._serialize.url("network_manager_name", network_manager_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(parameters, 'ActiveConfigurationParameter') - body_content_kwargs['content'] = body_content - request = self._client.post(url, query_parameters, header_parameters, **body_content_kwargs) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - deserialized = self._deserialize('ActiveSecurityUserRulesListResult', pipeline_response) - - if cls: - return cls(pipeline_response, deserialized, {}) - - return deserialized - list.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/networkManagers/{networkManagerName}/listActiveSecurityUserRules'} # type: ignore diff --git a/src/network-manager/azext_network_manager/vendored_sdks/aio/operations/_admin_rule_collections_operations.py b/src/network-manager/azext_network_manager/vendored_sdks/aio/operations/_admin_rule_collections_operations.py index eca2c67749c..cc61ec586e4 100644 --- a/src/network-manager/azext_network_manager/vendored_sdks/aio/operations/_admin_rule_collections_operations.py +++ b/src/network-manager/azext_network_manager/vendored_sdks/aio/operations/_admin_rule_collections_operations.py @@ -5,17 +5,22 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import functools from typing import Any, AsyncIterable, Callable, Dict, Generic, Optional, TypeVar, Union import warnings from azure.core.async_paging import AsyncItemPaged, AsyncList from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import AsyncHttpResponse, HttpRequest +from azure.core.pipeline.transport import AsyncHttpResponse +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace +from azure.core.tracing.decorator_async import distributed_trace_async from azure.mgmt.core.exceptions import ARMErrorFormat from ... import models as _models - +from ..._vendor import _convert_request +from ...operations._admin_rule_collections_operations import build_create_or_update_request, build_delete_request, build_get_request, build_list_request T = TypeVar('T') ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -26,7 +31,7 @@ class AdminRuleCollectionsOperations: instantiates it for you and attaches it as an attribute. :ivar models: Alias to model classes used in this operation group. - :type models: ~azure.mgmt.network.v2021_02_01_preview.models + :type models: ~azure.mgmt.network.v2021_05_01_preview.models :param client: Client for service requests. :param config: Configuration of service client. :param serializer: An object model serializer. @@ -41,6 +46,7 @@ def __init__(self, client, config, serializer, deserializer) -> None: self._deserialize = deserializer self._config = config + @distributed_trace def list( self, resource_group_name: str, @@ -56,7 +62,7 @@ def list( :type resource_group_name: str :param network_manager_name: The name of the network manager. :type network_manager_name: str - :param configuration_name: The name of the network manager security Configuration. + :param configuration_name: The name of the network manager Security Configuration. :type configuration_name: str :param top: An optional query parameter which specifies the maximum number of records to be returned by the server. @@ -66,8 +72,10 @@ def list( a skipToken parameter that specifies a starting point to use for subsequent calls. :type skip_token: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either RuleCollectionListResult or the result of cls(response) - :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.network.v2021_02_01_preview.models.RuleCollectionListResult] + :return: An iterator like instance of either RuleCollectionListResult or the result of + cls(response) + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.network.v2021_05_01_preview.models.RuleCollectionListResult] :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.RuleCollectionListResult"] @@ -75,41 +83,39 @@ def list( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-02-01-preview" - accept = "application/json" - def prepare_request(next_link=None): - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - if not next_link: - # Construct URL - url = self.list.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'networkManagerName': self._serialize.url("network_manager_name", network_manager_name, 'str'), - 'configurationName': self._serialize.url("configuration_name", configuration_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - if top is not None: - query_parameters['$top'] = self._serialize.query("top", top, 'int', maximum=20, minimum=1) - if skip_token is not None: - query_parameters['$skipToken'] = self._serialize.query("skip_token", skip_token, 'str') - - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + network_manager_name=network_manager_name, + configuration_name=configuration_name, + top=top, + skip_token=skip_token, + template_url=self.list.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + network_manager_name=network_manager_name, + configuration_name=configuration_name, + top=top, + skip_token=skip_token, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request async def extract_data(pipeline_response): - deserialized = self._deserialize('RuleCollectionListResult', pipeline_response) + deserialized = self._deserialize("RuleCollectionListResult", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -127,11 +133,13 @@ async def get_next(next_link=None): return pipeline_response + return AsyncItemPaged( get_next, extract_data ) list.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/networkManagers/{networkManagerName}/securityAdminConfigurations/{configurationName}/ruleCollections'} # type: ignore + @distributed_trace_async async def get( self, resource_group_name: str, @@ -146,14 +154,14 @@ async def get( :type resource_group_name: str :param network_manager_name: The name of the network manager. :type network_manager_name: str - :param configuration_name: The name of the network manager security Configuration. + :param configuration_name: The name of the network manager Security Configuration. :type configuration_name: str :param rule_collection_name: The name of the network manager security Configuration rule collection. :type rule_collection_name: str :keyword callable cls: A custom type or function that will be passed the direct response :return: RuleCollection, or the result of cls(response) - :rtype: ~azure.mgmt.network.v2021_02_01_preview.models.RuleCollection + :rtype: ~azure.mgmt.network.v2021_05_01_preview.models.RuleCollection :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.RuleCollection"] @@ -161,29 +169,19 @@ async def get( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-02-01-preview" - accept = "application/json" - - # Construct URL - url = self.get.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'networkManagerName': self._serialize.url("network_manager_name", network_manager_name, 'str'), - 'configurationName': self._serialize.url("configuration_name", configuration_name, 'str'), - 'ruleCollectionName': self._serialize.url("rule_collection_name", rule_collection_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_get_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + network_manager_name=network_manager_name, + configuration_name=configuration_name, + rule_collection_name=rule_collection_name, + template_url=self.get.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.get(url, query_parameters, header_parameters) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -197,8 +195,11 @@ async def get( return cls(pipeline_response, deserialized, {}) return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/networkManagers/{networkManagerName}/securityAdminConfigurations/{configurationName}/ruleCollections/{ruleCollectionName}'} # type: ignore + + @distributed_trace_async async def create_or_update( self, resource_group_name: str, @@ -214,16 +215,16 @@ async def create_or_update( :type resource_group_name: str :param network_manager_name: The name of the network manager. :type network_manager_name: str - :param configuration_name: The name of the network manager security Configuration. + :param configuration_name: The name of the network manager Security Configuration. :type configuration_name: str :param rule_collection_name: The name of the network manager security Configuration rule collection. :type rule_collection_name: str :param rule_collection: The Rule Collection to create or update. - :type rule_collection: ~azure.mgmt.network.v2021_02_01_preview.models.RuleCollection + :type rule_collection: ~azure.mgmt.network.v2021_05_01_preview.models.RuleCollection :keyword callable cls: A custom type or function that will be passed the direct response :return: RuleCollection, or the result of cls(response) - :rtype: ~azure.mgmt.network.v2021_02_01_preview.models.RuleCollection + :rtype: ~azure.mgmt.network.v2021_05_01_preview.models.RuleCollection :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.RuleCollection"] @@ -231,34 +232,24 @@ async def create_or_update( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-02-01-preview" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self.create_or_update.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'networkManagerName': self._serialize.url("network_manager_name", network_manager_name, 'str'), - 'configurationName': self._serialize.url("configuration_name", configuration_name, 'str'), - 'ruleCollectionName': self._serialize.url("rule_collection_name", rule_collection_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + + _json = self._serialize.body(rule_collection, 'RuleCollection') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + request = build_create_or_update_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + network_manager_name=network_manager_name, + configuration_name=configuration_name, + rule_collection_name=rule_collection_name, + content_type=content_type, + json=_json, + template_url=self.create_or_update.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(rule_collection, 'RuleCollection') - body_content_kwargs['content'] = body_content - request = self._client.put(url, query_parameters, header_parameters, **body_content_kwargs) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -276,14 +267,19 @@ async def create_or_update( return cls(pipeline_response, deserialized, {}) return deserialized + create_or_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/networkManagers/{networkManagerName}/securityAdminConfigurations/{configurationName}/ruleCollections/{ruleCollectionName}'} # type: ignore + + @distributed_trace_async async def delete( self, resource_group_name: str, network_manager_name: str, configuration_name: str, rule_collection_name: str, + force: Optional[bool] = None, + recursive: Optional[bool] = None, **kwargs: Any ) -> None: """Deletes an admin rule collection. @@ -292,11 +288,19 @@ async def delete( :type resource_group_name: str :param network_manager_name: The name of the network manager. :type network_manager_name: str - :param configuration_name: The name of the network manager security Configuration. + :param configuration_name: The name of the network manager Security Configuration. :type configuration_name: str :param rule_collection_name: The name of the network manager security Configuration rule collection. :type rule_collection_name: str + :param force: Deletes the resource even if it is part of a deployed configuration. If the + configuration has been deployed, the service will do a cleanup deployment in the background, + prior to the delete. + :type force: bool + :param recursive: Deletes the resource recursively. When present in a security configuration + delete, all rule collections and rules within the configuration will be deleted. When present + in a rule collection delete, all rules within the collection will be deleted. + :type recursive: bool :keyword callable cls: A custom type or function that will be passed the direct response :return: None, or the result of cls(response) :rtype: None @@ -307,29 +311,21 @@ async def delete( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-02-01-preview" - accept = "application/json" - - # Construct URL - url = self.delete.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'networkManagerName': self._serialize.url("network_manager_name", network_manager_name, 'str'), - 'configurationName': self._serialize.url("configuration_name", configuration_name, 'str'), - 'ruleCollectionName': self._serialize.url("rule_collection_name", rule_collection_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_delete_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + network_manager_name=network_manager_name, + configuration_name=configuration_name, + rule_collection_name=rule_collection_name, + force=force, + recursive=recursive, + template_url=self.delete.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.delete(url, query_parameters, header_parameters) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -341,3 +337,4 @@ async def delete( return cls(pipeline_response, None, {}) delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/networkManagers/{networkManagerName}/securityAdminConfigurations/{configurationName}/ruleCollections/{ruleCollectionName}'} # type: ignore + diff --git a/src/network-manager/azext_network_manager/vendored_sdks/aio/operations/_admin_rules_operations.py b/src/network-manager/azext_network_manager/vendored_sdks/aio/operations/_admin_rules_operations.py index 4d41ba8a9b6..ec920ef05a7 100644 --- a/src/network-manager/azext_network_manager/vendored_sdks/aio/operations/_admin_rules_operations.py +++ b/src/network-manager/azext_network_manager/vendored_sdks/aio/operations/_admin_rules_operations.py @@ -5,17 +5,22 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import functools from typing import Any, AsyncIterable, Callable, Dict, Generic, Optional, TypeVar, Union import warnings from azure.core.async_paging import AsyncItemPaged, AsyncList from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import AsyncHttpResponse, HttpRequest +from azure.core.pipeline.transport import AsyncHttpResponse +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace +from azure.core.tracing.decorator_async import distributed_trace_async from azure.mgmt.core.exceptions import ARMErrorFormat from ... import models as _models - +from ..._vendor import _convert_request +from ...operations._admin_rules_operations import build_create_or_update_request, build_delete_request, build_get_request, build_list_request T = TypeVar('T') ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -26,7 +31,7 @@ class AdminRulesOperations: instantiates it for you and attaches it as an attribute. :ivar models: Alias to model classes used in this operation group. - :type models: ~azure.mgmt.network.v2021_02_01_preview.models + :type models: ~azure.mgmt.network.v2021_05_01_preview.models :param client: Client for service requests. :param config: Configuration of service client. :param serializer: An object model serializer. @@ -41,6 +46,7 @@ def __init__(self, client, config, serializer, deserializer) -> None: self._deserialize = deserializer self._config = config + @distributed_trace def list( self, resource_group_name: str, @@ -57,7 +63,7 @@ def list( :type resource_group_name: str :param network_manager_name: The name of the network manager. :type network_manager_name: str - :param configuration_name: The name of the network manager security Configuration. + :param configuration_name: The name of the network manager Security Configuration. :type configuration_name: str :param rule_collection_name: The name of the network manager security Configuration rule collection. @@ -71,7 +77,8 @@ def list( :type skip_token: str :keyword callable cls: A custom type or function that will be passed the direct response :return: An iterator like instance of either AdminRuleListResult or the result of cls(response) - :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.network.v2021_02_01_preview.models.AdminRuleListResult] + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.network.v2021_05_01_preview.models.AdminRuleListResult] :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.AdminRuleListResult"] @@ -79,42 +86,41 @@ def list( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-02-01-preview" - accept = "application/json" - def prepare_request(next_link=None): - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - if not next_link: - # Construct URL - url = self.list.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'networkManagerName': self._serialize.url("network_manager_name", network_manager_name, 'str'), - 'configurationName': self._serialize.url("configuration_name", configuration_name, 'str'), - 'ruleCollectionName': self._serialize.url("rule_collection_name", rule_collection_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - if top is not None: - query_parameters['$top'] = self._serialize.query("top", top, 'int', maximum=20, minimum=1) - if skip_token is not None: - query_parameters['$skipToken'] = self._serialize.query("skip_token", skip_token, 'str') - - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + network_manager_name=network_manager_name, + configuration_name=configuration_name, + rule_collection_name=rule_collection_name, + top=top, + skip_token=skip_token, + template_url=self.list.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + network_manager_name=network_manager_name, + configuration_name=configuration_name, + rule_collection_name=rule_collection_name, + top=top, + skip_token=skip_token, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request async def extract_data(pipeline_response): - deserialized = self._deserialize('AdminRuleListResult', pipeline_response) + deserialized = self._deserialize("AdminRuleListResult", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -132,11 +138,13 @@ async def get_next(next_link=None): return pipeline_response + return AsyncItemPaged( get_next, extract_data ) list.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/networkManagers/{networkManagerName}/securityAdminConfigurations/{configurationName}/ruleCollections/{ruleCollectionName}/rules'} # type: ignore + @distributed_trace_async async def get( self, resource_group_name: str, @@ -152,7 +160,7 @@ async def get( :type resource_group_name: str :param network_manager_name: The name of the network manager. :type network_manager_name: str - :param configuration_name: The name of the network manager security Configuration. + :param configuration_name: The name of the network manager Security Configuration. :type configuration_name: str :param rule_collection_name: The name of the network manager security Configuration rule collection. @@ -161,7 +169,7 @@ async def get( :type rule_name: str :keyword callable cls: A custom type or function that will be passed the direct response :return: BaseAdminRule, or the result of cls(response) - :rtype: ~azure.mgmt.network.v2021_02_01_preview.models.BaseAdminRule + :rtype: ~azure.mgmt.network.v2021_05_01_preview.models.BaseAdminRule :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.BaseAdminRule"] @@ -169,30 +177,20 @@ async def get( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-02-01-preview" - accept = "application/json" - - # Construct URL - url = self.get.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'networkManagerName': self._serialize.url("network_manager_name", network_manager_name, 'str'), - 'configurationName': self._serialize.url("configuration_name", configuration_name, 'str'), - 'ruleCollectionName': self._serialize.url("rule_collection_name", rule_collection_name, 'str'), - 'ruleName': self._serialize.url("rule_name", rule_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_get_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + network_manager_name=network_manager_name, + configuration_name=configuration_name, + rule_collection_name=rule_collection_name, + rule_name=rule_name, + template_url=self.get.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.get(url, query_parameters, header_parameters) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -206,8 +204,11 @@ async def get( return cls(pipeline_response, deserialized, {}) return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/networkManagers/{networkManagerName}/securityAdminConfigurations/{configurationName}/ruleCollections/{ruleCollectionName}/rules/{ruleName}'} # type: ignore + + @distributed_trace_async async def create_or_update( self, resource_group_name: str, @@ -224,7 +225,7 @@ async def create_or_update( :type resource_group_name: str :param network_manager_name: The name of the network manager. :type network_manager_name: str - :param configuration_name: The name of the network manager security Configuration. + :param configuration_name: The name of the network manager Security Configuration. :type configuration_name: str :param rule_collection_name: The name of the network manager security Configuration rule collection. @@ -232,10 +233,10 @@ async def create_or_update( :param rule_name: The name of the rule. :type rule_name: str :param admin_rule: The admin rule to create or update. - :type admin_rule: ~azure.mgmt.network.v2021_02_01_preview.models.BaseAdminRule + :type admin_rule: ~azure.mgmt.network.v2021_05_01_preview.models.BaseAdminRule :keyword callable cls: A custom type or function that will be passed the direct response :return: BaseAdminRule, or the result of cls(response) - :rtype: ~azure.mgmt.network.v2021_02_01_preview.models.BaseAdminRule + :rtype: ~azure.mgmt.network.v2021_05_01_preview.models.BaseAdminRule :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.BaseAdminRule"] @@ -243,35 +244,25 @@ async def create_or_update( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-02-01-preview" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self.create_or_update.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'networkManagerName': self._serialize.url("network_manager_name", network_manager_name, 'str'), - 'configurationName': self._serialize.url("configuration_name", configuration_name, 'str'), - 'ruleCollectionName': self._serialize.url("rule_collection_name", rule_collection_name, 'str'), - 'ruleName': self._serialize.url("rule_name", rule_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + + _json = self._serialize.body(admin_rule, 'BaseAdminRule') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + request = build_create_or_update_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + network_manager_name=network_manager_name, + configuration_name=configuration_name, + rule_collection_name=rule_collection_name, + rule_name=rule_name, + content_type=content_type, + json=_json, + template_url=self.create_or_update.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(admin_rule, 'BaseAdminRule') - body_content_kwargs['content'] = body_content - request = self._client.put(url, query_parameters, header_parameters, **body_content_kwargs) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -289,8 +280,11 @@ async def create_or_update( return cls(pipeline_response, deserialized, {}) return deserialized + create_or_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/networkManagers/{networkManagerName}/securityAdminConfigurations/{configurationName}/ruleCollections/{ruleCollectionName}/rules/{ruleName}'} # type: ignore + + @distributed_trace_async async def delete( self, resource_group_name: str, @@ -298,6 +292,7 @@ async def delete( configuration_name: str, rule_collection_name: str, rule_name: str, + force: Optional[bool] = None, **kwargs: Any ) -> None: """Deletes an admin rule. @@ -306,13 +301,17 @@ async def delete( :type resource_group_name: str :param network_manager_name: The name of the network manager. :type network_manager_name: str - :param configuration_name: The name of the network manager security Configuration. + :param configuration_name: The name of the network manager Security Configuration. :type configuration_name: str :param rule_collection_name: The name of the network manager security Configuration rule collection. :type rule_collection_name: str :param rule_name: The name of the rule. :type rule_name: str + :param force: Deletes the resource even if it is part of a deployed configuration. If the + configuration has been deployed, the service will do a cleanup deployment in the background, + prior to the delete. + :type force: bool :keyword callable cls: A custom type or function that will be passed the direct response :return: None, or the result of cls(response) :rtype: None @@ -323,30 +322,21 @@ async def delete( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-02-01-preview" - accept = "application/json" - - # Construct URL - url = self.delete.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'networkManagerName': self._serialize.url("network_manager_name", network_manager_name, 'str'), - 'configurationName': self._serialize.url("configuration_name", configuration_name, 'str'), - 'ruleCollectionName': self._serialize.url("rule_collection_name", rule_collection_name, 'str'), - 'ruleName': self._serialize.url("rule_name", rule_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_delete_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + network_manager_name=network_manager_name, + configuration_name=configuration_name, + rule_collection_name=rule_collection_name, + rule_name=rule_name, + force=force, + template_url=self.delete.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.delete(url, query_parameters, header_parameters) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -358,3 +348,4 @@ async def delete( return cls(pipeline_response, None, {}) delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/networkManagers/{networkManagerName}/securityAdminConfigurations/{configurationName}/ruleCollections/{ruleCollectionName}/rules/{ruleName}'} # type: ignore + diff --git a/src/network-manager/azext_network_manager/vendored_sdks/aio/operations/_connectivity_configurations_operations.py b/src/network-manager/azext_network_manager/vendored_sdks/aio/operations/_connectivity_configurations_operations.py index 7aaf0f0a2c5..8c2c8298f04 100644 --- a/src/network-manager/azext_network_manager/vendored_sdks/aio/operations/_connectivity_configurations_operations.py +++ b/src/network-manager/azext_network_manager/vendored_sdks/aio/operations/_connectivity_configurations_operations.py @@ -5,17 +5,22 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import functools from typing import Any, AsyncIterable, Callable, Dict, Generic, Optional, TypeVar, Union import warnings from azure.core.async_paging import AsyncItemPaged, AsyncList from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import AsyncHttpResponse, HttpRequest +from azure.core.pipeline.transport import AsyncHttpResponse +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace +from azure.core.tracing.decorator_async import distributed_trace_async from azure.mgmt.core.exceptions import ARMErrorFormat from ... import models as _models - +from ..._vendor import _convert_request +from ...operations._connectivity_configurations_operations import build_create_or_update_request, build_delete_request, build_get_request, build_list_request T = TypeVar('T') ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -26,7 +31,7 @@ class ConnectivityConfigurationsOperations: instantiates it for you and attaches it as an attribute. :ivar models: Alias to model classes used in this operation group. - :type models: ~azure.mgmt.network.v2021_02_01_preview.models + :type models: ~azure.mgmt.network.v2021_05_01_preview.models :param client: Client for service requests. :param config: Configuration of service client. :param serializer: An object model serializer. @@ -41,6 +46,7 @@ def __init__(self, client, config, serializer, deserializer) -> None: self._deserialize = deserializer self._config = config + @distributed_trace_async async def get( self, resource_group_name: str, @@ -59,7 +65,7 @@ async def get( :type configuration_name: str :keyword callable cls: A custom type or function that will be passed the direct response :return: ConnectivityConfiguration, or the result of cls(response) - :rtype: ~azure.mgmt.network.v2021_02_01_preview.models.ConnectivityConfiguration + :rtype: ~azure.mgmt.network.v2021_05_01_preview.models.ConnectivityConfiguration :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.ConnectivityConfiguration"] @@ -67,28 +73,18 @@ async def get( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-02-01-preview" - accept = "application/json" - - # Construct URL - url = self.get.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'networkManagerName': self._serialize.url("network_manager_name", network_manager_name, 'str'), - 'configurationName': self._serialize.url("configuration_name", configuration_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_get_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + network_manager_name=network_manager_name, + configuration_name=configuration_name, + template_url=self.get.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.get(url, query_parameters, header_parameters) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -102,8 +98,11 @@ async def get( return cls(pipeline_response, deserialized, {}) return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/networkManagers/{networkManagerName}/connectivityConfigurations/{configurationName}'} # type: ignore + + @distributed_trace_async async def create_or_update( self, resource_group_name: str, @@ -122,10 +121,11 @@ async def create_or_update( :type configuration_name: str :param connectivity_configuration: Parameters supplied to create/update a network manager connectivity configuration. - :type connectivity_configuration: ~azure.mgmt.network.v2021_02_01_preview.models.ConnectivityConfiguration + :type connectivity_configuration: + ~azure.mgmt.network.v2021_05_01_preview.models.ConnectivityConfiguration :keyword callable cls: A custom type or function that will be passed the direct response :return: ConnectivityConfiguration, or the result of cls(response) - :rtype: ~azure.mgmt.network.v2021_02_01_preview.models.ConnectivityConfiguration + :rtype: ~azure.mgmt.network.v2021_05_01_preview.models.ConnectivityConfiguration :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.ConnectivityConfiguration"] @@ -133,33 +133,23 @@ async def create_or_update( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-02-01-preview" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self.create_or_update.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'networkManagerName': self._serialize.url("network_manager_name", network_manager_name, 'str'), - 'configurationName': self._serialize.url("configuration_name", configuration_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + _json = self._serialize.body(connectivity_configuration, 'ConnectivityConfiguration') + + request = build_create_or_update_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + network_manager_name=network_manager_name, + configuration_name=configuration_name, + content_type=content_type, + json=_json, + template_url=self.create_or_update.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(connectivity_configuration, 'ConnectivityConfiguration') - body_content_kwargs['content'] = body_content - request = self._client.put(url, query_parameters, header_parameters, **body_content_kwargs) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -177,13 +167,17 @@ async def create_or_update( return cls(pipeline_response, deserialized, {}) return deserialized + create_or_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/networkManagers/{networkManagerName}/connectivityConfigurations/{configurationName}'} # type: ignore + + @distributed_trace_async async def delete( self, resource_group_name: str, network_manager_name: str, configuration_name: str, + force: Optional[bool] = None, **kwargs: Any ) -> None: """Deletes a network manager connectivity configuration, specified by the resource group, network @@ -195,6 +189,10 @@ async def delete( :type network_manager_name: str :param configuration_name: The name of the network manager connectivity configuration. :type configuration_name: str + :param force: Deletes the resource even if it is part of a deployed configuration. If the + configuration has been deployed, the service will do a cleanup deployment in the background, + prior to the delete. + :type force: bool :keyword callable cls: A custom type or function that will be passed the direct response :return: None, or the result of cls(response) :rtype: None @@ -205,28 +203,19 @@ async def delete( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-02-01-preview" - accept = "application/json" - - # Construct URL - url = self.delete.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'networkManagerName': self._serialize.url("network_manager_name", network_manager_name, 'str'), - 'configurationName': self._serialize.url("configuration_name", configuration_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_delete_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + network_manager_name=network_manager_name, + configuration_name=configuration_name, + force=force, + template_url=self.delete.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.delete(url, query_parameters, header_parameters) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -239,6 +228,8 @@ async def delete( delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/networkManagers/{networkManagerName}/connectivityConfigurations/{configurationName}'} # type: ignore + + @distributed_trace def list( self, resource_group_name: str, @@ -261,8 +252,10 @@ def list( a skipToken parameter that specifies a starting point to use for subsequent calls. :type skip_token: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either ConnectivityConfigurationListResult or the result of cls(response) - :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.network.v2021_02_01_preview.models.ConnectivityConfigurationListResult] + :return: An iterator like instance of either ConnectivityConfigurationListResult or the result + of cls(response) + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.network.v2021_05_01_preview.models.ConnectivityConfigurationListResult] :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.ConnectivityConfigurationListResult"] @@ -270,40 +263,37 @@ def list( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-02-01-preview" - accept = "application/json" - def prepare_request(next_link=None): - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - if not next_link: - # Construct URL - url = self.list.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'networkManagerName': self._serialize.url("network_manager_name", network_manager_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - if top is not None: - query_parameters['$top'] = self._serialize.query("top", top, 'int', maximum=20, minimum=1) - if skip_token is not None: - query_parameters['$skipToken'] = self._serialize.query("skip_token", skip_token, 'str') - - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + network_manager_name=network_manager_name, + top=top, + skip_token=skip_token, + template_url=self.list.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + network_manager_name=network_manager_name, + top=top, + skip_token=skip_token, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request async def extract_data(pipeline_response): - deserialized = self._deserialize('ConnectivityConfigurationListResult', pipeline_response) + deserialized = self._deserialize("ConnectivityConfigurationListResult", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -321,6 +311,7 @@ async def get_next(next_link=None): return pipeline_response + return AsyncItemPaged( get_next, extract_data ) diff --git a/src/network-manager/azext_network_manager/vendored_sdks/aio/operations/_effective_connectivity_configurations_operations.py b/src/network-manager/azext_network_manager/vendored_sdks/aio/operations/_effective_connectivity_configurations_operations.py deleted file mode 100644 index a25307a9064..00000000000 --- a/src/network-manager/azext_network_manager/vendored_sdks/aio/operations/_effective_connectivity_configurations_operations.py +++ /dev/null @@ -1,107 +0,0 @@ -# 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 typing import Any, Callable, Dict, Generic, Optional, TypeVar -import warnings - -from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error -from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import AsyncHttpResponse, HttpRequest -from azure.mgmt.core.exceptions import ARMErrorFormat - -from ... import models as _models - -T = TypeVar('T') -ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] - -class EffectiveConnectivityConfigurationsOperations: - """EffectiveConnectivityConfigurationsOperations async operations. - - You should not instantiate this class directly. Instead, you should create a Client instance that - instantiates it for you and attaches it as an attribute. - - :ivar models: Alias to model classes used in this operation group. - :type models: ~azure.mgmt.network.v2021_02_01_preview.models - :param client: Client for service requests. - :param config: Configuration of service client. - :param serializer: An object model serializer. - :param deserializer: An object model deserializer. - """ - - models = _models - - def __init__(self, client, config, serializer, deserializer) -> None: - self._client = client - self._serialize = serializer - self._deserialize = deserializer - self._config = config - - async def list( - self, - resource_group_name: str, - virtual_network_name: str, - parameters: "_models.QueryRequestOptions", - **kwargs: Any - ) -> "_models.NetworkManagerEffectiveConnectivityConfigurationListResult": - """List all effective connectivity configurations applied on a virtual network. - - :param resource_group_name: The name of the resource group. - :type resource_group_name: str - :param virtual_network_name: The name of the virtual network. - :type virtual_network_name: str - :param parameters: Parameters supplied to list correct page. - :type parameters: ~azure.mgmt.network.v2021_02_01_preview.models.QueryRequestOptions - :keyword callable cls: A custom type or function that will be passed the direct response - :return: NetworkManagerEffectiveConnectivityConfigurationListResult, or the result of cls(response) - :rtype: ~azure.mgmt.network.v2021_02_01_preview.models.NetworkManagerEffectiveConnectivityConfigurationListResult - :raises: ~azure.core.exceptions.HttpResponseError - """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.NetworkManagerEffectiveConnectivityConfigurationListResult"] - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-02-01-preview" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self.list.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'virtualNetworkName': self._serialize.url("virtual_network_name", virtual_network_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(parameters, 'QueryRequestOptions') - body_content_kwargs['content'] = body_content - request = self._client.post(url, query_parameters, header_parameters, **body_content_kwargs) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - deserialized = self._deserialize('NetworkManagerEffectiveConnectivityConfigurationListResult', pipeline_response) - - if cls: - return cls(pipeline_response, deserialized, {}) - - return deserialized - list.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/virtualNetworks/{virtualNetworkName}/listNetworkManagerEffectiveConnectivityConfigurations'} # type: ignore diff --git a/src/network-manager/azext_network_manager/vendored_sdks/aio/operations/_effective_virtual_networks_operations.py b/src/network-manager/azext_network_manager/vendored_sdks/aio/operations/_effective_virtual_networks_operations.py index 7f424f19c79..6d726c7f54d 100644 --- a/src/network-manager/azext_network_manager/vendored_sdks/aio/operations/_effective_virtual_networks_operations.py +++ b/src/network-manager/azext_network_manager/vendored_sdks/aio/operations/_effective_virtual_networks_operations.py @@ -5,16 +5,20 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import functools from typing import Any, Callable, Dict, Generic, Optional, TypeVar import warnings from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import AsyncHttpResponse, HttpRequest +from azure.core.pipeline.transport import AsyncHttpResponse +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator_async import distributed_trace_async from azure.mgmt.core.exceptions import ARMErrorFormat from ... import models as _models - +from ..._vendor import _convert_request +from ...operations._effective_virtual_networks_operations import build_list_by_network_manager_request T = TypeVar('T') ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -25,7 +29,7 @@ class EffectiveVirtualNetworksOperations: instantiates it for you and attaches it as an attribute. :ivar models: Alias to model classes used in this operation group. - :type models: ~azure.mgmt.network.v2021_02_01_preview.models + :type models: ~azure.mgmt.network.v2021_05_01_preview.models :param client: Client for service requests. :param config: Configuration of service client. :param serializer: An object model serializer. @@ -40,6 +44,7 @@ def __init__(self, client, config, serializer, deserializer) -> None: self._deserialize = deserializer self._config = config + @distributed_trace_async async def list_by_network_manager( self, resource_group_name: str, @@ -56,7 +61,8 @@ async def list_by_network_manager( :param network_manager_name: The name of the network manager. :type network_manager_name: str :param parameters: Effective Virtual Networks Parameter. - :type parameters: ~azure.mgmt.network.v2021_02_01_preview.models.EffectiveVirtualNetworksParameter + :type parameters: + ~azure.mgmt.network.v2021_05_01_preview.models.EffectiveVirtualNetworksParameter :param top: An optional query parameter which specifies the maximum number of records to be returned by the server. :type top: int @@ -66,7 +72,7 @@ async def list_by_network_manager( :type skip_token: str :keyword callable cls: A custom type or function that will be passed the direct response :return: EffectiveVirtualNetworksListResult, or the result of cls(response) - :rtype: ~azure.mgmt.network.v2021_02_01_preview.models.EffectiveVirtualNetworksListResult + :rtype: ~azure.mgmt.network.v2021_05_01_preview.models.EffectiveVirtualNetworksListResult :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.EffectiveVirtualNetworksListResult"] @@ -74,106 +80,24 @@ async def list_by_network_manager( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-02-01-preview" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self.list_by_network_manager.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'networkManagerName': self._serialize.url("network_manager_name", network_manager_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - if top is not None: - query_parameters['$top'] = self._serialize.query("top", top, 'int', maximum=20, minimum=1) - if skip_token is not None: - query_parameters['$skipToken'] = self._serialize.query("skip_token", skip_token, 'str') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(parameters, 'EffectiveVirtualNetworksParameter') - body_content_kwargs['content'] = body_content - request = self._client.post(url, query_parameters, header_parameters, **body_content_kwargs) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - deserialized = self._deserialize('EffectiveVirtualNetworksListResult', pipeline_response) - if cls: - return cls(pipeline_response, deserialized, {}) + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - return deserialized - list_by_network_manager.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/networkManagers/{networkManagerName}/listEffectiveVirtualNetworks'} # type: ignore + _json = self._serialize.body(parameters, 'EffectiveVirtualNetworksParameter') - async def list_by_network_group( - self, - resource_group_name: str, - network_manager_name: str, - network_group_name: str, - parameters: "_models.QueryRequestOptions", - **kwargs: Any - ) -> "_models.EffectiveVirtualNetworksListResult": - """Lists all effective virtual networks by specified network group. + request = build_list_by_network_manager_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + network_manager_name=network_manager_name, + content_type=content_type, + json=_json, + top=top, + skip_token=skip_token, + template_url=self.list_by_network_manager.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - :param resource_group_name: The name of the resource group. - :type resource_group_name: str - :param network_manager_name: The name of the network manager. - :type network_manager_name: str - :param network_group_name: The name of the network group to get. - :type network_group_name: str - :param parameters: Parameters supplied to list correct page. - :type parameters: ~azure.mgmt.network.v2021_02_01_preview.models.QueryRequestOptions - :keyword callable cls: A custom type or function that will be passed the direct response - :return: EffectiveVirtualNetworksListResult, or the result of cls(response) - :rtype: ~azure.mgmt.network.v2021_02_01_preview.models.EffectiveVirtualNetworksListResult - :raises: ~azure.core.exceptions.HttpResponseError - """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.EffectiveVirtualNetworksListResult"] - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-02-01-preview" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self.list_by_network_group.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'networkManagerName': self._serialize.url("network_manager_name", network_manager_name, 'str'), - 'networkGroupName': self._serialize.url("network_group_name", network_group_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(parameters, 'QueryRequestOptions') - body_content_kwargs['content'] = body_content - request = self._client.post(url, query_parameters, header_parameters, **body_content_kwargs) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -187,4 +111,6 @@ async def list_by_network_group( return cls(pipeline_response, deserialized, {}) return deserialized - list_by_network_group.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/networkManagers/{networkManagerName}/networkGroups/{networkGroupName}/listEffectiveVirtualNetworks'} # type: ignore + + list_by_network_manager.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/networkManagers/{networkManagerName}/listEffectiveVirtualNetworks'} # type: ignore + diff --git a/src/network-manager/azext_network_manager/vendored_sdks/aio/operations/_active_security_admin_rules_operations.py b/src/network-manager/azext_network_manager/vendored_sdks/aio/operations/_list_effective_virtual_networks_operations.py similarity index 53% rename from src/network-manager/azext_network_manager/vendored_sdks/aio/operations/_active_security_admin_rules_operations.py rename to src/network-manager/azext_network_manager/vendored_sdks/aio/operations/_list_effective_virtual_networks_operations.py index 23e9a9b4987..7fe36989af3 100644 --- a/src/network-manager/azext_network_manager/vendored_sdks/aio/operations/_active_security_admin_rules_operations.py +++ b/src/network-manager/azext_network_manager/vendored_sdks/aio/operations/_list_effective_virtual_networks_operations.py @@ -5,27 +5,31 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import functools from typing import Any, Callable, Dict, Generic, Optional, TypeVar import warnings from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import AsyncHttpResponse, HttpRequest +from azure.core.pipeline.transport import AsyncHttpResponse +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator_async import distributed_trace_async from azure.mgmt.core.exceptions import ARMErrorFormat from ... import models as _models - +from ..._vendor import _convert_request +from ...operations._list_effective_virtual_networks_operations import build_by_network_group_request T = TypeVar('T') ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] -class ActiveSecurityAdminRulesOperations: - """ActiveSecurityAdminRulesOperations async operations. +class ListEffectiveVirtualNetworksOperations: + """ListEffectiveVirtualNetworksOperations async operations. You should not instantiate this class directly. Instead, you should create a Client instance that instantiates it for you and attaches it as an attribute. :ivar models: Alias to model classes used in this operation group. - :type models: ~azure.mgmt.network.v2021_02_01_preview.models + :type models: ~azure.mgmt.network.v2021_05_01_preview.models :param client: Client for service requests. :param config: Configuration of service client. :param serializer: An object model serializer. @@ -40,57 +44,52 @@ def __init__(self, client, config, serializer, deserializer) -> None: self._deserialize = deserializer self._config = config - async def list( + @distributed_trace_async + async def by_network_group( self, resource_group_name: str, network_manager_name: str, - parameters: "_models.ActiveConfigurationParameter", + network_group_name: str, + parameters: "_models.QueryRequestOptions", **kwargs: Any - ) -> "_models.ActiveSecurityAdminRulesListResult": - """Lists active security admin rules in a network manager. + ) -> "_models.EffectiveVirtualNetworksListResult": + """Lists all effective virtual networks by specified network group. :param resource_group_name: The name of the resource group. :type resource_group_name: str :param network_manager_name: The name of the network manager. :type network_manager_name: str - :param parameters: Active Configuration Parameter. - :type parameters: ~azure.mgmt.network.v2021_02_01_preview.models.ActiveConfigurationParameter + :param network_group_name: The name of the network group. + :type network_group_name: str + :param parameters: Parameters supplied to list correct page. + :type parameters: ~azure.mgmt.network.v2021_05_01_preview.models.QueryRequestOptions :keyword callable cls: A custom type or function that will be passed the direct response - :return: ActiveSecurityAdminRulesListResult, or the result of cls(response) - :rtype: ~azure.mgmt.network.v2021_02_01_preview.models.ActiveSecurityAdminRulesListResult + :return: EffectiveVirtualNetworksListResult, or the result of cls(response) + :rtype: ~azure.mgmt.network.v2021_05_01_preview.models.EffectiveVirtualNetworksListResult :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.ActiveSecurityAdminRulesListResult"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.EffectiveVirtualNetworksListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-02-01-preview" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self.list.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'networkManagerName': self._serialize.url("network_manager_name", network_manager_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + + _json = self._serialize.body(parameters, 'QueryRequestOptions') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + request = build_by_network_group_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + network_manager_name=network_manager_name, + network_group_name=network_group_name, + content_type=content_type, + json=_json, + template_url=self.by_network_group.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(parameters, 'ActiveConfigurationParameter') - body_content_kwargs['content'] = body_content - request = self._client.post(url, query_parameters, header_parameters, **body_content_kwargs) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -98,10 +97,12 @@ async def list( map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize('ActiveSecurityAdminRulesListResult', pipeline_response) + deserialized = self._deserialize('EffectiveVirtualNetworksListResult', pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - list.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/networkManagers/{networkManagerName}/listActiveSecurityAdminRules'} # type: ignore + + by_network_group.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/networkManagers/{networkManagerName}/networkGroups/{networkGroupName}/listEffectiveVirtualNetworks'} # type: ignore + diff --git a/src/network-manager/azext_network_manager/vendored_sdks/aio/operations/_management_group_network_manager_connections_operations.py b/src/network-manager/azext_network_manager/vendored_sdks/aio/operations/_management_group_network_manager_connections_operations.py new file mode 100644 index 00000000000..f910aba4237 --- /dev/null +++ b/src/network-manager/azext_network_manager/vendored_sdks/aio/operations/_management_group_network_manager_connections_operations.py @@ -0,0 +1,290 @@ +# 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 functools +from typing import Any, AsyncIterable, Callable, Dict, Generic, Optional, TypeVar, Union +import warnings + +from azure.core.async_paging import AsyncItemPaged, AsyncList +from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +from azure.core.pipeline import PipelineResponse +from azure.core.pipeline.transport import AsyncHttpResponse +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace +from azure.core.tracing.decorator_async import distributed_trace_async +from azure.mgmt.core.exceptions import ARMErrorFormat + +from ... import models as _models +from ..._vendor import _convert_request +from ...operations._management_group_network_manager_connections_operations import build_create_or_update_request, build_delete_request, build_get_request, build_list_request +T = TypeVar('T') +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] + +class ManagementGroupNetworkManagerConnectionsOperations: + """ManagementGroupNetworkManagerConnectionsOperations async operations. + + You should not instantiate this class directly. Instead, you should create a Client instance that + instantiates it for you and attaches it as an attribute. + + :ivar models: Alias to model classes used in this operation group. + :type models: ~azure.mgmt.network.v2021_05_01_preview.models + :param client: Client for service requests. + :param config: Configuration of service client. + :param serializer: An object model serializer. + :param deserializer: An object model deserializer. + """ + + models = _models + + def __init__(self, client, config, serializer, deserializer) -> None: + self._client = client + self._serialize = serializer + self._deserialize = deserializer + self._config = config + + @distributed_trace_async + async def create_or_update( + self, + management_group_id: str, + network_manager_connection_name: str, + parameters: "_models.NetworkManagerConnection", + **kwargs: Any + ) -> "_models.NetworkManagerConnection": + """Create a connection to a cross tenant network manager. + + :param management_group_id: The management group Id which uniquely identify the Microsoft Azure + management group. + :type management_group_id: str + :param network_manager_connection_name: Name for the network manager connection. + :type network_manager_connection_name: str + :param parameters: Network manager connection to be created/updated. + :type parameters: ~azure.mgmt.network.v2021_05_01_preview.models.NetworkManagerConnection + :keyword callable cls: A custom type or function that will be passed the direct response + :return: NetworkManagerConnection, or the result of cls(response) + :rtype: ~azure.mgmt.network.v2021_05_01_preview.models.NetworkManagerConnection + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.NetworkManagerConnection"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + + _json = self._serialize.body(parameters, 'NetworkManagerConnection') + + request = build_create_or_update_request( + management_group_id=management_group_id, + network_manager_connection_name=network_manager_connection_name, + content_type=content_type, + json=_json, + template_url=self.create_or_update.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200, 201]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + if response.status_code == 200: + deserialized = self._deserialize('NetworkManagerConnection', pipeline_response) + + if response.status_code == 201: + deserialized = self._deserialize('NetworkManagerConnection', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + create_or_update.metadata = {'url': '/providers/Microsoft.Network/managementGroups/{managementGroupId}/networkManagerConnections/{networkManagerConnectionName}'} # type: ignore + + + @distributed_trace_async + async def get( + self, + management_group_id: str, + network_manager_connection_name: str, + **kwargs: Any + ) -> "_models.NetworkManagerConnection": + """Get a specified connection created by this management group. + + :param management_group_id: The management group Id which uniquely identify the Microsoft Azure + management group. + :type management_group_id: str + :param network_manager_connection_name: Name for the network manager connection. + :type network_manager_connection_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: NetworkManagerConnection, or the result of cls(response) + :rtype: ~azure.mgmt.network.v2021_05_01_preview.models.NetworkManagerConnection + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.NetworkManagerConnection"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + + request = build_get_request( + management_group_id=management_group_id, + network_manager_connection_name=network_manager_connection_name, + template_url=self.get.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = self._deserialize('NetworkManagerConnection', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + get.metadata = {'url': '/providers/Microsoft.Network/managementGroups/{managementGroupId}/networkManagerConnections/{networkManagerConnectionName}'} # type: ignore + + + @distributed_trace_async + async def delete( + self, + management_group_id: str, + network_manager_connection_name: str, + **kwargs: Any + ) -> None: + """Delete specified pending connection created by this management group. + + :param management_group_id: The management group Id which uniquely identify the Microsoft Azure + management group. + :type management_group_id: str + :param network_manager_connection_name: Name for the network manager connection. + :type network_manager_connection_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: None, or the result of cls(response) + :rtype: None + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + + request = build_delete_request( + management_group_id=management_group_id, + network_manager_connection_name=network_manager_connection_name, + template_url=self.delete.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200, 204]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + if cls: + return cls(pipeline_response, None, {}) + + delete.metadata = {'url': '/providers/Microsoft.Network/managementGroups/{managementGroupId}/networkManagerConnections/{networkManagerConnectionName}'} # type: ignore + + + @distributed_trace + def list( + self, + management_group_id: str, + top: Optional[int] = None, + skip_token: Optional[str] = None, + **kwargs: Any + ) -> AsyncIterable["_models.NetworkManagerConnectionListResult"]: + """List all network manager connections created by this management group. + + :param management_group_id: The management group Id which uniquely identify the Microsoft Azure + management group. + :type management_group_id: str + :param top: An optional query parameter which specifies the maximum number of records to be + returned by the server. + :type top: int + :param skip_token: SkipToken is only used if a previous operation returned a partial result. If + a previous response contains a nextLink element, the value of the nextLink element will include + a skipToken parameter that specifies a starting point to use for subsequent calls. + :type skip_token: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either NetworkManagerConnectionListResult or the result + of cls(response) + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.network.v2021_05_01_preview.models.NetworkManagerConnectionListResult] + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.NetworkManagerConnectionListResult"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + def prepare_request(next_link=None): + if not next_link: + + request = build_list_request( + management_group_id=management_group_id, + top=top, + skip_token=skip_token, + template_url=self.list.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + else: + + request = build_list_request( + management_group_id=management_group_id, + top=top, + skip_token=skip_token, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" + return request + + async def extract_data(pipeline_response): + deserialized = self._deserialize("NetworkManagerConnectionListResult", pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) + return deserialized.next_link or None, AsyncList(list_of_elem) + + async def get_next(next_link=None): + request = prepare_request(next_link) + + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + return pipeline_response + + + return AsyncItemPaged( + get_next, extract_data + ) + list.metadata = {'url': '/providers/Microsoft.Network/managementGroups/{managementGroupId}/networkManagerConnections'} # type: ignore diff --git a/src/network-manager/azext_network_manager/vendored_sdks/aio/operations/_network_groups_operations.py b/src/network-manager/azext_network_manager/vendored_sdks/aio/operations/_network_groups_operations.py index 5393f2574ab..c21290fa924 100644 --- a/src/network-manager/azext_network_manager/vendored_sdks/aio/operations/_network_groups_operations.py +++ b/src/network-manager/azext_network_manager/vendored_sdks/aio/operations/_network_groups_operations.py @@ -5,17 +5,22 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import functools from typing import Any, AsyncIterable, Callable, Dict, Generic, Optional, TypeVar, Union import warnings from azure.core.async_paging import AsyncItemPaged, AsyncList from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import AsyncHttpResponse, HttpRequest +from azure.core.pipeline.transport import AsyncHttpResponse +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace +from azure.core.tracing.decorator_async import distributed_trace_async from azure.mgmt.core.exceptions import ARMErrorFormat from ... import models as _models - +from ..._vendor import _convert_request +from ...operations._network_groups_operations import build_create_or_update_request, build_delete_request, build_get_request, build_list_request T = TypeVar('T') ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -26,7 +31,7 @@ class NetworkGroupsOperations: instantiates it for you and attaches it as an attribute. :ivar models: Alias to model classes used in this operation group. - :type models: ~azure.mgmt.network.v2021_02_01_preview.models + :type models: ~azure.mgmt.network.v2021_05_01_preview.models :param client: Client for service requests. :param config: Configuration of service client. :param serializer: An object model serializer. @@ -41,6 +46,7 @@ def __init__(self, client, config, serializer, deserializer) -> None: self._deserialize = deserializer self._config = config + @distributed_trace_async async def get( self, resource_group_name: str, @@ -54,11 +60,11 @@ async def get( :type resource_group_name: str :param network_manager_name: The name of the network manager. :type network_manager_name: str - :param network_group_name: The name of the network group to get. + :param network_group_name: The name of the network group. :type network_group_name: str :keyword callable cls: A custom type or function that will be passed the direct response :return: NetworkGroup, or the result of cls(response) - :rtype: ~azure.mgmt.network.v2021_02_01_preview.models.NetworkGroup + :rtype: ~azure.mgmt.network.v2021_05_01_preview.models.NetworkGroup :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.NetworkGroup"] @@ -66,28 +72,18 @@ async def get( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-02-01-preview" - accept = "application/json" - - # Construct URL - url = self.get.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'networkManagerName': self._serialize.url("network_manager_name", network_manager_name, 'str'), - 'networkGroupName': self._serialize.url("network_group_name", network_group_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_get_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + network_manager_name=network_manager_name, + network_group_name=network_group_name, + template_url=self.get.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.get(url, query_parameters, header_parameters) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -101,8 +97,11 @@ async def get( return cls(pipeline_response, deserialized, {}) return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/networkManagers/{networkManagerName}/networkGroups/{networkGroupName}'} # type: ignore + + @distributed_trace_async async def create_or_update( self, resource_group_name: str, @@ -118,17 +117,17 @@ async def create_or_update( :type resource_group_name: str :param network_manager_name: The name of the network manager. :type network_manager_name: str - :param network_group_name: The name of the network group to get. + :param network_group_name: The name of the network group. :type network_group_name: str :param parameters: Parameters supplied to the specify which network group need to create. - :type parameters: ~azure.mgmt.network.v2021_02_01_preview.models.NetworkGroup + :type parameters: ~azure.mgmt.network.v2021_05_01_preview.models.NetworkGroup :param if_match: The ETag of the transformation. Omit this value to always overwrite the current resource. Specify the last-seen ETag value to prevent accidentally overwriting concurrent changes. :type if_match: str :keyword callable cls: A custom type or function that will be passed the direct response :return: NetworkGroup, or the result of cls(response) - :rtype: ~azure.mgmt.network.v2021_02_01_preview.models.NetworkGroup + :rtype: ~azure.mgmt.network.v2021_05_01_preview.models.NetworkGroup :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.NetworkGroup"] @@ -136,35 +135,24 @@ async def create_or_update( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-02-01-preview" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self.create_or_update.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'networkManagerName': self._serialize.url("network_manager_name", network_manager_name, 'str'), - 'networkGroupName': self._serialize.url("network_group_name", network_group_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - if if_match is not None: - header_parameters['If-Match'] = self._serialize.header("if_match", if_match, 'str') - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(parameters, 'NetworkGroup') - body_content_kwargs['content'] = body_content - request = self._client.put(url, query_parameters, header_parameters, **body_content_kwargs) + + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + + _json = self._serialize.body(parameters, 'NetworkGroup') + + request = build_create_or_update_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + network_manager_name=network_manager_name, + network_group_name=network_group_name, + content_type=content_type, + json=_json, + if_match=if_match, + template_url=self.create_or_update.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -175,23 +163,29 @@ async def create_or_update( response_headers = {} if response.status_code == 200: response_headers['ETag']=self._deserialize('str', response.headers.get('ETag')) + deserialized = self._deserialize('NetworkGroup', pipeline_response) if response.status_code == 201: response_headers['ETag']=self._deserialize('str', response.headers.get('ETag')) + deserialized = self._deserialize('NetworkGroup', pipeline_response) if cls: return cls(pipeline_response, deserialized, response_headers) return deserialized + create_or_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/networkManagers/{networkManagerName}/networkGroups/{networkGroupName}'} # type: ignore + + @distributed_trace_async async def delete( self, resource_group_name: str, network_manager_name: str, network_group_name: str, + force: Optional[bool] = None, **kwargs: Any ) -> None: """Deletes a network group. @@ -200,8 +194,12 @@ async def delete( :type resource_group_name: str :param network_manager_name: The name of the network manager. :type network_manager_name: str - :param network_group_name: The name of the network group to get. + :param network_group_name: The name of the network group. :type network_group_name: str + :param force: Deletes the resource even if it is part of a deployed configuration. If the + configuration has been deployed, the service will do a cleanup deployment in the background, + prior to the delete. + :type force: bool :keyword callable cls: A custom type or function that will be passed the direct response :return: None, or the result of cls(response) :rtype: None @@ -212,28 +210,19 @@ async def delete( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-02-01-preview" - accept = "application/json" - - # Construct URL - url = self.delete.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'networkManagerName': self._serialize.url("network_manager_name", network_manager_name, 'str'), - 'networkGroupName': self._serialize.url("network_group_name", network_group_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_delete_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + network_manager_name=network_manager_name, + network_group_name=network_group_name, + force=force, + template_url=self.delete.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.delete(url, query_parameters, header_parameters) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -246,6 +235,8 @@ async def delete( delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/networkManagers/{networkManagerName}/networkGroups/{networkGroupName}'} # type: ignore + + @distributed_trace def list( self, resource_group_name: str, @@ -268,8 +259,10 @@ def list( a skipToken parameter that specifies a starting point to use for subsequent calls. :type skip_token: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either NetworkGroupListResult or the result of cls(response) - :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.network.v2021_02_01_preview.models.NetworkGroupListResult] + :return: An iterator like instance of either NetworkGroupListResult or the result of + cls(response) + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.network.v2021_05_01_preview.models.NetworkGroupListResult] :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.NetworkGroupListResult"] @@ -277,40 +270,37 @@ def list( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-02-01-preview" - accept = "application/json" - def prepare_request(next_link=None): - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - if not next_link: - # Construct URL - url = self.list.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'networkManagerName': self._serialize.url("network_manager_name", network_manager_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - if top is not None: - query_parameters['$top'] = self._serialize.query("top", top, 'int', maximum=20, minimum=1) - if skip_token is not None: - query_parameters['$skipToken'] = self._serialize.query("skip_token", skip_token, 'str') - - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + network_manager_name=network_manager_name, + top=top, + skip_token=skip_token, + template_url=self.list.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + network_manager_name=network_manager_name, + top=top, + skip_token=skip_token, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request async def extract_data(pipeline_response): - deserialized = self._deserialize('NetworkGroupListResult', pipeline_response) + deserialized = self._deserialize("NetworkGroupListResult", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -328,6 +318,7 @@ async def get_next(next_link=None): return pipeline_response + return AsyncItemPaged( get_next, extract_data ) diff --git a/src/network-manager/azext_network_manager/vendored_sdks/aio/operations/_network_management_client_operations.py b/src/network-manager/azext_network_manager/vendored_sdks/aio/operations/_network_management_client_operations.py new file mode 100644 index 00000000000..150c50b0f3d --- /dev/null +++ b/src/network-manager/azext_network_manager/vendored_sdks/aio/operations/_network_management_client_operations.py @@ -0,0 +1,324 @@ +# 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 functools +from typing import Any, Callable, Dict, Generic, Optional, TypeVar +import warnings + +from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +from azure.core.pipeline import PipelineResponse +from azure.core.pipeline.transport import AsyncHttpResponse +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator_async import distributed_trace_async +from azure.mgmt.core.exceptions import ARMErrorFormat + +from ... import models as _models +from ..._vendor import _convert_request +from ...operations._network_management_client_operations import build_list_active_connectivity_configurations_request, build_list_active_security_admin_rules_request, build_list_active_security_user_rules_request, build_list_network_manager_effective_connectivity_configurations_request, build_list_network_manager_effective_security_admin_rules_request +T = TypeVar('T') +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] + +class NetworkManagementClientOperationsMixin: + + @distributed_trace_async + async def list_active_connectivity_configurations( + self, + resource_group_name: str, + network_manager_name: str, + parameters: "_models.ActiveConfigurationParameter", + **kwargs: Any + ) -> "_models.ActiveConnectivityConfigurationsListResult": + """Lists active connectivity configurations in a network manager. + + :param resource_group_name: The name of the resource group. + :type resource_group_name: str + :param network_manager_name: The name of the network manager. + :type network_manager_name: str + :param parameters: Active Configuration Parameter. + :type parameters: ~azure.mgmt.network.v2021_05_01_preview.models.ActiveConfigurationParameter + :keyword callable cls: A custom type or function that will be passed the direct response + :return: ActiveConnectivityConfigurationsListResult, or the result of cls(response) + :rtype: + ~azure.mgmt.network.v2021_05_01_preview.models.ActiveConnectivityConfigurationsListResult + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.ActiveConnectivityConfigurationsListResult"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + + _json = self._serialize.body(parameters, 'ActiveConfigurationParameter') + + request = build_list_active_connectivity_configurations_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + network_manager_name=network_manager_name, + content_type=content_type, + json=_json, + template_url=self.list_active_connectivity_configurations.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = self._deserialize('ActiveConnectivityConfigurationsListResult', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + list_active_connectivity_configurations.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/networkManagers/{networkManagerName}/listActiveConnectivityConfigurations'} # type: ignore + + + @distributed_trace_async + async def list_active_security_admin_rules( + self, + resource_group_name: str, + network_manager_name: str, + parameters: "_models.ActiveConfigurationParameter", + **kwargs: Any + ) -> "_models.ActiveSecurityAdminRulesListResult": + """Lists active security admin rules in a network manager. + + :param resource_group_name: The name of the resource group. + :type resource_group_name: str + :param network_manager_name: The name of the network manager. + :type network_manager_name: str + :param parameters: Active Configuration Parameter. + :type parameters: ~azure.mgmt.network.v2021_05_01_preview.models.ActiveConfigurationParameter + :keyword callable cls: A custom type or function that will be passed the direct response + :return: ActiveSecurityAdminRulesListResult, or the result of cls(response) + :rtype: ~azure.mgmt.network.v2021_05_01_preview.models.ActiveSecurityAdminRulesListResult + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.ActiveSecurityAdminRulesListResult"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + + _json = self._serialize.body(parameters, 'ActiveConfigurationParameter') + + request = build_list_active_security_admin_rules_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + network_manager_name=network_manager_name, + content_type=content_type, + json=_json, + template_url=self.list_active_security_admin_rules.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = self._deserialize('ActiveSecurityAdminRulesListResult', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + list_active_security_admin_rules.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/networkManagers/{networkManagerName}/listActiveSecurityAdminRules'} # type: ignore + + + @distributed_trace_async + async def list_active_security_user_rules( + self, + resource_group_name: str, + network_manager_name: str, + parameters: "_models.ActiveConfigurationParameter", + **kwargs: Any + ) -> "_models.ActiveSecurityUserRulesListResult": + """Lists Active Security User Rules in a network manager. + + :param resource_group_name: The name of the resource group. + :type resource_group_name: str + :param network_manager_name: The name of the network manager. + :type network_manager_name: str + :param parameters: Active Configuration Parameter. + :type parameters: ~azure.mgmt.network.v2021_05_01_preview.models.ActiveConfigurationParameter + :keyword callable cls: A custom type or function that will be passed the direct response + :return: ActiveSecurityUserRulesListResult, or the result of cls(response) + :rtype: ~azure.mgmt.network.v2021_05_01_preview.models.ActiveSecurityUserRulesListResult + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.ActiveSecurityUserRulesListResult"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + + _json = self._serialize.body(parameters, 'ActiveConfigurationParameter') + + request = build_list_active_security_user_rules_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + network_manager_name=network_manager_name, + content_type=content_type, + json=_json, + template_url=self.list_active_security_user_rules.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = self._deserialize('ActiveSecurityUserRulesListResult', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + list_active_security_user_rules.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/networkManagers/{networkManagerName}/listActiveSecurityUserRules'} # type: ignore + + + @distributed_trace_async + async def list_network_manager_effective_connectivity_configurations( + self, + resource_group_name: str, + virtual_network_name: str, + parameters: "_models.QueryRequestOptions", + **kwargs: Any + ) -> "_models.NetworkManagerEffectiveConnectivityConfigurationListResult": + """List all effective connectivity configurations applied on a virtual network. + + :param resource_group_name: The name of the resource group. + :type resource_group_name: str + :param virtual_network_name: The name of the virtual network. + :type virtual_network_name: str + :param parameters: Parameters supplied to list correct page. + :type parameters: ~azure.mgmt.network.v2021_05_01_preview.models.QueryRequestOptions + :keyword callable cls: A custom type or function that will be passed the direct response + :return: NetworkManagerEffectiveConnectivityConfigurationListResult, or the result of + cls(response) + :rtype: + ~azure.mgmt.network.v2021_05_01_preview.models.NetworkManagerEffectiveConnectivityConfigurationListResult + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.NetworkManagerEffectiveConnectivityConfigurationListResult"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + + _json = self._serialize.body(parameters, 'QueryRequestOptions') + + request = build_list_network_manager_effective_connectivity_configurations_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + virtual_network_name=virtual_network_name, + content_type=content_type, + json=_json, + template_url=self.list_network_manager_effective_connectivity_configurations.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = self._deserialize('NetworkManagerEffectiveConnectivityConfigurationListResult', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + list_network_manager_effective_connectivity_configurations.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/virtualNetworks/{virtualNetworkName}/listNetworkManagerEffectiveConnectivityConfigurations'} # type: ignore + + + @distributed_trace_async + async def list_network_manager_effective_security_admin_rules( + self, + resource_group_name: str, + virtual_network_name: str, + parameters: "_models.QueryRequestOptions", + **kwargs: Any + ) -> "_models.NetworkManagerEffectiveSecurityAdminRulesListResult": + """List all effective security admin rules applied on a virtual network. + + :param resource_group_name: The name of the resource group. + :type resource_group_name: str + :param virtual_network_name: The name of the virtual network. + :type virtual_network_name: str + :param parameters: Parameters supplied to list correct page. + :type parameters: ~azure.mgmt.network.v2021_05_01_preview.models.QueryRequestOptions + :keyword callable cls: A custom type or function that will be passed the direct response + :return: NetworkManagerEffectiveSecurityAdminRulesListResult, or the result of cls(response) + :rtype: + ~azure.mgmt.network.v2021_05_01_preview.models.NetworkManagerEffectiveSecurityAdminRulesListResult + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.NetworkManagerEffectiveSecurityAdminRulesListResult"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + + _json = self._serialize.body(parameters, 'QueryRequestOptions') + + request = build_list_network_manager_effective_security_admin_rules_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + virtual_network_name=virtual_network_name, + content_type=content_type, + json=_json, + template_url=self.list_network_manager_effective_security_admin_rules.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = self._deserialize('NetworkManagerEffectiveSecurityAdminRulesListResult', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + list_network_manager_effective_security_admin_rules.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/virtualNetworks/{virtualNetworkName}/listNetworkManagerEffectiveSecurityAdminRules'} # type: ignore + diff --git a/src/network-manager/azext_network_manager/vendored_sdks/aio/operations/_network_manager_commits_operations.py b/src/network-manager/azext_network_manager/vendored_sdks/aio/operations/_network_manager_commits_operations.py index edb5e278cd4..6ec2550c6cb 100644 --- a/src/network-manager/azext_network_manager/vendored_sdks/aio/operations/_network_manager_commits_operations.py +++ b/src/network-manager/azext_network_manager/vendored_sdks/aio/operations/_network_manager_commits_operations.py @@ -5,16 +5,20 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import functools from typing import Any, Callable, Dict, Generic, Optional, TypeVar import warnings from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import AsyncHttpResponse, HttpRequest +from azure.core.pipeline.transport import AsyncHttpResponse +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator_async import distributed_trace_async from azure.mgmt.core.exceptions import ARMErrorFormat from ... import models as _models - +from ..._vendor import _convert_request +from ...operations._network_manager_commits_operations import build_post_request T = TypeVar('T') ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -25,7 +29,7 @@ class NetworkManagerCommitsOperations: instantiates it for you and attaches it as an attribute. :ivar models: Alias to model classes used in this operation group. - :type models: ~azure.mgmt.network.v2021_02_01_preview.models + :type models: ~azure.mgmt.network.v2021_05_01_preview.models :param client: Client for service requests. :param config: Configuration of service client. :param serializer: An object model serializer. @@ -40,6 +44,7 @@ def __init__(self, client, config, serializer, deserializer) -> None: self._deserialize = deserializer self._config = config + @distributed_trace_async async def post( self, resource_group_name: str, @@ -54,10 +59,10 @@ async def post( :param network_manager_name: The name of the network manager. :type network_manager_name: str :param parameters: Parameters supplied to specify which Managed Network commit is. - :type parameters: ~azure.mgmt.network.v2021_02_01_preview.models.NetworkManagerCommit + :type parameters: ~azure.mgmt.network.v2021_05_01_preview.models.NetworkManagerCommit :keyword callable cls: A custom type or function that will be passed the direct response :return: NetworkManagerCommit, or the result of cls(response) - :rtype: ~azure.mgmt.network.v2021_02_01_preview.models.NetworkManagerCommit + :rtype: ~azure.mgmt.network.v2021_05_01_preview.models.NetworkManagerCommit :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.NetworkManagerCommit"] @@ -65,32 +70,22 @@ async def post( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-02-01-preview" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self.post.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'networkManagerName': self._serialize.url("network_manager_name", network_manager_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + + _json = self._serialize.body(parameters, 'NetworkManagerCommit') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + request = build_post_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + network_manager_name=network_manager_name, + content_type=content_type, + json=_json, + template_url=self.post.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(parameters, 'NetworkManagerCommit') - body_content_kwargs['content'] = body_content - request = self._client.post(url, query_parameters, header_parameters, **body_content_kwargs) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -104,4 +99,6 @@ async def post( return cls(pipeline_response, deserialized, {}) return deserialized + post.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/networkManagers/{networkManagerName}/commit'} # type: ignore + diff --git a/src/network-manager/azext_network_manager/vendored_sdks/aio/operations/_network_manager_deployment_status_operations.py b/src/network-manager/azext_network_manager/vendored_sdks/aio/operations/_network_manager_deployment_status_operations.py index 217199348e4..982deff010e 100644 --- a/src/network-manager/azext_network_manager/vendored_sdks/aio/operations/_network_manager_deployment_status_operations.py +++ b/src/network-manager/azext_network_manager/vendored_sdks/aio/operations/_network_manager_deployment_status_operations.py @@ -5,16 +5,20 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import functools from typing import Any, Callable, Dict, Generic, Optional, TypeVar import warnings from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import AsyncHttpResponse, HttpRequest +from azure.core.pipeline.transport import AsyncHttpResponse +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator_async import distributed_trace_async from azure.mgmt.core.exceptions import ARMErrorFormat from ... import models as _models - +from ..._vendor import _convert_request +from ...operations._network_manager_deployment_status_operations import build_list_request T = TypeVar('T') ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -25,7 +29,7 @@ class NetworkManagerDeploymentStatusOperations: instantiates it for you and attaches it as an attribute. :ivar models: Alias to model classes used in this operation group. - :type models: ~azure.mgmt.network.v2021_02_01_preview.models + :type models: ~azure.mgmt.network.v2021_05_01_preview.models :param client: Client for service requests. :param config: Configuration of service client. :param serializer: An object model serializer. @@ -40,6 +44,7 @@ def __init__(self, client, config, serializer, deserializer) -> None: self._deserialize = deserializer self._config = config + @distributed_trace_async async def list( self, resource_group_name: str, @@ -54,10 +59,11 @@ async def list( :param network_manager_name: The name of the network manager. :type network_manager_name: str :param parameters: Parameters supplied to specify which Managed Network deployment status is. - :type parameters: ~azure.mgmt.network.v2021_02_01_preview.models.NetworkManagerDeploymentStatusParameter + :type parameters: + ~azure.mgmt.network.v2021_05_01_preview.models.NetworkManagerDeploymentStatusParameter :keyword callable cls: A custom type or function that will be passed the direct response :return: NetworkManagerDeploymentStatusListResult, or the result of cls(response) - :rtype: ~azure.mgmt.network.v2021_02_01_preview.models.NetworkManagerDeploymentStatusListResult + :rtype: ~azure.mgmt.network.v2021_05_01_preview.models.NetworkManagerDeploymentStatusListResult :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.NetworkManagerDeploymentStatusListResult"] @@ -65,32 +71,22 @@ async def list( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-02-01-preview" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self.list.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'networkManagerName': self._serialize.url("network_manager_name", network_manager_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + + _json = self._serialize.body(parameters, 'NetworkManagerDeploymentStatusParameter') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + request = build_list_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + network_manager_name=network_manager_name, + content_type=content_type, + json=_json, + template_url=self.list.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(parameters, 'NetworkManagerDeploymentStatusParameter') - body_content_kwargs['content'] = body_content - request = self._client.post(url, query_parameters, header_parameters, **body_content_kwargs) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -104,4 +100,6 @@ async def list( return cls(pipeline_response, deserialized, {}) return deserialized + list.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/networkManagers/{networkManagerName}/listDeploymentStatus'} # type: ignore + diff --git a/src/network-manager/azext_network_manager/vendored_sdks/aio/operations/_network_manager_effective_security_admin_rules_operations.py b/src/network-manager/azext_network_manager/vendored_sdks/aio/operations/_network_manager_effective_security_admin_rules_operations.py deleted file mode 100644 index 0d2ea772371..00000000000 --- a/src/network-manager/azext_network_manager/vendored_sdks/aio/operations/_network_manager_effective_security_admin_rules_operations.py +++ /dev/null @@ -1,107 +0,0 @@ -# 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 typing import Any, Callable, Dict, Generic, Optional, TypeVar -import warnings - -from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error -from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import AsyncHttpResponse, HttpRequest -from azure.mgmt.core.exceptions import ARMErrorFormat - -from ... import models as _models - -T = TypeVar('T') -ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] - -class NetworkManagerEffectiveSecurityAdminRulesOperations: - """NetworkManagerEffectiveSecurityAdminRulesOperations async operations. - - You should not instantiate this class directly. Instead, you should create a Client instance that - instantiates it for you and attaches it as an attribute. - - :ivar models: Alias to model classes used in this operation group. - :type models: ~azure.mgmt.network.v2021_02_01_preview.models - :param client: Client for service requests. - :param config: Configuration of service client. - :param serializer: An object model serializer. - :param deserializer: An object model deserializer. - """ - - models = _models - - def __init__(self, client, config, serializer, deserializer) -> None: - self._client = client - self._serialize = serializer - self._deserialize = deserializer - self._config = config - - async def list( - self, - resource_group_name: str, - virtual_network_name: str, - parameters: "_models.QueryRequestOptions", - **kwargs: Any - ) -> "_models.NetworkManagerEffectiveSecurityAdminRulesListResult": - """List all effective security admin rules applied on a virtual network. - - :param resource_group_name: The name of the resource group. - :type resource_group_name: str - :param virtual_network_name: The name of the virtual network. - :type virtual_network_name: str - :param parameters: Parameters supplied to list correct page. - :type parameters: ~azure.mgmt.network.v2021_02_01_preview.models.QueryRequestOptions - :keyword callable cls: A custom type or function that will be passed the direct response - :return: NetworkManagerEffectiveSecurityAdminRulesListResult, or the result of cls(response) - :rtype: ~azure.mgmt.network.v2021_02_01_preview.models.NetworkManagerEffectiveSecurityAdminRulesListResult - :raises: ~azure.core.exceptions.HttpResponseError - """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.NetworkManagerEffectiveSecurityAdminRulesListResult"] - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-02-01-preview" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self.list.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'virtualNetworkName': self._serialize.url("virtual_network_name", virtual_network_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(parameters, 'QueryRequestOptions') - body_content_kwargs['content'] = body_content - request = self._client.post(url, query_parameters, header_parameters, **body_content_kwargs) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - deserialized = self._deserialize('NetworkManagerEffectiveSecurityAdminRulesListResult', pipeline_response) - - if cls: - return cls(pipeline_response, deserialized, {}) - - return deserialized - list.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/virtualNetworks/{virtualNetworkName}/listNetworkManagerEffectiveSecurityAdminRules'} # type: ignore diff --git a/src/network-manager/azext_network_manager/vendored_sdks/aio/operations/_network_managers_operations.py b/src/network-manager/azext_network_manager/vendored_sdks/aio/operations/_network_managers_operations.py index 922ec5fdb52..a8efb1a914c 100644 --- a/src/network-manager/azext_network_manager/vendored_sdks/aio/operations/_network_managers_operations.py +++ b/src/network-manager/azext_network_manager/vendored_sdks/aio/operations/_network_managers_operations.py @@ -5,17 +5,22 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import functools from typing import Any, AsyncIterable, Callable, Dict, Generic, Optional, TypeVar, Union import warnings from azure.core.async_paging import AsyncItemPaged, AsyncList from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import AsyncHttpResponse, HttpRequest +from azure.core.pipeline.transport import AsyncHttpResponse +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace +from azure.core.tracing.decorator_async import distributed_trace_async from azure.mgmt.core.exceptions import ARMErrorFormat from ... import models as _models - +from ..._vendor import _convert_request +from ...operations._network_managers_operations import build_create_or_update_request, build_delete_request, build_get_request, build_list_by_subscription_request, build_list_request, build_patch_request T = TypeVar('T') ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -26,7 +31,7 @@ class NetworkManagersOperations: instantiates it for you and attaches it as an attribute. :ivar models: Alias to model classes used in this operation group. - :type models: ~azure.mgmt.network.v2021_02_01_preview.models + :type models: ~azure.mgmt.network.v2021_05_01_preview.models :param client: Client for service requests. :param config: Configuration of service client. :param serializer: An object model serializer. @@ -41,6 +46,7 @@ def __init__(self, client, config, serializer, deserializer) -> None: self._deserialize = deserializer self._config = config + @distributed_trace_async async def get( self, resource_group_name: str, @@ -55,7 +61,7 @@ async def get( :type network_manager_name: str :keyword callable cls: A custom type or function that will be passed the direct response :return: NetworkManager, or the result of cls(response) - :rtype: ~azure.mgmt.network.v2021_02_01_preview.models.NetworkManager + :rtype: ~azure.mgmt.network.v2021_05_01_preview.models.NetworkManager :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.NetworkManager"] @@ -63,27 +69,17 @@ async def get( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-02-01-preview" - accept = "application/json" - - # Construct URL - url = self.get.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'networkManagerName': self._serialize.url("network_manager_name", network_manager_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_get_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + network_manager_name=network_manager_name, + template_url=self.get.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.get(url, query_parameters, header_parameters) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -97,8 +93,11 @@ async def get( return cls(pipeline_response, deserialized, {}) return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/networkManagers/{networkManagerName}'} # type: ignore + + @distributed_trace_async async def create_or_update( self, resource_group_name: str, @@ -113,10 +112,10 @@ async def create_or_update( :param network_manager_name: The name of the network manager. :type network_manager_name: str :param parameters: Parameters supplied to specify which network manager is. - :type parameters: ~azure.mgmt.network.v2021_02_01_preview.models.NetworkManager + :type parameters: ~azure.mgmt.network.v2021_05_01_preview.models.NetworkManager :keyword callable cls: A custom type or function that will be passed the direct response :return: NetworkManager, or the result of cls(response) - :rtype: ~azure.mgmt.network.v2021_02_01_preview.models.NetworkManager + :rtype: ~azure.mgmt.network.v2021_05_01_preview.models.NetworkManager :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.NetworkManager"] @@ -124,32 +123,22 @@ async def create_or_update( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-02-01-preview" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self.create_or_update.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'networkManagerName': self._serialize.url("network_manager_name", network_manager_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + _json = self._serialize.body(parameters, 'NetworkManager') + + request = build_create_or_update_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + network_manager_name=network_manager_name, + content_type=content_type, + json=_json, + template_url=self.create_or_update.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(parameters, 'NetworkManager') - body_content_kwargs['content'] = body_content - request = self._client.put(url, query_parameters, header_parameters, **body_content_kwargs) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -167,12 +156,17 @@ async def create_or_update( return cls(pipeline_response, deserialized, {}) return deserialized + create_or_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/networkManagers/{networkManagerName}'} # type: ignore + + @distributed_trace_async async def delete( self, resource_group_name: str, network_manager_name: str, + force: Optional[bool] = None, + recursive: Optional[bool] = None, **kwargs: Any ) -> None: """Deletes a network manager. @@ -181,6 +175,14 @@ async def delete( :type resource_group_name: str :param network_manager_name: The name of the network manager. :type network_manager_name: str + :param force: Deletes the resource even if it is part of a deployed configuration. If the + configuration has been deployed, the service will do a cleanup deployment in the background, + prior to the delete. + :type force: bool + :param recursive: Deletes the resource recursively. When present in a security configuration + delete, all rule collections and rules within the configuration will be deleted. When present + in a rule collection delete, all rules within the collection will be deleted. + :type recursive: bool :keyword callable cls: A custom type or function that will be passed the direct response :return: None, or the result of cls(response) :rtype: None @@ -191,27 +193,19 @@ async def delete( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-02-01-preview" - accept = "application/json" - - # Construct URL - url = self.delete.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'networkManagerName': self._serialize.url("network_manager_name", network_manager_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_delete_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + network_manager_name=network_manager_name, + force=force, + recursive=recursive, + template_url=self.delete.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.delete(url, query_parameters, header_parameters) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -224,24 +218,26 @@ async def delete( delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/networkManagers/{networkManagerName}'} # type: ignore - async def patch_tags( + + @distributed_trace_async + async def patch( self, resource_group_name: str, network_manager_name: str, - parameters: "_models.TagsObject", + parameters: "_models.PatchObject", **kwargs: Any ) -> "_models.NetworkManager": - """Patch a NetworkManager Tags. + """Patch NetworkManager. :param resource_group_name: The name of the resource group. :type resource_group_name: str :param network_manager_name: The name of the network manager. :type network_manager_name: str - :param parameters: Parameters supplied to update network manager tags. - :type parameters: ~azure.mgmt.network.v2021_02_01_preview.models.TagsObject + :param parameters: Parameters supplied to specify which network manager is. + :type parameters: ~azure.mgmt.network.v2021_05_01_preview.models.PatchObject :keyword callable cls: A custom type or function that will be passed the direct response :return: NetworkManager, or the result of cls(response) - :rtype: ~azure.mgmt.network.v2021_02_01_preview.models.NetworkManager + :rtype: ~azure.mgmt.network.v2021_05_01_preview.models.NetworkManager :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.NetworkManager"] @@ -249,32 +245,22 @@ async def patch_tags( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-02-01-preview" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self.patch_tags.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'networkManagerName': self._serialize.url("network_manager_name", network_manager_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + _json = self._serialize.body(parameters, 'PatchObject') + + request = build_patch_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + network_manager_name=network_manager_name, + content_type=content_type, + json=_json, + template_url=self.patch.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(parameters, 'TagsObject') - body_content_kwargs['content'] = body_content - request = self._client.patch(url, query_parameters, header_parameters, **body_content_kwargs) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -288,8 +274,11 @@ async def patch_tags( return cls(pipeline_response, deserialized, {}) return deserialized - patch_tags.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/networkManagers/{networkManagerName}'} # type: ignore + patch.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/networkManagers/{networkManagerName}'} # type: ignore + + + @distributed_trace def list_by_subscription( self, top: Optional[int] = None, @@ -306,8 +295,10 @@ def list_by_subscription( a skipToken parameter that specifies a starting point to use for subsequent calls. :type skip_token: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either NetworkManagerListResult or the result of cls(response) - :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.network.v2021_02_01_preview.models.NetworkManagerListResult] + :return: An iterator like instance of either NetworkManagerListResult or the result of + cls(response) + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.network.v2021_05_01_preview.models.NetworkManagerListResult] :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.NetworkManagerListResult"] @@ -315,38 +306,33 @@ def list_by_subscription( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-02-01-preview" - accept = "application/json" - def prepare_request(next_link=None): - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - if not next_link: - # Construct URL - url = self.list_by_subscription.metadata['url'] # type: ignore - 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 = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - if top is not None: - query_parameters['$top'] = self._serialize.query("top", top, 'int', maximum=20, minimum=1) - if skip_token is not None: - query_parameters['$skipToken'] = self._serialize.query("skip_token", skip_token, 'str') - - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_by_subscription_request( + subscription_id=self._config.subscription_id, + top=top, + skip_token=skip_token, + template_url=self.list_by_subscription.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_by_subscription_request( + subscription_id=self._config.subscription_id, + top=top, + skip_token=skip_token, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request async def extract_data(pipeline_response): - deserialized = self._deserialize('NetworkManagerListResult', pipeline_response) + deserialized = self._deserialize("NetworkManagerListResult", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -364,11 +350,13 @@ async def get_next(next_link=None): return pipeline_response + return AsyncItemPaged( get_next, extract_data ) list_by_subscription.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.Network/networkManagers'} # type: ignore + @distributed_trace def list( self, resource_group_name: str, @@ -388,8 +376,10 @@ def list( a skipToken parameter that specifies a starting point to use for subsequent calls. :type skip_token: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either NetworkManagerListResult or the result of cls(response) - :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.network.v2021_02_01_preview.models.NetworkManagerListResult] + :return: An iterator like instance of either NetworkManagerListResult or the result of + cls(response) + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.network.v2021_05_01_preview.models.NetworkManagerListResult] :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.NetworkManagerListResult"] @@ -397,39 +387,35 @@ def list( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-02-01-preview" - accept = "application/json" - def prepare_request(next_link=None): - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - if not next_link: - # Construct URL - url = self.list.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - if top is not None: - query_parameters['$top'] = self._serialize.query("top", top, 'int', maximum=20, minimum=1) - if skip_token is not None: - query_parameters['$skipToken'] = self._serialize.query("skip_token", skip_token, 'str') - - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + top=top, + skip_token=skip_token, + template_url=self.list.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + top=top, + skip_token=skip_token, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request async def extract_data(pipeline_response): - deserialized = self._deserialize('NetworkManagerListResult', pipeline_response) + deserialized = self._deserialize("NetworkManagerListResult", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -447,6 +433,7 @@ async def get_next(next_link=None): return pipeline_response + return AsyncItemPaged( get_next, extract_data ) diff --git a/src/network-manager/azext_network_manager/vendored_sdks/aio/operations/_network_security_perimeters_operations.py b/src/network-manager/azext_network_manager/vendored_sdks/aio/operations/_network_security_perimeters_operations.py deleted file mode 100644 index e848ca499c6..00000000000 --- a/src/network-manager/azext_network_manager/vendored_sdks/aio/operations/_network_security_perimeters_operations.py +++ /dev/null @@ -1,387 +0,0 @@ -# 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 typing import Any, AsyncIterable, Callable, Dict, Generic, Optional, TypeVar, Union -import warnings - -from azure.core.async_paging import AsyncItemPaged, AsyncList -from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error -from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import AsyncHttpResponse, HttpRequest -from azure.mgmt.core.exceptions import ARMErrorFormat - -from ... import models as _models - -T = TypeVar('T') -ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] - -class NetworkSecurityPerimetersOperations: - """NetworkSecurityPerimetersOperations async operations. - - You should not instantiate this class directly. Instead, you should create a Client instance that - instantiates it for you and attaches it as an attribute. - - :ivar models: Alias to model classes used in this operation group. - :type models: ~azure.mgmt.network.v2021_02_01_preview.models - :param client: Client for service requests. - :param config: Configuration of service client. - :param serializer: An object model serializer. - :param deserializer: An object model deserializer. - """ - - models = _models - - def __init__(self, client, config, serializer, deserializer) -> None: - self._client = client - self._serialize = serializer - self._deserialize = deserializer - self._config = config - - async def get( - self, - resource_group_name: str, - network_security_perimeter_name: str, - **kwargs: Any - ) -> "_models.NetworkSecurityPerimeter": - """Gets the specified network security perimeter by the name. - - :param resource_group_name: The name of the resource group. - :type resource_group_name: str - :param network_security_perimeter_name: The name of the network security perimeter. - :type network_security_perimeter_name: str - :keyword callable cls: A custom type or function that will be passed the direct response - :return: NetworkSecurityPerimeter, or the result of cls(response) - :rtype: ~azure.mgmt.network.v2021_02_01_preview.models.NetworkSecurityPerimeter - :raises: ~azure.core.exceptions.HttpResponseError - """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.NetworkSecurityPerimeter"] - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-02-01-preview" - accept = "application/json" - - # Construct URL - url = self.get.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'networkSecurityPerimeterName': self._serialize.url("network_security_perimeter_name", network_security_perimeter_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - - request = self._client.get(url, query_parameters, header_parameters) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - deserialized = self._deserialize('NetworkSecurityPerimeter', pipeline_response) - - if cls: - return cls(pipeline_response, deserialized, {}) - - return deserialized - get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/networkSecurityPerimeters/{networkSecurityPerimeterName}'} # type: ignore - - async def create_or_update( - self, - resource_group_name: str, - network_security_perimeter_name: str, - parameters: "_models.NetworkSecurityPerimeter", - **kwargs: Any - ) -> "_models.NetworkSecurityPerimeter": - """Creates or updates a Network Security Perimeter. - - :param resource_group_name: The name of the resource group. - :type resource_group_name: str - :param network_security_perimeter_name: The name of the network security perimeter. - :type network_security_perimeter_name: str - :param parameters: Parameter supplied to create or update the network security perimeter. - :type parameters: ~azure.mgmt.network.v2021_02_01_preview.models.NetworkSecurityPerimeter - :keyword callable cls: A custom type or function that will be passed the direct response - :return: NetworkSecurityPerimeter, or the result of cls(response) - :rtype: ~azure.mgmt.network.v2021_02_01_preview.models.NetworkSecurityPerimeter - :raises: ~azure.core.exceptions.HttpResponseError - """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.NetworkSecurityPerimeter"] - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-02-01-preview" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self.create_or_update.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'networkSecurityPerimeterName': self._serialize.url("network_security_perimeter_name", network_security_perimeter_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(parameters, 'NetworkSecurityPerimeter') - body_content_kwargs['content'] = body_content - request = self._client.put(url, query_parameters, header_parameters, **body_content_kwargs) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) - response = pipeline_response.http_response - - if response.status_code not in [200, 201]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - if response.status_code == 200: - deserialized = self._deserialize('NetworkSecurityPerimeter', pipeline_response) - - if response.status_code == 201: - deserialized = self._deserialize('NetworkSecurityPerimeter', pipeline_response) - - if cls: - return cls(pipeline_response, deserialized, {}) - - return deserialized - create_or_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/networkSecurityPerimeters/{networkSecurityPerimeterName}'} # type: ignore - - async def delete( - self, - resource_group_name: str, - network_security_perimeter_name: str, - **kwargs: Any - ) -> None: - """Deletes a network security perimeter. - - :param resource_group_name: The name of the resource group. - :type resource_group_name: str - :param network_security_perimeter_name: The name of the network security perimeter. - :type network_security_perimeter_name: str - :keyword callable cls: A custom type or function that will be passed the direct response - :return: None, or the result of cls(response) - :rtype: None - :raises: ~azure.core.exceptions.HttpResponseError - """ - cls = kwargs.pop('cls', None) # type: ClsType[None] - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-02-01-preview" - accept = "application/json" - - # Construct URL - url = self.delete.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'networkSecurityPerimeterName': self._serialize.url("network_security_perimeter_name", network_security_perimeter_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - - request = self._client.delete(url, query_parameters, header_parameters) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) - response = pipeline_response.http_response - - if response.status_code not in [200, 204]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - if cls: - return cls(pipeline_response, None, {}) - - delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/networkSecurityPerimeters/{networkSecurityPerimeterName}'} # type: ignore - - def list_by_subscription( - self, - top: Optional[int] = None, - skip_token: Optional[str] = None, - **kwargs: Any - ) -> AsyncIterable["_models.NetworkSecurityPerimeterListResult"]: - """List all network security perimeters in a subscription. - - :param top: An optional query parameter which specifies the maximum number of records to be - returned by the server. - :type top: int - :param skip_token: SkipToken is only used if a previous operation returned a partial result. If - a previous response contains a nextLink element, the value of the nextLink element will include - a skipToken parameter that specifies a starting point to use for subsequent calls. - :type skip_token: str - :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either NetworkSecurityPerimeterListResult or the result of cls(response) - :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.network.v2021_02_01_preview.models.NetworkSecurityPerimeterListResult] - :raises: ~azure.core.exceptions.HttpResponseError - """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.NetworkSecurityPerimeterListResult"] - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-02-01-preview" - accept = "application/json" - - def prepare_request(next_link=None): - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - - if not next_link: - # Construct URL - url = self.list_by_subscription.metadata['url'] # type: ignore - 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 = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - if top is not None: - query_parameters['$top'] = self._serialize.query("top", top, 'int', maximum=20, minimum=1) - if skip_token is not None: - query_parameters['$skipToken'] = self._serialize.query("skip_token", skip_token, 'str') - - request = self._client.get(url, query_parameters, header_parameters) - else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) - return request - - async def extract_data(pipeline_response): - deserialized = self._deserialize('NetworkSecurityPerimeterListResult', pipeline_response) - list_of_elem = deserialized.value - if cls: - list_of_elem = cls(list_of_elem) - return deserialized.next_link or None, AsyncList(list_of_elem) - - async def get_next(next_link=None): - request = prepare_request(next_link) - - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - return pipeline_response - - return AsyncItemPaged( - get_next, extract_data - ) - list_by_subscription.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.Network/networkSecurityPerimeters'} # type: ignore - - def list( - self, - resource_group_name: str, - top: Optional[int] = None, - skip_token: Optional[str] = None, - **kwargs: Any - ) -> AsyncIterable["_models.NetworkSecurityPerimeterListResult"]: - """List network security perimeters in a resource group. - - :param resource_group_name: The name of the resource group. - :type resource_group_name: str - :param top: An optional query parameter which specifies the maximum number of records to be - returned by the server. - :type top: int - :param skip_token: SkipToken is only used if a previous operation returned a partial result. If - a previous response contains a nextLink element, the value of the nextLink element will include - a skipToken parameter that specifies a starting point to use for subsequent calls. - :type skip_token: str - :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either NetworkSecurityPerimeterListResult or the result of cls(response) - :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.network.v2021_02_01_preview.models.NetworkSecurityPerimeterListResult] - :raises: ~azure.core.exceptions.HttpResponseError - """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.NetworkSecurityPerimeterListResult"] - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-02-01-preview" - accept = "application/json" - - def prepare_request(next_link=None): - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - - if not next_link: - # Construct URL - url = self.list.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - if top is not None: - query_parameters['$top'] = self._serialize.query("top", top, 'int', maximum=20, minimum=1) - if skip_token is not None: - query_parameters['$skipToken'] = self._serialize.query("skip_token", skip_token, 'str') - - request = self._client.get(url, query_parameters, header_parameters) - else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) - return request - - async def extract_data(pipeline_response): - deserialized = self._deserialize('NetworkSecurityPerimeterListResult', pipeline_response) - list_of_elem = deserialized.value - if cls: - list_of_elem = cls(list_of_elem) - return deserialized.next_link or None, AsyncList(list_of_elem) - - async def get_next(next_link=None): - request = prepare_request(next_link) - - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - return pipeline_response - - return AsyncItemPaged( - get_next, extract_data - ) - list.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/networkSecurityPerimeters'} # type: ignore diff --git a/src/network-manager/azext_network_manager/vendored_sdks/aio/operations/_perimeter_associable_resource_types_operations.py b/src/network-manager/azext_network_manager/vendored_sdks/aio/operations/_perimeter_associable_resource_types_operations.py deleted file mode 100644 index 7052642970c..00000000000 --- a/src/network-manager/azext_network_manager/vendored_sdks/aio/operations/_perimeter_associable_resource_types_operations.py +++ /dev/null @@ -1,96 +0,0 @@ -# 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 typing import Any, Callable, Dict, Generic, Optional, TypeVar -import warnings - -from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error -from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import AsyncHttpResponse, HttpRequest -from azure.mgmt.core.exceptions import ARMErrorFormat - -from ... import models as _models - -T = TypeVar('T') -ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] - -class PerimeterAssociableResourceTypesOperations: - """PerimeterAssociableResourceTypesOperations async operations. - - You should not instantiate this class directly. Instead, you should create a Client instance that - instantiates it for you and attaches it as an attribute. - - :ivar models: Alias to model classes used in this operation group. - :type models: ~azure.mgmt.network.v2021_02_01_preview.models - :param client: Client for service requests. - :param config: Configuration of service client. - :param serializer: An object model serializer. - :param deserializer: An object model deserializer. - """ - - models = _models - - def __init__(self, client, config, serializer, deserializer) -> None: - self._client = client - self._serialize = serializer - self._deserialize = deserializer - self._config = config - - async def get( - self, - location: str, - **kwargs: Any - ) -> "_models.PerimeterAssociableResourcesListResult": - """Gets the list of resources that are onboarded with NSP. These resources can be associated with - a network security perimeter. - - :param location: The location of the where the association is present. - :type location: str - :keyword callable cls: A custom type or function that will be passed the direct response - :return: PerimeterAssociableResourcesListResult, or the result of cls(response) - :rtype: ~azure.mgmt.network.v2021_02_01_preview.models.PerimeterAssociableResourcesListResult - :raises: ~azure.core.exceptions.HttpResponseError - """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.PerimeterAssociableResourcesListResult"] - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-02-01-preview" - accept = "application/json" - - # Construct URL - url = self.get.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'location': self._serialize.url("location", location, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - - request = self._client.get(url, query_parameters, header_parameters) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - deserialized = self._deserialize('PerimeterAssociableResourcesListResult', pipeline_response) - - if cls: - return cls(pipeline_response, deserialized, {}) - - return deserialized - get.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.Network/locations/{location}/perimeterAssociableResourceTypes'} # type: ignore diff --git a/src/network-manager/azext_network_manager/vendored_sdks/aio/operations/_scope_connections_operations.py b/src/network-manager/azext_network_manager/vendored_sdks/aio/operations/_scope_connections_operations.py new file mode 100644 index 00000000000..030643d624d --- /dev/null +++ b/src/network-manager/azext_network_manager/vendored_sdks/aio/operations/_scope_connections_operations.py @@ -0,0 +1,308 @@ +# 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 functools +from typing import Any, AsyncIterable, Callable, Dict, Generic, Optional, TypeVar, Union +import warnings + +from azure.core.async_paging import AsyncItemPaged, AsyncList +from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +from azure.core.pipeline import PipelineResponse +from azure.core.pipeline.transport import AsyncHttpResponse +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace +from azure.core.tracing.decorator_async import distributed_trace_async +from azure.mgmt.core.exceptions import ARMErrorFormat + +from ... import models as _models +from ..._vendor import _convert_request +from ...operations._scope_connections_operations import build_create_or_update_request, build_delete_request, build_get_request, build_list_request +T = TypeVar('T') +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] + +class ScopeConnectionsOperations: + """ScopeConnectionsOperations async operations. + + You should not instantiate this class directly. Instead, you should create a Client instance that + instantiates it for you and attaches it as an attribute. + + :ivar models: Alias to model classes used in this operation group. + :type models: ~azure.mgmt.network.v2021_05_01_preview.models + :param client: Client for service requests. + :param config: Configuration of service client. + :param serializer: An object model serializer. + :param deserializer: An object model deserializer. + """ + + models = _models + + def __init__(self, client, config, serializer, deserializer) -> None: + self._client = client + self._serialize = serializer + self._deserialize = deserializer + self._config = config + + @distributed_trace_async + async def create_or_update( + self, + resource_group_name: str, + network_manager_name: str, + scope_connection_name: str, + parameters: "_models.ScopeConnection", + **kwargs: Any + ) -> "_models.ScopeConnection": + """Creates or updates scope connection from Network Manager. + + :param resource_group_name: The name of the resource group. + :type resource_group_name: str + :param network_manager_name: The name of the network manager. + :type network_manager_name: str + :param scope_connection_name: Name for the cross-tenant connection. + :type scope_connection_name: str + :param parameters: Scope connection to be created/updated. + :type parameters: ~azure.mgmt.network.v2021_05_01_preview.models.ScopeConnection + :keyword callable cls: A custom type or function that will be passed the direct response + :return: ScopeConnection, or the result of cls(response) + :rtype: ~azure.mgmt.network.v2021_05_01_preview.models.ScopeConnection + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.ScopeConnection"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + + _json = self._serialize.body(parameters, 'ScopeConnection') + + request = build_create_or_update_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + network_manager_name=network_manager_name, + scope_connection_name=scope_connection_name, + content_type=content_type, + json=_json, + template_url=self.create_or_update.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200, 201]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + if response.status_code == 200: + deserialized = self._deserialize('ScopeConnection', pipeline_response) + + if response.status_code == 201: + deserialized = self._deserialize('ScopeConnection', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + create_or_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/networkManagers/{networkManagerName}/scopeConnections/{scopeConnectionName}'} # type: ignore + + + @distributed_trace_async + async def get( + self, + resource_group_name: str, + network_manager_name: str, + scope_connection_name: str, + **kwargs: Any + ) -> "_models.ScopeConnection": + """Get specified scope connection created by this Network Manager. + + :param resource_group_name: The name of the resource group. + :type resource_group_name: str + :param network_manager_name: The name of the network manager. + :type network_manager_name: str + :param scope_connection_name: Name for the cross-tenant connection. + :type scope_connection_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: ScopeConnection, or the result of cls(response) + :rtype: ~azure.mgmt.network.v2021_05_01_preview.models.ScopeConnection + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.ScopeConnection"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + + request = build_get_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + network_manager_name=network_manager_name, + scope_connection_name=scope_connection_name, + template_url=self.get.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = self._deserialize('ScopeConnection', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/networkManagers/{networkManagerName}/scopeConnections/{scopeConnectionName}'} # type: ignore + + + @distributed_trace_async + async def delete( + self, + resource_group_name: str, + network_manager_name: str, + scope_connection_name: str, + **kwargs: Any + ) -> None: + """Delete the pending scope connection created by this network manager. + + :param resource_group_name: The name of the resource group. + :type resource_group_name: str + :param network_manager_name: The name of the network manager. + :type network_manager_name: str + :param scope_connection_name: Name for the cross-tenant connection. + :type scope_connection_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: None, or the result of cls(response) + :rtype: None + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + + request = build_delete_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + network_manager_name=network_manager_name, + scope_connection_name=scope_connection_name, + template_url=self.delete.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200, 204]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + if cls: + return cls(pipeline_response, None, {}) + + delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/networkManagers/{networkManagerName}/scopeConnections/{scopeConnectionName}'} # type: ignore + + + @distributed_trace + def list( + self, + resource_group_name: str, + network_manager_name: str, + top: Optional[int] = None, + skip_token: Optional[str] = None, + **kwargs: Any + ) -> AsyncIterable["_models.ScopeConnectionListResult"]: + """List all scope connections created by this network manager. + + :param resource_group_name: The name of the resource group. + :type resource_group_name: str + :param network_manager_name: The name of the network manager. + :type network_manager_name: str + :param top: An optional query parameter which specifies the maximum number of records to be + returned by the server. + :type top: int + :param skip_token: SkipToken is only used if a previous operation returned a partial result. If + a previous response contains a nextLink element, the value of the nextLink element will include + a skipToken parameter that specifies a starting point to use for subsequent calls. + :type skip_token: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either ScopeConnectionListResult or the result of + cls(response) + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.network.v2021_05_01_preview.models.ScopeConnectionListResult] + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.ScopeConnectionListResult"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + def prepare_request(next_link=None): + if not next_link: + + request = build_list_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + network_manager_name=network_manager_name, + top=top, + skip_token=skip_token, + template_url=self.list.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + else: + + request = build_list_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + network_manager_name=network_manager_name, + top=top, + skip_token=skip_token, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" + return request + + async def extract_data(pipeline_response): + deserialized = self._deserialize("ScopeConnectionListResult", pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) + return deserialized.next_link or None, AsyncList(list_of_elem) + + async def get_next(next_link=None): + request = prepare_request(next_link) + + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + return pipeline_response + + + return AsyncItemPaged( + get_next, extract_data + ) + list.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/networkManagers/{networkManagerName}/scopeConnections'} # type: ignore diff --git a/src/network-manager/azext_network_manager/vendored_sdks/aio/operations/_security_admin_configurations_operations.py b/src/network-manager/azext_network_manager/vendored_sdks/aio/operations/_security_admin_configurations_operations.py index 1376e034b69..0e7ef9064eb 100644 --- a/src/network-manager/azext_network_manager/vendored_sdks/aio/operations/_security_admin_configurations_operations.py +++ b/src/network-manager/azext_network_manager/vendored_sdks/aio/operations/_security_admin_configurations_operations.py @@ -5,17 +5,22 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import functools from typing import Any, AsyncIterable, Callable, Dict, Generic, Optional, TypeVar, Union import warnings from azure.core.async_paging import AsyncItemPaged, AsyncList from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import AsyncHttpResponse, HttpRequest +from azure.core.pipeline.transport import AsyncHttpResponse +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace +from azure.core.tracing.decorator_async import distributed_trace_async from azure.mgmt.core.exceptions import ARMErrorFormat from ... import models as _models - +from ..._vendor import _convert_request +from ...operations._security_admin_configurations_operations import build_create_or_update_request, build_delete_request, build_get_request, build_list_request T = TypeVar('T') ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -26,7 +31,7 @@ class SecurityAdminConfigurationsOperations: instantiates it for you and attaches it as an attribute. :ivar models: Alias to model classes used in this operation group. - :type models: ~azure.mgmt.network.v2021_02_01_preview.models + :type models: ~azure.mgmt.network.v2021_05_01_preview.models :param client: Client for service requests. :param config: Configuration of service client. :param serializer: An object model serializer. @@ -41,6 +46,7 @@ def __init__(self, client, config, serializer, deserializer) -> None: self._deserialize = deserializer self._config = config + @distributed_trace def list( self, resource_group_name: str, @@ -64,8 +70,10 @@ def list( a skipToken parameter that specifies a starting point to use for subsequent calls. :type skip_token: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either SecurityConfigurationListResult or the result of cls(response) - :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.network.v2021_02_01_preview.models.SecurityConfigurationListResult] + :return: An iterator like instance of either SecurityConfigurationListResult or the result of + cls(response) + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.network.v2021_05_01_preview.models.SecurityConfigurationListResult] :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.SecurityConfigurationListResult"] @@ -73,40 +81,37 @@ def list( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-02-01-preview" - accept = "application/json" - def prepare_request(next_link=None): - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - if not next_link: - # Construct URL - url = self.list.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'networkManagerName': self._serialize.url("network_manager_name", network_manager_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - if top is not None: - query_parameters['$top'] = self._serialize.query("top", top, 'int', maximum=20, minimum=1) - if skip_token is not None: - query_parameters['$skipToken'] = self._serialize.query("skip_token", skip_token, 'str') - - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + network_manager_name=network_manager_name, + top=top, + skip_token=skip_token, + template_url=self.list.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + network_manager_name=network_manager_name, + top=top, + skip_token=skip_token, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request async def extract_data(pipeline_response): - deserialized = self._deserialize('SecurityConfigurationListResult', pipeline_response) + deserialized = self._deserialize("SecurityConfigurationListResult", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -124,11 +129,13 @@ async def get_next(next_link=None): return pipeline_response + return AsyncItemPaged( get_next, extract_data ) list.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/networkManagers/{networkManagerName}/securityAdminConfigurations'} # type: ignore + @distributed_trace_async async def get( self, resource_group_name: str, @@ -142,11 +149,11 @@ async def get( :type resource_group_name: str :param network_manager_name: The name of the network manager. :type network_manager_name: str - :param configuration_name: The name of the network manager security Configuration. + :param configuration_name: The name of the network manager Security Configuration. :type configuration_name: str :keyword callable cls: A custom type or function that will be passed the direct response :return: SecurityConfiguration, or the result of cls(response) - :rtype: ~azure.mgmt.network.v2021_02_01_preview.models.SecurityConfiguration + :rtype: ~azure.mgmt.network.v2021_05_01_preview.models.SecurityConfiguration :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.SecurityConfiguration"] @@ -154,28 +161,18 @@ async def get( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-02-01-preview" - accept = "application/json" - - # Construct URL - url = self.get.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'networkManagerName': self._serialize.url("network_manager_name", network_manager_name, 'str'), - 'configurationName': self._serialize.url("configuration_name", configuration_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_get_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + network_manager_name=network_manager_name, + configuration_name=configuration_name, + template_url=self.get.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.get(url, query_parameters, header_parameters) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -189,8 +186,11 @@ async def get( return cls(pipeline_response, deserialized, {}) return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/networkManagers/{networkManagerName}/securityAdminConfigurations/{configurationName}'} # type: ignore + + @distributed_trace_async async def create_or_update( self, resource_group_name: str, @@ -205,13 +205,14 @@ async def create_or_update( :type resource_group_name: str :param network_manager_name: The name of the network manager. :type network_manager_name: str - :param configuration_name: The name of the network manager security Configuration. + :param configuration_name: The name of the network manager Security Configuration. :type configuration_name: str :param security_admin_configuration: The security admin configuration to create or update. - :type security_admin_configuration: ~azure.mgmt.network.v2021_02_01_preview.models.SecurityConfiguration + :type security_admin_configuration: + ~azure.mgmt.network.v2021_05_01_preview.models.SecurityConfiguration :keyword callable cls: A custom type or function that will be passed the direct response :return: SecurityConfiguration, or the result of cls(response) - :rtype: ~azure.mgmt.network.v2021_02_01_preview.models.SecurityConfiguration + :rtype: ~azure.mgmt.network.v2021_05_01_preview.models.SecurityConfiguration :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.SecurityConfiguration"] @@ -219,33 +220,23 @@ async def create_or_update( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-02-01-preview" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self.create_or_update.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'networkManagerName': self._serialize.url("network_manager_name", network_manager_name, 'str'), - 'configurationName': self._serialize.url("configuration_name", configuration_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + + _json = self._serialize.body(security_admin_configuration, 'SecurityConfiguration') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + request = build_create_or_update_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + network_manager_name=network_manager_name, + configuration_name=configuration_name, + content_type=content_type, + json=_json, + template_url=self.create_or_update.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(security_admin_configuration, 'SecurityConfiguration') - body_content_kwargs['content'] = body_content - request = self._client.put(url, query_parameters, header_parameters, **body_content_kwargs) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -263,13 +254,18 @@ async def create_or_update( return cls(pipeline_response, deserialized, {}) return deserialized + create_or_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/networkManagers/{networkManagerName}/securityAdminConfigurations/{configurationName}'} # type: ignore + + @distributed_trace_async async def delete( self, resource_group_name: str, network_manager_name: str, configuration_name: str, + force: Optional[bool] = None, + recursive: Optional[bool] = None, **kwargs: Any ) -> None: """Deletes a network manager security admin configuration. @@ -278,8 +274,16 @@ async def delete( :type resource_group_name: str :param network_manager_name: The name of the network manager. :type network_manager_name: str - :param configuration_name: The name of the network manager security Configuration. + :param configuration_name: The name of the network manager Security Configuration. :type configuration_name: str + :param force: Deletes the resource even if it is part of a deployed configuration. If the + configuration has been deployed, the service will do a cleanup deployment in the background, + prior to the delete. + :type force: bool + :param recursive: Deletes the resource recursively. When present in a security configuration + delete, all rule collections and rules within the configuration will be deleted. When present + in a rule collection delete, all rules within the collection will be deleted. + :type recursive: bool :keyword callable cls: A custom type or function that will be passed the direct response :return: None, or the result of cls(response) :rtype: None @@ -290,28 +294,20 @@ async def delete( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-02-01-preview" - accept = "application/json" - - # Construct URL - url = self.delete.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'networkManagerName': self._serialize.url("network_manager_name", network_manager_name, 'str'), - 'configurationName': self._serialize.url("configuration_name", configuration_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_delete_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + network_manager_name=network_manager_name, + configuration_name=configuration_name, + force=force, + recursive=recursive, + template_url=self.delete.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.delete(url, query_parameters, header_parameters) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -323,3 +319,4 @@ async def delete( return cls(pipeline_response, None, {}) delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/networkManagers/{networkManagerName}/securityAdminConfigurations/{configurationName}'} # type: ignore + diff --git a/src/network-manager/azext_network_manager/vendored_sdks/aio/operations/_security_user_configurations_operations.py b/src/network-manager/azext_network_manager/vendored_sdks/aio/operations/_security_user_configurations_operations.py index 90c23233f46..49dd927f9c7 100644 --- a/src/network-manager/azext_network_manager/vendored_sdks/aio/operations/_security_user_configurations_operations.py +++ b/src/network-manager/azext_network_manager/vendored_sdks/aio/operations/_security_user_configurations_operations.py @@ -5,17 +5,22 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import functools from typing import Any, AsyncIterable, Callable, Dict, Generic, Optional, TypeVar, Union import warnings from azure.core.async_paging import AsyncItemPaged, AsyncList from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import AsyncHttpResponse, HttpRequest +from azure.core.pipeline.transport import AsyncHttpResponse +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace +from azure.core.tracing.decorator_async import distributed_trace_async from azure.mgmt.core.exceptions import ARMErrorFormat from ... import models as _models - +from ..._vendor import _convert_request +from ...operations._security_user_configurations_operations import build_create_or_update_request, build_delete_request, build_get_request, build_list_request T = TypeVar('T') ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -26,7 +31,7 @@ class SecurityUserConfigurationsOperations: instantiates it for you and attaches it as an attribute. :ivar models: Alias to model classes used in this operation group. - :type models: ~azure.mgmt.network.v2021_02_01_preview.models + :type models: ~azure.mgmt.network.v2021_05_01_preview.models :param client: Client for service requests. :param config: Configuration of service client. :param serializer: An object model serializer. @@ -41,6 +46,7 @@ def __init__(self, client, config, serializer, deserializer) -> None: self._deserialize = deserializer self._config = config + @distributed_trace def list( self, resource_group_name: str, @@ -64,8 +70,10 @@ def list( a skipToken parameter that specifies a starting point to use for subsequent calls. :type skip_token: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either SecurityConfigurationListResult or the result of cls(response) - :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.network.v2021_02_01_preview.models.SecurityConfigurationListResult] + :return: An iterator like instance of either SecurityConfigurationListResult or the result of + cls(response) + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.network.v2021_05_01_preview.models.SecurityConfigurationListResult] :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.SecurityConfigurationListResult"] @@ -73,40 +81,37 @@ def list( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-02-01-preview" - accept = "application/json" - def prepare_request(next_link=None): - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - if not next_link: - # Construct URL - url = self.list.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'networkManagerName': self._serialize.url("network_manager_name", network_manager_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - if top is not None: - query_parameters['$top'] = self._serialize.query("top", top, 'int', maximum=20, minimum=1) - if skip_token is not None: - query_parameters['$skipToken'] = self._serialize.query("skip_token", skip_token, 'str') - - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + network_manager_name=network_manager_name, + top=top, + skip_token=skip_token, + template_url=self.list.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + network_manager_name=network_manager_name, + top=top, + skip_token=skip_token, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request async def extract_data(pipeline_response): - deserialized = self._deserialize('SecurityConfigurationListResult', pipeline_response) + deserialized = self._deserialize("SecurityConfigurationListResult", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -124,11 +129,13 @@ async def get_next(next_link=None): return pipeline_response + return AsyncItemPaged( get_next, extract_data ) list.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/networkManagers/{networkManagerName}/securityUserConfigurations'} # type: ignore + @distributed_trace_async async def get( self, resource_group_name: str, @@ -142,11 +149,11 @@ async def get( :type resource_group_name: str :param network_manager_name: The name of the network manager. :type network_manager_name: str - :param configuration_name: The name of the network manager security Configuration. + :param configuration_name: The name of the network manager Security Configuration. :type configuration_name: str :keyword callable cls: A custom type or function that will be passed the direct response :return: SecurityConfiguration, or the result of cls(response) - :rtype: ~azure.mgmt.network.v2021_02_01_preview.models.SecurityConfiguration + :rtype: ~azure.mgmt.network.v2021_05_01_preview.models.SecurityConfiguration :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.SecurityConfiguration"] @@ -154,28 +161,18 @@ async def get( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-02-01-preview" - accept = "application/json" - - # Construct URL - url = self.get.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'networkManagerName': self._serialize.url("network_manager_name", network_manager_name, 'str'), - 'configurationName': self._serialize.url("configuration_name", configuration_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_get_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + network_manager_name=network_manager_name, + configuration_name=configuration_name, + template_url=self.get.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.get(url, query_parameters, header_parameters) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -189,8 +186,11 @@ async def get( return cls(pipeline_response, deserialized, {}) return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/networkManagers/{networkManagerName}/securityUserConfigurations/{configurationName}'} # type: ignore + + @distributed_trace_async async def create_or_update( self, resource_group_name: str, @@ -205,13 +205,14 @@ async def create_or_update( :type resource_group_name: str :param network_manager_name: The name of the network manager. :type network_manager_name: str - :param configuration_name: The name of the network manager security Configuration. + :param configuration_name: The name of the network manager Security Configuration. :type configuration_name: str :param security_user_configuration: The security user configuration to create or update. - :type security_user_configuration: ~azure.mgmt.network.v2021_02_01_preview.models.SecurityConfiguration + :type security_user_configuration: + ~azure.mgmt.network.v2021_05_01_preview.models.SecurityConfiguration :keyword callable cls: A custom type or function that will be passed the direct response :return: SecurityConfiguration, or the result of cls(response) - :rtype: ~azure.mgmt.network.v2021_02_01_preview.models.SecurityConfiguration + :rtype: ~azure.mgmt.network.v2021_05_01_preview.models.SecurityConfiguration :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.SecurityConfiguration"] @@ -219,33 +220,23 @@ async def create_or_update( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-02-01-preview" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self.create_or_update.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'networkManagerName': self._serialize.url("network_manager_name", network_manager_name, 'str'), - 'configurationName': self._serialize.url("configuration_name", configuration_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + + _json = self._serialize.body(security_user_configuration, 'SecurityConfiguration') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + request = build_create_or_update_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + network_manager_name=network_manager_name, + configuration_name=configuration_name, + content_type=content_type, + json=_json, + template_url=self.create_or_update.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(security_user_configuration, 'SecurityConfiguration') - body_content_kwargs['content'] = body_content - request = self._client.put(url, query_parameters, header_parameters, **body_content_kwargs) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -263,13 +254,18 @@ async def create_or_update( return cls(pipeline_response, deserialized, {}) return deserialized + create_or_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/networkManagers/{networkManagerName}/securityUserConfigurations/{configurationName}'} # type: ignore + + @distributed_trace_async async def delete( self, resource_group_name: str, network_manager_name: str, configuration_name: str, + force: Optional[bool] = None, + recursive: Optional[bool] = None, **kwargs: Any ) -> None: """Deletes a network manager security user configuration. @@ -278,8 +274,16 @@ async def delete( :type resource_group_name: str :param network_manager_name: The name of the network manager. :type network_manager_name: str - :param configuration_name: The name of the network manager security Configuration. + :param configuration_name: The name of the network manager Security Configuration. :type configuration_name: str + :param force: Deletes the resource even if it is part of a deployed configuration. If the + configuration has been deployed, the service will do a cleanup deployment in the background, + prior to the delete. + :type force: bool + :param recursive: Deletes the resource recursively. When present in a security configuration + delete, all rule collections and rules within the configuration will be deleted. When present + in a rule collection delete, all rules within the collection will be deleted. + :type recursive: bool :keyword callable cls: A custom type or function that will be passed the direct response :return: None, or the result of cls(response) :rtype: None @@ -290,28 +294,20 @@ async def delete( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-02-01-preview" - accept = "application/json" - - # Construct URL - url = self.delete.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'networkManagerName': self._serialize.url("network_manager_name", network_manager_name, 'str'), - 'configurationName': self._serialize.url("configuration_name", configuration_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_delete_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + network_manager_name=network_manager_name, + configuration_name=configuration_name, + force=force, + recursive=recursive, + template_url=self.delete.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.delete(url, query_parameters, header_parameters) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -323,3 +319,4 @@ async def delete( return cls(pipeline_response, None, {}) delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/networkManagers/{networkManagerName}/securityUserConfigurations/{configurationName}'} # type: ignore + diff --git a/src/network-manager/azext_network_manager/vendored_sdks/aio/operations/_static_members_operations.py b/src/network-manager/azext_network_manager/vendored_sdks/aio/operations/_static_members_operations.py new file mode 100644 index 00000000000..4dc25138101 --- /dev/null +++ b/src/network-manager/azext_network_manager/vendored_sdks/aio/operations/_static_members_operations.py @@ -0,0 +1,325 @@ +# 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 functools +from typing import Any, AsyncIterable, Callable, Dict, Generic, Optional, TypeVar, Union +import warnings + +from azure.core.async_paging import AsyncItemPaged, AsyncList +from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +from azure.core.pipeline import PipelineResponse +from azure.core.pipeline.transport import AsyncHttpResponse +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace +from azure.core.tracing.decorator_async import distributed_trace_async +from azure.mgmt.core.exceptions import ARMErrorFormat + +from ... import models as _models +from ..._vendor import _convert_request +from ...operations._static_members_operations import build_create_or_update_request, build_delete_request, build_get_request, build_list_request +T = TypeVar('T') +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] + +class StaticMembersOperations: + """StaticMembersOperations async operations. + + You should not instantiate this class directly. Instead, you should create a Client instance that + instantiates it for you and attaches it as an attribute. + + :ivar models: Alias to model classes used in this operation group. + :type models: ~azure.mgmt.network.v2021_05_01_preview.models + :param client: Client for service requests. + :param config: Configuration of service client. + :param serializer: An object model serializer. + :param deserializer: An object model deserializer. + """ + + models = _models + + def __init__(self, client, config, serializer, deserializer) -> None: + self._client = client + self._serialize = serializer + self._deserialize = deserializer + self._config = config + + @distributed_trace_async + async def get( + self, + resource_group_name: str, + network_manager_name: str, + network_group_name: str, + static_member_name: str, + **kwargs: Any + ) -> "_models.StaticMember": + """Gets the specified static member. + + :param resource_group_name: The name of the resource group. + :type resource_group_name: str + :param network_manager_name: The name of the network manager. + :type network_manager_name: str + :param network_group_name: The name of the network group. + :type network_group_name: str + :param static_member_name: The name of the static member. + :type static_member_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: StaticMember, or the result of cls(response) + :rtype: ~azure.mgmt.network.v2021_05_01_preview.models.StaticMember + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.StaticMember"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + + request = build_get_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + network_manager_name=network_manager_name, + network_group_name=network_group_name, + static_member_name=static_member_name, + template_url=self.get.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = self._deserialize('StaticMember', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/networkManagers/{networkManagerName}/networkGroups/{networkGroupName}/staticMembers/{staticMemberName}'} # type: ignore + + + @distributed_trace_async + async def create_or_update( + self, + resource_group_name: str, + network_manager_name: str, + network_group_name: str, + static_member_name: str, + parameters: "_models.StaticMember", + **kwargs: Any + ) -> "_models.StaticMember": + """Creates or updates a static member. + + :param resource_group_name: The name of the resource group. + :type resource_group_name: str + :param network_manager_name: The name of the network manager. + :type network_manager_name: str + :param network_group_name: The name of the network group. + :type network_group_name: str + :param static_member_name: The name of the static member. + :type static_member_name: str + :param parameters: Parameters supplied to the specify the static member to create. + :type parameters: ~azure.mgmt.network.v2021_05_01_preview.models.StaticMember + :keyword callable cls: A custom type or function that will be passed the direct response + :return: StaticMember, or the result of cls(response) + :rtype: ~azure.mgmt.network.v2021_05_01_preview.models.StaticMember + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.StaticMember"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + + _json = self._serialize.body(parameters, 'StaticMember') + + request = build_create_or_update_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + network_manager_name=network_manager_name, + network_group_name=network_group_name, + static_member_name=static_member_name, + content_type=content_type, + json=_json, + template_url=self.create_or_update.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200, 201]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + if response.status_code == 200: + deserialized = self._deserialize('StaticMember', pipeline_response) + + if response.status_code == 201: + deserialized = self._deserialize('StaticMember', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + create_or_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/networkManagers/{networkManagerName}/networkGroups/{networkGroupName}/staticMembers/{staticMemberName}'} # type: ignore + + + @distributed_trace_async + async def delete( + self, + resource_group_name: str, + network_manager_name: str, + network_group_name: str, + static_member_name: str, + **kwargs: Any + ) -> None: + """Deletes a static member. + + :param resource_group_name: The name of the resource group. + :type resource_group_name: str + :param network_manager_name: The name of the network manager. + :type network_manager_name: str + :param network_group_name: The name of the network group. + :type network_group_name: str + :param static_member_name: The name of the static member. + :type static_member_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: None, or the result of cls(response) + :rtype: None + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + + request = build_delete_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + network_manager_name=network_manager_name, + network_group_name=network_group_name, + static_member_name=static_member_name, + template_url=self.delete.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200, 204]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + if cls: + return cls(pipeline_response, None, {}) + + delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/networkManagers/{networkManagerName}/networkGroups/{networkGroupName}/staticMembers/{staticMemberName}'} # type: ignore + + + @distributed_trace + def list( + self, + resource_group_name: str, + network_manager_name: str, + network_group_name: str, + top: Optional[int] = None, + skip_token: Optional[str] = None, + **kwargs: Any + ) -> AsyncIterable["_models.StaticMemberListResult"]: + """Lists the specified static member. + + :param resource_group_name: The name of the resource group. + :type resource_group_name: str + :param network_manager_name: The name of the network manager. + :type network_manager_name: str + :param network_group_name: The name of the network group. + :type network_group_name: str + :param top: An optional query parameter which specifies the maximum number of records to be + returned by the server. + :type top: int + :param skip_token: SkipToken is only used if a previous operation returned a partial result. If + a previous response contains a nextLink element, the value of the nextLink element will include + a skipToken parameter that specifies a starting point to use for subsequent calls. + :type skip_token: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either StaticMemberListResult or the result of + cls(response) + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.network.v2021_05_01_preview.models.StaticMemberListResult] + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.StaticMemberListResult"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + def prepare_request(next_link=None): + if not next_link: + + request = build_list_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + network_manager_name=network_manager_name, + network_group_name=network_group_name, + top=top, + skip_token=skip_token, + template_url=self.list.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + else: + + request = build_list_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + network_manager_name=network_manager_name, + network_group_name=network_group_name, + top=top, + skip_token=skip_token, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" + return request + + async def extract_data(pipeline_response): + deserialized = self._deserialize("StaticMemberListResult", pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) + return deserialized.next_link or None, AsyncList(list_of_elem) + + async def get_next(next_link=None): + request = prepare_request(next_link) + + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + return pipeline_response + + + return AsyncItemPaged( + get_next, extract_data + ) + list.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/networkManagers/{networkManagerName}/networkGroups/{networkGroupName}/staticMembers'} # type: ignore diff --git a/src/network-manager/azext_network_manager/vendored_sdks/aio/operations/_subscription_network_manager_connections_operations.py b/src/network-manager/azext_network_manager/vendored_sdks/aio/operations/_subscription_network_manager_connections_operations.py new file mode 100644 index 00000000000..6d8197a176c --- /dev/null +++ b/src/network-manager/azext_network_manager/vendored_sdks/aio/operations/_subscription_network_manager_connections_operations.py @@ -0,0 +1,274 @@ +# 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 functools +from typing import Any, AsyncIterable, Callable, Dict, Generic, Optional, TypeVar, Union +import warnings + +from azure.core.async_paging import AsyncItemPaged, AsyncList +from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +from azure.core.pipeline import PipelineResponse +from azure.core.pipeline.transport import AsyncHttpResponse +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace +from azure.core.tracing.decorator_async import distributed_trace_async +from azure.mgmt.core.exceptions import ARMErrorFormat + +from ... import models as _models +from ..._vendor import _convert_request +from ...operations._subscription_network_manager_connections_operations import build_create_or_update_request, build_delete_request, build_get_request, build_list_request +T = TypeVar('T') +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] + +class SubscriptionNetworkManagerConnectionsOperations: + """SubscriptionNetworkManagerConnectionsOperations async operations. + + You should not instantiate this class directly. Instead, you should create a Client instance that + instantiates it for you and attaches it as an attribute. + + :ivar models: Alias to model classes used in this operation group. + :type models: ~azure.mgmt.network.v2021_05_01_preview.models + :param client: Client for service requests. + :param config: Configuration of service client. + :param serializer: An object model serializer. + :param deserializer: An object model deserializer. + """ + + models = _models + + def __init__(self, client, config, serializer, deserializer) -> None: + self._client = client + self._serialize = serializer + self._deserialize = deserializer + self._config = config + + @distributed_trace_async + async def create_or_update( + self, + network_manager_connection_name: str, + parameters: "_models.NetworkManagerConnection", + **kwargs: Any + ) -> "_models.NetworkManagerConnection": + """Create a connection from this subscription to a cross tenant network manager. + + :param network_manager_connection_name: Name for the network manager connection. + :type network_manager_connection_name: str + :param parameters: Network manager connection to be created/updated. + :type parameters: ~azure.mgmt.network.v2021_05_01_preview.models.NetworkManagerConnection + :keyword callable cls: A custom type or function that will be passed the direct response + :return: NetworkManagerConnection, or the result of cls(response) + :rtype: ~azure.mgmt.network.v2021_05_01_preview.models.NetworkManagerConnection + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.NetworkManagerConnection"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + + _json = self._serialize.body(parameters, 'NetworkManagerConnection') + + request = build_create_or_update_request( + subscription_id=self._config.subscription_id, + network_manager_connection_name=network_manager_connection_name, + content_type=content_type, + json=_json, + template_url=self.create_or_update.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200, 201]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + if response.status_code == 200: + deserialized = self._deserialize('NetworkManagerConnection', pipeline_response) + + if response.status_code == 201: + deserialized = self._deserialize('NetworkManagerConnection', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + create_or_update.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.Network/networkManagerConnections/{networkManagerConnectionName}'} # type: ignore + + + @distributed_trace_async + async def get( + self, + network_manager_connection_name: str, + **kwargs: Any + ) -> "_models.NetworkManagerConnection": + """Get a specified connection created by this subscription. + + :param network_manager_connection_name: Name for the network manager connection. + :type network_manager_connection_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: NetworkManagerConnection, or the result of cls(response) + :rtype: ~azure.mgmt.network.v2021_05_01_preview.models.NetworkManagerConnection + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.NetworkManagerConnection"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + + request = build_get_request( + subscription_id=self._config.subscription_id, + network_manager_connection_name=network_manager_connection_name, + template_url=self.get.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = self._deserialize('NetworkManagerConnection', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + get.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.Network/networkManagerConnections/{networkManagerConnectionName}'} # type: ignore + + + @distributed_trace_async + async def delete( + self, + network_manager_connection_name: str, + **kwargs: Any + ) -> None: + """Delete specified pending connection created by this subscription. + + :param network_manager_connection_name: Name for the network manager connection. + :type network_manager_connection_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: None, or the result of cls(response) + :rtype: None + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + + request = build_delete_request( + subscription_id=self._config.subscription_id, + network_manager_connection_name=network_manager_connection_name, + template_url=self.delete.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200, 204]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + if cls: + return cls(pipeline_response, None, {}) + + delete.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.Network/networkManagerConnections/{networkManagerConnectionName}'} # type: ignore + + + @distributed_trace + def list( + self, + top: Optional[int] = None, + skip_token: Optional[str] = None, + **kwargs: Any + ) -> AsyncIterable["_models.NetworkManagerConnectionListResult"]: + """List all network manager connections created by this subscription. + + :param top: An optional query parameter which specifies the maximum number of records to be + returned by the server. + :type top: int + :param skip_token: SkipToken is only used if a previous operation returned a partial result. If + a previous response contains a nextLink element, the value of the nextLink element will include + a skipToken parameter that specifies a starting point to use for subsequent calls. + :type skip_token: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either NetworkManagerConnectionListResult or the result + of cls(response) + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.network.v2021_05_01_preview.models.NetworkManagerConnectionListResult] + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.NetworkManagerConnectionListResult"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + def prepare_request(next_link=None): + if not next_link: + + request = build_list_request( + subscription_id=self._config.subscription_id, + top=top, + skip_token=skip_token, + template_url=self.list.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + else: + + request = build_list_request( + subscription_id=self._config.subscription_id, + top=top, + skip_token=skip_token, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" + return request + + async def extract_data(pipeline_response): + deserialized = self._deserialize("NetworkManagerConnectionListResult", pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) + return deserialized.next_link or None, AsyncList(list_of_elem) + + async def get_next(next_link=None): + request = prepare_request(next_link) + + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + return pipeline_response + + + return AsyncItemPaged( + get_next, extract_data + ) + list.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.Network/networkManagerConnections'} # type: ignore diff --git a/src/network-manager/azext_network_manager/vendored_sdks/aio/operations/_user_rule_collections_operations.py b/src/network-manager/azext_network_manager/vendored_sdks/aio/operations/_user_rule_collections_operations.py index ef488639df0..48dbf3c23da 100644 --- a/src/network-manager/azext_network_manager/vendored_sdks/aio/operations/_user_rule_collections_operations.py +++ b/src/network-manager/azext_network_manager/vendored_sdks/aio/operations/_user_rule_collections_operations.py @@ -5,17 +5,22 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import functools from typing import Any, AsyncIterable, Callable, Dict, Generic, Optional, TypeVar, Union import warnings from azure.core.async_paging import AsyncItemPaged, AsyncList from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import AsyncHttpResponse, HttpRequest +from azure.core.pipeline.transport import AsyncHttpResponse +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace +from azure.core.tracing.decorator_async import distributed_trace_async from azure.mgmt.core.exceptions import ARMErrorFormat from ... import models as _models - +from ..._vendor import _convert_request +from ...operations._user_rule_collections_operations import build_create_or_update_request, build_delete_request, build_get_request, build_list_request T = TypeVar('T') ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -26,7 +31,7 @@ class UserRuleCollectionsOperations: instantiates it for you and attaches it as an attribute. :ivar models: Alias to model classes used in this operation group. - :type models: ~azure.mgmt.network.v2021_02_01_preview.models + :type models: ~azure.mgmt.network.v2021_05_01_preview.models :param client: Client for service requests. :param config: Configuration of service client. :param serializer: An object model serializer. @@ -41,6 +46,7 @@ def __init__(self, client, config, serializer, deserializer) -> None: self._deserialize = deserializer self._config = config + @distributed_trace def list( self, resource_group_name: str, @@ -56,7 +62,7 @@ def list( :type resource_group_name: str :param network_manager_name: The name of the network manager. :type network_manager_name: str - :param configuration_name: The name of the network manager security Configuration. + :param configuration_name: The name of the network manager Security Configuration. :type configuration_name: str :param top: An optional query parameter which specifies the maximum number of records to be returned by the server. @@ -66,8 +72,10 @@ def list( a skipToken parameter that specifies a starting point to use for subsequent calls. :type skip_token: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either RuleCollectionListResult or the result of cls(response) - :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.network.v2021_02_01_preview.models.RuleCollectionListResult] + :return: An iterator like instance of either RuleCollectionListResult or the result of + cls(response) + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.network.v2021_05_01_preview.models.RuleCollectionListResult] :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.RuleCollectionListResult"] @@ -75,41 +83,39 @@ def list( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-02-01-preview" - accept = "application/json" - def prepare_request(next_link=None): - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - if not next_link: - # Construct URL - url = self.list.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'networkManagerName': self._serialize.url("network_manager_name", network_manager_name, 'str'), - 'configurationName': self._serialize.url("configuration_name", configuration_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - if top is not None: - query_parameters['$top'] = self._serialize.query("top", top, 'int', maximum=20, minimum=1) - if skip_token is not None: - query_parameters['$skipToken'] = self._serialize.query("skip_token", skip_token, 'str') - - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + network_manager_name=network_manager_name, + configuration_name=configuration_name, + top=top, + skip_token=skip_token, + template_url=self.list.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + network_manager_name=network_manager_name, + configuration_name=configuration_name, + top=top, + skip_token=skip_token, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request async def extract_data(pipeline_response): - deserialized = self._deserialize('RuleCollectionListResult', pipeline_response) + deserialized = self._deserialize("RuleCollectionListResult", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -127,11 +133,13 @@ async def get_next(next_link=None): return pipeline_response + return AsyncItemPaged( get_next, extract_data ) list.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/networkManagers/{networkManagerName}/securityUserConfigurations/{configurationName}/ruleCollections'} # type: ignore + @distributed_trace_async async def get( self, resource_group_name: str, @@ -146,14 +154,14 @@ async def get( :type resource_group_name: str :param network_manager_name: The name of the network manager. :type network_manager_name: str - :param configuration_name: The name of the network manager security Configuration. + :param configuration_name: The name of the network manager Security Configuration. :type configuration_name: str :param rule_collection_name: The name of the network manager security Configuration rule collection. :type rule_collection_name: str :keyword callable cls: A custom type or function that will be passed the direct response :return: RuleCollection, or the result of cls(response) - :rtype: ~azure.mgmt.network.v2021_02_01_preview.models.RuleCollection + :rtype: ~azure.mgmt.network.v2021_05_01_preview.models.RuleCollection :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.RuleCollection"] @@ -161,29 +169,19 @@ async def get( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-02-01-preview" - accept = "application/json" - - # Construct URL - url = self.get.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'networkManagerName': self._serialize.url("network_manager_name", network_manager_name, 'str'), - 'configurationName': self._serialize.url("configuration_name", configuration_name, 'str'), - 'ruleCollectionName': self._serialize.url("rule_collection_name", rule_collection_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_get_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + network_manager_name=network_manager_name, + configuration_name=configuration_name, + rule_collection_name=rule_collection_name, + template_url=self.get.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.get(url, query_parameters, header_parameters) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -197,8 +195,11 @@ async def get( return cls(pipeline_response, deserialized, {}) return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/networkManagers/{networkManagerName}/securityUserConfigurations/{configurationName}/ruleCollections/{ruleCollectionName}'} # type: ignore + + @distributed_trace_async async def create_or_update( self, resource_group_name: str, @@ -214,16 +215,16 @@ async def create_or_update( :type resource_group_name: str :param network_manager_name: The name of the network manager. :type network_manager_name: str - :param configuration_name: The name of the network manager security Configuration. + :param configuration_name: The name of the network manager Security Configuration. :type configuration_name: str :param rule_collection_name: The name of the network manager security Configuration rule collection. :type rule_collection_name: str :param user_rule_collection: The User Rule Collection to create or update. - :type user_rule_collection: ~azure.mgmt.network.v2021_02_01_preview.models.RuleCollection + :type user_rule_collection: ~azure.mgmt.network.v2021_05_01_preview.models.RuleCollection :keyword callable cls: A custom type or function that will be passed the direct response :return: RuleCollection, or the result of cls(response) - :rtype: ~azure.mgmt.network.v2021_02_01_preview.models.RuleCollection + :rtype: ~azure.mgmt.network.v2021_05_01_preview.models.RuleCollection :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.RuleCollection"] @@ -231,34 +232,24 @@ async def create_or_update( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-02-01-preview" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self.create_or_update.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'networkManagerName': self._serialize.url("network_manager_name", network_manager_name, 'str'), - 'configurationName': self._serialize.url("configuration_name", configuration_name, 'str'), - 'ruleCollectionName': self._serialize.url("rule_collection_name", rule_collection_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + + _json = self._serialize.body(user_rule_collection, 'RuleCollection') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + request = build_create_or_update_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + network_manager_name=network_manager_name, + configuration_name=configuration_name, + rule_collection_name=rule_collection_name, + content_type=content_type, + json=_json, + template_url=self.create_or_update.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(user_rule_collection, 'RuleCollection') - body_content_kwargs['content'] = body_content - request = self._client.put(url, query_parameters, header_parameters, **body_content_kwargs) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -276,14 +267,19 @@ async def create_or_update( return cls(pipeline_response, deserialized, {}) return deserialized + create_or_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/networkManagers/{networkManagerName}/securityUserConfigurations/{configurationName}/ruleCollections/{ruleCollectionName}'} # type: ignore + + @distributed_trace_async async def delete( self, resource_group_name: str, network_manager_name: str, configuration_name: str, rule_collection_name: str, + force: Optional[bool] = None, + recursive: Optional[bool] = None, **kwargs: Any ) -> None: """Deletes a user rule collection. @@ -292,11 +288,19 @@ async def delete( :type resource_group_name: str :param network_manager_name: The name of the network manager. :type network_manager_name: str - :param configuration_name: The name of the network manager security Configuration. + :param configuration_name: The name of the network manager Security Configuration. :type configuration_name: str :param rule_collection_name: The name of the network manager security Configuration rule collection. :type rule_collection_name: str + :param force: Deletes the resource even if it is part of a deployed configuration. If the + configuration has been deployed, the service will do a cleanup deployment in the background, + prior to the delete. + :type force: bool + :param recursive: Deletes the resource recursively. When present in a security configuration + delete, all rule collections and rules within the configuration will be deleted. When present + in a rule collection delete, all rules within the collection will be deleted. + :type recursive: bool :keyword callable cls: A custom type or function that will be passed the direct response :return: None, or the result of cls(response) :rtype: None @@ -307,29 +311,21 @@ async def delete( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-02-01-preview" - accept = "application/json" - - # Construct URL - url = self.delete.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'networkManagerName': self._serialize.url("network_manager_name", network_manager_name, 'str'), - 'configurationName': self._serialize.url("configuration_name", configuration_name, 'str'), - 'ruleCollectionName': self._serialize.url("rule_collection_name", rule_collection_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_delete_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + network_manager_name=network_manager_name, + configuration_name=configuration_name, + rule_collection_name=rule_collection_name, + force=force, + recursive=recursive, + template_url=self.delete.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.delete(url, query_parameters, header_parameters) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -341,3 +337,4 @@ async def delete( return cls(pipeline_response, None, {}) delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/networkManagers/{networkManagerName}/securityUserConfigurations/{configurationName}/ruleCollections/{ruleCollectionName}'} # type: ignore + diff --git a/src/network-manager/azext_network_manager/vendored_sdks/aio/operations/_user_rules_operations.py b/src/network-manager/azext_network_manager/vendored_sdks/aio/operations/_user_rules_operations.py index 895b099aca7..aad32212c62 100644 --- a/src/network-manager/azext_network_manager/vendored_sdks/aio/operations/_user_rules_operations.py +++ b/src/network-manager/azext_network_manager/vendored_sdks/aio/operations/_user_rules_operations.py @@ -5,17 +5,22 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import functools from typing import Any, AsyncIterable, Callable, Dict, Generic, Optional, TypeVar, Union import warnings from azure.core.async_paging import AsyncItemPaged, AsyncList from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import AsyncHttpResponse, HttpRequest +from azure.core.pipeline.transport import AsyncHttpResponse +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace +from azure.core.tracing.decorator_async import distributed_trace_async from azure.mgmt.core.exceptions import ARMErrorFormat from ... import models as _models - +from ..._vendor import _convert_request +from ...operations._user_rules_operations import build_create_or_update_request, build_delete_request, build_get_request, build_list_request T = TypeVar('T') ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -26,7 +31,7 @@ class UserRulesOperations: instantiates it for you and attaches it as an attribute. :ivar models: Alias to model classes used in this operation group. - :type models: ~azure.mgmt.network.v2021_02_01_preview.models + :type models: ~azure.mgmt.network.v2021_05_01_preview.models :param client: Client for service requests. :param config: Configuration of service client. :param serializer: An object model serializer. @@ -41,6 +46,7 @@ def __init__(self, client, config, serializer, deserializer) -> None: self._deserialize = deserializer self._config = config + @distributed_trace def list( self, resource_group_name: str, @@ -57,7 +63,7 @@ def list( :type resource_group_name: str :param network_manager_name: The name of the network manager. :type network_manager_name: str - :param configuration_name: The name of the network manager security Configuration. + :param configuration_name: The name of the network manager Security Configuration. :type configuration_name: str :param rule_collection_name: The name of the network manager security Configuration rule collection. @@ -71,7 +77,8 @@ def list( :type skip_token: str :keyword callable cls: A custom type or function that will be passed the direct response :return: An iterator like instance of either UserRuleListResult or the result of cls(response) - :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.network.v2021_02_01_preview.models.UserRuleListResult] + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.network.v2021_05_01_preview.models.UserRuleListResult] :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.UserRuleListResult"] @@ -79,42 +86,41 @@ def list( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-02-01-preview" - accept = "application/json" - def prepare_request(next_link=None): - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - if not next_link: - # Construct URL - url = self.list.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'networkManagerName': self._serialize.url("network_manager_name", network_manager_name, 'str'), - 'configurationName': self._serialize.url("configuration_name", configuration_name, 'str'), - 'ruleCollectionName': self._serialize.url("rule_collection_name", rule_collection_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - if top is not None: - query_parameters['$top'] = self._serialize.query("top", top, 'int', maximum=20, minimum=1) - if skip_token is not None: - query_parameters['$skipToken'] = self._serialize.query("skip_token", skip_token, 'str') - - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + network_manager_name=network_manager_name, + configuration_name=configuration_name, + rule_collection_name=rule_collection_name, + top=top, + skip_token=skip_token, + template_url=self.list.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + network_manager_name=network_manager_name, + configuration_name=configuration_name, + rule_collection_name=rule_collection_name, + top=top, + skip_token=skip_token, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request async def extract_data(pipeline_response): - deserialized = self._deserialize('UserRuleListResult', pipeline_response) + deserialized = self._deserialize("UserRuleListResult", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -132,11 +138,13 @@ async def get_next(next_link=None): return pipeline_response + return AsyncItemPaged( get_next, extract_data ) list.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/networkManagers/{networkManagerName}/securityUserConfigurations/{configurationName}/ruleCollections/{ruleCollectionName}/rules'} # type: ignore + @distributed_trace_async async def get( self, resource_group_name: str, @@ -152,7 +160,7 @@ async def get( :type resource_group_name: str :param network_manager_name: The name of the network manager. :type network_manager_name: str - :param configuration_name: The name of the network manager security Configuration. + :param configuration_name: The name of the network manager Security Configuration. :type configuration_name: str :param rule_collection_name: The name of the network manager security Configuration rule collection. @@ -161,7 +169,7 @@ async def get( :type rule_name: str :keyword callable cls: A custom type or function that will be passed the direct response :return: BaseUserRule, or the result of cls(response) - :rtype: ~azure.mgmt.network.v2021_02_01_preview.models.BaseUserRule + :rtype: ~azure.mgmt.network.v2021_05_01_preview.models.BaseUserRule :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.BaseUserRule"] @@ -169,30 +177,20 @@ async def get( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-02-01-preview" - accept = "application/json" - - # Construct URL - url = self.get.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'networkManagerName': self._serialize.url("network_manager_name", network_manager_name, 'str'), - 'configurationName': self._serialize.url("configuration_name", configuration_name, 'str'), - 'ruleCollectionName': self._serialize.url("rule_collection_name", rule_collection_name, 'str'), - 'ruleName': self._serialize.url("rule_name", rule_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_get_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + network_manager_name=network_manager_name, + configuration_name=configuration_name, + rule_collection_name=rule_collection_name, + rule_name=rule_name, + template_url=self.get.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.get(url, query_parameters, header_parameters) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -206,8 +204,11 @@ async def get( return cls(pipeline_response, deserialized, {}) return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/networkManagers/{networkManagerName}/securityUserConfigurations/{configurationName}/ruleCollections/{ruleCollectionName}/rules/{ruleName}'} # type: ignore + + @distributed_trace_async async def create_or_update( self, resource_group_name: str, @@ -224,7 +225,7 @@ async def create_or_update( :type resource_group_name: str :param network_manager_name: The name of the network manager. :type network_manager_name: str - :param configuration_name: The name of the network manager security Configuration. + :param configuration_name: The name of the network manager Security Configuration. :type configuration_name: str :param rule_collection_name: The name of the network manager security Configuration rule collection. @@ -232,10 +233,10 @@ async def create_or_update( :param rule_name: The name of the rule. :type rule_name: str :param user_rule: The user rule to create or update. - :type user_rule: ~azure.mgmt.network.v2021_02_01_preview.models.BaseUserRule + :type user_rule: ~azure.mgmt.network.v2021_05_01_preview.models.BaseUserRule :keyword callable cls: A custom type or function that will be passed the direct response :return: BaseUserRule, or the result of cls(response) - :rtype: ~azure.mgmt.network.v2021_02_01_preview.models.BaseUserRule + :rtype: ~azure.mgmt.network.v2021_05_01_preview.models.BaseUserRule :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.BaseUserRule"] @@ -243,35 +244,25 @@ async def create_or_update( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-02-01-preview" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self.create_or_update.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'networkManagerName': self._serialize.url("network_manager_name", network_manager_name, 'str'), - 'configurationName': self._serialize.url("configuration_name", configuration_name, 'str'), - 'ruleCollectionName': self._serialize.url("rule_collection_name", rule_collection_name, 'str'), - 'ruleName': self._serialize.url("rule_name", rule_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + + _json = self._serialize.body(user_rule, 'BaseUserRule') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + request = build_create_or_update_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + network_manager_name=network_manager_name, + configuration_name=configuration_name, + rule_collection_name=rule_collection_name, + rule_name=rule_name, + content_type=content_type, + json=_json, + template_url=self.create_or_update.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(user_rule, 'BaseUserRule') - body_content_kwargs['content'] = body_content - request = self._client.put(url, query_parameters, header_parameters, **body_content_kwargs) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -289,8 +280,11 @@ async def create_or_update( return cls(pipeline_response, deserialized, {}) return deserialized + create_or_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/networkManagers/{networkManagerName}/securityUserConfigurations/{configurationName}/ruleCollections/{ruleCollectionName}/rules/{ruleName}'} # type: ignore + + @distributed_trace_async async def delete( self, resource_group_name: str, @@ -298,6 +292,7 @@ async def delete( configuration_name: str, rule_collection_name: str, rule_name: str, + force: Optional[bool] = None, **kwargs: Any ) -> None: """Deletes a user rule. @@ -306,13 +301,17 @@ async def delete( :type resource_group_name: str :param network_manager_name: The name of the network manager. :type network_manager_name: str - :param configuration_name: The name of the network manager security Configuration. + :param configuration_name: The name of the network manager Security Configuration. :type configuration_name: str :param rule_collection_name: The name of the network manager security Configuration rule collection. :type rule_collection_name: str :param rule_name: The name of the rule. :type rule_name: str + :param force: Deletes the resource even if it is part of a deployed configuration. If the + configuration has been deployed, the service will do a cleanup deployment in the background, + prior to the delete. + :type force: bool :keyword callable cls: A custom type or function that will be passed the direct response :return: None, or the result of cls(response) :rtype: None @@ -323,30 +322,21 @@ async def delete( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-02-01-preview" - accept = "application/json" - - # Construct URL - url = self.delete.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'networkManagerName': self._serialize.url("network_manager_name", network_manager_name, 'str'), - 'configurationName': self._serialize.url("configuration_name", configuration_name, 'str'), - 'ruleCollectionName': self._serialize.url("rule_collection_name", rule_collection_name, 'str'), - 'ruleName': self._serialize.url("rule_name", rule_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_delete_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + network_manager_name=network_manager_name, + configuration_name=configuration_name, + rule_collection_name=rule_collection_name, + rule_name=rule_name, + force=force, + template_url=self.delete.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.delete(url, query_parameters, header_parameters) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -358,3 +348,4 @@ async def delete( return cls(pipeline_response, None, {}) delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/networkManagers/{networkManagerName}/securityUserConfigurations/{configurationName}/ruleCollections/{ruleCollectionName}/rules/{ruleName}'} # type: ignore + diff --git a/src/network-manager/azext_network_manager/vendored_sdks/models/__init__.py b/src/network-manager/azext_network_manager/vendored_sdks/models/__init__.py index a0e46b4c305..c22c91e74ed 100644 --- a/src/network-manager/azext_network_manager/vendored_sdks/models/__init__.py +++ b/src/network-manager/azext_network_manager/vendored_sdks/models/__init__.py @@ -6,126 +6,68 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -try: - from ._models_py3 import ActiveBaseSecurityAdminRule - from ._models_py3 import ActiveBaseSecurityUserRule - from ._models_py3 import ActiveConfigurationParameter - from ._models_py3 import ActiveConnectivityConfiguration - from ._models_py3 import ActiveConnectivityConfigurationsListResult - from ._models_py3 import ActiveDefaultSecurityAdminRule - from ._models_py3 import ActiveDefaultSecurityUserRule - from ._models_py3 import ActiveSecurityAdminRule - from ._models_py3 import ActiveSecurityAdminRulesListResult - from ._models_py3 import ActiveSecurityUserRule - from ._models_py3 import ActiveSecurityUserRulesListResult - from ._models_py3 import AddressPrefixItem - from ._models_py3 import AdminRule - from ._models_py3 import AdminRuleListResult - from ._models_py3 import BaseAdminRule - from ._models_py3 import BaseUserRule - from ._models_py3 import CloudErrorBody - from ._models_py3 import ConfigurationGroup - from ._models_py3 import ConnectivityConfiguration - from ._models_py3 import ConnectivityConfigurationListResult - from ._models_py3 import ConnectivityGroupItem - from ._models_py3 import DefaultAdminRule - from ._models_py3 import DefaultUserRule - from ._models_py3 import EffectiveBaseSecurityAdminRule - from ._models_py3 import EffectiveConnectivityConfiguration - from ._models_py3 import EffectiveDefaultSecurityAdminRule - from ._models_py3 import EffectiveSecurityAdminRule - from ._models_py3 import EffectiveVirtualNetwork - from ._models_py3 import EffectiveVirtualNetworksListResult - from ._models_py3 import EffectiveVirtualNetworksParameter - from ._models_py3 import GroupMembersItem - from ._models_py3 import Hub - from ._models_py3 import NetworkGroup - from ._models_py3 import NetworkGroupListResult - from ._models_py3 import NetworkManager - from ._models_py3 import NetworkManagerCommit - from ._models_py3 import NetworkManagerDeploymentStatus - from ._models_py3 import NetworkManagerDeploymentStatusListResult - from ._models_py3 import NetworkManagerDeploymentStatusParameter - from ._models_py3 import NetworkManagerEffectiveConnectivityConfigurationListResult - from ._models_py3 import NetworkManagerEffectiveSecurityAdminRulesListResult - from ._models_py3 import NetworkManagerListResult - from ._models_py3 import NetworkManagerPropertiesNetworkManagerScopes - from ._models_py3 import NetworkManagerSecurityGroupItem - from ._models_py3 import NetworkSecurityPerimeter - from ._models_py3 import NetworkSecurityPerimeterListResult - from ._models_py3 import PerimeterAssociableResource - from ._models_py3 import PerimeterAssociableResourcesListResult - from ._models_py3 import ProxyResource - from ._models_py3 import QueryRequestOptions - from ._models_py3 import Resource - from ._models_py3 import RuleCollection - from ._models_py3 import RuleCollectionListResult - from ._models_py3 import SecurityConfiguration - from ._models_py3 import SecurityConfigurationListResult - from ._models_py3 import SystemData - from ._models_py3 import TagsObject - from ._models_py3 import UserRule - from ._models_py3 import UserRuleListResult -except (SyntaxError, ImportError): - from ._models import ActiveBaseSecurityAdminRule # type: ignore - from ._models import ActiveBaseSecurityUserRule # type: ignore - from ._models import ActiveConfigurationParameter # type: ignore - from ._models import ActiveConnectivityConfiguration # type: ignore - from ._models import ActiveConnectivityConfigurationsListResult # type: ignore - from ._models import ActiveDefaultSecurityAdminRule # type: ignore - from ._models import ActiveDefaultSecurityUserRule # type: ignore - from ._models import ActiveSecurityAdminRule # type: ignore - from ._models import ActiveSecurityAdminRulesListResult # type: ignore - from ._models import ActiveSecurityUserRule # type: ignore - from ._models import ActiveSecurityUserRulesListResult # type: ignore - from ._models import AddressPrefixItem # type: ignore - from ._models import AdminRule # type: ignore - from ._models import AdminRuleListResult # type: ignore - from ._models import BaseAdminRule # type: ignore - from ._models import BaseUserRule # type: ignore - from ._models import CloudErrorBody # type: ignore - from ._models import ConfigurationGroup # type: ignore - from ._models import ConnectivityConfiguration # type: ignore - from ._models import ConnectivityConfigurationListResult # type: ignore - from ._models import ConnectivityGroupItem # type: ignore - from ._models import DefaultAdminRule # type: ignore - from ._models import DefaultUserRule # type: ignore - from ._models import EffectiveBaseSecurityAdminRule # type: ignore - from ._models import EffectiveConnectivityConfiguration # type: ignore - from ._models import EffectiveDefaultSecurityAdminRule # type: ignore - from ._models import EffectiveSecurityAdminRule # type: ignore - from ._models import EffectiveVirtualNetwork # type: ignore - from ._models import EffectiveVirtualNetworksListResult # type: ignore - from ._models import EffectiveVirtualNetworksParameter # type: ignore - from ._models import GroupMembersItem # type: ignore - from ._models import Hub # type: ignore - from ._models import NetworkGroup # type: ignore - from ._models import NetworkGroupListResult # type: ignore - from ._models import NetworkManager # type: ignore - from ._models import NetworkManagerCommit # type: ignore - from ._models import NetworkManagerDeploymentStatus # type: ignore - from ._models import NetworkManagerDeploymentStatusListResult # type: ignore - from ._models import NetworkManagerDeploymentStatusParameter # type: ignore - from ._models import NetworkManagerEffectiveConnectivityConfigurationListResult # type: ignore - from ._models import NetworkManagerEffectiveSecurityAdminRulesListResult # type: ignore - from ._models import NetworkManagerListResult # type: ignore - from ._models import NetworkManagerPropertiesNetworkManagerScopes # type: ignore - from ._models import NetworkManagerSecurityGroupItem # type: ignore - from ._models import NetworkSecurityPerimeter # type: ignore - from ._models import NetworkSecurityPerimeterListResult # type: ignore - from ._models import PerimeterAssociableResource # type: ignore - from ._models import PerimeterAssociableResourcesListResult # type: ignore - from ._models import ProxyResource # type: ignore - from ._models import QueryRequestOptions # type: ignore - from ._models import Resource # type: ignore - from ._models import RuleCollection # type: ignore - from ._models import RuleCollectionListResult # type: ignore - from ._models import SecurityConfiguration # type: ignore - from ._models import SecurityConfigurationListResult # type: ignore - from ._models import SystemData # type: ignore - from ._models import TagsObject # type: ignore - from ._models import UserRule # type: ignore - from ._models import UserRuleListResult # type: ignore +from ._models_py3 import ActiveBaseSecurityAdminRule +from ._models_py3 import ActiveBaseSecurityUserRule +from ._models_py3 import ActiveConfigurationParameter +from ._models_py3 import ActiveConnectivityConfiguration +from ._models_py3 import ActiveConnectivityConfigurationsListResult +from ._models_py3 import ActiveDefaultSecurityAdminRule +from ._models_py3 import ActiveDefaultSecurityUserRule +from ._models_py3 import ActiveSecurityAdminRule +from ._models_py3 import ActiveSecurityAdminRulesListResult +from ._models_py3 import ActiveSecurityUserRule +from ._models_py3 import ActiveSecurityUserRulesListResult +from ._models_py3 import AddressPrefixItem +from ._models_py3 import AdminRule +from ._models_py3 import AdminRuleListResult +from ._models_py3 import BaseAdminRule +from ._models_py3 import BaseUserRule +from ._models_py3 import CloudErrorBody +from ._models_py3 import ConfigurationGroup +from ._models_py3 import ConnectivityConfiguration +from ._models_py3 import ConnectivityConfigurationListResult +from ._models_py3 import ConnectivityGroupItem +from ._models_py3 import CrossTenantScopes +from ._models_py3 import DefaultAdminRule +from ._models_py3 import DefaultUserRule +from ._models_py3 import EffectiveBaseSecurityAdminRule +from ._models_py3 import EffectiveConnectivityConfiguration +from ._models_py3 import EffectiveDefaultSecurityAdminRule +from ._models_py3 import EffectiveSecurityAdminRule +from ._models_py3 import EffectiveVirtualNetwork +from ._models_py3 import EffectiveVirtualNetworksListResult +from ._models_py3 import EffectiveVirtualNetworksParameter +from ._models_py3 import Hub +from ._models_py3 import NetworkGroup +from ._models_py3 import NetworkGroupListResult +from ._models_py3 import NetworkManager +from ._models_py3 import NetworkManagerCommit +from ._models_py3 import NetworkManagerConnection +from ._models_py3 import NetworkManagerConnectionListResult +from ._models_py3 import NetworkManagerDeploymentStatus +from ._models_py3 import NetworkManagerDeploymentStatusListResult +from ._models_py3 import NetworkManagerDeploymentStatusParameter +from ._models_py3 import NetworkManagerEffectiveConnectivityConfigurationListResult +from ._models_py3 import NetworkManagerEffectiveSecurityAdminRulesListResult +from ._models_py3 import NetworkManagerListResult +from ._models_py3 import NetworkManagerPropertiesNetworkManagerScopes +from ._models_py3 import NetworkManagerSecurityGroupItem +from ._models_py3 import PatchObject +from ._models_py3 import ProxyResource +from ._models_py3 import QueryRequestOptions +from ._models_py3 import Resource +from ._models_py3 import RuleCollection +from ._models_py3 import RuleCollectionListResult +from ._models_py3 import ScopeConnection +from ._models_py3 import ScopeConnectionListResult +from ._models_py3 import SecurityConfiguration +from ._models_py3 import SecurityConfigurationListResult +from ._models_py3 import StaticMember +from ._models_py3 import StaticMemberListResult +from ._models_py3 import SystemData +from ._models_py3 import UserRule +from ._models_py3 import UserRuleListResult + from ._network_management_client_enums import ( AddressPrefixType, @@ -141,7 +83,9 @@ GroupConnectivity, IsGlobal, MembershipType, + NetworkIntentPolicyBasedService, ProvisioningState, + ScopeConnectionState, SecurityConfigurationRuleAccess, SecurityConfigurationRuleDirection, SecurityConfigurationRuleProtocol, @@ -172,6 +116,7 @@ 'ConnectivityConfiguration', 'ConnectivityConfigurationListResult', 'ConnectivityGroupItem', + 'CrossTenantScopes', 'DefaultAdminRule', 'DefaultUserRule', 'EffectiveBaseSecurityAdminRule', @@ -181,12 +126,13 @@ 'EffectiveVirtualNetwork', 'EffectiveVirtualNetworksListResult', 'EffectiveVirtualNetworksParameter', - 'GroupMembersItem', 'Hub', 'NetworkGroup', 'NetworkGroupListResult', 'NetworkManager', 'NetworkManagerCommit', + 'NetworkManagerConnection', + 'NetworkManagerConnectionListResult', 'NetworkManagerDeploymentStatus', 'NetworkManagerDeploymentStatusListResult', 'NetworkManagerDeploymentStatusParameter', @@ -195,19 +141,19 @@ 'NetworkManagerListResult', 'NetworkManagerPropertiesNetworkManagerScopes', 'NetworkManagerSecurityGroupItem', - 'NetworkSecurityPerimeter', - 'NetworkSecurityPerimeterListResult', - 'PerimeterAssociableResource', - 'PerimeterAssociableResourcesListResult', + 'PatchObject', 'ProxyResource', 'QueryRequestOptions', 'Resource', 'RuleCollection', 'RuleCollectionListResult', + 'ScopeConnection', + 'ScopeConnectionListResult', 'SecurityConfiguration', 'SecurityConfigurationListResult', + 'StaticMember', + 'StaticMemberListResult', 'SystemData', - 'TagsObject', 'UserRule', 'UserRuleListResult', 'AddressPrefixType', @@ -223,7 +169,9 @@ 'GroupConnectivity', 'IsGlobal', 'MembershipType', + 'NetworkIntentPolicyBasedService', 'ProvisioningState', + 'ScopeConnectionState', 'SecurityConfigurationRuleAccess', 'SecurityConfigurationRuleDirection', 'SecurityConfigurationRuleProtocol', diff --git a/src/network-manager/azext_network_manager/vendored_sdks/models/_models.py b/src/network-manager/azext_network_manager/vendored_sdks/models/_models.py deleted file mode 100644 index f48bb0f58ba..00000000000 --- a/src/network-manager/azext_network_manager/vendored_sdks/models/_models.py +++ /dev/null @@ -1,2959 +0,0 @@ -# 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 msrest.serialization - - -class ActiveBaseSecurityAdminRule(msrest.serialization.Model): - """Network base admin rule. - - You probably want to use the sub-classes and not this class directly. Known - sub-classes are: ActiveSecurityAdminRule, ActiveDefaultSecurityAdminRule. - - All required parameters must be populated in order to send to Azure. - - :param id: Resource ID. - :type id: str - :param commit_time: Deployment time string. - :type commit_time: ~datetime.datetime - :param region: Deployment region. - :type region: str - :param configuration_display_name: A display name of the security admin configuration. - :type configuration_display_name: str - :param configuration_description: A description of the security admin configuration. - :type configuration_description: str - :param rule_collection_display_name: A display name of the rule collection. - :type rule_collection_display_name: str - :param rule_collection_description: A description of the rule collection. - :type rule_collection_description: str - :param rule_collection_applies_to_groups: Groups for rule collection. - :type rule_collection_applies_to_groups: - list[~azure.mgmt.network.v2021_02_01_preview.models.NetworkManagerSecurityGroupItem] - :param rule_groups: Effective configuration groups. - :type rule_groups: list[~azure.mgmt.network.v2021_02_01_preview.models.ConfigurationGroup] - :param kind: Required. Whether the rule is custom or default.Constant filled by server. - Possible values include: "Custom", "Default". - :type kind: str or ~azure.mgmt.network.v2021_02_01_preview.models.EffectiveAdminRuleKind - """ - - _validation = { - 'kind': {'required': True}, - } - - _attribute_map = { - 'id': {'key': 'id', 'type': 'str'}, - 'commit_time': {'key': 'commitTime', 'type': 'iso-8601'}, - 'region': {'key': 'region', 'type': 'str'}, - 'configuration_display_name': {'key': 'configurationDisplayName', 'type': 'str'}, - 'configuration_description': {'key': 'configurationDescription', 'type': 'str'}, - 'rule_collection_display_name': {'key': 'ruleCollectionDisplayName', 'type': 'str'}, - 'rule_collection_description': {'key': 'ruleCollectionDescription', 'type': 'str'}, - 'rule_collection_applies_to_groups': {'key': 'ruleCollectionAppliesToGroups', 'type': '[NetworkManagerSecurityGroupItem]'}, - 'rule_groups': {'key': 'ruleGroups', 'type': '[ConfigurationGroup]'}, - 'kind': {'key': 'kind', 'type': 'str'}, - } - - _subtype_map = { - 'kind': {'Custom': 'ActiveSecurityAdminRule', 'Default': 'ActiveDefaultSecurityAdminRule'} - } - - def __init__( - self, - **kwargs - ): - super(ActiveBaseSecurityAdminRule, self).__init__(**kwargs) - self.id = kwargs.get('id', None) - self.commit_time = kwargs.get('commit_time', None) - self.region = kwargs.get('region', None) - self.configuration_display_name = kwargs.get('configuration_display_name', None) - self.configuration_description = kwargs.get('configuration_description', None) - self.rule_collection_display_name = kwargs.get('rule_collection_display_name', None) - self.rule_collection_description = kwargs.get('rule_collection_description', None) - self.rule_collection_applies_to_groups = kwargs.get('rule_collection_applies_to_groups', None) - self.rule_groups = kwargs.get('rule_groups', None) - self.kind = None # type: Optional[str] - - -class ActiveBaseSecurityUserRule(msrest.serialization.Model): - """Network base rule. - - You probably want to use the sub-classes and not this class directly. Known - sub-classes are: ActiveSecurityUserRule, ActiveDefaultSecurityUserRule. - - All required parameters must be populated in order to send to Azure. - - :param id: Resource ID. - :type id: str - :param commit_time: Deployment time string. - :type commit_time: ~datetime.datetime - :param region: Deployment region. - :type region: str - :param configuration_display_name: A display name of the security user configuration. - :type configuration_display_name: str - :param configuration_description: A description of the security user configuration. - :type configuration_description: str - :param rule_collection_display_name: A display name of the rule collection. - :type rule_collection_display_name: str - :param rule_collection_description: A description of the rule collection. - :type rule_collection_description: str - :param rule_collection_applies_to_groups: Groups for rule collection. - :type rule_collection_applies_to_groups: - list[~azure.mgmt.network.v2021_02_01_preview.models.NetworkManagerSecurityGroupItem] - :param rule_groups: Effective configuration groups. - :type rule_groups: list[~azure.mgmt.network.v2021_02_01_preview.models.ConfigurationGroup] - :param kind: Required. Whether the rule is custom or default.Constant filled by server. - Possible values include: "Custom", "Default". - :type kind: str or ~azure.mgmt.network.v2021_02_01_preview.models.EffectiveUserRuleKind - """ - - _validation = { - 'kind': {'required': True}, - } - - _attribute_map = { - 'id': {'key': 'id', 'type': 'str'}, - 'commit_time': {'key': 'commitTime', 'type': 'iso-8601'}, - 'region': {'key': 'region', 'type': 'str'}, - 'configuration_display_name': {'key': 'configurationDisplayName', 'type': 'str'}, - 'configuration_description': {'key': 'configurationDescription', 'type': 'str'}, - 'rule_collection_display_name': {'key': 'ruleCollectionDisplayName', 'type': 'str'}, - 'rule_collection_description': {'key': 'ruleCollectionDescription', 'type': 'str'}, - 'rule_collection_applies_to_groups': {'key': 'ruleCollectionAppliesToGroups', 'type': '[NetworkManagerSecurityGroupItem]'}, - 'rule_groups': {'key': 'ruleGroups', 'type': '[ConfigurationGroup]'}, - 'kind': {'key': 'kind', 'type': 'str'}, - } - - _subtype_map = { - 'kind': {'Custom': 'ActiveSecurityUserRule', 'Default': 'ActiveDefaultSecurityUserRule'} - } - - def __init__( - self, - **kwargs - ): - super(ActiveBaseSecurityUserRule, self).__init__(**kwargs) - self.id = kwargs.get('id', None) - self.commit_time = kwargs.get('commit_time', None) - self.region = kwargs.get('region', None) - self.configuration_display_name = kwargs.get('configuration_display_name', None) - self.configuration_description = kwargs.get('configuration_description', None) - self.rule_collection_display_name = kwargs.get('rule_collection_display_name', None) - self.rule_collection_description = kwargs.get('rule_collection_description', None) - self.rule_collection_applies_to_groups = kwargs.get('rule_collection_applies_to_groups', None) - self.rule_groups = kwargs.get('rule_groups', None) - self.kind = None # type: Optional[str] - - -class ActiveConfigurationParameter(msrest.serialization.Model): - """Effective Virtual Networks Parameter. - - :param regions: List of regions. - :type regions: list[str] - :param skip_token: When present, the value can be passed to a subsequent query call (together - with the same query and scopes used in the current request) to retrieve the next page of data. - :type skip_token: str - """ - - _attribute_map = { - 'regions': {'key': 'regions', 'type': '[str]'}, - 'skip_token': {'key': 'skipToken', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(ActiveConfigurationParameter, self).__init__(**kwargs) - self.regions = kwargs.get('regions', None) - self.skip_token = kwargs.get('skip_token', None) - - -class EffectiveConnectivityConfiguration(msrest.serialization.Model): - """The network manager effective connectivity configuration. - - Variables are only populated by the server, and will be ignored when sending a request. - - :param id: Resource ID. - :type id: str - :param configuration_groups: Effective configuration groups. - :type configuration_groups: - list[~azure.mgmt.network.v2021_02_01_preview.models.ConfigurationGroup] - :param display_name: A friendly name for the resource. - :type display_name: str - :param description: A description of the connectivity configuration. - :type description: str - :param connectivity_topology: Connectivity topology type. Possible values include: - "HubAndSpoke", "Mesh". - :type connectivity_topology: str or - ~azure.mgmt.network.v2021_02_01_preview.models.ConnectivityTopology - :param hubs: List of hubItems. - :type hubs: list[~azure.mgmt.network.v2021_02_01_preview.models.Hub] - :param is_global: Flag if global mesh is supported. Possible values include: "False", "True". - :type is_global: str or ~azure.mgmt.network.v2021_02_01_preview.models.IsGlobal - :param applies_to_groups: Groups for configuration. - :type applies_to_groups: - list[~azure.mgmt.network.v2021_02_01_preview.models.ConnectivityGroupItem] - :ivar provisioning_state: The provisioning state of the connectivity configuration resource. - Possible values include: "Succeeded", "Updating", "Deleting", "Failed". - :vartype provisioning_state: str or - ~azure.mgmt.network.v2021_02_01_preview.models.ProvisioningState - :param delete_existing_peering: Flag if need to remove current existing peerings. Possible - values include: "False", "True". - :type delete_existing_peering: str or - ~azure.mgmt.network.v2021_02_01_preview.models.DeleteExistingPeering - """ - - _validation = { - 'provisioning_state': {'readonly': True}, - } - - _attribute_map = { - 'id': {'key': 'id', 'type': 'str'}, - 'configuration_groups': {'key': 'configurationGroups', 'type': '[ConfigurationGroup]'}, - 'display_name': {'key': 'properties.displayName', 'type': 'str'}, - 'description': {'key': 'properties.description', 'type': 'str'}, - 'connectivity_topology': {'key': 'properties.connectivityTopology', 'type': 'str'}, - 'hubs': {'key': 'properties.hubs', 'type': '[Hub]'}, - 'is_global': {'key': 'properties.isGlobal', 'type': 'str'}, - 'applies_to_groups': {'key': 'properties.appliesToGroups', 'type': '[ConnectivityGroupItem]'}, - 'provisioning_state': {'key': 'properties.provisioningState', 'type': 'str'}, - 'delete_existing_peering': {'key': 'properties.deleteExistingPeering', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(EffectiveConnectivityConfiguration, self).__init__(**kwargs) - self.id = kwargs.get('id', None) - self.configuration_groups = kwargs.get('configuration_groups', None) - self.display_name = kwargs.get('display_name', None) - self.description = kwargs.get('description', None) - self.connectivity_topology = kwargs.get('connectivity_topology', None) - self.hubs = kwargs.get('hubs', None) - self.is_global = kwargs.get('is_global', None) - self.applies_to_groups = kwargs.get('applies_to_groups', None) - self.provisioning_state = None - self.delete_existing_peering = kwargs.get('delete_existing_peering', None) - - -class ActiveConnectivityConfiguration(EffectiveConnectivityConfiguration): - """Active connectivity configuration. - - Variables are only populated by the server, and will be ignored when sending a request. - - :param id: Resource ID. - :type id: str - :param configuration_groups: Effective configuration groups. - :type configuration_groups: - list[~azure.mgmt.network.v2021_02_01_preview.models.ConfigurationGroup] - :param display_name: A friendly name for the resource. - :type display_name: str - :param description: A description of the connectivity configuration. - :type description: str - :param connectivity_topology: Connectivity topology type. Possible values include: - "HubAndSpoke", "Mesh". - :type connectivity_topology: str or - ~azure.mgmt.network.v2021_02_01_preview.models.ConnectivityTopology - :param hubs: List of hubItems. - :type hubs: list[~azure.mgmt.network.v2021_02_01_preview.models.Hub] - :param is_global: Flag if global mesh is supported. Possible values include: "False", "True". - :type is_global: str or ~azure.mgmt.network.v2021_02_01_preview.models.IsGlobal - :param applies_to_groups: Groups for configuration. - :type applies_to_groups: - list[~azure.mgmt.network.v2021_02_01_preview.models.ConnectivityGroupItem] - :ivar provisioning_state: The provisioning state of the connectivity configuration resource. - Possible values include: "Succeeded", "Updating", "Deleting", "Failed". - :vartype provisioning_state: str or - ~azure.mgmt.network.v2021_02_01_preview.models.ProvisioningState - :param delete_existing_peering: Flag if need to remove current existing peerings. Possible - values include: "False", "True". - :type delete_existing_peering: str or - ~azure.mgmt.network.v2021_02_01_preview.models.DeleteExistingPeering - :param commit_time: Deployment time string. - :type commit_time: ~datetime.datetime - :param region: Deployment region. - :type region: str - """ - - _validation = { - 'provisioning_state': {'readonly': True}, - } - - _attribute_map = { - 'id': {'key': 'id', 'type': 'str'}, - 'configuration_groups': {'key': 'configurationGroups', 'type': '[ConfigurationGroup]'}, - 'display_name': {'key': 'properties.displayName', 'type': 'str'}, - 'description': {'key': 'properties.description', 'type': 'str'}, - 'connectivity_topology': {'key': 'properties.connectivityTopology', 'type': 'str'}, - 'hubs': {'key': 'properties.hubs', 'type': '[Hub]'}, - 'is_global': {'key': 'properties.isGlobal', 'type': 'str'}, - 'applies_to_groups': {'key': 'properties.appliesToGroups', 'type': '[ConnectivityGroupItem]'}, - 'provisioning_state': {'key': 'properties.provisioningState', 'type': 'str'}, - 'delete_existing_peering': {'key': 'properties.deleteExistingPeering', 'type': 'str'}, - 'commit_time': {'key': 'commitTime', 'type': 'iso-8601'}, - 'region': {'key': 'region', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(ActiveConnectivityConfiguration, self).__init__(**kwargs) - self.commit_time = kwargs.get('commit_time', None) - self.region = kwargs.get('region', None) - - -class ActiveConnectivityConfigurationsListResult(msrest.serialization.Model): - """Result of the request to list active connectivity configurations. It contains a list of active connectivity configurations and a skiptoken to get the next set of results. - - :param value: Gets a page of active connectivity configurations. - :type value: - list[~azure.mgmt.network.v2021_02_01_preview.models.ActiveConnectivityConfiguration] - :param skip_token: When present, the value can be passed to a subsequent query call (together - with the same query and scopes used in the current request) to retrieve the next page of data. - :type skip_token: str - """ - - _attribute_map = { - 'value': {'key': 'value', 'type': '[ActiveConnectivityConfiguration]'}, - 'skip_token': {'key': 'skipToken', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(ActiveConnectivityConfigurationsListResult, self).__init__(**kwargs) - self.value = kwargs.get('value', None) - self.skip_token = kwargs.get('skip_token', None) - - -class ActiveDefaultSecurityAdminRule(ActiveBaseSecurityAdminRule): - """Network default admin rule. - - Variables are only populated by the server, and will be ignored when sending a request. - - All required parameters must be populated in order to send to Azure. - - :param id: Resource ID. - :type id: str - :param commit_time: Deployment time string. - :type commit_time: ~datetime.datetime - :param region: Deployment region. - :type region: str - :param configuration_display_name: A display name of the security admin configuration. - :type configuration_display_name: str - :param configuration_description: A description of the security admin configuration. - :type configuration_description: str - :param rule_collection_display_name: A display name of the rule collection. - :type rule_collection_display_name: str - :param rule_collection_description: A description of the rule collection. - :type rule_collection_description: str - :param rule_collection_applies_to_groups: Groups for rule collection. - :type rule_collection_applies_to_groups: - list[~azure.mgmt.network.v2021_02_01_preview.models.NetworkManagerSecurityGroupItem] - :param rule_groups: Effective configuration groups. - :type rule_groups: list[~azure.mgmt.network.v2021_02_01_preview.models.ConfigurationGroup] - :param kind: Required. Whether the rule is custom or default.Constant filled by server. - Possible values include: "Custom", "Default". - :type kind: str or ~azure.mgmt.network.v2021_02_01_preview.models.EffectiveAdminRuleKind - :ivar display_name: A friendly name for the rule. - :vartype display_name: str - :ivar description: A description for this rule. Restricted to 140 chars. - :vartype description: str - :param flag: Default rule flag. - :type flag: str - :ivar protocol: Network protocol this rule applies to. Possible values include: "Tcp", "Udp", - "Icmp", "Esp", "Any", "Ah". - :vartype protocol: str or - ~azure.mgmt.network.v2021_02_01_preview.models.SecurityConfigurationRuleProtocol - :ivar sources: The CIDR or source IP ranges. - :vartype sources: list[~azure.mgmt.network.v2021_02_01_preview.models.AddressPrefixItem] - :ivar destinations: The destination address prefixes. CIDR or destination IP ranges. - :vartype destinations: list[~azure.mgmt.network.v2021_02_01_preview.models.AddressPrefixItem] - :ivar source_port_ranges: The source port ranges. - :vartype source_port_ranges: list[str] - :ivar destination_port_ranges: The destination port ranges. - :vartype destination_port_ranges: list[str] - :ivar access: Indicates the access allowed for this particular rule. Possible values include: - "Allow", "Deny", "AlwaysAllow". - :vartype access: str or - ~azure.mgmt.network.v2021_02_01_preview.models.SecurityConfigurationRuleAccess - :ivar priority: The priority of the rule. The value can be between 1 and 4096. The priority - number must be unique for each rule in the collection. The lower the priority number, the - higher the priority of the rule. - :vartype priority: int - :ivar direction: Indicates if the traffic matched against the rule in inbound or outbound. - Possible values include: "Inbound", "Outbound". - :vartype direction: str or - ~azure.mgmt.network.v2021_02_01_preview.models.SecurityConfigurationRuleDirection - :ivar provisioning_state: The provisioning state of the resource. Possible values include: - "Succeeded", "Updating", "Deleting", "Failed". - :vartype provisioning_state: str or - ~azure.mgmt.network.v2021_02_01_preview.models.ProvisioningState - """ - - _validation = { - 'kind': {'required': True}, - 'display_name': {'readonly': True}, - 'description': {'readonly': True}, - 'protocol': {'readonly': True}, - 'sources': {'readonly': True}, - 'destinations': {'readonly': True}, - 'source_port_ranges': {'readonly': True}, - 'destination_port_ranges': {'readonly': True}, - 'access': {'readonly': True}, - 'priority': {'readonly': True}, - 'direction': {'readonly': True}, - 'provisioning_state': {'readonly': True}, - } - - _attribute_map = { - 'id': {'key': 'id', 'type': 'str'}, - 'commit_time': {'key': 'commitTime', 'type': 'iso-8601'}, - 'region': {'key': 'region', 'type': 'str'}, - 'configuration_display_name': {'key': 'configurationDisplayName', 'type': 'str'}, - 'configuration_description': {'key': 'configurationDescription', 'type': 'str'}, - 'rule_collection_display_name': {'key': 'ruleCollectionDisplayName', 'type': 'str'}, - 'rule_collection_description': {'key': 'ruleCollectionDescription', 'type': 'str'}, - 'rule_collection_applies_to_groups': {'key': 'ruleCollectionAppliesToGroups', 'type': '[NetworkManagerSecurityGroupItem]'}, - 'rule_groups': {'key': 'ruleGroups', 'type': '[ConfigurationGroup]'}, - 'kind': {'key': 'kind', 'type': 'str'}, - 'display_name': {'key': 'properties.displayName', 'type': 'str'}, - 'description': {'key': 'properties.description', 'type': 'str'}, - 'flag': {'key': 'properties.flag', 'type': 'str'}, - 'protocol': {'key': 'properties.protocol', 'type': 'str'}, - 'sources': {'key': 'properties.sources', 'type': '[AddressPrefixItem]'}, - 'destinations': {'key': 'properties.destinations', 'type': '[AddressPrefixItem]'}, - 'source_port_ranges': {'key': 'properties.sourcePortRanges', 'type': '[str]'}, - 'destination_port_ranges': {'key': 'properties.destinationPortRanges', 'type': '[str]'}, - 'access': {'key': 'properties.access', 'type': 'str'}, - 'priority': {'key': 'properties.priority', 'type': 'int'}, - 'direction': {'key': 'properties.direction', 'type': 'str'}, - 'provisioning_state': {'key': 'properties.provisioningState', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(ActiveDefaultSecurityAdminRule, self).__init__(**kwargs) - self.kind = 'Default' # type: str - self.display_name = None - self.description = None - self.flag = kwargs.get('flag', None) - self.protocol = None - self.sources = None - self.destinations = None - self.source_port_ranges = None - self.destination_port_ranges = None - self.access = None - self.priority = None - self.direction = None - self.provisioning_state = None - - -class ActiveDefaultSecurityUserRule(ActiveBaseSecurityUserRule): - """Network security default user rule. - - Variables are only populated by the server, and will be ignored when sending a request. - - All required parameters must be populated in order to send to Azure. - - :param id: Resource ID. - :type id: str - :param commit_time: Deployment time string. - :type commit_time: ~datetime.datetime - :param region: Deployment region. - :type region: str - :param configuration_display_name: A display name of the security user configuration. - :type configuration_display_name: str - :param configuration_description: A description of the security user configuration. - :type configuration_description: str - :param rule_collection_display_name: A display name of the rule collection. - :type rule_collection_display_name: str - :param rule_collection_description: A description of the rule collection. - :type rule_collection_description: str - :param rule_collection_applies_to_groups: Groups for rule collection. - :type rule_collection_applies_to_groups: - list[~azure.mgmt.network.v2021_02_01_preview.models.NetworkManagerSecurityGroupItem] - :param rule_groups: Effective configuration groups. - :type rule_groups: list[~azure.mgmt.network.v2021_02_01_preview.models.ConfigurationGroup] - :param kind: Required. Whether the rule is custom or default.Constant filled by server. - Possible values include: "Custom", "Default". - :type kind: str or ~azure.mgmt.network.v2021_02_01_preview.models.EffectiveUserRuleKind - :ivar display_name: A friendly name for the rule. - :vartype display_name: str - :ivar description: A description for this rule. Restricted to 140 chars. - :vartype description: str - :param flag: Default rule flag. - :type flag: str - :ivar protocol: Network protocol this rule applies to. Possible values include: "Tcp", "Udp", - "Icmp", "Esp", "Any", "Ah". - :vartype protocol: str or - ~azure.mgmt.network.v2021_02_01_preview.models.SecurityConfigurationRuleProtocol - :ivar sources: The CIDR or source IP ranges. - :vartype sources: list[~azure.mgmt.network.v2021_02_01_preview.models.AddressPrefixItem] - :ivar destinations: The destination address prefixes. CIDR or destination IP ranges. - :vartype destinations: list[~azure.mgmt.network.v2021_02_01_preview.models.AddressPrefixItem] - :ivar source_port_ranges: The source port ranges. - :vartype source_port_ranges: list[str] - :ivar destination_port_ranges: The destination port ranges. - :vartype destination_port_ranges: list[str] - :ivar direction: Indicates if the traffic matched against the rule in inbound or outbound. - Possible values include: "Inbound", "Outbound". - :vartype direction: str or - ~azure.mgmt.network.v2021_02_01_preview.models.SecurityConfigurationRuleDirection - :ivar provisioning_state: The provisioning state of the security configuration user rule - resource. Possible values include: "Succeeded", "Updating", "Deleting", "Failed". - :vartype provisioning_state: str or - ~azure.mgmt.network.v2021_02_01_preview.models.ProvisioningState - """ - - _validation = { - 'kind': {'required': True}, - 'display_name': {'readonly': True}, - 'description': {'readonly': True}, - 'protocol': {'readonly': True}, - 'sources': {'readonly': True}, - 'destinations': {'readonly': True}, - 'source_port_ranges': {'readonly': True}, - 'destination_port_ranges': {'readonly': True}, - 'direction': {'readonly': True}, - 'provisioning_state': {'readonly': True}, - } - - _attribute_map = { - 'id': {'key': 'id', 'type': 'str'}, - 'commit_time': {'key': 'commitTime', 'type': 'iso-8601'}, - 'region': {'key': 'region', 'type': 'str'}, - 'configuration_display_name': {'key': 'configurationDisplayName', 'type': 'str'}, - 'configuration_description': {'key': 'configurationDescription', 'type': 'str'}, - 'rule_collection_display_name': {'key': 'ruleCollectionDisplayName', 'type': 'str'}, - 'rule_collection_description': {'key': 'ruleCollectionDescription', 'type': 'str'}, - 'rule_collection_applies_to_groups': {'key': 'ruleCollectionAppliesToGroups', 'type': '[NetworkManagerSecurityGroupItem]'}, - 'rule_groups': {'key': 'ruleGroups', 'type': '[ConfigurationGroup]'}, - 'kind': {'key': 'kind', 'type': 'str'}, - 'display_name': {'key': 'properties.displayName', 'type': 'str'}, - 'description': {'key': 'properties.description', 'type': 'str'}, - 'flag': {'key': 'properties.flag', 'type': 'str'}, - 'protocol': {'key': 'properties.protocol', 'type': 'str'}, - 'sources': {'key': 'properties.sources', 'type': '[AddressPrefixItem]'}, - 'destinations': {'key': 'properties.destinations', 'type': '[AddressPrefixItem]'}, - 'source_port_ranges': {'key': 'properties.sourcePortRanges', 'type': '[str]'}, - 'destination_port_ranges': {'key': 'properties.destinationPortRanges', 'type': '[str]'}, - 'direction': {'key': 'properties.direction', 'type': 'str'}, - 'provisioning_state': {'key': 'properties.provisioningState', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(ActiveDefaultSecurityUserRule, self).__init__(**kwargs) - self.kind = 'Default' # type: str - self.display_name = None - self.description = None - self.flag = kwargs.get('flag', None) - self.protocol = None - self.sources = None - self.destinations = None - self.source_port_ranges = None - self.destination_port_ranges = None - self.direction = None - self.provisioning_state = None - - -class ActiveSecurityAdminRule(ActiveBaseSecurityAdminRule): - """Network admin rule. - - Variables are only populated by the server, and will be ignored when sending a request. - - All required parameters must be populated in order to send to Azure. - - :param id: Resource ID. - :type id: str - :param commit_time: Deployment time string. - :type commit_time: ~datetime.datetime - :param region: Deployment region. - :type region: str - :param configuration_display_name: A display name of the security admin configuration. - :type configuration_display_name: str - :param configuration_description: A description of the security admin configuration. - :type configuration_description: str - :param rule_collection_display_name: A display name of the rule collection. - :type rule_collection_display_name: str - :param rule_collection_description: A description of the rule collection. - :type rule_collection_description: str - :param rule_collection_applies_to_groups: Groups for rule collection. - :type rule_collection_applies_to_groups: - list[~azure.mgmt.network.v2021_02_01_preview.models.NetworkManagerSecurityGroupItem] - :param rule_groups: Effective configuration groups. - :type rule_groups: list[~azure.mgmt.network.v2021_02_01_preview.models.ConfigurationGroup] - :param kind: Required. Whether the rule is custom or default.Constant filled by server. - Possible values include: "Custom", "Default". - :type kind: str or ~azure.mgmt.network.v2021_02_01_preview.models.EffectiveAdminRuleKind - :param display_name: A friendly name for the rule. - :type display_name: str - :param description: A description for this rule. Restricted to 140 chars. - :type description: str - :param protocol: Network protocol this rule applies to. Possible values include: "Tcp", "Udp", - "Icmp", "Esp", "Any", "Ah". - :type protocol: str or - ~azure.mgmt.network.v2021_02_01_preview.models.SecurityConfigurationRuleProtocol - :param sources: The CIDR or source IP ranges. - :type sources: list[~azure.mgmt.network.v2021_02_01_preview.models.AddressPrefixItem] - :param destinations: The destination address prefixes. CIDR or destination IP ranges. - :type destinations: list[~azure.mgmt.network.v2021_02_01_preview.models.AddressPrefixItem] - :param source_port_ranges: The source port ranges. - :type source_port_ranges: list[str] - :param destination_port_ranges: The destination port ranges. - :type destination_port_ranges: list[str] - :param access: Indicates the access allowed for this particular rule. Possible values include: - "Allow", "Deny", "AlwaysAllow". - :type access: str or - ~azure.mgmt.network.v2021_02_01_preview.models.SecurityConfigurationRuleAccess - :param priority: The priority of the rule. The value can be between 1 and 4096. The priority - number must be unique for each rule in the collection. The lower the priority number, the - higher the priority of the rule. - :type priority: int - :param direction: Indicates if the traffic matched against the rule in inbound or outbound. - Possible values include: "Inbound", "Outbound". - :type direction: str or - ~azure.mgmt.network.v2021_02_01_preview.models.SecurityConfigurationRuleDirection - :ivar provisioning_state: The provisioning state of the resource. Possible values include: - "Succeeded", "Updating", "Deleting", "Failed". - :vartype provisioning_state: str or - ~azure.mgmt.network.v2021_02_01_preview.models.ProvisioningState - """ - - _validation = { - 'kind': {'required': True}, - 'priority': {'maximum': 4096, 'minimum': 1}, - 'provisioning_state': {'readonly': True}, - } - - _attribute_map = { - 'id': {'key': 'id', 'type': 'str'}, - 'commit_time': {'key': 'commitTime', 'type': 'iso-8601'}, - 'region': {'key': 'region', 'type': 'str'}, - 'configuration_display_name': {'key': 'configurationDisplayName', 'type': 'str'}, - 'configuration_description': {'key': 'configurationDescription', 'type': 'str'}, - 'rule_collection_display_name': {'key': 'ruleCollectionDisplayName', 'type': 'str'}, - 'rule_collection_description': {'key': 'ruleCollectionDescription', 'type': 'str'}, - 'rule_collection_applies_to_groups': {'key': 'ruleCollectionAppliesToGroups', 'type': '[NetworkManagerSecurityGroupItem]'}, - 'rule_groups': {'key': 'ruleGroups', 'type': '[ConfigurationGroup]'}, - 'kind': {'key': 'kind', 'type': 'str'}, - 'display_name': {'key': 'properties.displayName', 'type': 'str'}, - 'description': {'key': 'properties.description', 'type': 'str'}, - 'protocol': {'key': 'properties.protocol', 'type': 'str'}, - 'sources': {'key': 'properties.sources', 'type': '[AddressPrefixItem]'}, - 'destinations': {'key': 'properties.destinations', 'type': '[AddressPrefixItem]'}, - 'source_port_ranges': {'key': 'properties.sourcePortRanges', 'type': '[str]'}, - 'destination_port_ranges': {'key': 'properties.destinationPortRanges', 'type': '[str]'}, - 'access': {'key': 'properties.access', 'type': 'str'}, - 'priority': {'key': 'properties.priority', 'type': 'int'}, - 'direction': {'key': 'properties.direction', 'type': 'str'}, - 'provisioning_state': {'key': 'properties.provisioningState', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(ActiveSecurityAdminRule, self).__init__(**kwargs) - self.kind = 'Custom' # type: str - self.display_name = kwargs.get('display_name', None) - self.description = kwargs.get('description', None) - self.protocol = kwargs.get('protocol', None) - self.sources = kwargs.get('sources', None) - self.destinations = kwargs.get('destinations', None) - self.source_port_ranges = kwargs.get('source_port_ranges', None) - self.destination_port_ranges = kwargs.get('destination_port_ranges', None) - self.access = kwargs.get('access', None) - self.priority = kwargs.get('priority', None) - self.direction = kwargs.get('direction', None) - self.provisioning_state = None - - -class ActiveSecurityAdminRulesListResult(msrest.serialization.Model): - """Result of the request to list active security admin rules. It contains a list of active security admin rules and a skiptoken to get the next set of results. - - :param value: Gets a page of active security admin rules. - :type value: list[~azure.mgmt.network.v2021_02_01_preview.models.ActiveBaseSecurityAdminRule] - :param skip_token: When present, the value can be passed to a subsequent query call (together - with the same query and scopes used in the current request) to retrieve the next page of data. - :type skip_token: str - """ - - _attribute_map = { - 'value': {'key': 'value', 'type': '[ActiveBaseSecurityAdminRule]'}, - 'skip_token': {'key': 'skipToken', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(ActiveSecurityAdminRulesListResult, self).__init__(**kwargs) - self.value = kwargs.get('value', None) - self.skip_token = kwargs.get('skip_token', None) - - -class ActiveSecurityUserRule(ActiveBaseSecurityUserRule): - """Network security user rule. - - Variables are only populated by the server, and will be ignored when sending a request. - - All required parameters must be populated in order to send to Azure. - - :param id: Resource ID. - :type id: str - :param commit_time: Deployment time string. - :type commit_time: ~datetime.datetime - :param region: Deployment region. - :type region: str - :param configuration_display_name: A display name of the security user configuration. - :type configuration_display_name: str - :param configuration_description: A description of the security user configuration. - :type configuration_description: str - :param rule_collection_display_name: A display name of the rule collection. - :type rule_collection_display_name: str - :param rule_collection_description: A description of the rule collection. - :type rule_collection_description: str - :param rule_collection_applies_to_groups: Groups for rule collection. - :type rule_collection_applies_to_groups: - list[~azure.mgmt.network.v2021_02_01_preview.models.NetworkManagerSecurityGroupItem] - :param rule_groups: Effective configuration groups. - :type rule_groups: list[~azure.mgmt.network.v2021_02_01_preview.models.ConfigurationGroup] - :param kind: Required. Whether the rule is custom or default.Constant filled by server. - Possible values include: "Custom", "Default". - :type kind: str or ~azure.mgmt.network.v2021_02_01_preview.models.EffectiveUserRuleKind - :param display_name: A friendly name for the rule. - :type display_name: str - :param description: A description for this rule. - :type description: str - :param protocol: Network protocol this rule applies to. Possible values include: "Tcp", "Udp", - "Icmp", "Esp", "Any", "Ah". - :type protocol: str or - ~azure.mgmt.network.v2021_02_01_preview.models.SecurityConfigurationRuleProtocol - :param sources: The CIDR or source IP ranges. - :type sources: list[~azure.mgmt.network.v2021_02_01_preview.models.AddressPrefixItem] - :param destinations: The destination address prefixes. CIDR or destination IP ranges. - :type destinations: list[~azure.mgmt.network.v2021_02_01_preview.models.AddressPrefixItem] - :param source_port_ranges: The source port ranges. - :type source_port_ranges: list[str] - :param destination_port_ranges: The destination port ranges. - :type destination_port_ranges: list[str] - :param direction: Indicates if the traffic matched against the rule in inbound or outbound. - Possible values include: "Inbound", "Outbound". - :type direction: str or - ~azure.mgmt.network.v2021_02_01_preview.models.SecurityConfigurationRuleDirection - :ivar provisioning_state: The provisioning state of the security configuration user rule - resource. Possible values include: "Succeeded", "Updating", "Deleting", "Failed". - :vartype provisioning_state: str or - ~azure.mgmt.network.v2021_02_01_preview.models.ProvisioningState - """ - - _validation = { - 'kind': {'required': True}, - 'provisioning_state': {'readonly': True}, - } - - _attribute_map = { - 'id': {'key': 'id', 'type': 'str'}, - 'commit_time': {'key': 'commitTime', 'type': 'iso-8601'}, - 'region': {'key': 'region', 'type': 'str'}, - 'configuration_display_name': {'key': 'configurationDisplayName', 'type': 'str'}, - 'configuration_description': {'key': 'configurationDescription', 'type': 'str'}, - 'rule_collection_display_name': {'key': 'ruleCollectionDisplayName', 'type': 'str'}, - 'rule_collection_description': {'key': 'ruleCollectionDescription', 'type': 'str'}, - 'rule_collection_applies_to_groups': {'key': 'ruleCollectionAppliesToGroups', 'type': '[NetworkManagerSecurityGroupItem]'}, - 'rule_groups': {'key': 'ruleGroups', 'type': '[ConfigurationGroup]'}, - 'kind': {'key': 'kind', 'type': 'str'}, - 'display_name': {'key': 'properties.displayName', 'type': 'str'}, - 'description': {'key': 'properties.description', 'type': 'str'}, - 'protocol': {'key': 'properties.protocol', 'type': 'str'}, - 'sources': {'key': 'properties.sources', 'type': '[AddressPrefixItem]'}, - 'destinations': {'key': 'properties.destinations', 'type': '[AddressPrefixItem]'}, - 'source_port_ranges': {'key': 'properties.sourcePortRanges', 'type': '[str]'}, - 'destination_port_ranges': {'key': 'properties.destinationPortRanges', 'type': '[str]'}, - 'direction': {'key': 'properties.direction', 'type': 'str'}, - 'provisioning_state': {'key': 'properties.provisioningState', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(ActiveSecurityUserRule, self).__init__(**kwargs) - self.kind = 'Custom' # type: str - self.display_name = kwargs.get('display_name', None) - self.description = kwargs.get('description', None) - self.protocol = kwargs.get('protocol', None) - self.sources = kwargs.get('sources', None) - self.destinations = kwargs.get('destinations', None) - self.source_port_ranges = kwargs.get('source_port_ranges', None) - self.destination_port_ranges = kwargs.get('destination_port_ranges', None) - self.direction = kwargs.get('direction', None) - self.provisioning_state = None - - -class ActiveSecurityUserRulesListResult(msrest.serialization.Model): - """Result of the request to list active security user rules. It contains a list of active security user rules and a skiptoken to get the next set of results. - - :param value: Gets a page of active security user rules. - :type value: list[~azure.mgmt.network.v2021_02_01_preview.models.ActiveBaseSecurityUserRule] - :param skip_token: When present, the value can be passed to a subsequent query call (together - with the same query and scopes used in the current request) to retrieve the next page of data. - :type skip_token: str - """ - - _attribute_map = { - 'value': {'key': 'value', 'type': '[ActiveBaseSecurityUserRule]'}, - 'skip_token': {'key': 'skipToken', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(ActiveSecurityUserRulesListResult, self).__init__(**kwargs) - self.value = kwargs.get('value', None) - self.skip_token = kwargs.get('skip_token', None) - - -class AddressPrefixItem(msrest.serialization.Model): - """Address prefix item. - - :param address_prefix: Address prefix. - :type address_prefix: str - :param address_prefix_type: Address prefix type. Possible values include: "IPPrefix", - "ServiceTag". - :type address_prefix_type: str or - ~azure.mgmt.network.v2021_02_01_preview.models.AddressPrefixType - """ - - _attribute_map = { - 'address_prefix': {'key': 'addressPrefix', 'type': 'str'}, - 'address_prefix_type': {'key': 'addressPrefixType', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(AddressPrefixItem, self).__init__(**kwargs) - self.address_prefix = kwargs.get('address_prefix', None) - self.address_prefix_type = kwargs.get('address_prefix_type', None) - - -class ProxyResource(msrest.serialization.Model): - """Proxy resource representation. - - 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 etag: A unique read-only string that changes whenever the resource is updated. - :vartype etag: str - """ - - _validation = { - 'id': {'readonly': True}, - 'name': {'readonly': True}, - 'type': {'readonly': True}, - 'etag': {'readonly': True}, - } - - _attribute_map = { - 'id': {'key': 'id', 'type': 'str'}, - 'name': {'key': 'name', 'type': 'str'}, - 'type': {'key': 'type', 'type': 'str'}, - 'etag': {'key': 'etag', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(ProxyResource, self).__init__(**kwargs) - self.id = None - self.name = None - self.type = None - self.etag = None - - -class BaseAdminRule(ProxyResource): - """Network base admin rule. - - You probably want to use the sub-classes and not this class directly. Known - sub-classes are: AdminRule, DefaultAdminRule. - - Variables are only populated by the server, and will be ignored when sending a request. - - All required parameters must be populated in order to send to Azure. - - :ivar id: Resource ID. - :vartype id: str - :ivar name: Resource name. - :vartype name: str - :ivar type: Resource type. - :vartype type: str - :ivar etag: A unique read-only string that changes whenever the resource is updated. - :vartype etag: str - :param kind: Required. Whether the rule is custom or default.Constant filled by server. - Possible values include: "Custom", "Default". - :type kind: str or ~azure.mgmt.network.v2021_02_01_preview.models.AdminRuleKind - :ivar system_data: The system metadata related to this resource. - :vartype system_data: ~azure.mgmt.network.v2021_02_01_preview.models.SystemData - """ - - _validation = { - 'id': {'readonly': True}, - 'name': {'readonly': True}, - 'type': {'readonly': True}, - 'etag': {'readonly': True}, - 'kind': {'required': True}, - 'system_data': {'readonly': True}, - } - - _attribute_map = { - 'id': {'key': 'id', 'type': 'str'}, - 'name': {'key': 'name', 'type': 'str'}, - 'type': {'key': 'type', 'type': 'str'}, - 'etag': {'key': 'etag', 'type': 'str'}, - 'kind': {'key': 'kind', 'type': 'str'}, - 'system_data': {'key': 'systemData', 'type': 'SystemData'}, - } - - _subtype_map = { - 'kind': {'Custom': 'AdminRule', 'Default': 'DefaultAdminRule'} - } - - def __init__( - self, - **kwargs - ): - super(BaseAdminRule, self).__init__(**kwargs) - self.kind = 'BaseAdminRule' # type: str - self.system_data = None - - -class AdminRule(BaseAdminRule): - """Network admin rule. - - Variables are only populated by the server, and will be ignored when sending a request. - - All required parameters must be populated in order to send to Azure. - - :ivar id: Resource ID. - :vartype id: str - :ivar name: Resource name. - :vartype name: str - :ivar type: Resource type. - :vartype type: str - :ivar etag: A unique read-only string that changes whenever the resource is updated. - :vartype etag: str - :param kind: Required. Whether the rule is custom or default.Constant filled by server. - Possible values include: "Custom", "Default". - :type kind: str or ~azure.mgmt.network.v2021_02_01_preview.models.AdminRuleKind - :ivar system_data: The system metadata related to this resource. - :vartype system_data: ~azure.mgmt.network.v2021_02_01_preview.models.SystemData - :param display_name: A friendly name for the rule. - :type display_name: str - :param description: A description for this rule. Restricted to 140 chars. - :type description: str - :param protocol: Network protocol this rule applies to. Possible values include: "Tcp", "Udp", - "Icmp", "Esp", "Any", "Ah". - :type protocol: str or - ~azure.mgmt.network.v2021_02_01_preview.models.SecurityConfigurationRuleProtocol - :param sources: The CIDR or source IP ranges. - :type sources: list[~azure.mgmt.network.v2021_02_01_preview.models.AddressPrefixItem] - :param destinations: The destination address prefixes. CIDR or destination IP ranges. - :type destinations: list[~azure.mgmt.network.v2021_02_01_preview.models.AddressPrefixItem] - :param source_port_ranges: The source port ranges. - :type source_port_ranges: list[str] - :param destination_port_ranges: The destination port ranges. - :type destination_port_ranges: list[str] - :param access: Indicates the access allowed for this particular rule. Possible values include: - "Allow", "Deny", "AlwaysAllow". - :type access: str or - ~azure.mgmt.network.v2021_02_01_preview.models.SecurityConfigurationRuleAccess - :param priority: The priority of the rule. The value can be between 1 and 4096. The priority - number must be unique for each rule in the collection. The lower the priority number, the - higher the priority of the rule. - :type priority: int - :param direction: Indicates if the traffic matched against the rule in inbound or outbound. - Possible values include: "Inbound", "Outbound". - :type direction: str or - ~azure.mgmt.network.v2021_02_01_preview.models.SecurityConfigurationRuleDirection - :ivar provisioning_state: The provisioning state of the resource. Possible values include: - "Succeeded", "Updating", "Deleting", "Failed". - :vartype provisioning_state: str or - ~azure.mgmt.network.v2021_02_01_preview.models.ProvisioningState - """ - - _validation = { - 'id': {'readonly': True}, - 'name': {'readonly': True}, - 'type': {'readonly': True}, - 'etag': {'readonly': True}, - 'kind': {'required': True}, - 'system_data': {'readonly': True}, - 'priority': {'maximum': 4096, 'minimum': 1}, - 'provisioning_state': {'readonly': True}, - } - - _attribute_map = { - 'id': {'key': 'id', 'type': 'str'}, - 'name': {'key': 'name', 'type': 'str'}, - 'type': {'key': 'type', 'type': 'str'}, - 'etag': {'key': 'etag', 'type': 'str'}, - 'kind': {'key': 'kind', 'type': 'str'}, - 'system_data': {'key': 'systemData', 'type': 'SystemData'}, - 'display_name': {'key': 'properties.displayName', 'type': 'str'}, - 'description': {'key': 'properties.description', 'type': 'str'}, - 'protocol': {'key': 'properties.protocol', 'type': 'str'}, - 'sources': {'key': 'properties.sources', 'type': '[AddressPrefixItem]'}, - 'destinations': {'key': 'properties.destinations', 'type': '[AddressPrefixItem]'}, - 'source_port_ranges': {'key': 'properties.sourcePortRanges', 'type': '[str]'}, - 'destination_port_ranges': {'key': 'properties.destinationPortRanges', 'type': '[str]'}, - 'access': {'key': 'properties.access', 'type': 'str'}, - 'priority': {'key': 'properties.priority', 'type': 'int'}, - 'direction': {'key': 'properties.direction', 'type': 'str'}, - 'provisioning_state': {'key': 'properties.provisioningState', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(AdminRule, self).__init__(**kwargs) - self.kind = 'Custom' # type: str - self.display_name = kwargs.get('display_name', None) - self.description = kwargs.get('description', None) - self.protocol = kwargs.get('protocol', None) - self.sources = kwargs.get('sources', None) - self.destinations = kwargs.get('destinations', None) - self.source_port_ranges = kwargs.get('source_port_ranges', None) - self.destination_port_ranges = kwargs.get('destination_port_ranges', None) - self.access = kwargs.get('access', None) - self.priority = kwargs.get('priority', None) - self.direction = kwargs.get('direction', None) - self.provisioning_state = None - - -class AdminRuleListResult(msrest.serialization.Model): - """security configuration admin rule list result. - - :param value: A list of admin rules. - :type value: list[~azure.mgmt.network.v2021_02_01_preview.models.BaseAdminRule] - :param next_link: The URL to get the next set of results. - :type next_link: str - """ - - _attribute_map = { - 'value': {'key': 'value', 'type': '[BaseAdminRule]'}, - 'next_link': {'key': 'nextLink', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(AdminRuleListResult, self).__init__(**kwargs) - self.value = kwargs.get('value', None) - self.next_link = kwargs.get('next_link', None) - - -class BaseUserRule(ProxyResource): - """Network base rule. - - You probably want to use the sub-classes and not this class directly. Known - sub-classes are: UserRule, DefaultUserRule. - - Variables are only populated by the server, and will be ignored when sending a request. - - All required parameters must be populated in order to send to Azure. - - :ivar id: Resource ID. - :vartype id: str - :ivar name: Resource name. - :vartype name: str - :ivar type: Resource type. - :vartype type: str - :ivar etag: A unique read-only string that changes whenever the resource is updated. - :vartype etag: str - :param kind: Required. Whether the rule is custom or default.Constant filled by server. - Possible values include: "Custom", "Default". - :type kind: str or ~azure.mgmt.network.v2021_02_01_preview.models.UserRuleKind - :ivar system_data: The system metadata related to this resource. - :vartype system_data: ~azure.mgmt.network.v2021_02_01_preview.models.SystemData - """ - - _validation = { - 'id': {'readonly': True}, - 'name': {'readonly': True}, - 'type': {'readonly': True}, - 'etag': {'readonly': True}, - 'kind': {'required': True}, - 'system_data': {'readonly': True}, - } - - _attribute_map = { - 'id': {'key': 'id', 'type': 'str'}, - 'name': {'key': 'name', 'type': 'str'}, - 'type': {'key': 'type', 'type': 'str'}, - 'etag': {'key': 'etag', 'type': 'str'}, - 'kind': {'key': 'kind', 'type': 'str'}, - 'system_data': {'key': 'systemData', 'type': 'SystemData'}, - } - - _subtype_map = { - 'kind': {'Custom': 'UserRule', 'Default': 'DefaultUserRule'} - } - - def __init__( - self, - **kwargs - ): - super(BaseUserRule, self).__init__(**kwargs) - self.kind = 'BaseUserRule' # type: str - self.system_data = None - - -class CloudErrorBody(msrest.serialization.Model): - """An error response from the service. - - :param code: An identifier for the error. Codes are invariant and are intended to be consumed - programmatically. - :type code: str - :param message: A message describing the error, intended to be suitable for display in a user - interface. - :type message: str - :param target: The target of the particular error. For example, the name of the property in - error. - :type target: str - :param details: A list of additional details about the error. - :type details: list[~azure.mgmt.network.v2021_02_01_preview.models.CloudErrorBody] - """ - - _attribute_map = { - 'code': {'key': 'code', 'type': 'str'}, - 'message': {'key': 'message', 'type': 'str'}, - 'target': {'key': 'target', 'type': 'str'}, - 'details': {'key': 'details', 'type': '[CloudErrorBody]'}, - } - - def __init__( - self, - **kwargs - ): - super(CloudErrorBody, self).__init__(**kwargs) - self.code = kwargs.get('code', None) - self.message = kwargs.get('message', None) - self.target = kwargs.get('target', None) - self.details = kwargs.get('details', None) - - -class ConfigurationGroup(msrest.serialization.Model): - """The network configuration group resource. - - Variables are only populated by the server, and will be ignored when sending a request. - - :param id: Resource ID. - :type id: str - :param display_name: A friendly name for the network group. - :type display_name: str - :param description: A description of the network group. - :type description: str - :param member_type: Group member type. - :type member_type: str - :param group_members: Group members of network group. - :type group_members: list[~azure.mgmt.network.v2021_02_01_preview.models.GroupMembersItem] - :param conditional_membership: Network group conditional filter. - :type conditional_membership: str - :ivar provisioning_state: The provisioning state of the scope assignment resource. Possible - values include: "Succeeded", "Updating", "Deleting", "Failed". - :vartype provisioning_state: str or - ~azure.mgmt.network.v2021_02_01_preview.models.ProvisioningState - """ - - _validation = { - 'provisioning_state': {'readonly': True}, - } - - _attribute_map = { - 'id': {'key': 'id', 'type': 'str'}, - 'display_name': {'key': 'properties.displayName', 'type': 'str'}, - 'description': {'key': 'properties.description', 'type': 'str'}, - 'member_type': {'key': 'properties.memberType', 'type': 'str'}, - 'group_members': {'key': 'properties.groupMembers', 'type': '[GroupMembersItem]'}, - 'conditional_membership': {'key': 'properties.conditionalMembership', 'type': 'str'}, - 'provisioning_state': {'key': 'properties.provisioningState', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(ConfigurationGroup, self).__init__(**kwargs) - self.id = kwargs.get('id', None) - self.display_name = kwargs.get('display_name', None) - self.description = kwargs.get('description', None) - self.member_type = kwargs.get('member_type', None) - self.group_members = kwargs.get('group_members', None) - self.conditional_membership = kwargs.get('conditional_membership', None) - self.provisioning_state = None - - -class ConnectivityConfiguration(ProxyResource): - """The network manager connectivity configuration 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 etag: A unique read-only string that changes whenever the resource is updated. - :vartype etag: str - :ivar system_data: The system metadata related to this resource. - :vartype system_data: ~azure.mgmt.network.v2021_02_01_preview.models.SystemData - :param display_name: A friendly name for the resource. - :type display_name: str - :param description: A description of the connectivity configuration. - :type description: str - :param connectivity_topology: Connectivity topology type. Possible values include: - "HubAndSpoke", "Mesh". - :type connectivity_topology: str or - ~azure.mgmt.network.v2021_02_01_preview.models.ConnectivityTopology - :param hubs: List of hubItems. - :type hubs: list[~azure.mgmt.network.v2021_02_01_preview.models.Hub] - :param is_global: Flag if global mesh is supported. Possible values include: "False", "True". - :type is_global: str or ~azure.mgmt.network.v2021_02_01_preview.models.IsGlobal - :param applies_to_groups: Groups for configuration. - :type applies_to_groups: - list[~azure.mgmt.network.v2021_02_01_preview.models.ConnectivityGroupItem] - :ivar provisioning_state: The provisioning state of the connectivity configuration resource. - Possible values include: "Succeeded", "Updating", "Deleting", "Failed". - :vartype provisioning_state: str or - ~azure.mgmt.network.v2021_02_01_preview.models.ProvisioningState - :param delete_existing_peering: Flag if need to remove current existing peerings. Possible - values include: "False", "True". - :type delete_existing_peering: str or - ~azure.mgmt.network.v2021_02_01_preview.models.DeleteExistingPeering - """ - - _validation = { - 'id': {'readonly': True}, - 'name': {'readonly': True}, - 'type': {'readonly': True}, - 'etag': {'readonly': True}, - 'system_data': {'readonly': True}, - 'provisioning_state': {'readonly': True}, - } - - _attribute_map = { - 'id': {'key': 'id', 'type': 'str'}, - 'name': {'key': 'name', 'type': 'str'}, - 'type': {'key': 'type', 'type': 'str'}, - 'etag': {'key': 'etag', 'type': 'str'}, - 'system_data': {'key': 'systemData', 'type': 'SystemData'}, - 'display_name': {'key': 'properties.displayName', 'type': 'str'}, - 'description': {'key': 'properties.description', 'type': 'str'}, - 'connectivity_topology': {'key': 'properties.connectivityTopology', 'type': 'str'}, - 'hubs': {'key': 'properties.hubs', 'type': '[Hub]'}, - 'is_global': {'key': 'properties.isGlobal', 'type': 'str'}, - 'applies_to_groups': {'key': 'properties.appliesToGroups', 'type': '[ConnectivityGroupItem]'}, - 'provisioning_state': {'key': 'properties.provisioningState', 'type': 'str'}, - 'delete_existing_peering': {'key': 'properties.deleteExistingPeering', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(ConnectivityConfiguration, self).__init__(**kwargs) - self.system_data = None - self.display_name = kwargs.get('display_name', None) - self.description = kwargs.get('description', None) - self.connectivity_topology = kwargs.get('connectivity_topology', None) - self.hubs = kwargs.get('hubs', None) - self.is_global = kwargs.get('is_global', None) - self.applies_to_groups = kwargs.get('applies_to_groups', None) - self.provisioning_state = None - self.delete_existing_peering = kwargs.get('delete_existing_peering', None) - - -class ConnectivityConfigurationListResult(msrest.serialization.Model): - """Result of the request to list network manager connectivity configurations. It contains a list of configurations and a link to get the next set of results. - - :param value: Gets a page of Connectivity Configurations. - :type value: list[~azure.mgmt.network.v2021_02_01_preview.models.ConnectivityConfiguration] - :param next_link: Gets the URL to get the next page of results. - :type next_link: str - """ - - _attribute_map = { - 'value': {'key': 'value', 'type': '[ConnectivityConfiguration]'}, - 'next_link': {'key': 'nextLink', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(ConnectivityConfigurationListResult, self).__init__(**kwargs) - self.value = kwargs.get('value', None) - self.next_link = kwargs.get('next_link', None) - - -class ConnectivityGroupItem(msrest.serialization.Model): - """ConnectivityGroupItem. - - :param network_group_id: Network group Id. - :type network_group_id: str - :param use_hub_gateway: Flag if need to use hub gateway. Possible values include: "False", - "True". - :type use_hub_gateway: str or ~azure.mgmt.network.v2021_02_01_preview.models.UseHubGateway - :param is_global: Flag if global is supported. Possible values include: "False", "True". - :type is_global: str or ~azure.mgmt.network.v2021_02_01_preview.models.IsGlobal - :param group_connectivity: Group connectivity type. Possible values include: "None", - "DirectlyConnected". - :type group_connectivity: str or - ~azure.mgmt.network.v2021_02_01_preview.models.GroupConnectivity - """ - - _attribute_map = { - 'network_group_id': {'key': 'networkGroupId', 'type': 'str'}, - 'use_hub_gateway': {'key': 'useHubGateway', 'type': 'str'}, - 'is_global': {'key': 'isGlobal', 'type': 'str'}, - 'group_connectivity': {'key': 'groupConnectivity', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(ConnectivityGroupItem, self).__init__(**kwargs) - self.network_group_id = kwargs.get('network_group_id', None) - self.use_hub_gateway = kwargs.get('use_hub_gateway', None) - self.is_global = kwargs.get('is_global', None) - self.group_connectivity = kwargs.get('group_connectivity', None) - - -class DefaultAdminRule(BaseAdminRule): - """Network default admin rule. - - Variables are only populated by the server, and will be ignored when sending a request. - - All required parameters must be populated in order to send to Azure. - - :ivar id: Resource ID. - :vartype id: str - :ivar name: Resource name. - :vartype name: str - :ivar type: Resource type. - :vartype type: str - :ivar etag: A unique read-only string that changes whenever the resource is updated. - :vartype etag: str - :param kind: Required. Whether the rule is custom or default.Constant filled by server. - Possible values include: "Custom", "Default". - :type kind: str or ~azure.mgmt.network.v2021_02_01_preview.models.AdminRuleKind - :ivar system_data: The system metadata related to this resource. - :vartype system_data: ~azure.mgmt.network.v2021_02_01_preview.models.SystemData - :ivar display_name: A friendly name for the rule. - :vartype display_name: str - :ivar description: A description for this rule. Restricted to 140 chars. - :vartype description: str - :param flag: Default rule flag. - :type flag: str - :ivar protocol: Network protocol this rule applies to. Possible values include: "Tcp", "Udp", - "Icmp", "Esp", "Any", "Ah". - :vartype protocol: str or - ~azure.mgmt.network.v2021_02_01_preview.models.SecurityConfigurationRuleProtocol - :ivar sources: The CIDR or source IP ranges. - :vartype sources: list[~azure.mgmt.network.v2021_02_01_preview.models.AddressPrefixItem] - :ivar destinations: The destination address prefixes. CIDR or destination IP ranges. - :vartype destinations: list[~azure.mgmt.network.v2021_02_01_preview.models.AddressPrefixItem] - :ivar source_port_ranges: The source port ranges. - :vartype source_port_ranges: list[str] - :ivar destination_port_ranges: The destination port ranges. - :vartype destination_port_ranges: list[str] - :ivar access: Indicates the access allowed for this particular rule. Possible values include: - "Allow", "Deny", "AlwaysAllow". - :vartype access: str or - ~azure.mgmt.network.v2021_02_01_preview.models.SecurityConfigurationRuleAccess - :ivar priority: The priority of the rule. The value can be between 1 and 4096. The priority - number must be unique for each rule in the collection. The lower the priority number, the - higher the priority of the rule. - :vartype priority: int - :ivar direction: Indicates if the traffic matched against the rule in inbound or outbound. - Possible values include: "Inbound", "Outbound". - :vartype direction: str or - ~azure.mgmt.network.v2021_02_01_preview.models.SecurityConfigurationRuleDirection - :ivar provisioning_state: The provisioning state of the resource. Possible values include: - "Succeeded", "Updating", "Deleting", "Failed". - :vartype provisioning_state: str or - ~azure.mgmt.network.v2021_02_01_preview.models.ProvisioningState - """ - - _validation = { - 'id': {'readonly': True}, - 'name': {'readonly': True}, - 'type': {'readonly': True}, - 'etag': {'readonly': True}, - 'kind': {'required': True}, - 'system_data': {'readonly': True}, - 'display_name': {'readonly': True}, - 'description': {'readonly': True}, - 'protocol': {'readonly': True}, - 'sources': {'readonly': True}, - 'destinations': {'readonly': True}, - 'source_port_ranges': {'readonly': True}, - 'destination_port_ranges': {'readonly': True}, - 'access': {'readonly': True}, - 'priority': {'readonly': True}, - 'direction': {'readonly': True}, - 'provisioning_state': {'readonly': True}, - } - - _attribute_map = { - 'id': {'key': 'id', 'type': 'str'}, - 'name': {'key': 'name', 'type': 'str'}, - 'type': {'key': 'type', 'type': 'str'}, - 'etag': {'key': 'etag', 'type': 'str'}, - 'kind': {'key': 'kind', 'type': 'str'}, - 'system_data': {'key': 'systemData', 'type': 'SystemData'}, - 'display_name': {'key': 'properties.displayName', 'type': 'str'}, - 'description': {'key': 'properties.description', 'type': 'str'}, - 'flag': {'key': 'properties.flag', 'type': 'str'}, - 'protocol': {'key': 'properties.protocol', 'type': 'str'}, - 'sources': {'key': 'properties.sources', 'type': '[AddressPrefixItem]'}, - 'destinations': {'key': 'properties.destinations', 'type': '[AddressPrefixItem]'}, - 'source_port_ranges': {'key': 'properties.sourcePortRanges', 'type': '[str]'}, - 'destination_port_ranges': {'key': 'properties.destinationPortRanges', 'type': '[str]'}, - 'access': {'key': 'properties.access', 'type': 'str'}, - 'priority': {'key': 'properties.priority', 'type': 'int'}, - 'direction': {'key': 'properties.direction', 'type': 'str'}, - 'provisioning_state': {'key': 'properties.provisioningState', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(DefaultAdminRule, self).__init__(**kwargs) - self.kind = 'Default' # type: str - self.display_name = None - self.description = None - self.flag = kwargs.get('flag', None) - self.protocol = None - self.sources = None - self.destinations = None - self.source_port_ranges = None - self.destination_port_ranges = None - self.access = None - self.priority = None - self.direction = None - self.provisioning_state = None - - -class DefaultUserRule(BaseUserRule): - """Network security default user rule. - - Variables are only populated by the server, and will be ignored when sending a request. - - All required parameters must be populated in order to send to Azure. - - :ivar id: Resource ID. - :vartype id: str - :ivar name: Resource name. - :vartype name: str - :ivar type: Resource type. - :vartype type: str - :ivar etag: A unique read-only string that changes whenever the resource is updated. - :vartype etag: str - :param kind: Required. Whether the rule is custom or default.Constant filled by server. - Possible values include: "Custom", "Default". - :type kind: str or ~azure.mgmt.network.v2021_02_01_preview.models.UserRuleKind - :ivar system_data: The system metadata related to this resource. - :vartype system_data: ~azure.mgmt.network.v2021_02_01_preview.models.SystemData - :ivar display_name: A friendly name for the rule. - :vartype display_name: str - :ivar description: A description for this rule. Restricted to 140 chars. - :vartype description: str - :param flag: Default rule flag. - :type flag: str - :ivar protocol: Network protocol this rule applies to. Possible values include: "Tcp", "Udp", - "Icmp", "Esp", "Any", "Ah". - :vartype protocol: str or - ~azure.mgmt.network.v2021_02_01_preview.models.SecurityConfigurationRuleProtocol - :ivar sources: The CIDR or source IP ranges. - :vartype sources: list[~azure.mgmt.network.v2021_02_01_preview.models.AddressPrefixItem] - :ivar destinations: The destination address prefixes. CIDR or destination IP ranges. - :vartype destinations: list[~azure.mgmt.network.v2021_02_01_preview.models.AddressPrefixItem] - :ivar source_port_ranges: The source port ranges. - :vartype source_port_ranges: list[str] - :ivar destination_port_ranges: The destination port ranges. - :vartype destination_port_ranges: list[str] - :ivar direction: Indicates if the traffic matched against the rule in inbound or outbound. - Possible values include: "Inbound", "Outbound". - :vartype direction: str or - ~azure.mgmt.network.v2021_02_01_preview.models.SecurityConfigurationRuleDirection - :ivar provisioning_state: The provisioning state of the security configuration user rule - resource. Possible values include: "Succeeded", "Updating", "Deleting", "Failed". - :vartype provisioning_state: str or - ~azure.mgmt.network.v2021_02_01_preview.models.ProvisioningState - """ - - _validation = { - 'id': {'readonly': True}, - 'name': {'readonly': True}, - 'type': {'readonly': True}, - 'etag': {'readonly': True}, - 'kind': {'required': True}, - 'system_data': {'readonly': True}, - 'display_name': {'readonly': True}, - 'description': {'readonly': True}, - 'protocol': {'readonly': True}, - 'sources': {'readonly': True}, - 'destinations': {'readonly': True}, - 'source_port_ranges': {'readonly': True}, - 'destination_port_ranges': {'readonly': True}, - 'direction': {'readonly': True}, - 'provisioning_state': {'readonly': True}, - } - - _attribute_map = { - 'id': {'key': 'id', 'type': 'str'}, - 'name': {'key': 'name', 'type': 'str'}, - 'type': {'key': 'type', 'type': 'str'}, - 'etag': {'key': 'etag', 'type': 'str'}, - 'kind': {'key': 'kind', 'type': 'str'}, - 'system_data': {'key': 'systemData', 'type': 'SystemData'}, - 'display_name': {'key': 'properties.displayName', 'type': 'str'}, - 'description': {'key': 'properties.description', 'type': 'str'}, - 'flag': {'key': 'properties.flag', 'type': 'str'}, - 'protocol': {'key': 'properties.protocol', 'type': 'str'}, - 'sources': {'key': 'properties.sources', 'type': '[AddressPrefixItem]'}, - 'destinations': {'key': 'properties.destinations', 'type': '[AddressPrefixItem]'}, - 'source_port_ranges': {'key': 'properties.sourcePortRanges', 'type': '[str]'}, - 'destination_port_ranges': {'key': 'properties.destinationPortRanges', 'type': '[str]'}, - 'direction': {'key': 'properties.direction', 'type': 'str'}, - 'provisioning_state': {'key': 'properties.provisioningState', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(DefaultUserRule, self).__init__(**kwargs) - self.kind = 'Default' # type: str - self.display_name = None - self.description = None - self.flag = kwargs.get('flag', None) - self.protocol = None - self.sources = None - self.destinations = None - self.source_port_ranges = None - self.destination_port_ranges = None - self.direction = None - self.provisioning_state = None - - -class EffectiveBaseSecurityAdminRule(msrest.serialization.Model): - """Network base admin rule. - - You probably want to use the sub-classes and not this class directly. Known - sub-classes are: EffectiveSecurityAdminRule, EffectiveDefaultSecurityAdminRule. - - All required parameters must be populated in order to send to Azure. - - :param id: Resource ID. - :type id: str - :param configuration_display_name: A display name of the security admin configuration. - :type configuration_display_name: str - :param configuration_description: A description of the security admin configuration. - :type configuration_description: str - :param rule_collection_display_name: A display name of the rule collection. - :type rule_collection_display_name: str - :param rule_collection_description: A description of the rule collection. - :type rule_collection_description: str - :param rule_collection_applies_to_groups: Groups for rule collection. - :type rule_collection_applies_to_groups: - list[~azure.mgmt.network.v2021_02_01_preview.models.NetworkManagerSecurityGroupItem] - :param rule_groups: Effective configuration groups. - :type rule_groups: list[~azure.mgmt.network.v2021_02_01_preview.models.ConfigurationGroup] - :param kind: Required. Whether the rule is custom or default.Constant filled by server. - Possible values include: "Custom", "Default". - :type kind: str or ~azure.mgmt.network.v2021_02_01_preview.models.EffectiveAdminRuleKind - """ - - _validation = { - 'kind': {'required': True}, - } - - _attribute_map = { - 'id': {'key': 'id', 'type': 'str'}, - 'configuration_display_name': {'key': 'configurationDisplayName', 'type': 'str'}, - 'configuration_description': {'key': 'configurationDescription', 'type': 'str'}, - 'rule_collection_display_name': {'key': 'ruleCollectionDisplayName', 'type': 'str'}, - 'rule_collection_description': {'key': 'ruleCollectionDescription', 'type': 'str'}, - 'rule_collection_applies_to_groups': {'key': 'ruleCollectionAppliesToGroups', 'type': '[NetworkManagerSecurityGroupItem]'}, - 'rule_groups': {'key': 'ruleGroups', 'type': '[ConfigurationGroup]'}, - 'kind': {'key': 'kind', 'type': 'str'}, - } - - _subtype_map = { - 'kind': {'Custom': 'EffectiveSecurityAdminRule', 'Default': 'EffectiveDefaultSecurityAdminRule'} - } - - def __init__( - self, - **kwargs - ): - super(EffectiveBaseSecurityAdminRule, self).__init__(**kwargs) - self.id = kwargs.get('id', None) - self.configuration_display_name = kwargs.get('configuration_display_name', None) - self.configuration_description = kwargs.get('configuration_description', None) - self.rule_collection_display_name = kwargs.get('rule_collection_display_name', None) - self.rule_collection_description = kwargs.get('rule_collection_description', None) - self.rule_collection_applies_to_groups = kwargs.get('rule_collection_applies_to_groups', None) - self.rule_groups = kwargs.get('rule_groups', None) - self.kind = None # type: Optional[str] - - -class EffectiveDefaultSecurityAdminRule(EffectiveBaseSecurityAdminRule): - """Network default admin rule. - - Variables are only populated by the server, and will be ignored when sending a request. - - All required parameters must be populated in order to send to Azure. - - :param id: Resource ID. - :type id: str - :param configuration_display_name: A display name of the security admin configuration. - :type configuration_display_name: str - :param configuration_description: A description of the security admin configuration. - :type configuration_description: str - :param rule_collection_display_name: A display name of the rule collection. - :type rule_collection_display_name: str - :param rule_collection_description: A description of the rule collection. - :type rule_collection_description: str - :param rule_collection_applies_to_groups: Groups for rule collection. - :type rule_collection_applies_to_groups: - list[~azure.mgmt.network.v2021_02_01_preview.models.NetworkManagerSecurityGroupItem] - :param rule_groups: Effective configuration groups. - :type rule_groups: list[~azure.mgmt.network.v2021_02_01_preview.models.ConfigurationGroup] - :param kind: Required. Whether the rule is custom or default.Constant filled by server. - Possible values include: "Custom", "Default". - :type kind: str or ~azure.mgmt.network.v2021_02_01_preview.models.EffectiveAdminRuleKind - :ivar display_name: A friendly name for the rule. - :vartype display_name: str - :ivar description: A description for this rule. Restricted to 140 chars. - :vartype description: str - :param flag: Default rule flag. - :type flag: str - :ivar protocol: Network protocol this rule applies to. Possible values include: "Tcp", "Udp", - "Icmp", "Esp", "Any", "Ah". - :vartype protocol: str or - ~azure.mgmt.network.v2021_02_01_preview.models.SecurityConfigurationRuleProtocol - :ivar sources: The CIDR or source IP ranges. - :vartype sources: list[~azure.mgmt.network.v2021_02_01_preview.models.AddressPrefixItem] - :ivar destinations: The destination address prefixes. CIDR or destination IP ranges. - :vartype destinations: list[~azure.mgmt.network.v2021_02_01_preview.models.AddressPrefixItem] - :ivar source_port_ranges: The source port ranges. - :vartype source_port_ranges: list[str] - :ivar destination_port_ranges: The destination port ranges. - :vartype destination_port_ranges: list[str] - :ivar access: Indicates the access allowed for this particular rule. Possible values include: - "Allow", "Deny", "AlwaysAllow". - :vartype access: str or - ~azure.mgmt.network.v2021_02_01_preview.models.SecurityConfigurationRuleAccess - :ivar priority: The priority of the rule. The value can be between 1 and 4096. The priority - number must be unique for each rule in the collection. The lower the priority number, the - higher the priority of the rule. - :vartype priority: int - :ivar direction: Indicates if the traffic matched against the rule in inbound or outbound. - Possible values include: "Inbound", "Outbound". - :vartype direction: str or - ~azure.mgmt.network.v2021_02_01_preview.models.SecurityConfigurationRuleDirection - :ivar provisioning_state: The provisioning state of the resource. Possible values include: - "Succeeded", "Updating", "Deleting", "Failed". - :vartype provisioning_state: str or - ~azure.mgmt.network.v2021_02_01_preview.models.ProvisioningState - """ - - _validation = { - 'kind': {'required': True}, - 'display_name': {'readonly': True}, - 'description': {'readonly': True}, - 'protocol': {'readonly': True}, - 'sources': {'readonly': True}, - 'destinations': {'readonly': True}, - 'source_port_ranges': {'readonly': True}, - 'destination_port_ranges': {'readonly': True}, - 'access': {'readonly': True}, - 'priority': {'readonly': True}, - 'direction': {'readonly': True}, - 'provisioning_state': {'readonly': True}, - } - - _attribute_map = { - 'id': {'key': 'id', 'type': 'str'}, - 'configuration_display_name': {'key': 'configurationDisplayName', 'type': 'str'}, - 'configuration_description': {'key': 'configurationDescription', 'type': 'str'}, - 'rule_collection_display_name': {'key': 'ruleCollectionDisplayName', 'type': 'str'}, - 'rule_collection_description': {'key': 'ruleCollectionDescription', 'type': 'str'}, - 'rule_collection_applies_to_groups': {'key': 'ruleCollectionAppliesToGroups', 'type': '[NetworkManagerSecurityGroupItem]'}, - 'rule_groups': {'key': 'ruleGroups', 'type': '[ConfigurationGroup]'}, - 'kind': {'key': 'kind', 'type': 'str'}, - 'display_name': {'key': 'properties.displayName', 'type': 'str'}, - 'description': {'key': 'properties.description', 'type': 'str'}, - 'flag': {'key': 'properties.flag', 'type': 'str'}, - 'protocol': {'key': 'properties.protocol', 'type': 'str'}, - 'sources': {'key': 'properties.sources', 'type': '[AddressPrefixItem]'}, - 'destinations': {'key': 'properties.destinations', 'type': '[AddressPrefixItem]'}, - 'source_port_ranges': {'key': 'properties.sourcePortRanges', 'type': '[str]'}, - 'destination_port_ranges': {'key': 'properties.destinationPortRanges', 'type': '[str]'}, - 'access': {'key': 'properties.access', 'type': 'str'}, - 'priority': {'key': 'properties.priority', 'type': 'int'}, - 'direction': {'key': 'properties.direction', 'type': 'str'}, - 'provisioning_state': {'key': 'properties.provisioningState', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(EffectiveDefaultSecurityAdminRule, self).__init__(**kwargs) - self.kind = 'Default' # type: str - self.display_name = None - self.description = None - self.flag = kwargs.get('flag', None) - self.protocol = None - self.sources = None - self.destinations = None - self.source_port_ranges = None - self.destination_port_ranges = None - self.access = None - self.priority = None - self.direction = None - self.provisioning_state = None - - -class EffectiveSecurityAdminRule(EffectiveBaseSecurityAdminRule): - """Network admin rule. - - Variables are only populated by the server, and will be ignored when sending a request. - - All required parameters must be populated in order to send to Azure. - - :param id: Resource ID. - :type id: str - :param configuration_display_name: A display name of the security admin configuration. - :type configuration_display_name: str - :param configuration_description: A description of the security admin configuration. - :type configuration_description: str - :param rule_collection_display_name: A display name of the rule collection. - :type rule_collection_display_name: str - :param rule_collection_description: A description of the rule collection. - :type rule_collection_description: str - :param rule_collection_applies_to_groups: Groups for rule collection. - :type rule_collection_applies_to_groups: - list[~azure.mgmt.network.v2021_02_01_preview.models.NetworkManagerSecurityGroupItem] - :param rule_groups: Effective configuration groups. - :type rule_groups: list[~azure.mgmt.network.v2021_02_01_preview.models.ConfigurationGroup] - :param kind: Required. Whether the rule is custom or default.Constant filled by server. - Possible values include: "Custom", "Default". - :type kind: str or ~azure.mgmt.network.v2021_02_01_preview.models.EffectiveAdminRuleKind - :param display_name: A friendly name for the rule. - :type display_name: str - :param description: A description for this rule. Restricted to 140 chars. - :type description: str - :param protocol: Network protocol this rule applies to. Possible values include: "Tcp", "Udp", - "Icmp", "Esp", "Any", "Ah". - :type protocol: str or - ~azure.mgmt.network.v2021_02_01_preview.models.SecurityConfigurationRuleProtocol - :param sources: The CIDR or source IP ranges. - :type sources: list[~azure.mgmt.network.v2021_02_01_preview.models.AddressPrefixItem] - :param destinations: The destination address prefixes. CIDR or destination IP ranges. - :type destinations: list[~azure.mgmt.network.v2021_02_01_preview.models.AddressPrefixItem] - :param source_port_ranges: The source port ranges. - :type source_port_ranges: list[str] - :param destination_port_ranges: The destination port ranges. - :type destination_port_ranges: list[str] - :param access: Indicates the access allowed for this particular rule. Possible values include: - "Allow", "Deny", "AlwaysAllow". - :type access: str or - ~azure.mgmt.network.v2021_02_01_preview.models.SecurityConfigurationRuleAccess - :param priority: The priority of the rule. The value can be between 1 and 4096. The priority - number must be unique for each rule in the collection. The lower the priority number, the - higher the priority of the rule. - :type priority: int - :param direction: Indicates if the traffic matched against the rule in inbound or outbound. - Possible values include: "Inbound", "Outbound". - :type direction: str or - ~azure.mgmt.network.v2021_02_01_preview.models.SecurityConfigurationRuleDirection - :ivar provisioning_state: The provisioning state of the resource. Possible values include: - "Succeeded", "Updating", "Deleting", "Failed". - :vartype provisioning_state: str or - ~azure.mgmt.network.v2021_02_01_preview.models.ProvisioningState - """ - - _validation = { - 'kind': {'required': True}, - 'priority': {'maximum': 4096, 'minimum': 1}, - 'provisioning_state': {'readonly': True}, - } - - _attribute_map = { - 'id': {'key': 'id', 'type': 'str'}, - 'configuration_display_name': {'key': 'configurationDisplayName', 'type': 'str'}, - 'configuration_description': {'key': 'configurationDescription', 'type': 'str'}, - 'rule_collection_display_name': {'key': 'ruleCollectionDisplayName', 'type': 'str'}, - 'rule_collection_description': {'key': 'ruleCollectionDescription', 'type': 'str'}, - 'rule_collection_applies_to_groups': {'key': 'ruleCollectionAppliesToGroups', 'type': '[NetworkManagerSecurityGroupItem]'}, - 'rule_groups': {'key': 'ruleGroups', 'type': '[ConfigurationGroup]'}, - 'kind': {'key': 'kind', 'type': 'str'}, - 'display_name': {'key': 'properties.displayName', 'type': 'str'}, - 'description': {'key': 'properties.description', 'type': 'str'}, - 'protocol': {'key': 'properties.protocol', 'type': 'str'}, - 'sources': {'key': 'properties.sources', 'type': '[AddressPrefixItem]'}, - 'destinations': {'key': 'properties.destinations', 'type': '[AddressPrefixItem]'}, - 'source_port_ranges': {'key': 'properties.sourcePortRanges', 'type': '[str]'}, - 'destination_port_ranges': {'key': 'properties.destinationPortRanges', 'type': '[str]'}, - 'access': {'key': 'properties.access', 'type': 'str'}, - 'priority': {'key': 'properties.priority', 'type': 'int'}, - 'direction': {'key': 'properties.direction', 'type': 'str'}, - 'provisioning_state': {'key': 'properties.provisioningState', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(EffectiveSecurityAdminRule, self).__init__(**kwargs) - self.kind = 'Custom' # type: str - self.display_name = kwargs.get('display_name', None) - self.description = kwargs.get('description', None) - self.protocol = kwargs.get('protocol', None) - self.sources = kwargs.get('sources', None) - self.destinations = kwargs.get('destinations', None) - self.source_port_ranges = kwargs.get('source_port_ranges', None) - self.destination_port_ranges = kwargs.get('destination_port_ranges', None) - self.access = kwargs.get('access', None) - self.priority = kwargs.get('priority', None) - self.direction = kwargs.get('direction', None) - self.provisioning_state = None - - -class EffectiveVirtualNetwork(msrest.serialization.Model): - """Effective Virtual Network. - - :param id: Effective vnet Id. - :type id: str - :param location: Location of vnet. - :type location: str - :param membership_type: Membership Type. Possible values include: "Static", "Dynamic". - :type membership_type: str or ~azure.mgmt.network.v2021_02_01_preview.models.MembershipType - """ - - _attribute_map = { - 'id': {'key': 'id', 'type': 'str'}, - 'location': {'key': 'location', 'type': 'str'}, - 'membership_type': {'key': 'membershipType', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(EffectiveVirtualNetwork, self).__init__(**kwargs) - self.id = kwargs.get('id', None) - self.location = kwargs.get('location', None) - self.membership_type = kwargs.get('membership_type', None) - - -class EffectiveVirtualNetworksListResult(msrest.serialization.Model): - """Result of the request to list Effective Virtual Network. It contains a list of groups and a URL link to get the next set of results. - - :param value: Gets a page of EffectiveVirtualNetwork. - :type value: list[~azure.mgmt.network.v2021_02_01_preview.models.EffectiveVirtualNetwork] - :param skip_token: When present, the value can be passed to a subsequent query call (together - with the same query and scopes used in the current request) to retrieve the next page of data. - :type skip_token: str - """ - - _attribute_map = { - 'value': {'key': 'value', 'type': '[EffectiveVirtualNetwork]'}, - 'skip_token': {'key': 'skipToken', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(EffectiveVirtualNetworksListResult, self).__init__(**kwargs) - self.value = kwargs.get('value', None) - self.skip_token = kwargs.get('skip_token', None) - - -class EffectiveVirtualNetworksParameter(msrest.serialization.Model): - """Effective Virtual Networks Parameter. - - :param conditional_members: Conditional Members. - :type conditional_members: str - :param skip_token: Continuation token for pagination, capturing the next page size and offset, - as well as the context of the query. - :type skip_token: str - """ - - _attribute_map = { - 'conditional_members': {'key': 'conditionalMembers', 'type': 'str'}, - 'skip_token': {'key': 'skipToken', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(EffectiveVirtualNetworksParameter, self).__init__(**kwargs) - self.conditional_members = kwargs.get('conditional_members', None) - self.skip_token = kwargs.get('skip_token', None) - - -class GroupMembersItem(msrest.serialization.Model): - """GroupMembers Item. - - :param resource_id: Resource Id. - :type resource_id: str - """ - - _attribute_map = { - 'resource_id': {'key': 'resourceId', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(GroupMembersItem, self).__init__(**kwargs) - self.resource_id = kwargs.get('resource_id', None) - - -class Hub(msrest.serialization.Model): - """Hub Item. - - :param resource_id: Resource Id. - :type resource_id: str - :param resource_type: Resource Type. - :type resource_type: str - """ - - _attribute_map = { - 'resource_id': {'key': 'resourceId', 'type': 'str'}, - 'resource_type': {'key': 'resourceType', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(Hub, self).__init__(**kwargs) - self.resource_id = kwargs.get('resource_id', None) - self.resource_type = kwargs.get('resource_type', None) - - -class NetworkGroup(ProxyResource): - """The network group 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 etag: A unique read-only string that changes whenever the resource is updated. - :vartype etag: str - :ivar system_data: The system metadata related to this resource. - :vartype system_data: ~azure.mgmt.network.v2021_02_01_preview.models.SystemData - :param display_name: A friendly name for the network group. - :type display_name: str - :param description: A description of the network group. - :type description: str - :param member_type: Group member type. - :type member_type: str - :param group_members: Group members of network group. - :type group_members: list[~azure.mgmt.network.v2021_02_01_preview.models.GroupMembersItem] - :param conditional_membership: Network group conditional filter. - :type conditional_membership: str - :ivar provisioning_state: The provisioning state of the scope assignment resource. Possible - values include: "Succeeded", "Updating", "Deleting", "Failed". - :vartype provisioning_state: str or - ~azure.mgmt.network.v2021_02_01_preview.models.ProvisioningState - """ - - _validation = { - 'id': {'readonly': True}, - 'name': {'readonly': True}, - 'type': {'readonly': True}, - 'etag': {'readonly': True}, - 'system_data': {'readonly': True}, - 'provisioning_state': {'readonly': True}, - } - - _attribute_map = { - 'id': {'key': 'id', 'type': 'str'}, - 'name': {'key': 'name', 'type': 'str'}, - 'type': {'key': 'type', 'type': 'str'}, - 'etag': {'key': 'etag', 'type': 'str'}, - 'system_data': {'key': 'systemData', 'type': 'SystemData'}, - 'display_name': {'key': 'properties.displayName', 'type': 'str'}, - 'description': {'key': 'properties.description', 'type': 'str'}, - 'member_type': {'key': 'properties.memberType', 'type': 'str'}, - 'group_members': {'key': 'properties.groupMembers', 'type': '[GroupMembersItem]'}, - 'conditional_membership': {'key': 'properties.conditionalMembership', 'type': 'str'}, - 'provisioning_state': {'key': 'properties.provisioningState', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(NetworkGroup, self).__init__(**kwargs) - self.system_data = None - self.display_name = kwargs.get('display_name', None) - self.description = kwargs.get('description', None) - self.member_type = kwargs.get('member_type', None) - self.group_members = kwargs.get('group_members', None) - self.conditional_membership = kwargs.get('conditional_membership', None) - self.provisioning_state = None - - -class NetworkGroupListResult(msrest.serialization.Model): - """Result of the request to list NetworkGroup. It contains a list of groups and a URL link to get the next set of results. - - :param value: Gets a page of NetworkGroup. - :type value: list[~azure.mgmt.network.v2021_02_01_preview.models.NetworkGroup] - :param next_link: Gets the URL to get the next set of results. - :type next_link: str - """ - - _attribute_map = { - 'value': {'key': 'value', 'type': '[NetworkGroup]'}, - 'next_link': {'key': 'nextLink', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(NetworkGroupListResult, self).__init__(**kwargs) - self.value = kwargs.get('value', None) - self.next_link = kwargs.get('next_link', None) - - -class Resource(msrest.serialization.Model): - """Common resource representation. - - Variables are only populated by the server, and will be ignored when sending a request. - - :param id: Resource ID. - :type 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: A set of tags. Resource tags. - :type tags: dict[str, str] - """ - - _validation = { - 'name': {'readonly': True}, - 'type': {'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}'}, - } - - def __init__( - self, - **kwargs - ): - super(Resource, self).__init__(**kwargs) - self.id = kwargs.get('id', None) - self.name = None - self.type = None - self.location = kwargs.get('location', None) - self.tags = kwargs.get('tags', None) - - -class NetworkManager(Resource): - """The Managed Network resource. - - Variables are only populated by the server, and will be ignored when sending a request. - - :param id: Resource ID. - :type 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: A set of tags. Resource tags. - :type tags: dict[str, str] - :ivar etag: A unique read-only string that changes whenever the resource is updated. - :vartype etag: str - :ivar system_data: The system metadata related to this resource. - :vartype system_data: ~azure.mgmt.network.v2021_02_01_preview.models.SystemData - :param display_name: A friendly name for the network manager. - :type display_name: str - :param description: A description of the network manager. - :type description: str - :param network_manager_scopes: Scope of Network Manager. - :type network_manager_scopes: - ~azure.mgmt.network.v2021_02_01_preview.models.NetworkManagerPropertiesNetworkManagerScopes - :param network_manager_scope_accesses: Scope Access. - :type network_manager_scope_accesses: list[str or - ~azure.mgmt.network.v2021_02_01_preview.models.ConfigurationType] - :ivar provisioning_state: The provisioning state of the scope assignment resource. Possible - values include: "Succeeded", "Updating", "Deleting", "Failed". - :vartype provisioning_state: str or - ~azure.mgmt.network.v2021_02_01_preview.models.ProvisioningState - """ - - _validation = { - 'name': {'readonly': True}, - 'type': {'readonly': True}, - 'etag': {'readonly': True}, - 'system_data': {'readonly': True}, - 'provisioning_state': {'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}'}, - 'etag': {'key': 'etag', 'type': 'str'}, - 'system_data': {'key': 'systemData', 'type': 'SystemData'}, - 'display_name': {'key': 'properties.displayName', 'type': 'str'}, - 'description': {'key': 'properties.description', 'type': 'str'}, - 'network_manager_scopes': {'key': 'properties.networkManagerScopes', 'type': 'NetworkManagerPropertiesNetworkManagerScopes'}, - 'network_manager_scope_accesses': {'key': 'properties.networkManagerScopeAccesses', 'type': '[str]'}, - 'provisioning_state': {'key': 'properties.provisioningState', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(NetworkManager, self).__init__(**kwargs) - self.etag = None - self.system_data = None - self.display_name = kwargs.get('display_name', None) - self.description = kwargs.get('description', None) - self.network_manager_scopes = kwargs.get('network_manager_scopes', None) - self.network_manager_scope_accesses = kwargs.get('network_manager_scope_accesses', None) - self.provisioning_state = None - - -class NetworkManagerCommit(msrest.serialization.Model): - """Network Manager Commit. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar commit_id: Commit Id. - :vartype commit_id: str - :param target_locations: List of target locations. - :type target_locations: list[str] - :param configuration_ids: List of configuration ids. - :type configuration_ids: list[str] - :param commit_type: Commit Type. Possible values include: "SecurityAdmin", "SecurityUser", - "Connectivity". - :type commit_type: str or ~azure.mgmt.network.v2021_02_01_preview.models.ConfigurationType - """ - - _validation = { - 'commit_id': {'readonly': True}, - } - - _attribute_map = { - 'commit_id': {'key': 'commitId', 'type': 'str'}, - 'target_locations': {'key': 'targetLocations', 'type': '[str]'}, - 'configuration_ids': {'key': 'configurationIds', 'type': '[str]'}, - 'commit_type': {'key': 'commitType', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(NetworkManagerCommit, self).__init__(**kwargs) - self.commit_id = None - self.target_locations = kwargs.get('target_locations', None) - self.configuration_ids = kwargs.get('configuration_ids', None) - self.commit_type = kwargs.get('commit_type', None) - - -class NetworkManagerDeploymentStatus(msrest.serialization.Model): - """Network Manager Deployment Status. - - :param commit_time: Commit Time. - :type commit_time: ~datetime.datetime - :param region: Region Name. - :type region: str - :param deployment_status: Deployment Status. Possible values include: "NotStarted", - "Deploying", "Deployed", "Failed". - :type deployment_status: str or ~azure.mgmt.network.v2021_02_01_preview.models.DeploymentStatus - :param configuration_ids: List of configuration ids. - :type configuration_ids: list[str] - :param deployment_type: Configuration Deployment Type. Possible values include: - "SecurityAdmin", "SecurityUser", "Connectivity". - :type deployment_type: str or ~azure.mgmt.network.v2021_02_01_preview.models.ConfigurationType - :param error_message: Error Message. - :type error_message: str - """ - - _attribute_map = { - 'commit_time': {'key': 'commitTime', 'type': 'iso-8601'}, - 'region': {'key': 'region', 'type': 'str'}, - 'deployment_status': {'key': 'deploymentStatus', 'type': 'str'}, - 'configuration_ids': {'key': 'configurationIds', 'type': '[str]'}, - 'deployment_type': {'key': 'deploymentType', 'type': 'str'}, - 'error_message': {'key': 'errorMessage', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(NetworkManagerDeploymentStatus, self).__init__(**kwargs) - self.commit_time = kwargs.get('commit_time', None) - self.region = kwargs.get('region', None) - self.deployment_status = kwargs.get('deployment_status', None) - self.configuration_ids = kwargs.get('configuration_ids', None) - self.deployment_type = kwargs.get('deployment_type', None) - self.error_message = kwargs.get('error_message', None) - - -class NetworkManagerDeploymentStatusListResult(msrest.serialization.Model): - """A list of Network Manager Deployment Status. - - :param value: Gets a page of Network Manager Deployment Status. - :type value: - list[~azure.mgmt.network.v2021_02_01_preview.models.NetworkManagerDeploymentStatus] - :param skip_token: When present, the value can be passed to a subsequent query call (together - with the same query and scopes used in the current request) to retrieve the next page of data. - :type skip_token: str - """ - - _attribute_map = { - 'value': {'key': 'value', 'type': '[NetworkManagerDeploymentStatus]'}, - 'skip_token': {'key': 'skipToken', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(NetworkManagerDeploymentStatusListResult, self).__init__(**kwargs) - self.value = kwargs.get('value', None) - self.skip_token = kwargs.get('skip_token', None) - - -class NetworkManagerDeploymentStatusParameter(msrest.serialization.Model): - """Network Manager Deployment Status Parameter. - - :param regions: List of locations. - :type regions: list[str] - :param deployment_types: List of deployment types. - :type deployment_types: list[str or - ~azure.mgmt.network.v2021_02_01_preview.models.ConfigurationType] - :param skip_token: Continuation token for pagination, capturing the next page size and offset, - as well as the context of the query. - :type skip_token: str - """ - - _attribute_map = { - 'regions': {'key': 'regions', 'type': '[str]'}, - 'deployment_types': {'key': 'deploymentTypes', 'type': '[str]'}, - 'skip_token': {'key': 'skipToken', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(NetworkManagerDeploymentStatusParameter, self).__init__(**kwargs) - self.regions = kwargs.get('regions', None) - self.deployment_types = kwargs.get('deployment_types', None) - self.skip_token = kwargs.get('skip_token', None) - - -class NetworkManagerEffectiveConnectivityConfigurationListResult(msrest.serialization.Model): - """Result of the request to list networkManagerEffectiveConnectivityConfiguration. It contains a list of groups and a skiptoken to get the next set of results. - - :param value: Gets a page of NetworkManagerEffectiveConnectivityConfiguration. - :type value: - list[~azure.mgmt.network.v2021_02_01_preview.models.EffectiveConnectivityConfiguration] - :param skip_token: When present, the value can be passed to a subsequent query call (together - with the same query and scopes used in the current request) to retrieve the next page of data. - :type skip_token: str - """ - - _attribute_map = { - 'value': {'key': 'value', 'type': '[EffectiveConnectivityConfiguration]'}, - 'skip_token': {'key': 'skipToken', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(NetworkManagerEffectiveConnectivityConfigurationListResult, self).__init__(**kwargs) - self.value = kwargs.get('value', None) - self.skip_token = kwargs.get('skip_token', None) - - -class NetworkManagerEffectiveSecurityAdminRulesListResult(msrest.serialization.Model): - """Result of the request to list networkManagerEffectiveSecurityAdminRules. It contains a list of groups and a skiptoken to get the next set of results. - - :param value: Gets a page of NetworkManagerEffectiveSecurityAdminRules. - :type value: - list[~azure.mgmt.network.v2021_02_01_preview.models.EffectiveBaseSecurityAdminRule] - :param skip_token: When present, the value can be passed to a subsequent query call (together - with the same query and scopes used in the current request) to retrieve the next page of data. - :type skip_token: str - """ - - _attribute_map = { - 'value': {'key': 'value', 'type': '[EffectiveBaseSecurityAdminRule]'}, - 'skip_token': {'key': 'skipToken', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(NetworkManagerEffectiveSecurityAdminRulesListResult, self).__init__(**kwargs) - self.value = kwargs.get('value', None) - self.skip_token = kwargs.get('skip_token', None) - - -class NetworkManagerListResult(msrest.serialization.Model): - """Result of the request to list NetworkManager. It contains a list of network managers and a URL link to get the next set of results. - - :param value: Gets a page of NetworkManager. - :type value: list[~azure.mgmt.network.v2021_02_01_preview.models.NetworkManager] - :param next_link: Gets the URL to get the next page of results. - :type next_link: str - """ - - _attribute_map = { - 'value': {'key': 'value', 'type': '[NetworkManager]'}, - 'next_link': {'key': 'nextLink', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(NetworkManagerListResult, self).__init__(**kwargs) - self.value = kwargs.get('value', None) - self.next_link = kwargs.get('next_link', None) - - -class NetworkManagerPropertiesNetworkManagerScopes(msrest.serialization.Model): - """Scope of Network Manager. - - :param management_groups: List of management groups. - :type management_groups: list[str] - :param subscriptions: List of subscriptions. - :type subscriptions: list[str] - """ - - _attribute_map = { - 'management_groups': {'key': 'managementGroups', 'type': '[str]'}, - 'subscriptions': {'key': 'subscriptions', 'type': '[str]'}, - } - - def __init__( - self, - **kwargs - ): - super(NetworkManagerPropertiesNetworkManagerScopes, self).__init__(**kwargs) - self.management_groups = kwargs.get('management_groups', None) - self.subscriptions = kwargs.get('subscriptions', None) - - -class NetworkManagerSecurityGroupItem(msrest.serialization.Model): - """Network manager security group item. - - :param network_group_id: Network manager group Id. - :type network_group_id: str - """ - - _attribute_map = { - 'network_group_id': {'key': 'networkGroupId', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(NetworkManagerSecurityGroupItem, self).__init__(**kwargs) - self.network_group_id = kwargs.get('network_group_id', None) - - -class NetworkSecurityPerimeter(Resource): - """The Network Security Perimeter resource. - - Variables are only populated by the server, and will be ignored when sending a request. - - :param id: Resource ID. - :type 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: A set of tags. Resource tags. - :type tags: dict[str, str] - :ivar etag: A unique read-only string that changes whenever the resource is updated. - :vartype etag: str - :param display_name: A friendly name for the network security perimeter. - :type display_name: str - :param description: A description of the network security perimeter. - :type description: str - :ivar provisioning_state: The provisioning state of the scope assignment resource. Possible - values include: "Succeeded", "Updating", "Deleting", "Failed". - :vartype provisioning_state: str or - ~azure.mgmt.network.v2021_02_01_preview.models.ProvisioningState - """ - - _validation = { - 'name': {'readonly': True}, - 'type': {'readonly': True}, - 'etag': {'readonly': True}, - 'provisioning_state': {'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}'}, - 'etag': {'key': 'etag', 'type': 'str'}, - 'display_name': {'key': 'properties.displayName', 'type': 'str'}, - 'description': {'key': 'properties.description', 'type': 'str'}, - 'provisioning_state': {'key': 'properties.provisioningState', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(NetworkSecurityPerimeter, self).__init__(**kwargs) - self.etag = None - self.display_name = kwargs.get('display_name', None) - self.description = kwargs.get('description', None) - self.provisioning_state = None - - -class NetworkSecurityPerimeterListResult(msrest.serialization.Model): - """Result of the request to list NetworkSecurityPerimeter. It contains a list of network security perimeters and a URL link to get the next set of results. - - :param value: Gets a page of NetworkSecurityPerimeter. - :type value: list[~azure.mgmt.network.v2021_02_01_preview.models.NetworkSecurityPerimeter] - :param next_link: Gets the URL to get the next page of results. - :type next_link: str - """ - - _attribute_map = { - 'value': {'key': 'value', 'type': '[NetworkSecurityPerimeter]'}, - 'next_link': {'key': 'nextLink', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(NetworkSecurityPerimeterListResult, self).__init__(**kwargs) - self.value = kwargs.get('value', None) - self.next_link = kwargs.get('next_link', None) - - -class PerimeterAssociableResource(Resource): - """Resource that is onboarded to use network security perimeter. Also referred as perimeter associable resource. - - Variables are only populated by the server, and will be ignored when sending a request. - - :param id: Resource ID. - :type 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: A set of tags. Resource tags. - :type tags: dict[str, str] - :ivar display_name: A friendly name for the properties of perimeter associable resources. - :vartype display_name: str - :ivar resource_type: Resource type/provider name. - :vartype resource_type: str - :ivar public_dns_zones: Public DNS zone names of the resources. - :vartype public_dns_zones: list[str] - """ - - _validation = { - 'name': {'readonly': True}, - 'type': {'readonly': True}, - 'display_name': {'readonly': True}, - 'resource_type': {'readonly': True}, - 'public_dns_zones': {'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}'}, - 'display_name': {'key': 'properties.displayName', 'type': 'str'}, - 'resource_type': {'key': 'properties.resourceType', 'type': 'str'}, - 'public_dns_zones': {'key': 'properties.publicDnsZones', 'type': '[str]'}, - } - - def __init__( - self, - **kwargs - ): - super(PerimeterAssociableResource, self).__init__(**kwargs) - self.display_name = None - self.resource_type = None - self.public_dns_zones = None - - -class PerimeterAssociableResourcesListResult(msrest.serialization.Model): - """Paged list of perimeter associable resources. - - :param value: Gets paged list of perimeter associable resources. - :type value: list[~azure.mgmt.network.v2021_02_01_preview.models.PerimeterAssociableResource] - :param next_link: Gets the URL to get the next page of results. - :type next_link: str - """ - - _attribute_map = { - 'value': {'key': 'value', 'type': '[PerimeterAssociableResource]'}, - 'next_link': {'key': 'nextLink', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(PerimeterAssociableResourcesListResult, self).__init__(**kwargs) - self.value = kwargs.get('value', None) - self.next_link = kwargs.get('next_link', None) - - -class QueryRequestOptions(msrest.serialization.Model): - """Query Request Options. - - :param skip_token: When present, the value can be passed to a subsequent query call (together - with the same query and scopes used in the current request) to retrieve the next page of data. - :type skip_token: str - """ - - _attribute_map = { - 'skip_token': {'key': 'skipToken', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(QueryRequestOptions, self).__init__(**kwargs) - self.skip_token = kwargs.get('skip_token', None) - - -class RuleCollection(ProxyResource): - """Defines the rule collection. - - 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 etag: A unique read-only string that changes whenever the resource is updated. - :vartype etag: str - :ivar system_data: The system metadata related to this resource. - :vartype system_data: ~azure.mgmt.network.v2021_02_01_preview.models.SystemData - :param display_name: A display name of the rule collection. - :type display_name: str - :param description: A description of the rule collection. - :type description: str - :param applies_to_groups: Groups for configuration. - :type applies_to_groups: - list[~azure.mgmt.network.v2021_02_01_preview.models.NetworkManagerSecurityGroupItem] - :ivar provisioning_state: The provisioning state of the resource. Possible values include: - "Succeeded", "Updating", "Deleting", "Failed". - :vartype provisioning_state: str or - ~azure.mgmt.network.v2021_02_01_preview.models.ProvisioningState - """ - - _validation = { - 'id': {'readonly': True}, - 'name': {'readonly': True}, - 'type': {'readonly': True}, - 'etag': {'readonly': True}, - 'system_data': {'readonly': True}, - 'provisioning_state': {'readonly': True}, - } - - _attribute_map = { - 'id': {'key': 'id', 'type': 'str'}, - 'name': {'key': 'name', 'type': 'str'}, - 'type': {'key': 'type', 'type': 'str'}, - 'etag': {'key': 'etag', 'type': 'str'}, - 'system_data': {'key': 'systemData', 'type': 'SystemData'}, - 'display_name': {'key': 'properties.displayName', 'type': 'str'}, - 'description': {'key': 'properties.description', 'type': 'str'}, - 'applies_to_groups': {'key': 'properties.appliesToGroups', 'type': '[NetworkManagerSecurityGroupItem]'}, - 'provisioning_state': {'key': 'properties.provisioningState', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(RuleCollection, self).__init__(**kwargs) - self.system_data = None - self.display_name = kwargs.get('display_name', None) - self.description = kwargs.get('description', None) - self.applies_to_groups = kwargs.get('applies_to_groups', None) - self.provisioning_state = None - - -class RuleCollectionListResult(msrest.serialization.Model): - """Security configuration rule collection list result. - - :param value: A list of network manager security configuration rule collections. - :type value: list[~azure.mgmt.network.v2021_02_01_preview.models.RuleCollection] - :param next_link: Gets the URL to get the next set of results. - :type next_link: str - """ - - _attribute_map = { - 'value': {'key': 'value', 'type': '[RuleCollection]'}, - 'next_link': {'key': 'nextLink', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(RuleCollectionListResult, self).__init__(**kwargs) - self.value = kwargs.get('value', None) - self.next_link = kwargs.get('next_link', None) - - -class SecurityConfiguration(ProxyResource): - """Defines the security configuration. - - 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 etag: A unique read-only string that changes whenever the resource is updated. - :vartype etag: str - :ivar system_data: The system metadata related to this resource. - :vartype system_data: ~azure.mgmt.network.v2021_02_01_preview.models.SystemData - :param display_name: A display name of the security configuration. - :type display_name: str - :param description: A description of the security configuration. - :type description: str - :param security_type: Security Type. Possible values include: "AdminPolicy", "UserPolicy". - :type security_type: str or ~azure.mgmt.network.v2021_02_01_preview.models.SecurityType - :param delete_existing_ns_gs: Flag if need to delete existing network security groups. Possible - values include: "False", "True". - :type delete_existing_ns_gs: str or - ~azure.mgmt.network.v2021_02_01_preview.models.DeleteExistingNSGs - :ivar provisioning_state: The provisioning state of the resource. Possible values include: - "Succeeded", "Updating", "Deleting", "Failed". - :vartype provisioning_state: str or - ~azure.mgmt.network.v2021_02_01_preview.models.ProvisioningState - """ - - _validation = { - 'id': {'readonly': True}, - 'name': {'readonly': True}, - 'type': {'readonly': True}, - 'etag': {'readonly': True}, - 'system_data': {'readonly': True}, - 'provisioning_state': {'readonly': True}, - } - - _attribute_map = { - 'id': {'key': 'id', 'type': 'str'}, - 'name': {'key': 'name', 'type': 'str'}, - 'type': {'key': 'type', 'type': 'str'}, - 'etag': {'key': 'etag', 'type': 'str'}, - 'system_data': {'key': 'systemData', 'type': 'SystemData'}, - 'display_name': {'key': 'properties.displayName', 'type': 'str'}, - 'description': {'key': 'properties.description', 'type': 'str'}, - 'security_type': {'key': 'properties.securityType', 'type': 'str'}, - 'delete_existing_ns_gs': {'key': 'properties.deleteExistingNSGs', 'type': 'str'}, - 'provisioning_state': {'key': 'properties.provisioningState', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(SecurityConfiguration, self).__init__(**kwargs) - self.system_data = None - self.display_name = kwargs.get('display_name', None) - self.description = kwargs.get('description', None) - self.security_type = kwargs.get('security_type', None) - self.delete_existing_ns_gs = kwargs.get('delete_existing_ns_gs', None) - self.provisioning_state = None - - -class SecurityConfigurationListResult(msrest.serialization.Model): - """A list of network manager security configurations. - - :param value: Gets a page of security configurations. - :type value: list[~azure.mgmt.network.v2021_02_01_preview.models.SecurityConfiguration] - :param next_link: Gets the URL to get the next page of results. - :type next_link: str - """ - - _attribute_map = { - 'value': {'key': 'value', 'type': '[SecurityConfiguration]'}, - 'next_link': {'key': 'nextLink', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(SecurityConfigurationListResult, self).__init__(**kwargs) - self.value = kwargs.get('value', None) - self.next_link = kwargs.get('next_link', None) - - -class SystemData(msrest.serialization.Model): - """Metadata pertaining to creation and last modification of the resource. - - :param created_by: The identity that created the resource. - :type created_by: str - :param created_by_type: The type of identity that created the resource. Possible values - include: "User", "Application", "ManagedIdentity", "Key". - :type created_by_type: str or ~azure.mgmt.network.v2021_02_01_preview.models.CreatedByType - :param created_at: The timestamp of resource creation (UTC). - :type created_at: ~datetime.datetime - :param last_modified_by: The identity that last modified the resource. - :type last_modified_by: str - :param last_modified_by_type: The type of identity that last modified the resource. Possible - values include: "User", "Application", "ManagedIdentity", "Key". - :type last_modified_by_type: str or - ~azure.mgmt.network.v2021_02_01_preview.models.CreatedByType - :param last_modified_at: The type of identity that last modified the resource. - :type last_modified_at: ~datetime.datetime - """ - - _attribute_map = { - 'created_by': {'key': 'createdBy', 'type': 'str'}, - 'created_by_type': {'key': 'createdByType', 'type': 'str'}, - # TODO: Datetime Issue will be fixed later - # 'created_at': {'key': 'createdAt', 'type': 'iso-8601'}, - 'created_at': {'key': 'createdAt', 'type': 'str'}, - 'last_modified_by': {'key': 'lastModifiedBy', 'type': 'str'}, - 'last_modified_by_type': {'key': 'lastModifiedByType', 'type': 'str'}, - # 'last_modified_at': {'key': 'lastModifiedAt', 'type': 'iso-8601'}, - 'last_modified_at': {'key': 'lastModifiedAt', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(SystemData, self).__init__(**kwargs) - self.created_by = kwargs.get('created_by', None) - self.created_by_type = kwargs.get('created_by_type', None) - self.created_at = kwargs.get('created_at', None) - self.last_modified_by = kwargs.get('last_modified_by', None) - self.last_modified_by_type = kwargs.get('last_modified_by_type', None) - self.last_modified_at = kwargs.get('last_modified_at', None) - - -class TagsObject(msrest.serialization.Model): - """Tags object for patch operations. - - :param tags: A set of tags. Resource tags. - :type tags: dict[str, str] - """ - - _attribute_map = { - 'tags': {'key': 'tags', 'type': '{str}'}, - } - - def __init__( - self, - **kwargs - ): - super(TagsObject, self).__init__(**kwargs) - self.tags = kwargs.get('tags', None) - - -class UserRule(BaseUserRule): - """Network security user rule. - - Variables are only populated by the server, and will be ignored when sending a request. - - All required parameters must be populated in order to send to Azure. - - :ivar id: Resource ID. - :vartype id: str - :ivar name: Resource name. - :vartype name: str - :ivar type: Resource type. - :vartype type: str - :ivar etag: A unique read-only string that changes whenever the resource is updated. - :vartype etag: str - :param kind: Required. Whether the rule is custom or default.Constant filled by server. - Possible values include: "Custom", "Default". - :type kind: str or ~azure.mgmt.network.v2021_02_01_preview.models.UserRuleKind - :ivar system_data: The system metadata related to this resource. - :vartype system_data: ~azure.mgmt.network.v2021_02_01_preview.models.SystemData - :param display_name: A friendly name for the rule. - :type display_name: str - :param description: A description for this rule. - :type description: str - :param protocol: Network protocol this rule applies to. Possible values include: "Tcp", "Udp", - "Icmp", "Esp", "Any", "Ah". - :type protocol: str or - ~azure.mgmt.network.v2021_02_01_preview.models.SecurityConfigurationRuleProtocol - :param sources: The CIDR or source IP ranges. - :type sources: list[~azure.mgmt.network.v2021_02_01_preview.models.AddressPrefixItem] - :param destinations: The destination address prefixes. CIDR or destination IP ranges. - :type destinations: list[~azure.mgmt.network.v2021_02_01_preview.models.AddressPrefixItem] - :param source_port_ranges: The source port ranges. - :type source_port_ranges: list[str] - :param destination_port_ranges: The destination port ranges. - :type destination_port_ranges: list[str] - :param direction: Indicates if the traffic matched against the rule in inbound or outbound. - Possible values include: "Inbound", "Outbound". - :type direction: str or - ~azure.mgmt.network.v2021_02_01_preview.models.SecurityConfigurationRuleDirection - :ivar provisioning_state: The provisioning state of the security configuration user rule - resource. Possible values include: "Succeeded", "Updating", "Deleting", "Failed". - :vartype provisioning_state: str or - ~azure.mgmt.network.v2021_02_01_preview.models.ProvisioningState - """ - - _validation = { - 'id': {'readonly': True}, - 'name': {'readonly': True}, - 'type': {'readonly': True}, - 'etag': {'readonly': True}, - 'kind': {'required': True}, - 'system_data': {'readonly': True}, - 'provisioning_state': {'readonly': True}, - } - - _attribute_map = { - 'id': {'key': 'id', 'type': 'str'}, - 'name': {'key': 'name', 'type': 'str'}, - 'type': {'key': 'type', 'type': 'str'}, - 'etag': {'key': 'etag', 'type': 'str'}, - 'kind': {'key': 'kind', 'type': 'str'}, - 'system_data': {'key': 'systemData', 'type': 'SystemData'}, - 'display_name': {'key': 'properties.displayName', 'type': 'str'}, - 'description': {'key': 'properties.description', 'type': 'str'}, - 'protocol': {'key': 'properties.protocol', 'type': 'str'}, - 'sources': {'key': 'properties.sources', 'type': '[AddressPrefixItem]'}, - 'destinations': {'key': 'properties.destinations', 'type': '[AddressPrefixItem]'}, - 'source_port_ranges': {'key': 'properties.sourcePortRanges', 'type': '[str]'}, - 'destination_port_ranges': {'key': 'properties.destinationPortRanges', 'type': '[str]'}, - 'direction': {'key': 'properties.direction', 'type': 'str'}, - 'provisioning_state': {'key': 'properties.provisioningState', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(UserRule, self).__init__(**kwargs) - self.kind = 'Custom' # type: str - self.display_name = kwargs.get('display_name', None) - self.description = kwargs.get('description', None) - self.protocol = kwargs.get('protocol', None) - self.sources = kwargs.get('sources', None) - self.destinations = kwargs.get('destinations', None) - self.source_port_ranges = kwargs.get('source_port_ranges', None) - self.destination_port_ranges = kwargs.get('destination_port_ranges', None) - self.direction = kwargs.get('direction', None) - self.provisioning_state = None - - -class UserRuleListResult(msrest.serialization.Model): - """security user rule list result. - - :param value: A list of user rules. - :type value: list[~azure.mgmt.network.v2021_02_01_preview.models.BaseUserRule] - :param next_link: The URL to get the next set of results. - :type next_link: str - """ - - _attribute_map = { - 'value': {'key': 'value', 'type': '[BaseUserRule]'}, - 'next_link': {'key': 'nextLink', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(UserRuleListResult, self).__init__(**kwargs) - self.value = kwargs.get('value', None) - self.next_link = kwargs.get('next_link', None) diff --git a/src/network-manager/azext_network_manager/vendored_sdks/models/_models_py3.py b/src/network-manager/azext_network_manager/vendored_sdks/models/_models_py3.py index 69cfb576374..07ccecb8ca2 100644 --- a/src/network-manager/azext_network_manager/vendored_sdks/models/_models_py3.py +++ b/src/network-manager/azext_network_manager/vendored_sdks/models/_models_py3.py @@ -22,28 +22,28 @@ class ActiveBaseSecurityAdminRule(msrest.serialization.Model): All required parameters must be populated in order to send to Azure. - :param id: Resource ID. - :type id: str - :param commit_time: Deployment time string. - :type commit_time: ~datetime.datetime - :param region: Deployment region. - :type region: str - :param configuration_display_name: A display name of the security admin configuration. - :type configuration_display_name: str - :param configuration_description: A description of the security admin configuration. - :type configuration_description: str - :param rule_collection_display_name: A display name of the rule collection. - :type rule_collection_display_name: str - :param rule_collection_description: A description of the rule collection. - :type rule_collection_description: str - :param rule_collection_applies_to_groups: Groups for rule collection. - :type rule_collection_applies_to_groups: - list[~azure.mgmt.network.v2021_02_01_preview.models.NetworkManagerSecurityGroupItem] - :param rule_groups: Effective configuration groups. - :type rule_groups: list[~azure.mgmt.network.v2021_02_01_preview.models.ConfigurationGroup] - :param kind: Required. Whether the rule is custom or default.Constant filled by server. - Possible values include: "Custom", "Default". - :type kind: str or ~azure.mgmt.network.v2021_02_01_preview.models.EffectiveAdminRuleKind + :ivar id: Resource ID. + :vartype id: str + :ivar commit_time: Deployment time string. + :vartype commit_time: ~datetime.datetime + :ivar region: Deployment region. + :vartype region: str + :ivar configuration_display_name: A display name of the security admin configuration. + :vartype configuration_display_name: str + :ivar configuration_description: A description of the security admin configuration. + :vartype configuration_description: str + :ivar rule_collection_display_name: A display name of the rule collection. + :vartype rule_collection_display_name: str + :ivar rule_collection_description: A description of the rule collection. + :vartype rule_collection_description: str + :ivar rule_collection_applies_to_groups: Groups for rule collection. + :vartype rule_collection_applies_to_groups: + list[~azure.mgmt.network.v2021_05_01_preview.models.NetworkManagerSecurityGroupItem] + :ivar rule_groups: Effective configuration groups. + :vartype rule_groups: list[~azure.mgmt.network.v2021_05_01_preview.models.ConfigurationGroup] + :ivar kind: Required. Whether the rule is custom or default.Constant filled by server. Possible + values include: "Custom", "Default". + :vartype kind: str or ~azure.mgmt.network.v2021_05_01_preview.models.EffectiveAdminRuleKind """ _validation = { @@ -81,6 +81,27 @@ def __init__( rule_groups: Optional[List["ConfigurationGroup"]] = None, **kwargs ): + """ + :keyword id: Resource ID. + :paramtype id: str + :keyword commit_time: Deployment time string. + :paramtype commit_time: ~datetime.datetime + :keyword region: Deployment region. + :paramtype region: str + :keyword configuration_display_name: A display name of the security admin configuration. + :paramtype configuration_display_name: str + :keyword configuration_description: A description of the security admin configuration. + :paramtype configuration_description: str + :keyword rule_collection_display_name: A display name of the rule collection. + :paramtype rule_collection_display_name: str + :keyword rule_collection_description: A description of the rule collection. + :paramtype rule_collection_description: str + :keyword rule_collection_applies_to_groups: Groups for rule collection. + :paramtype rule_collection_applies_to_groups: + list[~azure.mgmt.network.v2021_05_01_preview.models.NetworkManagerSecurityGroupItem] + :keyword rule_groups: Effective configuration groups. + :paramtype rule_groups: list[~azure.mgmt.network.v2021_05_01_preview.models.ConfigurationGroup] + """ super(ActiveBaseSecurityAdminRule, self).__init__(**kwargs) self.id = id self.commit_time = commit_time @@ -102,28 +123,28 @@ class ActiveBaseSecurityUserRule(msrest.serialization.Model): All required parameters must be populated in order to send to Azure. - :param id: Resource ID. - :type id: str - :param commit_time: Deployment time string. - :type commit_time: ~datetime.datetime - :param region: Deployment region. - :type region: str - :param configuration_display_name: A display name of the security user configuration. - :type configuration_display_name: str - :param configuration_description: A description of the security user configuration. - :type configuration_description: str - :param rule_collection_display_name: A display name of the rule collection. - :type rule_collection_display_name: str - :param rule_collection_description: A description of the rule collection. - :type rule_collection_description: str - :param rule_collection_applies_to_groups: Groups for rule collection. - :type rule_collection_applies_to_groups: - list[~azure.mgmt.network.v2021_02_01_preview.models.NetworkManagerSecurityGroupItem] - :param rule_groups: Effective configuration groups. - :type rule_groups: list[~azure.mgmt.network.v2021_02_01_preview.models.ConfigurationGroup] - :param kind: Required. Whether the rule is custom or default.Constant filled by server. - Possible values include: "Custom", "Default". - :type kind: str or ~azure.mgmt.network.v2021_02_01_preview.models.EffectiveUserRuleKind + :ivar id: Resource ID. + :vartype id: str + :ivar commit_time: Deployment time string. + :vartype commit_time: ~datetime.datetime + :ivar region: Deployment region. + :vartype region: str + :ivar configuration_display_name: A display name of the security user configuration. + :vartype configuration_display_name: str + :ivar configuration_description: A description of the security user configuration. + :vartype configuration_description: str + :ivar rule_collection_display_name: A display name of the rule collection. + :vartype rule_collection_display_name: str + :ivar rule_collection_description: A description of the rule collection. + :vartype rule_collection_description: str + :ivar rule_collection_applies_to_groups: Groups for rule collection. + :vartype rule_collection_applies_to_groups: + list[~azure.mgmt.network.v2021_05_01_preview.models.NetworkManagerSecurityGroupItem] + :ivar rule_groups: Effective configuration groups. + :vartype rule_groups: list[~azure.mgmt.network.v2021_05_01_preview.models.ConfigurationGroup] + :ivar kind: Required. Whether the rule is custom or default.Constant filled by server. Possible + values include: "Custom", "Default". + :vartype kind: str or ~azure.mgmt.network.v2021_05_01_preview.models.EffectiveUserRuleKind """ _validation = { @@ -161,6 +182,27 @@ def __init__( rule_groups: Optional[List["ConfigurationGroup"]] = None, **kwargs ): + """ + :keyword id: Resource ID. + :paramtype id: str + :keyword commit_time: Deployment time string. + :paramtype commit_time: ~datetime.datetime + :keyword region: Deployment region. + :paramtype region: str + :keyword configuration_display_name: A display name of the security user configuration. + :paramtype configuration_display_name: str + :keyword configuration_description: A description of the security user configuration. + :paramtype configuration_description: str + :keyword rule_collection_display_name: A display name of the rule collection. + :paramtype rule_collection_display_name: str + :keyword rule_collection_description: A description of the rule collection. + :paramtype rule_collection_description: str + :keyword rule_collection_applies_to_groups: Groups for rule collection. + :paramtype rule_collection_applies_to_groups: + list[~azure.mgmt.network.v2021_05_01_preview.models.NetworkManagerSecurityGroupItem] + :keyword rule_groups: Effective configuration groups. + :paramtype rule_groups: list[~azure.mgmt.network.v2021_05_01_preview.models.ConfigurationGroup] + """ super(ActiveBaseSecurityUserRule, self).__init__(**kwargs) self.id = id self.commit_time = commit_time @@ -177,11 +219,11 @@ def __init__( class ActiveConfigurationParameter(msrest.serialization.Model): """Effective Virtual Networks Parameter. - :param regions: List of regions. - :type regions: list[str] - :param skip_token: When present, the value can be passed to a subsequent query call (together + :ivar regions: List of regions. + :vartype regions: list[str] + :ivar skip_token: When present, the value can be passed to a subsequent query call (together with the same query and scopes used in the current request) to retrieve the next page of data. - :type skip_token: str + :vartype skip_token: str """ _attribute_map = { @@ -196,6 +238,13 @@ def __init__( skip_token: Optional[str] = None, **kwargs ): + """ + :keyword regions: List of regions. + :paramtype regions: list[str] + :keyword skip_token: When present, the value can be passed to a subsequent query call (together + with the same query and scopes used in the current request) to retrieve the next page of data. + :paramtype skip_token: str + """ super(ActiveConfigurationParameter, self).__init__(**kwargs) self.regions = regions self.skip_token = skip_token @@ -206,34 +255,34 @@ class EffectiveConnectivityConfiguration(msrest.serialization.Model): Variables are only populated by the server, and will be ignored when sending a request. - :param id: Resource ID. - :type id: str - :param configuration_groups: Effective configuration groups. - :type configuration_groups: - list[~azure.mgmt.network.v2021_02_01_preview.models.ConfigurationGroup] - :param display_name: A friendly name for the resource. - :type display_name: str - :param description: A description of the connectivity configuration. - :type description: str - :param connectivity_topology: Connectivity topology type. Possible values include: + :ivar id: Resource ID. + :vartype id: str + :ivar configuration_groups: Effective configuration groups. + :vartype configuration_groups: + list[~azure.mgmt.network.v2021_05_01_preview.models.ConfigurationGroup] + :ivar display_name: A friendly name for the resource. + :vartype display_name: str + :ivar description: A description of the connectivity configuration. + :vartype description: str + :ivar connectivity_topology: Connectivity topology type. Possible values include: "HubAndSpoke", "Mesh". - :type connectivity_topology: str or - ~azure.mgmt.network.v2021_02_01_preview.models.ConnectivityTopology - :param hubs: List of hubItems. - :type hubs: list[~azure.mgmt.network.v2021_02_01_preview.models.Hub] - :param is_global: Flag if global mesh is supported. Possible values include: "False", "True". - :type is_global: str or ~azure.mgmt.network.v2021_02_01_preview.models.IsGlobal - :param applies_to_groups: Groups for configuration. - :type applies_to_groups: - list[~azure.mgmt.network.v2021_02_01_preview.models.ConnectivityGroupItem] + :vartype connectivity_topology: str or + ~azure.mgmt.network.v2021_05_01_preview.models.ConnectivityTopology + :ivar hubs: List of hubItems. + :vartype hubs: list[~azure.mgmt.network.v2021_05_01_preview.models.Hub] + :ivar is_global: Flag if global mesh is supported. Possible values include: "False", "True". + :vartype is_global: str or ~azure.mgmt.network.v2021_05_01_preview.models.IsGlobal + :ivar applies_to_groups: Groups for configuration. + :vartype applies_to_groups: + list[~azure.mgmt.network.v2021_05_01_preview.models.ConnectivityGroupItem] :ivar provisioning_state: The provisioning state of the connectivity configuration resource. Possible values include: "Succeeded", "Updating", "Deleting", "Failed". :vartype provisioning_state: str or - ~azure.mgmt.network.v2021_02_01_preview.models.ProvisioningState - :param delete_existing_peering: Flag if need to remove current existing peerings. Possible + ~azure.mgmt.network.v2021_05_01_preview.models.ProvisioningState + :ivar delete_existing_peering: Flag if need to remove current existing peerings. Possible values include: "False", "True". - :type delete_existing_peering: str or - ~azure.mgmt.network.v2021_02_01_preview.models.DeleteExistingPeering + :vartype delete_existing_peering: str or + ~azure.mgmt.network.v2021_05_01_preview.models.DeleteExistingPeering """ _validation = { @@ -267,6 +316,32 @@ def __init__( delete_existing_peering: Optional[Union[str, "DeleteExistingPeering"]] = None, **kwargs ): + """ + :keyword id: Resource ID. + :paramtype id: str + :keyword configuration_groups: Effective configuration groups. + :paramtype configuration_groups: + list[~azure.mgmt.network.v2021_05_01_preview.models.ConfigurationGroup] + :keyword display_name: A friendly name for the resource. + :paramtype display_name: str + :keyword description: A description of the connectivity configuration. + :paramtype description: str + :keyword connectivity_topology: Connectivity topology type. Possible values include: + "HubAndSpoke", "Mesh". + :paramtype connectivity_topology: str or + ~azure.mgmt.network.v2021_05_01_preview.models.ConnectivityTopology + :keyword hubs: List of hubItems. + :paramtype hubs: list[~azure.mgmt.network.v2021_05_01_preview.models.Hub] + :keyword is_global: Flag if global mesh is supported. Possible values include: "False", "True". + :paramtype is_global: str or ~azure.mgmt.network.v2021_05_01_preview.models.IsGlobal + :keyword applies_to_groups: Groups for configuration. + :paramtype applies_to_groups: + list[~azure.mgmt.network.v2021_05_01_preview.models.ConnectivityGroupItem] + :keyword delete_existing_peering: Flag if need to remove current existing peerings. Possible + values include: "False", "True". + :paramtype delete_existing_peering: str or + ~azure.mgmt.network.v2021_05_01_preview.models.DeleteExistingPeering + """ super(EffectiveConnectivityConfiguration, self).__init__(**kwargs) self.id = id self.configuration_groups = configuration_groups @@ -285,38 +360,38 @@ class ActiveConnectivityConfiguration(EffectiveConnectivityConfiguration): Variables are only populated by the server, and will be ignored when sending a request. - :param id: Resource ID. - :type id: str - :param configuration_groups: Effective configuration groups. - :type configuration_groups: - list[~azure.mgmt.network.v2021_02_01_preview.models.ConfigurationGroup] - :param display_name: A friendly name for the resource. - :type display_name: str - :param description: A description of the connectivity configuration. - :type description: str - :param connectivity_topology: Connectivity topology type. Possible values include: + :ivar id: Resource ID. + :vartype id: str + :ivar configuration_groups: Effective configuration groups. + :vartype configuration_groups: + list[~azure.mgmt.network.v2021_05_01_preview.models.ConfigurationGroup] + :ivar display_name: A friendly name for the resource. + :vartype display_name: str + :ivar description: A description of the connectivity configuration. + :vartype description: str + :ivar connectivity_topology: Connectivity topology type. Possible values include: "HubAndSpoke", "Mesh". - :type connectivity_topology: str or - ~azure.mgmt.network.v2021_02_01_preview.models.ConnectivityTopology - :param hubs: List of hubItems. - :type hubs: list[~azure.mgmt.network.v2021_02_01_preview.models.Hub] - :param is_global: Flag if global mesh is supported. Possible values include: "False", "True". - :type is_global: str or ~azure.mgmt.network.v2021_02_01_preview.models.IsGlobal - :param applies_to_groups: Groups for configuration. - :type applies_to_groups: - list[~azure.mgmt.network.v2021_02_01_preview.models.ConnectivityGroupItem] + :vartype connectivity_topology: str or + ~azure.mgmt.network.v2021_05_01_preview.models.ConnectivityTopology + :ivar hubs: List of hubItems. + :vartype hubs: list[~azure.mgmt.network.v2021_05_01_preview.models.Hub] + :ivar is_global: Flag if global mesh is supported. Possible values include: "False", "True". + :vartype is_global: str or ~azure.mgmt.network.v2021_05_01_preview.models.IsGlobal + :ivar applies_to_groups: Groups for configuration. + :vartype applies_to_groups: + list[~azure.mgmt.network.v2021_05_01_preview.models.ConnectivityGroupItem] :ivar provisioning_state: The provisioning state of the connectivity configuration resource. Possible values include: "Succeeded", "Updating", "Deleting", "Failed". :vartype provisioning_state: str or - ~azure.mgmt.network.v2021_02_01_preview.models.ProvisioningState - :param delete_existing_peering: Flag if need to remove current existing peerings. Possible + ~azure.mgmt.network.v2021_05_01_preview.models.ProvisioningState + :ivar delete_existing_peering: Flag if need to remove current existing peerings. Possible values include: "False", "True". - :type delete_existing_peering: str or - ~azure.mgmt.network.v2021_02_01_preview.models.DeleteExistingPeering - :param commit_time: Deployment time string. - :type commit_time: ~datetime.datetime - :param region: Deployment region. - :type region: str + :vartype delete_existing_peering: str or + ~azure.mgmt.network.v2021_05_01_preview.models.DeleteExistingPeering + :ivar commit_time: Deployment time string. + :vartype commit_time: ~datetime.datetime + :ivar region: Deployment region. + :vartype region: str """ _validation = { @@ -354,6 +429,36 @@ def __init__( region: Optional[str] = None, **kwargs ): + """ + :keyword id: Resource ID. + :paramtype id: str + :keyword configuration_groups: Effective configuration groups. + :paramtype configuration_groups: + list[~azure.mgmt.network.v2021_05_01_preview.models.ConfigurationGroup] + :keyword display_name: A friendly name for the resource. + :paramtype display_name: str + :keyword description: A description of the connectivity configuration. + :paramtype description: str + :keyword connectivity_topology: Connectivity topology type. Possible values include: + "HubAndSpoke", "Mesh". + :paramtype connectivity_topology: str or + ~azure.mgmt.network.v2021_05_01_preview.models.ConnectivityTopology + :keyword hubs: List of hubItems. + :paramtype hubs: list[~azure.mgmt.network.v2021_05_01_preview.models.Hub] + :keyword is_global: Flag if global mesh is supported. Possible values include: "False", "True". + :paramtype is_global: str or ~azure.mgmt.network.v2021_05_01_preview.models.IsGlobal + :keyword applies_to_groups: Groups for configuration. + :paramtype applies_to_groups: + list[~azure.mgmt.network.v2021_05_01_preview.models.ConnectivityGroupItem] + :keyword delete_existing_peering: Flag if need to remove current existing peerings. Possible + values include: "False", "True". + :paramtype delete_existing_peering: str or + ~azure.mgmt.network.v2021_05_01_preview.models.DeleteExistingPeering + :keyword commit_time: Deployment time string. + :paramtype commit_time: ~datetime.datetime + :keyword region: Deployment region. + :paramtype region: str + """ super(ActiveConnectivityConfiguration, self).__init__(id=id, configuration_groups=configuration_groups, display_name=display_name, description=description, connectivity_topology=connectivity_topology, hubs=hubs, is_global=is_global, applies_to_groups=applies_to_groups, delete_existing_peering=delete_existing_peering, **kwargs) self.commit_time = commit_time self.region = region @@ -362,12 +467,12 @@ def __init__( class ActiveConnectivityConfigurationsListResult(msrest.serialization.Model): """Result of the request to list active connectivity configurations. It contains a list of active connectivity configurations and a skiptoken to get the next set of results. - :param value: Gets a page of active connectivity configurations. - :type value: - list[~azure.mgmt.network.v2021_02_01_preview.models.ActiveConnectivityConfiguration] - :param skip_token: When present, the value can be passed to a subsequent query call (together + :ivar value: Gets a page of active connectivity configurations. + :vartype value: + list[~azure.mgmt.network.v2021_05_01_preview.models.ActiveConnectivityConfiguration] + :ivar skip_token: When present, the value can be passed to a subsequent query call (together with the same query and scopes used in the current request) to retrieve the next page of data. - :type skip_token: str + :vartype skip_token: str """ _attribute_map = { @@ -382,6 +487,14 @@ def __init__( skip_token: Optional[str] = None, **kwargs ): + """ + :keyword value: Gets a page of active connectivity configurations. + :paramtype value: + list[~azure.mgmt.network.v2021_05_01_preview.models.ActiveConnectivityConfiguration] + :keyword skip_token: When present, the value can be passed to a subsequent query call (together + with the same query and scopes used in the current request) to retrieve the next page of data. + :paramtype skip_token: str + """ super(ActiveConnectivityConfigurationsListResult, self).__init__(**kwargs) self.value = value self.skip_token = skip_token @@ -394,42 +507,42 @@ class ActiveDefaultSecurityAdminRule(ActiveBaseSecurityAdminRule): All required parameters must be populated in order to send to Azure. - :param id: Resource ID. - :type id: str - :param commit_time: Deployment time string. - :type commit_time: ~datetime.datetime - :param region: Deployment region. - :type region: str - :param configuration_display_name: A display name of the security admin configuration. - :type configuration_display_name: str - :param configuration_description: A description of the security admin configuration. - :type configuration_description: str - :param rule_collection_display_name: A display name of the rule collection. - :type rule_collection_display_name: str - :param rule_collection_description: A description of the rule collection. - :type rule_collection_description: str - :param rule_collection_applies_to_groups: Groups for rule collection. - :type rule_collection_applies_to_groups: - list[~azure.mgmt.network.v2021_02_01_preview.models.NetworkManagerSecurityGroupItem] - :param rule_groups: Effective configuration groups. - :type rule_groups: list[~azure.mgmt.network.v2021_02_01_preview.models.ConfigurationGroup] - :param kind: Required. Whether the rule is custom or default.Constant filled by server. - Possible values include: "Custom", "Default". - :type kind: str or ~azure.mgmt.network.v2021_02_01_preview.models.EffectiveAdminRuleKind + :ivar id: Resource ID. + :vartype id: str + :ivar commit_time: Deployment time string. + :vartype commit_time: ~datetime.datetime + :ivar region: Deployment region. + :vartype region: str + :ivar configuration_display_name: A display name of the security admin configuration. + :vartype configuration_display_name: str + :ivar configuration_description: A description of the security admin configuration. + :vartype configuration_description: str + :ivar rule_collection_display_name: A display name of the rule collection. + :vartype rule_collection_display_name: str + :ivar rule_collection_description: A description of the rule collection. + :vartype rule_collection_description: str + :ivar rule_collection_applies_to_groups: Groups for rule collection. + :vartype rule_collection_applies_to_groups: + list[~azure.mgmt.network.v2021_05_01_preview.models.NetworkManagerSecurityGroupItem] + :ivar rule_groups: Effective configuration groups. + :vartype rule_groups: list[~azure.mgmt.network.v2021_05_01_preview.models.ConfigurationGroup] + :ivar kind: Required. Whether the rule is custom or default.Constant filled by server. Possible + values include: "Custom", "Default". + :vartype kind: str or ~azure.mgmt.network.v2021_05_01_preview.models.EffectiveAdminRuleKind :ivar display_name: A friendly name for the rule. :vartype display_name: str :ivar description: A description for this rule. Restricted to 140 chars. :vartype description: str - :param flag: Default rule flag. - :type flag: str + :ivar flag: Default rule flag. + :vartype flag: str :ivar protocol: Network protocol this rule applies to. Possible values include: "Tcp", "Udp", "Icmp", "Esp", "Any", "Ah". :vartype protocol: str or - ~azure.mgmt.network.v2021_02_01_preview.models.SecurityConfigurationRuleProtocol + ~azure.mgmt.network.v2021_05_01_preview.models.SecurityConfigurationRuleProtocol :ivar sources: The CIDR or source IP ranges. - :vartype sources: list[~azure.mgmt.network.v2021_02_01_preview.models.AddressPrefixItem] + :vartype sources: list[~azure.mgmt.network.v2021_05_01_preview.models.AddressPrefixItem] :ivar destinations: The destination address prefixes. CIDR or destination IP ranges. - :vartype destinations: list[~azure.mgmt.network.v2021_02_01_preview.models.AddressPrefixItem] + :vartype destinations: list[~azure.mgmt.network.v2021_05_01_preview.models.AddressPrefixItem] :ivar source_port_ranges: The source port ranges. :vartype source_port_ranges: list[str] :ivar destination_port_ranges: The destination port ranges. @@ -437,7 +550,7 @@ class ActiveDefaultSecurityAdminRule(ActiveBaseSecurityAdminRule): :ivar access: Indicates the access allowed for this particular rule. Possible values include: "Allow", "Deny", "AlwaysAllow". :vartype access: str or - ~azure.mgmt.network.v2021_02_01_preview.models.SecurityConfigurationRuleAccess + ~azure.mgmt.network.v2021_05_01_preview.models.SecurityConfigurationRuleAccess :ivar priority: The priority of the rule. The value can be between 1 and 4096. The priority number must be unique for each rule in the collection. The lower the priority number, the higher the priority of the rule. @@ -445,11 +558,11 @@ class ActiveDefaultSecurityAdminRule(ActiveBaseSecurityAdminRule): :ivar direction: Indicates if the traffic matched against the rule in inbound or outbound. Possible values include: "Inbound", "Outbound". :vartype direction: str or - ~azure.mgmt.network.v2021_02_01_preview.models.SecurityConfigurationRuleDirection + ~azure.mgmt.network.v2021_05_01_preview.models.SecurityConfigurationRuleDirection :ivar provisioning_state: The provisioning state of the resource. Possible values include: "Succeeded", "Updating", "Deleting", "Failed". :vartype provisioning_state: str or - ~azure.mgmt.network.v2021_02_01_preview.models.ProvisioningState + ~azure.mgmt.network.v2021_05_01_preview.models.ProvisioningState """ _validation = { @@ -507,6 +620,29 @@ def __init__( flag: Optional[str] = None, **kwargs ): + """ + :keyword id: Resource ID. + :paramtype id: str + :keyword commit_time: Deployment time string. + :paramtype commit_time: ~datetime.datetime + :keyword region: Deployment region. + :paramtype region: str + :keyword configuration_display_name: A display name of the security admin configuration. + :paramtype configuration_display_name: str + :keyword configuration_description: A description of the security admin configuration. + :paramtype configuration_description: str + :keyword rule_collection_display_name: A display name of the rule collection. + :paramtype rule_collection_display_name: str + :keyword rule_collection_description: A description of the rule collection. + :paramtype rule_collection_description: str + :keyword rule_collection_applies_to_groups: Groups for rule collection. + :paramtype rule_collection_applies_to_groups: + list[~azure.mgmt.network.v2021_05_01_preview.models.NetworkManagerSecurityGroupItem] + :keyword rule_groups: Effective configuration groups. + :paramtype rule_groups: list[~azure.mgmt.network.v2021_05_01_preview.models.ConfigurationGroup] + :keyword flag: Default rule flag. + :paramtype flag: str + """ super(ActiveDefaultSecurityAdminRule, self).__init__(id=id, commit_time=commit_time, region=region, configuration_display_name=configuration_display_name, configuration_description=configuration_description, rule_collection_display_name=rule_collection_display_name, rule_collection_description=rule_collection_description, rule_collection_applies_to_groups=rule_collection_applies_to_groups, rule_groups=rule_groups, **kwargs) self.kind = 'Default' # type: str self.display_name = None @@ -530,42 +666,42 @@ class ActiveDefaultSecurityUserRule(ActiveBaseSecurityUserRule): All required parameters must be populated in order to send to Azure. - :param id: Resource ID. - :type id: str - :param commit_time: Deployment time string. - :type commit_time: ~datetime.datetime - :param region: Deployment region. - :type region: str - :param configuration_display_name: A display name of the security user configuration. - :type configuration_display_name: str - :param configuration_description: A description of the security user configuration. - :type configuration_description: str - :param rule_collection_display_name: A display name of the rule collection. - :type rule_collection_display_name: str - :param rule_collection_description: A description of the rule collection. - :type rule_collection_description: str - :param rule_collection_applies_to_groups: Groups for rule collection. - :type rule_collection_applies_to_groups: - list[~azure.mgmt.network.v2021_02_01_preview.models.NetworkManagerSecurityGroupItem] - :param rule_groups: Effective configuration groups. - :type rule_groups: list[~azure.mgmt.network.v2021_02_01_preview.models.ConfigurationGroup] - :param kind: Required. Whether the rule is custom or default.Constant filled by server. - Possible values include: "Custom", "Default". - :type kind: str or ~azure.mgmt.network.v2021_02_01_preview.models.EffectiveUserRuleKind + :ivar id: Resource ID. + :vartype id: str + :ivar commit_time: Deployment time string. + :vartype commit_time: ~datetime.datetime + :ivar region: Deployment region. + :vartype region: str + :ivar configuration_display_name: A display name of the security user configuration. + :vartype configuration_display_name: str + :ivar configuration_description: A description of the security user configuration. + :vartype configuration_description: str + :ivar rule_collection_display_name: A display name of the rule collection. + :vartype rule_collection_display_name: str + :ivar rule_collection_description: A description of the rule collection. + :vartype rule_collection_description: str + :ivar rule_collection_applies_to_groups: Groups for rule collection. + :vartype rule_collection_applies_to_groups: + list[~azure.mgmt.network.v2021_05_01_preview.models.NetworkManagerSecurityGroupItem] + :ivar rule_groups: Effective configuration groups. + :vartype rule_groups: list[~azure.mgmt.network.v2021_05_01_preview.models.ConfigurationGroup] + :ivar kind: Required. Whether the rule is custom or default.Constant filled by server. Possible + values include: "Custom", "Default". + :vartype kind: str or ~azure.mgmt.network.v2021_05_01_preview.models.EffectiveUserRuleKind :ivar display_name: A friendly name for the rule. :vartype display_name: str :ivar description: A description for this rule. Restricted to 140 chars. :vartype description: str - :param flag: Default rule flag. - :type flag: str + :ivar flag: Default rule flag. + :vartype flag: str :ivar protocol: Network protocol this rule applies to. Possible values include: "Tcp", "Udp", "Icmp", "Esp", "Any", "Ah". :vartype protocol: str or - ~azure.mgmt.network.v2021_02_01_preview.models.SecurityConfigurationRuleProtocol + ~azure.mgmt.network.v2021_05_01_preview.models.SecurityConfigurationRuleProtocol :ivar sources: The CIDR or source IP ranges. - :vartype sources: list[~azure.mgmt.network.v2021_02_01_preview.models.AddressPrefixItem] + :vartype sources: list[~azure.mgmt.network.v2021_05_01_preview.models.AddressPrefixItem] :ivar destinations: The destination address prefixes. CIDR or destination IP ranges. - :vartype destinations: list[~azure.mgmt.network.v2021_02_01_preview.models.AddressPrefixItem] + :vartype destinations: list[~azure.mgmt.network.v2021_05_01_preview.models.AddressPrefixItem] :ivar source_port_ranges: The source port ranges. :vartype source_port_ranges: list[str] :ivar destination_port_ranges: The destination port ranges. @@ -573,11 +709,11 @@ class ActiveDefaultSecurityUserRule(ActiveBaseSecurityUserRule): :ivar direction: Indicates if the traffic matched against the rule in inbound or outbound. Possible values include: "Inbound", "Outbound". :vartype direction: str or - ~azure.mgmt.network.v2021_02_01_preview.models.SecurityConfigurationRuleDirection + ~azure.mgmt.network.v2021_05_01_preview.models.SecurityConfigurationRuleDirection :ivar provisioning_state: The provisioning state of the security configuration user rule resource. Possible values include: "Succeeded", "Updating", "Deleting", "Failed". :vartype provisioning_state: str or - ~azure.mgmt.network.v2021_02_01_preview.models.ProvisioningState + ~azure.mgmt.network.v2021_05_01_preview.models.ProvisioningState """ _validation = { @@ -631,6 +767,29 @@ def __init__( flag: Optional[str] = None, **kwargs ): + """ + :keyword id: Resource ID. + :paramtype id: str + :keyword commit_time: Deployment time string. + :paramtype commit_time: ~datetime.datetime + :keyword region: Deployment region. + :paramtype region: str + :keyword configuration_display_name: A display name of the security user configuration. + :paramtype configuration_display_name: str + :keyword configuration_description: A description of the security user configuration. + :paramtype configuration_description: str + :keyword rule_collection_display_name: A display name of the rule collection. + :paramtype rule_collection_display_name: str + :keyword rule_collection_description: A description of the rule collection. + :paramtype rule_collection_description: str + :keyword rule_collection_applies_to_groups: Groups for rule collection. + :paramtype rule_collection_applies_to_groups: + list[~azure.mgmt.network.v2021_05_01_preview.models.NetworkManagerSecurityGroupItem] + :keyword rule_groups: Effective configuration groups. + :paramtype rule_groups: list[~azure.mgmt.network.v2021_05_01_preview.models.ConfigurationGroup] + :keyword flag: Default rule flag. + :paramtype flag: str + """ super(ActiveDefaultSecurityUserRule, self).__init__(id=id, commit_time=commit_time, region=region, configuration_display_name=configuration_display_name, configuration_description=configuration_description, rule_collection_display_name=rule_collection_display_name, rule_collection_description=rule_collection_description, rule_collection_applies_to_groups=rule_collection_applies_to_groups, rule_groups=rule_groups, **kwargs) self.kind = 'Default' # type: str self.display_name = None @@ -652,60 +811,60 @@ class ActiveSecurityAdminRule(ActiveBaseSecurityAdminRule): All required parameters must be populated in order to send to Azure. - :param id: Resource ID. - :type id: str - :param commit_time: Deployment time string. - :type commit_time: ~datetime.datetime - :param region: Deployment region. - :type region: str - :param configuration_display_name: A display name of the security admin configuration. - :type configuration_display_name: str - :param configuration_description: A description of the security admin configuration. - :type configuration_description: str - :param rule_collection_display_name: A display name of the rule collection. - :type rule_collection_display_name: str - :param rule_collection_description: A description of the rule collection. - :type rule_collection_description: str - :param rule_collection_applies_to_groups: Groups for rule collection. - :type rule_collection_applies_to_groups: - list[~azure.mgmt.network.v2021_02_01_preview.models.NetworkManagerSecurityGroupItem] - :param rule_groups: Effective configuration groups. - :type rule_groups: list[~azure.mgmt.network.v2021_02_01_preview.models.ConfigurationGroup] - :param kind: Required. Whether the rule is custom or default.Constant filled by server. - Possible values include: "Custom", "Default". - :type kind: str or ~azure.mgmt.network.v2021_02_01_preview.models.EffectiveAdminRuleKind - :param display_name: A friendly name for the rule. - :type display_name: str - :param description: A description for this rule. Restricted to 140 chars. - :type description: str - :param protocol: Network protocol this rule applies to. Possible values include: "Tcp", "Udp", + :ivar id: Resource ID. + :vartype id: str + :ivar commit_time: Deployment time string. + :vartype commit_time: ~datetime.datetime + :ivar region: Deployment region. + :vartype region: str + :ivar configuration_display_name: A display name of the security admin configuration. + :vartype configuration_display_name: str + :ivar configuration_description: A description of the security admin configuration. + :vartype configuration_description: str + :ivar rule_collection_display_name: A display name of the rule collection. + :vartype rule_collection_display_name: str + :ivar rule_collection_description: A description of the rule collection. + :vartype rule_collection_description: str + :ivar rule_collection_applies_to_groups: Groups for rule collection. + :vartype rule_collection_applies_to_groups: + list[~azure.mgmt.network.v2021_05_01_preview.models.NetworkManagerSecurityGroupItem] + :ivar rule_groups: Effective configuration groups. + :vartype rule_groups: list[~azure.mgmt.network.v2021_05_01_preview.models.ConfigurationGroup] + :ivar kind: Required. Whether the rule is custom or default.Constant filled by server. Possible + values include: "Custom", "Default". + :vartype kind: str or ~azure.mgmt.network.v2021_05_01_preview.models.EffectiveAdminRuleKind + :ivar display_name: A friendly name for the rule. + :vartype display_name: str + :ivar description: A description for this rule. Restricted to 140 chars. + :vartype description: str + :ivar protocol: Network protocol this rule applies to. Possible values include: "Tcp", "Udp", "Icmp", "Esp", "Any", "Ah". - :type protocol: str or - ~azure.mgmt.network.v2021_02_01_preview.models.SecurityConfigurationRuleProtocol - :param sources: The CIDR or source IP ranges. - :type sources: list[~azure.mgmt.network.v2021_02_01_preview.models.AddressPrefixItem] - :param destinations: The destination address prefixes. CIDR or destination IP ranges. - :type destinations: list[~azure.mgmt.network.v2021_02_01_preview.models.AddressPrefixItem] - :param source_port_ranges: The source port ranges. - :type source_port_ranges: list[str] - :param destination_port_ranges: The destination port ranges. - :type destination_port_ranges: list[str] - :param access: Indicates the access allowed for this particular rule. Possible values include: + :vartype protocol: str or + ~azure.mgmt.network.v2021_05_01_preview.models.SecurityConfigurationRuleProtocol + :ivar sources: The CIDR or source IP ranges. + :vartype sources: list[~azure.mgmt.network.v2021_05_01_preview.models.AddressPrefixItem] + :ivar destinations: The destination address prefixes. CIDR or destination IP ranges. + :vartype destinations: list[~azure.mgmt.network.v2021_05_01_preview.models.AddressPrefixItem] + :ivar source_port_ranges: The source port ranges. + :vartype source_port_ranges: list[str] + :ivar destination_port_ranges: The destination port ranges. + :vartype destination_port_ranges: list[str] + :ivar access: Indicates the access allowed for this particular rule. Possible values include: "Allow", "Deny", "AlwaysAllow". - :type access: str or - ~azure.mgmt.network.v2021_02_01_preview.models.SecurityConfigurationRuleAccess - :param priority: The priority of the rule. The value can be between 1 and 4096. The priority + :vartype access: str or + ~azure.mgmt.network.v2021_05_01_preview.models.SecurityConfigurationRuleAccess + :ivar priority: The priority of the rule. The value can be between 1 and 4096. The priority number must be unique for each rule in the collection. The lower the priority number, the higher the priority of the rule. - :type priority: int - :param direction: Indicates if the traffic matched against the rule in inbound or outbound. + :vartype priority: int + :ivar direction: Indicates if the traffic matched against the rule in inbound or outbound. Possible values include: "Inbound", "Outbound". - :type direction: str or - ~azure.mgmt.network.v2021_02_01_preview.models.SecurityConfigurationRuleDirection + :vartype direction: str or + ~azure.mgmt.network.v2021_05_01_preview.models.SecurityConfigurationRuleDirection :ivar provisioning_state: The provisioning state of the resource. Possible values include: "Succeeded", "Updating", "Deleting", "Failed". :vartype provisioning_state: str or - ~azure.mgmt.network.v2021_02_01_preview.models.ProvisioningState + ~azure.mgmt.network.v2021_05_01_preview.models.ProvisioningState """ _validation = { @@ -762,6 +921,55 @@ def __init__( direction: Optional[Union[str, "SecurityConfigurationRuleDirection"]] = None, **kwargs ): + """ + :keyword id: Resource ID. + :paramtype id: str + :keyword commit_time: Deployment time string. + :paramtype commit_time: ~datetime.datetime + :keyword region: Deployment region. + :paramtype region: str + :keyword configuration_display_name: A display name of the security admin configuration. + :paramtype configuration_display_name: str + :keyword configuration_description: A description of the security admin configuration. + :paramtype configuration_description: str + :keyword rule_collection_display_name: A display name of the rule collection. + :paramtype rule_collection_display_name: str + :keyword rule_collection_description: A description of the rule collection. + :paramtype rule_collection_description: str + :keyword rule_collection_applies_to_groups: Groups for rule collection. + :paramtype rule_collection_applies_to_groups: + list[~azure.mgmt.network.v2021_05_01_preview.models.NetworkManagerSecurityGroupItem] + :keyword rule_groups: Effective configuration groups. + :paramtype rule_groups: list[~azure.mgmt.network.v2021_05_01_preview.models.ConfigurationGroup] + :keyword display_name: A friendly name for the rule. + :paramtype display_name: str + :keyword description: A description for this rule. Restricted to 140 chars. + :paramtype description: str + :keyword protocol: Network protocol this rule applies to. Possible values include: "Tcp", + "Udp", "Icmp", "Esp", "Any", "Ah". + :paramtype protocol: str or + ~azure.mgmt.network.v2021_05_01_preview.models.SecurityConfigurationRuleProtocol + :keyword sources: The CIDR or source IP ranges. + :paramtype sources: list[~azure.mgmt.network.v2021_05_01_preview.models.AddressPrefixItem] + :keyword destinations: The destination address prefixes. CIDR or destination IP ranges. + :paramtype destinations: list[~azure.mgmt.network.v2021_05_01_preview.models.AddressPrefixItem] + :keyword source_port_ranges: The source port ranges. + :paramtype source_port_ranges: list[str] + :keyword destination_port_ranges: The destination port ranges. + :paramtype destination_port_ranges: list[str] + :keyword access: Indicates the access allowed for this particular rule. Possible values + include: "Allow", "Deny", "AlwaysAllow". + :paramtype access: str or + ~azure.mgmt.network.v2021_05_01_preview.models.SecurityConfigurationRuleAccess + :keyword priority: The priority of the rule. The value can be between 1 and 4096. The priority + number must be unique for each rule in the collection. The lower the priority number, the + higher the priority of the rule. + :paramtype priority: int + :keyword direction: Indicates if the traffic matched against the rule in inbound or outbound. + Possible values include: "Inbound", "Outbound". + :paramtype direction: str or + ~azure.mgmt.network.v2021_05_01_preview.models.SecurityConfigurationRuleDirection + """ super(ActiveSecurityAdminRule, self).__init__(id=id, commit_time=commit_time, region=region, configuration_display_name=configuration_display_name, configuration_description=configuration_description, rule_collection_display_name=rule_collection_display_name, rule_collection_description=rule_collection_description, rule_collection_applies_to_groups=rule_collection_applies_to_groups, rule_groups=rule_groups, **kwargs) self.kind = 'Custom' # type: str self.display_name = display_name @@ -780,11 +988,12 @@ def __init__( class ActiveSecurityAdminRulesListResult(msrest.serialization.Model): """Result of the request to list active security admin rules. It contains a list of active security admin rules and a skiptoken to get the next set of results. - :param value: Gets a page of active security admin rules. - :type value: list[~azure.mgmt.network.v2021_02_01_preview.models.ActiveBaseSecurityAdminRule] - :param skip_token: When present, the value can be passed to a subsequent query call (together + :ivar value: Gets a page of active security admin rules. + :vartype value: + list[~azure.mgmt.network.v2021_05_01_preview.models.ActiveBaseSecurityAdminRule] + :ivar skip_token: When present, the value can be passed to a subsequent query call (together with the same query and scopes used in the current request) to retrieve the next page of data. - :type skip_token: str + :vartype skip_token: str """ _attribute_map = { @@ -799,6 +1008,14 @@ def __init__( skip_token: Optional[str] = None, **kwargs ): + """ + :keyword value: Gets a page of active security admin rules. + :paramtype value: + list[~azure.mgmt.network.v2021_05_01_preview.models.ActiveBaseSecurityAdminRule] + :keyword skip_token: When present, the value can be passed to a subsequent query call (together + with the same query and scopes used in the current request) to retrieve the next page of data. + :paramtype skip_token: str + """ super(ActiveSecurityAdminRulesListResult, self).__init__(**kwargs) self.value = value self.skip_token = skip_token @@ -811,52 +1028,52 @@ class ActiveSecurityUserRule(ActiveBaseSecurityUserRule): All required parameters must be populated in order to send to Azure. - :param id: Resource ID. - :type id: str - :param commit_time: Deployment time string. - :type commit_time: ~datetime.datetime - :param region: Deployment region. - :type region: str - :param configuration_display_name: A display name of the security user configuration. - :type configuration_display_name: str - :param configuration_description: A description of the security user configuration. - :type configuration_description: str - :param rule_collection_display_name: A display name of the rule collection. - :type rule_collection_display_name: str - :param rule_collection_description: A description of the rule collection. - :type rule_collection_description: str - :param rule_collection_applies_to_groups: Groups for rule collection. - :type rule_collection_applies_to_groups: - list[~azure.mgmt.network.v2021_02_01_preview.models.NetworkManagerSecurityGroupItem] - :param rule_groups: Effective configuration groups. - :type rule_groups: list[~azure.mgmt.network.v2021_02_01_preview.models.ConfigurationGroup] - :param kind: Required. Whether the rule is custom or default.Constant filled by server. - Possible values include: "Custom", "Default". - :type kind: str or ~azure.mgmt.network.v2021_02_01_preview.models.EffectiveUserRuleKind - :param display_name: A friendly name for the rule. - :type display_name: str - :param description: A description for this rule. - :type description: str - :param protocol: Network protocol this rule applies to. Possible values include: "Tcp", "Udp", + :ivar id: Resource ID. + :vartype id: str + :ivar commit_time: Deployment time string. + :vartype commit_time: ~datetime.datetime + :ivar region: Deployment region. + :vartype region: str + :ivar configuration_display_name: A display name of the security user configuration. + :vartype configuration_display_name: str + :ivar configuration_description: A description of the security user configuration. + :vartype configuration_description: str + :ivar rule_collection_display_name: A display name of the rule collection. + :vartype rule_collection_display_name: str + :ivar rule_collection_description: A description of the rule collection. + :vartype rule_collection_description: str + :ivar rule_collection_applies_to_groups: Groups for rule collection. + :vartype rule_collection_applies_to_groups: + list[~azure.mgmt.network.v2021_05_01_preview.models.NetworkManagerSecurityGroupItem] + :ivar rule_groups: Effective configuration groups. + :vartype rule_groups: list[~azure.mgmt.network.v2021_05_01_preview.models.ConfigurationGroup] + :ivar kind: Required. Whether the rule is custom or default.Constant filled by server. Possible + values include: "Custom", "Default". + :vartype kind: str or ~azure.mgmt.network.v2021_05_01_preview.models.EffectiveUserRuleKind + :ivar display_name: A friendly name for the rule. + :vartype display_name: str + :ivar description: A description for this rule. + :vartype description: str + :ivar protocol: Network protocol this rule applies to. Possible values include: "Tcp", "Udp", "Icmp", "Esp", "Any", "Ah". - :type protocol: str or - ~azure.mgmt.network.v2021_02_01_preview.models.SecurityConfigurationRuleProtocol - :param sources: The CIDR or source IP ranges. - :type sources: list[~azure.mgmt.network.v2021_02_01_preview.models.AddressPrefixItem] - :param destinations: The destination address prefixes. CIDR or destination IP ranges. - :type destinations: list[~azure.mgmt.network.v2021_02_01_preview.models.AddressPrefixItem] - :param source_port_ranges: The source port ranges. - :type source_port_ranges: list[str] - :param destination_port_ranges: The destination port ranges. - :type destination_port_ranges: list[str] - :param direction: Indicates if the traffic matched against the rule in inbound or outbound. + :vartype protocol: str or + ~azure.mgmt.network.v2021_05_01_preview.models.SecurityConfigurationRuleProtocol + :ivar sources: The CIDR or source IP ranges. + :vartype sources: list[~azure.mgmt.network.v2021_05_01_preview.models.AddressPrefixItem] + :ivar destinations: The destination address prefixes. CIDR or destination IP ranges. + :vartype destinations: list[~azure.mgmt.network.v2021_05_01_preview.models.AddressPrefixItem] + :ivar source_port_ranges: The source port ranges. + :vartype source_port_ranges: list[str] + :ivar destination_port_ranges: The destination port ranges. + :vartype destination_port_ranges: list[str] + :ivar direction: Indicates if the traffic matched against the rule in inbound or outbound. Possible values include: "Inbound", "Outbound". - :type direction: str or - ~azure.mgmt.network.v2021_02_01_preview.models.SecurityConfigurationRuleDirection + :vartype direction: str or + ~azure.mgmt.network.v2021_05_01_preview.models.SecurityConfigurationRuleDirection :ivar provisioning_state: The provisioning state of the security configuration user rule resource. Possible values include: "Succeeded", "Updating", "Deleting", "Failed". :vartype provisioning_state: str or - ~azure.mgmt.network.v2021_02_01_preview.models.ProvisioningState + ~azure.mgmt.network.v2021_05_01_preview.models.ProvisioningState """ _validation = { @@ -908,6 +1125,47 @@ def __init__( direction: Optional[Union[str, "SecurityConfigurationRuleDirection"]] = None, **kwargs ): + """ + :keyword id: Resource ID. + :paramtype id: str + :keyword commit_time: Deployment time string. + :paramtype commit_time: ~datetime.datetime + :keyword region: Deployment region. + :paramtype region: str + :keyword configuration_display_name: A display name of the security user configuration. + :paramtype configuration_display_name: str + :keyword configuration_description: A description of the security user configuration. + :paramtype configuration_description: str + :keyword rule_collection_display_name: A display name of the rule collection. + :paramtype rule_collection_display_name: str + :keyword rule_collection_description: A description of the rule collection. + :paramtype rule_collection_description: str + :keyword rule_collection_applies_to_groups: Groups for rule collection. + :paramtype rule_collection_applies_to_groups: + list[~azure.mgmt.network.v2021_05_01_preview.models.NetworkManagerSecurityGroupItem] + :keyword rule_groups: Effective configuration groups. + :paramtype rule_groups: list[~azure.mgmt.network.v2021_05_01_preview.models.ConfigurationGroup] + :keyword display_name: A friendly name for the rule. + :paramtype display_name: str + :keyword description: A description for this rule. + :paramtype description: str + :keyword protocol: Network protocol this rule applies to. Possible values include: "Tcp", + "Udp", "Icmp", "Esp", "Any", "Ah". + :paramtype protocol: str or + ~azure.mgmt.network.v2021_05_01_preview.models.SecurityConfigurationRuleProtocol + :keyword sources: The CIDR or source IP ranges. + :paramtype sources: list[~azure.mgmt.network.v2021_05_01_preview.models.AddressPrefixItem] + :keyword destinations: The destination address prefixes. CIDR or destination IP ranges. + :paramtype destinations: list[~azure.mgmt.network.v2021_05_01_preview.models.AddressPrefixItem] + :keyword source_port_ranges: The source port ranges. + :paramtype source_port_ranges: list[str] + :keyword destination_port_ranges: The destination port ranges. + :paramtype destination_port_ranges: list[str] + :keyword direction: Indicates if the traffic matched against the rule in inbound or outbound. + Possible values include: "Inbound", "Outbound". + :paramtype direction: str or + ~azure.mgmt.network.v2021_05_01_preview.models.SecurityConfigurationRuleDirection + """ super(ActiveSecurityUserRule, self).__init__(id=id, commit_time=commit_time, region=region, configuration_display_name=configuration_display_name, configuration_description=configuration_description, rule_collection_display_name=rule_collection_display_name, rule_collection_description=rule_collection_description, rule_collection_applies_to_groups=rule_collection_applies_to_groups, rule_groups=rule_groups, **kwargs) self.kind = 'Custom' # type: str self.display_name = display_name @@ -924,11 +1182,11 @@ def __init__( class ActiveSecurityUserRulesListResult(msrest.serialization.Model): """Result of the request to list active security user rules. It contains a list of active security user rules and a skiptoken to get the next set of results. - :param value: Gets a page of active security user rules. - :type value: list[~azure.mgmt.network.v2021_02_01_preview.models.ActiveBaseSecurityUserRule] - :param skip_token: When present, the value can be passed to a subsequent query call (together + :ivar value: Gets a page of active security user rules. + :vartype value: list[~azure.mgmt.network.v2021_05_01_preview.models.ActiveBaseSecurityUserRule] + :ivar skip_token: When present, the value can be passed to a subsequent query call (together with the same query and scopes used in the current request) to retrieve the next page of data. - :type skip_token: str + :vartype skip_token: str """ _attribute_map = { @@ -943,6 +1201,14 @@ def __init__( skip_token: Optional[str] = None, **kwargs ): + """ + :keyword value: Gets a page of active security user rules. + :paramtype value: + list[~azure.mgmt.network.v2021_05_01_preview.models.ActiveBaseSecurityUserRule] + :keyword skip_token: When present, the value can be passed to a subsequent query call (together + with the same query and scopes used in the current request) to retrieve the next page of data. + :paramtype skip_token: str + """ super(ActiveSecurityUserRulesListResult, self).__init__(**kwargs) self.value = value self.skip_token = skip_token @@ -951,12 +1217,12 @@ def __init__( class AddressPrefixItem(msrest.serialization.Model): """Address prefix item. - :param address_prefix: Address prefix. - :type address_prefix: str - :param address_prefix_type: Address prefix type. Possible values include: "IPPrefix", + :ivar address_prefix: Address prefix. + :vartype address_prefix: str + :ivar address_prefix_type: Address prefix type. Possible values include: "IPPrefix", "ServiceTag". - :type address_prefix_type: str or - ~azure.mgmt.network.v2021_02_01_preview.models.AddressPrefixType + :vartype address_prefix_type: str or + ~azure.mgmt.network.v2021_05_01_preview.models.AddressPrefixType """ _attribute_map = { @@ -971,6 +1237,14 @@ def __init__( address_prefix_type: Optional[Union[str, "AddressPrefixType"]] = None, **kwargs ): + """ + :keyword address_prefix: Address prefix. + :paramtype address_prefix: str + :keyword address_prefix_type: Address prefix type. Possible values include: "IPPrefix", + "ServiceTag". + :paramtype address_prefix_type: str or + ~azure.mgmt.network.v2021_05_01_preview.models.AddressPrefixType + """ super(AddressPrefixItem, self).__init__(**kwargs) self.address_prefix = address_prefix self.address_prefix_type = address_prefix_type @@ -1009,6 +1283,8 @@ def __init__( self, **kwargs ): + """ + """ super(ProxyResource, self).__init__(**kwargs) self.id = None self.name = None @@ -1034,11 +1310,11 @@ class BaseAdminRule(ProxyResource): :vartype type: str :ivar etag: A unique read-only string that changes whenever the resource is updated. :vartype etag: str - :param kind: Required. Whether the rule is custom or default.Constant filled by server. - Possible values include: "Custom", "Default". - :type kind: str or ~azure.mgmt.network.v2021_02_01_preview.models.AdminRuleKind + :ivar kind: Required. Whether the rule is custom or default.Constant filled by server. Possible + values include: "Custom", "Default". + :vartype kind: str or ~azure.mgmt.network.v2021_05_01_preview.models.AdminRuleKind :ivar system_data: The system metadata related to this resource. - :vartype system_data: ~azure.mgmt.network.v2021_02_01_preview.models.SystemData + :vartype system_data: ~azure.mgmt.network.v2021_05_01_preview.models.SystemData """ _validation = { @@ -1067,6 +1343,8 @@ def __init__( self, **kwargs ): + """ + """ super(BaseAdminRule, self).__init__(**kwargs) self.kind = 'BaseAdminRule' # type: str self.system_data = None @@ -1087,43 +1365,43 @@ class AdminRule(BaseAdminRule): :vartype type: str :ivar etag: A unique read-only string that changes whenever the resource is updated. :vartype etag: str - :param kind: Required. Whether the rule is custom or default.Constant filled by server. - Possible values include: "Custom", "Default". - :type kind: str or ~azure.mgmt.network.v2021_02_01_preview.models.AdminRuleKind + :ivar kind: Required. Whether the rule is custom or default.Constant filled by server. Possible + values include: "Custom", "Default". + :vartype kind: str or ~azure.mgmt.network.v2021_05_01_preview.models.AdminRuleKind :ivar system_data: The system metadata related to this resource. - :vartype system_data: ~azure.mgmt.network.v2021_02_01_preview.models.SystemData - :param display_name: A friendly name for the rule. - :type display_name: str - :param description: A description for this rule. Restricted to 140 chars. - :type description: str - :param protocol: Network protocol this rule applies to. Possible values include: "Tcp", "Udp", + :vartype system_data: ~azure.mgmt.network.v2021_05_01_preview.models.SystemData + :ivar display_name: A friendly name for the rule. + :vartype display_name: str + :ivar description: A description for this rule. Restricted to 140 chars. + :vartype description: str + :ivar protocol: Network protocol this rule applies to. Possible values include: "Tcp", "Udp", "Icmp", "Esp", "Any", "Ah". - :type protocol: str or - ~azure.mgmt.network.v2021_02_01_preview.models.SecurityConfigurationRuleProtocol - :param sources: The CIDR or source IP ranges. - :type sources: list[~azure.mgmt.network.v2021_02_01_preview.models.AddressPrefixItem] - :param destinations: The destination address prefixes. CIDR or destination IP ranges. - :type destinations: list[~azure.mgmt.network.v2021_02_01_preview.models.AddressPrefixItem] - :param source_port_ranges: The source port ranges. - :type source_port_ranges: list[str] - :param destination_port_ranges: The destination port ranges. - :type destination_port_ranges: list[str] - :param access: Indicates the access allowed for this particular rule. Possible values include: + :vartype protocol: str or + ~azure.mgmt.network.v2021_05_01_preview.models.SecurityConfigurationRuleProtocol + :ivar sources: The CIDR or source IP ranges. + :vartype sources: list[~azure.mgmt.network.v2021_05_01_preview.models.AddressPrefixItem] + :ivar destinations: The destination address prefixes. CIDR or destination IP ranges. + :vartype destinations: list[~azure.mgmt.network.v2021_05_01_preview.models.AddressPrefixItem] + :ivar source_port_ranges: The source port ranges. + :vartype source_port_ranges: list[str] + :ivar destination_port_ranges: The destination port ranges. + :vartype destination_port_ranges: list[str] + :ivar access: Indicates the access allowed for this particular rule. Possible values include: "Allow", "Deny", "AlwaysAllow". - :type access: str or - ~azure.mgmt.network.v2021_02_01_preview.models.SecurityConfigurationRuleAccess - :param priority: The priority of the rule. The value can be between 1 and 4096. The priority + :vartype access: str or + ~azure.mgmt.network.v2021_05_01_preview.models.SecurityConfigurationRuleAccess + :ivar priority: The priority of the rule. The value can be between 1 and 4096. The priority number must be unique for each rule in the collection. The lower the priority number, the higher the priority of the rule. - :type priority: int - :param direction: Indicates if the traffic matched against the rule in inbound or outbound. + :vartype priority: int + :ivar direction: Indicates if the traffic matched against the rule in inbound or outbound. Possible values include: "Inbound", "Outbound". - :type direction: str or - ~azure.mgmt.network.v2021_02_01_preview.models.SecurityConfigurationRuleDirection + :vartype direction: str or + ~azure.mgmt.network.v2021_05_01_preview.models.SecurityConfigurationRuleDirection :ivar provisioning_state: The provisioning state of the resource. Possible values include: "Succeeded", "Updating", "Deleting", "Failed". :vartype provisioning_state: str or - ~azure.mgmt.network.v2021_02_01_preview.models.ProvisioningState + ~azure.mgmt.network.v2021_05_01_preview.models.ProvisioningState """ _validation = { @@ -1172,6 +1450,36 @@ def __init__( direction: Optional[Union[str, "SecurityConfigurationRuleDirection"]] = None, **kwargs ): + """ + :keyword display_name: A friendly name for the rule. + :paramtype display_name: str + :keyword description: A description for this rule. Restricted to 140 chars. + :paramtype description: str + :keyword protocol: Network protocol this rule applies to. Possible values include: "Tcp", + "Udp", "Icmp", "Esp", "Any", "Ah". + :paramtype protocol: str or + ~azure.mgmt.network.v2021_05_01_preview.models.SecurityConfigurationRuleProtocol + :keyword sources: The CIDR or source IP ranges. + :paramtype sources: list[~azure.mgmt.network.v2021_05_01_preview.models.AddressPrefixItem] + :keyword destinations: The destination address prefixes. CIDR or destination IP ranges. + :paramtype destinations: list[~azure.mgmt.network.v2021_05_01_preview.models.AddressPrefixItem] + :keyword source_port_ranges: The source port ranges. + :paramtype source_port_ranges: list[str] + :keyword destination_port_ranges: The destination port ranges. + :paramtype destination_port_ranges: list[str] + :keyword access: Indicates the access allowed for this particular rule. Possible values + include: "Allow", "Deny", "AlwaysAllow". + :paramtype access: str or + ~azure.mgmt.network.v2021_05_01_preview.models.SecurityConfigurationRuleAccess + :keyword priority: The priority of the rule. The value can be between 1 and 4096. The priority + number must be unique for each rule in the collection. The lower the priority number, the + higher the priority of the rule. + :paramtype priority: int + :keyword direction: Indicates if the traffic matched against the rule in inbound or outbound. + Possible values include: "Inbound", "Outbound". + :paramtype direction: str or + ~azure.mgmt.network.v2021_05_01_preview.models.SecurityConfigurationRuleDirection + """ super(AdminRule, self).__init__(**kwargs) self.kind = 'Custom' # type: str self.display_name = display_name @@ -1190,10 +1498,10 @@ def __init__( class AdminRuleListResult(msrest.serialization.Model): """security configuration admin rule list result. - :param value: A list of admin rules. - :type value: list[~azure.mgmt.network.v2021_02_01_preview.models.BaseAdminRule] - :param next_link: The URL to get the next set of results. - :type next_link: str + :ivar value: A list of admin rules. + :vartype value: list[~azure.mgmt.network.v2021_05_01_preview.models.BaseAdminRule] + :ivar next_link: The URL to get the next set of results. + :vartype next_link: str """ _attribute_map = { @@ -1208,6 +1516,12 @@ def __init__( next_link: Optional[str] = None, **kwargs ): + """ + :keyword value: A list of admin rules. + :paramtype value: list[~azure.mgmt.network.v2021_05_01_preview.models.BaseAdminRule] + :keyword next_link: The URL to get the next set of results. + :paramtype next_link: str + """ super(AdminRuleListResult, self).__init__(**kwargs) self.value = value self.next_link = next_link @@ -1231,11 +1545,11 @@ class BaseUserRule(ProxyResource): :vartype type: str :ivar etag: A unique read-only string that changes whenever the resource is updated. :vartype etag: str - :param kind: Required. Whether the rule is custom or default.Constant filled by server. - Possible values include: "Custom", "Default". - :type kind: str or ~azure.mgmt.network.v2021_02_01_preview.models.UserRuleKind + :ivar kind: Required. Whether the rule is custom or default.Constant filled by server. Possible + values include: "Custom", "Default". + :vartype kind: str or ~azure.mgmt.network.v2021_05_01_preview.models.UserRuleKind :ivar system_data: The system metadata related to this resource. - :vartype system_data: ~azure.mgmt.network.v2021_02_01_preview.models.SystemData + :vartype system_data: ~azure.mgmt.network.v2021_05_01_preview.models.SystemData """ _validation = { @@ -1264,6 +1578,8 @@ def __init__( self, **kwargs ): + """ + """ super(BaseUserRule, self).__init__(**kwargs) self.kind = 'BaseUserRule' # type: str self.system_data = None @@ -1272,17 +1588,17 @@ def __init__( class CloudErrorBody(msrest.serialization.Model): """An error response from the service. - :param code: An identifier for the error. Codes are invariant and are intended to be consumed + :ivar code: An identifier for the error. Codes are invariant and are intended to be consumed programmatically. - :type code: str - :param message: A message describing the error, intended to be suitable for display in a user + :vartype code: str + :ivar message: A message describing the error, intended to be suitable for display in a user interface. - :type message: str - :param target: The target of the particular error. For example, the name of the property in + :vartype message: str + :ivar target: The target of the particular error. For example, the name of the property in error. - :type target: str - :param details: A list of additional details about the error. - :type details: list[~azure.mgmt.network.v2021_02_01_preview.models.CloudErrorBody] + :vartype target: str + :ivar details: A list of additional details about the error. + :vartype details: list[~azure.mgmt.network.v2021_05_01_preview.models.CloudErrorBody] """ _attribute_map = { @@ -1301,6 +1617,19 @@ def __init__( details: Optional[List["CloudErrorBody"]] = None, **kwargs ): + """ + :keyword code: An identifier for the error. Codes are invariant and are intended to be consumed + programmatically. + :paramtype code: str + :keyword message: A message describing the error, intended to be suitable for display in a user + interface. + :paramtype message: str + :keyword target: The target of the particular error. For example, the name of the property in + error. + :paramtype target: str + :keyword details: A list of additional details about the error. + :paramtype details: list[~azure.mgmt.network.v2021_05_01_preview.models.CloudErrorBody] + """ super(CloudErrorBody, self).__init__(**kwargs) self.code = code self.message = message @@ -1313,22 +1642,18 @@ class ConfigurationGroup(msrest.serialization.Model): Variables are only populated by the server, and will be ignored when sending a request. - :param id: Resource ID. - :type id: str - :param display_name: A friendly name for the network group. - :type display_name: str - :param description: A description of the network group. - :type description: str - :param member_type: Group member type. - :type member_type: str - :param group_members: Group members of network group. - :type group_members: list[~azure.mgmt.network.v2021_02_01_preview.models.GroupMembersItem] - :param conditional_membership: Network group conditional filter. - :type conditional_membership: str + :ivar id: Resource ID. + :vartype id: str + :ivar display_name: A friendly name for the network group. + :vartype display_name: str + :ivar description: A description of the network group. + :vartype description: str + :ivar member_type: Group member type. + :vartype member_type: str :ivar provisioning_state: The provisioning state of the scope assignment resource. Possible values include: "Succeeded", "Updating", "Deleting", "Failed". :vartype provisioning_state: str or - ~azure.mgmt.network.v2021_02_01_preview.models.ProvisioningState + ~azure.mgmt.network.v2021_05_01_preview.models.ProvisioningState """ _validation = { @@ -1340,8 +1665,6 @@ class ConfigurationGroup(msrest.serialization.Model): 'display_name': {'key': 'properties.displayName', 'type': 'str'}, 'description': {'key': 'properties.description', 'type': 'str'}, 'member_type': {'key': 'properties.memberType', 'type': 'str'}, - 'group_members': {'key': 'properties.groupMembers', 'type': '[GroupMembersItem]'}, - 'conditional_membership': {'key': 'properties.conditionalMembership', 'type': 'str'}, 'provisioning_state': {'key': 'properties.provisioningState', 'type': 'str'}, } @@ -1352,17 +1675,23 @@ def __init__( display_name: Optional[str] = None, description: Optional[str] = None, member_type: Optional[str] = None, - group_members: Optional[List["GroupMembersItem"]] = None, - conditional_membership: Optional[str] = None, **kwargs ): + """ + :keyword id: Resource ID. + :paramtype id: str + :keyword display_name: A friendly name for the network group. + :paramtype display_name: str + :keyword description: A description of the network group. + :paramtype description: str + :keyword member_type: Group member type. + :paramtype member_type: str + """ super(ConfigurationGroup, self).__init__(**kwargs) self.id = id self.display_name = display_name self.description = description self.member_type = member_type - self.group_members = group_members - self.conditional_membership = conditional_membership self.provisioning_state = None @@ -1380,30 +1709,30 @@ class ConnectivityConfiguration(ProxyResource): :ivar etag: A unique read-only string that changes whenever the resource is updated. :vartype etag: str :ivar system_data: The system metadata related to this resource. - :vartype system_data: ~azure.mgmt.network.v2021_02_01_preview.models.SystemData - :param display_name: A friendly name for the resource. - :type display_name: str - :param description: A description of the connectivity configuration. - :type description: str - :param connectivity_topology: Connectivity topology type. Possible values include: + :vartype system_data: ~azure.mgmt.network.v2021_05_01_preview.models.SystemData + :ivar display_name: A friendly name for the resource. + :vartype display_name: str + :ivar description: A description of the connectivity configuration. + :vartype description: str + :ivar connectivity_topology: Connectivity topology type. Possible values include: "HubAndSpoke", "Mesh". - :type connectivity_topology: str or - ~azure.mgmt.network.v2021_02_01_preview.models.ConnectivityTopology - :param hubs: List of hubItems. - :type hubs: list[~azure.mgmt.network.v2021_02_01_preview.models.Hub] - :param is_global: Flag if global mesh is supported. Possible values include: "False", "True". - :type is_global: str or ~azure.mgmt.network.v2021_02_01_preview.models.IsGlobal - :param applies_to_groups: Groups for configuration. - :type applies_to_groups: - list[~azure.mgmt.network.v2021_02_01_preview.models.ConnectivityGroupItem] + :vartype connectivity_topology: str or + ~azure.mgmt.network.v2021_05_01_preview.models.ConnectivityTopology + :ivar hubs: List of hubItems. + :vartype hubs: list[~azure.mgmt.network.v2021_05_01_preview.models.Hub] + :ivar is_global: Flag if global mesh is supported. Possible values include: "False", "True". + :vartype is_global: str or ~azure.mgmt.network.v2021_05_01_preview.models.IsGlobal + :ivar applies_to_groups: Groups for configuration. + :vartype applies_to_groups: + list[~azure.mgmt.network.v2021_05_01_preview.models.ConnectivityGroupItem] :ivar provisioning_state: The provisioning state of the connectivity configuration resource. Possible values include: "Succeeded", "Updating", "Deleting", "Failed". :vartype provisioning_state: str or - ~azure.mgmt.network.v2021_02_01_preview.models.ProvisioningState - :param delete_existing_peering: Flag if need to remove current existing peerings. Possible + ~azure.mgmt.network.v2021_05_01_preview.models.ProvisioningState + :ivar delete_existing_peering: Flag if need to remove current existing peerings. Possible values include: "False", "True". - :type delete_existing_peering: str or - ~azure.mgmt.network.v2021_02_01_preview.models.DeleteExistingPeering + :vartype delete_existing_peering: str or + ~azure.mgmt.network.v2021_05_01_preview.models.DeleteExistingPeering """ _validation = { @@ -1443,6 +1772,27 @@ def __init__( delete_existing_peering: Optional[Union[str, "DeleteExistingPeering"]] = None, **kwargs ): + """ + :keyword display_name: A friendly name for the resource. + :paramtype display_name: str + :keyword description: A description of the connectivity configuration. + :paramtype description: str + :keyword connectivity_topology: Connectivity topology type. Possible values include: + "HubAndSpoke", "Mesh". + :paramtype connectivity_topology: str or + ~azure.mgmt.network.v2021_05_01_preview.models.ConnectivityTopology + :keyword hubs: List of hubItems. + :paramtype hubs: list[~azure.mgmt.network.v2021_05_01_preview.models.Hub] + :keyword is_global: Flag if global mesh is supported. Possible values include: "False", "True". + :paramtype is_global: str or ~azure.mgmt.network.v2021_05_01_preview.models.IsGlobal + :keyword applies_to_groups: Groups for configuration. + :paramtype applies_to_groups: + list[~azure.mgmt.network.v2021_05_01_preview.models.ConnectivityGroupItem] + :keyword delete_existing_peering: Flag if need to remove current existing peerings. Possible + values include: "False", "True". + :paramtype delete_existing_peering: str or + ~azure.mgmt.network.v2021_05_01_preview.models.DeleteExistingPeering + """ super(ConnectivityConfiguration, self).__init__(**kwargs) self.system_data = None self.display_name = display_name @@ -1458,10 +1808,10 @@ def __init__( class ConnectivityConfigurationListResult(msrest.serialization.Model): """Result of the request to list network manager connectivity configurations. It contains a list of configurations and a link to get the next set of results. - :param value: Gets a page of Connectivity Configurations. - :type value: list[~azure.mgmt.network.v2021_02_01_preview.models.ConnectivityConfiguration] - :param next_link: Gets the URL to get the next page of results. - :type next_link: str + :ivar value: Gets a page of Connectivity Configurations. + :vartype value: list[~azure.mgmt.network.v2021_05_01_preview.models.ConnectivityConfiguration] + :ivar next_link: Gets the URL to get the next page of results. + :vartype next_link: str """ _attribute_map = { @@ -1476,27 +1826,41 @@ def __init__( next_link: Optional[str] = None, **kwargs ): + """ + :keyword value: Gets a page of Connectivity Configurations. + :paramtype value: + list[~azure.mgmt.network.v2021_05_01_preview.models.ConnectivityConfiguration] + :keyword next_link: Gets the URL to get the next page of results. + :paramtype next_link: str + """ super(ConnectivityConfigurationListResult, self).__init__(**kwargs) self.value = value self.next_link = next_link class ConnectivityGroupItem(msrest.serialization.Model): - """ConnectivityGroupItem. + """Connectivity group item. + + All required parameters must be populated in order to send to Azure. - :param network_group_id: Network group Id. - :type network_group_id: str - :param use_hub_gateway: Flag if need to use hub gateway. Possible values include: "False", + :ivar network_group_id: Required. Network group Id. + :vartype network_group_id: str + :ivar use_hub_gateway: Flag if need to use hub gateway. Possible values include: "False", "True". - :type use_hub_gateway: str or ~azure.mgmt.network.v2021_02_01_preview.models.UseHubGateway - :param is_global: Flag if global is supported. Possible values include: "False", "True". - :type is_global: str or ~azure.mgmt.network.v2021_02_01_preview.models.IsGlobal - :param group_connectivity: Group connectivity type. Possible values include: "None", + :vartype use_hub_gateway: str or ~azure.mgmt.network.v2021_05_01_preview.models.UseHubGateway + :ivar is_global: Flag if global is supported. Possible values include: "False", "True". + :vartype is_global: str or ~azure.mgmt.network.v2021_05_01_preview.models.IsGlobal + :ivar group_connectivity: Required. Group connectivity type. Possible values include: "None", "DirectlyConnected". - :type group_connectivity: str or - ~azure.mgmt.network.v2021_02_01_preview.models.GroupConnectivity + :vartype group_connectivity: str or + ~azure.mgmt.network.v2021_05_01_preview.models.GroupConnectivity """ + _validation = { + 'network_group_id': {'required': True}, + 'group_connectivity': {'required': True}, + } + _attribute_map = { 'network_group_id': {'key': 'networkGroupId', 'type': 'str'}, 'use_hub_gateway': {'key': 'useHubGateway', 'type': 'str'}, @@ -1507,12 +1871,25 @@ class ConnectivityGroupItem(msrest.serialization.Model): def __init__( self, *, - network_group_id: Optional[str] = None, + network_group_id: str, + group_connectivity: Union[str, "GroupConnectivity"], use_hub_gateway: Optional[Union[str, "UseHubGateway"]] = None, is_global: Optional[Union[str, "IsGlobal"]] = None, - group_connectivity: Optional[Union[str, "GroupConnectivity"]] = None, **kwargs ): + """ + :keyword network_group_id: Required. Network group Id. + :paramtype network_group_id: str + :keyword use_hub_gateway: Flag if need to use hub gateway. Possible values include: "False", + "True". + :paramtype use_hub_gateway: str or ~azure.mgmt.network.v2021_05_01_preview.models.UseHubGateway + :keyword is_global: Flag if global is supported. Possible values include: "False", "True". + :paramtype is_global: str or ~azure.mgmt.network.v2021_05_01_preview.models.IsGlobal + :keyword group_connectivity: Required. Group connectivity type. Possible values include: + "None", "DirectlyConnected". + :paramtype group_connectivity: str or + ~azure.mgmt.network.v2021_05_01_preview.models.GroupConnectivity + """ super(ConnectivityGroupItem, self).__init__(**kwargs) self.network_group_id = network_group_id self.use_hub_gateway = use_hub_gateway @@ -1520,6 +1897,43 @@ def __init__( self.group_connectivity = group_connectivity +class CrossTenantScopes(msrest.serialization.Model): + """Cross tenant scopes. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar tenant_id: Tenant ID. + :vartype tenant_id: str + :ivar management_groups: List of management groups. + :vartype management_groups: list[str] + :ivar subscriptions: List of subscriptions. + :vartype subscriptions: list[str] + """ + + _validation = { + 'tenant_id': {'readonly': True}, + 'management_groups': {'readonly': True}, + 'subscriptions': {'readonly': True}, + } + + _attribute_map = { + 'tenant_id': {'key': 'tenantId', 'type': 'str'}, + 'management_groups': {'key': 'managementGroups', 'type': '[str]'}, + 'subscriptions': {'key': 'subscriptions', 'type': '[str]'}, + } + + def __init__( + self, + **kwargs + ): + """ + """ + super(CrossTenantScopes, self).__init__(**kwargs) + self.tenant_id = None + self.management_groups = None + self.subscriptions = None + + class DefaultAdminRule(BaseAdminRule): """Network default admin rule. @@ -1535,25 +1949,25 @@ class DefaultAdminRule(BaseAdminRule): :vartype type: str :ivar etag: A unique read-only string that changes whenever the resource is updated. :vartype etag: str - :param kind: Required. Whether the rule is custom or default.Constant filled by server. - Possible values include: "Custom", "Default". - :type kind: str or ~azure.mgmt.network.v2021_02_01_preview.models.AdminRuleKind + :ivar kind: Required. Whether the rule is custom or default.Constant filled by server. Possible + values include: "Custom", "Default". + :vartype kind: str or ~azure.mgmt.network.v2021_05_01_preview.models.AdminRuleKind :ivar system_data: The system metadata related to this resource. - :vartype system_data: ~azure.mgmt.network.v2021_02_01_preview.models.SystemData + :vartype system_data: ~azure.mgmt.network.v2021_05_01_preview.models.SystemData :ivar display_name: A friendly name for the rule. :vartype display_name: str :ivar description: A description for this rule. Restricted to 140 chars. :vartype description: str - :param flag: Default rule flag. - :type flag: str + :ivar flag: Default rule flag. + :vartype flag: str :ivar protocol: Network protocol this rule applies to. Possible values include: "Tcp", "Udp", "Icmp", "Esp", "Any", "Ah". :vartype protocol: str or - ~azure.mgmt.network.v2021_02_01_preview.models.SecurityConfigurationRuleProtocol + ~azure.mgmt.network.v2021_05_01_preview.models.SecurityConfigurationRuleProtocol :ivar sources: The CIDR or source IP ranges. - :vartype sources: list[~azure.mgmt.network.v2021_02_01_preview.models.AddressPrefixItem] + :vartype sources: list[~azure.mgmt.network.v2021_05_01_preview.models.AddressPrefixItem] :ivar destinations: The destination address prefixes. CIDR or destination IP ranges. - :vartype destinations: list[~azure.mgmt.network.v2021_02_01_preview.models.AddressPrefixItem] + :vartype destinations: list[~azure.mgmt.network.v2021_05_01_preview.models.AddressPrefixItem] :ivar source_port_ranges: The source port ranges. :vartype source_port_ranges: list[str] :ivar destination_port_ranges: The destination port ranges. @@ -1561,7 +1975,7 @@ class DefaultAdminRule(BaseAdminRule): :ivar access: Indicates the access allowed for this particular rule. Possible values include: "Allow", "Deny", "AlwaysAllow". :vartype access: str or - ~azure.mgmt.network.v2021_02_01_preview.models.SecurityConfigurationRuleAccess + ~azure.mgmt.network.v2021_05_01_preview.models.SecurityConfigurationRuleAccess :ivar priority: The priority of the rule. The value can be between 1 and 4096. The priority number must be unique for each rule in the collection. The lower the priority number, the higher the priority of the rule. @@ -1569,11 +1983,11 @@ class DefaultAdminRule(BaseAdminRule): :ivar direction: Indicates if the traffic matched against the rule in inbound or outbound. Possible values include: "Inbound", "Outbound". :vartype direction: str or - ~azure.mgmt.network.v2021_02_01_preview.models.SecurityConfigurationRuleDirection + ~azure.mgmt.network.v2021_05_01_preview.models.SecurityConfigurationRuleDirection :ivar provisioning_state: The provisioning state of the resource. Possible values include: "Succeeded", "Updating", "Deleting", "Failed". :vartype provisioning_state: str or - ~azure.mgmt.network.v2021_02_01_preview.models.ProvisioningState + ~azure.mgmt.network.v2021_05_01_preview.models.ProvisioningState """ _validation = { @@ -1623,6 +2037,10 @@ def __init__( flag: Optional[str] = None, **kwargs ): + """ + :keyword flag: Default rule flag. + :paramtype flag: str + """ super(DefaultAdminRule, self).__init__(**kwargs) self.kind = 'Default' # type: str self.display_name = None @@ -1654,25 +2072,25 @@ class DefaultUserRule(BaseUserRule): :vartype type: str :ivar etag: A unique read-only string that changes whenever the resource is updated. :vartype etag: str - :param kind: Required. Whether the rule is custom or default.Constant filled by server. - Possible values include: "Custom", "Default". - :type kind: str or ~azure.mgmt.network.v2021_02_01_preview.models.UserRuleKind + :ivar kind: Required. Whether the rule is custom or default.Constant filled by server. Possible + values include: "Custom", "Default". + :vartype kind: str or ~azure.mgmt.network.v2021_05_01_preview.models.UserRuleKind :ivar system_data: The system metadata related to this resource. - :vartype system_data: ~azure.mgmt.network.v2021_02_01_preview.models.SystemData + :vartype system_data: ~azure.mgmt.network.v2021_05_01_preview.models.SystemData :ivar display_name: A friendly name for the rule. :vartype display_name: str :ivar description: A description for this rule. Restricted to 140 chars. :vartype description: str - :param flag: Default rule flag. - :type flag: str + :ivar flag: Default rule flag. + :vartype flag: str :ivar protocol: Network protocol this rule applies to. Possible values include: "Tcp", "Udp", "Icmp", "Esp", "Any", "Ah". :vartype protocol: str or - ~azure.mgmt.network.v2021_02_01_preview.models.SecurityConfigurationRuleProtocol + ~azure.mgmt.network.v2021_05_01_preview.models.SecurityConfigurationRuleProtocol :ivar sources: The CIDR or source IP ranges. - :vartype sources: list[~azure.mgmt.network.v2021_02_01_preview.models.AddressPrefixItem] + :vartype sources: list[~azure.mgmt.network.v2021_05_01_preview.models.AddressPrefixItem] :ivar destinations: The destination address prefixes. CIDR or destination IP ranges. - :vartype destinations: list[~azure.mgmt.network.v2021_02_01_preview.models.AddressPrefixItem] + :vartype destinations: list[~azure.mgmt.network.v2021_05_01_preview.models.AddressPrefixItem] :ivar source_port_ranges: The source port ranges. :vartype source_port_ranges: list[str] :ivar destination_port_ranges: The destination port ranges. @@ -1680,11 +2098,11 @@ class DefaultUserRule(BaseUserRule): :ivar direction: Indicates if the traffic matched against the rule in inbound or outbound. Possible values include: "Inbound", "Outbound". :vartype direction: str or - ~azure.mgmt.network.v2021_02_01_preview.models.SecurityConfigurationRuleDirection + ~azure.mgmt.network.v2021_05_01_preview.models.SecurityConfigurationRuleDirection :ivar provisioning_state: The provisioning state of the security configuration user rule resource. Possible values include: "Succeeded", "Updating", "Deleting", "Failed". :vartype provisioning_state: str or - ~azure.mgmt.network.v2021_02_01_preview.models.ProvisioningState + ~azure.mgmt.network.v2021_05_01_preview.models.ProvisioningState """ _validation = { @@ -1730,6 +2148,10 @@ def __init__( flag: Optional[str] = None, **kwargs ): + """ + :keyword flag: Default rule flag. + :paramtype flag: str + """ super(DefaultUserRule, self).__init__(**kwargs) self.kind = 'Default' # type: str self.display_name = None @@ -1752,24 +2174,24 @@ class EffectiveBaseSecurityAdminRule(msrest.serialization.Model): All required parameters must be populated in order to send to Azure. - :param id: Resource ID. - :type id: str - :param configuration_display_name: A display name of the security admin configuration. - :type configuration_display_name: str - :param configuration_description: A description of the security admin configuration. - :type configuration_description: str - :param rule_collection_display_name: A display name of the rule collection. - :type rule_collection_display_name: str - :param rule_collection_description: A description of the rule collection. - :type rule_collection_description: str - :param rule_collection_applies_to_groups: Groups for rule collection. - :type rule_collection_applies_to_groups: - list[~azure.mgmt.network.v2021_02_01_preview.models.NetworkManagerSecurityGroupItem] - :param rule_groups: Effective configuration groups. - :type rule_groups: list[~azure.mgmt.network.v2021_02_01_preview.models.ConfigurationGroup] - :param kind: Required. Whether the rule is custom or default.Constant filled by server. - Possible values include: "Custom", "Default". - :type kind: str or ~azure.mgmt.network.v2021_02_01_preview.models.EffectiveAdminRuleKind + :ivar id: Resource ID. + :vartype id: str + :ivar configuration_display_name: A display name of the security admin configuration. + :vartype configuration_display_name: str + :ivar configuration_description: A description of the security admin configuration. + :vartype configuration_description: str + :ivar rule_collection_display_name: A display name of the rule collection. + :vartype rule_collection_display_name: str + :ivar rule_collection_description: A description of the rule collection. + :vartype rule_collection_description: str + :ivar rule_collection_applies_to_groups: Groups for rule collection. + :vartype rule_collection_applies_to_groups: + list[~azure.mgmt.network.v2021_05_01_preview.models.NetworkManagerSecurityGroupItem] + :ivar rule_groups: Effective configuration groups. + :vartype rule_groups: list[~azure.mgmt.network.v2021_05_01_preview.models.ConfigurationGroup] + :ivar kind: Required. Whether the rule is custom or default.Constant filled by server. Possible + values include: "Custom", "Default". + :vartype kind: str or ~azure.mgmt.network.v2021_05_01_preview.models.EffectiveAdminRuleKind """ _validation = { @@ -1803,6 +2225,23 @@ def __init__( rule_groups: Optional[List["ConfigurationGroup"]] = None, **kwargs ): + """ + :keyword id: Resource ID. + :paramtype id: str + :keyword configuration_display_name: A display name of the security admin configuration. + :paramtype configuration_display_name: str + :keyword configuration_description: A description of the security admin configuration. + :paramtype configuration_description: str + :keyword rule_collection_display_name: A display name of the rule collection. + :paramtype rule_collection_display_name: str + :keyword rule_collection_description: A description of the rule collection. + :paramtype rule_collection_description: str + :keyword rule_collection_applies_to_groups: Groups for rule collection. + :paramtype rule_collection_applies_to_groups: + list[~azure.mgmt.network.v2021_05_01_preview.models.NetworkManagerSecurityGroupItem] + :keyword rule_groups: Effective configuration groups. + :paramtype rule_groups: list[~azure.mgmt.network.v2021_05_01_preview.models.ConfigurationGroup] + """ super(EffectiveBaseSecurityAdminRule, self).__init__(**kwargs) self.id = id self.configuration_display_name = configuration_display_name @@ -1821,38 +2260,38 @@ class EffectiveDefaultSecurityAdminRule(EffectiveBaseSecurityAdminRule): All required parameters must be populated in order to send to Azure. - :param id: Resource ID. - :type id: str - :param configuration_display_name: A display name of the security admin configuration. - :type configuration_display_name: str - :param configuration_description: A description of the security admin configuration. - :type configuration_description: str - :param rule_collection_display_name: A display name of the rule collection. - :type rule_collection_display_name: str - :param rule_collection_description: A description of the rule collection. - :type rule_collection_description: str - :param rule_collection_applies_to_groups: Groups for rule collection. - :type rule_collection_applies_to_groups: - list[~azure.mgmt.network.v2021_02_01_preview.models.NetworkManagerSecurityGroupItem] - :param rule_groups: Effective configuration groups. - :type rule_groups: list[~azure.mgmt.network.v2021_02_01_preview.models.ConfigurationGroup] - :param kind: Required. Whether the rule is custom or default.Constant filled by server. - Possible values include: "Custom", "Default". - :type kind: str or ~azure.mgmt.network.v2021_02_01_preview.models.EffectiveAdminRuleKind + :ivar id: Resource ID. + :vartype id: str + :ivar configuration_display_name: A display name of the security admin configuration. + :vartype configuration_display_name: str + :ivar configuration_description: A description of the security admin configuration. + :vartype configuration_description: str + :ivar rule_collection_display_name: A display name of the rule collection. + :vartype rule_collection_display_name: str + :ivar rule_collection_description: A description of the rule collection. + :vartype rule_collection_description: str + :ivar rule_collection_applies_to_groups: Groups for rule collection. + :vartype rule_collection_applies_to_groups: + list[~azure.mgmt.network.v2021_05_01_preview.models.NetworkManagerSecurityGroupItem] + :ivar rule_groups: Effective configuration groups. + :vartype rule_groups: list[~azure.mgmt.network.v2021_05_01_preview.models.ConfigurationGroup] + :ivar kind: Required. Whether the rule is custom or default.Constant filled by server. Possible + values include: "Custom", "Default". + :vartype kind: str or ~azure.mgmt.network.v2021_05_01_preview.models.EffectiveAdminRuleKind :ivar display_name: A friendly name for the rule. :vartype display_name: str :ivar description: A description for this rule. Restricted to 140 chars. :vartype description: str - :param flag: Default rule flag. - :type flag: str + :ivar flag: Default rule flag. + :vartype flag: str :ivar protocol: Network protocol this rule applies to. Possible values include: "Tcp", "Udp", "Icmp", "Esp", "Any", "Ah". :vartype protocol: str or - ~azure.mgmt.network.v2021_02_01_preview.models.SecurityConfigurationRuleProtocol + ~azure.mgmt.network.v2021_05_01_preview.models.SecurityConfigurationRuleProtocol :ivar sources: The CIDR or source IP ranges. - :vartype sources: list[~azure.mgmt.network.v2021_02_01_preview.models.AddressPrefixItem] + :vartype sources: list[~azure.mgmt.network.v2021_05_01_preview.models.AddressPrefixItem] :ivar destinations: The destination address prefixes. CIDR or destination IP ranges. - :vartype destinations: list[~azure.mgmt.network.v2021_02_01_preview.models.AddressPrefixItem] + :vartype destinations: list[~azure.mgmt.network.v2021_05_01_preview.models.AddressPrefixItem] :ivar source_port_ranges: The source port ranges. :vartype source_port_ranges: list[str] :ivar destination_port_ranges: The destination port ranges. @@ -1860,7 +2299,7 @@ class EffectiveDefaultSecurityAdminRule(EffectiveBaseSecurityAdminRule): :ivar access: Indicates the access allowed for this particular rule. Possible values include: "Allow", "Deny", "AlwaysAllow". :vartype access: str or - ~azure.mgmt.network.v2021_02_01_preview.models.SecurityConfigurationRuleAccess + ~azure.mgmt.network.v2021_05_01_preview.models.SecurityConfigurationRuleAccess :ivar priority: The priority of the rule. The value can be between 1 and 4096. The priority number must be unique for each rule in the collection. The lower the priority number, the higher the priority of the rule. @@ -1868,11 +2307,11 @@ class EffectiveDefaultSecurityAdminRule(EffectiveBaseSecurityAdminRule): :ivar direction: Indicates if the traffic matched against the rule in inbound or outbound. Possible values include: "Inbound", "Outbound". :vartype direction: str or - ~azure.mgmt.network.v2021_02_01_preview.models.SecurityConfigurationRuleDirection + ~azure.mgmt.network.v2021_05_01_preview.models.SecurityConfigurationRuleDirection :ivar provisioning_state: The provisioning state of the resource. Possible values include: "Succeeded", "Updating", "Deleting", "Failed". :vartype provisioning_state: str or - ~azure.mgmt.network.v2021_02_01_preview.models.ProvisioningState + ~azure.mgmt.network.v2021_05_01_preview.models.ProvisioningState """ _validation = { @@ -1926,6 +2365,25 @@ def __init__( flag: Optional[str] = None, **kwargs ): + """ + :keyword id: Resource ID. + :paramtype id: str + :keyword configuration_display_name: A display name of the security admin configuration. + :paramtype configuration_display_name: str + :keyword configuration_description: A description of the security admin configuration. + :paramtype configuration_description: str + :keyword rule_collection_display_name: A display name of the rule collection. + :paramtype rule_collection_display_name: str + :keyword rule_collection_description: A description of the rule collection. + :paramtype rule_collection_description: str + :keyword rule_collection_applies_to_groups: Groups for rule collection. + :paramtype rule_collection_applies_to_groups: + list[~azure.mgmt.network.v2021_05_01_preview.models.NetworkManagerSecurityGroupItem] + :keyword rule_groups: Effective configuration groups. + :paramtype rule_groups: list[~azure.mgmt.network.v2021_05_01_preview.models.ConfigurationGroup] + :keyword flag: Default rule flag. + :paramtype flag: str + """ super(EffectiveDefaultSecurityAdminRule, self).__init__(id=id, configuration_display_name=configuration_display_name, configuration_description=configuration_description, rule_collection_display_name=rule_collection_display_name, rule_collection_description=rule_collection_description, rule_collection_applies_to_groups=rule_collection_applies_to_groups, rule_groups=rule_groups, **kwargs) self.kind = 'Default' # type: str self.display_name = None @@ -1949,56 +2407,56 @@ class EffectiveSecurityAdminRule(EffectiveBaseSecurityAdminRule): All required parameters must be populated in order to send to Azure. - :param id: Resource ID. - :type id: str - :param configuration_display_name: A display name of the security admin configuration. - :type configuration_display_name: str - :param configuration_description: A description of the security admin configuration. - :type configuration_description: str - :param rule_collection_display_name: A display name of the rule collection. - :type rule_collection_display_name: str - :param rule_collection_description: A description of the rule collection. - :type rule_collection_description: str - :param rule_collection_applies_to_groups: Groups for rule collection. - :type rule_collection_applies_to_groups: - list[~azure.mgmt.network.v2021_02_01_preview.models.NetworkManagerSecurityGroupItem] - :param rule_groups: Effective configuration groups. - :type rule_groups: list[~azure.mgmt.network.v2021_02_01_preview.models.ConfigurationGroup] - :param kind: Required. Whether the rule is custom or default.Constant filled by server. - Possible values include: "Custom", "Default". - :type kind: str or ~azure.mgmt.network.v2021_02_01_preview.models.EffectiveAdminRuleKind - :param display_name: A friendly name for the rule. - :type display_name: str - :param description: A description for this rule. Restricted to 140 chars. - :type description: str - :param protocol: Network protocol this rule applies to. Possible values include: "Tcp", "Udp", + :ivar id: Resource ID. + :vartype id: str + :ivar configuration_display_name: A display name of the security admin configuration. + :vartype configuration_display_name: str + :ivar configuration_description: A description of the security admin configuration. + :vartype configuration_description: str + :ivar rule_collection_display_name: A display name of the rule collection. + :vartype rule_collection_display_name: str + :ivar rule_collection_description: A description of the rule collection. + :vartype rule_collection_description: str + :ivar rule_collection_applies_to_groups: Groups for rule collection. + :vartype rule_collection_applies_to_groups: + list[~azure.mgmt.network.v2021_05_01_preview.models.NetworkManagerSecurityGroupItem] + :ivar rule_groups: Effective configuration groups. + :vartype rule_groups: list[~azure.mgmt.network.v2021_05_01_preview.models.ConfigurationGroup] + :ivar kind: Required. Whether the rule is custom or default.Constant filled by server. Possible + values include: "Custom", "Default". + :vartype kind: str or ~azure.mgmt.network.v2021_05_01_preview.models.EffectiveAdminRuleKind + :ivar display_name: A friendly name for the rule. + :vartype display_name: str + :ivar description: A description for this rule. Restricted to 140 chars. + :vartype description: str + :ivar protocol: Network protocol this rule applies to. Possible values include: "Tcp", "Udp", "Icmp", "Esp", "Any", "Ah". - :type protocol: str or - ~azure.mgmt.network.v2021_02_01_preview.models.SecurityConfigurationRuleProtocol - :param sources: The CIDR or source IP ranges. - :type sources: list[~azure.mgmt.network.v2021_02_01_preview.models.AddressPrefixItem] - :param destinations: The destination address prefixes. CIDR or destination IP ranges. - :type destinations: list[~azure.mgmt.network.v2021_02_01_preview.models.AddressPrefixItem] - :param source_port_ranges: The source port ranges. - :type source_port_ranges: list[str] - :param destination_port_ranges: The destination port ranges. - :type destination_port_ranges: list[str] - :param access: Indicates the access allowed for this particular rule. Possible values include: + :vartype protocol: str or + ~azure.mgmt.network.v2021_05_01_preview.models.SecurityConfigurationRuleProtocol + :ivar sources: The CIDR or source IP ranges. + :vartype sources: list[~azure.mgmt.network.v2021_05_01_preview.models.AddressPrefixItem] + :ivar destinations: The destination address prefixes. CIDR or destination IP ranges. + :vartype destinations: list[~azure.mgmt.network.v2021_05_01_preview.models.AddressPrefixItem] + :ivar source_port_ranges: The source port ranges. + :vartype source_port_ranges: list[str] + :ivar destination_port_ranges: The destination port ranges. + :vartype destination_port_ranges: list[str] + :ivar access: Indicates the access allowed for this particular rule. Possible values include: "Allow", "Deny", "AlwaysAllow". - :type access: str or - ~azure.mgmt.network.v2021_02_01_preview.models.SecurityConfigurationRuleAccess - :param priority: The priority of the rule. The value can be between 1 and 4096. The priority + :vartype access: str or + ~azure.mgmt.network.v2021_05_01_preview.models.SecurityConfigurationRuleAccess + :ivar priority: The priority of the rule. The value can be between 1 and 4096. The priority number must be unique for each rule in the collection. The lower the priority number, the higher the priority of the rule. - :type priority: int - :param direction: Indicates if the traffic matched against the rule in inbound or outbound. + :vartype priority: int + :ivar direction: Indicates if the traffic matched against the rule in inbound or outbound. Possible values include: "Inbound", "Outbound". - :type direction: str or - ~azure.mgmt.network.v2021_02_01_preview.models.SecurityConfigurationRuleDirection + :vartype direction: str or + ~azure.mgmt.network.v2021_05_01_preview.models.SecurityConfigurationRuleDirection :ivar provisioning_state: The provisioning state of the resource. Possible values include: "Succeeded", "Updating", "Deleting", "Failed". :vartype provisioning_state: str or - ~azure.mgmt.network.v2021_02_01_preview.models.ProvisioningState + ~azure.mgmt.network.v2021_05_01_preview.models.ProvisioningState """ _validation = { @@ -2051,6 +2509,51 @@ def __init__( direction: Optional[Union[str, "SecurityConfigurationRuleDirection"]] = None, **kwargs ): + """ + :keyword id: Resource ID. + :paramtype id: str + :keyword configuration_display_name: A display name of the security admin configuration. + :paramtype configuration_display_name: str + :keyword configuration_description: A description of the security admin configuration. + :paramtype configuration_description: str + :keyword rule_collection_display_name: A display name of the rule collection. + :paramtype rule_collection_display_name: str + :keyword rule_collection_description: A description of the rule collection. + :paramtype rule_collection_description: str + :keyword rule_collection_applies_to_groups: Groups for rule collection. + :paramtype rule_collection_applies_to_groups: + list[~azure.mgmt.network.v2021_05_01_preview.models.NetworkManagerSecurityGroupItem] + :keyword rule_groups: Effective configuration groups. + :paramtype rule_groups: list[~azure.mgmt.network.v2021_05_01_preview.models.ConfigurationGroup] + :keyword display_name: A friendly name for the rule. + :paramtype display_name: str + :keyword description: A description for this rule. Restricted to 140 chars. + :paramtype description: str + :keyword protocol: Network protocol this rule applies to. Possible values include: "Tcp", + "Udp", "Icmp", "Esp", "Any", "Ah". + :paramtype protocol: str or + ~azure.mgmt.network.v2021_05_01_preview.models.SecurityConfigurationRuleProtocol + :keyword sources: The CIDR or source IP ranges. + :paramtype sources: list[~azure.mgmt.network.v2021_05_01_preview.models.AddressPrefixItem] + :keyword destinations: The destination address prefixes. CIDR or destination IP ranges. + :paramtype destinations: list[~azure.mgmt.network.v2021_05_01_preview.models.AddressPrefixItem] + :keyword source_port_ranges: The source port ranges. + :paramtype source_port_ranges: list[str] + :keyword destination_port_ranges: The destination port ranges. + :paramtype destination_port_ranges: list[str] + :keyword access: Indicates the access allowed for this particular rule. Possible values + include: "Allow", "Deny", "AlwaysAllow". + :paramtype access: str or + ~azure.mgmt.network.v2021_05_01_preview.models.SecurityConfigurationRuleAccess + :keyword priority: The priority of the rule. The value can be between 1 and 4096. The priority + number must be unique for each rule in the collection. The lower the priority number, the + higher the priority of the rule. + :paramtype priority: int + :keyword direction: Indicates if the traffic matched against the rule in inbound or outbound. + Possible values include: "Inbound", "Outbound". + :paramtype direction: str or + ~azure.mgmt.network.v2021_05_01_preview.models.SecurityConfigurationRuleDirection + """ super(EffectiveSecurityAdminRule, self).__init__(id=id, configuration_display_name=configuration_display_name, configuration_description=configuration_description, rule_collection_display_name=rule_collection_display_name, rule_collection_description=rule_collection_description, rule_collection_applies_to_groups=rule_collection_applies_to_groups, rule_groups=rule_groups, **kwargs) self.kind = 'Custom' # type: str self.display_name = display_name @@ -2069,12 +2572,12 @@ def __init__( class EffectiveVirtualNetwork(msrest.serialization.Model): """Effective Virtual Network. - :param id: Effective vnet Id. - :type id: str - :param location: Location of vnet. - :type location: str - :param membership_type: Membership Type. Possible values include: "Static", "Dynamic". - :type membership_type: str or ~azure.mgmt.network.v2021_02_01_preview.models.MembershipType + :ivar id: Effective vnet Id. + :vartype id: str + :ivar location: Location of vnet. + :vartype location: str + :ivar membership_type: Membership Type. Possible values include: "Static", "Dynamic". + :vartype membership_type: str or ~azure.mgmt.network.v2021_05_01_preview.models.MembershipType """ _attribute_map = { @@ -2091,6 +2594,15 @@ def __init__( membership_type: Optional[Union[str, "MembershipType"]] = None, **kwargs ): + """ + :keyword id: Effective vnet Id. + :paramtype id: str + :keyword location: Location of vnet. + :paramtype location: str + :keyword membership_type: Membership Type. Possible values include: "Static", "Dynamic". + :paramtype membership_type: str or + ~azure.mgmt.network.v2021_05_01_preview.models.MembershipType + """ super(EffectiveVirtualNetwork, self).__init__(**kwargs) self.id = id self.location = location @@ -2100,11 +2612,11 @@ def __init__( class EffectiveVirtualNetworksListResult(msrest.serialization.Model): """Result of the request to list Effective Virtual Network. It contains a list of groups and a URL link to get the next set of results. - :param value: Gets a page of EffectiveVirtualNetwork. - :type value: list[~azure.mgmt.network.v2021_02_01_preview.models.EffectiveVirtualNetwork] - :param skip_token: When present, the value can be passed to a subsequent query call (together + :ivar value: Gets a page of EffectiveVirtualNetwork. + :vartype value: list[~azure.mgmt.network.v2021_05_01_preview.models.EffectiveVirtualNetwork] + :ivar skip_token: When present, the value can be passed to a subsequent query call (together with the same query and scopes used in the current request) to retrieve the next page of data. - :type skip_token: str + :vartype skip_token: str """ _attribute_map = { @@ -2119,6 +2631,13 @@ def __init__( skip_token: Optional[str] = None, **kwargs ): + """ + :keyword value: Gets a page of EffectiveVirtualNetwork. + :paramtype value: list[~azure.mgmt.network.v2021_05_01_preview.models.EffectiveVirtualNetwork] + :keyword skip_token: When present, the value can be passed to a subsequent query call (together + with the same query and scopes used in the current request) to retrieve the next page of data. + :paramtype skip_token: str + """ super(EffectiveVirtualNetworksListResult, self).__init__(**kwargs) self.value = value self.skip_token = skip_token @@ -2127,11 +2646,11 @@ def __init__( class EffectiveVirtualNetworksParameter(msrest.serialization.Model): """Effective Virtual Networks Parameter. - :param conditional_members: Conditional Members. - :type conditional_members: str - :param skip_token: Continuation token for pagination, capturing the next page size and offset, + :ivar conditional_members: Conditional Members. + :vartype conditional_members: str + :ivar skip_token: Continuation token for pagination, capturing the next page size and offset, as well as the context of the query. - :type skip_token: str + :vartype skip_token: str """ _attribute_map = { @@ -2146,39 +2665,25 @@ def __init__( skip_token: Optional[str] = None, **kwargs ): + """ + :keyword conditional_members: Conditional Members. + :paramtype conditional_members: str + :keyword skip_token: Continuation token for pagination, capturing the next page size and + offset, as well as the context of the query. + :paramtype skip_token: str + """ super(EffectiveVirtualNetworksParameter, self).__init__(**kwargs) self.conditional_members = conditional_members self.skip_token = skip_token -class GroupMembersItem(msrest.serialization.Model): - """GroupMembers Item. - - :param resource_id: Resource Id. - :type resource_id: str - """ - - _attribute_map = { - 'resource_id': {'key': 'resourceId', 'type': 'str'}, - } - - def __init__( - self, - *, - resource_id: Optional[str] = None, - **kwargs - ): - super(GroupMembersItem, self).__init__(**kwargs) - self.resource_id = resource_id - - class Hub(msrest.serialization.Model): """Hub Item. - :param resource_id: Resource Id. - :type resource_id: str - :param resource_type: Resource Type. - :type resource_type: str + :ivar resource_id: Resource Id. + :vartype resource_id: str + :ivar resource_type: Resource Type. + :vartype resource_type: str """ _attribute_map = { @@ -2193,6 +2698,12 @@ def __init__( resource_type: Optional[str] = None, **kwargs ): + """ + :keyword resource_id: Resource Id. + :paramtype resource_id: str + :keyword resource_type: Resource Type. + :paramtype resource_type: str + """ super(Hub, self).__init__(**kwargs) self.resource_id = resource_id self.resource_type = resource_type @@ -2212,21 +2723,17 @@ class NetworkGroup(ProxyResource): :ivar etag: A unique read-only string that changes whenever the resource is updated. :vartype etag: str :ivar system_data: The system metadata related to this resource. - :vartype system_data: ~azure.mgmt.network.v2021_02_01_preview.models.SystemData - :param display_name: A friendly name for the network group. - :type display_name: str - :param description: A description of the network group. - :type description: str - :param member_type: Group member type. - :type member_type: str - :param group_members: Group members of network group. - :type group_members: list[~azure.mgmt.network.v2021_02_01_preview.models.GroupMembersItem] - :param conditional_membership: Network group conditional filter. - :type conditional_membership: str + :vartype system_data: ~azure.mgmt.network.v2021_05_01_preview.models.SystemData + :ivar display_name: A friendly name for the network group. + :vartype display_name: str + :ivar description: A description of the network group. + :vartype description: str + :ivar member_type: Group member type. + :vartype member_type: str :ivar provisioning_state: The provisioning state of the scope assignment resource. Possible values include: "Succeeded", "Updating", "Deleting", "Failed". :vartype provisioning_state: str or - ~azure.mgmt.network.v2021_02_01_preview.models.ProvisioningState + ~azure.mgmt.network.v2021_05_01_preview.models.ProvisioningState """ _validation = { @@ -2247,8 +2754,6 @@ class NetworkGroup(ProxyResource): 'display_name': {'key': 'properties.displayName', 'type': 'str'}, 'description': {'key': 'properties.description', 'type': 'str'}, 'member_type': {'key': 'properties.memberType', 'type': 'str'}, - 'group_members': {'key': 'properties.groupMembers', 'type': '[GroupMembersItem]'}, - 'conditional_membership': {'key': 'properties.conditionalMembership', 'type': 'str'}, 'provisioning_state': {'key': 'properties.provisioningState', 'type': 'str'}, } @@ -2258,27 +2763,31 @@ def __init__( display_name: Optional[str] = None, description: Optional[str] = None, member_type: Optional[str] = None, - group_members: Optional[List["GroupMembersItem"]] = None, - conditional_membership: Optional[str] = None, **kwargs ): + """ + :keyword display_name: A friendly name for the network group. + :paramtype display_name: str + :keyword description: A description of the network group. + :paramtype description: str + :keyword member_type: Group member type. + :paramtype member_type: str + """ super(NetworkGroup, self).__init__(**kwargs) self.system_data = None self.display_name = display_name self.description = description self.member_type = member_type - self.group_members = group_members - self.conditional_membership = conditional_membership self.provisioning_state = None class NetworkGroupListResult(msrest.serialization.Model): """Result of the request to list NetworkGroup. It contains a list of groups and a URL link to get the next set of results. - :param value: Gets a page of NetworkGroup. - :type value: list[~azure.mgmt.network.v2021_02_01_preview.models.NetworkGroup] - :param next_link: Gets the URL to get the next set of results. - :type next_link: str + :ivar value: Gets a page of NetworkGroup. + :vartype value: list[~azure.mgmt.network.v2021_05_01_preview.models.NetworkGroup] + :ivar next_link: Gets the URL to get the next set of results. + :vartype next_link: str """ _attribute_map = { @@ -2293,6 +2802,12 @@ def __init__( next_link: Optional[str] = None, **kwargs ): + """ + :keyword value: Gets a page of NetworkGroup. + :paramtype value: list[~azure.mgmt.network.v2021_05_01_preview.models.NetworkGroup] + :keyword next_link: Gets the URL to get the next set of results. + :paramtype next_link: str + """ super(NetworkGroupListResult, self).__init__(**kwargs) self.value = value self.next_link = next_link @@ -2303,16 +2818,16 @@ class Resource(msrest.serialization.Model): Variables are only populated by the server, and will be ignored when sending a request. - :param id: Resource ID. - :type id: str + :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: A set of tags. Resource tags. - :type tags: dict[str, str] + :ivar location: Resource location. + :vartype location: str + :ivar tags: A set of tags. Resource tags. + :vartype tags: dict[str, str] """ _validation = { @@ -2336,6 +2851,14 @@ def __init__( tags: Optional[Dict[str, str]] = None, **kwargs ): + """ + :keyword id: Resource ID. + :paramtype id: str + :keyword location: Resource location. + :paramtype location: str + :keyword tags: A set of tags. Resource tags. + :paramtype tags: dict[str, str] + """ super(Resource, self).__init__(**kwargs) self.id = id self.name = None @@ -2349,34 +2872,34 @@ class NetworkManager(Resource): Variables are only populated by the server, and will be ignored when sending a request. - :param id: Resource ID. - :type id: str + :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: A set of tags. Resource tags. - :type tags: dict[str, str] + :ivar location: Resource location. + :vartype location: str + :ivar tags: A set of tags. Resource tags. + :vartype tags: dict[str, str] :ivar etag: A unique read-only string that changes whenever the resource is updated. :vartype etag: str :ivar system_data: The system metadata related to this resource. - :vartype system_data: ~azure.mgmt.network.v2021_02_01_preview.models.SystemData - :param display_name: A friendly name for the network manager. - :type display_name: str - :param description: A description of the network manager. - :type description: str - :param network_manager_scopes: Scope of Network Manager. - :type network_manager_scopes: - ~azure.mgmt.network.v2021_02_01_preview.models.NetworkManagerPropertiesNetworkManagerScopes - :param network_manager_scope_accesses: Scope Access. - :type network_manager_scope_accesses: list[str or - ~azure.mgmt.network.v2021_02_01_preview.models.ConfigurationType] + :vartype system_data: ~azure.mgmt.network.v2021_05_01_preview.models.SystemData + :ivar display_name: A friendly name for the network manager. + :vartype display_name: str + :ivar description: A description of the network manager. + :vartype description: str + :ivar network_manager_scopes: Scope of Network Manager. + :vartype network_manager_scopes: + ~azure.mgmt.network.v2021_05_01_preview.models.NetworkManagerPropertiesNetworkManagerScopes + :ivar network_manager_scope_accesses: Scope Access. + :vartype network_manager_scope_accesses: list[str or + ~azure.mgmt.network.v2021_05_01_preview.models.ConfigurationType] :ivar provisioning_state: The provisioning state of the scope assignment resource. Possible values include: "Succeeded", "Updating", "Deleting", "Failed". :vartype provisioning_state: str or - ~azure.mgmt.network.v2021_02_01_preview.models.ProvisioningState + ~azure.mgmt.network.v2021_05_01_preview.models.ProvisioningState """ _validation = { @@ -2414,6 +2937,24 @@ def __init__( network_manager_scope_accesses: Optional[List[Union[str, "ConfigurationType"]]] = None, **kwargs ): + """ + :keyword id: Resource ID. + :paramtype id: str + :keyword location: Resource location. + :paramtype location: str + :keyword tags: A set of tags. Resource tags. + :paramtype tags: dict[str, str] + :keyword display_name: A friendly name for the network manager. + :paramtype display_name: str + :keyword description: A description of the network manager. + :paramtype description: str + :keyword network_manager_scopes: Scope of Network Manager. + :paramtype network_manager_scopes: + ~azure.mgmt.network.v2021_05_01_preview.models.NetworkManagerPropertiesNetworkManagerScopes + :keyword network_manager_scope_accesses: Scope Access. + :paramtype network_manager_scope_accesses: list[str or + ~azure.mgmt.network.v2021_05_01_preview.models.ConfigurationType] + """ super(NetworkManager, self).__init__(id=id, location=location, tags=tags, **kwargs) self.etag = None self.system_data = None @@ -2429,19 +2970,22 @@ class NetworkManagerCommit(msrest.serialization.Model): Variables are only populated by the server, and will be ignored when sending a request. + All required parameters must be populated in order to send to Azure. + :ivar commit_id: Commit Id. :vartype commit_id: str - :param target_locations: List of target locations. - :type target_locations: list[str] - :param configuration_ids: List of configuration ids. - :type configuration_ids: list[str] - :param commit_type: Commit Type. Possible values include: "SecurityAdmin", "SecurityUser", + :ivar target_locations: Required. List of target locations. + :vartype target_locations: list[str] + :ivar configuration_ids: List of configuration ids. + :vartype configuration_ids: list[str] + :ivar commit_type: Commit Type. Possible values include: "SecurityAdmin", "SecurityUser", "Connectivity". - :type commit_type: str or ~azure.mgmt.network.v2021_02_01_preview.models.ConfigurationType + :vartype commit_type: str or ~azure.mgmt.network.v2021_05_01_preview.models.ConfigurationType """ _validation = { 'commit_id': {'readonly': True}, + 'target_locations': {'required': True}, } _attribute_map = { @@ -2454,11 +2998,20 @@ class NetworkManagerCommit(msrest.serialization.Model): def __init__( self, *, - target_locations: Optional[List[str]] = None, + target_locations: List[str], configuration_ids: Optional[List[str]] = None, commit_type: Optional[Union[str, "ConfigurationType"]] = None, **kwargs ): + """ + :keyword target_locations: Required. List of target locations. + :paramtype target_locations: list[str] + :keyword configuration_ids: List of configuration ids. + :paramtype configuration_ids: list[str] + :keyword commit_type: Commit Type. Possible values include: "SecurityAdmin", "SecurityUser", + "Connectivity". + :paramtype commit_type: str or ~azure.mgmt.network.v2021_05_01_preview.models.ConfigurationType + """ super(NetworkManagerCommit, self).__init__(**kwargs) self.commit_id = None self.target_locations = target_locations @@ -2466,23 +3019,122 @@ def __init__( self.commit_type = commit_type +class NetworkManagerConnection(ProxyResource): + """The Network Manager 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 etag: A unique read-only string that changes whenever the resource is updated. + :vartype etag: str + :ivar system_data: The system metadata related to this resource. + :vartype system_data: ~azure.mgmt.network.v2021_05_01_preview.models.SystemData + :ivar network_manager_id: Network Manager Id. + :vartype network_manager_id: str + :ivar connection_state: Connection state. Possible values include: "Connected", "Pending", + "Conflict", "Revoked", "Rejected". + :vartype connection_state: str or + ~azure.mgmt.network.v2021_05_01_preview.models.ScopeConnectionState + :ivar description: A description of the scope connection. + :vartype description: str + """ + + _validation = { + 'id': {'readonly': True}, + 'name': {'readonly': True}, + 'type': {'readonly': True}, + 'etag': {'readonly': True}, + 'system_data': {'readonly': True}, + 'connection_state': {'readonly': True}, + } + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + 'name': {'key': 'name', 'type': 'str'}, + 'type': {'key': 'type', 'type': 'str'}, + 'etag': {'key': 'etag', 'type': 'str'}, + 'system_data': {'key': 'systemData', 'type': 'SystemData'}, + 'network_manager_id': {'key': 'properties.networkManagerId', 'type': 'str'}, + 'connection_state': {'key': 'properties.connectionState', 'type': 'str'}, + 'description': {'key': 'properties.description', 'type': 'str'}, + } + + def __init__( + self, + *, + network_manager_id: Optional[str] = None, + description: Optional[str] = None, + **kwargs + ): + """ + :keyword network_manager_id: Network Manager Id. + :paramtype network_manager_id: str + :keyword description: A description of the scope connection. + :paramtype description: str + """ + super(NetworkManagerConnection, self).__init__(**kwargs) + self.system_data = None + self.network_manager_id = network_manager_id + self.connection_state = None + self.description = description + + +class NetworkManagerConnectionListResult(msrest.serialization.Model): + """List of network manager connections. + + :ivar value: List of network manager connections. + :vartype value: list[~azure.mgmt.network.v2021_05_01_preview.models.NetworkManagerConnection] + :ivar next_link: Gets the URL to get the next page of results. + :vartype next_link: str + """ + + _attribute_map = { + 'value': {'key': 'value', 'type': '[NetworkManagerConnection]'}, + 'next_link': {'key': 'nextLink', 'type': 'str'}, + } + + def __init__( + self, + *, + value: Optional[List["NetworkManagerConnection"]] = None, + next_link: Optional[str] = None, + **kwargs + ): + """ + :keyword value: List of network manager connections. + :paramtype value: list[~azure.mgmt.network.v2021_05_01_preview.models.NetworkManagerConnection] + :keyword next_link: Gets the URL to get the next page of results. + :paramtype next_link: str + """ + super(NetworkManagerConnectionListResult, self).__init__(**kwargs) + self.value = value + self.next_link = next_link + + class NetworkManagerDeploymentStatus(msrest.serialization.Model): """Network Manager Deployment Status. - :param commit_time: Commit Time. - :type commit_time: ~datetime.datetime - :param region: Region Name. - :type region: str - :param deployment_status: Deployment Status. Possible values include: "NotStarted", - "Deploying", "Deployed", "Failed". - :type deployment_status: str or ~azure.mgmt.network.v2021_02_01_preview.models.DeploymentStatus - :param configuration_ids: List of configuration ids. - :type configuration_ids: list[str] - :param deployment_type: Configuration Deployment Type. Possible values include: - "SecurityAdmin", "SecurityUser", "Connectivity". - :type deployment_type: str or ~azure.mgmt.network.v2021_02_01_preview.models.ConfigurationType - :param error_message: Error Message. - :type error_message: str + :ivar commit_time: Commit Time. + :vartype commit_time: ~datetime.datetime + :ivar region: Region Name. + :vartype region: str + :ivar deployment_status: Deployment Status. Possible values include: "NotStarted", "Deploying", + "Deployed", "Failed". + :vartype deployment_status: str or + ~azure.mgmt.network.v2021_05_01_preview.models.DeploymentStatus + :ivar configuration_ids: List of configuration ids. + :vartype configuration_ids: list[str] + :ivar deployment_type: Configuration Deployment Type. Possible values include: "SecurityAdmin", + "SecurityUser", "Connectivity". + :vartype deployment_type: str or + ~azure.mgmt.network.v2021_05_01_preview.models.ConfigurationType + :ivar error_message: Error Message. + :vartype error_message: str """ _attribute_map = { @@ -2505,6 +3157,24 @@ def __init__( error_message: Optional[str] = None, **kwargs ): + """ + :keyword commit_time: Commit Time. + :paramtype commit_time: ~datetime.datetime + :keyword region: Region Name. + :paramtype region: str + :keyword deployment_status: Deployment Status. Possible values include: "NotStarted", + "Deploying", "Deployed", "Failed". + :paramtype deployment_status: str or + ~azure.mgmt.network.v2021_05_01_preview.models.DeploymentStatus + :keyword configuration_ids: List of configuration ids. + :paramtype configuration_ids: list[str] + :keyword deployment_type: Configuration Deployment Type. Possible values include: + "SecurityAdmin", "SecurityUser", "Connectivity". + :paramtype deployment_type: str or + ~azure.mgmt.network.v2021_05_01_preview.models.ConfigurationType + :keyword error_message: Error Message. + :paramtype error_message: str + """ super(NetworkManagerDeploymentStatus, self).__init__(**kwargs) self.commit_time = commit_time self.region = region @@ -2517,12 +3187,12 @@ def __init__( class NetworkManagerDeploymentStatusListResult(msrest.serialization.Model): """A list of Network Manager Deployment Status. - :param value: Gets a page of Network Manager Deployment Status. - :type value: - list[~azure.mgmt.network.v2021_02_01_preview.models.NetworkManagerDeploymentStatus] - :param skip_token: When present, the value can be passed to a subsequent query call (together + :ivar value: Gets a page of Network Manager Deployment Status. + :vartype value: + list[~azure.mgmt.network.v2021_05_01_preview.models.NetworkManagerDeploymentStatus] + :ivar skip_token: When present, the value can be passed to a subsequent query call (together with the same query and scopes used in the current request) to retrieve the next page of data. - :type skip_token: str + :vartype skip_token: str """ _attribute_map = { @@ -2537,6 +3207,14 @@ def __init__( skip_token: Optional[str] = None, **kwargs ): + """ + :keyword value: Gets a page of Network Manager Deployment Status. + :paramtype value: + list[~azure.mgmt.network.v2021_05_01_preview.models.NetworkManagerDeploymentStatus] + :keyword skip_token: When present, the value can be passed to a subsequent query call (together + with the same query and scopes used in the current request) to retrieve the next page of data. + :paramtype skip_token: str + """ super(NetworkManagerDeploymentStatusListResult, self).__init__(**kwargs) self.value = value self.skip_token = skip_token @@ -2545,14 +3223,14 @@ def __init__( class NetworkManagerDeploymentStatusParameter(msrest.serialization.Model): """Network Manager Deployment Status Parameter. - :param regions: List of locations. - :type regions: list[str] - :param deployment_types: List of deployment types. - :type deployment_types: list[str or - ~azure.mgmt.network.v2021_02_01_preview.models.ConfigurationType] - :param skip_token: Continuation token for pagination, capturing the next page size and offset, + :ivar regions: List of locations. + :vartype regions: list[str] + :ivar deployment_types: List of deployment types. + :vartype deployment_types: list[str or + ~azure.mgmt.network.v2021_05_01_preview.models.ConfigurationType] + :ivar skip_token: Continuation token for pagination, capturing the next page size and offset, as well as the context of the query. - :type skip_token: str + :vartype skip_token: str """ _attribute_map = { @@ -2569,6 +3247,16 @@ def __init__( skip_token: Optional[str] = None, **kwargs ): + """ + :keyword regions: List of locations. + :paramtype regions: list[str] + :keyword deployment_types: List of deployment types. + :paramtype deployment_types: list[str or + ~azure.mgmt.network.v2021_05_01_preview.models.ConfigurationType] + :keyword skip_token: Continuation token for pagination, capturing the next page size and + offset, as well as the context of the query. + :paramtype skip_token: str + """ super(NetworkManagerDeploymentStatusParameter, self).__init__(**kwargs) self.regions = regions self.deployment_types = deployment_types @@ -2578,12 +3266,12 @@ def __init__( class NetworkManagerEffectiveConnectivityConfigurationListResult(msrest.serialization.Model): """Result of the request to list networkManagerEffectiveConnectivityConfiguration. It contains a list of groups and a skiptoken to get the next set of results. - :param value: Gets a page of NetworkManagerEffectiveConnectivityConfiguration. - :type value: - list[~azure.mgmt.network.v2021_02_01_preview.models.EffectiveConnectivityConfiguration] - :param skip_token: When present, the value can be passed to a subsequent query call (together + :ivar value: Gets a page of NetworkManagerEffectiveConnectivityConfiguration. + :vartype value: + list[~azure.mgmt.network.v2021_05_01_preview.models.EffectiveConnectivityConfiguration] + :ivar skip_token: When present, the value can be passed to a subsequent query call (together with the same query and scopes used in the current request) to retrieve the next page of data. - :type skip_token: str + :vartype skip_token: str """ _attribute_map = { @@ -2598,6 +3286,14 @@ def __init__( skip_token: Optional[str] = None, **kwargs ): + """ + :keyword value: Gets a page of NetworkManagerEffectiveConnectivityConfiguration. + :paramtype value: + list[~azure.mgmt.network.v2021_05_01_preview.models.EffectiveConnectivityConfiguration] + :keyword skip_token: When present, the value can be passed to a subsequent query call (together + with the same query and scopes used in the current request) to retrieve the next page of data. + :paramtype skip_token: str + """ super(NetworkManagerEffectiveConnectivityConfigurationListResult, self).__init__(**kwargs) self.value = value self.skip_token = skip_token @@ -2606,12 +3302,12 @@ def __init__( class NetworkManagerEffectiveSecurityAdminRulesListResult(msrest.serialization.Model): """Result of the request to list networkManagerEffectiveSecurityAdminRules. It contains a list of groups and a skiptoken to get the next set of results. - :param value: Gets a page of NetworkManagerEffectiveSecurityAdminRules. - :type value: - list[~azure.mgmt.network.v2021_02_01_preview.models.EffectiveBaseSecurityAdminRule] - :param skip_token: When present, the value can be passed to a subsequent query call (together + :ivar value: Gets a page of NetworkManagerEffectiveSecurityAdminRules. + :vartype value: + list[~azure.mgmt.network.v2021_05_01_preview.models.EffectiveBaseSecurityAdminRule] + :ivar skip_token: When present, the value can be passed to a subsequent query call (together with the same query and scopes used in the current request) to retrieve the next page of data. - :type skip_token: str + :vartype skip_token: str """ _attribute_map = { @@ -2626,6 +3322,14 @@ def __init__( skip_token: Optional[str] = None, **kwargs ): + """ + :keyword value: Gets a page of NetworkManagerEffectiveSecurityAdminRules. + :paramtype value: + list[~azure.mgmt.network.v2021_05_01_preview.models.EffectiveBaseSecurityAdminRule] + :keyword skip_token: When present, the value can be passed to a subsequent query call (together + with the same query and scopes used in the current request) to retrieve the next page of data. + :paramtype skip_token: str + """ super(NetworkManagerEffectiveSecurityAdminRulesListResult, self).__init__(**kwargs) self.value = value self.skip_token = skip_token @@ -2634,10 +3338,10 @@ def __init__( class NetworkManagerListResult(msrest.serialization.Model): """Result of the request to list NetworkManager. It contains a list of network managers and a URL link to get the next set of results. - :param value: Gets a page of NetworkManager. - :type value: list[~azure.mgmt.network.v2021_02_01_preview.models.NetworkManager] - :param next_link: Gets the URL to get the next page of results. - :type next_link: str + :ivar value: Gets a page of NetworkManager. + :vartype value: list[~azure.mgmt.network.v2021_05_01_preview.models.NetworkManager] + :ivar next_link: Gets the URL to get the next page of results. + :vartype next_link: str """ _attribute_map = { @@ -2652,6 +3356,12 @@ def __init__( next_link: Optional[str] = None, **kwargs ): + """ + :keyword value: Gets a page of NetworkManager. + :paramtype value: list[~azure.mgmt.network.v2021_05_01_preview.models.NetworkManager] + :keyword next_link: Gets the URL to get the next page of results. + :paramtype next_link: str + """ super(NetworkManagerListResult, self).__init__(**kwargs) self.value = value self.next_link = next_link @@ -2660,15 +3370,25 @@ def __init__( class NetworkManagerPropertiesNetworkManagerScopes(msrest.serialization.Model): """Scope of Network Manager. - :param management_groups: List of management groups. - :type management_groups: list[str] - :param subscriptions: List of subscriptions. - :type subscriptions: list[str] + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar management_groups: List of management groups. + :vartype management_groups: list[str] + :ivar subscriptions: List of subscriptions. + :vartype subscriptions: list[str] + :ivar cross_tenant_scopes: List of cross tenant scopes. + :vartype cross_tenant_scopes: + list[~azure.mgmt.network.v2021_05_01_preview.models.CrossTenantScopes] """ + _validation = { + 'cross_tenant_scopes': {'readonly': True}, + } + _attribute_map = { 'management_groups': {'key': 'managementGroups', 'type': '[str]'}, 'subscriptions': {'key': 'subscriptions', 'type': '[str]'}, + 'cross_tenant_scopes': {'key': 'crossTenantScopes', 'type': '[CrossTenantScopes]'}, } def __init__( @@ -2678,18 +3398,31 @@ def __init__( subscriptions: Optional[List[str]] = None, **kwargs ): + """ + :keyword management_groups: List of management groups. + :paramtype management_groups: list[str] + :keyword subscriptions: List of subscriptions. + :paramtype subscriptions: list[str] + """ super(NetworkManagerPropertiesNetworkManagerScopes, self).__init__(**kwargs) self.management_groups = management_groups self.subscriptions = subscriptions + self.cross_tenant_scopes = None class NetworkManagerSecurityGroupItem(msrest.serialization.Model): """Network manager security group item. - :param network_group_id: Network manager group Id. - :type network_group_id: str + All required parameters must be populated in order to send to Azure. + + :ivar network_group_id: Required. Network manager group Id. + :vartype network_group_id: str """ + _validation = { + 'network_group_id': {'required': True}, + } + _attribute_map = { 'network_group_id': {'key': 'networkGroupId', 'type': 'str'}, } @@ -2697,44 +3430,103 @@ class NetworkManagerSecurityGroupItem(msrest.serialization.Model): def __init__( self, *, - network_group_id: Optional[str] = None, + network_group_id: str, **kwargs ): + """ + :keyword network_group_id: Required. Network manager group Id. + :paramtype network_group_id: str + """ super(NetworkManagerSecurityGroupItem, self).__init__(**kwargs) self.network_group_id = network_group_id -class NetworkSecurityPerimeter(Resource): - """The Network Security Perimeter resource. +class PatchObject(msrest.serialization.Model): + """Object for patch operations. + + :ivar tags: A set of tags. Resource tags. + :vartype tags: dict[str, str] + """ + + _attribute_map = { + 'tags': {'key': 'tags', 'type': '{str}'}, + } + + def __init__( + self, + *, + tags: Optional[Dict[str, str]] = None, + **kwargs + ): + """ + :keyword tags: A set of tags. Resource tags. + :paramtype tags: dict[str, str] + """ + super(PatchObject, self).__init__(**kwargs) + self.tags = tags + + +class QueryRequestOptions(msrest.serialization.Model): + """Query Request Options. + + :ivar skip_token: When present, the value can be passed to a subsequent query call (together + with the same query and scopes used in the current request) to retrieve the next page of data. + :vartype skip_token: str + """ + + _attribute_map = { + 'skip_token': {'key': 'skipToken', 'type': 'str'}, + } + + def __init__( + self, + *, + skip_token: Optional[str] = None, + **kwargs + ): + """ + :keyword skip_token: When present, the value can be passed to a subsequent query call (together + with the same query and scopes used in the current request) to retrieve the next page of data. + :paramtype skip_token: str + """ + super(QueryRequestOptions, self).__init__(**kwargs) + self.skip_token = skip_token + + +class RuleCollection(ProxyResource): + """Defines the rule collection. Variables are only populated by the server, and will be ignored when sending a request. - :param id: Resource ID. - :type id: str + :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: A set of tags. Resource tags. - :type tags: dict[str, str] :ivar etag: A unique read-only string that changes whenever the resource is updated. :vartype etag: str - :param display_name: A friendly name for the network security perimeter. - :type display_name: str - :param description: A description of the network security perimeter. - :type description: str - :ivar provisioning_state: The provisioning state of the scope assignment resource. Possible - values include: "Succeeded", "Updating", "Deleting", "Failed". + :ivar system_data: The system metadata related to this resource. + :vartype system_data: ~azure.mgmt.network.v2021_05_01_preview.models.SystemData + :ivar display_name: A display name of the rule collection. + :vartype display_name: str + :ivar description: A description of the rule collection. + :vartype description: str + :ivar applies_to_groups: Groups for configuration. + :vartype applies_to_groups: + list[~azure.mgmt.network.v2021_05_01_preview.models.NetworkManagerSecurityGroupItem] + :ivar provisioning_state: The provisioning state of the resource. Possible values include: + "Succeeded", "Updating", "Deleting", "Failed". :vartype provisioning_state: str or - ~azure.mgmt.network.v2021_02_01_preview.models.ProvisioningState + ~azure.mgmt.network.v2021_05_01_preview.models.ProvisioningState """ _validation = { + 'id': {'readonly': True}, 'name': {'readonly': True}, 'type': {'readonly': True}, 'etag': {'readonly': True}, + 'system_data': {'readonly': True}, 'provisioning_state': {'readonly': True}, } @@ -2742,163 +3534,177 @@ class NetworkSecurityPerimeter(Resource): '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}'}, 'etag': {'key': 'etag', 'type': 'str'}, + 'system_data': {'key': 'systemData', 'type': 'SystemData'}, 'display_name': {'key': 'properties.displayName', 'type': 'str'}, 'description': {'key': 'properties.description', 'type': 'str'}, + 'applies_to_groups': {'key': 'properties.appliesToGroups', 'type': '[NetworkManagerSecurityGroupItem]'}, 'provisioning_state': {'key': 'properties.provisioningState', 'type': 'str'}, } def __init__( self, *, - id: Optional[str] = None, - location: Optional[str] = None, - tags: Optional[Dict[str, str]] = None, display_name: Optional[str] = None, description: Optional[str] = None, + applies_to_groups: Optional[List["NetworkManagerSecurityGroupItem"]] = None, **kwargs ): - super(NetworkSecurityPerimeter, self).__init__(id=id, location=location, tags=tags, **kwargs) - self.etag = None + """ + :keyword display_name: A display name of the rule collection. + :paramtype display_name: str + :keyword description: A description of the rule collection. + :paramtype description: str + :keyword applies_to_groups: Groups for configuration. + :paramtype applies_to_groups: + list[~azure.mgmt.network.v2021_05_01_preview.models.NetworkManagerSecurityGroupItem] + """ + super(RuleCollection, self).__init__(**kwargs) + self.system_data = None self.display_name = display_name self.description = description + self.applies_to_groups = applies_to_groups self.provisioning_state = None -class NetworkSecurityPerimeterListResult(msrest.serialization.Model): - """Result of the request to list NetworkSecurityPerimeter. It contains a list of network security perimeters and a URL link to get the next set of results. +class RuleCollectionListResult(msrest.serialization.Model): + """Security configuration rule collection list result. - :param value: Gets a page of NetworkSecurityPerimeter. - :type value: list[~azure.mgmt.network.v2021_02_01_preview.models.NetworkSecurityPerimeter] - :param next_link: Gets the URL to get the next page of results. - :type next_link: str + :ivar value: A list of network manager security configuration rule collections. + :vartype value: list[~azure.mgmt.network.v2021_05_01_preview.models.RuleCollection] + :ivar next_link: Gets the URL to get the next set of results. + :vartype next_link: str """ _attribute_map = { - 'value': {'key': 'value', 'type': '[NetworkSecurityPerimeter]'}, + 'value': {'key': 'value', 'type': '[RuleCollection]'}, 'next_link': {'key': 'nextLink', 'type': 'str'}, } def __init__( self, *, - value: Optional[List["NetworkSecurityPerimeter"]] = None, + value: Optional[List["RuleCollection"]] = None, next_link: Optional[str] = None, **kwargs ): - super(NetworkSecurityPerimeterListResult, self).__init__(**kwargs) + """ + :keyword value: A list of network manager security configuration rule collections. + :paramtype value: list[~azure.mgmt.network.v2021_05_01_preview.models.RuleCollection] + :keyword next_link: Gets the URL to get the next set of results. + :paramtype next_link: str + """ + super(RuleCollectionListResult, self).__init__(**kwargs) self.value = value self.next_link = next_link -class PerimeterAssociableResource(Resource): - """Resource that is onboarded to use network security perimeter. Also referred as perimeter associable resource. +class ScopeConnection(ProxyResource): + """The Scope Connections resource. Variables are only populated by the server, and will be ignored when sending a request. - :param id: Resource ID. - :type id: str + :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: A set of tags. Resource tags. - :type tags: dict[str, str] - :ivar display_name: A friendly name for the properties of perimeter associable resources. - :vartype display_name: str - :ivar resource_type: Resource type/provider name. - :vartype resource_type: str - :ivar public_dns_zones: Public DNS zone names of the resources. - :vartype public_dns_zones: list[str] + :ivar etag: A unique read-only string that changes whenever the resource is updated. + :vartype etag: str + :ivar system_data: The system metadata related to this resource. + :vartype system_data: ~azure.mgmt.network.v2021_05_01_preview.models.SystemData + :ivar tenant_id: Tenant ID. + :vartype tenant_id: str + :ivar resource_id: Resource ID. + :vartype resource_id: str + :ivar connection_state: Connection State. Possible values include: "Connected", "Pending", + "Conflict", "Revoked", "Rejected". + :vartype connection_state: str or + ~azure.mgmt.network.v2021_05_01_preview.models.ScopeConnectionState + :ivar description: A description of the scope connection. + :vartype description: str """ _validation = { + 'id': {'readonly': True}, 'name': {'readonly': True}, 'type': {'readonly': True}, - 'display_name': {'readonly': True}, - 'resource_type': {'readonly': True}, - 'public_dns_zones': {'readonly': True}, + 'etag': {'readonly': True}, + 'system_data': {'readonly': True}, + 'connection_state': {'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}'}, - 'display_name': {'key': 'properties.displayName', 'type': 'str'}, - 'resource_type': {'key': 'properties.resourceType', 'type': 'str'}, - 'public_dns_zones': {'key': 'properties.publicDnsZones', 'type': '[str]'}, + 'etag': {'key': 'etag', 'type': 'str'}, + 'system_data': {'key': 'systemData', 'type': 'SystemData'}, + 'tenant_id': {'key': 'properties.tenantId', 'type': 'str'}, + 'resource_id': {'key': 'properties.resourceId', 'type': 'str'}, + 'connection_state': {'key': 'properties.connectionState', 'type': 'str'}, + 'description': {'key': 'properties.description', 'type': 'str'}, } def __init__( self, *, - id: Optional[str] = None, - location: Optional[str] = None, - tags: Optional[Dict[str, str]] = None, + tenant_id: Optional[str] = None, + resource_id: Optional[str] = None, + description: Optional[str] = None, **kwargs ): - super(PerimeterAssociableResource, self).__init__(id=id, location=location, tags=tags, **kwargs) - self.display_name = None - self.resource_type = None - self.public_dns_zones = None + """ + :keyword tenant_id: Tenant ID. + :paramtype tenant_id: str + :keyword resource_id: Resource ID. + :paramtype resource_id: str + :keyword description: A description of the scope connection. + :paramtype description: str + """ + super(ScopeConnection, self).__init__(**kwargs) + self.system_data = None + self.tenant_id = tenant_id + self.resource_id = resource_id + self.connection_state = None + self.description = description -class PerimeterAssociableResourcesListResult(msrest.serialization.Model): - """Paged list of perimeter associable resources. +class ScopeConnectionListResult(msrest.serialization.Model): + """List of scope connections. - :param value: Gets paged list of perimeter associable resources. - :type value: list[~azure.mgmt.network.v2021_02_01_preview.models.PerimeterAssociableResource] - :param next_link: Gets the URL to get the next page of results. - :type next_link: str + :ivar value: List of scope connections. + :vartype value: list[~azure.mgmt.network.v2021_05_01_preview.models.ScopeConnection] + :ivar next_link: Gets the URL to get the next page of results. + :vartype next_link: str """ _attribute_map = { - 'value': {'key': 'value', 'type': '[PerimeterAssociableResource]'}, + 'value': {'key': 'value', 'type': '[ScopeConnection]'}, 'next_link': {'key': 'nextLink', 'type': 'str'}, } def __init__( self, *, - value: Optional[List["PerimeterAssociableResource"]] = None, + value: Optional[List["ScopeConnection"]] = None, next_link: Optional[str] = None, **kwargs ): - super(PerimeterAssociableResourcesListResult, self).__init__(**kwargs) + """ + :keyword value: List of scope connections. + :paramtype value: list[~azure.mgmt.network.v2021_05_01_preview.models.ScopeConnection] + :keyword next_link: Gets the URL to get the next page of results. + :paramtype next_link: str + """ + super(ScopeConnectionListResult, self).__init__(**kwargs) self.value = value self.next_link = next_link -class QueryRequestOptions(msrest.serialization.Model): - """Query Request Options. - - :param skip_token: When present, the value can be passed to a subsequent query call (together - with the same query and scopes used in the current request) to retrieve the next page of data. - :type skip_token: str - """ - - _attribute_map = { - 'skip_token': {'key': 'skipToken', 'type': 'str'}, - } - - def __init__( - self, - *, - skip_token: Optional[str] = None, - **kwargs - ): - super(QueryRequestOptions, self).__init__(**kwargs) - self.skip_token = skip_token - - -class RuleCollection(ProxyResource): - """Defines the rule collection. +class SecurityConfiguration(ProxyResource): + """Defines the security configuration. Variables are only populated by the server, and will be ignored when sending a request. @@ -2911,18 +3717,25 @@ class RuleCollection(ProxyResource): :ivar etag: A unique read-only string that changes whenever the resource is updated. :vartype etag: str :ivar system_data: The system metadata related to this resource. - :vartype system_data: ~azure.mgmt.network.v2021_02_01_preview.models.SystemData - :param display_name: A display name of the rule collection. - :type display_name: str - :param description: A description of the rule collection. - :type description: str - :param applies_to_groups: Groups for configuration. - :type applies_to_groups: - list[~azure.mgmt.network.v2021_02_01_preview.models.NetworkManagerSecurityGroupItem] + :vartype system_data: ~azure.mgmt.network.v2021_05_01_preview.models.SystemData + :ivar display_name: A display name of the security configuration. + :vartype display_name: str + :ivar description: A description of the security configuration. + :vartype description: str + :ivar security_type: Security Type. Possible values include: "AdminPolicy", "UserPolicy". + :vartype security_type: str or ~azure.mgmt.network.v2021_05_01_preview.models.SecurityType + :ivar apply_on_network_intent_policy_based_services: Enum list of network intent policy based + services. + :vartype apply_on_network_intent_policy_based_services: list[str or + ~azure.mgmt.network.v2021_05_01_preview.models.NetworkIntentPolicyBasedService] + :ivar delete_existing_ns_gs: Flag if need to delete existing network security groups. Possible + values include: "False", "True". + :vartype delete_existing_ns_gs: str or + ~azure.mgmt.network.v2021_05_01_preview.models.DeleteExistingNSGs :ivar provisioning_state: The provisioning state of the resource. Possible values include: "Succeeded", "Updating", "Deleting", "Failed". :vartype provisioning_state: str or - ~azure.mgmt.network.v2021_02_01_preview.models.ProvisioningState + ~azure.mgmt.network.v2021_05_01_preview.models.ProvisioningState """ _validation = { @@ -2942,7 +3755,9 @@ class RuleCollection(ProxyResource): 'system_data': {'key': 'systemData', 'type': 'SystemData'}, 'display_name': {'key': 'properties.displayName', 'type': 'str'}, 'description': {'key': 'properties.description', 'type': 'str'}, - 'applies_to_groups': {'key': 'properties.appliesToGroups', 'type': '[NetworkManagerSecurityGroupItem]'}, + 'security_type': {'key': 'properties.securityType', 'type': 'str'}, + 'apply_on_network_intent_policy_based_services': {'key': 'properties.applyOnNetworkIntentPolicyBasedServices', 'type': '[str]'}, + 'delete_existing_ns_gs': {'key': 'properties.deleteExistingNSGs', 'type': 'str'}, 'provisioning_state': {'key': 'properties.provisioningState', 'type': 'str'}, } @@ -2951,45 +3766,71 @@ def __init__( *, display_name: Optional[str] = None, description: Optional[str] = None, - applies_to_groups: Optional[List["NetworkManagerSecurityGroupItem"]] = None, + security_type: Optional[Union[str, "SecurityType"]] = None, + apply_on_network_intent_policy_based_services: Optional[List[Union[str, "NetworkIntentPolicyBasedService"]]] = None, + delete_existing_ns_gs: Optional[Union[str, "DeleteExistingNSGs"]] = None, **kwargs ): - super(RuleCollection, self).__init__(**kwargs) + """ + :keyword display_name: A display name of the security configuration. + :paramtype display_name: str + :keyword description: A description of the security configuration. + :paramtype description: str + :keyword security_type: Security Type. Possible values include: "AdminPolicy", "UserPolicy". + :paramtype security_type: str or ~azure.mgmt.network.v2021_05_01_preview.models.SecurityType + :keyword apply_on_network_intent_policy_based_services: Enum list of network intent policy + based services. + :paramtype apply_on_network_intent_policy_based_services: list[str or + ~azure.mgmt.network.v2021_05_01_preview.models.NetworkIntentPolicyBasedService] + :keyword delete_existing_ns_gs: Flag if need to delete existing network security groups. + Possible values include: "False", "True". + :paramtype delete_existing_ns_gs: str or + ~azure.mgmt.network.v2021_05_01_preview.models.DeleteExistingNSGs + """ + super(SecurityConfiguration, self).__init__(**kwargs) self.system_data = None self.display_name = display_name self.description = description - self.applies_to_groups = applies_to_groups + self.security_type = security_type + self.apply_on_network_intent_policy_based_services = apply_on_network_intent_policy_based_services + self.delete_existing_ns_gs = delete_existing_ns_gs self.provisioning_state = None -class RuleCollectionListResult(msrest.serialization.Model): - """Security configuration rule collection list result. +class SecurityConfigurationListResult(msrest.serialization.Model): + """A list of network manager security configurations. - :param value: A list of network manager security configuration rule collections. - :type value: list[~azure.mgmt.network.v2021_02_01_preview.models.RuleCollection] - :param next_link: Gets the URL to get the next set of results. - :type next_link: str + :ivar value: Gets a page of security configurations. + :vartype value: list[~azure.mgmt.network.v2021_05_01_preview.models.SecurityConfiguration] + :ivar next_link: Gets the URL to get the next page of results. + :vartype next_link: str """ _attribute_map = { - 'value': {'key': 'value', 'type': '[RuleCollection]'}, + 'value': {'key': 'value', 'type': '[SecurityConfiguration]'}, 'next_link': {'key': 'nextLink', 'type': 'str'}, } def __init__( self, *, - value: Optional[List["RuleCollection"]] = None, + value: Optional[List["SecurityConfiguration"]] = None, next_link: Optional[str] = None, **kwargs ): - super(RuleCollectionListResult, self).__init__(**kwargs) + """ + :keyword value: Gets a page of security configurations. + :paramtype value: list[~azure.mgmt.network.v2021_05_01_preview.models.SecurityConfiguration] + :keyword next_link: Gets the URL to get the next page of results. + :paramtype next_link: str + """ + super(SecurityConfigurationListResult, self).__init__(**kwargs) self.value = value self.next_link = next_link -class SecurityConfiguration(ProxyResource): - """Defines the security configuration. +class StaticMember(ProxyResource): + """StaticMember Item. Variables are only populated by the server, and will be ignored when sending a request. @@ -3002,21 +3843,9 @@ class SecurityConfiguration(ProxyResource): :ivar etag: A unique read-only string that changes whenever the resource is updated. :vartype etag: str :ivar system_data: The system metadata related to this resource. - :vartype system_data: ~azure.mgmt.network.v2021_02_01_preview.models.SystemData - :param display_name: A display name of the security configuration. - :type display_name: str - :param description: A description of the security configuration. - :type description: str - :param security_type: Security Type. Possible values include: "AdminPolicy", "UserPolicy". - :type security_type: str or ~azure.mgmt.network.v2021_02_01_preview.models.SecurityType - :param delete_existing_ns_gs: Flag if need to delete existing network security groups. Possible - values include: "False", "True". - :type delete_existing_ns_gs: str or - ~azure.mgmt.network.v2021_02_01_preview.models.DeleteExistingNSGs - :ivar provisioning_state: The provisioning state of the resource. Possible values include: - "Succeeded", "Updating", "Deleting", "Failed". - :vartype provisioning_state: str or - ~azure.mgmt.network.v2021_02_01_preview.models.ProvisioningState + :vartype system_data: ~azure.mgmt.network.v2021_05_01_preview.models.SystemData + :ivar resource_id: Resource Id. + :vartype resource_id: str """ _validation = { @@ -3025,7 +3854,6 @@ class SecurityConfiguration(ProxyResource): 'type': {'readonly': True}, 'etag': {'readonly': True}, 'system_data': {'readonly': True}, - 'provisioning_state': {'readonly': True}, } _attribute_map = { @@ -3034,53 +3862,52 @@ class SecurityConfiguration(ProxyResource): 'type': {'key': 'type', 'type': 'str'}, 'etag': {'key': 'etag', 'type': 'str'}, 'system_data': {'key': 'systemData', 'type': 'SystemData'}, - 'display_name': {'key': 'properties.displayName', 'type': 'str'}, - 'description': {'key': 'properties.description', 'type': 'str'}, - 'security_type': {'key': 'properties.securityType', 'type': 'str'}, - 'delete_existing_ns_gs': {'key': 'properties.deleteExistingNSGs', 'type': 'str'}, - 'provisioning_state': {'key': 'properties.provisioningState', 'type': 'str'}, + 'resource_id': {'key': 'properties.resourceId', 'type': 'str'}, } def __init__( self, *, - display_name: Optional[str] = None, - description: Optional[str] = None, - security_type: Optional[Union[str, "SecurityType"]] = None, - delete_existing_ns_gs: Optional[Union[str, "DeleteExistingNSGs"]] = None, + resource_id: Optional[str] = None, **kwargs ): - super(SecurityConfiguration, self).__init__(**kwargs) + """ + :keyword resource_id: Resource Id. + :paramtype resource_id: str + """ + super(StaticMember, self).__init__(**kwargs) self.system_data = None - self.display_name = display_name - self.description = description - self.security_type = security_type - self.delete_existing_ns_gs = delete_existing_ns_gs - self.provisioning_state = None + self.resource_id = resource_id -class SecurityConfigurationListResult(msrest.serialization.Model): - """A list of network manager security configurations. +class StaticMemberListResult(msrest.serialization.Model): + """Result of the request to list StaticMember. It contains a list of groups and a URL link to get the next set of results. - :param value: Gets a page of security configurations. - :type value: list[~azure.mgmt.network.v2021_02_01_preview.models.SecurityConfiguration] - :param next_link: Gets the URL to get the next page of results. - :type next_link: str + :ivar value: Gets a page of StaticMember. + :vartype value: list[~azure.mgmt.network.v2021_05_01_preview.models.StaticMember] + :ivar next_link: Gets the URL to get the next set of results. + :vartype next_link: str """ _attribute_map = { - 'value': {'key': 'value', 'type': '[SecurityConfiguration]'}, + 'value': {'key': 'value', 'type': '[StaticMember]'}, 'next_link': {'key': 'nextLink', 'type': 'str'}, } def __init__( self, *, - value: Optional[List["SecurityConfiguration"]] = None, + value: Optional[List["StaticMember"]] = None, next_link: Optional[str] = None, **kwargs ): - super(SecurityConfigurationListResult, self).__init__(**kwargs) + """ + :keyword value: Gets a page of StaticMember. + :paramtype value: list[~azure.mgmt.network.v2021_05_01_preview.models.StaticMember] + :keyword next_link: Gets the URL to get the next set of results. + :paramtype next_link: str + """ + super(StaticMemberListResult, self).__init__(**kwargs) self.value = value self.next_link = next_link @@ -3088,33 +3915,30 @@ def __init__( class SystemData(msrest.serialization.Model): """Metadata pertaining to creation and last modification of the resource. - :param created_by: The identity that created the resource. - :type created_by: str - :param created_by_type: The type of identity that created the resource. Possible values - include: "User", "Application", "ManagedIdentity", "Key". - :type created_by_type: str or ~azure.mgmt.network.v2021_02_01_preview.models.CreatedByType - :param created_at: The timestamp of resource creation (UTC). - :type created_at: ~datetime.datetime - :param last_modified_by: The identity that last modified the resource. - :type last_modified_by: str - :param last_modified_by_type: The type of identity that last modified the resource. Possible + :ivar created_by: The identity that created the resource. + :vartype created_by: str + :ivar created_by_type: The type of identity that created the resource. Possible values include: + "User", "Application", "ManagedIdentity", "Key". + :vartype created_by_type: str or ~azure.mgmt.network.v2021_05_01_preview.models.CreatedByType + :ivar created_at: The timestamp of resource creation (UTC). + :vartype created_at: ~datetime.datetime + :ivar last_modified_by: The identity that last modified the resource. + :vartype last_modified_by: str + :ivar last_modified_by_type: The type of identity that last modified the resource. Possible values include: "User", "Application", "ManagedIdentity", "Key". - :type last_modified_by_type: str or - ~azure.mgmt.network.v2021_02_01_preview.models.CreatedByType - :param last_modified_at: The type of identity that last modified the resource. - :type last_modified_at: ~datetime.datetime + :vartype last_modified_by_type: str or + ~azure.mgmt.network.v2021_05_01_preview.models.CreatedByType + :ivar last_modified_at: The type of identity that last modified the resource. + :vartype last_modified_at: ~datetime.datetime """ _attribute_map = { 'created_by': {'key': 'createdBy', 'type': 'str'}, 'created_by_type': {'key': 'createdByType', 'type': 'str'}, - # TODO: Datetime Issue will be fixed later - # 'created_at': {'key': 'createdAt', 'type': 'iso-8601'}, - 'created_at': {'key': 'createdAt', 'type': 'str'}, + 'created_at': {'key': 'createdAt', 'type': 'iso-8601'}, 'last_modified_by': {'key': 'lastModifiedBy', 'type': 'str'}, 'last_modified_by_type': {'key': 'lastModifiedByType', 'type': 'str'}, - # 'last_modified_at': {'key': 'lastModifiedAt', 'type': 'iso-8601'}, - 'last_modified_at': {'key': 'lastModifiedAt', 'type': 'str'}, + 'last_modified_at': {'key': 'lastModifiedAt', 'type': 'iso-8601'}, } def __init__( @@ -3128,6 +3952,23 @@ def __init__( last_modified_at: Optional[datetime.datetime] = None, **kwargs ): + """ + :keyword created_by: The identity that created the resource. + :paramtype created_by: str + :keyword created_by_type: The type of identity that created the resource. Possible values + include: "User", "Application", "ManagedIdentity", "Key". + :paramtype created_by_type: str or ~azure.mgmt.network.v2021_05_01_preview.models.CreatedByType + :keyword created_at: The timestamp of resource creation (UTC). + :paramtype created_at: ~datetime.datetime + :keyword last_modified_by: The identity that last modified the resource. + :paramtype last_modified_by: str + :keyword last_modified_by_type: The type of identity that last modified the resource. Possible + values include: "User", "Application", "ManagedIdentity", "Key". + :paramtype last_modified_by_type: str or + ~azure.mgmt.network.v2021_05_01_preview.models.CreatedByType + :keyword last_modified_at: The type of identity that last modified the resource. + :paramtype last_modified_at: ~datetime.datetime + """ super(SystemData, self).__init__(**kwargs) self.created_by = created_by self.created_by_type = created_by_type @@ -3137,27 +3978,6 @@ def __init__( self.last_modified_at = last_modified_at -class TagsObject(msrest.serialization.Model): - """Tags object for patch operations. - - :param tags: A set of tags. Resource tags. - :type tags: dict[str, str] - """ - - _attribute_map = { - 'tags': {'key': 'tags', 'type': '{str}'}, - } - - def __init__( - self, - *, - tags: Optional[Dict[str, str]] = None, - **kwargs - ): - super(TagsObject, self).__init__(**kwargs) - self.tags = tags - - class UserRule(BaseUserRule): """Network security user rule. @@ -3173,35 +3993,35 @@ class UserRule(BaseUserRule): :vartype type: str :ivar etag: A unique read-only string that changes whenever the resource is updated. :vartype etag: str - :param kind: Required. Whether the rule is custom or default.Constant filled by server. - Possible values include: "Custom", "Default". - :type kind: str or ~azure.mgmt.network.v2021_02_01_preview.models.UserRuleKind + :ivar kind: Required. Whether the rule is custom or default.Constant filled by server. Possible + values include: "Custom", "Default". + :vartype kind: str or ~azure.mgmt.network.v2021_05_01_preview.models.UserRuleKind :ivar system_data: The system metadata related to this resource. - :vartype system_data: ~azure.mgmt.network.v2021_02_01_preview.models.SystemData - :param display_name: A friendly name for the rule. - :type display_name: str - :param description: A description for this rule. - :type description: str - :param protocol: Network protocol this rule applies to. Possible values include: "Tcp", "Udp", + :vartype system_data: ~azure.mgmt.network.v2021_05_01_preview.models.SystemData + :ivar display_name: A friendly name for the rule. + :vartype display_name: str + :ivar description: A description for this rule. + :vartype description: str + :ivar protocol: Network protocol this rule applies to. Possible values include: "Tcp", "Udp", "Icmp", "Esp", "Any", "Ah". - :type protocol: str or - ~azure.mgmt.network.v2021_02_01_preview.models.SecurityConfigurationRuleProtocol - :param sources: The CIDR or source IP ranges. - :type sources: list[~azure.mgmt.network.v2021_02_01_preview.models.AddressPrefixItem] - :param destinations: The destination address prefixes. CIDR or destination IP ranges. - :type destinations: list[~azure.mgmt.network.v2021_02_01_preview.models.AddressPrefixItem] - :param source_port_ranges: The source port ranges. - :type source_port_ranges: list[str] - :param destination_port_ranges: The destination port ranges. - :type destination_port_ranges: list[str] - :param direction: Indicates if the traffic matched against the rule in inbound or outbound. + :vartype protocol: str or + ~azure.mgmt.network.v2021_05_01_preview.models.SecurityConfigurationRuleProtocol + :ivar sources: The CIDR or source IP ranges. + :vartype sources: list[~azure.mgmt.network.v2021_05_01_preview.models.AddressPrefixItem] + :ivar destinations: The destination address prefixes. CIDR or destination IP ranges. + :vartype destinations: list[~azure.mgmt.network.v2021_05_01_preview.models.AddressPrefixItem] + :ivar source_port_ranges: The source port ranges. + :vartype source_port_ranges: list[str] + :ivar destination_port_ranges: The destination port ranges. + :vartype destination_port_ranges: list[str] + :ivar direction: Indicates if the traffic matched against the rule in inbound or outbound. Possible values include: "Inbound", "Outbound". - :type direction: str or - ~azure.mgmt.network.v2021_02_01_preview.models.SecurityConfigurationRuleDirection + :vartype direction: str or + ~azure.mgmt.network.v2021_05_01_preview.models.SecurityConfigurationRuleDirection :ivar provisioning_state: The provisioning state of the security configuration user rule resource. Possible values include: "Succeeded", "Updating", "Deleting", "Failed". :vartype provisioning_state: str or - ~azure.mgmt.network.v2021_02_01_preview.models.ProvisioningState + ~azure.mgmt.network.v2021_05_01_preview.models.ProvisioningState """ _validation = { @@ -3245,6 +4065,28 @@ def __init__( direction: Optional[Union[str, "SecurityConfigurationRuleDirection"]] = None, **kwargs ): + """ + :keyword display_name: A friendly name for the rule. + :paramtype display_name: str + :keyword description: A description for this rule. + :paramtype description: str + :keyword protocol: Network protocol this rule applies to. Possible values include: "Tcp", + "Udp", "Icmp", "Esp", "Any", "Ah". + :paramtype protocol: str or + ~azure.mgmt.network.v2021_05_01_preview.models.SecurityConfigurationRuleProtocol + :keyword sources: The CIDR or source IP ranges. + :paramtype sources: list[~azure.mgmt.network.v2021_05_01_preview.models.AddressPrefixItem] + :keyword destinations: The destination address prefixes. CIDR or destination IP ranges. + :paramtype destinations: list[~azure.mgmt.network.v2021_05_01_preview.models.AddressPrefixItem] + :keyword source_port_ranges: The source port ranges. + :paramtype source_port_ranges: list[str] + :keyword destination_port_ranges: The destination port ranges. + :paramtype destination_port_ranges: list[str] + :keyword direction: Indicates if the traffic matched against the rule in inbound or outbound. + Possible values include: "Inbound", "Outbound". + :paramtype direction: str or + ~azure.mgmt.network.v2021_05_01_preview.models.SecurityConfigurationRuleDirection + """ super(UserRule, self).__init__(**kwargs) self.kind = 'Custom' # type: str self.display_name = display_name @@ -3261,10 +4103,10 @@ def __init__( class UserRuleListResult(msrest.serialization.Model): """security user rule list result. - :param value: A list of user rules. - :type value: list[~azure.mgmt.network.v2021_02_01_preview.models.BaseUserRule] - :param next_link: The URL to get the next set of results. - :type next_link: str + :ivar value: A list of user rules. + :vartype value: list[~azure.mgmt.network.v2021_05_01_preview.models.BaseUserRule] + :ivar next_link: The URL to get the next set of results. + :vartype next_link: str """ _attribute_map = { @@ -3279,6 +4121,12 @@ def __init__( next_link: Optional[str] = None, **kwargs ): + """ + :keyword value: A list of user rules. + :paramtype value: list[~azure.mgmt.network.v2021_05_01_preview.models.BaseUserRule] + :keyword next_link: The URL to get the next set of results. + :paramtype next_link: str + """ super(UserRuleListResult, self).__init__(**kwargs) self.value = value self.next_link = next_link diff --git a/src/network-manager/azext_network_manager/vendored_sdks/models/_network_management_client_enums.py b/src/network-manager/azext_network_manager/vendored_sdks/models/_network_management_client_enums.py index b0161e3803d..4dcccb946d0 100644 --- a/src/network-manager/azext_network_manager/vendored_sdks/models/_network_management_client_enums.py +++ b/src/network-manager/azext_network_manager/vendored_sdks/models/_network_management_client_enums.py @@ -6,41 +6,26 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from enum import Enum, EnumMeta +from enum import Enum from six import with_metaclass +from azure.core import CaseInsensitiveEnumMeta -class _CaseInsensitiveEnumMeta(EnumMeta): - def __getitem__(self, name): - return super().__getitem__(name.upper()) - def __getattr__(cls, name): - """Return the enum member matching `name` - We use __getattr__ instead of descriptors or inserting into the enum - class' __dict__ in order to support `name` and `value` being both - properties for enum members (which live in the class' __dict__) and - enum members themselves. - """ - try: - return cls._member_map_[name.upper()] - except KeyError: - raise AttributeError(name) - - -class AddressPrefixType(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class AddressPrefixType(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """Address prefix type. """ IP_PREFIX = "IPPrefix" SERVICE_TAG = "ServiceTag" -class AdminRuleKind(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class AdminRuleKind(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """Whether the rule is custom or default. """ CUSTOM = "Custom" DEFAULT = "Default" -class ConfigurationType(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class ConfigurationType(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """Configuration Deployment Type. """ @@ -48,14 +33,14 @@ class ConfigurationType(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): SECURITY_USER = "SecurityUser" CONNECTIVITY = "Connectivity" -class ConnectivityTopology(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class ConnectivityTopology(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """Connectivity topology type. """ HUB_AND_SPOKE = "HubAndSpoke" MESH = "Mesh" -class CreatedByType(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class CreatedByType(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """The type of identity that created the resource. """ @@ -64,21 +49,21 @@ class CreatedByType(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): MANAGED_IDENTITY = "ManagedIdentity" KEY = "Key" -class DeleteExistingNSGs(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class DeleteExistingNSGs(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """Flag if need to delete existing network security groups. """ FALSE = "False" TRUE = "True" -class DeleteExistingPeering(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class DeleteExistingPeering(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """Flag if need to remove current existing peerings. """ FALSE = "False" TRUE = "True" -class DeploymentStatus(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class DeploymentStatus(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """Deployment Status. """ @@ -87,42 +72,49 @@ class DeploymentStatus(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): DEPLOYED = "Deployed" FAILED = "Failed" -class EffectiveAdminRuleKind(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class EffectiveAdminRuleKind(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """Whether the rule is custom or default. """ CUSTOM = "Custom" DEFAULT = "Default" -class EffectiveUserRuleKind(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class EffectiveUserRuleKind(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """Whether the rule is custom or default. """ CUSTOM = "Custom" DEFAULT = "Default" -class GroupConnectivity(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class GroupConnectivity(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """Group connectivity type. """ NONE = "None" DIRECTLY_CONNECTED = "DirectlyConnected" -class IsGlobal(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class IsGlobal(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """Flag if global mesh is supported. """ FALSE = "False" TRUE = "True" -class MembershipType(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class MembershipType(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """Membership Type. """ STATIC = "Static" DYNAMIC = "Dynamic" -class ProvisioningState(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class NetworkIntentPolicyBasedService(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): + """Network intent policy based services. + """ + + NONE = "None" + ALL = "All" + +class ProvisioningState(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """The current provisioning state. """ @@ -131,7 +123,17 @@ class ProvisioningState(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): DELETING = "Deleting" FAILED = "Failed" -class SecurityConfigurationRuleAccess(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class ScopeConnectionState(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): + """The current scope connection state. + """ + + CONNECTED = "Connected" + PENDING = "Pending" + CONFLICT = "Conflict" + REVOKED = "Revoked" + REJECTED = "Rejected" + +class SecurityConfigurationRuleAccess(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """Whether network traffic is allowed or denied. """ @@ -139,7 +141,7 @@ class SecurityConfigurationRuleAccess(with_metaclass(_CaseInsensitiveEnumMeta, s DENY = "Deny" ALWAYS_ALLOW = "AlwaysAllow" -class SecurityConfigurationRuleDirection(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class SecurityConfigurationRuleDirection(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """The direction of the rule. The direction specifies if the rule will be evaluated on incoming or outgoing traffic. """ @@ -147,7 +149,7 @@ class SecurityConfigurationRuleDirection(with_metaclass(_CaseInsensitiveEnumMeta INBOUND = "Inbound" OUTBOUND = "Outbound" -class SecurityConfigurationRuleProtocol(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class SecurityConfigurationRuleProtocol(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """Network protocol this rule applies to. """ @@ -158,21 +160,21 @@ class SecurityConfigurationRuleProtocol(with_metaclass(_CaseInsensitiveEnumMeta, ANY = "Any" AH = "Ah" -class SecurityType(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class SecurityType(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """Security Type. """ ADMIN_POLICY = "AdminPolicy" USER_POLICY = "UserPolicy" -class UseHubGateway(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class UseHubGateway(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """Flag if need to use hub gateway. """ FALSE = "False" TRUE = "True" -class UserRuleKind(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class UserRuleKind(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """Whether the rule is custom or default. """ diff --git a/src/network-manager/azext_network_manager/vendored_sdks/operations/__init__.py b/src/network-manager/azext_network_manager/vendored_sdks/operations/__init__.py index e3ab4d13aca..4a8edd7c584 100644 --- a/src/network-manager/azext_network_manager/vendored_sdks/operations/__init__.py +++ b/src/network-manager/azext_network_manager/vendored_sdks/operations/__init__.py @@ -10,40 +10,38 @@ from ._network_manager_commits_operations import NetworkManagerCommitsOperations from ._network_manager_deployment_status_operations import NetworkManagerDeploymentStatusOperations from ._effective_virtual_networks_operations import EffectiveVirtualNetworksOperations -from ._active_connectivity_configurations_operations import ActiveConnectivityConfigurationsOperations -from ._active_security_admin_rules_operations import ActiveSecurityAdminRulesOperations -from ._active_security_user_rules_operations import ActiveSecurityUserRulesOperations +from ._network_management_client_operations import NetworkManagementClientOperationsMixin from ._connectivity_configurations_operations import ConnectivityConfigurationsOperations -from ._effective_connectivity_configurations_operations import EffectiveConnectivityConfigurationsOperations -from ._network_manager_effective_security_admin_rules_operations import NetworkManagerEffectiveSecurityAdminRulesOperations from ._network_groups_operations import NetworkGroupsOperations +from ._list_effective_virtual_networks_operations import ListEffectiveVirtualNetworksOperations +from ._static_members_operations import StaticMembersOperations from ._security_user_configurations_operations import SecurityUserConfigurationsOperations from ._user_rule_collections_operations import UserRuleCollectionsOperations from ._user_rules_operations import UserRulesOperations from ._security_admin_configurations_operations import SecurityAdminConfigurationsOperations from ._admin_rule_collections_operations import AdminRuleCollectionsOperations from ._admin_rules_operations import AdminRulesOperations -from ._network_security_perimeters_operations import NetworkSecurityPerimetersOperations -from ._perimeter_associable_resource_types_operations import PerimeterAssociableResourceTypesOperations +from ._subscription_network_manager_connections_operations import SubscriptionNetworkManagerConnectionsOperations +from ._management_group_network_manager_connections_operations import ManagementGroupNetworkManagerConnectionsOperations +from ._scope_connections_operations import ScopeConnectionsOperations __all__ = [ 'NetworkManagersOperations', 'NetworkManagerCommitsOperations', 'NetworkManagerDeploymentStatusOperations', 'EffectiveVirtualNetworksOperations', - 'ActiveConnectivityConfigurationsOperations', - 'ActiveSecurityAdminRulesOperations', - 'ActiveSecurityUserRulesOperations', + 'NetworkManagementClientOperationsMixin', 'ConnectivityConfigurationsOperations', - 'EffectiveConnectivityConfigurationsOperations', - 'NetworkManagerEffectiveSecurityAdminRulesOperations', 'NetworkGroupsOperations', + 'ListEffectiveVirtualNetworksOperations', + 'StaticMembersOperations', 'SecurityUserConfigurationsOperations', 'UserRuleCollectionsOperations', 'UserRulesOperations', 'SecurityAdminConfigurationsOperations', 'AdminRuleCollectionsOperations', 'AdminRulesOperations', - 'NetworkSecurityPerimetersOperations', - 'PerimeterAssociableResourceTypesOperations', + 'SubscriptionNetworkManagerConnectionsOperations', + 'ManagementGroupNetworkManagerConnectionsOperations', + 'ScopeConnectionsOperations', ] diff --git a/src/network-manager/azext_network_manager/vendored_sdks/operations/_active_connectivity_configurations_operations.py b/src/network-manager/azext_network_manager/vendored_sdks/operations/_active_connectivity_configurations_operations.py deleted file mode 100644 index b3cccd8ae21..00000000000 --- a/src/network-manager/azext_network_manager/vendored_sdks/operations/_active_connectivity_configurations_operations.py +++ /dev/null @@ -1,112 +0,0 @@ -# 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 typing import TYPE_CHECKING -import warnings - -from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error -from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import HttpRequest, HttpResponse -from azure.mgmt.core.exceptions import ARMErrorFormat - -from .. import models as _models - -if TYPE_CHECKING: - # pylint: disable=unused-import,ungrouped-imports - from typing import Any, Callable, Dict, Generic, Optional, TypeVar - - T = TypeVar('T') - ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] - -class ActiveConnectivityConfigurationsOperations(object): - """ActiveConnectivityConfigurationsOperations operations. - - You should not instantiate this class directly. Instead, you should create a Client instance that - instantiates it for you and attaches it as an attribute. - - :ivar models: Alias to model classes used in this operation group. - :type models: ~azure.mgmt.network.v2021_02_01_preview.models - :param client: Client for service requests. - :param config: Configuration of service client. - :param serializer: An object model serializer. - :param deserializer: An object model deserializer. - """ - - models = _models - - def __init__(self, client, config, serializer, deserializer): - self._client = client - self._serialize = serializer - self._deserialize = deserializer - self._config = config - - def list( - self, - resource_group_name, # type: str - network_manager_name, # type: str - parameters, # type: "_models.ActiveConfigurationParameter" - **kwargs # type: Any - ): - # type: (...) -> "_models.ActiveConnectivityConfigurationsListResult" - """Lists active connectivity configurations in a network manager. - - :param resource_group_name: The name of the resource group. - :type resource_group_name: str - :param network_manager_name: The name of the network manager. - :type network_manager_name: str - :param parameters: Active Configuration Parameter. - :type parameters: ~azure.mgmt.network.v2021_02_01_preview.models.ActiveConfigurationParameter - :keyword callable cls: A custom type or function that will be passed the direct response - :return: ActiveConnectivityConfigurationsListResult, or the result of cls(response) - :rtype: ~azure.mgmt.network.v2021_02_01_preview.models.ActiveConnectivityConfigurationsListResult - :raises: ~azure.core.exceptions.HttpResponseError - """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.ActiveConnectivityConfigurationsListResult"] - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-02-01-preview" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self.list.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'networkManagerName': self._serialize.url("network_manager_name", network_manager_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(parameters, 'ActiveConfigurationParameter') - body_content_kwargs['content'] = body_content - request = self._client.post(url, query_parameters, header_parameters, **body_content_kwargs) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - deserialized = self._deserialize('ActiveConnectivityConfigurationsListResult', pipeline_response) - - if cls: - return cls(pipeline_response, deserialized, {}) - - return deserialized - list.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/networkManagers/{networkManagerName}/listActiveConnectivityConfigurations'} # type: ignore diff --git a/src/network-manager/azext_network_manager/vendored_sdks/operations/_active_security_admin_rules_operations.py b/src/network-manager/azext_network_manager/vendored_sdks/operations/_active_security_admin_rules_operations.py deleted file mode 100644 index cfc78b9b64f..00000000000 --- a/src/network-manager/azext_network_manager/vendored_sdks/operations/_active_security_admin_rules_operations.py +++ /dev/null @@ -1,112 +0,0 @@ -# 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 typing import TYPE_CHECKING -import warnings - -from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error -from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import HttpRequest, HttpResponse -from azure.mgmt.core.exceptions import ARMErrorFormat - -from .. import models as _models - -if TYPE_CHECKING: - # pylint: disable=unused-import,ungrouped-imports - from typing import Any, Callable, Dict, Generic, Optional, TypeVar - - T = TypeVar('T') - ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] - -class ActiveSecurityAdminRulesOperations(object): - """ActiveSecurityAdminRulesOperations operations. - - You should not instantiate this class directly. Instead, you should create a Client instance that - instantiates it for you and attaches it as an attribute. - - :ivar models: Alias to model classes used in this operation group. - :type models: ~azure.mgmt.network.v2021_02_01_preview.models - :param client: Client for service requests. - :param config: Configuration of service client. - :param serializer: An object model serializer. - :param deserializer: An object model deserializer. - """ - - models = _models - - def __init__(self, client, config, serializer, deserializer): - self._client = client - self._serialize = serializer - self._deserialize = deserializer - self._config = config - - def list( - self, - resource_group_name, # type: str - network_manager_name, # type: str - parameters, # type: "_models.ActiveConfigurationParameter" - **kwargs # type: Any - ): - # type: (...) -> "_models.ActiveSecurityAdminRulesListResult" - """Lists active security admin rules in a network manager. - - :param resource_group_name: The name of the resource group. - :type resource_group_name: str - :param network_manager_name: The name of the network manager. - :type network_manager_name: str - :param parameters: Active Configuration Parameter. - :type parameters: ~azure.mgmt.network.v2021_02_01_preview.models.ActiveConfigurationParameter - :keyword callable cls: A custom type or function that will be passed the direct response - :return: ActiveSecurityAdminRulesListResult, or the result of cls(response) - :rtype: ~azure.mgmt.network.v2021_02_01_preview.models.ActiveSecurityAdminRulesListResult - :raises: ~azure.core.exceptions.HttpResponseError - """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.ActiveSecurityAdminRulesListResult"] - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-02-01-preview" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self.list.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'networkManagerName': self._serialize.url("network_manager_name", network_manager_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(parameters, 'ActiveConfigurationParameter') - body_content_kwargs['content'] = body_content - request = self._client.post(url, query_parameters, header_parameters, **body_content_kwargs) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - deserialized = self._deserialize('ActiveSecurityAdminRulesListResult', pipeline_response) - - if cls: - return cls(pipeline_response, deserialized, {}) - - return deserialized - list.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/networkManagers/{networkManagerName}/listActiveSecurityAdminRules'} # type: ignore diff --git a/src/network-manager/azext_network_manager/vendored_sdks/operations/_active_security_user_rules_operations.py b/src/network-manager/azext_network_manager/vendored_sdks/operations/_active_security_user_rules_operations.py deleted file mode 100644 index c50c995dd9f..00000000000 --- a/src/network-manager/azext_network_manager/vendored_sdks/operations/_active_security_user_rules_operations.py +++ /dev/null @@ -1,112 +0,0 @@ -# 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 typing import TYPE_CHECKING -import warnings - -from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error -from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import HttpRequest, HttpResponse -from azure.mgmt.core.exceptions import ARMErrorFormat - -from .. import models as _models - -if TYPE_CHECKING: - # pylint: disable=unused-import,ungrouped-imports - from typing import Any, Callable, Dict, Generic, Optional, TypeVar - - T = TypeVar('T') - ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] - -class ActiveSecurityUserRulesOperations(object): - """ActiveSecurityUserRulesOperations operations. - - You should not instantiate this class directly. Instead, you should create a Client instance that - instantiates it for you and attaches it as an attribute. - - :ivar models: Alias to model classes used in this operation group. - :type models: ~azure.mgmt.network.v2021_02_01_preview.models - :param client: Client for service requests. - :param config: Configuration of service client. - :param serializer: An object model serializer. - :param deserializer: An object model deserializer. - """ - - models = _models - - def __init__(self, client, config, serializer, deserializer): - self._client = client - self._serialize = serializer - self._deserialize = deserializer - self._config = config - - def list( - self, - resource_group_name, # type: str - network_manager_name, # type: str - parameters, # type: "_models.ActiveConfigurationParameter" - **kwargs # type: Any - ): - # type: (...) -> "_models.ActiveSecurityUserRulesListResult" - """Lists Active Security User Rules in a network manager. - - :param resource_group_name: The name of the resource group. - :type resource_group_name: str - :param network_manager_name: The name of the network manager. - :type network_manager_name: str - :param parameters: Active Configuration Parameter. - :type parameters: ~azure.mgmt.network.v2021_02_01_preview.models.ActiveConfigurationParameter - :keyword callable cls: A custom type or function that will be passed the direct response - :return: ActiveSecurityUserRulesListResult, or the result of cls(response) - :rtype: ~azure.mgmt.network.v2021_02_01_preview.models.ActiveSecurityUserRulesListResult - :raises: ~azure.core.exceptions.HttpResponseError - """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.ActiveSecurityUserRulesListResult"] - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-02-01-preview" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self.list.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'networkManagerName': self._serialize.url("network_manager_name", network_manager_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(parameters, 'ActiveConfigurationParameter') - body_content_kwargs['content'] = body_content - request = self._client.post(url, query_parameters, header_parameters, **body_content_kwargs) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - deserialized = self._deserialize('ActiveSecurityUserRulesListResult', pipeline_response) - - if cls: - return cls(pipeline_response, deserialized, {}) - - return deserialized - list.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/networkManagers/{networkManagerName}/listActiveSecurityUserRules'} # type: ignore diff --git a/src/network-manager/azext_network_manager/vendored_sdks/operations/_admin_rule_collections_operations.py b/src/network-manager/azext_network_manager/vendored_sdks/operations/_admin_rule_collections_operations.py index 752c53b39f4..ee7f02abd7c 100644 --- a/src/network-manager/azext_network_manager/vendored_sdks/operations/_admin_rule_collections_operations.py +++ b/src/network-manager/azext_network_manager/vendored_sdks/operations/_admin_rule_collections_operations.py @@ -5,23 +5,203 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import TYPE_CHECKING +import functools +from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar, Union import warnings from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.paging import ItemPaged from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import HttpRequest, HttpResponse +from azure.core.pipeline.transport import HttpResponse +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace from azure.mgmt.core.exceptions import ARMErrorFormat +from msrest import Serializer from .. import models as _models - -if TYPE_CHECKING: - # pylint: disable=unused-import,ungrouped-imports - from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar, Union - - T = TypeVar('T') - ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] +from .._vendor import _convert_request, _format_url_section +T = TypeVar('T') +JSONType = Any +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] + +_SERIALIZER = Serializer() +_SERIALIZER.client_side_validation = False + +def build_list_request( + subscription_id: str, + resource_group_name: str, + network_manager_name: str, + configuration_name: str, + *, + top: Optional[int] = None, + skip_token: Optional[str] = None, + **kwargs: Any +) -> HttpRequest: + api_version = "2021-05-01-preview" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/networkManagers/{networkManagerName}/securityAdminConfigurations/{configurationName}/ruleCollections') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "networkManagerName": _SERIALIZER.url("network_manager_name", network_manager_name, 'str'), + "configurationName": _SERIALIZER.url("configuration_name", configuration_name, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + if top is not None: + query_parameters['$top'] = _SERIALIZER.query("top", top, 'int', maximum=20, minimum=1) + if skip_token is not None: + query_parameters['$skipToken'] = _SERIALIZER.query("skip_token", skip_token, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_get_request( + subscription_id: str, + resource_group_name: str, + network_manager_name: str, + configuration_name: str, + rule_collection_name: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2021-05-01-preview" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/networkManagers/{networkManagerName}/securityAdminConfigurations/{configurationName}/ruleCollections/{ruleCollectionName}') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "networkManagerName": _SERIALIZER.url("network_manager_name", network_manager_name, 'str'), + "configurationName": _SERIALIZER.url("configuration_name", configuration_name, 'str'), + "ruleCollectionName": _SERIALIZER.url("rule_collection_name", rule_collection_name, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_create_or_update_request( + subscription_id: str, + resource_group_name: str, + network_manager_name: str, + configuration_name: str, + rule_collection_name: str, + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any +) -> HttpRequest: + content_type = kwargs.pop('content_type', None) # type: Optional[str] + + api_version = "2021-05-01-preview" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/networkManagers/{networkManagerName}/securityAdminConfigurations/{configurationName}/ruleCollections/{ruleCollectionName}') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "networkManagerName": _SERIALIZER.url("network_manager_name", network_manager_name, 'str'), + "configurationName": _SERIALIZER.url("configuration_name", configuration_name, 'str'), + "ruleCollectionName": _SERIALIZER.url("rule_collection_name", rule_collection_name, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + if content_type is not None: + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="PUT", + url=url, + params=query_parameters, + headers=header_parameters, + json=json, + content=content, + **kwargs + ) + + +def build_delete_request( + subscription_id: str, + resource_group_name: str, + network_manager_name: str, + configuration_name: str, + rule_collection_name: str, + *, + force: Optional[bool] = None, + recursive: Optional[bool] = None, + **kwargs: Any +) -> HttpRequest: + api_version = "2021-05-01-preview" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/networkManagers/{networkManagerName}/securityAdminConfigurations/{configurationName}/ruleCollections/{ruleCollectionName}') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "networkManagerName": _SERIALIZER.url("network_manager_name", network_manager_name, 'str'), + "configurationName": _SERIALIZER.url("configuration_name", configuration_name, 'str'), + "ruleCollectionName": _SERIALIZER.url("rule_collection_name", rule_collection_name, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + if force is not None: + query_parameters['force'] = _SERIALIZER.query("force", force, 'bool') + if recursive is not None: + query_parameters['recursive'] = _SERIALIZER.query("recursive", recursive, 'bool') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="DELETE", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) class AdminRuleCollectionsOperations(object): """AdminRuleCollectionsOperations operations. @@ -30,7 +210,7 @@ class AdminRuleCollectionsOperations(object): instantiates it for you and attaches it as an attribute. :ivar models: Alias to model classes used in this operation group. - :type models: ~azure.mgmt.network.v2021_02_01_preview.models + :type models: ~azure.mgmt.network.v2021_05_01_preview.models :param client: Client for service requests. :param config: Configuration of service client. :param serializer: An object model serializer. @@ -45,23 +225,23 @@ def __init__(self, client, config, serializer, deserializer): self._deserialize = deserializer self._config = config + @distributed_trace def list( self, - resource_group_name, # type: str - network_manager_name, # type: str - configuration_name, # type: str - top=None, # type: Optional[int] - skip_token=None, # type: Optional[str] - **kwargs # type: Any - ): - # type: (...) -> Iterable["_models.RuleCollectionListResult"] + resource_group_name: str, + network_manager_name: str, + configuration_name: str, + top: Optional[int] = None, + skip_token: Optional[str] = None, + **kwargs: Any + ) -> Iterable["_models.RuleCollectionListResult"]: """Lists all the rule collections in a security admin configuration, in a paginated format. :param resource_group_name: The name of the resource group. :type resource_group_name: str :param network_manager_name: The name of the network manager. :type network_manager_name: str - :param configuration_name: The name of the network manager security Configuration. + :param configuration_name: The name of the network manager Security Configuration. :type configuration_name: str :param top: An optional query parameter which specifies the maximum number of records to be returned by the server. @@ -71,8 +251,10 @@ def list( a skipToken parameter that specifies a starting point to use for subsequent calls. :type skip_token: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either RuleCollectionListResult or the result of cls(response) - :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.network.v2021_02_01_preview.models.RuleCollectionListResult] + :return: An iterator like instance of either RuleCollectionListResult or the result of + cls(response) + :rtype: + ~azure.core.paging.ItemPaged[~azure.mgmt.network.v2021_05_01_preview.models.RuleCollectionListResult] :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.RuleCollectionListResult"] @@ -80,41 +262,39 @@ def list( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-02-01-preview" - accept = "application/json" - def prepare_request(next_link=None): - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - if not next_link: - # Construct URL - url = self.list.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'networkManagerName': self._serialize.url("network_manager_name", network_manager_name, 'str'), - 'configurationName': self._serialize.url("configuration_name", configuration_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - if top is not None: - query_parameters['$top'] = self._serialize.query("top", top, 'int', maximum=20, minimum=1) - if skip_token is not None: - query_parameters['$skipToken'] = self._serialize.query("skip_token", skip_token, 'str') - - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + network_manager_name=network_manager_name, + configuration_name=configuration_name, + top=top, + skip_token=skip_token, + template_url=self.list.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + network_manager_name=network_manager_name, + configuration_name=configuration_name, + top=top, + skip_token=skip_token, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request def extract_data(pipeline_response): - deserialized = self._deserialize('RuleCollectionListResult', pipeline_response) + deserialized = self._deserialize("RuleCollectionListResult", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -132,34 +312,35 @@ def get_next(next_link=None): return pipeline_response + return ItemPaged( get_next, extract_data ) list.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/networkManagers/{networkManagerName}/securityAdminConfigurations/{configurationName}/ruleCollections'} # type: ignore + @distributed_trace def get( self, - resource_group_name, # type: str - network_manager_name, # type: str - configuration_name, # type: str - rule_collection_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> "_models.RuleCollection" + resource_group_name: str, + network_manager_name: str, + configuration_name: str, + rule_collection_name: str, + **kwargs: Any + ) -> "_models.RuleCollection": """Gets a network manager security admin configuration rule collection. :param resource_group_name: The name of the resource group. :type resource_group_name: str :param network_manager_name: The name of the network manager. :type network_manager_name: str - :param configuration_name: The name of the network manager security Configuration. + :param configuration_name: The name of the network manager Security Configuration. :type configuration_name: str :param rule_collection_name: The name of the network manager security Configuration rule collection. :type rule_collection_name: str :keyword callable cls: A custom type or function that will be passed the direct response :return: RuleCollection, or the result of cls(response) - :rtype: ~azure.mgmt.network.v2021_02_01_preview.models.RuleCollection + :rtype: ~azure.mgmt.network.v2021_05_01_preview.models.RuleCollection :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.RuleCollection"] @@ -167,29 +348,19 @@ def get( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-02-01-preview" - accept = "application/json" - - # Construct URL - url = self.get.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'networkManagerName': self._serialize.url("network_manager_name", network_manager_name, 'str'), - 'configurationName': self._serialize.url("configuration_name", configuration_name, 'str'), - 'ruleCollectionName': self._serialize.url("rule_collection_name", rule_collection_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_get_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + network_manager_name=network_manager_name, + configuration_name=configuration_name, + rule_collection_name=rule_collection_name, + template_url=self.get.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.get(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -203,34 +374,36 @@ def get( return cls(pipeline_response, deserialized, {}) return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/networkManagers/{networkManagerName}/securityAdminConfigurations/{configurationName}/ruleCollections/{ruleCollectionName}'} # type: ignore + + @distributed_trace def create_or_update( self, - resource_group_name, # type: str - network_manager_name, # type: str - configuration_name, # type: str - rule_collection_name, # type: str - rule_collection, # type: "_models.RuleCollection" - **kwargs # type: Any - ): - # type: (...) -> "_models.RuleCollection" + resource_group_name: str, + network_manager_name: str, + configuration_name: str, + rule_collection_name: str, + rule_collection: "_models.RuleCollection", + **kwargs: Any + ) -> "_models.RuleCollection": """Creates or updates an admin rule collection. :param resource_group_name: The name of the resource group. :type resource_group_name: str :param network_manager_name: The name of the network manager. :type network_manager_name: str - :param configuration_name: The name of the network manager security Configuration. + :param configuration_name: The name of the network manager Security Configuration. :type configuration_name: str :param rule_collection_name: The name of the network manager security Configuration rule collection. :type rule_collection_name: str :param rule_collection: The Rule Collection to create or update. - :type rule_collection: ~azure.mgmt.network.v2021_02_01_preview.models.RuleCollection + :type rule_collection: ~azure.mgmt.network.v2021_05_01_preview.models.RuleCollection :keyword callable cls: A custom type or function that will be passed the direct response :return: RuleCollection, or the result of cls(response) - :rtype: ~azure.mgmt.network.v2021_02_01_preview.models.RuleCollection + :rtype: ~azure.mgmt.network.v2021_05_01_preview.models.RuleCollection :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.RuleCollection"] @@ -238,34 +411,24 @@ def create_or_update( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-02-01-preview" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self.create_or_update.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'networkManagerName': self._serialize.url("network_manager_name", network_manager_name, 'str'), - 'configurationName': self._serialize.url("configuration_name", configuration_name, 'str'), - 'ruleCollectionName': self._serialize.url("rule_collection_name", rule_collection_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + _json = self._serialize.body(rule_collection, 'RuleCollection') + + request = build_create_or_update_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + network_manager_name=network_manager_name, + configuration_name=configuration_name, + rule_collection_name=rule_collection_name, + content_type=content_type, + json=_json, + template_url=self.create_or_update.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(rule_collection, 'RuleCollection') - body_content_kwargs['content'] = body_content - request = self._client.put(url, query_parameters, header_parameters, **body_content_kwargs) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -283,28 +446,40 @@ def create_or_update( return cls(pipeline_response, deserialized, {}) return deserialized + create_or_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/networkManagers/{networkManagerName}/securityAdminConfigurations/{configurationName}/ruleCollections/{ruleCollectionName}'} # type: ignore + + @distributed_trace def delete( self, - resource_group_name, # type: str - network_manager_name, # type: str - configuration_name, # type: str - rule_collection_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> None + resource_group_name: str, + network_manager_name: str, + configuration_name: str, + rule_collection_name: str, + force: Optional[bool] = None, + recursive: Optional[bool] = None, + **kwargs: Any + ) -> None: """Deletes an admin rule collection. :param resource_group_name: The name of the resource group. :type resource_group_name: str :param network_manager_name: The name of the network manager. :type network_manager_name: str - :param configuration_name: The name of the network manager security Configuration. + :param configuration_name: The name of the network manager Security Configuration. :type configuration_name: str :param rule_collection_name: The name of the network manager security Configuration rule collection. :type rule_collection_name: str + :param force: Deletes the resource even if it is part of a deployed configuration. If the + configuration has been deployed, the service will do a cleanup deployment in the background, + prior to the delete. + :type force: bool + :param recursive: Deletes the resource recursively. When present in a security configuration + delete, all rule collections and rules within the configuration will be deleted. When present + in a rule collection delete, all rules within the collection will be deleted. + :type recursive: bool :keyword callable cls: A custom type or function that will be passed the direct response :return: None, or the result of cls(response) :rtype: None @@ -315,29 +490,21 @@ def delete( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-02-01-preview" - accept = "application/json" - - # Construct URL - url = self.delete.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'networkManagerName': self._serialize.url("network_manager_name", network_manager_name, 'str'), - 'configurationName': self._serialize.url("configuration_name", configuration_name, 'str'), - 'ruleCollectionName': self._serialize.url("rule_collection_name", rule_collection_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_delete_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + network_manager_name=network_manager_name, + configuration_name=configuration_name, + rule_collection_name=rule_collection_name, + force=force, + recursive=recursive, + template_url=self.delete.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.delete(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -349,3 +516,4 @@ def delete( return cls(pipeline_response, None, {}) delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/networkManagers/{networkManagerName}/securityAdminConfigurations/{configurationName}/ruleCollections/{ruleCollectionName}'} # type: ignore + diff --git a/src/network-manager/azext_network_manager/vendored_sdks/operations/_admin_rules_operations.py b/src/network-manager/azext_network_manager/vendored_sdks/operations/_admin_rules_operations.py index a0d26b49613..cc6273117d4 100644 --- a/src/network-manager/azext_network_manager/vendored_sdks/operations/_admin_rules_operations.py +++ b/src/network-manager/azext_network_manager/vendored_sdks/operations/_admin_rules_operations.py @@ -5,23 +5,208 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import TYPE_CHECKING +import functools +from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar, Union import warnings from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.paging import ItemPaged from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import HttpRequest, HttpResponse +from azure.core.pipeline.transport import HttpResponse +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace from azure.mgmt.core.exceptions import ARMErrorFormat +from msrest import Serializer from .. import models as _models - -if TYPE_CHECKING: - # pylint: disable=unused-import,ungrouped-imports - from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar, Union - - T = TypeVar('T') - ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] +from .._vendor import _convert_request, _format_url_section +T = TypeVar('T') +JSONType = Any +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] + +_SERIALIZER = Serializer() +_SERIALIZER.client_side_validation = False + +def build_list_request( + subscription_id: str, + resource_group_name: str, + network_manager_name: str, + configuration_name: str, + rule_collection_name: str, + *, + top: Optional[int] = None, + skip_token: Optional[str] = None, + **kwargs: Any +) -> HttpRequest: + api_version = "2021-05-01-preview" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/networkManagers/{networkManagerName}/securityAdminConfigurations/{configurationName}/ruleCollections/{ruleCollectionName}/rules') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "networkManagerName": _SERIALIZER.url("network_manager_name", network_manager_name, 'str'), + "configurationName": _SERIALIZER.url("configuration_name", configuration_name, 'str'), + "ruleCollectionName": _SERIALIZER.url("rule_collection_name", rule_collection_name, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + if top is not None: + query_parameters['$top'] = _SERIALIZER.query("top", top, 'int', maximum=20, minimum=1) + if skip_token is not None: + query_parameters['$skipToken'] = _SERIALIZER.query("skip_token", skip_token, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_get_request( + subscription_id: str, + resource_group_name: str, + network_manager_name: str, + configuration_name: str, + rule_collection_name: str, + rule_name: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2021-05-01-preview" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/networkManagers/{networkManagerName}/securityAdminConfigurations/{configurationName}/ruleCollections/{ruleCollectionName}/rules/{ruleName}') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "networkManagerName": _SERIALIZER.url("network_manager_name", network_manager_name, 'str'), + "configurationName": _SERIALIZER.url("configuration_name", configuration_name, 'str'), + "ruleCollectionName": _SERIALIZER.url("rule_collection_name", rule_collection_name, 'str'), + "ruleName": _SERIALIZER.url("rule_name", rule_name, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_create_or_update_request( + subscription_id: str, + resource_group_name: str, + network_manager_name: str, + configuration_name: str, + rule_collection_name: str, + rule_name: str, + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any +) -> HttpRequest: + content_type = kwargs.pop('content_type', None) # type: Optional[str] + + api_version = "2021-05-01-preview" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/networkManagers/{networkManagerName}/securityAdminConfigurations/{configurationName}/ruleCollections/{ruleCollectionName}/rules/{ruleName}') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "networkManagerName": _SERIALIZER.url("network_manager_name", network_manager_name, 'str'), + "configurationName": _SERIALIZER.url("configuration_name", configuration_name, 'str'), + "ruleCollectionName": _SERIALIZER.url("rule_collection_name", rule_collection_name, 'str'), + "ruleName": _SERIALIZER.url("rule_name", rule_name, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + if content_type is not None: + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="PUT", + url=url, + params=query_parameters, + headers=header_parameters, + json=json, + content=content, + **kwargs + ) + + +def build_delete_request( + subscription_id: str, + resource_group_name: str, + network_manager_name: str, + configuration_name: str, + rule_collection_name: str, + rule_name: str, + *, + force: Optional[bool] = None, + **kwargs: Any +) -> HttpRequest: + api_version = "2021-05-01-preview" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/networkManagers/{networkManagerName}/securityAdminConfigurations/{configurationName}/ruleCollections/{ruleCollectionName}/rules/{ruleName}') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "networkManagerName": _SERIALIZER.url("network_manager_name", network_manager_name, 'str'), + "configurationName": _SERIALIZER.url("configuration_name", configuration_name, 'str'), + "ruleCollectionName": _SERIALIZER.url("rule_collection_name", rule_collection_name, 'str'), + "ruleName": _SERIALIZER.url("rule_name", rule_name, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + if force is not None: + query_parameters['force'] = _SERIALIZER.query("force", force, 'bool') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="DELETE", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) class AdminRulesOperations(object): """AdminRulesOperations operations. @@ -30,7 +215,7 @@ class AdminRulesOperations(object): instantiates it for you and attaches it as an attribute. :ivar models: Alias to model classes used in this operation group. - :type models: ~azure.mgmt.network.v2021_02_01_preview.models + :type models: ~azure.mgmt.network.v2021_05_01_preview.models :param client: Client for service requests. :param config: Configuration of service client. :param serializer: An object model serializer. @@ -45,24 +230,24 @@ def __init__(self, client, config, serializer, deserializer): self._deserialize = deserializer self._config = config + @distributed_trace def list( self, - resource_group_name, # type: str - network_manager_name, # type: str - configuration_name, # type: str - rule_collection_name, # type: str - top=None, # type: Optional[int] - skip_token=None, # type: Optional[str] - **kwargs # type: Any - ): - # type: (...) -> Iterable["_models.AdminRuleListResult"] + resource_group_name: str, + network_manager_name: str, + configuration_name: str, + rule_collection_name: str, + top: Optional[int] = None, + skip_token: Optional[str] = None, + **kwargs: Any + ) -> Iterable["_models.AdminRuleListResult"]: """List all network manager security configuration admin rules. :param resource_group_name: The name of the resource group. :type resource_group_name: str :param network_manager_name: The name of the network manager. :type network_manager_name: str - :param configuration_name: The name of the network manager security Configuration. + :param configuration_name: The name of the network manager Security Configuration. :type configuration_name: str :param rule_collection_name: The name of the network manager security Configuration rule collection. @@ -76,7 +261,8 @@ def list( :type skip_token: str :keyword callable cls: A custom type or function that will be passed the direct response :return: An iterator like instance of either AdminRuleListResult or the result of cls(response) - :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.network.v2021_02_01_preview.models.AdminRuleListResult] + :rtype: + ~azure.core.paging.ItemPaged[~azure.mgmt.network.v2021_05_01_preview.models.AdminRuleListResult] :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.AdminRuleListResult"] @@ -84,42 +270,41 @@ def list( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-02-01-preview" - accept = "application/json" - def prepare_request(next_link=None): - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - if not next_link: - # Construct URL - url = self.list.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'networkManagerName': self._serialize.url("network_manager_name", network_manager_name, 'str'), - 'configurationName': self._serialize.url("configuration_name", configuration_name, 'str'), - 'ruleCollectionName': self._serialize.url("rule_collection_name", rule_collection_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - if top is not None: - query_parameters['$top'] = self._serialize.query("top", top, 'int', maximum=20, minimum=1) - if skip_token is not None: - query_parameters['$skipToken'] = self._serialize.query("skip_token", skip_token, 'str') - - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + network_manager_name=network_manager_name, + configuration_name=configuration_name, + rule_collection_name=rule_collection_name, + top=top, + skip_token=skip_token, + template_url=self.list.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + network_manager_name=network_manager_name, + configuration_name=configuration_name, + rule_collection_name=rule_collection_name, + top=top, + skip_token=skip_token, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request def extract_data(pipeline_response): - deserialized = self._deserialize('AdminRuleListResult', pipeline_response) + deserialized = self._deserialize("AdminRuleListResult", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -137,28 +322,29 @@ def get_next(next_link=None): return pipeline_response + return ItemPaged( get_next, extract_data ) list.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/networkManagers/{networkManagerName}/securityAdminConfigurations/{configurationName}/ruleCollections/{ruleCollectionName}/rules'} # type: ignore + @distributed_trace def get( self, - resource_group_name, # type: str - network_manager_name, # type: str - configuration_name, # type: str - rule_collection_name, # type: str - rule_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> "_models.BaseAdminRule" + resource_group_name: str, + network_manager_name: str, + configuration_name: str, + rule_collection_name: str, + rule_name: str, + **kwargs: Any + ) -> "_models.BaseAdminRule": """Gets a network manager security configuration admin rule. :param resource_group_name: The name of the resource group. :type resource_group_name: str :param network_manager_name: The name of the network manager. :type network_manager_name: str - :param configuration_name: The name of the network manager security Configuration. + :param configuration_name: The name of the network manager Security Configuration. :type configuration_name: str :param rule_collection_name: The name of the network manager security Configuration rule collection. @@ -167,7 +353,7 @@ def get( :type rule_name: str :keyword callable cls: A custom type or function that will be passed the direct response :return: BaseAdminRule, or the result of cls(response) - :rtype: ~azure.mgmt.network.v2021_02_01_preview.models.BaseAdminRule + :rtype: ~azure.mgmt.network.v2021_05_01_preview.models.BaseAdminRule :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.BaseAdminRule"] @@ -175,30 +361,20 @@ def get( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-02-01-preview" - accept = "application/json" - - # Construct URL - url = self.get.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'networkManagerName': self._serialize.url("network_manager_name", network_manager_name, 'str'), - 'configurationName': self._serialize.url("configuration_name", configuration_name, 'str'), - 'ruleCollectionName': self._serialize.url("rule_collection_name", rule_collection_name, 'str'), - 'ruleName': self._serialize.url("rule_name", rule_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_get_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + network_manager_name=network_manager_name, + configuration_name=configuration_name, + rule_collection_name=rule_collection_name, + rule_name=rule_name, + template_url=self.get.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.get(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -212,26 +388,28 @@ def get( return cls(pipeline_response, deserialized, {}) return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/networkManagers/{networkManagerName}/securityAdminConfigurations/{configurationName}/ruleCollections/{ruleCollectionName}/rules/{ruleName}'} # type: ignore + + @distributed_trace def create_or_update( self, - resource_group_name, # type: str - network_manager_name, # type: str - configuration_name, # type: str - rule_collection_name, # type: str - rule_name, # type: str - admin_rule, # type: "_models.BaseAdminRule" - **kwargs # type: Any - ): - # type: (...) -> "_models.BaseAdminRule" + resource_group_name: str, + network_manager_name: str, + configuration_name: str, + rule_collection_name: str, + rule_name: str, + admin_rule: "_models.BaseAdminRule", + **kwargs: Any + ) -> "_models.BaseAdminRule": """Creates or updates an admin rule. :param resource_group_name: The name of the resource group. :type resource_group_name: str :param network_manager_name: The name of the network manager. :type network_manager_name: str - :param configuration_name: The name of the network manager security Configuration. + :param configuration_name: The name of the network manager Security Configuration. :type configuration_name: str :param rule_collection_name: The name of the network manager security Configuration rule collection. @@ -239,10 +417,10 @@ def create_or_update( :param rule_name: The name of the rule. :type rule_name: str :param admin_rule: The admin rule to create or update. - :type admin_rule: ~azure.mgmt.network.v2021_02_01_preview.models.BaseAdminRule + :type admin_rule: ~azure.mgmt.network.v2021_05_01_preview.models.BaseAdminRule :keyword callable cls: A custom type or function that will be passed the direct response :return: BaseAdminRule, or the result of cls(response) - :rtype: ~azure.mgmt.network.v2021_02_01_preview.models.BaseAdminRule + :rtype: ~azure.mgmt.network.v2021_05_01_preview.models.BaseAdminRule :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.BaseAdminRule"] @@ -250,35 +428,25 @@ def create_or_update( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-02-01-preview" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self.create_or_update.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'networkManagerName': self._serialize.url("network_manager_name", network_manager_name, 'str'), - 'configurationName': self._serialize.url("configuration_name", configuration_name, 'str'), - 'ruleCollectionName': self._serialize.url("rule_collection_name", rule_collection_name, 'str'), - 'ruleName': self._serialize.url("rule_name", rule_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + _json = self._serialize.body(admin_rule, 'BaseAdminRule') + + request = build_create_or_update_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + network_manager_name=network_manager_name, + configuration_name=configuration_name, + rule_collection_name=rule_collection_name, + rule_name=rule_name, + content_type=content_type, + json=_json, + template_url=self.create_or_update.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(admin_rule, 'BaseAdminRule') - body_content_kwargs['content'] = body_content - request = self._client.put(url, query_parameters, header_parameters, **body_content_kwargs) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -296,31 +464,38 @@ def create_or_update( return cls(pipeline_response, deserialized, {}) return deserialized + create_or_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/networkManagers/{networkManagerName}/securityAdminConfigurations/{configurationName}/ruleCollections/{ruleCollectionName}/rules/{ruleName}'} # type: ignore + + @distributed_trace def delete( self, - resource_group_name, # type: str - network_manager_name, # type: str - configuration_name, # type: str - rule_collection_name, # type: str - rule_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> None + resource_group_name: str, + network_manager_name: str, + configuration_name: str, + rule_collection_name: str, + rule_name: str, + force: Optional[bool] = None, + **kwargs: Any + ) -> None: """Deletes an admin rule. :param resource_group_name: The name of the resource group. :type resource_group_name: str :param network_manager_name: The name of the network manager. :type network_manager_name: str - :param configuration_name: The name of the network manager security Configuration. + :param configuration_name: The name of the network manager Security Configuration. :type configuration_name: str :param rule_collection_name: The name of the network manager security Configuration rule collection. :type rule_collection_name: str :param rule_name: The name of the rule. :type rule_name: str + :param force: Deletes the resource even if it is part of a deployed configuration. If the + configuration has been deployed, the service will do a cleanup deployment in the background, + prior to the delete. + :type force: bool :keyword callable cls: A custom type or function that will be passed the direct response :return: None, or the result of cls(response) :rtype: None @@ -331,30 +506,21 @@ def delete( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-02-01-preview" - accept = "application/json" - - # Construct URL - url = self.delete.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'networkManagerName': self._serialize.url("network_manager_name", network_manager_name, 'str'), - 'configurationName': self._serialize.url("configuration_name", configuration_name, 'str'), - 'ruleCollectionName': self._serialize.url("rule_collection_name", rule_collection_name, 'str'), - 'ruleName': self._serialize.url("rule_name", rule_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_delete_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + network_manager_name=network_manager_name, + configuration_name=configuration_name, + rule_collection_name=rule_collection_name, + rule_name=rule_name, + force=force, + template_url=self.delete.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.delete(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -366,3 +532,4 @@ def delete( return cls(pipeline_response, None, {}) delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/networkManagers/{networkManagerName}/securityAdminConfigurations/{configurationName}/ruleCollections/{ruleCollectionName}/rules/{ruleName}'} # type: ignore + diff --git a/src/network-manager/azext_network_manager/vendored_sdks/operations/_connectivity_configurations_operations.py b/src/network-manager/azext_network_manager/vendored_sdks/operations/_connectivity_configurations_operations.py index 64f3fec527a..8d6e2fa40d4 100644 --- a/src/network-manager/azext_network_manager/vendored_sdks/operations/_connectivity_configurations_operations.py +++ b/src/network-manager/azext_network_manager/vendored_sdks/operations/_connectivity_configurations_operations.py @@ -5,23 +5,192 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import TYPE_CHECKING +import functools +from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar, Union import warnings from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.paging import ItemPaged from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import HttpRequest, HttpResponse +from azure.core.pipeline.transport import HttpResponse +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace from azure.mgmt.core.exceptions import ARMErrorFormat +from msrest import Serializer from .. import models as _models - -if TYPE_CHECKING: - # pylint: disable=unused-import,ungrouped-imports - from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar, Union - - T = TypeVar('T') - ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] +from .._vendor import _convert_request, _format_url_section +T = TypeVar('T') +JSONType = Any +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] + +_SERIALIZER = Serializer() +_SERIALIZER.client_side_validation = False + +def build_get_request( + subscription_id: str, + resource_group_name: str, + network_manager_name: str, + configuration_name: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2021-05-01-preview" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/networkManagers/{networkManagerName}/connectivityConfigurations/{configurationName}') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "networkManagerName": _SERIALIZER.url("network_manager_name", network_manager_name, 'str'), + "configurationName": _SERIALIZER.url("configuration_name", configuration_name, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_create_or_update_request( + subscription_id: str, + resource_group_name: str, + network_manager_name: str, + configuration_name: str, + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any +) -> HttpRequest: + content_type = kwargs.pop('content_type', None) # type: Optional[str] + + api_version = "2021-05-01-preview" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/networkManagers/{networkManagerName}/connectivityConfigurations/{configurationName}') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "networkManagerName": _SERIALIZER.url("network_manager_name", network_manager_name, 'str'), + "configurationName": _SERIALIZER.url("configuration_name", configuration_name, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + if content_type is not None: + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="PUT", + url=url, + params=query_parameters, + headers=header_parameters, + json=json, + content=content, + **kwargs + ) + + +def build_delete_request( + subscription_id: str, + resource_group_name: str, + network_manager_name: str, + configuration_name: str, + *, + force: Optional[bool] = None, + **kwargs: Any +) -> HttpRequest: + api_version = "2021-05-01-preview" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/networkManagers/{networkManagerName}/connectivityConfigurations/{configurationName}') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "networkManagerName": _SERIALIZER.url("network_manager_name", network_manager_name, 'str'), + "configurationName": _SERIALIZER.url("configuration_name", configuration_name, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + if force is not None: + query_parameters['force'] = _SERIALIZER.query("force", force, 'bool') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="DELETE", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_list_request( + subscription_id: str, + resource_group_name: str, + network_manager_name: str, + *, + top: Optional[int] = None, + skip_token: Optional[str] = None, + **kwargs: Any +) -> HttpRequest: + api_version = "2021-05-01-preview" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/networkManagers/{networkManagerName}/connectivityConfigurations') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "networkManagerName": _SERIALIZER.url("network_manager_name", network_manager_name, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + if top is not None: + query_parameters['$top'] = _SERIALIZER.query("top", top, 'int', maximum=20, minimum=1) + if skip_token is not None: + query_parameters['$skipToken'] = _SERIALIZER.query("skip_token", skip_token, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) class ConnectivityConfigurationsOperations(object): """ConnectivityConfigurationsOperations operations. @@ -30,7 +199,7 @@ class ConnectivityConfigurationsOperations(object): instantiates it for you and attaches it as an attribute. :ivar models: Alias to model classes used in this operation group. - :type models: ~azure.mgmt.network.v2021_02_01_preview.models + :type models: ~azure.mgmt.network.v2021_05_01_preview.models :param client: Client for service requests. :param config: Configuration of service client. :param serializer: An object model serializer. @@ -45,14 +214,14 @@ def __init__(self, client, config, serializer, deserializer): self._deserialize = deserializer self._config = config + @distributed_trace def get( self, - resource_group_name, # type: str - network_manager_name, # type: str - configuration_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> "_models.ConnectivityConfiguration" + resource_group_name: str, + network_manager_name: str, + configuration_name: str, + **kwargs: Any + ) -> "_models.ConnectivityConfiguration": """Gets a Network Connectivity Configuration, specified by the resource group, network manager name, and connectivity Configuration name. @@ -64,7 +233,7 @@ def get( :type configuration_name: str :keyword callable cls: A custom type or function that will be passed the direct response :return: ConnectivityConfiguration, or the result of cls(response) - :rtype: ~azure.mgmt.network.v2021_02_01_preview.models.ConnectivityConfiguration + :rtype: ~azure.mgmt.network.v2021_05_01_preview.models.ConnectivityConfiguration :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.ConnectivityConfiguration"] @@ -72,28 +241,18 @@ def get( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-02-01-preview" - accept = "application/json" - - # Construct URL - url = self.get.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'networkManagerName': self._serialize.url("network_manager_name", network_manager_name, 'str'), - 'configurationName': self._serialize.url("configuration_name", configuration_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_get_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + network_manager_name=network_manager_name, + configuration_name=configuration_name, + template_url=self.get.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.get(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -107,17 +266,19 @@ def get( return cls(pipeline_response, deserialized, {}) return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/networkManagers/{networkManagerName}/connectivityConfigurations/{configurationName}'} # type: ignore + + @distributed_trace def create_or_update( self, - resource_group_name, # type: str - network_manager_name, # type: str - configuration_name, # type: str - connectivity_configuration, # type: "_models.ConnectivityConfiguration" - **kwargs # type: Any - ): - # type: (...) -> "_models.ConnectivityConfiguration" + resource_group_name: str, + network_manager_name: str, + configuration_name: str, + connectivity_configuration: "_models.ConnectivityConfiguration", + **kwargs: Any + ) -> "_models.ConnectivityConfiguration": """Creates/Updates a new network manager connectivity configuration. :param resource_group_name: The name of the resource group. @@ -128,10 +289,11 @@ def create_or_update( :type configuration_name: str :param connectivity_configuration: Parameters supplied to create/update a network manager connectivity configuration. - :type connectivity_configuration: ~azure.mgmt.network.v2021_02_01_preview.models.ConnectivityConfiguration + :type connectivity_configuration: + ~azure.mgmt.network.v2021_05_01_preview.models.ConnectivityConfiguration :keyword callable cls: A custom type or function that will be passed the direct response :return: ConnectivityConfiguration, or the result of cls(response) - :rtype: ~azure.mgmt.network.v2021_02_01_preview.models.ConnectivityConfiguration + :rtype: ~azure.mgmt.network.v2021_05_01_preview.models.ConnectivityConfiguration :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.ConnectivityConfiguration"] @@ -139,33 +301,23 @@ def create_or_update( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-02-01-preview" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self.create_or_update.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'networkManagerName': self._serialize.url("network_manager_name", network_manager_name, 'str'), - 'configurationName': self._serialize.url("configuration_name", configuration_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + _json = self._serialize.body(connectivity_configuration, 'ConnectivityConfiguration') + + request = build_create_or_update_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + network_manager_name=network_manager_name, + configuration_name=configuration_name, + content_type=content_type, + json=_json, + template_url=self.create_or_update.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(connectivity_configuration, 'ConnectivityConfiguration') - body_content_kwargs['content'] = body_content - request = self._client.put(url, query_parameters, header_parameters, **body_content_kwargs) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -183,16 +335,19 @@ def create_or_update( return cls(pipeline_response, deserialized, {}) return deserialized + create_or_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/networkManagers/{networkManagerName}/connectivityConfigurations/{configurationName}'} # type: ignore + + @distributed_trace def delete( self, - resource_group_name, # type: str - network_manager_name, # type: str - configuration_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> None + resource_group_name: str, + network_manager_name: str, + configuration_name: str, + force: Optional[bool] = None, + **kwargs: Any + ) -> None: """Deletes a network manager connectivity configuration, specified by the resource group, network manager name, and connectivity configuration name. @@ -202,6 +357,10 @@ def delete( :type network_manager_name: str :param configuration_name: The name of the network manager connectivity configuration. :type configuration_name: str + :param force: Deletes the resource even if it is part of a deployed configuration. If the + configuration has been deployed, the service will do a cleanup deployment in the background, + prior to the delete. + :type force: bool :keyword callable cls: A custom type or function that will be passed the direct response :return: None, or the result of cls(response) :rtype: None @@ -212,28 +371,19 @@ def delete( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-02-01-preview" - accept = "application/json" - - # Construct URL - url = self.delete.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'networkManagerName': self._serialize.url("network_manager_name", network_manager_name, 'str'), - 'configurationName': self._serialize.url("configuration_name", configuration_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_delete_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + network_manager_name=network_manager_name, + configuration_name=configuration_name, + force=force, + template_url=self.delete.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.delete(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -246,15 +396,16 @@ def delete( delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/networkManagers/{networkManagerName}/connectivityConfigurations/{configurationName}'} # type: ignore + + @distributed_trace def list( self, - resource_group_name, # type: str - network_manager_name, # type: str - top=None, # type: Optional[int] - skip_token=None, # type: Optional[str] - **kwargs # type: Any - ): - # type: (...) -> Iterable["_models.ConnectivityConfigurationListResult"] + resource_group_name: str, + network_manager_name: str, + top: Optional[int] = None, + skip_token: Optional[str] = None, + **kwargs: Any + ) -> Iterable["_models.ConnectivityConfigurationListResult"]: """Lists all the network manager connectivity configuration in a specified network manager. :param resource_group_name: The name of the resource group. @@ -269,8 +420,10 @@ def list( a skipToken parameter that specifies a starting point to use for subsequent calls. :type skip_token: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either ConnectivityConfigurationListResult or the result of cls(response) - :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.network.v2021_02_01_preview.models.ConnectivityConfigurationListResult] + :return: An iterator like instance of either ConnectivityConfigurationListResult or the result + of cls(response) + :rtype: + ~azure.core.paging.ItemPaged[~azure.mgmt.network.v2021_05_01_preview.models.ConnectivityConfigurationListResult] :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.ConnectivityConfigurationListResult"] @@ -278,40 +431,37 @@ def list( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-02-01-preview" - accept = "application/json" - def prepare_request(next_link=None): - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - if not next_link: - # Construct URL - url = self.list.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'networkManagerName': self._serialize.url("network_manager_name", network_manager_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - if top is not None: - query_parameters['$top'] = self._serialize.query("top", top, 'int', maximum=20, minimum=1) - if skip_token is not None: - query_parameters['$skipToken'] = self._serialize.query("skip_token", skip_token, 'str') - - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + network_manager_name=network_manager_name, + top=top, + skip_token=skip_token, + template_url=self.list.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + network_manager_name=network_manager_name, + top=top, + skip_token=skip_token, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request def extract_data(pipeline_response): - deserialized = self._deserialize('ConnectivityConfigurationListResult', pipeline_response) + deserialized = self._deserialize("ConnectivityConfigurationListResult", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -329,6 +479,7 @@ def get_next(next_link=None): return pipeline_response + return ItemPaged( get_next, extract_data ) diff --git a/src/network-manager/azext_network_manager/vendored_sdks/operations/_effective_connectivity_configurations_operations.py b/src/network-manager/azext_network_manager/vendored_sdks/operations/_effective_connectivity_configurations_operations.py deleted file mode 100644 index df94773153e..00000000000 --- a/src/network-manager/azext_network_manager/vendored_sdks/operations/_effective_connectivity_configurations_operations.py +++ /dev/null @@ -1,112 +0,0 @@ -# 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 typing import TYPE_CHECKING -import warnings - -from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error -from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import HttpRequest, HttpResponse -from azure.mgmt.core.exceptions import ARMErrorFormat - -from .. import models as _models - -if TYPE_CHECKING: - # pylint: disable=unused-import,ungrouped-imports - from typing import Any, Callable, Dict, Generic, Optional, TypeVar - - T = TypeVar('T') - ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] - -class EffectiveConnectivityConfigurationsOperations(object): - """EffectiveConnectivityConfigurationsOperations operations. - - You should not instantiate this class directly. Instead, you should create a Client instance that - instantiates it for you and attaches it as an attribute. - - :ivar models: Alias to model classes used in this operation group. - :type models: ~azure.mgmt.network.v2021_02_01_preview.models - :param client: Client for service requests. - :param config: Configuration of service client. - :param serializer: An object model serializer. - :param deserializer: An object model deserializer. - """ - - models = _models - - def __init__(self, client, config, serializer, deserializer): - self._client = client - self._serialize = serializer - self._deserialize = deserializer - self._config = config - - def list( - self, - resource_group_name, # type: str - virtual_network_name, # type: str - parameters, # type: "_models.QueryRequestOptions" - **kwargs # type: Any - ): - # type: (...) -> "_models.NetworkManagerEffectiveConnectivityConfigurationListResult" - """List all effective connectivity configurations applied on a virtual network. - - :param resource_group_name: The name of the resource group. - :type resource_group_name: str - :param virtual_network_name: The name of the virtual network. - :type virtual_network_name: str - :param parameters: Parameters supplied to list correct page. - :type parameters: ~azure.mgmt.network.v2021_02_01_preview.models.QueryRequestOptions - :keyword callable cls: A custom type or function that will be passed the direct response - :return: NetworkManagerEffectiveConnectivityConfigurationListResult, or the result of cls(response) - :rtype: ~azure.mgmt.network.v2021_02_01_preview.models.NetworkManagerEffectiveConnectivityConfigurationListResult - :raises: ~azure.core.exceptions.HttpResponseError - """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.NetworkManagerEffectiveConnectivityConfigurationListResult"] - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-02-01-preview" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self.list.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'virtualNetworkName': self._serialize.url("virtual_network_name", virtual_network_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(parameters, 'QueryRequestOptions') - body_content_kwargs['content'] = body_content - request = self._client.post(url, query_parameters, header_parameters, **body_content_kwargs) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - deserialized = self._deserialize('NetworkManagerEffectiveConnectivityConfigurationListResult', pipeline_response) - - if cls: - return cls(pipeline_response, deserialized, {}) - - return deserialized - list.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/virtualNetworks/{virtualNetworkName}/listNetworkManagerEffectiveConnectivityConfigurations'} # type: ignore diff --git a/src/network-manager/azext_network_manager/vendored_sdks/operations/_effective_virtual_networks_operations.py b/src/network-manager/azext_network_manager/vendored_sdks/operations/_effective_virtual_networks_operations.py index 6d438d76538..bc9453ca407 100644 --- a/src/network-manager/azext_network_manager/vendored_sdks/operations/_effective_virtual_networks_operations.py +++ b/src/network-manager/azext_network_manager/vendored_sdks/operations/_effective_virtual_networks_operations.py @@ -5,22 +5,75 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import TYPE_CHECKING +import functools +from typing import Any, Callable, Dict, Generic, Optional, TypeVar import warnings from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import HttpRequest, HttpResponse +from azure.core.pipeline.transport import HttpResponse +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace from azure.mgmt.core.exceptions import ARMErrorFormat +from msrest import Serializer from .. import models as _models - -if TYPE_CHECKING: - # pylint: disable=unused-import,ungrouped-imports - from typing import Any, Callable, Dict, Generic, Optional, TypeVar - - T = TypeVar('T') - ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] +from .._vendor import _convert_request, _format_url_section +T = TypeVar('T') +JSONType = Any +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] + +_SERIALIZER = Serializer() +_SERIALIZER.client_side_validation = False + +def build_list_by_network_manager_request( + subscription_id: str, + resource_group_name: str, + network_manager_name: str, + *, + json: JSONType = None, + content: Any = None, + top: Optional[int] = None, + skip_token: Optional[str] = None, + **kwargs: Any +) -> HttpRequest: + content_type = kwargs.pop('content_type', None) # type: Optional[str] + + api_version = "2021-05-01-preview" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/networkManagers/{networkManagerName}/listEffectiveVirtualNetworks') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "networkManagerName": _SERIALIZER.url("network_manager_name", network_manager_name, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + if top is not None: + query_parameters['$top'] = _SERIALIZER.query("top", top, 'int', maximum=20, minimum=1) + if skip_token is not None: + query_parameters['$skipToken'] = _SERIALIZER.query("skip_token", skip_token, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + if content_type is not None: + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="POST", + url=url, + params=query_parameters, + headers=header_parameters, + json=json, + content=content, + **kwargs + ) class EffectiveVirtualNetworksOperations(object): """EffectiveVirtualNetworksOperations operations. @@ -29,7 +82,7 @@ class EffectiveVirtualNetworksOperations(object): instantiates it for you and attaches it as an attribute. :ivar models: Alias to model classes used in this operation group. - :type models: ~azure.mgmt.network.v2021_02_01_preview.models + :type models: ~azure.mgmt.network.v2021_05_01_preview.models :param client: Client for service requests. :param config: Configuration of service client. :param serializer: An object model serializer. @@ -44,16 +97,16 @@ def __init__(self, client, config, serializer, deserializer): self._deserialize = deserializer self._config = config + @distributed_trace def list_by_network_manager( self, - resource_group_name, # type: str - network_manager_name, # type: str - parameters, # type: "_models.EffectiveVirtualNetworksParameter" - top=None, # type: Optional[int] - skip_token=None, # type: Optional[str] - **kwargs # type: Any - ): - # type: (...) -> "_models.EffectiveVirtualNetworksListResult" + resource_group_name: str, + network_manager_name: str, + parameters: "_models.EffectiveVirtualNetworksParameter", + top: Optional[int] = None, + skip_token: Optional[str] = None, + **kwargs: Any + ) -> "_models.EffectiveVirtualNetworksListResult": """List effective virtual networks in a network manager. :param resource_group_name: The name of the resource group. @@ -61,7 +114,8 @@ def list_by_network_manager( :param network_manager_name: The name of the network manager. :type network_manager_name: str :param parameters: Effective Virtual Networks Parameter. - :type parameters: ~azure.mgmt.network.v2021_02_01_preview.models.EffectiveVirtualNetworksParameter + :type parameters: + ~azure.mgmt.network.v2021_05_01_preview.models.EffectiveVirtualNetworksParameter :param top: An optional query parameter which specifies the maximum number of records to be returned by the server. :type top: int @@ -71,7 +125,7 @@ def list_by_network_manager( :type skip_token: str :keyword callable cls: A custom type or function that will be passed the direct response :return: EffectiveVirtualNetworksListResult, or the result of cls(response) - :rtype: ~azure.mgmt.network.v2021_02_01_preview.models.EffectiveVirtualNetworksListResult + :rtype: ~azure.mgmt.network.v2021_05_01_preview.models.EffectiveVirtualNetworksListResult :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.EffectiveVirtualNetworksListResult"] @@ -79,107 +133,24 @@ def list_by_network_manager( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-02-01-preview" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self.list_by_network_manager.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'networkManagerName': self._serialize.url("network_manager_name", network_manager_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - if top is not None: - query_parameters['$top'] = self._serialize.query("top", top, 'int', maximum=20, minimum=1) - if skip_token is not None: - query_parameters['$skipToken'] = self._serialize.query("skip_token", skip_token, 'str') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(parameters, 'EffectiveVirtualNetworksParameter') - body_content_kwargs['content'] = body_content - request = self._client.post(url, query_parameters, header_parameters, **body_content_kwargs) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - deserialized = self._deserialize('EffectiveVirtualNetworksListResult', pipeline_response) - - if cls: - return cls(pipeline_response, deserialized, {}) - - return deserialized - list_by_network_manager.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/networkManagers/{networkManagerName}/listEffectiveVirtualNetworks'} # type: ignore - - def list_by_network_group( - self, - resource_group_name, # type: str - network_manager_name, # type: str - network_group_name, # type: str - parameters, # type: "_models.QueryRequestOptions" - **kwargs # type: Any - ): - # type: (...) -> "_models.EffectiveVirtualNetworksListResult" - """Lists all effective virtual networks by specified network group. - :param resource_group_name: The name of the resource group. - :type resource_group_name: str - :param network_manager_name: The name of the network manager. - :type network_manager_name: str - :param network_group_name: The name of the network group to get. - :type network_group_name: str - :param parameters: Parameters supplied to list correct page. - :type parameters: ~azure.mgmt.network.v2021_02_01_preview.models.QueryRequestOptions - :keyword callable cls: A custom type or function that will be passed the direct response - :return: EffectiveVirtualNetworksListResult, or the result of cls(response) - :rtype: ~azure.mgmt.network.v2021_02_01_preview.models.EffectiveVirtualNetworksListResult - :raises: ~azure.core.exceptions.HttpResponseError - """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.EffectiveVirtualNetworksListResult"] - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-02-01-preview" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self.list_by_network_group.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'networkManagerName': self._serialize.url("network_manager_name", network_manager_name, 'str'), - 'networkGroupName': self._serialize.url("network_group_name", network_group_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + _json = self._serialize.body(parameters, 'EffectiveVirtualNetworksParameter') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + request = build_list_by_network_manager_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + network_manager_name=network_manager_name, + content_type=content_type, + json=_json, + top=top, + skip_token=skip_token, + template_url=self.list_by_network_manager.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(parameters, 'QueryRequestOptions') - body_content_kwargs['content'] = body_content - request = self._client.post(url, query_parameters, header_parameters, **body_content_kwargs) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -193,4 +164,6 @@ def list_by_network_group( return cls(pipeline_response, deserialized, {}) return deserialized - list_by_network_group.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/networkManagers/{networkManagerName}/networkGroups/{networkGroupName}/listEffectiveVirtualNetworks'} # type: ignore + + list_by_network_manager.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/networkManagers/{networkManagerName}/listEffectiveVirtualNetworks'} # type: ignore + diff --git a/src/network-manager/azext_network_manager/vendored_sdks/operations/_list_effective_virtual_networks_operations.py b/src/network-manager/azext_network_manager/vendored_sdks/operations/_list_effective_virtual_networks_operations.py new file mode 100644 index 00000000000..317a35db749 --- /dev/null +++ b/src/network-manager/azext_network_manager/vendored_sdks/operations/_list_effective_virtual_networks_operations.py @@ -0,0 +1,157 @@ +# 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 functools +from typing import Any, Callable, Dict, Generic, Optional, TypeVar +import warnings + +from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +from azure.core.pipeline import PipelineResponse +from azure.core.pipeline.transport import HttpResponse +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace +from azure.mgmt.core.exceptions import ARMErrorFormat +from msrest import Serializer + +from .. import models as _models +from .._vendor import _convert_request, _format_url_section +T = TypeVar('T') +JSONType = Any +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] + +_SERIALIZER = Serializer() +_SERIALIZER.client_side_validation = False + +def build_by_network_group_request( + subscription_id: str, + resource_group_name: str, + network_manager_name: str, + network_group_name: str, + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any +) -> HttpRequest: + content_type = kwargs.pop('content_type', None) # type: Optional[str] + + api_version = "2021-05-01-preview" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/networkManagers/{networkManagerName}/networkGroups/{networkGroupName}/listEffectiveVirtualNetworks') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "networkManagerName": _SERIALIZER.url("network_manager_name", network_manager_name, 'str'), + "networkGroupName": _SERIALIZER.url("network_group_name", network_group_name, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + if content_type is not None: + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="POST", + url=url, + params=query_parameters, + headers=header_parameters, + json=json, + content=content, + **kwargs + ) + +class ListEffectiveVirtualNetworksOperations(object): + """ListEffectiveVirtualNetworksOperations operations. + + You should not instantiate this class directly. Instead, you should create a Client instance that + instantiates it for you and attaches it as an attribute. + + :ivar models: Alias to model classes used in this operation group. + :type models: ~azure.mgmt.network.v2021_05_01_preview.models + :param client: Client for service requests. + :param config: Configuration of service client. + :param serializer: An object model serializer. + :param deserializer: An object model deserializer. + """ + + models = _models + + def __init__(self, client, config, serializer, deserializer): + self._client = client + self._serialize = serializer + self._deserialize = deserializer + self._config = config + + @distributed_trace + def by_network_group( + self, + resource_group_name: str, + network_manager_name: str, + network_group_name: str, + parameters: "_models.QueryRequestOptions", + **kwargs: Any + ) -> "_models.EffectiveVirtualNetworksListResult": + """Lists all effective virtual networks by specified network group. + + :param resource_group_name: The name of the resource group. + :type resource_group_name: str + :param network_manager_name: The name of the network manager. + :type network_manager_name: str + :param network_group_name: The name of the network group. + :type network_group_name: str + :param parameters: Parameters supplied to list correct page. + :type parameters: ~azure.mgmt.network.v2021_05_01_preview.models.QueryRequestOptions + :keyword callable cls: A custom type or function that will be passed the direct response + :return: EffectiveVirtualNetworksListResult, or the result of cls(response) + :rtype: ~azure.mgmt.network.v2021_05_01_preview.models.EffectiveVirtualNetworksListResult + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.EffectiveVirtualNetworksListResult"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + + _json = self._serialize.body(parameters, 'QueryRequestOptions') + + request = build_by_network_group_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + network_manager_name=network_manager_name, + network_group_name=network_group_name, + content_type=content_type, + json=_json, + template_url=self.by_network_group.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = self._deserialize('EffectiveVirtualNetworksListResult', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + by_network_group.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/networkManagers/{networkManagerName}/networkGroups/{networkGroupName}/listEffectiveVirtualNetworks'} # type: ignore + diff --git a/src/network-manager/azext_network_manager/vendored_sdks/operations/_management_group_network_manager_connections_operations.py b/src/network-manager/azext_network_manager/vendored_sdks/operations/_management_group_network_manager_connections_operations.py new file mode 100644 index 00000000000..9709ef84700 --- /dev/null +++ b/src/network-manager/azext_network_manager/vendored_sdks/operations/_management_group_network_manager_connections_operations.py @@ -0,0 +1,438 @@ +# 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 functools +from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar, Union +import warnings + +from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +from azure.core.paging import ItemPaged +from azure.core.pipeline import PipelineResponse +from azure.core.pipeline.transport import HttpResponse +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace +from azure.mgmt.core.exceptions import ARMErrorFormat +from msrest import Serializer + +from .. import models as _models +from .._vendor import _convert_request, _format_url_section +T = TypeVar('T') +JSONType = Any +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] + +_SERIALIZER = Serializer() +_SERIALIZER.client_side_validation = False + +def build_create_or_update_request( + management_group_id: str, + network_manager_connection_name: str, + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any +) -> HttpRequest: + content_type = kwargs.pop('content_type', None) # type: Optional[str] + + api_version = "2021-05-01-preview" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/providers/Microsoft.Network/managementGroups/{managementGroupId}/networkManagerConnections/{networkManagerConnectionName}') + path_format_arguments = { + "managementGroupId": _SERIALIZER.url("management_group_id", management_group_id, 'str'), + "networkManagerConnectionName": _SERIALIZER.url("network_manager_connection_name", network_manager_connection_name, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + if content_type is not None: + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="PUT", + url=url, + params=query_parameters, + headers=header_parameters, + json=json, + content=content, + **kwargs + ) + + +def build_get_request( + management_group_id: str, + network_manager_connection_name: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2021-05-01-preview" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/providers/Microsoft.Network/managementGroups/{managementGroupId}/networkManagerConnections/{networkManagerConnectionName}') + path_format_arguments = { + "managementGroupId": _SERIALIZER.url("management_group_id", management_group_id, 'str'), + "networkManagerConnectionName": _SERIALIZER.url("network_manager_connection_name", network_manager_connection_name, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_delete_request( + management_group_id: str, + network_manager_connection_name: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2021-05-01-preview" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/providers/Microsoft.Network/managementGroups/{managementGroupId}/networkManagerConnections/{networkManagerConnectionName}') + path_format_arguments = { + "managementGroupId": _SERIALIZER.url("management_group_id", management_group_id, 'str'), + "networkManagerConnectionName": _SERIALIZER.url("network_manager_connection_name", network_manager_connection_name, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="DELETE", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_list_request( + management_group_id: str, + *, + top: Optional[int] = None, + skip_token: Optional[str] = None, + **kwargs: Any +) -> HttpRequest: + api_version = "2021-05-01-preview" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/providers/Microsoft.Network/managementGroups/{managementGroupId}/networkManagerConnections') + path_format_arguments = { + "managementGroupId": _SERIALIZER.url("management_group_id", management_group_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + if top is not None: + query_parameters['$top'] = _SERIALIZER.query("top", top, 'int', maximum=20, minimum=1) + if skip_token is not None: + query_parameters['$skipToken'] = _SERIALIZER.query("skip_token", skip_token, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + +class ManagementGroupNetworkManagerConnectionsOperations(object): + """ManagementGroupNetworkManagerConnectionsOperations operations. + + You should not instantiate this class directly. Instead, you should create a Client instance that + instantiates it for you and attaches it as an attribute. + + :ivar models: Alias to model classes used in this operation group. + :type models: ~azure.mgmt.network.v2021_05_01_preview.models + :param client: Client for service requests. + :param config: Configuration of service client. + :param serializer: An object model serializer. + :param deserializer: An object model deserializer. + """ + + models = _models + + def __init__(self, client, config, serializer, deserializer): + self._client = client + self._serialize = serializer + self._deserialize = deserializer + self._config = config + + @distributed_trace + def create_or_update( + self, + management_group_id: str, + network_manager_connection_name: str, + parameters: "_models.NetworkManagerConnection", + **kwargs: Any + ) -> "_models.NetworkManagerConnection": + """Create a connection to a cross tenant network manager. + + :param management_group_id: The management group Id which uniquely identify the Microsoft Azure + management group. + :type management_group_id: str + :param network_manager_connection_name: Name for the network manager connection. + :type network_manager_connection_name: str + :param parameters: Network manager connection to be created/updated. + :type parameters: ~azure.mgmt.network.v2021_05_01_preview.models.NetworkManagerConnection + :keyword callable cls: A custom type or function that will be passed the direct response + :return: NetworkManagerConnection, or the result of cls(response) + :rtype: ~azure.mgmt.network.v2021_05_01_preview.models.NetworkManagerConnection + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.NetworkManagerConnection"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + + _json = self._serialize.body(parameters, 'NetworkManagerConnection') + + request = build_create_or_update_request( + management_group_id=management_group_id, + network_manager_connection_name=network_manager_connection_name, + content_type=content_type, + json=_json, + template_url=self.create_or_update.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200, 201]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + if response.status_code == 200: + deserialized = self._deserialize('NetworkManagerConnection', pipeline_response) + + if response.status_code == 201: + deserialized = self._deserialize('NetworkManagerConnection', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + create_or_update.metadata = {'url': '/providers/Microsoft.Network/managementGroups/{managementGroupId}/networkManagerConnections/{networkManagerConnectionName}'} # type: ignore + + + @distributed_trace + def get( + self, + management_group_id: str, + network_manager_connection_name: str, + **kwargs: Any + ) -> "_models.NetworkManagerConnection": + """Get a specified connection created by this management group. + + :param management_group_id: The management group Id which uniquely identify the Microsoft Azure + management group. + :type management_group_id: str + :param network_manager_connection_name: Name for the network manager connection. + :type network_manager_connection_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: NetworkManagerConnection, or the result of cls(response) + :rtype: ~azure.mgmt.network.v2021_05_01_preview.models.NetworkManagerConnection + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.NetworkManagerConnection"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + + request = build_get_request( + management_group_id=management_group_id, + network_manager_connection_name=network_manager_connection_name, + template_url=self.get.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = self._deserialize('NetworkManagerConnection', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + get.metadata = {'url': '/providers/Microsoft.Network/managementGroups/{managementGroupId}/networkManagerConnections/{networkManagerConnectionName}'} # type: ignore + + + @distributed_trace + def delete( + self, + management_group_id: str, + network_manager_connection_name: str, + **kwargs: Any + ) -> None: + """Delete specified pending connection created by this management group. + + :param management_group_id: The management group Id which uniquely identify the Microsoft Azure + management group. + :type management_group_id: str + :param network_manager_connection_name: Name for the network manager connection. + :type network_manager_connection_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: None, or the result of cls(response) + :rtype: None + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + + request = build_delete_request( + management_group_id=management_group_id, + network_manager_connection_name=network_manager_connection_name, + template_url=self.delete.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200, 204]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + if cls: + return cls(pipeline_response, None, {}) + + delete.metadata = {'url': '/providers/Microsoft.Network/managementGroups/{managementGroupId}/networkManagerConnections/{networkManagerConnectionName}'} # type: ignore + + + @distributed_trace + def list( + self, + management_group_id: str, + top: Optional[int] = None, + skip_token: Optional[str] = None, + **kwargs: Any + ) -> Iterable["_models.NetworkManagerConnectionListResult"]: + """List all network manager connections created by this management group. + + :param management_group_id: The management group Id which uniquely identify the Microsoft Azure + management group. + :type management_group_id: str + :param top: An optional query parameter which specifies the maximum number of records to be + returned by the server. + :type top: int + :param skip_token: SkipToken is only used if a previous operation returned a partial result. If + a previous response contains a nextLink element, the value of the nextLink element will include + a skipToken parameter that specifies a starting point to use for subsequent calls. + :type skip_token: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either NetworkManagerConnectionListResult or the result + of cls(response) + :rtype: + ~azure.core.paging.ItemPaged[~azure.mgmt.network.v2021_05_01_preview.models.NetworkManagerConnectionListResult] + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.NetworkManagerConnectionListResult"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + def prepare_request(next_link=None): + if not next_link: + + request = build_list_request( + management_group_id=management_group_id, + top=top, + skip_token=skip_token, + template_url=self.list.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + else: + + request = build_list_request( + management_group_id=management_group_id, + top=top, + skip_token=skip_token, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" + return request + + def extract_data(pipeline_response): + deserialized = self._deserialize("NetworkManagerConnectionListResult", pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) + return deserialized.next_link or None, iter(list_of_elem) + + def get_next(next_link=None): + request = prepare_request(next_link) + + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + return pipeline_response + + + return ItemPaged( + get_next, extract_data + ) + list.metadata = {'url': '/providers/Microsoft.Network/managementGroups/{managementGroupId}/networkManagerConnections'} # type: ignore diff --git a/src/network-manager/azext_network_manager/vendored_sdks/operations/_network_groups_operations.py b/src/network-manager/azext_network_manager/vendored_sdks/operations/_network_groups_operations.py index 7a079d7d3a6..3a323e3ba2c 100644 --- a/src/network-manager/azext_network_manager/vendored_sdks/operations/_network_groups_operations.py +++ b/src/network-manager/azext_network_manager/vendored_sdks/operations/_network_groups_operations.py @@ -5,23 +5,195 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import TYPE_CHECKING +import functools +from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar, Union import warnings from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.paging import ItemPaged from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import HttpRequest, HttpResponse +from azure.core.pipeline.transport import HttpResponse +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace from azure.mgmt.core.exceptions import ARMErrorFormat +from msrest import Serializer from .. import models as _models - -if TYPE_CHECKING: - # pylint: disable=unused-import,ungrouped-imports - from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar, Union - - T = TypeVar('T') - ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] +from .._vendor import _convert_request, _format_url_section +T = TypeVar('T') +JSONType = Any +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] + +_SERIALIZER = Serializer() +_SERIALIZER.client_side_validation = False + +def build_get_request( + subscription_id: str, + resource_group_name: str, + network_manager_name: str, + network_group_name: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2021-05-01-preview" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/networkManagers/{networkManagerName}/networkGroups/{networkGroupName}') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "networkManagerName": _SERIALIZER.url("network_manager_name", network_manager_name, 'str'), + "networkGroupName": _SERIALIZER.url("network_group_name", network_group_name, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_create_or_update_request( + subscription_id: str, + resource_group_name: str, + network_manager_name: str, + network_group_name: str, + *, + json: JSONType = None, + content: Any = None, + if_match: Optional[str] = None, + **kwargs: Any +) -> HttpRequest: + content_type = kwargs.pop('content_type', None) # type: Optional[str] + + api_version = "2021-05-01-preview" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/networkManagers/{networkManagerName}/networkGroups/{networkGroupName}') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "networkManagerName": _SERIALIZER.url("network_manager_name", network_manager_name, 'str'), + "networkGroupName": _SERIALIZER.url("network_group_name", network_group_name, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + if if_match is not None: + header_parameters['If-Match'] = _SERIALIZER.header("if_match", if_match, 'str') + if content_type is not None: + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="PUT", + url=url, + params=query_parameters, + headers=header_parameters, + json=json, + content=content, + **kwargs + ) + + +def build_delete_request( + subscription_id: str, + resource_group_name: str, + network_manager_name: str, + network_group_name: str, + *, + force: Optional[bool] = None, + **kwargs: Any +) -> HttpRequest: + api_version = "2021-05-01-preview" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/networkManagers/{networkManagerName}/networkGroups/{networkGroupName}') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "networkManagerName": _SERIALIZER.url("network_manager_name", network_manager_name, 'str'), + "networkGroupName": _SERIALIZER.url("network_group_name", network_group_name, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + if force is not None: + query_parameters['force'] = _SERIALIZER.query("force", force, 'bool') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="DELETE", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_list_request( + subscription_id: str, + resource_group_name: str, + network_manager_name: str, + *, + top: Optional[int] = None, + skip_token: Optional[str] = None, + **kwargs: Any +) -> HttpRequest: + api_version = "2021-05-01-preview" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/networkManagers/{networkManagerName}/networkGroups') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "networkManagerName": _SERIALIZER.url("network_manager_name", network_manager_name, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + if top is not None: + query_parameters['$top'] = _SERIALIZER.query("top", top, 'int', maximum=20, minimum=1) + if skip_token is not None: + query_parameters['$skipToken'] = _SERIALIZER.query("skip_token", skip_token, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) class NetworkGroupsOperations(object): """NetworkGroupsOperations operations. @@ -30,7 +202,7 @@ class NetworkGroupsOperations(object): instantiates it for you and attaches it as an attribute. :ivar models: Alias to model classes used in this operation group. - :type models: ~azure.mgmt.network.v2021_02_01_preview.models + :type models: ~azure.mgmt.network.v2021_05_01_preview.models :param client: Client for service requests. :param config: Configuration of service client. :param serializer: An object model serializer. @@ -45,25 +217,25 @@ def __init__(self, client, config, serializer, deserializer): self._deserialize = deserializer self._config = config + @distributed_trace def get( self, - resource_group_name, # type: str - network_manager_name, # type: str - network_group_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> "_models.NetworkGroup" + resource_group_name: str, + network_manager_name: str, + network_group_name: str, + **kwargs: Any + ) -> "_models.NetworkGroup": """Gets the specified network group. :param resource_group_name: The name of the resource group. :type resource_group_name: str :param network_manager_name: The name of the network manager. :type network_manager_name: str - :param network_group_name: The name of the network group to get. + :param network_group_name: The name of the network group. :type network_group_name: str :keyword callable cls: A custom type or function that will be passed the direct response :return: NetworkGroup, or the result of cls(response) - :rtype: ~azure.mgmt.network.v2021_02_01_preview.models.NetworkGroup + :rtype: ~azure.mgmt.network.v2021_05_01_preview.models.NetworkGroup :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.NetworkGroup"] @@ -71,28 +243,18 @@ def get( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-02-01-preview" - accept = "application/json" - - # Construct URL - url = self.get.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'networkManagerName': self._serialize.url("network_manager_name", network_manager_name, 'str'), - 'networkGroupName': self._serialize.url("network_group_name", network_group_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_get_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + network_manager_name=network_manager_name, + network_group_name=network_group_name, + template_url=self.get.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.get(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -106,35 +268,37 @@ def get( return cls(pipeline_response, deserialized, {}) return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/networkManagers/{networkManagerName}/networkGroups/{networkGroupName}'} # type: ignore + + @distributed_trace def create_or_update( self, - resource_group_name, # type: str - network_manager_name, # type: str - network_group_name, # type: str - parameters, # type: "_models.NetworkGroup" - if_match=None, # type: Optional[str] - **kwargs # type: Any - ): - # type: (...) -> "_models.NetworkGroup" + resource_group_name: str, + network_manager_name: str, + network_group_name: str, + parameters: "_models.NetworkGroup", + if_match: Optional[str] = None, + **kwargs: Any + ) -> "_models.NetworkGroup": """Creates or updates a network group. :param resource_group_name: The name of the resource group. :type resource_group_name: str :param network_manager_name: The name of the network manager. :type network_manager_name: str - :param network_group_name: The name of the network group to get. + :param network_group_name: The name of the network group. :type network_group_name: str :param parameters: Parameters supplied to the specify which network group need to create. - :type parameters: ~azure.mgmt.network.v2021_02_01_preview.models.NetworkGroup + :type parameters: ~azure.mgmt.network.v2021_05_01_preview.models.NetworkGroup :param if_match: The ETag of the transformation. Omit this value to always overwrite the current resource. Specify the last-seen ETag value to prevent accidentally overwriting concurrent changes. :type if_match: str :keyword callable cls: A custom type or function that will be passed the direct response :return: NetworkGroup, or the result of cls(response) - :rtype: ~azure.mgmt.network.v2021_02_01_preview.models.NetworkGroup + :rtype: ~azure.mgmt.network.v2021_05_01_preview.models.NetworkGroup :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.NetworkGroup"] @@ -142,35 +306,24 @@ def create_or_update( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-02-01-preview" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self.create_or_update.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'networkManagerName': self._serialize.url("network_manager_name", network_manager_name, 'str'), - 'networkGroupName': self._serialize.url("network_group_name", network_group_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - if if_match is not None: - header_parameters['If-Match'] = self._serialize.header("if_match", if_match, 'str') - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(parameters, 'NetworkGroup') - body_content_kwargs['content'] = body_content - request = self._client.put(url, query_parameters, header_parameters, **body_content_kwargs) + + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + + _json = self._serialize.body(parameters, 'NetworkGroup') + + request = build_create_or_update_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + network_manager_name=network_manager_name, + network_group_name=network_group_name, + content_type=content_type, + json=_json, + if_match=if_match, + template_url=self.create_or_update.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -181,34 +334,43 @@ def create_or_update( response_headers = {} if response.status_code == 200: response_headers['ETag']=self._deserialize('str', response.headers.get('ETag')) + deserialized = self._deserialize('NetworkGroup', pipeline_response) if response.status_code == 201: response_headers['ETag']=self._deserialize('str', response.headers.get('ETag')) + deserialized = self._deserialize('NetworkGroup', pipeline_response) if cls: return cls(pipeline_response, deserialized, response_headers) return deserialized + create_or_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/networkManagers/{networkManagerName}/networkGroups/{networkGroupName}'} # type: ignore + + @distributed_trace def delete( self, - resource_group_name, # type: str - network_manager_name, # type: str - network_group_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> None + resource_group_name: str, + network_manager_name: str, + network_group_name: str, + force: Optional[bool] = None, + **kwargs: Any + ) -> None: """Deletes a network group. :param resource_group_name: The name of the resource group. :type resource_group_name: str :param network_manager_name: The name of the network manager. :type network_manager_name: str - :param network_group_name: The name of the network group to get. + :param network_group_name: The name of the network group. :type network_group_name: str + :param force: Deletes the resource even if it is part of a deployed configuration. If the + configuration has been deployed, the service will do a cleanup deployment in the background, + prior to the delete. + :type force: bool :keyword callable cls: A custom type or function that will be passed the direct response :return: None, or the result of cls(response) :rtype: None @@ -219,28 +381,19 @@ def delete( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-02-01-preview" - accept = "application/json" - - # Construct URL - url = self.delete.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'networkManagerName': self._serialize.url("network_manager_name", network_manager_name, 'str'), - 'networkGroupName': self._serialize.url("network_group_name", network_group_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_delete_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + network_manager_name=network_manager_name, + network_group_name=network_group_name, + force=force, + template_url=self.delete.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.delete(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -253,15 +406,16 @@ def delete( delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/networkManagers/{networkManagerName}/networkGroups/{networkGroupName}'} # type: ignore + + @distributed_trace def list( self, - resource_group_name, # type: str - network_manager_name, # type: str - top=None, # type: Optional[int] - skip_token=None, # type: Optional[str] - **kwargs # type: Any - ): - # type: (...) -> Iterable["_models.NetworkGroupListResult"] + resource_group_name: str, + network_manager_name: str, + top: Optional[int] = None, + skip_token: Optional[str] = None, + **kwargs: Any + ) -> Iterable["_models.NetworkGroupListResult"]: """Lists the specified network group. :param resource_group_name: The name of the resource group. @@ -276,8 +430,10 @@ def list( a skipToken parameter that specifies a starting point to use for subsequent calls. :type skip_token: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either NetworkGroupListResult or the result of cls(response) - :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.network.v2021_02_01_preview.models.NetworkGroupListResult] + :return: An iterator like instance of either NetworkGroupListResult or the result of + cls(response) + :rtype: + ~azure.core.paging.ItemPaged[~azure.mgmt.network.v2021_05_01_preview.models.NetworkGroupListResult] :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.NetworkGroupListResult"] @@ -285,40 +441,37 @@ def list( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-02-01-preview" - accept = "application/json" - def prepare_request(next_link=None): - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - if not next_link: - # Construct URL - url = self.list.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'networkManagerName': self._serialize.url("network_manager_name", network_manager_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - if top is not None: - query_parameters['$top'] = self._serialize.query("top", top, 'int', maximum=20, minimum=1) - if skip_token is not None: - query_parameters['$skipToken'] = self._serialize.query("skip_token", skip_token, 'str') - - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + network_manager_name=network_manager_name, + top=top, + skip_token=skip_token, + template_url=self.list.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + network_manager_name=network_manager_name, + top=top, + skip_token=skip_token, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request def extract_data(pipeline_response): - deserialized = self._deserialize('NetworkGroupListResult', pipeline_response) + deserialized = self._deserialize("NetworkGroupListResult", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -336,6 +489,7 @@ def get_next(next_link=None): return pipeline_response + return ItemPaged( get_next, extract_data ) diff --git a/src/network-manager/azext_network_manager/vendored_sdks/operations/_network_management_client_operations.py b/src/network-manager/azext_network_manager/vendored_sdks/operations/_network_management_client_operations.py new file mode 100644 index 00000000000..73cfe4ce742 --- /dev/null +++ b/src/network-manager/azext_network_manager/vendored_sdks/operations/_network_management_client_operations.py @@ -0,0 +1,547 @@ +# 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 functools +from typing import Any, Callable, Dict, Generic, Optional, TypeVar +import warnings + +from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +from azure.core.pipeline import PipelineResponse +from azure.core.pipeline.transport import HttpResponse +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace +from azure.mgmt.core.exceptions import ARMErrorFormat +from msrest import Serializer + +from .. import models as _models +from .._vendor import _convert_request, _format_url_section +T = TypeVar('T') +JSONType = Any +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] + +_SERIALIZER = Serializer() +_SERIALIZER.client_side_validation = False + +def build_list_active_connectivity_configurations_request( + subscription_id: str, + resource_group_name: str, + network_manager_name: str, + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any +) -> HttpRequest: + content_type = kwargs.pop('content_type', None) # type: Optional[str] + + api_version = "2021-05-01-preview" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/networkManagers/{networkManagerName}/listActiveConnectivityConfigurations') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "networkManagerName": _SERIALIZER.url("network_manager_name", network_manager_name, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + if content_type is not None: + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="POST", + url=url, + params=query_parameters, + headers=header_parameters, + json=json, + content=content, + **kwargs + ) + + +def build_list_active_security_admin_rules_request( + subscription_id: str, + resource_group_name: str, + network_manager_name: str, + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any +) -> HttpRequest: + content_type = kwargs.pop('content_type', None) # type: Optional[str] + + api_version = "2021-05-01-preview" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/networkManagers/{networkManagerName}/listActiveSecurityAdminRules') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "networkManagerName": _SERIALIZER.url("network_manager_name", network_manager_name, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + if content_type is not None: + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="POST", + url=url, + params=query_parameters, + headers=header_parameters, + json=json, + content=content, + **kwargs + ) + + +def build_list_active_security_user_rules_request( + subscription_id: str, + resource_group_name: str, + network_manager_name: str, + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any +) -> HttpRequest: + content_type = kwargs.pop('content_type', None) # type: Optional[str] + + api_version = "2021-05-01-preview" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/networkManagers/{networkManagerName}/listActiveSecurityUserRules') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "networkManagerName": _SERIALIZER.url("network_manager_name", network_manager_name, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + if content_type is not None: + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="POST", + url=url, + params=query_parameters, + headers=header_parameters, + json=json, + content=content, + **kwargs + ) + + +def build_list_network_manager_effective_connectivity_configurations_request( + subscription_id: str, + resource_group_name: str, + virtual_network_name: str, + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any +) -> HttpRequest: + content_type = kwargs.pop('content_type', None) # type: Optional[str] + + api_version = "2021-05-01-preview" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/virtualNetworks/{virtualNetworkName}/listNetworkManagerEffectiveConnectivityConfigurations') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "virtualNetworkName": _SERIALIZER.url("virtual_network_name", virtual_network_name, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + if content_type is not None: + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="POST", + url=url, + params=query_parameters, + headers=header_parameters, + json=json, + content=content, + **kwargs + ) + + +def build_list_network_manager_effective_security_admin_rules_request( + subscription_id: str, + resource_group_name: str, + virtual_network_name: str, + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any +) -> HttpRequest: + content_type = kwargs.pop('content_type', None) # type: Optional[str] + + api_version = "2021-05-01-preview" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/virtualNetworks/{virtualNetworkName}/listNetworkManagerEffectiveSecurityAdminRules') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "virtualNetworkName": _SERIALIZER.url("virtual_network_name", virtual_network_name, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + if content_type is not None: + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="POST", + url=url, + params=query_parameters, + headers=header_parameters, + json=json, + content=content, + **kwargs + ) + +class NetworkManagementClientOperationsMixin(object): + + @distributed_trace + def list_active_connectivity_configurations( + self, + resource_group_name: str, + network_manager_name: str, + parameters: "_models.ActiveConfigurationParameter", + **kwargs: Any + ) -> "_models.ActiveConnectivityConfigurationsListResult": + """Lists active connectivity configurations in a network manager. + + :param resource_group_name: The name of the resource group. + :type resource_group_name: str + :param network_manager_name: The name of the network manager. + :type network_manager_name: str + :param parameters: Active Configuration Parameter. + :type parameters: ~azure.mgmt.network.v2021_05_01_preview.models.ActiveConfigurationParameter + :keyword callable cls: A custom type or function that will be passed the direct response + :return: ActiveConnectivityConfigurationsListResult, or the result of cls(response) + :rtype: + ~azure.mgmt.network.v2021_05_01_preview.models.ActiveConnectivityConfigurationsListResult + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.ActiveConnectivityConfigurationsListResult"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + + _json = self._serialize.body(parameters, 'ActiveConfigurationParameter') + + request = build_list_active_connectivity_configurations_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + network_manager_name=network_manager_name, + content_type=content_type, + json=_json, + template_url=self.list_active_connectivity_configurations.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = self._deserialize('ActiveConnectivityConfigurationsListResult', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + list_active_connectivity_configurations.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/networkManagers/{networkManagerName}/listActiveConnectivityConfigurations'} # type: ignore + + + @distributed_trace + def list_active_security_admin_rules( + self, + resource_group_name: str, + network_manager_name: str, + parameters: "_models.ActiveConfigurationParameter", + **kwargs: Any + ) -> "_models.ActiveSecurityAdminRulesListResult": + """Lists active security admin rules in a network manager. + + :param resource_group_name: The name of the resource group. + :type resource_group_name: str + :param network_manager_name: The name of the network manager. + :type network_manager_name: str + :param parameters: Active Configuration Parameter. + :type parameters: ~azure.mgmt.network.v2021_05_01_preview.models.ActiveConfigurationParameter + :keyword callable cls: A custom type or function that will be passed the direct response + :return: ActiveSecurityAdminRulesListResult, or the result of cls(response) + :rtype: ~azure.mgmt.network.v2021_05_01_preview.models.ActiveSecurityAdminRulesListResult + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.ActiveSecurityAdminRulesListResult"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + + _json = self._serialize.body(parameters, 'ActiveConfigurationParameter') + + request = build_list_active_security_admin_rules_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + network_manager_name=network_manager_name, + content_type=content_type, + json=_json, + template_url=self.list_active_security_admin_rules.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = self._deserialize('ActiveSecurityAdminRulesListResult', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + list_active_security_admin_rules.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/networkManagers/{networkManagerName}/listActiveSecurityAdminRules'} # type: ignore + + + @distributed_trace + def list_active_security_user_rules( + self, + resource_group_name: str, + network_manager_name: str, + parameters: "_models.ActiveConfigurationParameter", + **kwargs: Any + ) -> "_models.ActiveSecurityUserRulesListResult": + """Lists Active Security User Rules in a network manager. + + :param resource_group_name: The name of the resource group. + :type resource_group_name: str + :param network_manager_name: The name of the network manager. + :type network_manager_name: str + :param parameters: Active Configuration Parameter. + :type parameters: ~azure.mgmt.network.v2021_05_01_preview.models.ActiveConfigurationParameter + :keyword callable cls: A custom type or function that will be passed the direct response + :return: ActiveSecurityUserRulesListResult, or the result of cls(response) + :rtype: ~azure.mgmt.network.v2021_05_01_preview.models.ActiveSecurityUserRulesListResult + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.ActiveSecurityUserRulesListResult"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + + _json = self._serialize.body(parameters, 'ActiveConfigurationParameter') + + request = build_list_active_security_user_rules_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + network_manager_name=network_manager_name, + content_type=content_type, + json=_json, + template_url=self.list_active_security_user_rules.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = self._deserialize('ActiveSecurityUserRulesListResult', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + list_active_security_user_rules.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/networkManagers/{networkManagerName}/listActiveSecurityUserRules'} # type: ignore + + + @distributed_trace + def list_network_manager_effective_connectivity_configurations( + self, + resource_group_name: str, + virtual_network_name: str, + parameters: "_models.QueryRequestOptions", + **kwargs: Any + ) -> "_models.NetworkManagerEffectiveConnectivityConfigurationListResult": + """List all effective connectivity configurations applied on a virtual network. + + :param resource_group_name: The name of the resource group. + :type resource_group_name: str + :param virtual_network_name: The name of the virtual network. + :type virtual_network_name: str + :param parameters: Parameters supplied to list correct page. + :type parameters: ~azure.mgmt.network.v2021_05_01_preview.models.QueryRequestOptions + :keyword callable cls: A custom type or function that will be passed the direct response + :return: NetworkManagerEffectiveConnectivityConfigurationListResult, or the result of + cls(response) + :rtype: + ~azure.mgmt.network.v2021_05_01_preview.models.NetworkManagerEffectiveConnectivityConfigurationListResult + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.NetworkManagerEffectiveConnectivityConfigurationListResult"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + + _json = self._serialize.body(parameters, 'QueryRequestOptions') + + request = build_list_network_manager_effective_connectivity_configurations_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + virtual_network_name=virtual_network_name, + content_type=content_type, + json=_json, + template_url=self.list_network_manager_effective_connectivity_configurations.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = self._deserialize('NetworkManagerEffectiveConnectivityConfigurationListResult', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + list_network_manager_effective_connectivity_configurations.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/virtualNetworks/{virtualNetworkName}/listNetworkManagerEffectiveConnectivityConfigurations'} # type: ignore + + + @distributed_trace + def list_network_manager_effective_security_admin_rules( + self, + resource_group_name: str, + virtual_network_name: str, + parameters: "_models.QueryRequestOptions", + **kwargs: Any + ) -> "_models.NetworkManagerEffectiveSecurityAdminRulesListResult": + """List all effective security admin rules applied on a virtual network. + + :param resource_group_name: The name of the resource group. + :type resource_group_name: str + :param virtual_network_name: The name of the virtual network. + :type virtual_network_name: str + :param parameters: Parameters supplied to list correct page. + :type parameters: ~azure.mgmt.network.v2021_05_01_preview.models.QueryRequestOptions + :keyword callable cls: A custom type or function that will be passed the direct response + :return: NetworkManagerEffectiveSecurityAdminRulesListResult, or the result of cls(response) + :rtype: + ~azure.mgmt.network.v2021_05_01_preview.models.NetworkManagerEffectiveSecurityAdminRulesListResult + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.NetworkManagerEffectiveSecurityAdminRulesListResult"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + + _json = self._serialize.body(parameters, 'QueryRequestOptions') + + request = build_list_network_manager_effective_security_admin_rules_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + virtual_network_name=virtual_network_name, + content_type=content_type, + json=_json, + template_url=self.list_network_manager_effective_security_admin_rules.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = self._deserialize('NetworkManagerEffectiveSecurityAdminRulesListResult', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + list_network_manager_effective_security_admin_rules.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/virtualNetworks/{virtualNetworkName}/listNetworkManagerEffectiveSecurityAdminRules'} # type: ignore + diff --git a/src/network-manager/azext_network_manager/vendored_sdks/operations/_network_manager_commits_operations.py b/src/network-manager/azext_network_manager/vendored_sdks/operations/_network_manager_commits_operations.py index 1c68982adfe..d2b4025f251 100644 --- a/src/network-manager/azext_network_manager/vendored_sdks/operations/_network_manager_commits_operations.py +++ b/src/network-manager/azext_network_manager/vendored_sdks/operations/_network_manager_commits_operations.py @@ -5,22 +5,69 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import TYPE_CHECKING +import functools +from typing import Any, Callable, Dict, Generic, Optional, TypeVar import warnings from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import HttpRequest, HttpResponse +from azure.core.pipeline.transport import HttpResponse +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace from azure.mgmt.core.exceptions import ARMErrorFormat +from msrest import Serializer from .. import models as _models - -if TYPE_CHECKING: - # pylint: disable=unused-import,ungrouped-imports - from typing import Any, Callable, Dict, Generic, Optional, TypeVar - - T = TypeVar('T') - ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] +from .._vendor import _convert_request, _format_url_section +T = TypeVar('T') +JSONType = Any +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] + +_SERIALIZER = Serializer() +_SERIALIZER.client_side_validation = False + +def build_post_request( + subscription_id: str, + resource_group_name: str, + network_manager_name: str, + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any +) -> HttpRequest: + content_type = kwargs.pop('content_type', None) # type: Optional[str] + + api_version = "2021-05-01-preview" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/networkManagers/{networkManagerName}/commit') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "networkManagerName": _SERIALIZER.url("network_manager_name", network_manager_name, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + if content_type is not None: + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="POST", + url=url, + params=query_parameters, + headers=header_parameters, + json=json, + content=content, + **kwargs + ) class NetworkManagerCommitsOperations(object): """NetworkManagerCommitsOperations operations. @@ -29,7 +76,7 @@ class NetworkManagerCommitsOperations(object): instantiates it for you and attaches it as an attribute. :ivar models: Alias to model classes used in this operation group. - :type models: ~azure.mgmt.network.v2021_02_01_preview.models + :type models: ~azure.mgmt.network.v2021_05_01_preview.models :param client: Client for service requests. :param config: Configuration of service client. :param serializer: An object model serializer. @@ -44,14 +91,14 @@ def __init__(self, client, config, serializer, deserializer): self._deserialize = deserializer self._config = config + @distributed_trace def post( self, - resource_group_name, # type: str - network_manager_name, # type: str - parameters, # type: "_models.NetworkManagerCommit" - **kwargs # type: Any - ): - # type: (...) -> "_models.NetworkManagerCommit" + resource_group_name: str, + network_manager_name: str, + parameters: "_models.NetworkManagerCommit", + **kwargs: Any + ) -> "_models.NetworkManagerCommit": """Post a Network Manager Commit. :param resource_group_name: The name of the resource group. @@ -59,10 +106,10 @@ def post( :param network_manager_name: The name of the network manager. :type network_manager_name: str :param parameters: Parameters supplied to specify which Managed Network commit is. - :type parameters: ~azure.mgmt.network.v2021_02_01_preview.models.NetworkManagerCommit + :type parameters: ~azure.mgmt.network.v2021_05_01_preview.models.NetworkManagerCommit :keyword callable cls: A custom type or function that will be passed the direct response :return: NetworkManagerCommit, or the result of cls(response) - :rtype: ~azure.mgmt.network.v2021_02_01_preview.models.NetworkManagerCommit + :rtype: ~azure.mgmt.network.v2021_05_01_preview.models.NetworkManagerCommit :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.NetworkManagerCommit"] @@ -70,32 +117,22 @@ def post( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-02-01-preview" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self.post.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'networkManagerName': self._serialize.url("network_manager_name", network_manager_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + _json = self._serialize.body(parameters, 'NetworkManagerCommit') + + request = build_post_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + network_manager_name=network_manager_name, + content_type=content_type, + json=_json, + template_url=self.post.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(parameters, 'NetworkManagerCommit') - body_content_kwargs['content'] = body_content - request = self._client.post(url, query_parameters, header_parameters, **body_content_kwargs) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -109,4 +146,6 @@ def post( return cls(pipeline_response, deserialized, {}) return deserialized + post.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/networkManagers/{networkManagerName}/commit'} # type: ignore + diff --git a/src/network-manager/azext_network_manager/vendored_sdks/operations/_network_manager_deployment_status_operations.py b/src/network-manager/azext_network_manager/vendored_sdks/operations/_network_manager_deployment_status_operations.py index 76556a8b989..101d94ec1c6 100644 --- a/src/network-manager/azext_network_manager/vendored_sdks/operations/_network_manager_deployment_status_operations.py +++ b/src/network-manager/azext_network_manager/vendored_sdks/operations/_network_manager_deployment_status_operations.py @@ -5,22 +5,69 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import TYPE_CHECKING +import functools +from typing import Any, Callable, Dict, Generic, Optional, TypeVar import warnings from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import HttpRequest, HttpResponse +from azure.core.pipeline.transport import HttpResponse +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace from azure.mgmt.core.exceptions import ARMErrorFormat +from msrest import Serializer from .. import models as _models - -if TYPE_CHECKING: - # pylint: disable=unused-import,ungrouped-imports - from typing import Any, Callable, Dict, Generic, Optional, TypeVar - - T = TypeVar('T') - ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] +from .._vendor import _convert_request, _format_url_section +T = TypeVar('T') +JSONType = Any +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] + +_SERIALIZER = Serializer() +_SERIALIZER.client_side_validation = False + +def build_list_request( + subscription_id: str, + resource_group_name: str, + network_manager_name: str, + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any +) -> HttpRequest: + content_type = kwargs.pop('content_type', None) # type: Optional[str] + + api_version = "2021-05-01-preview" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/networkManagers/{networkManagerName}/listDeploymentStatus') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "networkManagerName": _SERIALIZER.url("network_manager_name", network_manager_name, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + if content_type is not None: + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="POST", + url=url, + params=query_parameters, + headers=header_parameters, + json=json, + content=content, + **kwargs + ) class NetworkManagerDeploymentStatusOperations(object): """NetworkManagerDeploymentStatusOperations operations. @@ -29,7 +76,7 @@ class NetworkManagerDeploymentStatusOperations(object): instantiates it for you and attaches it as an attribute. :ivar models: Alias to model classes used in this operation group. - :type models: ~azure.mgmt.network.v2021_02_01_preview.models + :type models: ~azure.mgmt.network.v2021_05_01_preview.models :param client: Client for service requests. :param config: Configuration of service client. :param serializer: An object model serializer. @@ -44,14 +91,14 @@ def __init__(self, client, config, serializer, deserializer): self._deserialize = deserializer self._config = config + @distributed_trace def list( self, - resource_group_name, # type: str - network_manager_name, # type: str - parameters, # type: "_models.NetworkManagerDeploymentStatusParameter" - **kwargs # type: Any - ): - # type: (...) -> "_models.NetworkManagerDeploymentStatusListResult" + resource_group_name: str, + network_manager_name: str, + parameters: "_models.NetworkManagerDeploymentStatusParameter", + **kwargs: Any + ) -> "_models.NetworkManagerDeploymentStatusListResult": """Post to List of Network Manager Deployment Status. :param resource_group_name: The name of the resource group. @@ -59,10 +106,11 @@ def list( :param network_manager_name: The name of the network manager. :type network_manager_name: str :param parameters: Parameters supplied to specify which Managed Network deployment status is. - :type parameters: ~azure.mgmt.network.v2021_02_01_preview.models.NetworkManagerDeploymentStatusParameter + :type parameters: + ~azure.mgmt.network.v2021_05_01_preview.models.NetworkManagerDeploymentStatusParameter :keyword callable cls: A custom type or function that will be passed the direct response :return: NetworkManagerDeploymentStatusListResult, or the result of cls(response) - :rtype: ~azure.mgmt.network.v2021_02_01_preview.models.NetworkManagerDeploymentStatusListResult + :rtype: ~azure.mgmt.network.v2021_05_01_preview.models.NetworkManagerDeploymentStatusListResult :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.NetworkManagerDeploymentStatusListResult"] @@ -70,32 +118,22 @@ def list( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-02-01-preview" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self.list.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'networkManagerName': self._serialize.url("network_manager_name", network_manager_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + _json = self._serialize.body(parameters, 'NetworkManagerDeploymentStatusParameter') + + request = build_list_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + network_manager_name=network_manager_name, + content_type=content_type, + json=_json, + template_url=self.list.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(parameters, 'NetworkManagerDeploymentStatusParameter') - body_content_kwargs['content'] = body_content - request = self._client.post(url, query_parameters, header_parameters, **body_content_kwargs) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -109,4 +147,6 @@ def list( return cls(pipeline_response, deserialized, {}) return deserialized + list.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/networkManagers/{networkManagerName}/listDeploymentStatus'} # type: ignore + diff --git a/src/network-manager/azext_network_manager/vendored_sdks/operations/_network_manager_effective_security_admin_rules_operations.py b/src/network-manager/azext_network_manager/vendored_sdks/operations/_network_manager_effective_security_admin_rules_operations.py deleted file mode 100644 index 4305b69c894..00000000000 --- a/src/network-manager/azext_network_manager/vendored_sdks/operations/_network_manager_effective_security_admin_rules_operations.py +++ /dev/null @@ -1,112 +0,0 @@ -# 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 typing import TYPE_CHECKING -import warnings - -from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error -from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import HttpRequest, HttpResponse -from azure.mgmt.core.exceptions import ARMErrorFormat - -from .. import models as _models - -if TYPE_CHECKING: - # pylint: disable=unused-import,ungrouped-imports - from typing import Any, Callable, Dict, Generic, Optional, TypeVar - - T = TypeVar('T') - ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] - -class NetworkManagerEffectiveSecurityAdminRulesOperations(object): - """NetworkManagerEffectiveSecurityAdminRulesOperations operations. - - You should not instantiate this class directly. Instead, you should create a Client instance that - instantiates it for you and attaches it as an attribute. - - :ivar models: Alias to model classes used in this operation group. - :type models: ~azure.mgmt.network.v2021_02_01_preview.models - :param client: Client for service requests. - :param config: Configuration of service client. - :param serializer: An object model serializer. - :param deserializer: An object model deserializer. - """ - - models = _models - - def __init__(self, client, config, serializer, deserializer): - self._client = client - self._serialize = serializer - self._deserialize = deserializer - self._config = config - - def list( - self, - resource_group_name, # type: str - virtual_network_name, # type: str - parameters, # type: "_models.QueryRequestOptions" - **kwargs # type: Any - ): - # type: (...) -> "_models.NetworkManagerEffectiveSecurityAdminRulesListResult" - """List all effective security admin rules applied on a virtual network. - - :param resource_group_name: The name of the resource group. - :type resource_group_name: str - :param virtual_network_name: The name of the virtual network. - :type virtual_network_name: str - :param parameters: Parameters supplied to list correct page. - :type parameters: ~azure.mgmt.network.v2021_02_01_preview.models.QueryRequestOptions - :keyword callable cls: A custom type or function that will be passed the direct response - :return: NetworkManagerEffectiveSecurityAdminRulesListResult, or the result of cls(response) - :rtype: ~azure.mgmt.network.v2021_02_01_preview.models.NetworkManagerEffectiveSecurityAdminRulesListResult - :raises: ~azure.core.exceptions.HttpResponseError - """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.NetworkManagerEffectiveSecurityAdminRulesListResult"] - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-02-01-preview" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self.list.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'virtualNetworkName': self._serialize.url("virtual_network_name", virtual_network_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(parameters, 'QueryRequestOptions') - body_content_kwargs['content'] = body_content - request = self._client.post(url, query_parameters, header_parameters, **body_content_kwargs) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - deserialized = self._deserialize('NetworkManagerEffectiveSecurityAdminRulesListResult', pipeline_response) - - if cls: - return cls(pipeline_response, deserialized, {}) - - return deserialized - list.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/virtualNetworks/{virtualNetworkName}/listNetworkManagerEffectiveSecurityAdminRules'} # type: ignore diff --git a/src/network-manager/azext_network_manager/vendored_sdks/operations/_network_managers_operations.py b/src/network-manager/azext_network_manager/vendored_sdks/operations/_network_managers_operations.py index 0174d552e5f..14309c3ffbe 100644 --- a/src/network-manager/azext_network_manager/vendored_sdks/operations/_network_managers_operations.py +++ b/src/network-manager/azext_network_manager/vendored_sdks/operations/_network_managers_operations.py @@ -5,23 +5,269 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import TYPE_CHECKING +import functools +from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar, Union import warnings from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.paging import ItemPaged from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import HttpRequest, HttpResponse +from azure.core.pipeline.transport import HttpResponse +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace from azure.mgmt.core.exceptions import ARMErrorFormat +from msrest import Serializer from .. import models as _models - -if TYPE_CHECKING: - # pylint: disable=unused-import,ungrouped-imports - from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar, Union - - T = TypeVar('T') - ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] +from .._vendor import _convert_request, _format_url_section +T = TypeVar('T') +JSONType = Any +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] + +_SERIALIZER = Serializer() +_SERIALIZER.client_side_validation = False + +def build_get_request( + subscription_id: str, + resource_group_name: str, + network_manager_name: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2021-05-01-preview" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/networkManagers/{networkManagerName}') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "networkManagerName": _SERIALIZER.url("network_manager_name", network_manager_name, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_create_or_update_request( + subscription_id: str, + resource_group_name: str, + network_manager_name: str, + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any +) -> HttpRequest: + content_type = kwargs.pop('content_type', None) # type: Optional[str] + + api_version = "2021-05-01-preview" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/networkManagers/{networkManagerName}') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "networkManagerName": _SERIALIZER.url("network_manager_name", network_manager_name, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + if content_type is not None: + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="PUT", + url=url, + params=query_parameters, + headers=header_parameters, + json=json, + content=content, + **kwargs + ) + + +def build_delete_request( + subscription_id: str, + resource_group_name: str, + network_manager_name: str, + *, + force: Optional[bool] = None, + recursive: Optional[bool] = None, + **kwargs: Any +) -> HttpRequest: + api_version = "2021-05-01-preview" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/networkManagers/{networkManagerName}') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "networkManagerName": _SERIALIZER.url("network_manager_name", network_manager_name, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + if force is not None: + query_parameters['force'] = _SERIALIZER.query("force", force, 'bool') + if recursive is not None: + query_parameters['recursive'] = _SERIALIZER.query("recursive", recursive, 'bool') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="DELETE", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_patch_request( + subscription_id: str, + resource_group_name: str, + network_manager_name: str, + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any +) -> HttpRequest: + content_type = kwargs.pop('content_type', None) # type: Optional[str] + + api_version = "2021-05-01-preview" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/networkManagers/{networkManagerName}') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "networkManagerName": _SERIALIZER.url("network_manager_name", network_manager_name, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + if content_type is not None: + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="PATCH", + url=url, + params=query_parameters, + headers=header_parameters, + json=json, + content=content, + **kwargs + ) + + +def build_list_by_subscription_request( + subscription_id: str, + *, + top: Optional[int] = None, + skip_token: Optional[str] = None, + **kwargs: Any +) -> HttpRequest: + api_version = "2021-05-01-preview" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/providers/Microsoft.Network/networkManagers') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + if top is not None: + query_parameters['$top'] = _SERIALIZER.query("top", top, 'int', maximum=20, minimum=1) + if skip_token is not None: + query_parameters['$skipToken'] = _SERIALIZER.query("skip_token", skip_token, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_list_request( + subscription_id: str, + resource_group_name: str, + *, + top: Optional[int] = None, + skip_token: Optional[str] = None, + **kwargs: Any +) -> HttpRequest: + api_version = "2021-05-01-preview" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/networkManagers') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + if top is not None: + query_parameters['$top'] = _SERIALIZER.query("top", top, 'int', maximum=20, minimum=1) + if skip_token is not None: + query_parameters['$skipToken'] = _SERIALIZER.query("skip_token", skip_token, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) class NetworkManagersOperations(object): """NetworkManagersOperations operations. @@ -30,7 +276,7 @@ class NetworkManagersOperations(object): instantiates it for you and attaches it as an attribute. :ivar models: Alias to model classes used in this operation group. - :type models: ~azure.mgmt.network.v2021_02_01_preview.models + :type models: ~azure.mgmt.network.v2021_05_01_preview.models :param client: Client for service requests. :param config: Configuration of service client. :param serializer: An object model serializer. @@ -45,13 +291,13 @@ def __init__(self, client, config, serializer, deserializer): self._deserialize = deserializer self._config = config + @distributed_trace def get( self, - resource_group_name, # type: str - network_manager_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> "_models.NetworkManager" + resource_group_name: str, + network_manager_name: str, + **kwargs: Any + ) -> "_models.NetworkManager": """Gets the specified Network Manager. :param resource_group_name: The name of the resource group. @@ -60,7 +306,7 @@ def get( :type network_manager_name: str :keyword callable cls: A custom type or function that will be passed the direct response :return: NetworkManager, or the result of cls(response) - :rtype: ~azure.mgmt.network.v2021_02_01_preview.models.NetworkManager + :rtype: ~azure.mgmt.network.v2021_05_01_preview.models.NetworkManager :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.NetworkManager"] @@ -68,27 +314,17 @@ def get( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-02-01-preview" - accept = "application/json" - - # Construct URL - url = self.get.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'networkManagerName': self._serialize.url("network_manager_name", network_manager_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_get_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + network_manager_name=network_manager_name, + template_url=self.get.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.get(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -102,16 +338,18 @@ def get( return cls(pipeline_response, deserialized, {}) return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/networkManagers/{networkManagerName}'} # type: ignore + + @distributed_trace def create_or_update( self, - resource_group_name, # type: str - network_manager_name, # type: str - parameters, # type: "_models.NetworkManager" - **kwargs # type: Any - ): - # type: (...) -> "_models.NetworkManager" + resource_group_name: str, + network_manager_name: str, + parameters: "_models.NetworkManager", + **kwargs: Any + ) -> "_models.NetworkManager": """Creates or updates a Network Manager. :param resource_group_name: The name of the resource group. @@ -119,10 +357,10 @@ def create_or_update( :param network_manager_name: The name of the network manager. :type network_manager_name: str :param parameters: Parameters supplied to specify which network manager is. - :type parameters: ~azure.mgmt.network.v2021_02_01_preview.models.NetworkManager + :type parameters: ~azure.mgmt.network.v2021_05_01_preview.models.NetworkManager :keyword callable cls: A custom type or function that will be passed the direct response :return: NetworkManager, or the result of cls(response) - :rtype: ~azure.mgmt.network.v2021_02_01_preview.models.NetworkManager + :rtype: ~azure.mgmt.network.v2021_05_01_preview.models.NetworkManager :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.NetworkManager"] @@ -130,32 +368,22 @@ def create_or_update( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-02-01-preview" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self.create_or_update.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'networkManagerName': self._serialize.url("network_manager_name", network_manager_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + _json = self._serialize.body(parameters, 'NetworkManager') + + request = build_create_or_update_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + network_manager_name=network_manager_name, + content_type=content_type, + json=_json, + template_url=self.create_or_update.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(parameters, 'NetworkManager') - body_content_kwargs['content'] = body_content - request = self._client.put(url, query_parameters, header_parameters, **body_content_kwargs) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -173,21 +401,33 @@ def create_or_update( return cls(pipeline_response, deserialized, {}) return deserialized + create_or_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/networkManagers/{networkManagerName}'} # type: ignore + + @distributed_trace def delete( self, - resource_group_name, # type: str - network_manager_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> None + resource_group_name: str, + network_manager_name: str, + force: Optional[bool] = None, + recursive: Optional[bool] = None, + **kwargs: Any + ) -> None: """Deletes a network manager. :param resource_group_name: The name of the resource group. :type resource_group_name: str :param network_manager_name: The name of the network manager. :type network_manager_name: str + :param force: Deletes the resource even if it is part of a deployed configuration. If the + configuration has been deployed, the service will do a cleanup deployment in the background, + prior to the delete. + :type force: bool + :param recursive: Deletes the resource recursively. When present in a security configuration + delete, all rule collections and rules within the configuration will be deleted. When present + in a rule collection delete, all rules within the collection will be deleted. + :type recursive: bool :keyword callable cls: A custom type or function that will be passed the direct response :return: None, or the result of cls(response) :rtype: None @@ -198,27 +438,19 @@ def delete( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-02-01-preview" - accept = "application/json" - - # Construct URL - url = self.delete.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'networkManagerName': self._serialize.url("network_manager_name", network_manager_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_delete_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + network_manager_name=network_manager_name, + force=force, + recursive=recursive, + template_url=self.delete.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.delete(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -231,25 +463,26 @@ def delete( delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/networkManagers/{networkManagerName}'} # type: ignore - def patch_tags( + + @distributed_trace + def patch( self, - resource_group_name, # type: str - network_manager_name, # type: str - parameters, # type: "_models.TagsObject" - **kwargs # type: Any - ): - # type: (...) -> "_models.NetworkManager" - """Patch a NetworkManager Tags. + resource_group_name: str, + network_manager_name: str, + parameters: "_models.PatchObject", + **kwargs: Any + ) -> "_models.NetworkManager": + """Patch NetworkManager. :param resource_group_name: The name of the resource group. :type resource_group_name: str :param network_manager_name: The name of the network manager. :type network_manager_name: str - :param parameters: Parameters supplied to update network manager tags. - :type parameters: ~azure.mgmt.network.v2021_02_01_preview.models.TagsObject + :param parameters: Parameters supplied to specify which network manager is. + :type parameters: ~azure.mgmt.network.v2021_05_01_preview.models.PatchObject :keyword callable cls: A custom type or function that will be passed the direct response :return: NetworkManager, or the result of cls(response) - :rtype: ~azure.mgmt.network.v2021_02_01_preview.models.NetworkManager + :rtype: ~azure.mgmt.network.v2021_05_01_preview.models.NetworkManager :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.NetworkManager"] @@ -257,32 +490,22 @@ def patch_tags( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-02-01-preview" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self.patch_tags.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'networkManagerName': self._serialize.url("network_manager_name", network_manager_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + + _json = self._serialize.body(parameters, 'PatchObject') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + request = build_patch_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + network_manager_name=network_manager_name, + content_type=content_type, + json=_json, + template_url=self.patch.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(parameters, 'TagsObject') - body_content_kwargs['content'] = body_content - request = self._client.patch(url, query_parameters, header_parameters, **body_content_kwargs) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -296,15 +519,17 @@ def patch_tags( return cls(pipeline_response, deserialized, {}) return deserialized - patch_tags.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/networkManagers/{networkManagerName}'} # type: ignore + patch.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/networkManagers/{networkManagerName}'} # type: ignore + + + @distributed_trace def list_by_subscription( self, - top=None, # type: Optional[int] - skip_token=None, # type: Optional[str] - **kwargs # type: Any - ): - # type: (...) -> Iterable["_models.NetworkManagerListResult"] + top: Optional[int] = None, + skip_token: Optional[str] = None, + **kwargs: Any + ) -> Iterable["_models.NetworkManagerListResult"]: """List all network managers in a subscription. :param top: An optional query parameter which specifies the maximum number of records to be @@ -315,8 +540,10 @@ def list_by_subscription( a skipToken parameter that specifies a starting point to use for subsequent calls. :type skip_token: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either NetworkManagerListResult or the result of cls(response) - :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.network.v2021_02_01_preview.models.NetworkManagerListResult] + :return: An iterator like instance of either NetworkManagerListResult or the result of + cls(response) + :rtype: + ~azure.core.paging.ItemPaged[~azure.mgmt.network.v2021_05_01_preview.models.NetworkManagerListResult] :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.NetworkManagerListResult"] @@ -324,38 +551,33 @@ def list_by_subscription( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-02-01-preview" - accept = "application/json" - def prepare_request(next_link=None): - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - if not next_link: - # Construct URL - url = self.list_by_subscription.metadata['url'] # type: ignore - 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 = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - if top is not None: - query_parameters['$top'] = self._serialize.query("top", top, 'int', maximum=20, minimum=1) - if skip_token is not None: - query_parameters['$skipToken'] = self._serialize.query("skip_token", skip_token, 'str') - - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_by_subscription_request( + subscription_id=self._config.subscription_id, + top=top, + skip_token=skip_token, + template_url=self.list_by_subscription.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_by_subscription_request( + subscription_id=self._config.subscription_id, + top=top, + skip_token=skip_token, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request def extract_data(pipeline_response): - deserialized = self._deserialize('NetworkManagerListResult', pipeline_response) + deserialized = self._deserialize("NetworkManagerListResult", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -373,19 +595,20 @@ def get_next(next_link=None): return pipeline_response + return ItemPaged( get_next, extract_data ) list_by_subscription.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.Network/networkManagers'} # type: ignore + @distributed_trace def list( self, - resource_group_name, # type: str - top=None, # type: Optional[int] - skip_token=None, # type: Optional[str] - **kwargs # type: Any - ): - # type: (...) -> Iterable["_models.NetworkManagerListResult"] + resource_group_name: str, + top: Optional[int] = None, + skip_token: Optional[str] = None, + **kwargs: Any + ) -> Iterable["_models.NetworkManagerListResult"]: """List network managers in a resource group. :param resource_group_name: The name of the resource group. @@ -398,8 +621,10 @@ def list( a skipToken parameter that specifies a starting point to use for subsequent calls. :type skip_token: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either NetworkManagerListResult or the result of cls(response) - :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.network.v2021_02_01_preview.models.NetworkManagerListResult] + :return: An iterator like instance of either NetworkManagerListResult or the result of + cls(response) + :rtype: + ~azure.core.paging.ItemPaged[~azure.mgmt.network.v2021_05_01_preview.models.NetworkManagerListResult] :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.NetworkManagerListResult"] @@ -407,39 +632,35 @@ def list( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-02-01-preview" - accept = "application/json" - def prepare_request(next_link=None): - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - if not next_link: - # Construct URL - url = self.list.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - if top is not None: - query_parameters['$top'] = self._serialize.query("top", top, 'int', maximum=20, minimum=1) - if skip_token is not None: - query_parameters['$skipToken'] = self._serialize.query("skip_token", skip_token, 'str') - - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + top=top, + skip_token=skip_token, + template_url=self.list.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + top=top, + skip_token=skip_token, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request def extract_data(pipeline_response): - deserialized = self._deserialize('NetworkManagerListResult', pipeline_response) + deserialized = self._deserialize("NetworkManagerListResult", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -457,6 +678,7 @@ def get_next(next_link=None): return pipeline_response + return ItemPaged( get_next, extract_data ) diff --git a/src/network-manager/azext_network_manager/vendored_sdks/operations/_network_security_perimeters_operations.py b/src/network-manager/azext_network_manager/vendored_sdks/operations/_network_security_perimeters_operations.py deleted file mode 100644 index 5a3be1c8dea..00000000000 --- a/src/network-manager/azext_network_manager/vendored_sdks/operations/_network_security_perimeters_operations.py +++ /dev/null @@ -1,396 +0,0 @@ -# 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 typing import TYPE_CHECKING -import warnings - -from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error -from azure.core.paging import ItemPaged -from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import HttpRequest, HttpResponse -from azure.mgmt.core.exceptions import ARMErrorFormat - -from .. import models as _models - -if TYPE_CHECKING: - # pylint: disable=unused-import,ungrouped-imports - from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar, Union - - T = TypeVar('T') - ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] - -class NetworkSecurityPerimetersOperations(object): - """NetworkSecurityPerimetersOperations operations. - - You should not instantiate this class directly. Instead, you should create a Client instance that - instantiates it for you and attaches it as an attribute. - - :ivar models: Alias to model classes used in this operation group. - :type models: ~azure.mgmt.network.v2021_02_01_preview.models - :param client: Client for service requests. - :param config: Configuration of service client. - :param serializer: An object model serializer. - :param deserializer: An object model deserializer. - """ - - models = _models - - def __init__(self, client, config, serializer, deserializer): - self._client = client - self._serialize = serializer - self._deserialize = deserializer - self._config = config - - def get( - self, - resource_group_name, # type: str - network_security_perimeter_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> "_models.NetworkSecurityPerimeter" - """Gets the specified network security perimeter by the name. - - :param resource_group_name: The name of the resource group. - :type resource_group_name: str - :param network_security_perimeter_name: The name of the network security perimeter. - :type network_security_perimeter_name: str - :keyword callable cls: A custom type or function that will be passed the direct response - :return: NetworkSecurityPerimeter, or the result of cls(response) - :rtype: ~azure.mgmt.network.v2021_02_01_preview.models.NetworkSecurityPerimeter - :raises: ~azure.core.exceptions.HttpResponseError - """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.NetworkSecurityPerimeter"] - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-02-01-preview" - accept = "application/json" - - # Construct URL - url = self.get.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'networkSecurityPerimeterName': self._serialize.url("network_security_perimeter_name", network_security_perimeter_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - - request = self._client.get(url, query_parameters, header_parameters) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - deserialized = self._deserialize('NetworkSecurityPerimeter', pipeline_response) - - if cls: - return cls(pipeline_response, deserialized, {}) - - return deserialized - get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/networkSecurityPerimeters/{networkSecurityPerimeterName}'} # type: ignore - - def create_or_update( - self, - resource_group_name, # type: str - network_security_perimeter_name, # type: str - parameters, # type: "_models.NetworkSecurityPerimeter" - **kwargs # type: Any - ): - # type: (...) -> "_models.NetworkSecurityPerimeter" - """Creates or updates a Network Security Perimeter. - - :param resource_group_name: The name of the resource group. - :type resource_group_name: str - :param network_security_perimeter_name: The name of the network security perimeter. - :type network_security_perimeter_name: str - :param parameters: Parameter supplied to create or update the network security perimeter. - :type parameters: ~azure.mgmt.network.v2021_02_01_preview.models.NetworkSecurityPerimeter - :keyword callable cls: A custom type or function that will be passed the direct response - :return: NetworkSecurityPerimeter, or the result of cls(response) - :rtype: ~azure.mgmt.network.v2021_02_01_preview.models.NetworkSecurityPerimeter - :raises: ~azure.core.exceptions.HttpResponseError - """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.NetworkSecurityPerimeter"] - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-02-01-preview" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self.create_or_update.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'networkSecurityPerimeterName': self._serialize.url("network_security_perimeter_name", network_security_perimeter_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(parameters, 'NetworkSecurityPerimeter') - body_content_kwargs['content'] = body_content - request = self._client.put(url, query_parameters, header_parameters, **body_content_kwargs) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) - response = pipeline_response.http_response - - if response.status_code not in [200, 201]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - if response.status_code == 200: - deserialized = self._deserialize('NetworkSecurityPerimeter', pipeline_response) - - if response.status_code == 201: - deserialized = self._deserialize('NetworkSecurityPerimeter', pipeline_response) - - if cls: - return cls(pipeline_response, deserialized, {}) - - return deserialized - create_or_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/networkSecurityPerimeters/{networkSecurityPerimeterName}'} # type: ignore - - def delete( - self, - resource_group_name, # type: str - network_security_perimeter_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> None - """Deletes a network security perimeter. - - :param resource_group_name: The name of the resource group. - :type resource_group_name: str - :param network_security_perimeter_name: The name of the network security perimeter. - :type network_security_perimeter_name: str - :keyword callable cls: A custom type or function that will be passed the direct response - :return: None, or the result of cls(response) - :rtype: None - :raises: ~azure.core.exceptions.HttpResponseError - """ - cls = kwargs.pop('cls', None) # type: ClsType[None] - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-02-01-preview" - accept = "application/json" - - # Construct URL - url = self.delete.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'networkSecurityPerimeterName': self._serialize.url("network_security_perimeter_name", network_security_perimeter_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - - request = self._client.delete(url, query_parameters, header_parameters) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) - response = pipeline_response.http_response - - if response.status_code not in [200, 204]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - if cls: - return cls(pipeline_response, None, {}) - - delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/networkSecurityPerimeters/{networkSecurityPerimeterName}'} # type: ignore - - def list_by_subscription( - self, - top=None, # type: Optional[int] - skip_token=None, # type: Optional[str] - **kwargs # type: Any - ): - # type: (...) -> Iterable["_models.NetworkSecurityPerimeterListResult"] - """List all network security perimeters in a subscription. - - :param top: An optional query parameter which specifies the maximum number of records to be - returned by the server. - :type top: int - :param skip_token: SkipToken is only used if a previous operation returned a partial result. If - a previous response contains a nextLink element, the value of the nextLink element will include - a skipToken parameter that specifies a starting point to use for subsequent calls. - :type skip_token: str - :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either NetworkSecurityPerimeterListResult or the result of cls(response) - :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.network.v2021_02_01_preview.models.NetworkSecurityPerimeterListResult] - :raises: ~azure.core.exceptions.HttpResponseError - """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.NetworkSecurityPerimeterListResult"] - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-02-01-preview" - accept = "application/json" - - def prepare_request(next_link=None): - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - - if not next_link: - # Construct URL - url = self.list_by_subscription.metadata['url'] # type: ignore - 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 = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - if top is not None: - query_parameters['$top'] = self._serialize.query("top", top, 'int', maximum=20, minimum=1) - if skip_token is not None: - query_parameters['$skipToken'] = self._serialize.query("skip_token", skip_token, 'str') - - request = self._client.get(url, query_parameters, header_parameters) - else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) - return request - - def extract_data(pipeline_response): - deserialized = self._deserialize('NetworkSecurityPerimeterListResult', pipeline_response) - list_of_elem = deserialized.value - if cls: - list_of_elem = cls(list_of_elem) - return deserialized.next_link or None, iter(list_of_elem) - - def get_next(next_link=None): - request = prepare_request(next_link) - - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - return pipeline_response - - return ItemPaged( - get_next, extract_data - ) - list_by_subscription.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.Network/networkSecurityPerimeters'} # type: ignore - - def list( - self, - resource_group_name, # type: str - top=None, # type: Optional[int] - skip_token=None, # type: Optional[str] - **kwargs # type: Any - ): - # type: (...) -> Iterable["_models.NetworkSecurityPerimeterListResult"] - """List network security perimeters in a resource group. - - :param resource_group_name: The name of the resource group. - :type resource_group_name: str - :param top: An optional query parameter which specifies the maximum number of records to be - returned by the server. - :type top: int - :param skip_token: SkipToken is only used if a previous operation returned a partial result. If - a previous response contains a nextLink element, the value of the nextLink element will include - a skipToken parameter that specifies a starting point to use for subsequent calls. - :type skip_token: str - :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either NetworkSecurityPerimeterListResult or the result of cls(response) - :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.network.v2021_02_01_preview.models.NetworkSecurityPerimeterListResult] - :raises: ~azure.core.exceptions.HttpResponseError - """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.NetworkSecurityPerimeterListResult"] - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-02-01-preview" - accept = "application/json" - - def prepare_request(next_link=None): - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - - if not next_link: - # Construct URL - url = self.list.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - if top is not None: - query_parameters['$top'] = self._serialize.query("top", top, 'int', maximum=20, minimum=1) - if skip_token is not None: - query_parameters['$skipToken'] = self._serialize.query("skip_token", skip_token, 'str') - - request = self._client.get(url, query_parameters, header_parameters) - else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) - return request - - def extract_data(pipeline_response): - deserialized = self._deserialize('NetworkSecurityPerimeterListResult', pipeline_response) - list_of_elem = deserialized.value - if cls: - list_of_elem = cls(list_of_elem) - return deserialized.next_link or None, iter(list_of_elem) - - def get_next(next_link=None): - request = prepare_request(next_link) - - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - return pipeline_response - - return ItemPaged( - get_next, extract_data - ) - list.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/networkSecurityPerimeters'} # type: ignore diff --git a/src/network-manager/azext_network_manager/vendored_sdks/operations/_perimeter_associable_resource_types_operations.py b/src/network-manager/azext_network_manager/vendored_sdks/operations/_perimeter_associable_resource_types_operations.py deleted file mode 100644 index 80c30a1f635..00000000000 --- a/src/network-manager/azext_network_manager/vendored_sdks/operations/_perimeter_associable_resource_types_operations.py +++ /dev/null @@ -1,101 +0,0 @@ -# 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 typing import TYPE_CHECKING -import warnings - -from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error -from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import HttpRequest, HttpResponse -from azure.mgmt.core.exceptions import ARMErrorFormat - -from .. import models as _models - -if TYPE_CHECKING: - # pylint: disable=unused-import,ungrouped-imports - from typing import Any, Callable, Dict, Generic, Optional, TypeVar - - T = TypeVar('T') - ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] - -class PerimeterAssociableResourceTypesOperations(object): - """PerimeterAssociableResourceTypesOperations operations. - - You should not instantiate this class directly. Instead, you should create a Client instance that - instantiates it for you and attaches it as an attribute. - - :ivar models: Alias to model classes used in this operation group. - :type models: ~azure.mgmt.network.v2021_02_01_preview.models - :param client: Client for service requests. - :param config: Configuration of service client. - :param serializer: An object model serializer. - :param deserializer: An object model deserializer. - """ - - models = _models - - def __init__(self, client, config, serializer, deserializer): - self._client = client - self._serialize = serializer - self._deserialize = deserializer - self._config = config - - def get( - self, - location, # type: str - **kwargs # type: Any - ): - # type: (...) -> "_models.PerimeterAssociableResourcesListResult" - """Gets the list of resources that are onboarded with NSP. These resources can be associated with - a network security perimeter. - - :param location: The location of the where the association is present. - :type location: str - :keyword callable cls: A custom type or function that will be passed the direct response - :return: PerimeterAssociableResourcesListResult, or the result of cls(response) - :rtype: ~azure.mgmt.network.v2021_02_01_preview.models.PerimeterAssociableResourcesListResult - :raises: ~azure.core.exceptions.HttpResponseError - """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.PerimeterAssociableResourcesListResult"] - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-02-01-preview" - accept = "application/json" - - # Construct URL - url = self.get.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'location': self._serialize.url("location", location, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - - request = self._client.get(url, query_parameters, header_parameters) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - deserialized = self._deserialize('PerimeterAssociableResourcesListResult', pipeline_response) - - if cls: - return cls(pipeline_response, deserialized, {}) - - return deserialized - get.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.Network/locations/{location}/perimeterAssociableResourceTypes'} # type: ignore diff --git a/src/network-manager/azext_network_manager/vendored_sdks/operations/_scope_connections_operations.py b/src/network-manager/azext_network_manager/vendored_sdks/operations/_scope_connections_operations.py new file mode 100644 index 00000000000..338fd1febc1 --- /dev/null +++ b/src/network-manager/azext_network_manager/vendored_sdks/operations/_scope_connections_operations.py @@ -0,0 +1,472 @@ +# 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 functools +from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar, Union +import warnings + +from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +from azure.core.paging import ItemPaged +from azure.core.pipeline import PipelineResponse +from azure.core.pipeline.transport import HttpResponse +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace +from azure.mgmt.core.exceptions import ARMErrorFormat +from msrest import Serializer + +from .. import models as _models +from .._vendor import _convert_request, _format_url_section +T = TypeVar('T') +JSONType = Any +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] + +_SERIALIZER = Serializer() +_SERIALIZER.client_side_validation = False + +def build_create_or_update_request( + subscription_id: str, + resource_group_name: str, + network_manager_name: str, + scope_connection_name: str, + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any +) -> HttpRequest: + content_type = kwargs.pop('content_type', None) # type: Optional[str] + + api_version = "2021-05-01-preview" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/networkManagers/{networkManagerName}/scopeConnections/{scopeConnectionName}') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "networkManagerName": _SERIALIZER.url("network_manager_name", network_manager_name, 'str'), + "scopeConnectionName": _SERIALIZER.url("scope_connection_name", scope_connection_name, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + if content_type is not None: + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="PUT", + url=url, + params=query_parameters, + headers=header_parameters, + json=json, + content=content, + **kwargs + ) + + +def build_get_request( + subscription_id: str, + resource_group_name: str, + network_manager_name: str, + scope_connection_name: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2021-05-01-preview" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/networkManagers/{networkManagerName}/scopeConnections/{scopeConnectionName}') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "networkManagerName": _SERIALIZER.url("network_manager_name", network_manager_name, 'str'), + "scopeConnectionName": _SERIALIZER.url("scope_connection_name", scope_connection_name, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_delete_request( + subscription_id: str, + resource_group_name: str, + network_manager_name: str, + scope_connection_name: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2021-05-01-preview" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/networkManagers/{networkManagerName}/scopeConnections/{scopeConnectionName}') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "networkManagerName": _SERIALIZER.url("network_manager_name", network_manager_name, 'str'), + "scopeConnectionName": _SERIALIZER.url("scope_connection_name", scope_connection_name, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="DELETE", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_list_request( + subscription_id: str, + resource_group_name: str, + network_manager_name: str, + *, + top: Optional[int] = None, + skip_token: Optional[str] = None, + **kwargs: Any +) -> HttpRequest: + api_version = "2021-05-01-preview" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/networkManagers/{networkManagerName}/scopeConnections') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "networkManagerName": _SERIALIZER.url("network_manager_name", network_manager_name, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + if top is not None: + query_parameters['$top'] = _SERIALIZER.query("top", top, 'int', maximum=20, minimum=1) + if skip_token is not None: + query_parameters['$skipToken'] = _SERIALIZER.query("skip_token", skip_token, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + +class ScopeConnectionsOperations(object): + """ScopeConnectionsOperations operations. + + You should not instantiate this class directly. Instead, you should create a Client instance that + instantiates it for you and attaches it as an attribute. + + :ivar models: Alias to model classes used in this operation group. + :type models: ~azure.mgmt.network.v2021_05_01_preview.models + :param client: Client for service requests. + :param config: Configuration of service client. + :param serializer: An object model serializer. + :param deserializer: An object model deserializer. + """ + + models = _models + + def __init__(self, client, config, serializer, deserializer): + self._client = client + self._serialize = serializer + self._deserialize = deserializer + self._config = config + + @distributed_trace + def create_or_update( + self, + resource_group_name: str, + network_manager_name: str, + scope_connection_name: str, + parameters: "_models.ScopeConnection", + **kwargs: Any + ) -> "_models.ScopeConnection": + """Creates or updates scope connection from Network Manager. + + :param resource_group_name: The name of the resource group. + :type resource_group_name: str + :param network_manager_name: The name of the network manager. + :type network_manager_name: str + :param scope_connection_name: Name for the cross-tenant connection. + :type scope_connection_name: str + :param parameters: Scope connection to be created/updated. + :type parameters: ~azure.mgmt.network.v2021_05_01_preview.models.ScopeConnection + :keyword callable cls: A custom type or function that will be passed the direct response + :return: ScopeConnection, or the result of cls(response) + :rtype: ~azure.mgmt.network.v2021_05_01_preview.models.ScopeConnection + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.ScopeConnection"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + + _json = self._serialize.body(parameters, 'ScopeConnection') + + request = build_create_or_update_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + network_manager_name=network_manager_name, + scope_connection_name=scope_connection_name, + content_type=content_type, + json=_json, + template_url=self.create_or_update.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200, 201]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + if response.status_code == 200: + deserialized = self._deserialize('ScopeConnection', pipeline_response) + + if response.status_code == 201: + deserialized = self._deserialize('ScopeConnection', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + create_or_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/networkManagers/{networkManagerName}/scopeConnections/{scopeConnectionName}'} # type: ignore + + + @distributed_trace + def get( + self, + resource_group_name: str, + network_manager_name: str, + scope_connection_name: str, + **kwargs: Any + ) -> "_models.ScopeConnection": + """Get specified scope connection created by this Network Manager. + + :param resource_group_name: The name of the resource group. + :type resource_group_name: str + :param network_manager_name: The name of the network manager. + :type network_manager_name: str + :param scope_connection_name: Name for the cross-tenant connection. + :type scope_connection_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: ScopeConnection, or the result of cls(response) + :rtype: ~azure.mgmt.network.v2021_05_01_preview.models.ScopeConnection + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.ScopeConnection"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + + request = build_get_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + network_manager_name=network_manager_name, + scope_connection_name=scope_connection_name, + template_url=self.get.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = self._deserialize('ScopeConnection', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/networkManagers/{networkManagerName}/scopeConnections/{scopeConnectionName}'} # type: ignore + + + @distributed_trace + def delete( + self, + resource_group_name: str, + network_manager_name: str, + scope_connection_name: str, + **kwargs: Any + ) -> None: + """Delete the pending scope connection created by this network manager. + + :param resource_group_name: The name of the resource group. + :type resource_group_name: str + :param network_manager_name: The name of the network manager. + :type network_manager_name: str + :param scope_connection_name: Name for the cross-tenant connection. + :type scope_connection_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: None, or the result of cls(response) + :rtype: None + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + + request = build_delete_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + network_manager_name=network_manager_name, + scope_connection_name=scope_connection_name, + template_url=self.delete.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200, 204]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + if cls: + return cls(pipeline_response, None, {}) + + delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/networkManagers/{networkManagerName}/scopeConnections/{scopeConnectionName}'} # type: ignore + + + @distributed_trace + def list( + self, + resource_group_name: str, + network_manager_name: str, + top: Optional[int] = None, + skip_token: Optional[str] = None, + **kwargs: Any + ) -> Iterable["_models.ScopeConnectionListResult"]: + """List all scope connections created by this network manager. + + :param resource_group_name: The name of the resource group. + :type resource_group_name: str + :param network_manager_name: The name of the network manager. + :type network_manager_name: str + :param top: An optional query parameter which specifies the maximum number of records to be + returned by the server. + :type top: int + :param skip_token: SkipToken is only used if a previous operation returned a partial result. If + a previous response contains a nextLink element, the value of the nextLink element will include + a skipToken parameter that specifies a starting point to use for subsequent calls. + :type skip_token: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either ScopeConnectionListResult or the result of + cls(response) + :rtype: + ~azure.core.paging.ItemPaged[~azure.mgmt.network.v2021_05_01_preview.models.ScopeConnectionListResult] + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.ScopeConnectionListResult"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + def prepare_request(next_link=None): + if not next_link: + + request = build_list_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + network_manager_name=network_manager_name, + top=top, + skip_token=skip_token, + template_url=self.list.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + else: + + request = build_list_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + network_manager_name=network_manager_name, + top=top, + skip_token=skip_token, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" + return request + + def extract_data(pipeline_response): + deserialized = self._deserialize("ScopeConnectionListResult", pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) + return deserialized.next_link or None, iter(list_of_elem) + + def get_next(next_link=None): + request = prepare_request(next_link) + + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + return pipeline_response + + + return ItemPaged( + get_next, extract_data + ) + list.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/networkManagers/{networkManagerName}/scopeConnections'} # type: ignore diff --git a/src/network-manager/azext_network_manager/vendored_sdks/operations/_security_admin_configurations_operations.py b/src/network-manager/azext_network_manager/vendored_sdks/operations/_security_admin_configurations_operations.py index ba11d9a55e7..d4bc47f1ac3 100644 --- a/src/network-manager/azext_network_manager/vendored_sdks/operations/_security_admin_configurations_operations.py +++ b/src/network-manager/azext_network_manager/vendored_sdks/operations/_security_admin_configurations_operations.py @@ -5,23 +5,195 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import TYPE_CHECKING +import functools +from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar, Union import warnings from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.paging import ItemPaged from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import HttpRequest, HttpResponse +from azure.core.pipeline.transport import HttpResponse +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace from azure.mgmt.core.exceptions import ARMErrorFormat +from msrest import Serializer from .. import models as _models - -if TYPE_CHECKING: - # pylint: disable=unused-import,ungrouped-imports - from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar, Union - - T = TypeVar('T') - ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] +from .._vendor import _convert_request, _format_url_section +T = TypeVar('T') +JSONType = Any +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] + +_SERIALIZER = Serializer() +_SERIALIZER.client_side_validation = False + +def build_list_request( + subscription_id: str, + resource_group_name: str, + network_manager_name: str, + *, + top: Optional[int] = None, + skip_token: Optional[str] = None, + **kwargs: Any +) -> HttpRequest: + api_version = "2021-05-01-preview" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/networkManagers/{networkManagerName}/securityAdminConfigurations') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "networkManagerName": _SERIALIZER.url("network_manager_name", network_manager_name, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + if top is not None: + query_parameters['$top'] = _SERIALIZER.query("top", top, 'int', maximum=20, minimum=1) + if skip_token is not None: + query_parameters['$skipToken'] = _SERIALIZER.query("skip_token", skip_token, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_get_request( + subscription_id: str, + resource_group_name: str, + network_manager_name: str, + configuration_name: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2021-05-01-preview" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/networkManagers/{networkManagerName}/securityAdminConfigurations/{configurationName}') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "networkManagerName": _SERIALIZER.url("network_manager_name", network_manager_name, 'str'), + "configurationName": _SERIALIZER.url("configuration_name", configuration_name, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_create_or_update_request( + subscription_id: str, + resource_group_name: str, + network_manager_name: str, + configuration_name: str, + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any +) -> HttpRequest: + content_type = kwargs.pop('content_type', None) # type: Optional[str] + + api_version = "2021-05-01-preview" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/networkManagers/{networkManagerName}/securityAdminConfigurations/{configurationName}') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "networkManagerName": _SERIALIZER.url("network_manager_name", network_manager_name, 'str'), + "configurationName": _SERIALIZER.url("configuration_name", configuration_name, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + if content_type is not None: + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="PUT", + url=url, + params=query_parameters, + headers=header_parameters, + json=json, + content=content, + **kwargs + ) + + +def build_delete_request( + subscription_id: str, + resource_group_name: str, + network_manager_name: str, + configuration_name: str, + *, + force: Optional[bool] = None, + recursive: Optional[bool] = None, + **kwargs: Any +) -> HttpRequest: + api_version = "2021-05-01-preview" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/networkManagers/{networkManagerName}/securityAdminConfigurations/{configurationName}') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "networkManagerName": _SERIALIZER.url("network_manager_name", network_manager_name, 'str'), + "configurationName": _SERIALIZER.url("configuration_name", configuration_name, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + if force is not None: + query_parameters['force'] = _SERIALIZER.query("force", force, 'bool') + if recursive is not None: + query_parameters['recursive'] = _SERIALIZER.query("recursive", recursive, 'bool') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="DELETE", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) class SecurityAdminConfigurationsOperations(object): """SecurityAdminConfigurationsOperations operations. @@ -30,7 +202,7 @@ class SecurityAdminConfigurationsOperations(object): instantiates it for you and attaches it as an attribute. :ivar models: Alias to model classes used in this operation group. - :type models: ~azure.mgmt.network.v2021_02_01_preview.models + :type models: ~azure.mgmt.network.v2021_05_01_preview.models :param client: Client for service requests. :param config: Configuration of service client. :param serializer: An object model serializer. @@ -45,15 +217,15 @@ def __init__(self, client, config, serializer, deserializer): self._deserialize = deserializer self._config = config + @distributed_trace def list( self, - resource_group_name, # type: str - network_manager_name, # type: str - top=None, # type: Optional[int] - skip_token=None, # type: Optional[str] - **kwargs # type: Any - ): - # type: (...) -> Iterable["_models.SecurityConfigurationListResult"] + resource_group_name: str, + network_manager_name: str, + top: Optional[int] = None, + skip_token: Optional[str] = None, + **kwargs: Any + ) -> Iterable["_models.SecurityConfigurationListResult"]: """Lists all the network manager security admin configurations in a network manager, in a paginated format. @@ -69,8 +241,10 @@ def list( a skipToken parameter that specifies a starting point to use for subsequent calls. :type skip_token: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either SecurityConfigurationListResult or the result of cls(response) - :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.network.v2021_02_01_preview.models.SecurityConfigurationListResult] + :return: An iterator like instance of either SecurityConfigurationListResult or the result of + cls(response) + :rtype: + ~azure.core.paging.ItemPaged[~azure.mgmt.network.v2021_05_01_preview.models.SecurityConfigurationListResult] :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.SecurityConfigurationListResult"] @@ -78,40 +252,37 @@ def list( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-02-01-preview" - accept = "application/json" - def prepare_request(next_link=None): - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - if not next_link: - # Construct URL - url = self.list.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'networkManagerName': self._serialize.url("network_manager_name", network_manager_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - if top is not None: - query_parameters['$top'] = self._serialize.query("top", top, 'int', maximum=20, minimum=1) - if skip_token is not None: - query_parameters['$skipToken'] = self._serialize.query("skip_token", skip_token, 'str') - - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + network_manager_name=network_manager_name, + top=top, + skip_token=skip_token, + template_url=self.list.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + network_manager_name=network_manager_name, + top=top, + skip_token=skip_token, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request def extract_data(pipeline_response): - deserialized = self._deserialize('SecurityConfigurationListResult', pipeline_response) + deserialized = self._deserialize("SecurityConfigurationListResult", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -129,30 +300,31 @@ def get_next(next_link=None): return pipeline_response + return ItemPaged( get_next, extract_data ) list.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/networkManagers/{networkManagerName}/securityAdminConfigurations'} # type: ignore + @distributed_trace def get( self, - resource_group_name, # type: str - network_manager_name, # type: str - configuration_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> "_models.SecurityConfiguration" + resource_group_name: str, + network_manager_name: str, + configuration_name: str, + **kwargs: Any + ) -> "_models.SecurityConfiguration": """Retrieves a network manager security admin configuration. :param resource_group_name: The name of the resource group. :type resource_group_name: str :param network_manager_name: The name of the network manager. :type network_manager_name: str - :param configuration_name: The name of the network manager security Configuration. + :param configuration_name: The name of the network manager Security Configuration. :type configuration_name: str :keyword callable cls: A custom type or function that will be passed the direct response :return: SecurityConfiguration, or the result of cls(response) - :rtype: ~azure.mgmt.network.v2021_02_01_preview.models.SecurityConfiguration + :rtype: ~azure.mgmt.network.v2021_05_01_preview.models.SecurityConfiguration :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.SecurityConfiguration"] @@ -160,28 +332,18 @@ def get( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-02-01-preview" - accept = "application/json" - - # Construct URL - url = self.get.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'networkManagerName': self._serialize.url("network_manager_name", network_manager_name, 'str'), - 'configurationName': self._serialize.url("configuration_name", configuration_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_get_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + network_manager_name=network_manager_name, + configuration_name=configuration_name, + template_url=self.get.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.get(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -195,30 +357,33 @@ def get( return cls(pipeline_response, deserialized, {}) return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/networkManagers/{networkManagerName}/securityAdminConfigurations/{configurationName}'} # type: ignore + + @distributed_trace def create_or_update( self, - resource_group_name, # type: str - network_manager_name, # type: str - configuration_name, # type: str - security_admin_configuration, # type: "_models.SecurityConfiguration" - **kwargs # type: Any - ): - # type: (...) -> "_models.SecurityConfiguration" + resource_group_name: str, + network_manager_name: str, + configuration_name: str, + security_admin_configuration: "_models.SecurityConfiguration", + **kwargs: Any + ) -> "_models.SecurityConfiguration": """Creates or updates a network manager security admin configuration. :param resource_group_name: The name of the resource group. :type resource_group_name: str :param network_manager_name: The name of the network manager. :type network_manager_name: str - :param configuration_name: The name of the network manager security Configuration. + :param configuration_name: The name of the network manager Security Configuration. :type configuration_name: str :param security_admin_configuration: The security admin configuration to create or update. - :type security_admin_configuration: ~azure.mgmt.network.v2021_02_01_preview.models.SecurityConfiguration + :type security_admin_configuration: + ~azure.mgmt.network.v2021_05_01_preview.models.SecurityConfiguration :keyword callable cls: A custom type or function that will be passed the direct response :return: SecurityConfiguration, or the result of cls(response) - :rtype: ~azure.mgmt.network.v2021_02_01_preview.models.SecurityConfiguration + :rtype: ~azure.mgmt.network.v2021_05_01_preview.models.SecurityConfiguration :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.SecurityConfiguration"] @@ -226,33 +391,23 @@ def create_or_update( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-02-01-preview" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self.create_or_update.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'networkManagerName': self._serialize.url("network_manager_name", network_manager_name, 'str'), - 'configurationName': self._serialize.url("configuration_name", configuration_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + _json = self._serialize.body(security_admin_configuration, 'SecurityConfiguration') + + request = build_create_or_update_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + network_manager_name=network_manager_name, + configuration_name=configuration_name, + content_type=content_type, + json=_json, + template_url=self.create_or_update.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(security_admin_configuration, 'SecurityConfiguration') - body_content_kwargs['content'] = body_content - request = self._client.put(url, query_parameters, header_parameters, **body_content_kwargs) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -270,24 +425,36 @@ def create_or_update( return cls(pipeline_response, deserialized, {}) return deserialized + create_or_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/networkManagers/{networkManagerName}/securityAdminConfigurations/{configurationName}'} # type: ignore + + @distributed_trace def delete( self, - resource_group_name, # type: str - network_manager_name, # type: str - configuration_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> None + resource_group_name: str, + network_manager_name: str, + configuration_name: str, + force: Optional[bool] = None, + recursive: Optional[bool] = None, + **kwargs: Any + ) -> None: """Deletes a network manager security admin configuration. :param resource_group_name: The name of the resource group. :type resource_group_name: str :param network_manager_name: The name of the network manager. :type network_manager_name: str - :param configuration_name: The name of the network manager security Configuration. + :param configuration_name: The name of the network manager Security Configuration. :type configuration_name: str + :param force: Deletes the resource even if it is part of a deployed configuration. If the + configuration has been deployed, the service will do a cleanup deployment in the background, + prior to the delete. + :type force: bool + :param recursive: Deletes the resource recursively. When present in a security configuration + delete, all rule collections and rules within the configuration will be deleted. When present + in a rule collection delete, all rules within the collection will be deleted. + :type recursive: bool :keyword callable cls: A custom type or function that will be passed the direct response :return: None, or the result of cls(response) :rtype: None @@ -298,28 +465,20 @@ def delete( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-02-01-preview" - accept = "application/json" - - # Construct URL - url = self.delete.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'networkManagerName': self._serialize.url("network_manager_name", network_manager_name, 'str'), - 'configurationName': self._serialize.url("configuration_name", configuration_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_delete_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + network_manager_name=network_manager_name, + configuration_name=configuration_name, + force=force, + recursive=recursive, + template_url=self.delete.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.delete(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -331,3 +490,4 @@ def delete( return cls(pipeline_response, None, {}) delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/networkManagers/{networkManagerName}/securityAdminConfigurations/{configurationName}'} # type: ignore + diff --git a/src/network-manager/azext_network_manager/vendored_sdks/operations/_security_user_configurations_operations.py b/src/network-manager/azext_network_manager/vendored_sdks/operations/_security_user_configurations_operations.py index b3befcb62c6..afe0c319c4d 100644 --- a/src/network-manager/azext_network_manager/vendored_sdks/operations/_security_user_configurations_operations.py +++ b/src/network-manager/azext_network_manager/vendored_sdks/operations/_security_user_configurations_operations.py @@ -5,23 +5,195 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import TYPE_CHECKING +import functools +from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar, Union import warnings from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.paging import ItemPaged from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import HttpRequest, HttpResponse +from azure.core.pipeline.transport import HttpResponse +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace from azure.mgmt.core.exceptions import ARMErrorFormat +from msrest import Serializer from .. import models as _models - -if TYPE_CHECKING: - # pylint: disable=unused-import,ungrouped-imports - from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar, Union - - T = TypeVar('T') - ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] +from .._vendor import _convert_request, _format_url_section +T = TypeVar('T') +JSONType = Any +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] + +_SERIALIZER = Serializer() +_SERIALIZER.client_side_validation = False + +def build_list_request( + subscription_id: str, + resource_group_name: str, + network_manager_name: str, + *, + top: Optional[int] = None, + skip_token: Optional[str] = None, + **kwargs: Any +) -> HttpRequest: + api_version = "2021-05-01-preview" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/networkManagers/{networkManagerName}/securityUserConfigurations') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "networkManagerName": _SERIALIZER.url("network_manager_name", network_manager_name, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + if top is not None: + query_parameters['$top'] = _SERIALIZER.query("top", top, 'int', maximum=20, minimum=1) + if skip_token is not None: + query_parameters['$skipToken'] = _SERIALIZER.query("skip_token", skip_token, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_get_request( + subscription_id: str, + resource_group_name: str, + network_manager_name: str, + configuration_name: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2021-05-01-preview" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/networkManagers/{networkManagerName}/securityUserConfigurations/{configurationName}') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "networkManagerName": _SERIALIZER.url("network_manager_name", network_manager_name, 'str'), + "configurationName": _SERIALIZER.url("configuration_name", configuration_name, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_create_or_update_request( + subscription_id: str, + resource_group_name: str, + network_manager_name: str, + configuration_name: str, + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any +) -> HttpRequest: + content_type = kwargs.pop('content_type', None) # type: Optional[str] + + api_version = "2021-05-01-preview" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/networkManagers/{networkManagerName}/securityUserConfigurations/{configurationName}') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "networkManagerName": _SERIALIZER.url("network_manager_name", network_manager_name, 'str'), + "configurationName": _SERIALIZER.url("configuration_name", configuration_name, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + if content_type is not None: + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="PUT", + url=url, + params=query_parameters, + headers=header_parameters, + json=json, + content=content, + **kwargs + ) + + +def build_delete_request( + subscription_id: str, + resource_group_name: str, + network_manager_name: str, + configuration_name: str, + *, + force: Optional[bool] = None, + recursive: Optional[bool] = None, + **kwargs: Any +) -> HttpRequest: + api_version = "2021-05-01-preview" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/networkManagers/{networkManagerName}/securityUserConfigurations/{configurationName}') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "networkManagerName": _SERIALIZER.url("network_manager_name", network_manager_name, 'str'), + "configurationName": _SERIALIZER.url("configuration_name", configuration_name, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + if force is not None: + query_parameters['force'] = _SERIALIZER.query("force", force, 'bool') + if recursive is not None: + query_parameters['recursive'] = _SERIALIZER.query("recursive", recursive, 'bool') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="DELETE", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) class SecurityUserConfigurationsOperations(object): """SecurityUserConfigurationsOperations operations. @@ -30,7 +202,7 @@ class SecurityUserConfigurationsOperations(object): instantiates it for you and attaches it as an attribute. :ivar models: Alias to model classes used in this operation group. - :type models: ~azure.mgmt.network.v2021_02_01_preview.models + :type models: ~azure.mgmt.network.v2021_05_01_preview.models :param client: Client for service requests. :param config: Configuration of service client. :param serializer: An object model serializer. @@ -45,15 +217,15 @@ def __init__(self, client, config, serializer, deserializer): self._deserialize = deserializer self._config = config + @distributed_trace def list( self, - resource_group_name, # type: str - network_manager_name, # type: str - top=None, # type: Optional[int] - skip_token=None, # type: Optional[str] - **kwargs # type: Any - ): - # type: (...) -> Iterable["_models.SecurityConfigurationListResult"] + resource_group_name: str, + network_manager_name: str, + top: Optional[int] = None, + skip_token: Optional[str] = None, + **kwargs: Any + ) -> Iterable["_models.SecurityConfigurationListResult"]: """Lists all the network manager security user configurations in a network manager, in a paginated format. @@ -69,8 +241,10 @@ def list( a skipToken parameter that specifies a starting point to use for subsequent calls. :type skip_token: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either SecurityConfigurationListResult or the result of cls(response) - :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.network.v2021_02_01_preview.models.SecurityConfigurationListResult] + :return: An iterator like instance of either SecurityConfigurationListResult or the result of + cls(response) + :rtype: + ~azure.core.paging.ItemPaged[~azure.mgmt.network.v2021_05_01_preview.models.SecurityConfigurationListResult] :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.SecurityConfigurationListResult"] @@ -78,40 +252,37 @@ def list( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-02-01-preview" - accept = "application/json" - def prepare_request(next_link=None): - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - if not next_link: - # Construct URL - url = self.list.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'networkManagerName': self._serialize.url("network_manager_name", network_manager_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - if top is not None: - query_parameters['$top'] = self._serialize.query("top", top, 'int', maximum=20, minimum=1) - if skip_token is not None: - query_parameters['$skipToken'] = self._serialize.query("skip_token", skip_token, 'str') - - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + network_manager_name=network_manager_name, + top=top, + skip_token=skip_token, + template_url=self.list.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + network_manager_name=network_manager_name, + top=top, + skip_token=skip_token, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request def extract_data(pipeline_response): - deserialized = self._deserialize('SecurityConfigurationListResult', pipeline_response) + deserialized = self._deserialize("SecurityConfigurationListResult", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -129,30 +300,31 @@ def get_next(next_link=None): return pipeline_response + return ItemPaged( get_next, extract_data ) list.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/networkManagers/{networkManagerName}/securityUserConfigurations'} # type: ignore + @distributed_trace def get( self, - resource_group_name, # type: str - network_manager_name, # type: str - configuration_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> "_models.SecurityConfiguration" + resource_group_name: str, + network_manager_name: str, + configuration_name: str, + **kwargs: Any + ) -> "_models.SecurityConfiguration": """Retrieves a network manager security user configuration. :param resource_group_name: The name of the resource group. :type resource_group_name: str :param network_manager_name: The name of the network manager. :type network_manager_name: str - :param configuration_name: The name of the network manager security Configuration. + :param configuration_name: The name of the network manager Security Configuration. :type configuration_name: str :keyword callable cls: A custom type or function that will be passed the direct response :return: SecurityConfiguration, or the result of cls(response) - :rtype: ~azure.mgmt.network.v2021_02_01_preview.models.SecurityConfiguration + :rtype: ~azure.mgmt.network.v2021_05_01_preview.models.SecurityConfiguration :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.SecurityConfiguration"] @@ -160,28 +332,18 @@ def get( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-02-01-preview" - accept = "application/json" - - # Construct URL - url = self.get.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'networkManagerName': self._serialize.url("network_manager_name", network_manager_name, 'str'), - 'configurationName': self._serialize.url("configuration_name", configuration_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_get_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + network_manager_name=network_manager_name, + configuration_name=configuration_name, + template_url=self.get.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.get(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -195,30 +357,33 @@ def get( return cls(pipeline_response, deserialized, {}) return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/networkManagers/{networkManagerName}/securityUserConfigurations/{configurationName}'} # type: ignore + + @distributed_trace def create_or_update( self, - resource_group_name, # type: str - network_manager_name, # type: str - configuration_name, # type: str - security_user_configuration, # type: "_models.SecurityConfiguration" - **kwargs # type: Any - ): - # type: (...) -> "_models.SecurityConfiguration" + resource_group_name: str, + network_manager_name: str, + configuration_name: str, + security_user_configuration: "_models.SecurityConfiguration", + **kwargs: Any + ) -> "_models.SecurityConfiguration": """Creates or updates a network manager security user configuration. :param resource_group_name: The name of the resource group. :type resource_group_name: str :param network_manager_name: The name of the network manager. :type network_manager_name: str - :param configuration_name: The name of the network manager security Configuration. + :param configuration_name: The name of the network manager Security Configuration. :type configuration_name: str :param security_user_configuration: The security user configuration to create or update. - :type security_user_configuration: ~azure.mgmt.network.v2021_02_01_preview.models.SecurityConfiguration + :type security_user_configuration: + ~azure.mgmt.network.v2021_05_01_preview.models.SecurityConfiguration :keyword callable cls: A custom type or function that will be passed the direct response :return: SecurityConfiguration, or the result of cls(response) - :rtype: ~azure.mgmt.network.v2021_02_01_preview.models.SecurityConfiguration + :rtype: ~azure.mgmt.network.v2021_05_01_preview.models.SecurityConfiguration :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.SecurityConfiguration"] @@ -226,33 +391,23 @@ def create_or_update( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-02-01-preview" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self.create_or_update.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'networkManagerName': self._serialize.url("network_manager_name", network_manager_name, 'str'), - 'configurationName': self._serialize.url("configuration_name", configuration_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + _json = self._serialize.body(security_user_configuration, 'SecurityConfiguration') + + request = build_create_or_update_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + network_manager_name=network_manager_name, + configuration_name=configuration_name, + content_type=content_type, + json=_json, + template_url=self.create_or_update.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(security_user_configuration, 'SecurityConfiguration') - body_content_kwargs['content'] = body_content - request = self._client.put(url, query_parameters, header_parameters, **body_content_kwargs) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -270,24 +425,36 @@ def create_or_update( return cls(pipeline_response, deserialized, {}) return deserialized + create_or_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/networkManagers/{networkManagerName}/securityUserConfigurations/{configurationName}'} # type: ignore + + @distributed_trace def delete( self, - resource_group_name, # type: str - network_manager_name, # type: str - configuration_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> None + resource_group_name: str, + network_manager_name: str, + configuration_name: str, + force: Optional[bool] = None, + recursive: Optional[bool] = None, + **kwargs: Any + ) -> None: """Deletes a network manager security user configuration. :param resource_group_name: The name of the resource group. :type resource_group_name: str :param network_manager_name: The name of the network manager. :type network_manager_name: str - :param configuration_name: The name of the network manager security Configuration. + :param configuration_name: The name of the network manager Security Configuration. :type configuration_name: str + :param force: Deletes the resource even if it is part of a deployed configuration. If the + configuration has been deployed, the service will do a cleanup deployment in the background, + prior to the delete. + :type force: bool + :param recursive: Deletes the resource recursively. When present in a security configuration + delete, all rule collections and rules within the configuration will be deleted. When present + in a rule collection delete, all rules within the collection will be deleted. + :type recursive: bool :keyword callable cls: A custom type or function that will be passed the direct response :return: None, or the result of cls(response) :rtype: None @@ -298,28 +465,20 @@ def delete( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-02-01-preview" - accept = "application/json" - - # Construct URL - url = self.delete.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'networkManagerName': self._serialize.url("network_manager_name", network_manager_name, 'str'), - 'configurationName': self._serialize.url("configuration_name", configuration_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_delete_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + network_manager_name=network_manager_name, + configuration_name=configuration_name, + force=force, + recursive=recursive, + template_url=self.delete.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.delete(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -331,3 +490,4 @@ def delete( return cls(pipeline_response, None, {}) delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/networkManagers/{networkManagerName}/securityUserConfigurations/{configurationName}'} # type: ignore + diff --git a/src/network-manager/azext_network_manager/vendored_sdks/operations/_static_members_operations.py b/src/network-manager/azext_network_manager/vendored_sdks/operations/_static_members_operations.py new file mode 100644 index 00000000000..6f5d5f1f175 --- /dev/null +++ b/src/network-manager/azext_network_manager/vendored_sdks/operations/_static_members_operations.py @@ -0,0 +1,497 @@ +# 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 functools +from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar, Union +import warnings + +from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +from azure.core.paging import ItemPaged +from azure.core.pipeline import PipelineResponse +from azure.core.pipeline.transport import HttpResponse +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace +from azure.mgmt.core.exceptions import ARMErrorFormat +from msrest import Serializer + +from .. import models as _models +from .._vendor import _convert_request, _format_url_section +T = TypeVar('T') +JSONType = Any +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] + +_SERIALIZER = Serializer() +_SERIALIZER.client_side_validation = False + +def build_get_request( + subscription_id: str, + resource_group_name: str, + network_manager_name: str, + network_group_name: str, + static_member_name: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2021-05-01-preview" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/networkManagers/{networkManagerName}/networkGroups/{networkGroupName}/staticMembers/{staticMemberName}') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "networkManagerName": _SERIALIZER.url("network_manager_name", network_manager_name, 'str'), + "networkGroupName": _SERIALIZER.url("network_group_name", network_group_name, 'str'), + "staticMemberName": _SERIALIZER.url("static_member_name", static_member_name, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_create_or_update_request( + subscription_id: str, + resource_group_name: str, + network_manager_name: str, + network_group_name: str, + static_member_name: str, + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any +) -> HttpRequest: + content_type = kwargs.pop('content_type', None) # type: Optional[str] + + api_version = "2021-05-01-preview" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/networkManagers/{networkManagerName}/networkGroups/{networkGroupName}/staticMembers/{staticMemberName}') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "networkManagerName": _SERIALIZER.url("network_manager_name", network_manager_name, 'str'), + "networkGroupName": _SERIALIZER.url("network_group_name", network_group_name, 'str'), + "staticMemberName": _SERIALIZER.url("static_member_name", static_member_name, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + if content_type is not None: + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="PUT", + url=url, + params=query_parameters, + headers=header_parameters, + json=json, + content=content, + **kwargs + ) + + +def build_delete_request( + subscription_id: str, + resource_group_name: str, + network_manager_name: str, + network_group_name: str, + static_member_name: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2021-05-01-preview" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/networkManagers/{networkManagerName}/networkGroups/{networkGroupName}/staticMembers/{staticMemberName}') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "networkManagerName": _SERIALIZER.url("network_manager_name", network_manager_name, 'str'), + "networkGroupName": _SERIALIZER.url("network_group_name", network_group_name, 'str'), + "staticMemberName": _SERIALIZER.url("static_member_name", static_member_name, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="DELETE", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_list_request( + subscription_id: str, + resource_group_name: str, + network_manager_name: str, + network_group_name: str, + *, + top: Optional[int] = None, + skip_token: Optional[str] = None, + **kwargs: Any +) -> HttpRequest: + api_version = "2021-05-01-preview" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/networkManagers/{networkManagerName}/networkGroups/{networkGroupName}/staticMembers') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "networkManagerName": _SERIALIZER.url("network_manager_name", network_manager_name, 'str'), + "networkGroupName": _SERIALIZER.url("network_group_name", network_group_name, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + if top is not None: + query_parameters['$top'] = _SERIALIZER.query("top", top, 'int', maximum=20, minimum=1) + if skip_token is not None: + query_parameters['$skipToken'] = _SERIALIZER.query("skip_token", skip_token, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + +class StaticMembersOperations(object): + """StaticMembersOperations operations. + + You should not instantiate this class directly. Instead, you should create a Client instance that + instantiates it for you and attaches it as an attribute. + + :ivar models: Alias to model classes used in this operation group. + :type models: ~azure.mgmt.network.v2021_05_01_preview.models + :param client: Client for service requests. + :param config: Configuration of service client. + :param serializer: An object model serializer. + :param deserializer: An object model deserializer. + """ + + models = _models + + def __init__(self, client, config, serializer, deserializer): + self._client = client + self._serialize = serializer + self._deserialize = deserializer + self._config = config + + @distributed_trace + def get( + self, + resource_group_name: str, + network_manager_name: str, + network_group_name: str, + static_member_name: str, + **kwargs: Any + ) -> "_models.StaticMember": + """Gets the specified static member. + + :param resource_group_name: The name of the resource group. + :type resource_group_name: str + :param network_manager_name: The name of the network manager. + :type network_manager_name: str + :param network_group_name: The name of the network group. + :type network_group_name: str + :param static_member_name: The name of the static member. + :type static_member_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: StaticMember, or the result of cls(response) + :rtype: ~azure.mgmt.network.v2021_05_01_preview.models.StaticMember + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.StaticMember"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + + request = build_get_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + network_manager_name=network_manager_name, + network_group_name=network_group_name, + static_member_name=static_member_name, + template_url=self.get.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = self._deserialize('StaticMember', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/networkManagers/{networkManagerName}/networkGroups/{networkGroupName}/staticMembers/{staticMemberName}'} # type: ignore + + + @distributed_trace + def create_or_update( + self, + resource_group_name: str, + network_manager_name: str, + network_group_name: str, + static_member_name: str, + parameters: "_models.StaticMember", + **kwargs: Any + ) -> "_models.StaticMember": + """Creates or updates a static member. + + :param resource_group_name: The name of the resource group. + :type resource_group_name: str + :param network_manager_name: The name of the network manager. + :type network_manager_name: str + :param network_group_name: The name of the network group. + :type network_group_name: str + :param static_member_name: The name of the static member. + :type static_member_name: str + :param parameters: Parameters supplied to the specify the static member to create. + :type parameters: ~azure.mgmt.network.v2021_05_01_preview.models.StaticMember + :keyword callable cls: A custom type or function that will be passed the direct response + :return: StaticMember, or the result of cls(response) + :rtype: ~azure.mgmt.network.v2021_05_01_preview.models.StaticMember + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.StaticMember"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + + _json = self._serialize.body(parameters, 'StaticMember') + + request = build_create_or_update_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + network_manager_name=network_manager_name, + network_group_name=network_group_name, + static_member_name=static_member_name, + content_type=content_type, + json=_json, + template_url=self.create_or_update.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200, 201]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + if response.status_code == 200: + deserialized = self._deserialize('StaticMember', pipeline_response) + + if response.status_code == 201: + deserialized = self._deserialize('StaticMember', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + create_or_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/networkManagers/{networkManagerName}/networkGroups/{networkGroupName}/staticMembers/{staticMemberName}'} # type: ignore + + + @distributed_trace + def delete( + self, + resource_group_name: str, + network_manager_name: str, + network_group_name: str, + static_member_name: str, + **kwargs: Any + ) -> None: + """Deletes a static member. + + :param resource_group_name: The name of the resource group. + :type resource_group_name: str + :param network_manager_name: The name of the network manager. + :type network_manager_name: str + :param network_group_name: The name of the network group. + :type network_group_name: str + :param static_member_name: The name of the static member. + :type static_member_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: None, or the result of cls(response) + :rtype: None + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + + request = build_delete_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + network_manager_name=network_manager_name, + network_group_name=network_group_name, + static_member_name=static_member_name, + template_url=self.delete.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200, 204]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + if cls: + return cls(pipeline_response, None, {}) + + delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/networkManagers/{networkManagerName}/networkGroups/{networkGroupName}/staticMembers/{staticMemberName}'} # type: ignore + + + @distributed_trace + def list( + self, + resource_group_name: str, + network_manager_name: str, + network_group_name: str, + top: Optional[int] = None, + skip_token: Optional[str] = None, + **kwargs: Any + ) -> Iterable["_models.StaticMemberListResult"]: + """Lists the specified static member. + + :param resource_group_name: The name of the resource group. + :type resource_group_name: str + :param network_manager_name: The name of the network manager. + :type network_manager_name: str + :param network_group_name: The name of the network group. + :type network_group_name: str + :param top: An optional query parameter which specifies the maximum number of records to be + returned by the server. + :type top: int + :param skip_token: SkipToken is only used if a previous operation returned a partial result. If + a previous response contains a nextLink element, the value of the nextLink element will include + a skipToken parameter that specifies a starting point to use for subsequent calls. + :type skip_token: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either StaticMemberListResult or the result of + cls(response) + :rtype: + ~azure.core.paging.ItemPaged[~azure.mgmt.network.v2021_05_01_preview.models.StaticMemberListResult] + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.StaticMemberListResult"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + def prepare_request(next_link=None): + if not next_link: + + request = build_list_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + network_manager_name=network_manager_name, + network_group_name=network_group_name, + top=top, + skip_token=skip_token, + template_url=self.list.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + else: + + request = build_list_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + network_manager_name=network_manager_name, + network_group_name=network_group_name, + top=top, + skip_token=skip_token, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" + return request + + def extract_data(pipeline_response): + deserialized = self._deserialize("StaticMemberListResult", pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) + return deserialized.next_link or None, iter(list_of_elem) + + def get_next(next_link=None): + request = prepare_request(next_link) + + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + return pipeline_response + + + return ItemPaged( + get_next, extract_data + ) + list.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/networkManagers/{networkManagerName}/networkGroups/{networkGroupName}/staticMembers'} # type: ignore diff --git a/src/network-manager/azext_network_manager/vendored_sdks/operations/_subscription_network_manager_connections_operations.py b/src/network-manager/azext_network_manager/vendored_sdks/operations/_subscription_network_manager_connections_operations.py new file mode 100644 index 00000000000..f8375acc6b9 --- /dev/null +++ b/src/network-manager/azext_network_manager/vendored_sdks/operations/_subscription_network_manager_connections_operations.py @@ -0,0 +1,422 @@ +# 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 functools +from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar, Union +import warnings + +from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +from azure.core.paging import ItemPaged +from azure.core.pipeline import PipelineResponse +from azure.core.pipeline.transport import HttpResponse +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace +from azure.mgmt.core.exceptions import ARMErrorFormat +from msrest import Serializer + +from .. import models as _models +from .._vendor import _convert_request, _format_url_section +T = TypeVar('T') +JSONType = Any +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] + +_SERIALIZER = Serializer() +_SERIALIZER.client_side_validation = False + +def build_create_or_update_request( + subscription_id: str, + network_manager_connection_name: str, + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any +) -> HttpRequest: + content_type = kwargs.pop('content_type', None) # type: Optional[str] + + api_version = "2021-05-01-preview" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/providers/Microsoft.Network/networkManagerConnections/{networkManagerConnectionName}') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "networkManagerConnectionName": _SERIALIZER.url("network_manager_connection_name", network_manager_connection_name, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + if content_type is not None: + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="PUT", + url=url, + params=query_parameters, + headers=header_parameters, + json=json, + content=content, + **kwargs + ) + + +def build_get_request( + subscription_id: str, + network_manager_connection_name: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2021-05-01-preview" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/providers/Microsoft.Network/networkManagerConnections/{networkManagerConnectionName}') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "networkManagerConnectionName": _SERIALIZER.url("network_manager_connection_name", network_manager_connection_name, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_delete_request( + subscription_id: str, + network_manager_connection_name: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2021-05-01-preview" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/providers/Microsoft.Network/networkManagerConnections/{networkManagerConnectionName}') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "networkManagerConnectionName": _SERIALIZER.url("network_manager_connection_name", network_manager_connection_name, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="DELETE", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_list_request( + subscription_id: str, + *, + top: Optional[int] = None, + skip_token: Optional[str] = None, + **kwargs: Any +) -> HttpRequest: + api_version = "2021-05-01-preview" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/providers/Microsoft.Network/networkManagerConnections') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + if top is not None: + query_parameters['$top'] = _SERIALIZER.query("top", top, 'int', maximum=20, minimum=1) + if skip_token is not None: + query_parameters['$skipToken'] = _SERIALIZER.query("skip_token", skip_token, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + +class SubscriptionNetworkManagerConnectionsOperations(object): + """SubscriptionNetworkManagerConnectionsOperations operations. + + You should not instantiate this class directly. Instead, you should create a Client instance that + instantiates it for you and attaches it as an attribute. + + :ivar models: Alias to model classes used in this operation group. + :type models: ~azure.mgmt.network.v2021_05_01_preview.models + :param client: Client for service requests. + :param config: Configuration of service client. + :param serializer: An object model serializer. + :param deserializer: An object model deserializer. + """ + + models = _models + + def __init__(self, client, config, serializer, deserializer): + self._client = client + self._serialize = serializer + self._deserialize = deserializer + self._config = config + + @distributed_trace + def create_or_update( + self, + network_manager_connection_name: str, + parameters: "_models.NetworkManagerConnection", + **kwargs: Any + ) -> "_models.NetworkManagerConnection": + """Create a connection from this subscription to a cross tenant network manager. + + :param network_manager_connection_name: Name for the network manager connection. + :type network_manager_connection_name: str + :param parameters: Network manager connection to be created/updated. + :type parameters: ~azure.mgmt.network.v2021_05_01_preview.models.NetworkManagerConnection + :keyword callable cls: A custom type or function that will be passed the direct response + :return: NetworkManagerConnection, or the result of cls(response) + :rtype: ~azure.mgmt.network.v2021_05_01_preview.models.NetworkManagerConnection + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.NetworkManagerConnection"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + + _json = self._serialize.body(parameters, 'NetworkManagerConnection') + + request = build_create_or_update_request( + subscription_id=self._config.subscription_id, + network_manager_connection_name=network_manager_connection_name, + content_type=content_type, + json=_json, + template_url=self.create_or_update.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200, 201]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + if response.status_code == 200: + deserialized = self._deserialize('NetworkManagerConnection', pipeline_response) + + if response.status_code == 201: + deserialized = self._deserialize('NetworkManagerConnection', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + create_or_update.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.Network/networkManagerConnections/{networkManagerConnectionName}'} # type: ignore + + + @distributed_trace + def get( + self, + network_manager_connection_name: str, + **kwargs: Any + ) -> "_models.NetworkManagerConnection": + """Get a specified connection created by this subscription. + + :param network_manager_connection_name: Name for the network manager connection. + :type network_manager_connection_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: NetworkManagerConnection, or the result of cls(response) + :rtype: ~azure.mgmt.network.v2021_05_01_preview.models.NetworkManagerConnection + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.NetworkManagerConnection"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + + request = build_get_request( + subscription_id=self._config.subscription_id, + network_manager_connection_name=network_manager_connection_name, + template_url=self.get.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = self._deserialize('NetworkManagerConnection', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + get.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.Network/networkManagerConnections/{networkManagerConnectionName}'} # type: ignore + + + @distributed_trace + def delete( + self, + network_manager_connection_name: str, + **kwargs: Any + ) -> None: + """Delete specified pending connection created by this subscription. + + :param network_manager_connection_name: Name for the network manager connection. + :type network_manager_connection_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: None, or the result of cls(response) + :rtype: None + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + + request = build_delete_request( + subscription_id=self._config.subscription_id, + network_manager_connection_name=network_manager_connection_name, + template_url=self.delete.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200, 204]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + if cls: + return cls(pipeline_response, None, {}) + + delete.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.Network/networkManagerConnections/{networkManagerConnectionName}'} # type: ignore + + + @distributed_trace + def list( + self, + top: Optional[int] = None, + skip_token: Optional[str] = None, + **kwargs: Any + ) -> Iterable["_models.NetworkManagerConnectionListResult"]: + """List all network manager connections created by this subscription. + + :param top: An optional query parameter which specifies the maximum number of records to be + returned by the server. + :type top: int + :param skip_token: SkipToken is only used if a previous operation returned a partial result. If + a previous response contains a nextLink element, the value of the nextLink element will include + a skipToken parameter that specifies a starting point to use for subsequent calls. + :type skip_token: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either NetworkManagerConnectionListResult or the result + of cls(response) + :rtype: + ~azure.core.paging.ItemPaged[~azure.mgmt.network.v2021_05_01_preview.models.NetworkManagerConnectionListResult] + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.NetworkManagerConnectionListResult"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + def prepare_request(next_link=None): + if not next_link: + + request = build_list_request( + subscription_id=self._config.subscription_id, + top=top, + skip_token=skip_token, + template_url=self.list.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + else: + + request = build_list_request( + subscription_id=self._config.subscription_id, + top=top, + skip_token=skip_token, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" + return request + + def extract_data(pipeline_response): + deserialized = self._deserialize("NetworkManagerConnectionListResult", pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) + return deserialized.next_link or None, iter(list_of_elem) + + def get_next(next_link=None): + request = prepare_request(next_link) + + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + return pipeline_response + + + return ItemPaged( + get_next, extract_data + ) + list.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.Network/networkManagerConnections'} # type: ignore diff --git a/src/network-manager/azext_network_manager/vendored_sdks/operations/_user_rule_collections_operations.py b/src/network-manager/azext_network_manager/vendored_sdks/operations/_user_rule_collections_operations.py index a0b0d83a485..f2518ff462a 100644 --- a/src/network-manager/azext_network_manager/vendored_sdks/operations/_user_rule_collections_operations.py +++ b/src/network-manager/azext_network_manager/vendored_sdks/operations/_user_rule_collections_operations.py @@ -5,23 +5,203 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import TYPE_CHECKING +import functools +from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar, Union import warnings from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.paging import ItemPaged from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import HttpRequest, HttpResponse +from azure.core.pipeline.transport import HttpResponse +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace from azure.mgmt.core.exceptions import ARMErrorFormat +from msrest import Serializer from .. import models as _models - -if TYPE_CHECKING: - # pylint: disable=unused-import,ungrouped-imports - from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar, Union - - T = TypeVar('T') - ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] +from .._vendor import _convert_request, _format_url_section +T = TypeVar('T') +JSONType = Any +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] + +_SERIALIZER = Serializer() +_SERIALIZER.client_side_validation = False + +def build_list_request( + subscription_id: str, + resource_group_name: str, + network_manager_name: str, + configuration_name: str, + *, + top: Optional[int] = None, + skip_token: Optional[str] = None, + **kwargs: Any +) -> HttpRequest: + api_version = "2021-05-01-preview" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/networkManagers/{networkManagerName}/securityUserConfigurations/{configurationName}/ruleCollections') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "networkManagerName": _SERIALIZER.url("network_manager_name", network_manager_name, 'str'), + "configurationName": _SERIALIZER.url("configuration_name", configuration_name, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + if top is not None: + query_parameters['$top'] = _SERIALIZER.query("top", top, 'int', maximum=20, minimum=1) + if skip_token is not None: + query_parameters['$skipToken'] = _SERIALIZER.query("skip_token", skip_token, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_get_request( + subscription_id: str, + resource_group_name: str, + network_manager_name: str, + configuration_name: str, + rule_collection_name: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2021-05-01-preview" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/networkManagers/{networkManagerName}/securityUserConfigurations/{configurationName}/ruleCollections/{ruleCollectionName}') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "networkManagerName": _SERIALIZER.url("network_manager_name", network_manager_name, 'str'), + "configurationName": _SERIALIZER.url("configuration_name", configuration_name, 'str'), + "ruleCollectionName": _SERIALIZER.url("rule_collection_name", rule_collection_name, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_create_or_update_request( + subscription_id: str, + resource_group_name: str, + network_manager_name: str, + configuration_name: str, + rule_collection_name: str, + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any +) -> HttpRequest: + content_type = kwargs.pop('content_type', None) # type: Optional[str] + + api_version = "2021-05-01-preview" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/networkManagers/{networkManagerName}/securityUserConfigurations/{configurationName}/ruleCollections/{ruleCollectionName}') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "networkManagerName": _SERIALIZER.url("network_manager_name", network_manager_name, 'str'), + "configurationName": _SERIALIZER.url("configuration_name", configuration_name, 'str'), + "ruleCollectionName": _SERIALIZER.url("rule_collection_name", rule_collection_name, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + if content_type is not None: + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="PUT", + url=url, + params=query_parameters, + headers=header_parameters, + json=json, + content=content, + **kwargs + ) + + +def build_delete_request( + subscription_id: str, + resource_group_name: str, + network_manager_name: str, + configuration_name: str, + rule_collection_name: str, + *, + force: Optional[bool] = None, + recursive: Optional[bool] = None, + **kwargs: Any +) -> HttpRequest: + api_version = "2021-05-01-preview" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/networkManagers/{networkManagerName}/securityUserConfigurations/{configurationName}/ruleCollections/{ruleCollectionName}') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "networkManagerName": _SERIALIZER.url("network_manager_name", network_manager_name, 'str'), + "configurationName": _SERIALIZER.url("configuration_name", configuration_name, 'str'), + "ruleCollectionName": _SERIALIZER.url("rule_collection_name", rule_collection_name, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + if force is not None: + query_parameters['force'] = _SERIALIZER.query("force", force, 'bool') + if recursive is not None: + query_parameters['recursive'] = _SERIALIZER.query("recursive", recursive, 'bool') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="DELETE", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) class UserRuleCollectionsOperations(object): """UserRuleCollectionsOperations operations. @@ -30,7 +210,7 @@ class UserRuleCollectionsOperations(object): instantiates it for you and attaches it as an attribute. :ivar models: Alias to model classes used in this operation group. - :type models: ~azure.mgmt.network.v2021_02_01_preview.models + :type models: ~azure.mgmt.network.v2021_05_01_preview.models :param client: Client for service requests. :param config: Configuration of service client. :param serializer: An object model serializer. @@ -45,23 +225,23 @@ def __init__(self, client, config, serializer, deserializer): self._deserialize = deserializer self._config = config + @distributed_trace def list( self, - resource_group_name, # type: str - network_manager_name, # type: str - configuration_name, # type: str - top=None, # type: Optional[int] - skip_token=None, # type: Optional[str] - **kwargs # type: Any - ): - # type: (...) -> Iterable["_models.RuleCollectionListResult"] + resource_group_name: str, + network_manager_name: str, + configuration_name: str, + top: Optional[int] = None, + skip_token: Optional[str] = None, + **kwargs: Any + ) -> Iterable["_models.RuleCollectionListResult"]: """Lists all the user rule collections in a security configuration, in a paginated format. :param resource_group_name: The name of the resource group. :type resource_group_name: str :param network_manager_name: The name of the network manager. :type network_manager_name: str - :param configuration_name: The name of the network manager security Configuration. + :param configuration_name: The name of the network manager Security Configuration. :type configuration_name: str :param top: An optional query parameter which specifies the maximum number of records to be returned by the server. @@ -71,8 +251,10 @@ def list( a skipToken parameter that specifies a starting point to use for subsequent calls. :type skip_token: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either RuleCollectionListResult or the result of cls(response) - :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.network.v2021_02_01_preview.models.RuleCollectionListResult] + :return: An iterator like instance of either RuleCollectionListResult or the result of + cls(response) + :rtype: + ~azure.core.paging.ItemPaged[~azure.mgmt.network.v2021_05_01_preview.models.RuleCollectionListResult] :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.RuleCollectionListResult"] @@ -80,41 +262,39 @@ def list( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-02-01-preview" - accept = "application/json" - def prepare_request(next_link=None): - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - if not next_link: - # Construct URL - url = self.list.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'networkManagerName': self._serialize.url("network_manager_name", network_manager_name, 'str'), - 'configurationName': self._serialize.url("configuration_name", configuration_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - if top is not None: - query_parameters['$top'] = self._serialize.query("top", top, 'int', maximum=20, minimum=1) - if skip_token is not None: - query_parameters['$skipToken'] = self._serialize.query("skip_token", skip_token, 'str') - - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + network_manager_name=network_manager_name, + configuration_name=configuration_name, + top=top, + skip_token=skip_token, + template_url=self.list.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + network_manager_name=network_manager_name, + configuration_name=configuration_name, + top=top, + skip_token=skip_token, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request def extract_data(pipeline_response): - deserialized = self._deserialize('RuleCollectionListResult', pipeline_response) + deserialized = self._deserialize("RuleCollectionListResult", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -132,34 +312,35 @@ def get_next(next_link=None): return pipeline_response + return ItemPaged( get_next, extract_data ) list.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/networkManagers/{networkManagerName}/securityUserConfigurations/{configurationName}/ruleCollections'} # type: ignore + @distributed_trace def get( self, - resource_group_name, # type: str - network_manager_name, # type: str - configuration_name, # type: str - rule_collection_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> "_models.RuleCollection" + resource_group_name: str, + network_manager_name: str, + configuration_name: str, + rule_collection_name: str, + **kwargs: Any + ) -> "_models.RuleCollection": """Gets a network manager security user configuration rule collection. :param resource_group_name: The name of the resource group. :type resource_group_name: str :param network_manager_name: The name of the network manager. :type network_manager_name: str - :param configuration_name: The name of the network manager security Configuration. + :param configuration_name: The name of the network manager Security Configuration. :type configuration_name: str :param rule_collection_name: The name of the network manager security Configuration rule collection. :type rule_collection_name: str :keyword callable cls: A custom type or function that will be passed the direct response :return: RuleCollection, or the result of cls(response) - :rtype: ~azure.mgmt.network.v2021_02_01_preview.models.RuleCollection + :rtype: ~azure.mgmt.network.v2021_05_01_preview.models.RuleCollection :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.RuleCollection"] @@ -167,29 +348,19 @@ def get( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-02-01-preview" - accept = "application/json" - - # Construct URL - url = self.get.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'networkManagerName': self._serialize.url("network_manager_name", network_manager_name, 'str'), - 'configurationName': self._serialize.url("configuration_name", configuration_name, 'str'), - 'ruleCollectionName': self._serialize.url("rule_collection_name", rule_collection_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_get_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + network_manager_name=network_manager_name, + configuration_name=configuration_name, + rule_collection_name=rule_collection_name, + template_url=self.get.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.get(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -203,34 +374,36 @@ def get( return cls(pipeline_response, deserialized, {}) return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/networkManagers/{networkManagerName}/securityUserConfigurations/{configurationName}/ruleCollections/{ruleCollectionName}'} # type: ignore + + @distributed_trace def create_or_update( self, - resource_group_name, # type: str - network_manager_name, # type: str - configuration_name, # type: str - rule_collection_name, # type: str - user_rule_collection, # type: "_models.RuleCollection" - **kwargs # type: Any - ): - # type: (...) -> "_models.RuleCollection" + resource_group_name: str, + network_manager_name: str, + configuration_name: str, + rule_collection_name: str, + user_rule_collection: "_models.RuleCollection", + **kwargs: Any + ) -> "_models.RuleCollection": """Creates or updates a user rule collection. :param resource_group_name: The name of the resource group. :type resource_group_name: str :param network_manager_name: The name of the network manager. :type network_manager_name: str - :param configuration_name: The name of the network manager security Configuration. + :param configuration_name: The name of the network manager Security Configuration. :type configuration_name: str :param rule_collection_name: The name of the network manager security Configuration rule collection. :type rule_collection_name: str :param user_rule_collection: The User Rule Collection to create or update. - :type user_rule_collection: ~azure.mgmt.network.v2021_02_01_preview.models.RuleCollection + :type user_rule_collection: ~azure.mgmt.network.v2021_05_01_preview.models.RuleCollection :keyword callable cls: A custom type or function that will be passed the direct response :return: RuleCollection, or the result of cls(response) - :rtype: ~azure.mgmt.network.v2021_02_01_preview.models.RuleCollection + :rtype: ~azure.mgmt.network.v2021_05_01_preview.models.RuleCollection :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.RuleCollection"] @@ -238,34 +411,24 @@ def create_or_update( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-02-01-preview" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self.create_or_update.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'networkManagerName': self._serialize.url("network_manager_name", network_manager_name, 'str'), - 'configurationName': self._serialize.url("configuration_name", configuration_name, 'str'), - 'ruleCollectionName': self._serialize.url("rule_collection_name", rule_collection_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + _json = self._serialize.body(user_rule_collection, 'RuleCollection') + + request = build_create_or_update_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + network_manager_name=network_manager_name, + configuration_name=configuration_name, + rule_collection_name=rule_collection_name, + content_type=content_type, + json=_json, + template_url=self.create_or_update.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(user_rule_collection, 'RuleCollection') - body_content_kwargs['content'] = body_content - request = self._client.put(url, query_parameters, header_parameters, **body_content_kwargs) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -283,28 +446,40 @@ def create_or_update( return cls(pipeline_response, deserialized, {}) return deserialized + create_or_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/networkManagers/{networkManagerName}/securityUserConfigurations/{configurationName}/ruleCollections/{ruleCollectionName}'} # type: ignore + + @distributed_trace def delete( self, - resource_group_name, # type: str - network_manager_name, # type: str - configuration_name, # type: str - rule_collection_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> None + resource_group_name: str, + network_manager_name: str, + configuration_name: str, + rule_collection_name: str, + force: Optional[bool] = None, + recursive: Optional[bool] = None, + **kwargs: Any + ) -> None: """Deletes a user rule collection. :param resource_group_name: The name of the resource group. :type resource_group_name: str :param network_manager_name: The name of the network manager. :type network_manager_name: str - :param configuration_name: The name of the network manager security Configuration. + :param configuration_name: The name of the network manager Security Configuration. :type configuration_name: str :param rule_collection_name: The name of the network manager security Configuration rule collection. :type rule_collection_name: str + :param force: Deletes the resource even if it is part of a deployed configuration. If the + configuration has been deployed, the service will do a cleanup deployment in the background, + prior to the delete. + :type force: bool + :param recursive: Deletes the resource recursively. When present in a security configuration + delete, all rule collections and rules within the configuration will be deleted. When present + in a rule collection delete, all rules within the collection will be deleted. + :type recursive: bool :keyword callable cls: A custom type or function that will be passed the direct response :return: None, or the result of cls(response) :rtype: None @@ -315,29 +490,21 @@ def delete( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-02-01-preview" - accept = "application/json" - - # Construct URL - url = self.delete.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'networkManagerName': self._serialize.url("network_manager_name", network_manager_name, 'str'), - 'configurationName': self._serialize.url("configuration_name", configuration_name, 'str'), - 'ruleCollectionName': self._serialize.url("rule_collection_name", rule_collection_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_delete_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + network_manager_name=network_manager_name, + configuration_name=configuration_name, + rule_collection_name=rule_collection_name, + force=force, + recursive=recursive, + template_url=self.delete.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.delete(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -349,3 +516,4 @@ def delete( return cls(pipeline_response, None, {}) delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/networkManagers/{networkManagerName}/securityUserConfigurations/{configurationName}/ruleCollections/{ruleCollectionName}'} # type: ignore + diff --git a/src/network-manager/azext_network_manager/vendored_sdks/operations/_user_rules_operations.py b/src/network-manager/azext_network_manager/vendored_sdks/operations/_user_rules_operations.py index 8d787a37c8e..dcec684f7bd 100644 --- a/src/network-manager/azext_network_manager/vendored_sdks/operations/_user_rules_operations.py +++ b/src/network-manager/azext_network_manager/vendored_sdks/operations/_user_rules_operations.py @@ -5,23 +5,208 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import TYPE_CHECKING +import functools +from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar, Union import warnings from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.paging import ItemPaged from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import HttpRequest, HttpResponse +from azure.core.pipeline.transport import HttpResponse +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace from azure.mgmt.core.exceptions import ARMErrorFormat +from msrest import Serializer from .. import models as _models - -if TYPE_CHECKING: - # pylint: disable=unused-import,ungrouped-imports - from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar, Union - - T = TypeVar('T') - ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] +from .._vendor import _convert_request, _format_url_section +T = TypeVar('T') +JSONType = Any +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] + +_SERIALIZER = Serializer() +_SERIALIZER.client_side_validation = False + +def build_list_request( + subscription_id: str, + resource_group_name: str, + network_manager_name: str, + configuration_name: str, + rule_collection_name: str, + *, + top: Optional[int] = None, + skip_token: Optional[str] = None, + **kwargs: Any +) -> HttpRequest: + api_version = "2021-05-01-preview" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/networkManagers/{networkManagerName}/securityUserConfigurations/{configurationName}/ruleCollections/{ruleCollectionName}/rules') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "networkManagerName": _SERIALIZER.url("network_manager_name", network_manager_name, 'str'), + "configurationName": _SERIALIZER.url("configuration_name", configuration_name, 'str'), + "ruleCollectionName": _SERIALIZER.url("rule_collection_name", rule_collection_name, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + if top is not None: + query_parameters['$top'] = _SERIALIZER.query("top", top, 'int', maximum=20, minimum=1) + if skip_token is not None: + query_parameters['$skipToken'] = _SERIALIZER.query("skip_token", skip_token, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_get_request( + subscription_id: str, + resource_group_name: str, + network_manager_name: str, + configuration_name: str, + rule_collection_name: str, + rule_name: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2021-05-01-preview" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/networkManagers/{networkManagerName}/securityUserConfigurations/{configurationName}/ruleCollections/{ruleCollectionName}/rules/{ruleName}') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "networkManagerName": _SERIALIZER.url("network_manager_name", network_manager_name, 'str'), + "configurationName": _SERIALIZER.url("configuration_name", configuration_name, 'str'), + "ruleCollectionName": _SERIALIZER.url("rule_collection_name", rule_collection_name, 'str'), + "ruleName": _SERIALIZER.url("rule_name", rule_name, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_create_or_update_request( + subscription_id: str, + resource_group_name: str, + network_manager_name: str, + configuration_name: str, + rule_collection_name: str, + rule_name: str, + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any +) -> HttpRequest: + content_type = kwargs.pop('content_type', None) # type: Optional[str] + + api_version = "2021-05-01-preview" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/networkManagers/{networkManagerName}/securityUserConfigurations/{configurationName}/ruleCollections/{ruleCollectionName}/rules/{ruleName}') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "networkManagerName": _SERIALIZER.url("network_manager_name", network_manager_name, 'str'), + "configurationName": _SERIALIZER.url("configuration_name", configuration_name, 'str'), + "ruleCollectionName": _SERIALIZER.url("rule_collection_name", rule_collection_name, 'str'), + "ruleName": _SERIALIZER.url("rule_name", rule_name, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + if content_type is not None: + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="PUT", + url=url, + params=query_parameters, + headers=header_parameters, + json=json, + content=content, + **kwargs + ) + + +def build_delete_request( + subscription_id: str, + resource_group_name: str, + network_manager_name: str, + configuration_name: str, + rule_collection_name: str, + rule_name: str, + *, + force: Optional[bool] = None, + **kwargs: Any +) -> HttpRequest: + api_version = "2021-05-01-preview" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/networkManagers/{networkManagerName}/securityUserConfigurations/{configurationName}/ruleCollections/{ruleCollectionName}/rules/{ruleName}') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "networkManagerName": _SERIALIZER.url("network_manager_name", network_manager_name, 'str'), + "configurationName": _SERIALIZER.url("configuration_name", configuration_name, 'str'), + "ruleCollectionName": _SERIALIZER.url("rule_collection_name", rule_collection_name, 'str'), + "ruleName": _SERIALIZER.url("rule_name", rule_name, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + if force is not None: + query_parameters['force'] = _SERIALIZER.query("force", force, 'bool') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="DELETE", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) class UserRulesOperations(object): """UserRulesOperations operations. @@ -30,7 +215,7 @@ class UserRulesOperations(object): instantiates it for you and attaches it as an attribute. :ivar models: Alias to model classes used in this operation group. - :type models: ~azure.mgmt.network.v2021_02_01_preview.models + :type models: ~azure.mgmt.network.v2021_05_01_preview.models :param client: Client for service requests. :param config: Configuration of service client. :param serializer: An object model serializer. @@ -45,24 +230,24 @@ def __init__(self, client, config, serializer, deserializer): self._deserialize = deserializer self._config = config + @distributed_trace def list( self, - resource_group_name, # type: str - network_manager_name, # type: str - configuration_name, # type: str - rule_collection_name, # type: str - top=None, # type: Optional[int] - skip_token=None, # type: Optional[str] - **kwargs # type: Any - ): - # type: (...) -> Iterable["_models.UserRuleListResult"] + resource_group_name: str, + network_manager_name: str, + configuration_name: str, + rule_collection_name: str, + top: Optional[int] = None, + skip_token: Optional[str] = None, + **kwargs: Any + ) -> Iterable["_models.UserRuleListResult"]: """Lists all user rules in a rule collection. :param resource_group_name: The name of the resource group. :type resource_group_name: str :param network_manager_name: The name of the network manager. :type network_manager_name: str - :param configuration_name: The name of the network manager security Configuration. + :param configuration_name: The name of the network manager Security Configuration. :type configuration_name: str :param rule_collection_name: The name of the network manager security Configuration rule collection. @@ -76,7 +261,8 @@ def list( :type skip_token: str :keyword callable cls: A custom type or function that will be passed the direct response :return: An iterator like instance of either UserRuleListResult or the result of cls(response) - :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.network.v2021_02_01_preview.models.UserRuleListResult] + :rtype: + ~azure.core.paging.ItemPaged[~azure.mgmt.network.v2021_05_01_preview.models.UserRuleListResult] :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.UserRuleListResult"] @@ -84,42 +270,41 @@ def list( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-02-01-preview" - accept = "application/json" - def prepare_request(next_link=None): - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - if not next_link: - # Construct URL - url = self.list.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'networkManagerName': self._serialize.url("network_manager_name", network_manager_name, 'str'), - 'configurationName': self._serialize.url("configuration_name", configuration_name, 'str'), - 'ruleCollectionName': self._serialize.url("rule_collection_name", rule_collection_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - if top is not None: - query_parameters['$top'] = self._serialize.query("top", top, 'int', maximum=20, minimum=1) - if skip_token is not None: - query_parameters['$skipToken'] = self._serialize.query("skip_token", skip_token, 'str') - - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + network_manager_name=network_manager_name, + configuration_name=configuration_name, + rule_collection_name=rule_collection_name, + top=top, + skip_token=skip_token, + template_url=self.list.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + network_manager_name=network_manager_name, + configuration_name=configuration_name, + rule_collection_name=rule_collection_name, + top=top, + skip_token=skip_token, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request def extract_data(pipeline_response): - deserialized = self._deserialize('UserRuleListResult', pipeline_response) + deserialized = self._deserialize("UserRuleListResult", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -137,28 +322,29 @@ def get_next(next_link=None): return pipeline_response + return ItemPaged( get_next, extract_data ) list.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/networkManagers/{networkManagerName}/securityUserConfigurations/{configurationName}/ruleCollections/{ruleCollectionName}/rules'} # type: ignore + @distributed_trace def get( self, - resource_group_name, # type: str - network_manager_name, # type: str - configuration_name, # type: str - rule_collection_name, # type: str - rule_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> "_models.BaseUserRule" + resource_group_name: str, + network_manager_name: str, + configuration_name: str, + rule_collection_name: str, + rule_name: str, + **kwargs: Any + ) -> "_models.BaseUserRule": """Gets a user rule. :param resource_group_name: The name of the resource group. :type resource_group_name: str :param network_manager_name: The name of the network manager. :type network_manager_name: str - :param configuration_name: The name of the network manager security Configuration. + :param configuration_name: The name of the network manager Security Configuration. :type configuration_name: str :param rule_collection_name: The name of the network manager security Configuration rule collection. @@ -167,7 +353,7 @@ def get( :type rule_name: str :keyword callable cls: A custom type or function that will be passed the direct response :return: BaseUserRule, or the result of cls(response) - :rtype: ~azure.mgmt.network.v2021_02_01_preview.models.BaseUserRule + :rtype: ~azure.mgmt.network.v2021_05_01_preview.models.BaseUserRule :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.BaseUserRule"] @@ -175,30 +361,20 @@ def get( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-02-01-preview" - accept = "application/json" - - # Construct URL - url = self.get.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'networkManagerName': self._serialize.url("network_manager_name", network_manager_name, 'str'), - 'configurationName': self._serialize.url("configuration_name", configuration_name, 'str'), - 'ruleCollectionName': self._serialize.url("rule_collection_name", rule_collection_name, 'str'), - 'ruleName': self._serialize.url("rule_name", rule_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_get_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + network_manager_name=network_manager_name, + configuration_name=configuration_name, + rule_collection_name=rule_collection_name, + rule_name=rule_name, + template_url=self.get.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.get(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -212,26 +388,28 @@ def get( return cls(pipeline_response, deserialized, {}) return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/networkManagers/{networkManagerName}/securityUserConfigurations/{configurationName}/ruleCollections/{ruleCollectionName}/rules/{ruleName}'} # type: ignore + + @distributed_trace def create_or_update( self, - resource_group_name, # type: str - network_manager_name, # type: str - configuration_name, # type: str - rule_collection_name, # type: str - rule_name, # type: str - user_rule, # type: "_models.BaseUserRule" - **kwargs # type: Any - ): - # type: (...) -> "_models.BaseUserRule" + resource_group_name: str, + network_manager_name: str, + configuration_name: str, + rule_collection_name: str, + rule_name: str, + user_rule: "_models.BaseUserRule", + **kwargs: Any + ) -> "_models.BaseUserRule": """Creates or updates a user rule. :param resource_group_name: The name of the resource group. :type resource_group_name: str :param network_manager_name: The name of the network manager. :type network_manager_name: str - :param configuration_name: The name of the network manager security Configuration. + :param configuration_name: The name of the network manager Security Configuration. :type configuration_name: str :param rule_collection_name: The name of the network manager security Configuration rule collection. @@ -239,10 +417,10 @@ def create_or_update( :param rule_name: The name of the rule. :type rule_name: str :param user_rule: The user rule to create or update. - :type user_rule: ~azure.mgmt.network.v2021_02_01_preview.models.BaseUserRule + :type user_rule: ~azure.mgmt.network.v2021_05_01_preview.models.BaseUserRule :keyword callable cls: A custom type or function that will be passed the direct response :return: BaseUserRule, or the result of cls(response) - :rtype: ~azure.mgmt.network.v2021_02_01_preview.models.BaseUserRule + :rtype: ~azure.mgmt.network.v2021_05_01_preview.models.BaseUserRule :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.BaseUserRule"] @@ -250,35 +428,25 @@ def create_or_update( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-02-01-preview" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self.create_or_update.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'networkManagerName': self._serialize.url("network_manager_name", network_manager_name, 'str'), - 'configurationName': self._serialize.url("configuration_name", configuration_name, 'str'), - 'ruleCollectionName': self._serialize.url("rule_collection_name", rule_collection_name, 'str'), - 'ruleName': self._serialize.url("rule_name", rule_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + _json = self._serialize.body(user_rule, 'BaseUserRule') + + request = build_create_or_update_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + network_manager_name=network_manager_name, + configuration_name=configuration_name, + rule_collection_name=rule_collection_name, + rule_name=rule_name, + content_type=content_type, + json=_json, + template_url=self.create_or_update.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(user_rule, 'BaseUserRule') - body_content_kwargs['content'] = body_content - request = self._client.put(url, query_parameters, header_parameters, **body_content_kwargs) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -296,31 +464,38 @@ def create_or_update( return cls(pipeline_response, deserialized, {}) return deserialized + create_or_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/networkManagers/{networkManagerName}/securityUserConfigurations/{configurationName}/ruleCollections/{ruleCollectionName}/rules/{ruleName}'} # type: ignore + + @distributed_trace def delete( self, - resource_group_name, # type: str - network_manager_name, # type: str - configuration_name, # type: str - rule_collection_name, # type: str - rule_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> None + resource_group_name: str, + network_manager_name: str, + configuration_name: str, + rule_collection_name: str, + rule_name: str, + force: Optional[bool] = None, + **kwargs: Any + ) -> None: """Deletes a user rule. :param resource_group_name: The name of the resource group. :type resource_group_name: str :param network_manager_name: The name of the network manager. :type network_manager_name: str - :param configuration_name: The name of the network manager security Configuration. + :param configuration_name: The name of the network manager Security Configuration. :type configuration_name: str :param rule_collection_name: The name of the network manager security Configuration rule collection. :type rule_collection_name: str :param rule_name: The name of the rule. :type rule_name: str + :param force: Deletes the resource even if it is part of a deployed configuration. If the + configuration has been deployed, the service will do a cleanup deployment in the background, + prior to the delete. + :type force: bool :keyword callable cls: A custom type or function that will be passed the direct response :return: None, or the result of cls(response) :rtype: None @@ -331,30 +506,21 @@ def delete( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-02-01-preview" - accept = "application/json" - - # Construct URL - url = self.delete.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'networkManagerName': self._serialize.url("network_manager_name", network_manager_name, 'str'), - 'configurationName': self._serialize.url("configuration_name", configuration_name, 'str'), - 'ruleCollectionName': self._serialize.url("rule_collection_name", rule_collection_name, 'str'), - 'ruleName': self._serialize.url("rule_name", rule_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_delete_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + network_manager_name=network_manager_name, + configuration_name=configuration_name, + rule_collection_name=rule_collection_name, + rule_name=rule_name, + force=force, + template_url=self.delete.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.delete(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -366,3 +532,4 @@ def delete( return cls(pipeline_response, None, {}) delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/networkManagers/{networkManagerName}/securityUserConfigurations/{configurationName}/ruleCollections/{ruleCollectionName}/rules/{ruleName}'} # type: ignore + diff --git a/src/network-manager/azext_network_manager/vendored_sdks/py.typed b/src/network-manager/azext_network_manager/vendored_sdks/py.typed deleted file mode 100644 index e5aff4f83af..00000000000 --- a/src/network-manager/azext_network_manager/vendored_sdks/py.typed +++ /dev/null @@ -1 +0,0 @@ -# Marker file for PEP 561. \ No newline at end of file diff --git a/src/network-manager/setup.py b/src/network-manager/setup.py index 5f444e1728c..87546c6f385 100644 --- a/src/network-manager/setup.py +++ b/src/network-manager/setup.py @@ -10,7 +10,7 @@ from setuptools import setup, find_packages # HISTORY.rst entry. -VERSION = '0.3.0' +VERSION = '0.4.0' # The full list of classifiers is available at # https://pypi.python.org/pypi?%3Aaction=list_classifiers