From f8c7a79d5355d634166eb5d80397c7307b9c9b6b Mon Sep 17 00:00:00 2001 From: SDKAuto Date: Tue, 29 Oct 2024 20:40:13 +0000 Subject: [PATCH] CodeGen from PR 30701 in Azure/azure-rest-api-specs Merge 7922696e3be07a473889c5895edef76c58894f3b into 28d0530307f5c7c816e2094d100980b5c40f234c --- .../network/armnetwork/CHANGELOG.md | 4 + ...dminrulecollections_client_example_test.go | 184 - .../adminrules_client_example_test.go | 373 -- ...endpointconnections_client_example_test.go | 169 - ...rivatelinkresources_client_example_test.go | 58 - ...applicationgateways_client_example_test.go | 2346 ------------- ...wafdynamicmanifests_client_example_test.go | 92 - ...micmanifestsdefault_client_example_test.go | 84 - ...ationsecuritygroups_client_example_test.go | 242 -- .../network/armnetwork/autorest.md | 7 +- ...vailabledelegations_client_example_test.go | 54 - ...bleendpointservices_client_example_test.go | 61 - ...rivateendpointtypes_client_example_test.go | 84 - ...rcegroupdelegations_client_example_test.go | 54 - ...lableservicealiases_client_example_test.go | 98 - ...urefirewallfqdntags_client_example_test.go | 60 - .../azurefirewalls_client_example_test.go | 2987 ---------------- .../bastionhosts_client_example_test.go | 761 ----- ...pservicecommunities_client_example_test.go | 84 - ...urationpolicygroups_client_example_test.go | 226 -- .../connectionmonitors_client_example_test.go | 721 ---- ...ivityconfigurations_client_example_test.go | 228 -- .../network/armnetwork/constants.go | 2 +- .../customipprefixes_client_example_test.go | 627 ---- .../ddoscustompolicies_client_example_test.go | 145 - ...ddosprotectionplans_client_example_test.go | 296 -- ...efaultsecurityrules_client_example_test.go | 234 -- .../dscpconfiguration_client_example_test.go | 602 ---- ...rcuitauthorizations_client_example_test.go | 143 - ...ecircuitconnections_client_example_test.go | 206 -- ...outecircuitpeerings_client_example_test.go | 266 -- ...xpressroutecircuits_client_example_test.go | 644 ---- ...essrouteconnections_client_example_test.go | 266 -- ...sconnectionpeerings_client_example_test.go | 195 -- ...utecrossconnections_client_example_test.go | 366 -- ...xpressroutegateways_client_example_test.go | 337 -- .../expressroutelinks_client_example_test.go | 108 - ...eportauthorizations_client_example_test.go | 148 - .../expressrouteports_client_example_test.go | 519 --- ...routeportslocations_client_example_test.go | 95 - ...oviderportslocation_client_example_test.go | 73 - ...uteserviceproviders_client_example_test.go | 90 - .../firewallpolicies_client_example_test.go | 601 ---- ...llpolicydeployments_client_example_test.go | 39 - ...irewallpolicydrafts_client_example_test.go | 311 -- ...olicyidpssignatures_client_example_test.go | 87 - ...naturesfiltervalues_client_example_test.go | 47 - ...signaturesoverrides_client_example_test.go | 166 - ...llectiongroupdrafts_client_example_test.go | 160 - ...ulecollectiongroups_client_example_test.go | 866 ----- .../flowlogs_client_example_test.go | 341 -- sdk/resourcemanager/network/armnetwork/go.mod | 2 +- .../armnetwork/groups_client_example_test.go | 172 - .../hubroutetables_client_example_test.go | 186 - ...lnetworkconnections_client_example_test.go | 278 -- .../inboundnatrules_client_example_test.go | 200 -- ...inboundsecurityrule_client_example_test.go | 118 - ...aceipconfigurations_client_example_test.go | 110 - ...erfaceloadbalancers_client_example_test.go | 162 - .../interfaces_client_example_test.go | 1403 -------- ...cetapconfigurations_client_example_test.go | 154 - .../ipallocations_client_example_test.go | 276 -- .../ipgroups_client_example_test.go | 320 -- ...backendaddresspools_client_example_test.go | 312 -- ...endipconfigurations_client_example_test.go | 112 - ...rloadbalancingrules_client_example_test.go | 116 - ...ernetworkinterfaces_client_example_test.go | 210 -- ...lanceroutboundrules_client_example_test.go | 106 - .../loadbalancerprobes_client_example_test.go | 104 - .../loadbalancers_client_example_test.go | 3017 ----------------- ...ocalnetworkgateways_client_example_test.go | 230 -- .../management_client_example_test.go | 654 ---- ...kmanagerconnections_client_example_test.go | 164 - .../managercommits_client_example_test.go | 57 - ...gerdeploymentstatus_client_example_test.go | 71 - ...utingconfigurations_client_example_test.go | 168 - .../managers_client_example_test.go | 316 -- .../natgateways_client_example_test.go | 359 -- .../natrules_client_example_test.go | 172 - .../operations_client_example_test.go | 166 - .../p2svpngateways_client_example_test.go | 1079 ------ .../packetcaptures_client_example_test.go | 246 -- ...ecircuitconnections_client_example_test.go | 120 - ...rivatednszonegroups_client_example_test.go | 253 -- .../privateendpoints_client_example_test.go | 941 ----- ...privatelinkservices_client_example_test.go | 798 ----- .../profiles_client_example_test.go | 684 ---- .../publicipaddresses_client_example_test.go | 863 ----- .../publicipprefixes_client_example_test.go | 399 --- ...urcenavigationlinks_client_example_test.go | 52 - .../routefilterrules_client_example_test.go | 159 - .../routefilters_client_example_test.go | 326 -- .../routemaps_client_example_test.go | 265 -- .../armnetwork/routes_client_example_test.go | 153 - .../routetables_client_example_test.go | 333 -- .../routingintent_client_example_test.go | 194 -- ...tingrulecollections_client_example_test.go | 187 - .../routingrules_client_example_test.go | 199 -- .../scopeconnections_client_example_test.go | 169 - ...adminconfigurations_client_example_test.go | 176 - .../securitygroups_client_example_test.go | 1106 ------ ...itypartnerproviders_client_example_test.go | 261 -- .../securityrules_client_example_test.go | 168 - ...yuserconfigurations_client_example_test.go | 168 - ...userrulecollections_client_example_test.go | 184 - .../securityuserrules_client_example_test.go | 232 -- ...iceassociationlinks_client_example_test.go | 54 - ...iceendpointpolicies_client_example_test.go | 397 --- ...ntpolicydefinitions_client_example_test.go | 157 - ...rvicetaginformation_client_example_test.go | 169 - .../servicetags_client_example_test.go | 109 - .../staticmembers_client_example_test.go | 162 - .../armnetwork/subnets_client_example_test.go | 452 --- ...kmanagerconnections_client_example_test.go | 164 - .../armnetwork/usages_client_example_test.go | 644 ---- .../armnetwork/vipswap_client_example_test.go | 103 - ...pplianceconnections_client_example_test.go | 237 -- .../virtualappliances_client_example_test.go | 916 ----- ...rtualappliancesites_client_example_test.go | 171 - ...irtualapplianceskus_client_example_test.go | 106 - ...ualhubbgpconnection_client_example_test.go | 120 - ...alhubbgpconnections_client_example_test.go | 206 -- ...lhubipconfiguration_client_example_test.go | 154 - ...ualhubroutetablev2s_client_example_test.go | 190 -- .../virtualhubs_client_example_test.go | 627 ---- ...kgatewayconnections_client_example_test.go | 689 ---- ...workgatewaynatrules_client_example_test.go | 169 - ...tualnetworkgateways_client_example_test.go | 1587 --------- ...tualnetworkpeerings_client_example_test.go | 950 ------ .../virtualnetworks_client_example_test.go | 1116 ------ .../virtualnetworktaps_client_example_test.go | 307 -- ...rtualrouterpeerings_client_example_test.go | 147 - .../virtualrouters_client_example_test.go | 246 -- .../virtualwans_client_example_test.go | 350 -- .../vpnconnections_client_example_test.go | 411 --- .../vpngateways_client_example_test.go | 1334 -------- .../vpnlinkconnections_client_example_test.go | 221 -- ...erverconfigurations_client_example_test.go | 855 ----- ...iatedwithvirtualwan_client_example_test.go | 47 - ...sitelinkconnections_client_example_test.go | 72 - .../vpnsitelinks_client_example_test.go | 117 - .../vpnsites_client_example_test.go | 462 --- ...nsitesconfiguration_client_example_test.go | 44 - .../watchers_client_example_test.go | 933 ----- ...ionfirewallpolicies_client_example_test.go | 1383 -------- .../webcategories_client_example_test.go | 84 - 146 files changed, 9 insertions(+), 53040 deletions(-) delete mode 100644 sdk/resourcemanager/network/armnetwork/adminrulecollections_client_example_test.go delete mode 100644 sdk/resourcemanager/network/armnetwork/adminrules_client_example_test.go delete mode 100644 sdk/resourcemanager/network/armnetwork/applicationgatewayprivateendpointconnections_client_example_test.go delete mode 100644 sdk/resourcemanager/network/armnetwork/applicationgatewayprivatelinkresources_client_example_test.go delete mode 100644 sdk/resourcemanager/network/armnetwork/applicationgateways_client_example_test.go delete mode 100644 sdk/resourcemanager/network/armnetwork/applicationgatewaywafdynamicmanifests_client_example_test.go delete mode 100644 sdk/resourcemanager/network/armnetwork/applicationgatewaywafdynamicmanifestsdefault_client_example_test.go delete mode 100644 sdk/resourcemanager/network/armnetwork/applicationsecuritygroups_client_example_test.go delete mode 100644 sdk/resourcemanager/network/armnetwork/availabledelegations_client_example_test.go delete mode 100644 sdk/resourcemanager/network/armnetwork/availableendpointservices_client_example_test.go delete mode 100644 sdk/resourcemanager/network/armnetwork/availableprivateendpointtypes_client_example_test.go delete mode 100644 sdk/resourcemanager/network/armnetwork/availableresourcegroupdelegations_client_example_test.go delete mode 100644 sdk/resourcemanager/network/armnetwork/availableservicealiases_client_example_test.go delete mode 100644 sdk/resourcemanager/network/armnetwork/azurefirewallfqdntags_client_example_test.go delete mode 100644 sdk/resourcemanager/network/armnetwork/azurefirewalls_client_example_test.go delete mode 100644 sdk/resourcemanager/network/armnetwork/bastionhosts_client_example_test.go delete mode 100644 sdk/resourcemanager/network/armnetwork/bgpservicecommunities_client_example_test.go delete mode 100644 sdk/resourcemanager/network/armnetwork/configurationpolicygroups_client_example_test.go delete mode 100644 sdk/resourcemanager/network/armnetwork/connectionmonitors_client_example_test.go delete mode 100644 sdk/resourcemanager/network/armnetwork/connectivityconfigurations_client_example_test.go delete mode 100644 sdk/resourcemanager/network/armnetwork/customipprefixes_client_example_test.go delete mode 100644 sdk/resourcemanager/network/armnetwork/ddoscustompolicies_client_example_test.go delete mode 100644 sdk/resourcemanager/network/armnetwork/ddosprotectionplans_client_example_test.go delete mode 100644 sdk/resourcemanager/network/armnetwork/defaultsecurityrules_client_example_test.go delete mode 100644 sdk/resourcemanager/network/armnetwork/dscpconfiguration_client_example_test.go delete mode 100644 sdk/resourcemanager/network/armnetwork/expressroutecircuitauthorizations_client_example_test.go delete mode 100644 sdk/resourcemanager/network/armnetwork/expressroutecircuitconnections_client_example_test.go delete mode 100644 sdk/resourcemanager/network/armnetwork/expressroutecircuitpeerings_client_example_test.go delete mode 100644 sdk/resourcemanager/network/armnetwork/expressroutecircuits_client_example_test.go delete mode 100644 sdk/resourcemanager/network/armnetwork/expressrouteconnections_client_example_test.go delete mode 100644 sdk/resourcemanager/network/armnetwork/expressroutecrossconnectionpeerings_client_example_test.go delete mode 100644 sdk/resourcemanager/network/armnetwork/expressroutecrossconnections_client_example_test.go delete mode 100644 sdk/resourcemanager/network/armnetwork/expressroutegateways_client_example_test.go delete mode 100644 sdk/resourcemanager/network/armnetwork/expressroutelinks_client_example_test.go delete mode 100644 sdk/resourcemanager/network/armnetwork/expressrouteportauthorizations_client_example_test.go delete mode 100644 sdk/resourcemanager/network/armnetwork/expressrouteports_client_example_test.go delete mode 100644 sdk/resourcemanager/network/armnetwork/expressrouteportslocations_client_example_test.go delete mode 100644 sdk/resourcemanager/network/armnetwork/expressrouteproviderportslocation_client_example_test.go delete mode 100644 sdk/resourcemanager/network/armnetwork/expressrouteserviceproviders_client_example_test.go delete mode 100644 sdk/resourcemanager/network/armnetwork/firewallpolicies_client_example_test.go delete mode 100644 sdk/resourcemanager/network/armnetwork/firewallpolicydeployments_client_example_test.go delete mode 100644 sdk/resourcemanager/network/armnetwork/firewallpolicydrafts_client_example_test.go delete mode 100644 sdk/resourcemanager/network/armnetwork/firewallpolicyidpssignatures_client_example_test.go delete mode 100644 sdk/resourcemanager/network/armnetwork/firewallpolicyidpssignaturesfiltervalues_client_example_test.go delete mode 100644 sdk/resourcemanager/network/armnetwork/firewallpolicyidpssignaturesoverrides_client_example_test.go delete mode 100644 sdk/resourcemanager/network/armnetwork/firewallpolicyrulecollectiongroupdrafts_client_example_test.go delete mode 100644 sdk/resourcemanager/network/armnetwork/firewallpolicyrulecollectiongroups_client_example_test.go delete mode 100644 sdk/resourcemanager/network/armnetwork/flowlogs_client_example_test.go delete mode 100644 sdk/resourcemanager/network/armnetwork/groups_client_example_test.go delete mode 100644 sdk/resourcemanager/network/armnetwork/hubroutetables_client_example_test.go delete mode 100644 sdk/resourcemanager/network/armnetwork/hubvirtualnetworkconnections_client_example_test.go delete mode 100644 sdk/resourcemanager/network/armnetwork/inboundnatrules_client_example_test.go delete mode 100644 sdk/resourcemanager/network/armnetwork/inboundsecurityrule_client_example_test.go delete mode 100644 sdk/resourcemanager/network/armnetwork/interfaceipconfigurations_client_example_test.go delete mode 100644 sdk/resourcemanager/network/armnetwork/interfaceloadbalancers_client_example_test.go delete mode 100644 sdk/resourcemanager/network/armnetwork/interfaces_client_example_test.go delete mode 100644 sdk/resourcemanager/network/armnetwork/interfacetapconfigurations_client_example_test.go delete mode 100644 sdk/resourcemanager/network/armnetwork/ipallocations_client_example_test.go delete mode 100644 sdk/resourcemanager/network/armnetwork/ipgroups_client_example_test.go delete mode 100644 sdk/resourcemanager/network/armnetwork/loadbalancerbackendaddresspools_client_example_test.go delete mode 100644 sdk/resourcemanager/network/armnetwork/loadbalancerfrontendipconfigurations_client_example_test.go delete mode 100644 sdk/resourcemanager/network/armnetwork/loadbalancerloadbalancingrules_client_example_test.go delete mode 100644 sdk/resourcemanager/network/armnetwork/loadbalancernetworkinterfaces_client_example_test.go delete mode 100644 sdk/resourcemanager/network/armnetwork/loadbalanceroutboundrules_client_example_test.go delete mode 100644 sdk/resourcemanager/network/armnetwork/loadbalancerprobes_client_example_test.go delete mode 100644 sdk/resourcemanager/network/armnetwork/loadbalancers_client_example_test.go delete mode 100644 sdk/resourcemanager/network/armnetwork/localnetworkgateways_client_example_test.go delete mode 100644 sdk/resourcemanager/network/armnetwork/management_client_example_test.go delete mode 100644 sdk/resourcemanager/network/armnetwork/managementgroupnetworkmanagerconnections_client_example_test.go delete mode 100644 sdk/resourcemanager/network/armnetwork/managercommits_client_example_test.go delete mode 100644 sdk/resourcemanager/network/armnetwork/managerdeploymentstatus_client_example_test.go delete mode 100644 sdk/resourcemanager/network/armnetwork/managerroutingconfigurations_client_example_test.go delete mode 100644 sdk/resourcemanager/network/armnetwork/managers_client_example_test.go delete mode 100644 sdk/resourcemanager/network/armnetwork/natgateways_client_example_test.go delete mode 100644 sdk/resourcemanager/network/armnetwork/natrules_client_example_test.go delete mode 100644 sdk/resourcemanager/network/armnetwork/operations_client_example_test.go delete mode 100644 sdk/resourcemanager/network/armnetwork/p2svpngateways_client_example_test.go delete mode 100644 sdk/resourcemanager/network/armnetwork/packetcaptures_client_example_test.go delete mode 100644 sdk/resourcemanager/network/armnetwork/peerexpressroutecircuitconnections_client_example_test.go delete mode 100644 sdk/resourcemanager/network/armnetwork/privatednszonegroups_client_example_test.go delete mode 100644 sdk/resourcemanager/network/armnetwork/privateendpoints_client_example_test.go delete mode 100644 sdk/resourcemanager/network/armnetwork/privatelinkservices_client_example_test.go delete mode 100644 sdk/resourcemanager/network/armnetwork/profiles_client_example_test.go delete mode 100644 sdk/resourcemanager/network/armnetwork/publicipaddresses_client_example_test.go delete mode 100644 sdk/resourcemanager/network/armnetwork/publicipprefixes_client_example_test.go delete mode 100644 sdk/resourcemanager/network/armnetwork/resourcenavigationlinks_client_example_test.go delete mode 100644 sdk/resourcemanager/network/armnetwork/routefilterrules_client_example_test.go delete mode 100644 sdk/resourcemanager/network/armnetwork/routefilters_client_example_test.go delete mode 100644 sdk/resourcemanager/network/armnetwork/routemaps_client_example_test.go delete mode 100644 sdk/resourcemanager/network/armnetwork/routes_client_example_test.go delete mode 100644 sdk/resourcemanager/network/armnetwork/routetables_client_example_test.go delete mode 100644 sdk/resourcemanager/network/armnetwork/routingintent_client_example_test.go delete mode 100644 sdk/resourcemanager/network/armnetwork/routingrulecollections_client_example_test.go delete mode 100644 sdk/resourcemanager/network/armnetwork/routingrules_client_example_test.go delete mode 100644 sdk/resourcemanager/network/armnetwork/scopeconnections_client_example_test.go delete mode 100644 sdk/resourcemanager/network/armnetwork/securityadminconfigurations_client_example_test.go delete mode 100644 sdk/resourcemanager/network/armnetwork/securitygroups_client_example_test.go delete mode 100644 sdk/resourcemanager/network/armnetwork/securitypartnerproviders_client_example_test.go delete mode 100644 sdk/resourcemanager/network/armnetwork/securityrules_client_example_test.go delete mode 100644 sdk/resourcemanager/network/armnetwork/securityuserconfigurations_client_example_test.go delete mode 100644 sdk/resourcemanager/network/armnetwork/securityuserrulecollections_client_example_test.go delete mode 100644 sdk/resourcemanager/network/armnetwork/securityuserrules_client_example_test.go delete mode 100644 sdk/resourcemanager/network/armnetwork/serviceassociationlinks_client_example_test.go delete mode 100644 sdk/resourcemanager/network/armnetwork/serviceendpointpolicies_client_example_test.go delete mode 100644 sdk/resourcemanager/network/armnetwork/serviceendpointpolicydefinitions_client_example_test.go delete mode 100644 sdk/resourcemanager/network/armnetwork/servicetaginformation_client_example_test.go delete mode 100644 sdk/resourcemanager/network/armnetwork/servicetags_client_example_test.go delete mode 100644 sdk/resourcemanager/network/armnetwork/staticmembers_client_example_test.go delete mode 100644 sdk/resourcemanager/network/armnetwork/subnets_client_example_test.go delete mode 100644 sdk/resourcemanager/network/armnetwork/subscriptionnetworkmanagerconnections_client_example_test.go delete mode 100644 sdk/resourcemanager/network/armnetwork/usages_client_example_test.go delete mode 100644 sdk/resourcemanager/network/armnetwork/vipswap_client_example_test.go delete mode 100644 sdk/resourcemanager/network/armnetwork/virtualapplianceconnections_client_example_test.go delete mode 100644 sdk/resourcemanager/network/armnetwork/virtualappliances_client_example_test.go delete mode 100644 sdk/resourcemanager/network/armnetwork/virtualappliancesites_client_example_test.go delete mode 100644 sdk/resourcemanager/network/armnetwork/virtualapplianceskus_client_example_test.go delete mode 100644 sdk/resourcemanager/network/armnetwork/virtualhubbgpconnection_client_example_test.go delete mode 100644 sdk/resourcemanager/network/armnetwork/virtualhubbgpconnections_client_example_test.go delete mode 100644 sdk/resourcemanager/network/armnetwork/virtualhubipconfiguration_client_example_test.go delete mode 100644 sdk/resourcemanager/network/armnetwork/virtualhubroutetablev2s_client_example_test.go delete mode 100644 sdk/resourcemanager/network/armnetwork/virtualhubs_client_example_test.go delete mode 100644 sdk/resourcemanager/network/armnetwork/virtualnetworkgatewayconnections_client_example_test.go delete mode 100644 sdk/resourcemanager/network/armnetwork/virtualnetworkgatewaynatrules_client_example_test.go delete mode 100644 sdk/resourcemanager/network/armnetwork/virtualnetworkgateways_client_example_test.go delete mode 100644 sdk/resourcemanager/network/armnetwork/virtualnetworkpeerings_client_example_test.go delete mode 100644 sdk/resourcemanager/network/armnetwork/virtualnetworks_client_example_test.go delete mode 100644 sdk/resourcemanager/network/armnetwork/virtualnetworktaps_client_example_test.go delete mode 100644 sdk/resourcemanager/network/armnetwork/virtualrouterpeerings_client_example_test.go delete mode 100644 sdk/resourcemanager/network/armnetwork/virtualrouters_client_example_test.go delete mode 100644 sdk/resourcemanager/network/armnetwork/virtualwans_client_example_test.go delete mode 100644 sdk/resourcemanager/network/armnetwork/vpnconnections_client_example_test.go delete mode 100644 sdk/resourcemanager/network/armnetwork/vpngateways_client_example_test.go delete mode 100644 sdk/resourcemanager/network/armnetwork/vpnlinkconnections_client_example_test.go delete mode 100644 sdk/resourcemanager/network/armnetwork/vpnserverconfigurations_client_example_test.go delete mode 100644 sdk/resourcemanager/network/armnetwork/vpnserverconfigurationsassociatedwithvirtualwan_client_example_test.go delete mode 100644 sdk/resourcemanager/network/armnetwork/vpnsitelinkconnections_client_example_test.go delete mode 100644 sdk/resourcemanager/network/armnetwork/vpnsitelinks_client_example_test.go delete mode 100644 sdk/resourcemanager/network/armnetwork/vpnsites_client_example_test.go delete mode 100644 sdk/resourcemanager/network/armnetwork/vpnsitesconfiguration_client_example_test.go delete mode 100644 sdk/resourcemanager/network/armnetwork/watchers_client_example_test.go delete mode 100644 sdk/resourcemanager/network/armnetwork/webapplicationfirewallpolicies_client_example_test.go delete mode 100644 sdk/resourcemanager/network/armnetwork/webcategories_client_example_test.go diff --git a/sdk/resourcemanager/network/armnetwork/CHANGELOG.md b/sdk/resourcemanager/network/armnetwork/CHANGELOG.md index f362e9dc64ac..700b04a7acae 100644 --- a/sdk/resourcemanager/network/armnetwork/CHANGELOG.md +++ b/sdk/resourcemanager/network/armnetwork/CHANGELOG.md @@ -1,5 +1,9 @@ # Release History +## 6.1.1 (2024-10-29) +### Other Changes + + ## 6.1.0 (2024-09-24) ### Features Added diff --git a/sdk/resourcemanager/network/armnetwork/adminrulecollections_client_example_test.go b/sdk/resourcemanager/network/armnetwork/adminrulecollections_client_example_test.go deleted file mode 100644 index 6ba8b9d6fafc..000000000000 --- a/sdk/resourcemanager/network/armnetwork/adminrulecollections_client_example_test.go +++ /dev/null @@ -1,184 +0,0 @@ -//go:build go1.18 -// +build go1.18 - -// 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. -// DO NOT EDIT. - -package armnetwork_test - -import ( - "context" - "log" - - "github.com/Azure/azure-sdk-for-go/sdk/azcore/to" - "github.com/Azure/azure-sdk-for-go/sdk/azidentity" - "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/network/armnetwork/v6" -) - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/4883fa5dbf6f2c9093fac8ce334547e9dfac68fa/specification/network/resource-manager/Microsoft.Network/stable/2024-03-01/examples/NetworkManagerAdminRuleCollectionList.json -func ExampleAdminRuleCollectionsClient_NewListPager() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armnetwork.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := clientFactory.NewAdminRuleCollectionsClient().NewListPager("rg1", "testNetworkManager", "myTestSecurityConfig", &armnetwork.AdminRuleCollectionsClientListOptions{Top: nil, - SkipToken: nil, - }) - for pager.More() { - page, err := pager.NextPage(ctx) - if err != nil { - log.Fatalf("failed to advance page: %v", err) - } - for _, v := range page.Value { - // You could use page here. We use blank identifier for just demo purposes. - _ = v - } - // If the HTTP response code is 200 as defined in example definition, your page structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // page.AdminRuleCollectionListResult = armnetwork.AdminRuleCollectionListResult{ - // Value: []*armnetwork.AdminRuleCollection{ - // { - // Name: to.Ptr("testRuleCollection"), - // Type: to.Ptr("Microsoft.Network/networkManagers/securityAdminConfigurations/ruleCollections"), - // ID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/rg1/providers/Microsoft.Network/networkManagers/testNetworkManager/securityAdminConfigurations/myTestSecurityConfig/ruleCollections/testRuleCollection"), - // Properties: &armnetwork.AdminRuleCollectionPropertiesFormat{ - // Description: to.Ptr("A sample rule collection"), - // AppliesToGroups: []*armnetwork.ManagerSecurityGroupItem{ - // { - // NetworkGroupID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/rg1/providers/Microsoft.Network/networkManagers/testNetworkManager/networkGroups/testGroup"), - // }}, - // ProvisioningState: to.Ptr(armnetwork.ProvisioningStateSucceeded), - // ResourceGUID: to.Ptr("00000000-0000-0000-0000-000000000000"), - // }, - // SystemData: &armnetwork.SystemData{ - // CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-01-11T18:52:27.000Z"); return t}()), - // CreatedBy: to.Ptr("b69a9388-9488-4534-b470-7ec6d41beef5"), - // CreatedByType: to.Ptr(armnetwork.CreatedByTypeUser), - // LastModifiedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-01-11T18:52:27.000Z"); return t}()), - // LastModifiedBy: to.Ptr("b69a9388-9488-4534-b470-7ec6d41beef5"), - // LastModifiedByType: to.Ptr(armnetwork.CreatedByTypeUser), - // }, - // }}, - // } - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/4883fa5dbf6f2c9093fac8ce334547e9dfac68fa/specification/network/resource-manager/Microsoft.Network/stable/2024-03-01/examples/NetworkManagerAdminRuleCollectionGet.json -func ExampleAdminRuleCollectionsClient_Get() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armnetwork.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewAdminRuleCollectionsClient().Get(ctx, "rg1", "testNetworkManager", "myTestSecurityConfig", "testRuleCollection", nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.AdminRuleCollection = armnetwork.AdminRuleCollection{ - // Name: to.Ptr("testRuleCollection"), - // Type: to.Ptr("Microsoft.Network/networkManagers/securityAdminConfigurations/ruleCollections"), - // ID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/rg1/providers/Microsoft.Network/networkManagers/testNetworkManager/securityAdminConfigurations/myTestSecurityConfig/ruleCollections/testRuleCollection"), - // Properties: &armnetwork.AdminRuleCollectionPropertiesFormat{ - // Description: to.Ptr("A sample rule collection"), - // AppliesToGroups: []*armnetwork.ManagerSecurityGroupItem{ - // { - // NetworkGroupID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/rg1/providers/Microsoft.Network/networkManagers/testNetworkManager/networkGroups/testGroup"), - // }}, - // ProvisioningState: to.Ptr(armnetwork.ProvisioningStateSucceeded), - // ResourceGUID: to.Ptr("00000000-0000-0000-0000-000000000000"), - // }, - // SystemData: &armnetwork.SystemData{ - // CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-01-11T18:52:27.000Z"); return t}()), - // CreatedBy: to.Ptr("b69a9388-9488-4534-b470-7ec6d41beef5"), - // CreatedByType: to.Ptr(armnetwork.CreatedByTypeUser), - // LastModifiedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-01-11T18:52:27.000Z"); return t}()), - // LastModifiedBy: to.Ptr("b69a9388-9488-4534-b470-7ec6d41beef5"), - // LastModifiedByType: to.Ptr(armnetwork.CreatedByTypeUser), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/4883fa5dbf6f2c9093fac8ce334547e9dfac68fa/specification/network/resource-manager/Microsoft.Network/stable/2024-03-01/examples/NetworkManagerAdminRuleCollectionPut.json -func ExampleAdminRuleCollectionsClient_CreateOrUpdate() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armnetwork.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewAdminRuleCollectionsClient().CreateOrUpdate(ctx, "rg1", "testNetworkManager", "myTestSecurityConfig", "testRuleCollection", armnetwork.AdminRuleCollection{ - Properties: &armnetwork.AdminRuleCollectionPropertiesFormat{ - Description: to.Ptr("A sample policy"), - AppliesToGroups: []*armnetwork.ManagerSecurityGroupItem{ - { - NetworkGroupID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/rg1/providers/Microsoft.Network/networkManagers/testNetworkManager/networkGroups/testGroup"), - }}, - }, - }, nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.AdminRuleCollection = armnetwork.AdminRuleCollection{ - // Name: to.Ptr("myTestSecurityConfig"), - // Type: to.Ptr("Microsoft.Network/networkManagers/securityAdminConfigurations/ruleCollections"), - // ID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/rg1/providers/Microsoft.Network/networkManager/testNetworkManager/securityAdminConfigurations/myTestSecurityConfig/ruleCollections/testRuleCollection"), - // Properties: &armnetwork.AdminRuleCollectionPropertiesFormat{ - // Description: to.Ptr("A sample policy"), - // AppliesToGroups: []*armnetwork.ManagerSecurityGroupItem{ - // { - // NetworkGroupID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/rg1/providers/Microsoft.Network/networkManagers/testNetworkManager/networkGroups/testGroup"), - // }}, - // ProvisioningState: to.Ptr(armnetwork.ProvisioningStateSucceeded), - // ResourceGUID: to.Ptr("00000000-0000-0000-0000-000000000000"), - // }, - // SystemData: &armnetwork.SystemData{ - // CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-01-11T18:52:27.000Z"); return t}()), - // CreatedBy: to.Ptr("b69a9388-9488-4534-b470-7ec6d41beef5"), - // CreatedByType: to.Ptr(armnetwork.CreatedByTypeUser), - // LastModifiedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-01-11T18:52:27.000Z"); return t}()), - // LastModifiedBy: to.Ptr("b69a9388-9488-4534-b470-7ec6d41beef5"), - // LastModifiedByType: to.Ptr(armnetwork.CreatedByTypeUser), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/4883fa5dbf6f2c9093fac8ce334547e9dfac68fa/specification/network/resource-manager/Microsoft.Network/stable/2024-03-01/examples/NetworkManagerAdminRuleCollectionDelete.json -func ExampleAdminRuleCollectionsClient_BeginDelete() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armnetwork.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewAdminRuleCollectionsClient().BeginDelete(ctx, "rg1", "testNetworkManager", "myTestSecurityConfig", "testRuleCollection", &armnetwork.AdminRuleCollectionsClientBeginDeleteOptions{Force: to.Ptr(false)}) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - _, err = poller.PollUntilDone(ctx, nil) - if err != nil { - log.Fatalf("failed to pull the result: %v", err) - } -} diff --git a/sdk/resourcemanager/network/armnetwork/adminrules_client_example_test.go b/sdk/resourcemanager/network/armnetwork/adminrules_client_example_test.go deleted file mode 100644 index fb7623e41ca0..000000000000 --- a/sdk/resourcemanager/network/armnetwork/adminrules_client_example_test.go +++ /dev/null @@ -1,373 +0,0 @@ -//go:build go1.18 -// +build go1.18 - -// 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. -// DO NOT EDIT. - -package armnetwork_test - -import ( - "context" - "log" - - "github.com/Azure/azure-sdk-for-go/sdk/azcore/to" - "github.com/Azure/azure-sdk-for-go/sdk/azidentity" - "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/network/armnetwork/v6" -) - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/4883fa5dbf6f2c9093fac8ce334547e9dfac68fa/specification/network/resource-manager/Microsoft.Network/stable/2024-03-01/examples/NetworkManagerAdminRuleList.json -func ExampleAdminRulesClient_NewListPager() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armnetwork.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := clientFactory.NewAdminRulesClient().NewListPager("rg1", "testNetworkManager", "myTestSecurityConfig", "testRuleCollection", &armnetwork.AdminRulesClientListOptions{Top: nil, - SkipToken: nil, - }) - for pager.More() { - page, err := pager.NextPage(ctx) - if err != nil { - log.Fatalf("failed to advance page: %v", err) - } - for _, v := range page.Value { - // You could use page here. We use blank identifier for just demo purposes. - _ = v - } - // If the HTTP response code is 200 as defined in example definition, your page structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // page.AdminRuleListResult = armnetwork.AdminRuleListResult{ - // Value: []armnetwork.BaseAdminRuleClassification{ - // &armnetwork.AdminRule{ - // Name: to.Ptr("SampleAdminRule"), - // Type: to.Ptr("Microsoft.Network/networkManagers/securityAdminConfigurations/ruleCollections/rules"), - // ID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/rg1/providers/Microsoft.Network/networkmanagers/testNetworkManager/securityAdminConfigurations/myTestSecurityConfig/ruleCollections/testRuleCollection/rules/SampleAdminRule"), - // Kind: to.Ptr(armnetwork.AdminRuleKindCustom), - // SystemData: &armnetwork.SystemData{ - // CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-01-11T18:52:27.000Z"); return t}()), - // CreatedBy: to.Ptr("b69a9388-9488-4534-b470-7ec6d41beef5"), - // CreatedByType: to.Ptr(armnetwork.CreatedByTypeUser), - // LastModifiedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-01-11T18:52:27.000Z"); return t}()), - // LastModifiedBy: to.Ptr("b69a9388-9488-4534-b470-7ec6d41beef5"), - // LastModifiedByType: to.Ptr(armnetwork.CreatedByTypeUser), - // }, - // Properties: &armnetwork.AdminPropertiesFormat{ - // Description: to.Ptr("This is Sample Admin Rule"), - // Access: to.Ptr(armnetwork.SecurityConfigurationRuleAccessDeny), - // DestinationPortRanges: []*string{ - // to.Ptr("22")}, - // Destinations: []*armnetwork.AddressPrefixItem{ - // { - // AddressPrefix: to.Ptr("*"), - // AddressPrefixType: to.Ptr(armnetwork.AddressPrefixTypeIPPrefix), - // }}, - // Direction: to.Ptr(armnetwork.SecurityConfigurationRuleDirectionInbound), - // Priority: to.Ptr[int32](1), - // ProvisioningState: to.Ptr(armnetwork.ProvisioningStateSucceeded), - // ResourceGUID: to.Ptr("00000000-0000-0000-0000-000000000000"), - // SourcePortRanges: []*string{ - // to.Ptr("0-65535")}, - // Sources: []*armnetwork.AddressPrefixItem{ - // { - // AddressPrefix: to.Ptr("*"), - // AddressPrefixType: to.Ptr(armnetwork.AddressPrefixTypeIPPrefix), - // }}, - // Protocol: to.Ptr(armnetwork.SecurityConfigurationRuleProtocolTCP), - // }, - // }}, - // } - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/4883fa5dbf6f2c9093fac8ce334547e9dfac68fa/specification/network/resource-manager/Microsoft.Network/stable/2024-03-01/examples/NetworkManagerAdminRuleGet.json -func ExampleAdminRulesClient_Get_getsSecurityAdminRule() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armnetwork.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewAdminRulesClient().Get(ctx, "rg1", "testNetworkManager", "myTestSecurityConfig", "testRuleCollection", "SampleAdminRule", nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res = armnetwork.AdminRulesClientGetResponse{ - // BaseAdminRuleClassification: &armnetwork.AdminRule{ - // Name: to.Ptr("SampleAdminRule"), - // Type: to.Ptr("Microsoft.Network/networkManagers/securityAdminConfigurations/ruleCollections/rules"), - // ID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/rg1/providers/Microsoft.Network/networkManagers/testNetworkManager/securityAdminConfigurations/myTestSecurityConfig/ruleCollections/testRuleCollection/rules/SampleAdminRule"), - // Kind: to.Ptr(armnetwork.AdminRuleKindCustom), - // SystemData: &armnetwork.SystemData{ - // CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-01-11T18:52:27.000Z"); return t}()), - // CreatedBy: to.Ptr("b69a9388-9488-4534-b470-7ec6d41beef5"), - // CreatedByType: to.Ptr(armnetwork.CreatedByTypeUser), - // LastModifiedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-01-11T18:52:27.000Z"); return t}()), - // LastModifiedBy: to.Ptr("b69a9388-9488-4534-b470-7ec6d41beef5"), - // LastModifiedByType: to.Ptr(armnetwork.CreatedByTypeUser), - // }, - // Properties: &armnetwork.AdminPropertiesFormat{ - // Description: to.Ptr("This is Sample Admin Rule"), - // Access: to.Ptr(armnetwork.SecurityConfigurationRuleAccessDeny), - // DestinationPortRanges: []*string{ - // to.Ptr("22")}, - // Destinations: []*armnetwork.AddressPrefixItem{ - // { - // AddressPrefix: to.Ptr("*"), - // AddressPrefixType: to.Ptr(armnetwork.AddressPrefixTypeIPPrefix), - // }}, - // Direction: to.Ptr(armnetwork.SecurityConfigurationRuleDirectionInbound), - // Priority: to.Ptr[int32](1), - // ProvisioningState: to.Ptr(armnetwork.ProvisioningStateSucceeded), - // ResourceGUID: to.Ptr("00000000-0000-0000-0000-000000000000"), - // SourcePortRanges: []*string{ - // to.Ptr("0-65535")}, - // Sources: []*armnetwork.AddressPrefixItem{ - // { - // AddressPrefix: to.Ptr("*"), - // AddressPrefixType: to.Ptr(armnetwork.AddressPrefixTypeIPPrefix), - // }}, - // Protocol: to.Ptr(armnetwork.SecurityConfigurationRuleProtocolTCP), - // }, - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/4883fa5dbf6f2c9093fac8ce334547e9dfac68fa/specification/network/resource-manager/Microsoft.Network/stable/2024-03-01/examples/NetworkManagerDefaultAdminRuleGet.json -func ExampleAdminRulesClient_Get_getsSecurityDefaultAdminRule() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armnetwork.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewAdminRulesClient().Get(ctx, "rg1", "testNetworkManager", "myTestSecurityConfig", "testRuleCollection", "SampleDefaultAdminRule", nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res = armnetwork.AdminRulesClientGetResponse{ - // BaseAdminRuleClassification: &armnetwork.DefaultAdminRule{ - // Name: to.Ptr("SampleDefaultAdminRule"), - // Type: to.Ptr("Microsoft.Network/networkManagers/securityAdminConfigurations/ruleCollections/rules"), - // ID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/rg1/providers/Microsoft.Network/networkManagers/testNetworkManager/securityAdminConfigurations/myTestSecurityConfig/ruleCollections/testRuleCollection/rules/SampleDefaultAdminRule"), - // Kind: to.Ptr(armnetwork.AdminRuleKindDefault), - // SystemData: &armnetwork.SystemData{ - // CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-01-11T18:52:27.000Z"); return t}()), - // CreatedBy: to.Ptr("b69a9388-9488-4534-b470-7ec6d41beef5"), - // CreatedByType: to.Ptr(armnetwork.CreatedByTypeUser), - // LastModifiedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-01-11T18:52:27.000Z"); return t}()), - // LastModifiedBy: to.Ptr("b69a9388-9488-4534-b470-7ec6d41beef5"), - // LastModifiedByType: to.Ptr(armnetwork.CreatedByTypeUser), - // }, - // Properties: &armnetwork.DefaultAdminPropertiesFormat{ - // Description: to.Ptr("This is Sample Default Admin Rule"), - // Access: to.Ptr(armnetwork.SecurityConfigurationRuleAccessDeny), - // DestinationPortRanges: []*string{ - // to.Ptr("22")}, - // Destinations: []*armnetwork.AddressPrefixItem{ - // { - // AddressPrefix: to.Ptr("*"), - // AddressPrefixType: to.Ptr(armnetwork.AddressPrefixTypeIPPrefix), - // }}, - // Direction: to.Ptr(armnetwork.SecurityConfigurationRuleDirectionInbound), - // Flag: to.Ptr("AllowVnetInbound"), - // Priority: to.Ptr[int32](1), - // ProvisioningState: to.Ptr(armnetwork.ProvisioningStateSucceeded), - // ResourceGUID: to.Ptr("00000000-0000-0000-0000-000000000000"), - // SourcePortRanges: []*string{ - // to.Ptr("0-65535")}, - // Sources: []*armnetwork.AddressPrefixItem{ - // { - // AddressPrefix: to.Ptr("*"), - // AddressPrefixType: to.Ptr(armnetwork.AddressPrefixTypeIPPrefix), - // }}, - // Protocol: to.Ptr(armnetwork.SecurityConfigurationRuleProtocolTCP), - // }, - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/4883fa5dbf6f2c9093fac8ce334547e9dfac68fa/specification/network/resource-manager/Microsoft.Network/stable/2024-03-01/examples/NetworkManagerDefaultAdminRulePut.json -func ExampleAdminRulesClient_CreateOrUpdate_createADefaultAdminRule() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armnetwork.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewAdminRulesClient().CreateOrUpdate(ctx, "rg1", "testNetworkManager", "myTestSecurityConfig", "testRuleCollection", "SampleDefaultAdminRule", &armnetwork.DefaultAdminRule{ - Kind: to.Ptr(armnetwork.AdminRuleKindDefault), - Properties: &armnetwork.DefaultAdminPropertiesFormat{ - Flag: to.Ptr("AllowVnetInbound"), - }, - }, nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res = armnetwork.AdminRulesClientCreateOrUpdateResponse{ - // BaseAdminRuleClassification: &armnetwork.DefaultAdminRule{ - // Name: to.Ptr("SampleDefaultAdminRule"), - // Type: to.Ptr("Microsoft.Network/networkManagers/securityAdminConfigurations/ruleCollections/rules"), - // ID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/rg1/providers/Microsoft.Network/networkManagers/testNetworkManager/securityAdminConfigurations/myTestSecurityConfig/ruleCollections/testRuleCollection/rules/SampleDefaultAdminRule"), - // Kind: to.Ptr(armnetwork.AdminRuleKindDefault), - // SystemData: &armnetwork.SystemData{ - // CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-01-11T18:52:27.000Z"); return t}()), - // CreatedBy: to.Ptr("b69a9388-9488-4534-b470-7ec6d41beef5"), - // CreatedByType: to.Ptr(armnetwork.CreatedByTypeUser), - // LastModifiedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-01-11T18:52:27.000Z"); return t}()), - // LastModifiedBy: to.Ptr("b69a9388-9488-4534-b470-7ec6d41beef5"), - // LastModifiedByType: to.Ptr(armnetwork.CreatedByTypeUser), - // }, - // Properties: &armnetwork.DefaultAdminPropertiesFormat{ - // Description: to.Ptr("This is Sample Default Admin Rule"), - // Access: to.Ptr(armnetwork.SecurityConfigurationRuleAccessDeny), - // DestinationPortRanges: []*string{ - // to.Ptr("22")}, - // Destinations: []*armnetwork.AddressPrefixItem{ - // { - // AddressPrefix: to.Ptr("*"), - // AddressPrefixType: to.Ptr(armnetwork.AddressPrefixTypeIPPrefix), - // }}, - // Direction: to.Ptr(armnetwork.SecurityConfigurationRuleDirectionInbound), - // Flag: to.Ptr("AllowVnetInbound"), - // Priority: to.Ptr[int32](1), - // ProvisioningState: to.Ptr(armnetwork.ProvisioningStateSucceeded), - // ResourceGUID: to.Ptr("00000000-0000-0000-0000-000000000000"), - // SourcePortRanges: []*string{ - // to.Ptr("0-65535")}, - // Sources: []*armnetwork.AddressPrefixItem{ - // { - // AddressPrefix: to.Ptr("Internet"), - // AddressPrefixType: to.Ptr(armnetwork.AddressPrefixTypeServiceTag), - // }}, - // Protocol: to.Ptr(armnetwork.SecurityConfigurationRuleProtocolTCP), - // }, - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/4883fa5dbf6f2c9093fac8ce334547e9dfac68fa/specification/network/resource-manager/Microsoft.Network/stable/2024-03-01/examples/NetworkManagerAdminRulePut.json -func ExampleAdminRulesClient_CreateOrUpdate_createAnAdminRule() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armnetwork.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewAdminRulesClient().CreateOrUpdate(ctx, "rg1", "testNetworkManager", "myTestSecurityConfig", "testRuleCollection", "SampleAdminRule", &armnetwork.AdminRule{ - Kind: to.Ptr(armnetwork.AdminRuleKindCustom), - Properties: &armnetwork.AdminPropertiesFormat{ - Description: to.Ptr("This is Sample Admin Rule"), - Access: to.Ptr(armnetwork.SecurityConfigurationRuleAccessDeny), - DestinationPortRanges: []*string{ - to.Ptr("22")}, - Destinations: []*armnetwork.AddressPrefixItem{ - { - AddressPrefix: to.Ptr("*"), - AddressPrefixType: to.Ptr(armnetwork.AddressPrefixTypeIPPrefix), - }}, - Direction: to.Ptr(armnetwork.SecurityConfigurationRuleDirectionInbound), - Priority: to.Ptr[int32](1), - SourcePortRanges: []*string{ - to.Ptr("0-65535")}, - Sources: []*armnetwork.AddressPrefixItem{ - { - AddressPrefix: to.Ptr("Internet"), - AddressPrefixType: to.Ptr(armnetwork.AddressPrefixTypeServiceTag), - }}, - Protocol: to.Ptr(armnetwork.SecurityConfigurationRuleProtocolTCP), - }, - }, nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res = armnetwork.AdminRulesClientCreateOrUpdateResponse{ - // BaseAdminRuleClassification: &armnetwork.AdminRule{ - // Name: to.Ptr("SampleAdminRule"), - // Type: to.Ptr("Microsoft.Network/networkManagers/securityAdminConfigurations/ruleCollections/rules"), - // ID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/rg1/providers/Microsoft.Network/networkManagers/testNetworkManager/securityAdminConfigurations/myTestSecurityConfig/ruleCollections/testRuleCollection/rules/SampleAdminRule"), - // Kind: to.Ptr(armnetwork.AdminRuleKindCustom), - // SystemData: &armnetwork.SystemData{ - // CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-01-11T18:52:27.000Z"); return t}()), - // CreatedBy: to.Ptr("b69a9388-9488-4534-b470-7ec6d41beef5"), - // CreatedByType: to.Ptr(armnetwork.CreatedByTypeUser), - // LastModifiedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-01-11T18:52:27.000Z"); return t}()), - // LastModifiedBy: to.Ptr("b69a9388-9488-4534-b470-7ec6d41beef5"), - // LastModifiedByType: to.Ptr(armnetwork.CreatedByTypeUser), - // }, - // Properties: &armnetwork.AdminPropertiesFormat{ - // Description: to.Ptr("This is Sample Admin Rule"), - // Access: to.Ptr(armnetwork.SecurityConfigurationRuleAccessDeny), - // DestinationPortRanges: []*string{ - // to.Ptr("22")}, - // Destinations: []*armnetwork.AddressPrefixItem{ - // { - // AddressPrefix: to.Ptr("*"), - // AddressPrefixType: to.Ptr(armnetwork.AddressPrefixTypeIPPrefix), - // }}, - // Direction: to.Ptr(armnetwork.SecurityConfigurationRuleDirectionInbound), - // Priority: to.Ptr[int32](1), - // ProvisioningState: to.Ptr(armnetwork.ProvisioningStateSucceeded), - // ResourceGUID: to.Ptr("00000000-0000-0000-0000-000000000000"), - // SourcePortRanges: []*string{ - // to.Ptr("0-65535")}, - // Sources: []*armnetwork.AddressPrefixItem{ - // { - // AddressPrefix: to.Ptr("Internet"), - // AddressPrefixType: to.Ptr(armnetwork.AddressPrefixTypeServiceTag), - // }}, - // Protocol: to.Ptr(armnetwork.SecurityConfigurationRuleProtocolTCP), - // }, - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/4883fa5dbf6f2c9093fac8ce334547e9dfac68fa/specification/network/resource-manager/Microsoft.Network/stable/2024-03-01/examples/NetworkManagerAdminRuleDelete.json -func ExampleAdminRulesClient_BeginDelete() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armnetwork.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewAdminRulesClient().BeginDelete(ctx, "rg1", "testNetworkManager", "myTestSecurityConfig", "testRuleCollection", "SampleAdminRule", &armnetwork.AdminRulesClientBeginDeleteOptions{Force: to.Ptr(false)}) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - _, err = poller.PollUntilDone(ctx, nil) - if err != nil { - log.Fatalf("failed to pull the result: %v", err) - } -} diff --git a/sdk/resourcemanager/network/armnetwork/applicationgatewayprivateendpointconnections_client_example_test.go b/sdk/resourcemanager/network/armnetwork/applicationgatewayprivateendpointconnections_client_example_test.go deleted file mode 100644 index b7b5b982ae03..000000000000 --- a/sdk/resourcemanager/network/armnetwork/applicationgatewayprivateendpointconnections_client_example_test.go +++ /dev/null @@ -1,169 +0,0 @@ -//go:build go1.18 -// +build go1.18 - -// 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. -// DO NOT EDIT. - -package armnetwork_test - -import ( - "context" - "log" - - "github.com/Azure/azure-sdk-for-go/sdk/azcore/to" - "github.com/Azure/azure-sdk-for-go/sdk/azidentity" - "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/network/armnetwork/v6" -) - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/4883fa5dbf6f2c9093fac8ce334547e9dfac68fa/specification/network/resource-manager/Microsoft.Network/stable/2024-03-01/examples/ApplicationGatewayPrivateEndpointConnectionDelete.json -func ExampleApplicationGatewayPrivateEndpointConnectionsClient_BeginDelete() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armnetwork.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewApplicationGatewayPrivateEndpointConnectionsClient().BeginDelete(ctx, "rg1", "appgw", "connection1", nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - _, err = poller.PollUntilDone(ctx, nil) - if err != nil { - log.Fatalf("failed to pull the result: %v", err) - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/4883fa5dbf6f2c9093fac8ce334547e9dfac68fa/specification/network/resource-manager/Microsoft.Network/stable/2024-03-01/examples/ApplicationGatewayPrivateEndpointConnectionUpdate.json -func ExampleApplicationGatewayPrivateEndpointConnectionsClient_BeginUpdate() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armnetwork.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewApplicationGatewayPrivateEndpointConnectionsClient().BeginUpdate(ctx, "rg1", "appgw", "connection1", armnetwork.ApplicationGatewayPrivateEndpointConnection{ - Name: to.Ptr("connection1"), - Properties: &armnetwork.ApplicationGatewayPrivateEndpointConnectionProperties{ - PrivateEndpoint: &armnetwork.PrivateEndpoint{ - ID: to.Ptr("/subscriptions/subId2/resourceGroups/rg1/providers/Microsoft.Network/privateEndpoints/testPe"), - }, - PrivateLinkServiceConnectionState: &armnetwork.PrivateLinkServiceConnectionState{ - Description: to.Ptr("approved it for some reason."), - Status: to.Ptr("Approved"), - }, - }, - }, nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - res, err := poller.PollUntilDone(ctx, nil) - if err != nil { - log.Fatalf("failed to pull the result: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.ApplicationGatewayPrivateEndpointConnection = armnetwork.ApplicationGatewayPrivateEndpointConnection{ - // ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/applicationGateways/appgw/privateLinkResources/testPlePeConnection"), - // Name: to.Ptr("testPlePeConnection"), - // Properties: &armnetwork.ApplicationGatewayPrivateEndpointConnectionProperties{ - // LinkIdentifier: to.Ptr("linkId"), - // PrivateEndpoint: &armnetwork.PrivateEndpoint{ - // ID: to.Ptr("/subscriptions/subId/resourceGroups/rg1/providers/Microsoft.Network/privateEndpoints/testPe"), - // }, - // PrivateLinkServiceConnectionState: &armnetwork.PrivateLinkServiceConnectionState{ - // Description: to.Ptr("approved it for some reason."), - // Status: to.Ptr("Approved"), - // }, - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/4883fa5dbf6f2c9093fac8ce334547e9dfac68fa/specification/network/resource-manager/Microsoft.Network/stable/2024-03-01/examples/ApplicationGatewayPrivateEndpointConnectionGet.json -func ExampleApplicationGatewayPrivateEndpointConnectionsClient_Get() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armnetwork.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewApplicationGatewayPrivateEndpointConnectionsClient().Get(ctx, "rg1", "appgw", "connection1", nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.ApplicationGatewayPrivateEndpointConnection = armnetwork.ApplicationGatewayPrivateEndpointConnection{ - // ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/applicationGateways/appgw/privateLinkResources/connection1"), - // Name: to.Ptr("coonection1"), - // Type: to.Ptr("Microsoft.Network/applicationGateways/privateEndpointConnections"), - // Properties: &armnetwork.ApplicationGatewayPrivateEndpointConnectionProperties{ - // LinkIdentifier: to.Ptr("805319460"), - // PrivateEndpoint: &armnetwork.PrivateEndpoint{ - // ID: to.Ptr("/subscriptions/subid2/resourceGroups/rg1/providers/Microsoft.Network/privateEndpoints/pe1"), - // }, - // PrivateLinkServiceConnectionState: &armnetwork.PrivateLinkServiceConnectionState{ - // Description: to.Ptr("Approval Done"), - // Status: to.Ptr("Approved"), - // }, - // ProvisioningState: to.Ptr(armnetwork.ProvisioningStateSucceeded), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/4883fa5dbf6f2c9093fac8ce334547e9dfac68fa/specification/network/resource-manager/Microsoft.Network/stable/2024-03-01/examples/ApplicationGatewayPrivateEndpointConnectionList.json -func ExampleApplicationGatewayPrivateEndpointConnectionsClient_NewListPager() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armnetwork.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := clientFactory.NewApplicationGatewayPrivateEndpointConnectionsClient().NewListPager("rg1", "appgw", nil) - for pager.More() { - page, err := pager.NextPage(ctx) - if err != nil { - log.Fatalf("failed to advance page: %v", err) - } - for _, v := range page.Value { - // You could use page here. We use blank identifier for just demo purposes. - _ = v - } - // If the HTTP response code is 200 as defined in example definition, your page structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // page.ApplicationGatewayPrivateEndpointConnectionListResult = armnetwork.ApplicationGatewayPrivateEndpointConnectionListResult{ - // Value: []*armnetwork.ApplicationGatewayPrivateEndpointConnection{ - // { - // ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/applicationGateways/appgw/privateLinkResources/connection1"), - // Name: to.Ptr("coonection1"), - // Type: to.Ptr("Microsoft.Network/applicationGateways/privateEndpointConnections"), - // Properties: &armnetwork.ApplicationGatewayPrivateEndpointConnectionProperties{ - // LinkIdentifier: to.Ptr("805319460"), - // PrivateEndpoint: &armnetwork.PrivateEndpoint{ - // ID: to.Ptr("/subscriptions/subid2/resourceGroups/rg1/providers/Microsoft.Network/privateEndpoints/pe1"), - // }, - // PrivateLinkServiceConnectionState: &armnetwork.PrivateLinkServiceConnectionState{ - // Description: to.Ptr("Approval Done"), - // Status: to.Ptr("Approved"), - // }, - // ProvisioningState: to.Ptr(armnetwork.ProvisioningStateSucceeded), - // }, - // }}, - // } - } -} diff --git a/sdk/resourcemanager/network/armnetwork/applicationgatewayprivatelinkresources_client_example_test.go b/sdk/resourcemanager/network/armnetwork/applicationgatewayprivatelinkresources_client_example_test.go deleted file mode 100644 index 5bb447e4205a..000000000000 --- a/sdk/resourcemanager/network/armnetwork/applicationgatewayprivatelinkresources_client_example_test.go +++ /dev/null @@ -1,58 +0,0 @@ -//go:build go1.18 -// +build go1.18 - -// 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. -// DO NOT EDIT. - -package armnetwork_test - -import ( - "context" - "log" - - "github.com/Azure/azure-sdk-for-go/sdk/azidentity" - "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/network/armnetwork/v6" -) - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/4883fa5dbf6f2c9093fac8ce334547e9dfac68fa/specification/network/resource-manager/Microsoft.Network/stable/2024-03-01/examples/ApplicationGatewayPrivateLinkResourceList.json -func ExampleApplicationGatewayPrivateLinkResourcesClient_NewListPager() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armnetwork.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := clientFactory.NewApplicationGatewayPrivateLinkResourcesClient().NewListPager("rg1", "appgw", nil) - for pager.More() { - page, err := pager.NextPage(ctx) - if err != nil { - log.Fatalf("failed to advance page: %v", err) - } - for _, v := range page.Value { - // You could use page here. We use blank identifier for just demo purposes. - _ = v - } - // If the HTTP response code is 200 as defined in example definition, your page structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // page.ApplicationGatewayPrivateLinkResourceListResult = armnetwork.ApplicationGatewayPrivateLinkResourceListResult{ - // Value: []*armnetwork.ApplicationGatewayPrivateLinkResource{ - // { - // ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/applicationGateways/appgw/privateLinkResources/privateLink1"), - // Name: to.Ptr("privateLink1"), - // Type: to.Ptr("Microsoft.Network/applicationGateways/privateLinkResources"), - // Properties: &armnetwork.ApplicationGatewayPrivateLinkResourceProperties{ - // GroupID: to.Ptr("privateLink1"), - // RequiredMembers: []*string{ - // to.Ptr("privateLink1")}, - // RequiredZoneNames: []*string{ - // }, - // }, - // }}, - // } - } -} diff --git a/sdk/resourcemanager/network/armnetwork/applicationgateways_client_example_test.go b/sdk/resourcemanager/network/armnetwork/applicationgateways_client_example_test.go deleted file mode 100644 index 36ee317c9d0d..000000000000 --- a/sdk/resourcemanager/network/armnetwork/applicationgateways_client_example_test.go +++ /dev/null @@ -1,2346 +0,0 @@ -//go:build go1.18 -// +build go1.18 - -// 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. -// DO NOT EDIT. - -package armnetwork_test - -import ( - "context" - "log" - - "github.com/Azure/azure-sdk-for-go/sdk/azcore/to" - "github.com/Azure/azure-sdk-for-go/sdk/azidentity" - "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/network/armnetwork/v6" -) - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/4883fa5dbf6f2c9093fac8ce334547e9dfac68fa/specification/network/resource-manager/Microsoft.Network/stable/2024-03-01/examples/ApplicationGatewayDelete.json -func ExampleApplicationGatewaysClient_BeginDelete() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armnetwork.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewApplicationGatewaysClient().BeginDelete(ctx, "rg1", "appgw", nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - _, err = poller.PollUntilDone(ctx, nil) - if err != nil { - log.Fatalf("failed to pull the result: %v", err) - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/4883fa5dbf6f2c9093fac8ce334547e9dfac68fa/specification/network/resource-manager/Microsoft.Network/stable/2024-03-01/examples/ApplicationGatewayGet.json -func ExampleApplicationGatewaysClient_Get() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armnetwork.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewApplicationGatewaysClient().Get(ctx, "rg1", "appgw", nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.ApplicationGateway = armnetwork.ApplicationGateway{ - // Name: to.Ptr("appgw"), - // Type: to.Ptr("Microsoft.Network/applicationGateways"), - // ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/applicationGateways/appgw"), - // Location: to.Ptr("southcentralus"), - // Properties: &armnetwork.ApplicationGatewayPropertiesFormat{ - // AuthenticationCertificates: []*armnetwork.ApplicationGatewayAuthenticationCertificate{ - // }, - // BackendAddressPools: []*armnetwork.ApplicationGatewayBackendAddressPool{ - // { - // ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/applicationGateways/appgw/backendAddressPools/appgwpool"), - // Name: to.Ptr("appgwpool"), - // Properties: &armnetwork.ApplicationGatewayBackendAddressPoolPropertiesFormat{ - // BackendAddresses: []*armnetwork.ApplicationGatewayBackendAddress{ - // }, - // ProvisioningState: to.Ptr(armnetwork.ProvisioningStateSucceeded), - // }, - // }, - // { - // ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/applicationGateways/appgw/backendAddressPools/appgwpool1"), - // Name: to.Ptr("appgwpool1"), - // Properties: &armnetwork.ApplicationGatewayBackendAddressPoolPropertiesFormat{ - // BackendAddresses: []*armnetwork.ApplicationGatewayBackendAddress{ - // { - // }, - // { - // }}, - // ProvisioningState: to.Ptr(armnetwork.ProvisioningStateSucceeded), - // }, - // }}, - // BackendHTTPSettingsCollection: []*armnetwork.ApplicationGatewayBackendHTTPSettings{ - // { - // ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/applicationGateways/appgw/backendHttpSettingsCollection/appgwbhs"), - // Name: to.Ptr("appgwbhs"), - // Properties: &armnetwork.ApplicationGatewayBackendHTTPSettingsPropertiesFormat{ - // CookieBasedAffinity: to.Ptr(armnetwork.ApplicationGatewayCookieBasedAffinityDisabled), - // Port: to.Ptr[int32](80), - // ProvisioningState: to.Ptr(armnetwork.ProvisioningStateSucceeded), - // RequestTimeout: to.Ptr[int32](30), - // Protocol: to.Ptr(armnetwork.ApplicationGatewayProtocolHTTP), - // }, - // }}, - // FrontendIPConfigurations: []*armnetwork.ApplicationGatewayFrontendIPConfiguration{ - // { - // ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/applicationGateways/appgw/frontendIPConfigurations/appgwfip"), - // Name: to.Ptr("appgwfip"), - // Properties: &armnetwork.ApplicationGatewayFrontendIPConfigurationPropertiesFormat{ - // PrivateIPAllocationMethod: to.Ptr(armnetwork.IPAllocationMethodDynamic), - // ProvisioningState: to.Ptr(armnetwork.ProvisioningStateSucceeded), - // PublicIPAddress: &armnetwork.SubResource{ - // ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/publicIPAddresses/appgwpip"), - // }, - // }, - // }}, - // FrontendPorts: []*armnetwork.ApplicationGatewayFrontendPort{ - // { - // ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/applicationGateways/appgw/frontendPorts/appgwfp"), - // Name: to.Ptr("appgwfp"), - // Properties: &armnetwork.ApplicationGatewayFrontendPortPropertiesFormat{ - // Port: to.Ptr[int32](443), - // ProvisioningState: to.Ptr(armnetwork.ProvisioningStateSucceeded), - // }, - // }, - // { - // ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/applicationGateways/appgw/frontendPorts/appgwfp80"), - // Name: to.Ptr("appgwfp80"), - // Properties: &armnetwork.ApplicationGatewayFrontendPortPropertiesFormat{ - // Port: to.Ptr[int32](80), - // ProvisioningState: to.Ptr(armnetwork.ProvisioningStateSucceeded), - // }, - // }}, - // GatewayIPConfigurations: []*armnetwork.ApplicationGatewayIPConfiguration{ - // { - // ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/applicationGateways/appgw/gatewayIPConfigurations/appgwipc"), - // Name: to.Ptr("appgwipc"), - // Properties: &armnetwork.ApplicationGatewayIPConfigurationPropertiesFormat{ - // ProvisioningState: to.Ptr(armnetwork.ProvisioningStateSucceeded), - // Subnet: &armnetwork.SubResource{ - // ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/virtualNetworks/virtualNetwork1/subnets/appgwsubnet"), - // }, - // }, - // }}, - // GlobalConfiguration: &armnetwork.ApplicationGatewayGlobalConfiguration{ - // EnableRequestBuffering: to.Ptr(true), - // EnableResponseBuffering: to.Ptr(true), - // }, - // HTTPListeners: []*armnetwork.ApplicationGatewayHTTPListener{ - // { - // ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/applicationGateways/appgw/httpListeners/appgwhl"), - // Name: to.Ptr("appgwhl"), - // Properties: &armnetwork.ApplicationGatewayHTTPListenerPropertiesFormat{ - // FrontendIPConfiguration: &armnetwork.SubResource{ - // ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/applicationGateways/appgw/frontendIPConfigurations/appgwfip"), - // }, - // FrontendPort: &armnetwork.SubResource{ - // ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/applicationGateways/appgw/frontendPorts/appgwfp"), - // }, - // ProvisioningState: to.Ptr(armnetwork.ProvisioningStateSucceeded), - // RequireServerNameIndication: to.Ptr(false), - // SSLCertificate: &armnetwork.SubResource{ - // ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/applicationGateways/appgw/sslCertificates/sslcert"), - // }, - // SSLProfile: &armnetwork.SubResource{ - // ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/applicationGateways/appgw/sslProfiles/sslProfile1"), - // }, - // Protocol: to.Ptr(armnetwork.ApplicationGatewayProtocolHTTPS), - // }, - // }, - // { - // ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/applicationGateways/appgw/httpListeners/appgwhttplistener"), - // Name: to.Ptr("appgwhttplistener"), - // Properties: &armnetwork.ApplicationGatewayHTTPListenerPropertiesFormat{ - // FrontendIPConfiguration: &armnetwork.SubResource{ - // ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/applicationGateways/appgw/frontendIPConfigurations/appgwfip"), - // }, - // FrontendPort: &armnetwork.SubResource{ - // ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/applicationGateways/appgw/frontendPorts/appgwfp80"), - // }, - // ProvisioningState: to.Ptr(armnetwork.ProvisioningStateSucceeded), - // Protocol: to.Ptr(armnetwork.ApplicationGatewayProtocolHTTP), - // }, - // }}, - // LoadDistributionPolicies: []*armnetwork.ApplicationGatewayLoadDistributionPolicy{ - // { - // ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/applicationGateways/appgw/loadDistributionPolicies/ldp1"), - // Name: to.Ptr("ldp1"), - // Properties: &armnetwork.ApplicationGatewayLoadDistributionPolicyPropertiesFormat{ - // LoadDistributionAlgorithm: to.Ptr(armnetwork.ApplicationGatewayLoadDistributionAlgorithmRoundRobin), - // LoadDistributionTargets: []*armnetwork.ApplicationGatewayLoadDistributionTarget{ - // { - // ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/applicationGateways/appgw/loadDistributionPolicies/ldp1/loadDistributionTargets/ldt1"), - // Name: to.Ptr("ld11"), - // Properties: &armnetwork.ApplicationGatewayLoadDistributionTargetPropertiesFormat{ - // BackendAddressPool: &armnetwork.SubResource{ - // ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/applicationGateways/appgw/backendAddressPools/appgwpool"), - // }, - // WeightPerServer: to.Ptr[int32](40), - // }, - // }, - // { - // ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/applicationGateways/appgw/loadDistributionPolicies/ldp1/loadDistributionTargets/ldt1"), - // Name: to.Ptr("ld11"), - // Properties: &armnetwork.ApplicationGatewayLoadDistributionTargetPropertiesFormat{ - // BackendAddressPool: &armnetwork.SubResource{ - // ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/applicationGateways/appgw/backendAddressPools/appgwpool1"), - // }, - // WeightPerServer: to.Ptr[int32](60), - // }, - // }}, - // }, - // }}, - // OperationalState: to.Ptr(armnetwork.ApplicationGatewayOperationalStateRunning), - // PrivateEndpointConnections: []*armnetwork.ApplicationGatewayPrivateEndpointConnection{ - // }, - // PrivateLinkConfigurations: []*armnetwork.ApplicationGatewayPrivateLinkConfiguration{ - // { - // ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/applicationGateways/appgw/privateLinkConfigurations/privateLink1"), - // Name: to.Ptr("privateLink1"), - // Properties: &armnetwork.ApplicationGatewayPrivateLinkConfigurationProperties{ - // IPConfigurations: []*armnetwork.ApplicationGatewayPrivateLinkIPConfiguration{ - // { - // ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/applicationGateways/appgw/privateLinkConfigurations/privateLink1/privateLinkConfigurations/privateLink1/ipConfigurations/natNicIpconfig1"), - // Name: to.Ptr("natNicIpconfig1"), - // Properties: &armnetwork.ApplicationGatewayPrivateLinkIPConfigurationProperties{ - // Primary: to.Ptr(true), - // PrivateIPAllocationMethod: to.Ptr(armnetwork.IPAllocationMethodDynamic), - // ProvisioningState: to.Ptr(armnetwork.ProvisioningStateSucceeded), - // Subnet: &armnetwork.SubResource{ - // ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/virtualNetworks/virtualNetwork1/subnets/appgwsubnet"), - // }, - // }, - // }, - // { - // ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/applicationGateways/appgw/privateLinkConfigurations/privateLink1/privateLinkConfigurations/privateLink1/ipConfigurations/natNicIpconfig2"), - // Name: to.Ptr("natNicIpconfig2"), - // Properties: &armnetwork.ApplicationGatewayPrivateLinkIPConfigurationProperties{ - // PrivateIPAllocationMethod: to.Ptr(armnetwork.IPAllocationMethodDynamic), - // ProvisioningState: to.Ptr(armnetwork.ProvisioningStateSucceeded), - // Subnet: &armnetwork.SubResource{ - // ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/virtualNetworks/virtualNetwork1/subnets/appgwsubnet"), - // }, - // }, - // }}, - // ProvisioningState: to.Ptr(armnetwork.ProvisioningStateSucceeded), - // }, - // }}, - // Probes: []*armnetwork.ApplicationGatewayProbe{ - // }, - // ProvisioningState: to.Ptr(armnetwork.ProvisioningStateSucceeded), - // RequestRoutingRules: []*armnetwork.ApplicationGatewayRequestRoutingRule{ - // { - // ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/applicationGateways/appgw/requestRoutingRules/appgwrule"), - // Name: to.Ptr("appgwrule"), - // Properties: &armnetwork.ApplicationGatewayRequestRoutingRulePropertiesFormat{ - // BackendAddressPool: &armnetwork.SubResource{ - // ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/applicationGateways/appgw/backendAddressPools/appgwpool"), - // }, - // BackendHTTPSettings: &armnetwork.SubResource{ - // ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/applicationGateways/appgw/backendHttpSettingsCollection/appgwbhs"), - // }, - // HTTPListener: &armnetwork.SubResource{ - // ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/applicationGateways/appgw/httpListeners/appgwhl"), - // }, - // LoadDistributionPolicy: &armnetwork.SubResource{ - // ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/applicationGateways/appgw/loadDistributionPolicies/ldp1"), - // }, - // Priority: to.Ptr[int32](10), - // ProvisioningState: to.Ptr(armnetwork.ProvisioningStateSucceeded), - // RewriteRuleSet: &armnetwork.SubResource{ - // ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/applicationGateways/appgw/rewriteRuleSets/rewriteRuleSet1"), - // }, - // RuleType: to.Ptr(armnetwork.ApplicationGatewayRequestRoutingRuleTypeBasic), - // }, - // }, - // { - // ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/applicationGateways/appgw/requestRoutingRules/appgwPathBasedRule"), - // Name: to.Ptr("appgwPathBasedRule"), - // Properties: &armnetwork.ApplicationGatewayRequestRoutingRulePropertiesFormat{ - // HTTPListener: &armnetwork.SubResource{ - // ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/applicationGateways/appgw/httpListeners/appgwhttplistener"), - // }, - // Priority: to.Ptr[int32](20), - // ProvisioningState: to.Ptr(armnetwork.ProvisioningStateSucceeded), - // RuleType: to.Ptr(armnetwork.ApplicationGatewayRequestRoutingRuleTypePathBasedRouting), - // URLPathMap: &armnetwork.SubResource{ - // ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/applicationGateways/appgw/urlPathMaps/pathMap1"), - // }, - // }, - // }}, - // RewriteRuleSets: []*armnetwork.ApplicationGatewayRewriteRuleSet{ - // { - // ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/applicationGateways/appgw/rewriteRuleSets/rewriteRuleSet1"), - // Name: to.Ptr("rewriteRuleSet1"), - // Properties: &armnetwork.ApplicationGatewayRewriteRuleSetPropertiesFormat{ - // ProvisioningState: to.Ptr(armnetwork.ProvisioningStateSucceeded), - // RewriteRules: []*armnetwork.ApplicationGatewayRewriteRule{ - // { - // Name: to.Ptr("Set X-Forwarded-For"), - // ActionSet: &armnetwork.ApplicationGatewayRewriteRuleActionSet{ - // RequestHeaderConfigurations: []*armnetwork.ApplicationGatewayHeaderConfiguration{ - // { - // HeaderName: to.Ptr("X-Forwarded-For"), - // HeaderValue: to.Ptr("{var_remote-addr}"), - // }}, - // ResponseHeaderConfigurations: []*armnetwork.ApplicationGatewayHeaderConfiguration{ - // { - // HeaderName: to.Ptr("Strict-Transport-Security"), - // HeaderValue: to.Ptr("max-age=31536000"), - // }}, - // URLConfiguration: &armnetwork.ApplicationGatewayURLConfiguration{ - // ModifiedPath: to.Ptr("/abc"), - // ModifiedQueryString: to.Ptr("x=y&a=b"), - // Reroute: to.Ptr(false), - // }, - // }, - // Conditions: []*armnetwork.ApplicationGatewayRewriteRuleCondition{ - // { - // IgnoreCase: to.Ptr(true), - // Negate: to.Ptr(false), - // Pattern: to.Ptr("^Bearer"), - // Variable: to.Ptr("http_req_Authorization"), - // }}, - // RuleSequence: to.Ptr[int32](102), - // }}, - // }, - // }}, - // SKU: &armnetwork.ApplicationGatewaySKU{ - // Name: to.Ptr(armnetwork.ApplicationGatewaySKUNameStandardMedium), - // Capacity: to.Ptr[int32](3), - // Tier: to.Ptr(armnetwork.ApplicationGatewayTierStandard), - // }, - // SSLCertificates: []*armnetwork.ApplicationGatewaySSLCertificate{ - // { - // ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/applicationGateways/appgw/sslCertificates/sslcert"), - // Name: to.Ptr("sslcert"), - // Properties: &armnetwork.ApplicationGatewaySSLCertificatePropertiesFormat{ - // ProvisioningState: to.Ptr(armnetwork.ProvisioningStateSucceeded), - // PublicCertData: to.Ptr("*****"), - // }, - // }}, - // SSLProfiles: []*armnetwork.ApplicationGatewaySSLProfile{ - // { - // ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/applicationGateways/appgw/sslProfiles/sslProfile1"), - // Name: to.Ptr("sslProfile1"), - // Properties: &armnetwork.ApplicationGatewaySSLProfilePropertiesFormat{ - // ClientAuthConfiguration: &armnetwork.ApplicationGatewayClientAuthConfiguration{ - // VerifyClientCertIssuerDN: to.Ptr(true), - // VerifyClientRevocation: to.Ptr(armnetwork.ApplicationGatewayClientRevocationOptionsOCSP), - // }, - // ProvisioningState: to.Ptr(armnetwork.ProvisioningStateSucceeded), - // SSLPolicy: &armnetwork.ApplicationGatewaySSLPolicy{ - // CipherSuites: []*armnetwork.ApplicationGatewaySSLCipherSuite{ - // to.Ptr(armnetwork.ApplicationGatewaySSLCipherSuiteTLSECDHERSAWITHAES128CBCSHA256)}, - // MinProtocolVersion: to.Ptr(armnetwork.ApplicationGatewaySSLProtocolTLSv11), - // PolicyType: to.Ptr(armnetwork.ApplicationGatewaySSLPolicyTypeCustom), - // }, - // TrustedClientCertificates: []*armnetwork.SubResource{ - // { - // ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/applicationGateways/appgw/trustedClientCertificates/clientcert"), - // }}, - // }, - // }}, - // TrustedClientCertificates: []*armnetwork.ApplicationGatewayTrustedClientCertificate{ - // { - // ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/applicationGateways/appgw/trustedClientCertificates/clientcert"), - // Name: to.Ptr("clientcert"), - // Properties: &armnetwork.ApplicationGatewayTrustedClientCertificatePropertiesFormat{ - // ClientCertIssuerDN: to.Ptr("CN=User1, OU=Eng, O=Company Ltd, L=D4, S=Arizona, C=US"), - // Data: to.Ptr("****"), - // ProvisioningState: to.Ptr(armnetwork.ProvisioningStateSucceeded), - // ValidatedCertData: to.Ptr("****"), - // }, - // }}, - // URLPathMaps: []*armnetwork.ApplicationGatewayURLPathMap{ - // { - // ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/applicationGateways/appgw/urlPathMaps/pathMap1"), - // Name: to.Ptr("pathMap1"), - // Properties: &armnetwork.ApplicationGatewayURLPathMapPropertiesFormat{ - // DefaultBackendAddressPool: &armnetwork.SubResource{ - // ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/applicationGateways/appgw/backendAddressPools/appgwpool"), - // }, - // DefaultBackendHTTPSettings: &armnetwork.SubResource{ - // ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/applicationGateways/appgw/backendHttpSettingsCollection/appgwbhs"), - // }, - // DefaultLoadDistributionPolicy: &armnetwork.SubResource{ - // ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/applicationGateways/appgw/loadDistributionPolicies/ldp1"), - // }, - // DefaultRewriteRuleSet: &armnetwork.SubResource{ - // ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/applicationGateways/appgw/rewriteRuleSets/rewriteRuleSet1"), - // }, - // PathRules: []*armnetwork.ApplicationGatewayPathRule{ - // { - // ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/applicationGateways/appgw/urlPathMaps/pathMap1/pathRules/apiPaths"), - // Name: to.Ptr("apiPaths"), - // Properties: &armnetwork.ApplicationGatewayPathRulePropertiesFormat{ - // BackendAddressPool: &armnetwork.SubResource{ - // ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/applicationGateways/appgw/backendAddressPools/appgwpool"), - // }, - // BackendHTTPSettings: &armnetwork.SubResource{ - // ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/applicationGateways/appgw/backendHttpSettingsCollection/appgwbhs"), - // }, - // LoadDistributionPolicy: &armnetwork.SubResource{ - // ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/applicationGateways/appgw/loadDistributionPolicies/ldp1"), - // }, - // Paths: []*string{ - // to.Ptr("/api"), - // to.Ptr("/v1/api")}, - // ProvisioningState: to.Ptr(armnetwork.ProvisioningStateSucceeded), - // RewriteRuleSet: &armnetwork.SubResource{ - // ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/applicationGateways/appgw/rewriteRuleSets/rewriteRuleSet1"), - // }, - // }, - // }}, - // ProvisioningState: to.Ptr(armnetwork.ProvisioningStateSucceeded), - // }, - // }}, - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/4883fa5dbf6f2c9093fac8ce334547e9dfac68fa/specification/network/resource-manager/Microsoft.Network/stable/2024-03-01/examples/ApplicationGatewayCreate.json -func ExampleApplicationGatewaysClient_BeginCreateOrUpdate() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armnetwork.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewApplicationGatewaysClient().BeginCreateOrUpdate(ctx, "rg1", "appgw", armnetwork.ApplicationGateway{ - Location: to.Ptr("eastus"), - Identity: &armnetwork.ManagedServiceIdentity{ - Type: to.Ptr(armnetwork.ResourceIdentityTypeUserAssigned), - UserAssignedIdentities: map[string]*armnetwork.Components1Jq1T4ISchemasManagedserviceidentityPropertiesUserassignedidentitiesAdditionalproperties{ - "/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.ManagedIdentity/userAssignedIdentities/identity1": {}, - }, - }, - Properties: &armnetwork.ApplicationGatewayPropertiesFormat{ - BackendAddressPools: []*armnetwork.ApplicationGatewayBackendAddressPool{ - { - Name: to.Ptr("appgwpool"), - Properties: &armnetwork.ApplicationGatewayBackendAddressPoolPropertiesFormat{ - BackendAddresses: []*armnetwork.ApplicationGatewayBackendAddress{ - { - IPAddress: to.Ptr("10.0.1.1"), - }, - { - IPAddress: to.Ptr("10.0.1.2"), - }}, - }, - }, - { - ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/applicationGateways/appgw/backendAddressPools/appgwpool1"), - Name: to.Ptr("appgwpool1"), - Properties: &armnetwork.ApplicationGatewayBackendAddressPoolPropertiesFormat{ - BackendAddresses: []*armnetwork.ApplicationGatewayBackendAddress{ - { - IPAddress: to.Ptr("10.0.0.1"), - }, - { - IPAddress: to.Ptr("10.0.0.2"), - }}, - }, - }}, - BackendHTTPSettingsCollection: []*armnetwork.ApplicationGatewayBackendHTTPSettings{ - { - Name: to.Ptr("appgwbhs"), - Properties: &armnetwork.ApplicationGatewayBackendHTTPSettingsPropertiesFormat{ - CookieBasedAffinity: to.Ptr(armnetwork.ApplicationGatewayCookieBasedAffinityDisabled), - Port: to.Ptr[int32](80), - RequestTimeout: to.Ptr[int32](30), - Protocol: to.Ptr(armnetwork.ApplicationGatewayProtocolHTTP), - }, - }}, - FrontendIPConfigurations: []*armnetwork.ApplicationGatewayFrontendIPConfiguration{ - { - Name: to.Ptr("appgwfip"), - Properties: &armnetwork.ApplicationGatewayFrontendIPConfigurationPropertiesFormat{ - PublicIPAddress: &armnetwork.SubResource{ - ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/publicIPAddresses/appgwpip"), - }, - }, - }}, - FrontendPorts: []*armnetwork.ApplicationGatewayFrontendPort{ - { - Name: to.Ptr("appgwfp"), - Properties: &armnetwork.ApplicationGatewayFrontendPortPropertiesFormat{ - Port: to.Ptr[int32](443), - }, - }, - { - Name: to.Ptr("appgwfp80"), - Properties: &armnetwork.ApplicationGatewayFrontendPortPropertiesFormat{ - Port: to.Ptr[int32](80), - }, - }}, - GatewayIPConfigurations: []*armnetwork.ApplicationGatewayIPConfiguration{ - { - Name: to.Ptr("appgwipc"), - Properties: &armnetwork.ApplicationGatewayIPConfigurationPropertiesFormat{ - Subnet: &armnetwork.SubResource{ - ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/virtualNetworks/vnet/subnets/appgwsubnet"), - }, - }, - }}, - GlobalConfiguration: &armnetwork.ApplicationGatewayGlobalConfiguration{ - EnableRequestBuffering: to.Ptr(true), - EnableResponseBuffering: to.Ptr(true), - }, - HTTPListeners: []*armnetwork.ApplicationGatewayHTTPListener{ - { - Name: to.Ptr("appgwhl"), - Properties: &armnetwork.ApplicationGatewayHTTPListenerPropertiesFormat{ - FrontendIPConfiguration: &armnetwork.SubResource{ - ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/applicationGateways/appgw/frontendIPConfigurations/appgwfip"), - }, - FrontendPort: &armnetwork.SubResource{ - ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/applicationGateways/appgw/frontendPorts/appgwfp"), - }, - RequireServerNameIndication: to.Ptr(false), - SSLCertificate: &armnetwork.SubResource{ - ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/applicationGateways/appgw/sslCertificates/sslcert"), - }, - SSLProfile: &armnetwork.SubResource{ - ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/applicationGateways/appgw/sslProfiles/sslProfile1"), - }, - Protocol: to.Ptr(armnetwork.ApplicationGatewayProtocolHTTPS), - }, - }, - { - Name: to.Ptr("appgwhttplistener"), - Properties: &armnetwork.ApplicationGatewayHTTPListenerPropertiesFormat{ - FrontendIPConfiguration: &armnetwork.SubResource{ - ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/applicationGateways/appgw/frontendIPConfigurations/appgwfip"), - }, - FrontendPort: &armnetwork.SubResource{ - ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/applicationGateways/appgw/frontendPorts/appgwfp80"), - }, - Protocol: to.Ptr(armnetwork.ApplicationGatewayProtocolHTTP), - }, - }}, - RequestRoutingRules: []*armnetwork.ApplicationGatewayRequestRoutingRule{ - { - Name: to.Ptr("appgwrule"), - Properties: &armnetwork.ApplicationGatewayRequestRoutingRulePropertiesFormat{ - BackendAddressPool: &armnetwork.SubResource{ - ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/applicationGateways/appgw/backendAddressPools/appgwpool"), - }, - BackendHTTPSettings: &armnetwork.SubResource{ - ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/applicationGateways/appgw/backendHttpSettingsCollection/appgwbhs"), - }, - HTTPListener: &armnetwork.SubResource{ - ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/applicationGateways/appgw/httpListeners/appgwhl"), - }, - Priority: to.Ptr[int32](10), - RewriteRuleSet: &armnetwork.SubResource{ - ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/applicationGateways/appgw/rewriteRuleSets/rewriteRuleSet1"), - }, - RuleType: to.Ptr(armnetwork.ApplicationGatewayRequestRoutingRuleTypeBasic), - }, - }}, - RewriteRuleSets: []*armnetwork.ApplicationGatewayRewriteRuleSet{ - { - Name: to.Ptr("rewriteRuleSet1"), - Properties: &armnetwork.ApplicationGatewayRewriteRuleSetPropertiesFormat{ - RewriteRules: []*armnetwork.ApplicationGatewayRewriteRule{ - { - Name: to.Ptr("Set X-Forwarded-For"), - ActionSet: &armnetwork.ApplicationGatewayRewriteRuleActionSet{ - RequestHeaderConfigurations: []*armnetwork.ApplicationGatewayHeaderConfiguration{ - { - HeaderName: to.Ptr("X-Forwarded-For"), - HeaderValue: to.Ptr("{var_add_x_forwarded_for_proxy}"), - }}, - ResponseHeaderConfigurations: []*armnetwork.ApplicationGatewayHeaderConfiguration{ - { - HeaderName: to.Ptr("Strict-Transport-Security"), - HeaderValue: to.Ptr("max-age=31536000"), - }}, - URLConfiguration: &armnetwork.ApplicationGatewayURLConfiguration{ - ModifiedPath: to.Ptr("/abc"), - }, - }, - Conditions: []*armnetwork.ApplicationGatewayRewriteRuleCondition{ - { - IgnoreCase: to.Ptr(true), - Negate: to.Ptr(false), - Pattern: to.Ptr("^Bearer"), - Variable: to.Ptr("http_req_Authorization"), - }}, - RuleSequence: to.Ptr[int32](102), - }}, - }, - }}, - SKU: &armnetwork.ApplicationGatewaySKU{ - Name: to.Ptr(armnetwork.ApplicationGatewaySKUNameStandardV2), - Capacity: to.Ptr[int32](3), - Tier: to.Ptr(armnetwork.ApplicationGatewayTierStandardV2), - }, - SSLCertificates: []*armnetwork.ApplicationGatewaySSLCertificate{ - { - Name: to.Ptr("sslcert"), - Properties: &armnetwork.ApplicationGatewaySSLCertificatePropertiesFormat{ - Data: to.Ptr("****"), - Password: to.Ptr("****"), - }, - }, - { - Name: to.Ptr("sslcert2"), - Properties: &armnetwork.ApplicationGatewaySSLCertificatePropertiesFormat{ - KeyVaultSecretID: to.Ptr("https://kv/secret"), - }, - }}, - SSLProfiles: []*armnetwork.ApplicationGatewaySSLProfile{ - { - Name: to.Ptr("sslProfile1"), - Properties: &armnetwork.ApplicationGatewaySSLProfilePropertiesFormat{ - ClientAuthConfiguration: &armnetwork.ApplicationGatewayClientAuthConfiguration{ - VerifyClientCertIssuerDN: to.Ptr(true), - }, - SSLPolicy: &armnetwork.ApplicationGatewaySSLPolicy{ - CipherSuites: []*armnetwork.ApplicationGatewaySSLCipherSuite{ - to.Ptr(armnetwork.ApplicationGatewaySSLCipherSuiteTLSECDHERSAWITHAES128CBCSHA256)}, - MinProtocolVersion: to.Ptr(armnetwork.ApplicationGatewaySSLProtocolTLSv11), - PolicyType: to.Ptr(armnetwork.ApplicationGatewaySSLPolicyTypeCustom), - }, - TrustedClientCertificates: []*armnetwork.SubResource{ - { - ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/applicationGateways/appgw/trustedClientCertificates/clientcert"), - }}, - }, - }}, - TrustedClientCertificates: []*armnetwork.ApplicationGatewayTrustedClientCertificate{ - { - Name: to.Ptr("clientcert"), - Properties: &armnetwork.ApplicationGatewayTrustedClientCertificatePropertiesFormat{ - Data: to.Ptr("****"), - }, - }}, - TrustedRootCertificates: []*armnetwork.ApplicationGatewayTrustedRootCertificate{ - { - Name: to.Ptr("rootcert"), - Properties: &armnetwork.ApplicationGatewayTrustedRootCertificatePropertiesFormat{ - Data: to.Ptr("****"), - }, - }, - { - Name: to.Ptr("rootcert1"), - Properties: &armnetwork.ApplicationGatewayTrustedRootCertificatePropertiesFormat{ - KeyVaultSecretID: to.Ptr("https://kv/secret"), - }, - }}, - }, - }, nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - res, err := poller.PollUntilDone(ctx, nil) - if err != nil { - log.Fatalf("failed to pull the result: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.ApplicationGateway = armnetwork.ApplicationGateway{ - // Name: to.Ptr("appgw"), - // Type: to.Ptr("Microsoft.Network/applicationGateways"), - // ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/applicationGateways/appgw"), - // Location: to.Ptr("southcentralus"), - // Properties: &armnetwork.ApplicationGatewayPropertiesFormat{ - // AuthenticationCertificates: []*armnetwork.ApplicationGatewayAuthenticationCertificate{ - // }, - // BackendAddressPools: []*armnetwork.ApplicationGatewayBackendAddressPool{ - // { - // ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/applicationGateways/appgw/backendAddressPools/appgwpool"), - // Name: to.Ptr("appgwpool"), - // Properties: &armnetwork.ApplicationGatewayBackendAddressPoolPropertiesFormat{ - // BackendAddresses: []*armnetwork.ApplicationGatewayBackendAddress{ - // { - // IPAddress: to.Ptr("10.0.1.1"), - // }, - // { - // IPAddress: to.Ptr("10.0.1.2"), - // }}, - // ProvisioningState: to.Ptr(armnetwork.ProvisioningStateSucceeded), - // }, - // }, - // { - // ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/applicationGateways/appgw/backendAddressPools/appgwpool1"), - // Name: to.Ptr("appgwpool1"), - // Properties: &armnetwork.ApplicationGatewayBackendAddressPoolPropertiesFormat{ - // BackendAddresses: []*armnetwork.ApplicationGatewayBackendAddress{ - // { - // IPAddress: to.Ptr("10.0.0.1"), - // }, - // { - // IPAddress: to.Ptr("10.0.0.2"), - // }}, - // ProvisioningState: to.Ptr(armnetwork.ProvisioningStateSucceeded), - // }, - // }}, - // BackendHTTPSettingsCollection: []*armnetwork.ApplicationGatewayBackendHTTPSettings{ - // { - // ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/applicationGateways/appgw/backendHttpSettingsCollection/appgwbhs"), - // Name: to.Ptr("appgwbhs"), - // Properties: &armnetwork.ApplicationGatewayBackendHTTPSettingsPropertiesFormat{ - // CookieBasedAffinity: to.Ptr(armnetwork.ApplicationGatewayCookieBasedAffinityDisabled), - // Port: to.Ptr[int32](80), - // ProvisioningState: to.Ptr(armnetwork.ProvisioningStateSucceeded), - // RequestTimeout: to.Ptr[int32](30), - // Protocol: to.Ptr(armnetwork.ApplicationGatewayProtocolHTTP), - // }, - // }}, - // FrontendIPConfigurations: []*armnetwork.ApplicationGatewayFrontendIPConfiguration{ - // { - // ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/applicationGateways/appgw/frontendIPConfigurations/appgwfip"), - // Name: to.Ptr("appgwfip"), - // Properties: &armnetwork.ApplicationGatewayFrontendIPConfigurationPropertiesFormat{ - // PrivateIPAllocationMethod: to.Ptr(armnetwork.IPAllocationMethodDynamic), - // ProvisioningState: to.Ptr(armnetwork.ProvisioningStateSucceeded), - // PublicIPAddress: &armnetwork.SubResource{ - // ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/publicIPAddresses/appgwpip"), - // }, - // }, - // }}, - // FrontendPorts: []*armnetwork.ApplicationGatewayFrontendPort{ - // { - // ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/applicationGateways/appgw/frontendPorts/appgwfp"), - // Name: to.Ptr("appgwfp"), - // Properties: &armnetwork.ApplicationGatewayFrontendPortPropertiesFormat{ - // Port: to.Ptr[int32](443), - // ProvisioningState: to.Ptr(armnetwork.ProvisioningStateSucceeded), - // }, - // }, - // { - // ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/applicationGateways/appgw/frontendPorts/appgwfp80"), - // Name: to.Ptr("appgwfp80"), - // Properties: &armnetwork.ApplicationGatewayFrontendPortPropertiesFormat{ - // Port: to.Ptr[int32](80), - // ProvisioningState: to.Ptr(armnetwork.ProvisioningStateSucceeded), - // }, - // }}, - // GatewayIPConfigurations: []*armnetwork.ApplicationGatewayIPConfiguration{ - // { - // ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/applicationGateways/appgw/gatewayIPConfigurations/appgwipc"), - // Name: to.Ptr("appgwipc"), - // Properties: &armnetwork.ApplicationGatewayIPConfigurationPropertiesFormat{ - // ProvisioningState: to.Ptr(armnetwork.ProvisioningStateSucceeded), - // Subnet: &armnetwork.SubResource{ - // ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/virtualNetworks/virtualNetwork1/subnets/appgwsubnet"), - // }, - // }, - // }}, - // GlobalConfiguration: &armnetwork.ApplicationGatewayGlobalConfiguration{ - // EnableRequestBuffering: to.Ptr(true), - // EnableResponseBuffering: to.Ptr(true), - // }, - // HTTPListeners: []*armnetwork.ApplicationGatewayHTTPListener{ - // { - // ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/applicationGateways/appgw/httpListeners/appgwhl"), - // Name: to.Ptr("appgwhl"), - // Properties: &armnetwork.ApplicationGatewayHTTPListenerPropertiesFormat{ - // FrontendIPConfiguration: &armnetwork.SubResource{ - // ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/applicationGateways/appgw/frontendIPConfigurations/appgwfip"), - // }, - // FrontendPort: &armnetwork.SubResource{ - // ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/applicationGateways/appgw/frontendPorts/appgwfp"), - // }, - // ProvisioningState: to.Ptr(armnetwork.ProvisioningStateSucceeded), - // RequireServerNameIndication: to.Ptr(false), - // SSLCertificate: &armnetwork.SubResource{ - // ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/applicationGateways/appgw/sslCertificates/sslcert"), - // }, - // SSLProfile: &armnetwork.SubResource{ - // ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/applicationGateways/appgw/sslProfiles/sslProfile1"), - // }, - // Protocol: to.Ptr(armnetwork.ApplicationGatewayProtocolHTTPS), - // }, - // }, - // { - // ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/applicationGateways/appgw/httpListeners/appgwhttplistener"), - // Name: to.Ptr("appgwhttplistener"), - // Properties: &armnetwork.ApplicationGatewayHTTPListenerPropertiesFormat{ - // FrontendIPConfiguration: &armnetwork.SubResource{ - // ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/applicationGateways/appgw/frontendIPConfigurations/appgwfip"), - // }, - // FrontendPort: &armnetwork.SubResource{ - // ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/applicationGateways/appgw/frontendPorts/appgwfp80"), - // }, - // ProvisioningState: to.Ptr(armnetwork.ProvisioningStateSucceeded), - // Protocol: to.Ptr(armnetwork.ApplicationGatewayProtocolHTTP), - // }, - // }}, - // Listeners: []*armnetwork.ApplicationGatewayListener{ - // }, - // LoadDistributionPolicies: []*armnetwork.ApplicationGatewayLoadDistributionPolicy{ - // }, - // OperationalState: to.Ptr(armnetwork.ApplicationGatewayOperationalStateRunning), - // PrivateEndpointConnections: []*armnetwork.ApplicationGatewayPrivateEndpointConnection{ - // }, - // Probes: []*armnetwork.ApplicationGatewayProbe{ - // }, - // ProvisioningState: to.Ptr(armnetwork.ProvisioningStateSucceeded), - // RedirectConfigurations: []*armnetwork.ApplicationGatewayRedirectConfiguration{ - // }, - // RequestRoutingRules: []*armnetwork.ApplicationGatewayRequestRoutingRule{ - // { - // ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/applicationGateways/appgw/requestRoutingRules/appgwrule"), - // Name: to.Ptr("appgwrule"), - // Properties: &armnetwork.ApplicationGatewayRequestRoutingRulePropertiesFormat{ - // BackendAddressPool: &armnetwork.SubResource{ - // ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/applicationGateways/appgw/backendAddressPools/appgwpool"), - // }, - // BackendHTTPSettings: &armnetwork.SubResource{ - // ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/applicationGateways/appgw/backendHttpSettingsCollection/appgwbhs"), - // }, - // HTTPListener: &armnetwork.SubResource{ - // ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/applicationGateways/appgw/httpListeners/appgwhl"), - // }, - // ProvisioningState: to.Ptr(armnetwork.ProvisioningStateSucceeded), - // RewriteRuleSet: &armnetwork.SubResource{ - // ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/applicationGateways/appgw/rewriteRuleSets/rewriteRuleSet1"), - // }, - // RuleType: to.Ptr(armnetwork.ApplicationGatewayRequestRoutingRuleTypeBasic), - // }, - // }}, - // RewriteRuleSets: []*armnetwork.ApplicationGatewayRewriteRuleSet{ - // { - // ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/applicationGateways/appgw/rewriteRuleSets/rewriteRuleSet1"), - // Name: to.Ptr("rewriteRuleSet1"), - // Properties: &armnetwork.ApplicationGatewayRewriteRuleSetPropertiesFormat{ - // ProvisioningState: to.Ptr(armnetwork.ProvisioningStateSucceeded), - // RewriteRules: []*armnetwork.ApplicationGatewayRewriteRule{ - // { - // Name: to.Ptr("Set X-Forwarded-For"), - // ActionSet: &armnetwork.ApplicationGatewayRewriteRuleActionSet{ - // RequestHeaderConfigurations: []*armnetwork.ApplicationGatewayHeaderConfiguration{ - // { - // HeaderName: to.Ptr("X-Forwarded-For"), - // HeaderValue: to.Ptr("{var_remote-addr}"), - // }}, - // ResponseHeaderConfigurations: []*armnetwork.ApplicationGatewayHeaderConfiguration{ - // { - // HeaderName: to.Ptr("Strict-Transport-Security"), - // HeaderValue: to.Ptr("max-age=31536000"), - // }}, - // URLConfiguration: &armnetwork.ApplicationGatewayURLConfiguration{ - // ModifiedPath: to.Ptr("/abc"), - // ModifiedQueryString: to.Ptr("x=y&a=b"), - // }, - // }, - // Conditions: []*armnetwork.ApplicationGatewayRewriteRuleCondition{ - // { - // IgnoreCase: to.Ptr(true), - // Negate: to.Ptr(false), - // Pattern: to.Ptr("^Bearer"), - // Variable: to.Ptr("http_req_Authorization"), - // }}, - // RuleSequence: to.Ptr[int32](102), - // }}, - // }, - // }}, - // RoutingRules: []*armnetwork.ApplicationGatewayRoutingRule{ - // }, - // SKU: &armnetwork.ApplicationGatewaySKU{ - // Name: to.Ptr(armnetwork.ApplicationGatewaySKUNameStandardMedium), - // Capacity: to.Ptr[int32](3), - // Tier: to.Ptr(armnetwork.ApplicationGatewayTierStandard), - // }, - // SSLCertificates: []*armnetwork.ApplicationGatewaySSLCertificate{ - // { - // ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/applicationGateways/appgw/sslCertificates/sslcert"), - // Name: to.Ptr("sslcert"), - // Properties: &armnetwork.ApplicationGatewaySSLCertificatePropertiesFormat{ - // ProvisioningState: to.Ptr(armnetwork.ProvisioningStateSucceeded), - // PublicCertData: to.Ptr("*****"), - // }, - // }}, - // SSLProfiles: []*armnetwork.ApplicationGatewaySSLProfile{ - // { - // ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/applicationGateways/appgw/sslProfiles/sslProfile1"), - // Name: to.Ptr("sslProfile1"), - // Properties: &armnetwork.ApplicationGatewaySSLProfilePropertiesFormat{ - // ClientAuthConfiguration: &armnetwork.ApplicationGatewayClientAuthConfiguration{ - // VerifyClientCertIssuerDN: to.Ptr(true), - // }, - // ProvisioningState: to.Ptr(armnetwork.ProvisioningStateSucceeded), - // SSLPolicy: &armnetwork.ApplicationGatewaySSLPolicy{ - // CipherSuites: []*armnetwork.ApplicationGatewaySSLCipherSuite{ - // to.Ptr(armnetwork.ApplicationGatewaySSLCipherSuiteTLSECDHERSAWITHAES128CBCSHA256)}, - // MinProtocolVersion: to.Ptr(armnetwork.ApplicationGatewaySSLProtocolTLSv11), - // PolicyType: to.Ptr(armnetwork.ApplicationGatewaySSLPolicyTypeCustom), - // }, - // TrustedClientCertificates: []*armnetwork.SubResource{ - // { - // ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/applicationGateways/appgw/trustedClientCertificates/clientcert"), - // }}, - // }, - // }}, - // TrustedClientCertificates: []*armnetwork.ApplicationGatewayTrustedClientCertificate{ - // { - // ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/applicationGateways/appgw/trustedClientCertificates/clientcert"), - // Name: to.Ptr("clientcert"), - // Properties: &armnetwork.ApplicationGatewayTrustedClientCertificatePropertiesFormat{ - // Data: to.Ptr("****"), - // ProvisioningState: to.Ptr(armnetwork.ProvisioningStateSucceeded), - // }, - // }}, - // URLPathMaps: []*armnetwork.ApplicationGatewayURLPathMap{ - // }, - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/4883fa5dbf6f2c9093fac8ce334547e9dfac68fa/specification/network/resource-manager/Microsoft.Network/stable/2024-03-01/examples/ApplicationGatewayUpdateTags.json -func ExampleApplicationGatewaysClient_UpdateTags() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armnetwork.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewApplicationGatewaysClient().UpdateTags(ctx, "rg1", "AppGw", armnetwork.TagsObject{ - Tags: map[string]*string{ - "tag1": to.Ptr("value1"), - "tag2": to.Ptr("value2"), - }, - }, nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.ApplicationGateway = armnetwork.ApplicationGateway{ - // Name: to.Ptr("AppGw"), - // Type: to.Ptr("Microsoft.Network/applicationGateways"), - // ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/applicationGateways/AppGw"), - // Location: to.Ptr("westus"), - // Tags: map[string]*string{ - // "tag1": to.Ptr("value1"), - // "tag2": to.Ptr("value2"), - // }, - // Properties: &armnetwork.ApplicationGatewayPropertiesFormat{ - // AuthenticationCertificates: []*armnetwork.ApplicationGatewayAuthenticationCertificate{ - // }, - // BackendAddressPools: []*armnetwork.ApplicationGatewayBackendAddressPool{ - // { - // ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/applicationGateways/AppGw/backendAddressPools/Pool01"), - // Name: to.Ptr("Pool01"), - // Properties: &armnetwork.ApplicationGatewayBackendAddressPoolPropertiesFormat{ - // BackendAddresses: []*armnetwork.ApplicationGatewayBackendAddress{ - // { - // IPAddress: to.Ptr("10.10.10.1"), - // }, - // { - // IPAddress: to.Ptr("10.10.10.2"), - // }, - // { - // IPAddress: to.Ptr("10.10.10.3"), - // }}, - // ProvisioningState: to.Ptr(armnetwork.ProvisioningStateSucceeded), - // }, - // }}, - // BackendHTTPSettingsCollection: []*armnetwork.ApplicationGatewayBackendHTTPSettings{ - // { - // ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/applicationGateways/AppGw/backendHttpSettingsCollection/PoolSetting01"), - // Name: to.Ptr("PoolSetting01"), - // Properties: &armnetwork.ApplicationGatewayBackendHTTPSettingsPropertiesFormat{ - // CookieBasedAffinity: to.Ptr(armnetwork.ApplicationGatewayCookieBasedAffinityDisabled), - // PickHostNameFromBackendAddress: to.Ptr(false), - // Port: to.Ptr[int32](80), - // ProvisioningState: to.Ptr(armnetwork.ProvisioningStateSucceeded), - // RequestTimeout: to.Ptr[int32](30), - // Protocol: to.Ptr(armnetwork.ApplicationGatewayProtocolHTTP), - // }, - // }}, - // FrontendIPConfigurations: []*armnetwork.ApplicationGatewayFrontendIPConfiguration{ - // { - // ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/applicationGateways/AppGw/frontendIPConfigurations/FrontEndConfig01"), - // Name: to.Ptr("FrontEndConfig01"), - // Properties: &armnetwork.ApplicationGatewayFrontendIPConfigurationPropertiesFormat{ - // PrivateIPAllocationMethod: to.Ptr(armnetwork.IPAllocationMethodDynamic), - // ProvisioningState: to.Ptr(armnetwork.ProvisioningStateSucceeded), - // PublicIPAddress: &armnetwork.SubResource{ - // ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/publicIPAddresses/publicIp1"), - // }, - // }, - // }}, - // FrontendPorts: []*armnetwork.ApplicationGatewayFrontendPort{ - // { - // ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/applicationGateways/AppGw/frontendPorts/FrontEndPort01"), - // Name: to.Ptr("FrontEndPort01"), - // Properties: &armnetwork.ApplicationGatewayFrontendPortPropertiesFormat{ - // Port: to.Ptr[int32](80), - // ProvisioningState: to.Ptr(armnetwork.ProvisioningStateSucceeded), - // }, - // }}, - // GatewayIPConfigurations: []*armnetwork.ApplicationGatewayIPConfiguration{ - // { - // ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/applicationGateways/AppGw/gatewayIPConfigurations/GatewayIp01"), - // Name: to.Ptr("GatewayIp01"), - // Properties: &armnetwork.ApplicationGatewayIPConfigurationPropertiesFormat{ - // ProvisioningState: to.Ptr(armnetwork.ProvisioningStateSucceeded), - // Subnet: &armnetwork.SubResource{ - // ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/virtualNetworks/vnet/subnets/subnet1"), - // }, - // }, - // }}, - // HTTPListeners: []*armnetwork.ApplicationGatewayHTTPListener{ - // { - // ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/applicationGateways/AppGw/httpListeners/listener1"), - // Name: to.Ptr("listener1"), - // Properties: &armnetwork.ApplicationGatewayHTTPListenerPropertiesFormat{ - // FrontendIPConfiguration: &armnetwork.SubResource{ - // ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/applicationGateways/AppGw/frontendIPConfigurations/FrontEndConfig01"), - // }, - // FrontendPort: &armnetwork.SubResource{ - // ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/applicationGateways/AppGw/frontendPorts/FrontEndPort01"), - // }, - // ProvisioningState: to.Ptr(armnetwork.ProvisioningStateSucceeded), - // RequireServerNameIndication: to.Ptr(false), - // Protocol: to.Ptr(armnetwork.ApplicationGatewayProtocolHTTP), - // }, - // }}, - // OperationalState: to.Ptr(armnetwork.ApplicationGatewayOperationalStateRunning), - // Probes: []*armnetwork.ApplicationGatewayProbe{ - // }, - // ProvisioningState: to.Ptr(armnetwork.ProvisioningStateSucceeded), - // RedirectConfigurations: []*armnetwork.ApplicationGatewayRedirectConfiguration{ - // }, - // RequestRoutingRules: []*armnetwork.ApplicationGatewayRequestRoutingRule{ - // { - // ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/applicationGateways/AppGw/requestRoutingRules/Rule01"), - // Name: to.Ptr("Rule01"), - // Properties: &armnetwork.ApplicationGatewayRequestRoutingRulePropertiesFormat{ - // BackendAddressPool: &armnetwork.SubResource{ - // ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/applicationGateways/AppGw/backendAddressPools/Pool01"), - // }, - // BackendHTTPSettings: &armnetwork.SubResource{ - // ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/applicationGateways/AppGw/backendHttpSettingsCollection/PoolSetting01"), - // }, - // HTTPListener: &armnetwork.SubResource{ - // ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/applicationGateways/AppGw/httpListeners/listener1"), - // }, - // ProvisioningState: to.Ptr(armnetwork.ProvisioningStateSucceeded), - // RuleType: to.Ptr(armnetwork.ApplicationGatewayRequestRoutingRuleTypeBasic), - // }, - // }}, - // ResourceGUID: to.Ptr("00000000-0000-0000-0000-000000000000"), - // SKU: &armnetwork.ApplicationGatewaySKU{ - // Name: to.Ptr(armnetwork.ApplicationGatewaySKUNameStandardSmall), - // Capacity: to.Ptr[int32](2), - // Tier: to.Ptr(armnetwork.ApplicationGatewayTierStandard), - // }, - // SSLCertificates: []*armnetwork.ApplicationGatewaySSLCertificate{ - // }, - // URLPathMaps: []*armnetwork.ApplicationGatewayURLPathMap{ - // }, - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/4883fa5dbf6f2c9093fac8ce334547e9dfac68fa/specification/network/resource-manager/Microsoft.Network/stable/2024-03-01/examples/ApplicationGatewayList.json -func ExampleApplicationGatewaysClient_NewListPager() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armnetwork.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := clientFactory.NewApplicationGatewaysClient().NewListPager("rg1", nil) - for pager.More() { - page, err := pager.NextPage(ctx) - if err != nil { - log.Fatalf("failed to advance page: %v", err) - } - for _, v := range page.Value { - // You could use page here. We use blank identifier for just demo purposes. - _ = v - } - // If the HTTP response code is 200 as defined in example definition, your page structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // page.ApplicationGatewayListResult = armnetwork.ApplicationGatewayListResult{ - // Value: []*armnetwork.ApplicationGateway{ - // { - // Name: to.Ptr("appgw"), - // Type: to.Ptr("Microsoft.Network/applicationGateways"), - // ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/applicationGateways/appgw"), - // Location: to.Ptr("southcentralus"), - // Properties: &armnetwork.ApplicationGatewayPropertiesFormat{ - // AuthenticationCertificates: []*armnetwork.ApplicationGatewayAuthenticationCertificate{ - // }, - // BackendAddressPools: []*armnetwork.ApplicationGatewayBackendAddressPool{ - // { - // ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/applicationGateways/appgw/backendAddressPools/appgwpool"), - // Name: to.Ptr("appgwpool"), - // Properties: &armnetwork.ApplicationGatewayBackendAddressPoolPropertiesFormat{ - // BackendAddresses: []*armnetwork.ApplicationGatewayBackendAddress{ - // }, - // ProvisioningState: to.Ptr(armnetwork.ProvisioningStateSucceeded), - // }, - // }, - // { - // ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/applicationGateways/appgw/backendAddressPools/appgwpool1"), - // Name: to.Ptr("appgwpool1"), - // Properties: &armnetwork.ApplicationGatewayBackendAddressPoolPropertiesFormat{ - // BackendAddresses: []*armnetwork.ApplicationGatewayBackendAddress{ - // { - // }, - // { - // }}, - // ProvisioningState: to.Ptr(armnetwork.ProvisioningStateSucceeded), - // }, - // }}, - // BackendHTTPSettingsCollection: []*armnetwork.ApplicationGatewayBackendHTTPSettings{ - // { - // ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/applicationGateways/appgw/backendHttpSettingsCollection/appgwbhs"), - // Name: to.Ptr("appgwbhs"), - // Properties: &armnetwork.ApplicationGatewayBackendHTTPSettingsPropertiesFormat{ - // CookieBasedAffinity: to.Ptr(armnetwork.ApplicationGatewayCookieBasedAffinityDisabled), - // Port: to.Ptr[int32](80), - // ProvisioningState: to.Ptr(armnetwork.ProvisioningStateSucceeded), - // RequestTimeout: to.Ptr[int32](30), - // Protocol: to.Ptr(armnetwork.ApplicationGatewayProtocolHTTP), - // }, - // }}, - // FrontendIPConfigurations: []*armnetwork.ApplicationGatewayFrontendIPConfiguration{ - // { - // ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/applicationGateways/appgw/frontendIPConfigurations/appgwfip"), - // Name: to.Ptr("appgwfip"), - // Properties: &armnetwork.ApplicationGatewayFrontendIPConfigurationPropertiesFormat{ - // PrivateIPAllocationMethod: to.Ptr(armnetwork.IPAllocationMethodDynamic), - // ProvisioningState: to.Ptr(armnetwork.ProvisioningStateSucceeded), - // PublicIPAddress: &armnetwork.SubResource{ - // ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/publicIPAddresses/appgwpip"), - // }, - // }, - // }}, - // FrontendPorts: []*armnetwork.ApplicationGatewayFrontendPort{ - // { - // ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/applicationGateways/appgw/frontendPorts/appgwfp"), - // Name: to.Ptr("appgwfp"), - // Properties: &armnetwork.ApplicationGatewayFrontendPortPropertiesFormat{ - // Port: to.Ptr[int32](443), - // ProvisioningState: to.Ptr(armnetwork.ProvisioningStateSucceeded), - // }, - // }, - // { - // ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/applicationGateways/appgw/frontendPorts/appgwfp80"), - // Name: to.Ptr("appgwfp80"), - // Properties: &armnetwork.ApplicationGatewayFrontendPortPropertiesFormat{ - // Port: to.Ptr[int32](80), - // ProvisioningState: to.Ptr(armnetwork.ProvisioningStateSucceeded), - // }, - // }}, - // GatewayIPConfigurations: []*armnetwork.ApplicationGatewayIPConfiguration{ - // { - // ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/applicationGateways/appgw/gatewayIPConfigurations/appgwipc"), - // Name: to.Ptr("appgwipc"), - // Properties: &armnetwork.ApplicationGatewayIPConfigurationPropertiesFormat{ - // ProvisioningState: to.Ptr(armnetwork.ProvisioningStateSucceeded), - // Subnet: &armnetwork.SubResource{ - // ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/virtualNetworks/virtualNetwork1/subnets/appgwsubnet"), - // }, - // }, - // }}, - // GlobalConfiguration: &armnetwork.ApplicationGatewayGlobalConfiguration{ - // EnableRequestBuffering: to.Ptr(true), - // EnableResponseBuffering: to.Ptr(true), - // }, - // HTTPListeners: []*armnetwork.ApplicationGatewayHTTPListener{ - // { - // ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/applicationGateways/appgw/httpListeners/appgwhl"), - // Name: to.Ptr("appgwhl"), - // Properties: &armnetwork.ApplicationGatewayHTTPListenerPropertiesFormat{ - // FrontendIPConfiguration: &armnetwork.SubResource{ - // ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/applicationGateways/appgw/frontendIPConfigurations/appgwfip"), - // }, - // FrontendPort: &armnetwork.SubResource{ - // ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/applicationGateways/appgw/frontendPorts/appgwfp"), - // }, - // ProvisioningState: to.Ptr(armnetwork.ProvisioningStateSucceeded), - // RequireServerNameIndication: to.Ptr(false), - // SSLCertificate: &armnetwork.SubResource{ - // ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/applicationGateways/appgw/sslCertificates/sslcert"), - // }, - // SSLProfile: &armnetwork.SubResource{ - // ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/applicationGateways/appgw/sslProfiles/sslProfile1"), - // }, - // Protocol: to.Ptr(armnetwork.ApplicationGatewayProtocolHTTPS), - // }, - // }, - // { - // ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/applicationGateways/appgw/httpListeners/appgwhttplistener"), - // Name: to.Ptr("appgwhttplistener"), - // Properties: &armnetwork.ApplicationGatewayHTTPListenerPropertiesFormat{ - // FrontendIPConfiguration: &armnetwork.SubResource{ - // ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/applicationGateways/appgw/frontendIPConfigurations/appgwfip"), - // }, - // FrontendPort: &armnetwork.SubResource{ - // ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/applicationGateways/appgw/frontendPorts/appgwfp80"), - // }, - // ProvisioningState: to.Ptr(armnetwork.ProvisioningStateSucceeded), - // Protocol: to.Ptr(armnetwork.ApplicationGatewayProtocolHTTP), - // }, - // }}, - // LoadDistributionPolicies: []*armnetwork.ApplicationGatewayLoadDistributionPolicy{ - // { - // ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/applicationGateways/appgw/loadDistributionPolicies/ldp1"), - // Name: to.Ptr("ldp1"), - // Properties: &armnetwork.ApplicationGatewayLoadDistributionPolicyPropertiesFormat{ - // LoadDistributionAlgorithm: to.Ptr(armnetwork.ApplicationGatewayLoadDistributionAlgorithmRoundRobin), - // LoadDistributionTargets: []*armnetwork.ApplicationGatewayLoadDistributionTarget{ - // { - // ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/applicationGateways/appgw/loadDistributionPolicies/ldp1/loadDistributionTargets/ldt1"), - // Name: to.Ptr("ld11"), - // Properties: &armnetwork.ApplicationGatewayLoadDistributionTargetPropertiesFormat{ - // BackendAddressPool: &armnetwork.SubResource{ - // ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/applicationGateways/appgw/backendAddressPools/appgwpool"), - // }, - // WeightPerServer: to.Ptr[int32](40), - // }, - // }, - // { - // ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/applicationGateways/appgw/loadDistributionPolicies/ldp1/loadDistributionTargets/ldt1"), - // Name: to.Ptr("ld11"), - // Properties: &armnetwork.ApplicationGatewayLoadDistributionTargetPropertiesFormat{ - // BackendAddressPool: &armnetwork.SubResource{ - // ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/applicationGateways/appgw/backendAddressPools/appgwpool1"), - // }, - // WeightPerServer: to.Ptr[int32](60), - // }, - // }}, - // }, - // }}, - // OperationalState: to.Ptr(armnetwork.ApplicationGatewayOperationalStateRunning), - // PrivateEndpointConnections: []*armnetwork.ApplicationGatewayPrivateEndpointConnection{ - // }, - // PrivateLinkConfigurations: []*armnetwork.ApplicationGatewayPrivateLinkConfiguration{ - // { - // ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/applicationGateways/appgw/privateLinkConfigurations/privateLink1"), - // Name: to.Ptr("privateLink1"), - // Properties: &armnetwork.ApplicationGatewayPrivateLinkConfigurationProperties{ - // IPConfigurations: []*armnetwork.ApplicationGatewayPrivateLinkIPConfiguration{ - // { - // ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/applicationGateways/appgw/privateLinkConfigurations/privateLink1/privateLinkConfigurations/privateLink1/ipConfigurations/natNicIpconfig1"), - // Name: to.Ptr("natNicIpconfig1"), - // Properties: &armnetwork.ApplicationGatewayPrivateLinkIPConfigurationProperties{ - // Primary: to.Ptr(true), - // PrivateIPAllocationMethod: to.Ptr(armnetwork.IPAllocationMethodDynamic), - // ProvisioningState: to.Ptr(armnetwork.ProvisioningStateSucceeded), - // Subnet: &armnetwork.SubResource{ - // ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/virtualNetworks/virtualNetwork1/subnets/appgwsubnet"), - // }, - // }, - // }, - // { - // ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/applicationGateways/appgw/privateLinkConfigurations/privateLink1/privateLinkConfigurations/privateLink1/ipConfigurations/natNicIpconfig2"), - // Name: to.Ptr("natNicIpconfig2"), - // Properties: &armnetwork.ApplicationGatewayPrivateLinkIPConfigurationProperties{ - // PrivateIPAllocationMethod: to.Ptr(armnetwork.IPAllocationMethodDynamic), - // ProvisioningState: to.Ptr(armnetwork.ProvisioningStateSucceeded), - // Subnet: &armnetwork.SubResource{ - // ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/virtualNetworks/virtualNetwork1/subnets/appgwsubnet"), - // }, - // }, - // }}, - // ProvisioningState: to.Ptr(armnetwork.ProvisioningStateSucceeded), - // }, - // }}, - // Probes: []*armnetwork.ApplicationGatewayProbe{ - // }, - // ProvisioningState: to.Ptr(armnetwork.ProvisioningStateSucceeded), - // RequestRoutingRules: []*armnetwork.ApplicationGatewayRequestRoutingRule{ - // { - // ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/applicationGateways/appgw/requestRoutingRules/appgwrule"), - // Name: to.Ptr("appgwrule"), - // Properties: &armnetwork.ApplicationGatewayRequestRoutingRulePropertiesFormat{ - // BackendAddressPool: &armnetwork.SubResource{ - // ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/applicationGateways/appgw/backendAddressPools/appgwpool"), - // }, - // BackendHTTPSettings: &armnetwork.SubResource{ - // ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/applicationGateways/appgw/backendHttpSettingsCollection/appgwbhs"), - // }, - // HTTPListener: &armnetwork.SubResource{ - // ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/applicationGateways/appgw/httpListeners/appgwhl"), - // }, - // LoadDistributionPolicy: &armnetwork.SubResource{ - // ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/applicationGateways/appgw/loadDistributionPolicies/ldp1"), - // }, - // Priority: to.Ptr[int32](10), - // ProvisioningState: to.Ptr(armnetwork.ProvisioningStateSucceeded), - // RewriteRuleSet: &armnetwork.SubResource{ - // ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/applicationGateways/appgw/rewriteRuleSets/rewriteRuleSet1"), - // }, - // RuleType: to.Ptr(armnetwork.ApplicationGatewayRequestRoutingRuleTypeBasic), - // }, - // }, - // { - // ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/applicationGateways/appgw/requestRoutingRules/appgwPathBasedRule"), - // Name: to.Ptr("appgwPathBasedRule"), - // Properties: &armnetwork.ApplicationGatewayRequestRoutingRulePropertiesFormat{ - // HTTPListener: &armnetwork.SubResource{ - // ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/applicationGateways/appgw/httpListeners/appgwhttplistener"), - // }, - // Priority: to.Ptr[int32](20), - // ProvisioningState: to.Ptr(armnetwork.ProvisioningStateSucceeded), - // RuleType: to.Ptr(armnetwork.ApplicationGatewayRequestRoutingRuleTypePathBasedRouting), - // URLPathMap: &armnetwork.SubResource{ - // ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/applicationGateways/appgw/urlPathMaps/pathMap1"), - // }, - // }, - // }}, - // RewriteRuleSets: []*armnetwork.ApplicationGatewayRewriteRuleSet{ - // { - // ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/applicationGateways/appgw/rewriteRuleSets/rewriteRuleSet1"), - // Name: to.Ptr("rewriteRuleSet1"), - // Properties: &armnetwork.ApplicationGatewayRewriteRuleSetPropertiesFormat{ - // ProvisioningState: to.Ptr(armnetwork.ProvisioningStateSucceeded), - // RewriteRules: []*armnetwork.ApplicationGatewayRewriteRule{ - // { - // Name: to.Ptr("Set X-Forwarded-For"), - // ActionSet: &armnetwork.ApplicationGatewayRewriteRuleActionSet{ - // RequestHeaderConfigurations: []*armnetwork.ApplicationGatewayHeaderConfiguration{ - // { - // HeaderName: to.Ptr("X-Forwarded-For"), - // HeaderValue: to.Ptr("{var_remote-addr}"), - // }}, - // ResponseHeaderConfigurations: []*armnetwork.ApplicationGatewayHeaderConfiguration{ - // { - // HeaderName: to.Ptr("Strict-Transport-Security"), - // HeaderValue: to.Ptr("max-age=31536000"), - // }}, - // URLConfiguration: &armnetwork.ApplicationGatewayURLConfiguration{ - // ModifiedPath: to.Ptr("/abc"), - // ModifiedQueryString: to.Ptr("x=y&a=b"), - // Reroute: to.Ptr(false), - // }, - // }, - // Conditions: []*armnetwork.ApplicationGatewayRewriteRuleCondition{ - // { - // IgnoreCase: to.Ptr(true), - // Negate: to.Ptr(false), - // Pattern: to.Ptr("^Bearer"), - // Variable: to.Ptr("http_req_Authorization"), - // }}, - // RuleSequence: to.Ptr[int32](102), - // }}, - // }, - // }}, - // SKU: &armnetwork.ApplicationGatewaySKU{ - // Name: to.Ptr(armnetwork.ApplicationGatewaySKUNameStandardMedium), - // Capacity: to.Ptr[int32](3), - // Tier: to.Ptr(armnetwork.ApplicationGatewayTierStandard), - // }, - // SSLCertificates: []*armnetwork.ApplicationGatewaySSLCertificate{ - // { - // ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/applicationGateways/appgw/sslCertificates/sslcert"), - // Name: to.Ptr("sslcert"), - // Properties: &armnetwork.ApplicationGatewaySSLCertificatePropertiesFormat{ - // ProvisioningState: to.Ptr(armnetwork.ProvisioningStateSucceeded), - // PublicCertData: to.Ptr("*****"), - // }, - // }}, - // SSLProfiles: []*armnetwork.ApplicationGatewaySSLProfile{ - // { - // ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/applicationGateways/appgw/sslProfiles/sslProfile1"), - // Name: to.Ptr("sslProfile1"), - // Properties: &armnetwork.ApplicationGatewaySSLProfilePropertiesFormat{ - // ClientAuthConfiguration: &armnetwork.ApplicationGatewayClientAuthConfiguration{ - // VerifyClientCertIssuerDN: to.Ptr(true), - // VerifyClientRevocation: to.Ptr(armnetwork.ApplicationGatewayClientRevocationOptionsOCSP), - // }, - // ProvisioningState: to.Ptr(armnetwork.ProvisioningStateSucceeded), - // SSLPolicy: &armnetwork.ApplicationGatewaySSLPolicy{ - // CipherSuites: []*armnetwork.ApplicationGatewaySSLCipherSuite{ - // to.Ptr(armnetwork.ApplicationGatewaySSLCipherSuiteTLSECDHERSAWITHAES128CBCSHA256)}, - // MinProtocolVersion: to.Ptr(armnetwork.ApplicationGatewaySSLProtocolTLSv11), - // PolicyType: to.Ptr(armnetwork.ApplicationGatewaySSLPolicyTypeCustom), - // }, - // TrustedClientCertificates: []*armnetwork.SubResource{ - // { - // ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/applicationGateways/appgw/trustedClientCertificates/clientcert"), - // }}, - // }, - // }}, - // TrustedClientCertificates: []*armnetwork.ApplicationGatewayTrustedClientCertificate{ - // { - // ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/applicationGateways/appgw/trustedClientCertificates/clientcert"), - // Name: to.Ptr("clientcert"), - // Properties: &armnetwork.ApplicationGatewayTrustedClientCertificatePropertiesFormat{ - // ClientCertIssuerDN: to.Ptr("CN=User1, OU=Eng, O=Company Ltd, L=D4, S=Arizona, C=US"), - // Data: to.Ptr("****"), - // ProvisioningState: to.Ptr(armnetwork.ProvisioningStateSucceeded), - // ValidatedCertData: to.Ptr("****"), - // }, - // }}, - // URLPathMaps: []*armnetwork.ApplicationGatewayURLPathMap{ - // { - // ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/applicationGateways/appgw/urlPathMaps/pathMap1"), - // Name: to.Ptr("pathMap1"), - // Properties: &armnetwork.ApplicationGatewayURLPathMapPropertiesFormat{ - // DefaultBackendAddressPool: &armnetwork.SubResource{ - // ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/applicationGateways/appgw/backendAddressPools/appgwpool"), - // }, - // DefaultBackendHTTPSettings: &armnetwork.SubResource{ - // ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/applicationGateways/appgw/backendHttpSettingsCollection/appgwbhs"), - // }, - // DefaultLoadDistributionPolicy: &armnetwork.SubResource{ - // ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/applicationGateways/appgw/loadDistributionPolicies/ldp1"), - // }, - // DefaultRewriteRuleSet: &armnetwork.SubResource{ - // ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/applicationGateways/appgw/rewriteRuleSets/rewriteRuleSet1"), - // }, - // PathRules: []*armnetwork.ApplicationGatewayPathRule{ - // { - // ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/applicationGateways/appgw/urlPathMaps/pathMap1/pathRules/apiPaths"), - // Name: to.Ptr("apiPaths"), - // Properties: &armnetwork.ApplicationGatewayPathRulePropertiesFormat{ - // BackendAddressPool: &armnetwork.SubResource{ - // ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/applicationGateways/appgw/backendAddressPools/appgwpool"), - // }, - // BackendHTTPSettings: &armnetwork.SubResource{ - // ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/applicationGateways/appgw/backendHttpSettingsCollection/appgwbhs"), - // }, - // LoadDistributionPolicy: &armnetwork.SubResource{ - // ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/applicationGateways/appgw/loadDistributionPolicies/ldp1"), - // }, - // Paths: []*string{ - // to.Ptr("/api"), - // to.Ptr("/v1/api")}, - // ProvisioningState: to.Ptr(armnetwork.ProvisioningStateSucceeded), - // RewriteRuleSet: &armnetwork.SubResource{ - // ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/applicationGateways/appgw/rewriteRuleSets/rewriteRuleSet1"), - // }, - // }, - // }}, - // ProvisioningState: to.Ptr(armnetwork.ProvisioningStateSucceeded), - // }, - // }}, - // }, - // }}, - // } - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/4883fa5dbf6f2c9093fac8ce334547e9dfac68fa/specification/network/resource-manager/Microsoft.Network/stable/2024-03-01/examples/ApplicationGatewayListAll.json -func ExampleApplicationGatewaysClient_NewListAllPager() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armnetwork.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := clientFactory.NewApplicationGatewaysClient().NewListAllPager(nil) - for pager.More() { - page, err := pager.NextPage(ctx) - if err != nil { - log.Fatalf("failed to advance page: %v", err) - } - for _, v := range page.Value { - // You could use page here. We use blank identifier for just demo purposes. - _ = v - } - // If the HTTP response code is 200 as defined in example definition, your page structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // page.ApplicationGatewayListResult = armnetwork.ApplicationGatewayListResult{ - // Value: []*armnetwork.ApplicationGateway{ - // { - // Name: to.Ptr("appgw"), - // Type: to.Ptr("Microsoft.Network/applicationGateways"), - // ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/applicationGateways/appgw"), - // Location: to.Ptr("southcentralus"), - // Properties: &armnetwork.ApplicationGatewayPropertiesFormat{ - // AuthenticationCertificates: []*armnetwork.ApplicationGatewayAuthenticationCertificate{ - // }, - // BackendAddressPools: []*armnetwork.ApplicationGatewayBackendAddressPool{ - // { - // ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/applicationGateways/appgw/backendAddressPools/appgwpool"), - // Name: to.Ptr("appgwpool"), - // Properties: &armnetwork.ApplicationGatewayBackendAddressPoolPropertiesFormat{ - // BackendAddresses: []*armnetwork.ApplicationGatewayBackendAddress{ - // }, - // ProvisioningState: to.Ptr(armnetwork.ProvisioningStateSucceeded), - // }, - // }, - // { - // ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/applicationGateways/appgw/backendAddressPools/appgwpool1"), - // Name: to.Ptr("appgwpool1"), - // Properties: &armnetwork.ApplicationGatewayBackendAddressPoolPropertiesFormat{ - // BackendAddresses: []*armnetwork.ApplicationGatewayBackendAddress{ - // { - // }, - // { - // }}, - // ProvisioningState: to.Ptr(armnetwork.ProvisioningStateSucceeded), - // }, - // }}, - // BackendHTTPSettingsCollection: []*armnetwork.ApplicationGatewayBackendHTTPSettings{ - // { - // ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/applicationGateways/appgw/backendHttpSettingsCollection/appgwbhs"), - // Name: to.Ptr("appgwbhs"), - // Properties: &armnetwork.ApplicationGatewayBackendHTTPSettingsPropertiesFormat{ - // CookieBasedAffinity: to.Ptr(armnetwork.ApplicationGatewayCookieBasedAffinityDisabled), - // Port: to.Ptr[int32](80), - // ProvisioningState: to.Ptr(armnetwork.ProvisioningStateSucceeded), - // RequestTimeout: to.Ptr[int32](30), - // Protocol: to.Ptr(armnetwork.ApplicationGatewayProtocolHTTP), - // }, - // }}, - // FrontendIPConfigurations: []*armnetwork.ApplicationGatewayFrontendIPConfiguration{ - // { - // ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/applicationGateways/appgw/frontendIPConfigurations/appgwfip"), - // Name: to.Ptr("appgwfip"), - // Properties: &armnetwork.ApplicationGatewayFrontendIPConfigurationPropertiesFormat{ - // PrivateIPAllocationMethod: to.Ptr(armnetwork.IPAllocationMethodDynamic), - // ProvisioningState: to.Ptr(armnetwork.ProvisioningStateSucceeded), - // PublicIPAddress: &armnetwork.SubResource{ - // ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/publicIPAddresses/appgwpip"), - // }, - // }, - // }}, - // FrontendPorts: []*armnetwork.ApplicationGatewayFrontendPort{ - // { - // ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/applicationGateways/appgw/frontendPorts/appgwfp"), - // Name: to.Ptr("appgwfp"), - // Properties: &armnetwork.ApplicationGatewayFrontendPortPropertiesFormat{ - // Port: to.Ptr[int32](443), - // ProvisioningState: to.Ptr(armnetwork.ProvisioningStateSucceeded), - // }, - // }, - // { - // ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/applicationGateways/appgw/frontendPorts/appgwfp80"), - // Name: to.Ptr("appgwfp80"), - // Properties: &armnetwork.ApplicationGatewayFrontendPortPropertiesFormat{ - // Port: to.Ptr[int32](80), - // ProvisioningState: to.Ptr(armnetwork.ProvisioningStateSucceeded), - // }, - // }}, - // GatewayIPConfigurations: []*armnetwork.ApplicationGatewayIPConfiguration{ - // { - // ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/applicationGateways/appgw/gatewayIPConfigurations/appgwipc"), - // Name: to.Ptr("appgwipc"), - // Properties: &armnetwork.ApplicationGatewayIPConfigurationPropertiesFormat{ - // ProvisioningState: to.Ptr(armnetwork.ProvisioningStateSucceeded), - // Subnet: &armnetwork.SubResource{ - // ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/virtualNetworks/virtualNetwork1/subnets/appgwsubnet"), - // }, - // }, - // }}, - // GlobalConfiguration: &armnetwork.ApplicationGatewayGlobalConfiguration{ - // EnableRequestBuffering: to.Ptr(true), - // EnableResponseBuffering: to.Ptr(true), - // }, - // HTTPListeners: []*armnetwork.ApplicationGatewayHTTPListener{ - // { - // ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/applicationGateways/appgw/httpListeners/appgwhl"), - // Name: to.Ptr("appgwhl"), - // Properties: &armnetwork.ApplicationGatewayHTTPListenerPropertiesFormat{ - // FrontendIPConfiguration: &armnetwork.SubResource{ - // ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/applicationGateways/appgw/frontendIPConfigurations/appgwfip"), - // }, - // FrontendPort: &armnetwork.SubResource{ - // ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/applicationGateways/appgw/frontendPorts/appgwfp"), - // }, - // ProvisioningState: to.Ptr(armnetwork.ProvisioningStateSucceeded), - // RequireServerNameIndication: to.Ptr(false), - // SSLCertificate: &armnetwork.SubResource{ - // ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/applicationGateways/appgw/sslCertificates/sslcert"), - // }, - // SSLProfile: &armnetwork.SubResource{ - // ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/applicationGateways/appgw/sslProfiles/sslProfile1"), - // }, - // Protocol: to.Ptr(armnetwork.ApplicationGatewayProtocolHTTPS), - // }, - // }, - // { - // ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/applicationGateways/appgw/httpListeners/appgwhttplistener"), - // Name: to.Ptr("appgwhttplistener"), - // Properties: &armnetwork.ApplicationGatewayHTTPListenerPropertiesFormat{ - // FrontendIPConfiguration: &armnetwork.SubResource{ - // ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/applicationGateways/appgw/frontendIPConfigurations/appgwfip"), - // }, - // FrontendPort: &armnetwork.SubResource{ - // ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/applicationGateways/appgw/frontendPorts/appgwfp80"), - // }, - // ProvisioningState: to.Ptr(armnetwork.ProvisioningStateSucceeded), - // Protocol: to.Ptr(armnetwork.ApplicationGatewayProtocolHTTP), - // }, - // }}, - // LoadDistributionPolicies: []*armnetwork.ApplicationGatewayLoadDistributionPolicy{ - // { - // ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/applicationGateways/appgw/loadDistributionPolicies/ldp1"), - // Name: to.Ptr("ldp1"), - // Properties: &armnetwork.ApplicationGatewayLoadDistributionPolicyPropertiesFormat{ - // LoadDistributionAlgorithm: to.Ptr(armnetwork.ApplicationGatewayLoadDistributionAlgorithmRoundRobin), - // LoadDistributionTargets: []*armnetwork.ApplicationGatewayLoadDistributionTarget{ - // { - // ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/applicationGateways/appgw/loadDistributionPolicies/ldp1/loadDistributionTargets/ldt1"), - // Name: to.Ptr("ld11"), - // Properties: &armnetwork.ApplicationGatewayLoadDistributionTargetPropertiesFormat{ - // BackendAddressPool: &armnetwork.SubResource{ - // ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/applicationGateways/appgw/backendAddressPools/appgwpool"), - // }, - // WeightPerServer: to.Ptr[int32](40), - // }, - // }, - // { - // ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/applicationGateways/appgw/loadDistributionPolicies/ldp1/loadDistributionTargets/ldt1"), - // Name: to.Ptr("ld11"), - // Properties: &armnetwork.ApplicationGatewayLoadDistributionTargetPropertiesFormat{ - // BackendAddressPool: &armnetwork.SubResource{ - // ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/applicationGateways/appgw/backendAddressPools/appgwpool1"), - // }, - // WeightPerServer: to.Ptr[int32](60), - // }, - // }}, - // }, - // }}, - // OperationalState: to.Ptr(armnetwork.ApplicationGatewayOperationalStateRunning), - // PrivateEndpointConnections: []*armnetwork.ApplicationGatewayPrivateEndpointConnection{ - // }, - // PrivateLinkConfigurations: []*armnetwork.ApplicationGatewayPrivateLinkConfiguration{ - // { - // ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/applicationGateways/appgw/privateLinkConfigurations/privateLink1"), - // Name: to.Ptr("privateLink1"), - // Properties: &armnetwork.ApplicationGatewayPrivateLinkConfigurationProperties{ - // IPConfigurations: []*armnetwork.ApplicationGatewayPrivateLinkIPConfiguration{ - // { - // ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/applicationGateways/appgw/privateLinkConfigurations/privateLink1/privateLinkConfigurations/privateLink1/ipConfigurations/natNicIpconfig1"), - // Name: to.Ptr("natNicIpconfig1"), - // Properties: &armnetwork.ApplicationGatewayPrivateLinkIPConfigurationProperties{ - // Primary: to.Ptr(true), - // PrivateIPAllocationMethod: to.Ptr(armnetwork.IPAllocationMethodDynamic), - // ProvisioningState: to.Ptr(armnetwork.ProvisioningStateSucceeded), - // Subnet: &armnetwork.SubResource{ - // ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/virtualNetworks/virtualNetwork1/subnets/appgwsubnet"), - // }, - // }, - // }, - // { - // ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/applicationGateways/appgw/privateLinkConfigurations/privateLink1/privateLinkConfigurations/privateLink1/ipConfigurations/natNicIpconfig2"), - // Name: to.Ptr("natNicIpconfig2"), - // Properties: &armnetwork.ApplicationGatewayPrivateLinkIPConfigurationProperties{ - // PrivateIPAllocationMethod: to.Ptr(armnetwork.IPAllocationMethodDynamic), - // ProvisioningState: to.Ptr(armnetwork.ProvisioningStateSucceeded), - // Subnet: &armnetwork.SubResource{ - // ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/virtualNetworks/virtualNetwork1/subnets/appgwsubnet"), - // }, - // }, - // }}, - // ProvisioningState: to.Ptr(armnetwork.ProvisioningStateSucceeded), - // }, - // }}, - // Probes: []*armnetwork.ApplicationGatewayProbe{ - // }, - // ProvisioningState: to.Ptr(armnetwork.ProvisioningStateSucceeded), - // RequestRoutingRules: []*armnetwork.ApplicationGatewayRequestRoutingRule{ - // { - // ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/applicationGateways/appgw/requestRoutingRules/appgwrule"), - // Name: to.Ptr("appgwrule"), - // Properties: &armnetwork.ApplicationGatewayRequestRoutingRulePropertiesFormat{ - // BackendAddressPool: &armnetwork.SubResource{ - // ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/applicationGateways/appgw/backendAddressPools/appgwpool"), - // }, - // BackendHTTPSettings: &armnetwork.SubResource{ - // ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/applicationGateways/appgw/backendHttpSettingsCollection/appgwbhs"), - // }, - // HTTPListener: &armnetwork.SubResource{ - // ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/applicationGateways/appgw/httpListeners/appgwhl"), - // }, - // LoadDistributionPolicy: &armnetwork.SubResource{ - // ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/applicationGateways/appgw/loadDistributionPolicies/ldp1"), - // }, - // Priority: to.Ptr[int32](10), - // ProvisioningState: to.Ptr(armnetwork.ProvisioningStateSucceeded), - // RewriteRuleSet: &armnetwork.SubResource{ - // ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/applicationGateways/appgw/rewriteRuleSets/rewriteRuleSet1"), - // }, - // RuleType: to.Ptr(armnetwork.ApplicationGatewayRequestRoutingRuleTypeBasic), - // }, - // }, - // { - // ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/applicationGateways/appgw/requestRoutingRules/appgwPathBasedRule"), - // Name: to.Ptr("appgwPathBasedRule"), - // Properties: &armnetwork.ApplicationGatewayRequestRoutingRulePropertiesFormat{ - // HTTPListener: &armnetwork.SubResource{ - // ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/applicationGateways/appgw/httpListeners/appgwhttplistener"), - // }, - // Priority: to.Ptr[int32](20), - // ProvisioningState: to.Ptr(armnetwork.ProvisioningStateSucceeded), - // RuleType: to.Ptr(armnetwork.ApplicationGatewayRequestRoutingRuleTypePathBasedRouting), - // URLPathMap: &armnetwork.SubResource{ - // ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/applicationGateways/appgw/urlPathMaps/pathMap1"), - // }, - // }, - // }}, - // RewriteRuleSets: []*armnetwork.ApplicationGatewayRewriteRuleSet{ - // { - // ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/applicationGateways/appgw/rewriteRuleSets/rewriteRuleSet1"), - // Name: to.Ptr("rewriteRuleSet1"), - // Properties: &armnetwork.ApplicationGatewayRewriteRuleSetPropertiesFormat{ - // ProvisioningState: to.Ptr(armnetwork.ProvisioningStateSucceeded), - // RewriteRules: []*armnetwork.ApplicationGatewayRewriteRule{ - // { - // Name: to.Ptr("Set X-Forwarded-For"), - // ActionSet: &armnetwork.ApplicationGatewayRewriteRuleActionSet{ - // RequestHeaderConfigurations: []*armnetwork.ApplicationGatewayHeaderConfiguration{ - // { - // HeaderName: to.Ptr("X-Forwarded-For"), - // HeaderValue: to.Ptr("{var_remote-addr}"), - // }}, - // ResponseHeaderConfigurations: []*armnetwork.ApplicationGatewayHeaderConfiguration{ - // { - // HeaderName: to.Ptr("Strict-Transport-Security"), - // HeaderValue: to.Ptr("max-age=31536000"), - // }}, - // URLConfiguration: &armnetwork.ApplicationGatewayURLConfiguration{ - // ModifiedPath: to.Ptr("/abc"), - // ModifiedQueryString: to.Ptr("x=y&a=b"), - // Reroute: to.Ptr(false), - // }, - // }, - // Conditions: []*armnetwork.ApplicationGatewayRewriteRuleCondition{ - // { - // IgnoreCase: to.Ptr(true), - // Negate: to.Ptr(false), - // Pattern: to.Ptr("^Bearer"), - // Variable: to.Ptr("http_req_Authorization"), - // }}, - // RuleSequence: to.Ptr[int32](102), - // }}, - // }, - // }}, - // SKU: &armnetwork.ApplicationGatewaySKU{ - // Name: to.Ptr(armnetwork.ApplicationGatewaySKUNameStandardMedium), - // Capacity: to.Ptr[int32](3), - // Tier: to.Ptr(armnetwork.ApplicationGatewayTierStandard), - // }, - // SSLCertificates: []*armnetwork.ApplicationGatewaySSLCertificate{ - // { - // ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/applicationGateways/appgw/sslCertificates/sslcert"), - // Name: to.Ptr("sslcert"), - // Properties: &armnetwork.ApplicationGatewaySSLCertificatePropertiesFormat{ - // ProvisioningState: to.Ptr(armnetwork.ProvisioningStateSucceeded), - // PublicCertData: to.Ptr("*****"), - // }, - // }}, - // SSLProfiles: []*armnetwork.ApplicationGatewaySSLProfile{ - // { - // ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/applicationGateways/appgw/sslProfiles/sslProfile1"), - // Name: to.Ptr("sslProfile1"), - // Properties: &armnetwork.ApplicationGatewaySSLProfilePropertiesFormat{ - // ClientAuthConfiguration: &armnetwork.ApplicationGatewayClientAuthConfiguration{ - // VerifyClientCertIssuerDN: to.Ptr(true), - // VerifyClientRevocation: to.Ptr(armnetwork.ApplicationGatewayClientRevocationOptionsOCSP), - // }, - // ProvisioningState: to.Ptr(armnetwork.ProvisioningStateSucceeded), - // SSLPolicy: &armnetwork.ApplicationGatewaySSLPolicy{ - // CipherSuites: []*armnetwork.ApplicationGatewaySSLCipherSuite{ - // to.Ptr(armnetwork.ApplicationGatewaySSLCipherSuiteTLSECDHERSAWITHAES128CBCSHA256)}, - // MinProtocolVersion: to.Ptr(armnetwork.ApplicationGatewaySSLProtocolTLSv11), - // PolicyType: to.Ptr(armnetwork.ApplicationGatewaySSLPolicyTypeCustom), - // }, - // TrustedClientCertificates: []*armnetwork.SubResource{ - // { - // ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/applicationGateways/appgw/trustedClientCertificates/clientcert"), - // }}, - // }, - // }}, - // TrustedClientCertificates: []*armnetwork.ApplicationGatewayTrustedClientCertificate{ - // { - // ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/applicationGateways/appgw/trustedClientCertificates/clientcert"), - // Name: to.Ptr("clientcert"), - // Properties: &armnetwork.ApplicationGatewayTrustedClientCertificatePropertiesFormat{ - // ClientCertIssuerDN: to.Ptr("CN=User1, OU=Eng, O=Company Ltd, L=D4, S=Arizona, C=US"), - // Data: to.Ptr("****"), - // ProvisioningState: to.Ptr(armnetwork.ProvisioningStateSucceeded), - // ValidatedCertData: to.Ptr("****"), - // }, - // }}, - // URLPathMaps: []*armnetwork.ApplicationGatewayURLPathMap{ - // { - // ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/applicationGateways/appgw/urlPathMaps/pathMap1"), - // Name: to.Ptr("pathMap1"), - // Properties: &armnetwork.ApplicationGatewayURLPathMapPropertiesFormat{ - // DefaultBackendAddressPool: &armnetwork.SubResource{ - // ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/applicationGateways/appgw/backendAddressPools/appgwpool"), - // }, - // DefaultBackendHTTPSettings: &armnetwork.SubResource{ - // ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/applicationGateways/appgw/backendHttpSettingsCollection/appgwbhs"), - // }, - // DefaultLoadDistributionPolicy: &armnetwork.SubResource{ - // ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/applicationGateways/appgw/loadDistributionPolicies/ldp1"), - // }, - // DefaultRewriteRuleSet: &armnetwork.SubResource{ - // ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/applicationGateways/appgw/rewriteRuleSets/rewriteRuleSet1"), - // }, - // PathRules: []*armnetwork.ApplicationGatewayPathRule{ - // { - // ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/applicationGateways/appgw/urlPathMaps/pathMap1/pathRules/apiPaths"), - // Name: to.Ptr("apiPaths"), - // Properties: &armnetwork.ApplicationGatewayPathRulePropertiesFormat{ - // BackendAddressPool: &armnetwork.SubResource{ - // ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/applicationGateways/appgw/backendAddressPools/appgwpool"), - // }, - // BackendHTTPSettings: &armnetwork.SubResource{ - // ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/applicationGateways/appgw/backendHttpSettingsCollection/appgwbhs"), - // }, - // LoadDistributionPolicy: &armnetwork.SubResource{ - // ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/applicationGateways/appgw/loadDistributionPolicies/ldp1"), - // }, - // Paths: []*string{ - // to.Ptr("/api"), - // to.Ptr("/v1/api")}, - // ProvisioningState: to.Ptr(armnetwork.ProvisioningStateSucceeded), - // RewriteRuleSet: &armnetwork.SubResource{ - // ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/applicationGateways/appgw/rewriteRuleSets/rewriteRuleSet1"), - // }, - // }, - // }}, - // ProvisioningState: to.Ptr(armnetwork.ProvisioningStateSucceeded), - // }, - // }}, - // }, - // }}, - // } - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/4883fa5dbf6f2c9093fac8ce334547e9dfac68fa/specification/network/resource-manager/Microsoft.Network/stable/2024-03-01/examples/ApplicationGatewayStart.json -func ExampleApplicationGatewaysClient_BeginStart() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armnetwork.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewApplicationGatewaysClient().BeginStart(ctx, "rg1", "appgw", nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - _, err = poller.PollUntilDone(ctx, nil) - if err != nil { - log.Fatalf("failed to pull the result: %v", err) - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/4883fa5dbf6f2c9093fac8ce334547e9dfac68fa/specification/network/resource-manager/Microsoft.Network/stable/2024-03-01/examples/ApplicationGatewayStop.json -func ExampleApplicationGatewaysClient_BeginStop() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armnetwork.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewApplicationGatewaysClient().BeginStop(ctx, "rg1", "appgw", nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - _, err = poller.PollUntilDone(ctx, nil) - if err != nil { - log.Fatalf("failed to pull the result: %v", err) - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/4883fa5dbf6f2c9093fac8ce334547e9dfac68fa/specification/network/resource-manager/Microsoft.Network/stable/2024-03-01/examples/ApplicationGatewayBackendHealthGet.json -func ExampleApplicationGatewaysClient_BeginBackendHealth() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armnetwork.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewApplicationGatewaysClient().BeginBackendHealth(ctx, "appgw", "appgw", &armnetwork.ApplicationGatewaysClientBeginBackendHealthOptions{Expand: nil}) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - res, err := poller.PollUntilDone(ctx, nil) - if err != nil { - log.Fatalf("failed to pull the result: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.ApplicationGatewayBackendHealth = armnetwork.ApplicationGatewayBackendHealth{ - // BackendAddressPools: []*armnetwork.ApplicationGatewayBackendHealthPool{ - // { - // BackendAddressPool: &armnetwork.ApplicationGatewayBackendAddressPool{ - // ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/applicationGateways/appgw/backendaddressPools/MFAnalyticsPool"), - // }, - // BackendHTTPSettingsCollection: []*armnetwork.ApplicationGatewayBackendHealthHTTPSettings{ - // { - // BackendHTTPSettings: &armnetwork.ApplicationGatewayBackendHTTPSettings{ - // ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/applicationGateways/appgw/backendHttpSettingsCollection/MFPoolSettings"), - // }, - // Servers: []*armnetwork.ApplicationGatewayBackendHealthServer{ - // { - // Address: to.Ptr("10.220.1.8"), - // Health: to.Ptr(armnetwork.ApplicationGatewayBackendHealthServerHealthUp), - // }}, - // }}, - // }, - // { - // BackendAddressPool: &armnetwork.ApplicationGatewayBackendAddressPool{ - // ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/applicationGateways/appgw/backendaddressPools/MFPool"), - // }, - // BackendHTTPSettingsCollection: []*armnetwork.ApplicationGatewayBackendHealthHTTPSettings{ - // { - // BackendHTTPSettings: &armnetwork.ApplicationGatewayBackendHTTPSettings{ - // ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/applicationGateways/appgw/backendHttpSettingsCollection/MFPoolSettings"), - // }, - // Servers: []*armnetwork.ApplicationGatewayBackendHealthServer{ - // { - // Address: to.Ptr("10.220.1.4"), - // Health: to.Ptr(armnetwork.ApplicationGatewayBackendHealthServerHealthUp), - // }, - // { - // Address: to.Ptr("10.220.1.5"), - // Health: to.Ptr(armnetwork.ApplicationGatewayBackendHealthServerHealthUp), - // }}, - // }}, - // }}, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/4883fa5dbf6f2c9093fac8ce334547e9dfac68fa/specification/network/resource-manager/Microsoft.Network/stable/2024-03-01/examples/ApplicationGatewayBackendHealthTest.json -func ExampleApplicationGatewaysClient_BeginBackendHealthOnDemand() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armnetwork.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewApplicationGatewaysClient().BeginBackendHealthOnDemand(ctx, "rg1", "appgw", armnetwork.ApplicationGatewayOnDemandProbe{ - Path: to.Ptr("/"), - BackendAddressPool: &armnetwork.SubResource{ - ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/applicationGateways/appgw/backendaddressPools/MFAnalyticsPool"), - }, - BackendHTTPSettings: &armnetwork.SubResource{ - ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/applicationGateways/appgw/backendHttpSettingsCollection/MFPoolSettings"), - }, - PickHostNameFromBackendHTTPSettings: to.Ptr(true), - Timeout: to.Ptr[int32](30), - Protocol: to.Ptr(armnetwork.ApplicationGatewayProtocolHTTP), - }, &armnetwork.ApplicationGatewaysClientBeginBackendHealthOnDemandOptions{Expand: nil}) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - res, err := poller.PollUntilDone(ctx, nil) - if err != nil { - log.Fatalf("failed to pull the result: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.ApplicationGatewayBackendHealthOnDemand = armnetwork.ApplicationGatewayBackendHealthOnDemand{ - // BackendAddressPool: &armnetwork.ApplicationGatewayBackendAddressPool{ - // ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/applicationGateways/appgw/backendaddressPools/MFAnalyticsPool"), - // }, - // BackendHealthHTTPSettings: &armnetwork.ApplicationGatewayBackendHealthHTTPSettings{ - // BackendHTTPSettings: &armnetwork.ApplicationGatewayBackendHTTPSettings{ - // ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/applicationGateways/appgw/backendHttpSettingsCollection/MFPoolSettings"), - // }, - // Servers: []*armnetwork.ApplicationGatewayBackendHealthServer{ - // { - // Address: to.Ptr("10.220.1.4"), - // Health: to.Ptr(armnetwork.ApplicationGatewayBackendHealthServerHealthUp), - // }, - // { - // Address: to.Ptr("10.220.1.5"), - // Health: to.Ptr(armnetwork.ApplicationGatewayBackendHealthServerHealthUp), - // }}, - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/4883fa5dbf6f2c9093fac8ce334547e9dfac68fa/specification/network/resource-manager/Microsoft.Network/stable/2024-03-01/examples/ApplicationGatewayAvailableServerVariablesGet.json -func ExampleApplicationGatewaysClient_ListAvailableServerVariables() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armnetwork.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewApplicationGatewaysClient().ListAvailableServerVariables(ctx, nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.StringArray = []*string{ - // to.Ptr("request_query")} -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/4883fa5dbf6f2c9093fac8ce334547e9dfac68fa/specification/network/resource-manager/Microsoft.Network/stable/2024-03-01/examples/ApplicationGatewayAvailableRequestHeadersGet.json -func ExampleApplicationGatewaysClient_ListAvailableRequestHeaders() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armnetwork.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewApplicationGatewaysClient().ListAvailableRequestHeaders(ctx, nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.StringArray = []*string{ - // to.Ptr("Accept-Charset")} -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/4883fa5dbf6f2c9093fac8ce334547e9dfac68fa/specification/network/resource-manager/Microsoft.Network/stable/2024-03-01/examples/ApplicationGatewayAvailableResponseHeadersGet.json -func ExampleApplicationGatewaysClient_ListAvailableResponseHeaders() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armnetwork.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewApplicationGatewaysClient().ListAvailableResponseHeaders(ctx, nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.StringArray = []*string{ - // to.Ptr("Access-Control-Allow-Origin")} -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/4883fa5dbf6f2c9093fac8ce334547e9dfac68fa/specification/network/resource-manager/Microsoft.Network/stable/2024-03-01/examples/ApplicationGatewayAvailableWafRuleSetsGet.json -func ExampleApplicationGatewaysClient_ListAvailableWafRuleSets() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armnetwork.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewApplicationGatewaysClient().ListAvailableWafRuleSets(ctx, nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.ApplicationGatewayAvailableWafRuleSetsResult = armnetwork.ApplicationGatewayAvailableWafRuleSetsResult{ - // Value: []*armnetwork.ApplicationGatewayFirewallRuleSet{ - // { - // Name: to.Ptr("OWASP_3.0"), - // Type: to.Ptr("Microsoft.Network/applicationGatewayAvailableWafRuleSets"), - // ID: to.Ptr("/subscriptions//resourceGroups//providers/Microsoft.Network/applicationGatewayAvailableWafRuleSets/"), - // Properties: &armnetwork.ApplicationGatewayFirewallRuleSetPropertiesFormat{ - // ProvisioningState: to.Ptr(armnetwork.ProvisioningStateSucceeded), - // RuleGroups: []*armnetwork.ApplicationGatewayFirewallRuleGroup{ - // { - // Description: to.Ptr(""), - // RuleGroupName: to.Ptr("General"), - // Rules: []*armnetwork.ApplicationGatewayFirewallRule{ - // { - // Description: to.Ptr("Possible Multipart Unmatched Boundary."), - // RuleID: to.Ptr[int32](200004), - // RuleIDString: to.Ptr("200004"), - // }}, - // }}, - // RuleSetType: to.Ptr("OWASP"), - // RuleSetVersion: to.Ptr("3.0"), - // }, - // }}, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/4883fa5dbf6f2c9093fac8ce334547e9dfac68fa/specification/network/resource-manager/Microsoft.Network/stable/2024-03-01/examples/ApplicationGatewayAvailableSslOptionsGet.json -func ExampleApplicationGatewaysClient_ListAvailableSSLOptions() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armnetwork.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewApplicationGatewaysClient().ListAvailableSSLOptions(ctx, nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.ApplicationGatewayAvailableSSLOptions = armnetwork.ApplicationGatewayAvailableSSLOptions{ - // Name: to.Ptr("default"), - // Type: to.Ptr("Microsoft.Network/ApplicationGatewayAvailableSslOptions"), - // ID: to.Ptr("/subscriptions/subid/resourceGroups//providers/Microsoft.Network/ApplicationGatewayAvailableSslOptions/default"), - // Properties: &armnetwork.ApplicationGatewayAvailableSSLOptionsPropertiesFormat{ - // AvailableCipherSuites: []*armnetwork.ApplicationGatewaySSLCipherSuite{ - // to.Ptr(armnetwork.ApplicationGatewaySSLCipherSuiteTLSECDHERSAWITHAES256GCMSHA384), - // to.Ptr(armnetwork.ApplicationGatewaySSLCipherSuiteTLSECDHERSAWITHAES128GCMSHA256), - // to.Ptr(armnetwork.ApplicationGatewaySSLCipherSuiteTLSECDHERSAWITHAES256CBCSHA384), - // to.Ptr(armnetwork.ApplicationGatewaySSLCipherSuiteTLSECDHERSAWITHAES128CBCSHA256), - // to.Ptr(armnetwork.ApplicationGatewaySSLCipherSuiteTLSECDHERSAWITHAES256CBCSHA), - // to.Ptr(armnetwork.ApplicationGatewaySSLCipherSuiteTLSECDHERSAWITHAES128CBCSHA), - // to.Ptr(armnetwork.ApplicationGatewaySSLCipherSuiteTLSDHERSAWITHAES256GCMSHA384), - // to.Ptr(armnetwork.ApplicationGatewaySSLCipherSuiteTLSDHERSAWITHAES128GCMSHA256), - // to.Ptr(armnetwork.ApplicationGatewaySSLCipherSuiteTLSDHERSAWITHAES256CBCSHA), - // to.Ptr(armnetwork.ApplicationGatewaySSLCipherSuiteTLSDHERSAWITHAES128CBCSHA), - // to.Ptr(armnetwork.ApplicationGatewaySSLCipherSuiteTLSRSAWITHAES256GCMSHA384), - // to.Ptr(armnetwork.ApplicationGatewaySSLCipherSuiteTLSRSAWITHAES128GCMSHA256), - // to.Ptr(armnetwork.ApplicationGatewaySSLCipherSuiteTLSRSAWITHAES256CBCSHA256), - // to.Ptr(armnetwork.ApplicationGatewaySSLCipherSuiteTLSRSAWITHAES128CBCSHA256), - // to.Ptr(armnetwork.ApplicationGatewaySSLCipherSuiteTLSRSAWITHAES256CBCSHA), - // to.Ptr(armnetwork.ApplicationGatewaySSLCipherSuiteTLSRSAWITHAES128CBCSHA), - // to.Ptr(armnetwork.ApplicationGatewaySSLCipherSuiteTLSECDHEECDSAWITHAES256GCMSHA384), - // to.Ptr(armnetwork.ApplicationGatewaySSLCipherSuiteTLSECDHEECDSAWITHAES128GCMSHA256), - // to.Ptr(armnetwork.ApplicationGatewaySSLCipherSuiteTLSECDHEECDSAWITHAES256CBCSHA384), - // to.Ptr(armnetwork.ApplicationGatewaySSLCipherSuiteTLSECDHEECDSAWITHAES128CBCSHA256), - // to.Ptr(armnetwork.ApplicationGatewaySSLCipherSuiteTLSECDHEECDSAWITHAES256CBCSHA), - // to.Ptr(armnetwork.ApplicationGatewaySSLCipherSuiteTLSECDHEECDSAWITHAES128CBCSHA), - // to.Ptr(armnetwork.ApplicationGatewaySSLCipherSuiteTLSDHEDSSWITHAES256CBCSHA256), - // to.Ptr(armnetwork.ApplicationGatewaySSLCipherSuiteTLSDHEDSSWITHAES128CBCSHA256), - // to.Ptr(armnetwork.ApplicationGatewaySSLCipherSuiteTLSDHEDSSWITHAES256CBCSHA), - // to.Ptr(armnetwork.ApplicationGatewaySSLCipherSuiteTLSDHEDSSWITHAES128CBCSHA), - // to.Ptr(armnetwork.ApplicationGatewaySSLCipherSuiteTLSRSAWITH3DESEDECBCSHA), - // to.Ptr(armnetwork.ApplicationGatewaySSLCipherSuiteTLSDHEDSSWITH3DESEDECBCSHA)}, - // AvailableProtocols: []*armnetwork.ApplicationGatewaySSLProtocol{ - // to.Ptr(armnetwork.ApplicationGatewaySSLProtocolTLSv10), - // to.Ptr(armnetwork.ApplicationGatewaySSLProtocolTLSv11), - // to.Ptr(armnetwork.ApplicationGatewaySSLProtocolTLSv12)}, - // DefaultPolicy: to.Ptr(armnetwork.ApplicationGatewaySSLPolicyNameAppGwSSLPolicy20150501), - // PredefinedPolicies: []*armnetwork.SubResource{ - // { - // ID: to.Ptr("/subscriptions/subid/resourceGroups//providers/Microsoft.Network/ApplicationGatewayAvailableSslOptions/default/ApplicationGatewaySslPredefinedPolicy/AppGwSslPolicy20150501"), - // }, - // { - // ID: to.Ptr("/subscriptions/subid/resourceGroups//providers/Microsoft.Network/ApplicationGatewayAvailableSslOptions/default/ApplicationGatewaySslPredefinedPolicy/AppGwSslPolicy20170401"), - // }, - // { - // ID: to.Ptr("/subscriptions/subid/resourceGroups//providers/Microsoft.Network/ApplicationGatewayAvailableSslOptions/default/ApplicationGatewaySslPredefinedPolicy/AppGwSslPolicy20170401S"), - // }}, - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/4883fa5dbf6f2c9093fac8ce334547e9dfac68fa/specification/network/resource-manager/Microsoft.Network/stable/2024-03-01/examples/ApplicationGatewayAvailableSslOptionsPredefinedPoliciesGet.json -func ExampleApplicationGatewaysClient_NewListAvailableSSLPredefinedPoliciesPager() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armnetwork.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := clientFactory.NewApplicationGatewaysClient().NewListAvailableSSLPredefinedPoliciesPager(nil) - for pager.More() { - page, err := pager.NextPage(ctx) - if err != nil { - log.Fatalf("failed to advance page: %v", err) - } - for _, v := range page.Value { - // You could use page here. We use blank identifier for just demo purposes. - _ = v - } - // If the HTTP response code is 200 as defined in example definition, your page structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // page.ApplicationGatewayAvailableSSLPredefinedPolicies = armnetwork.ApplicationGatewayAvailableSSLPredefinedPolicies{ - // Value: []*armnetwork.ApplicationGatewaySSLPredefinedPolicy{ - // { - // ID: to.Ptr("/subscriptions/subid/resourceGroups//providers/Microsoft.Network/ApplicationGatewayAvailableSslOptions/default/ApplicationGatewaySslPredefinedPolicy/AppGwSslPolicy20150501"), - // Name: to.Ptr("AppGwSslPolicy20150501"), - // Properties: &armnetwork.ApplicationGatewaySSLPredefinedPolicyPropertiesFormat{ - // CipherSuites: []*armnetwork.ApplicationGatewaySSLCipherSuite{ - // to.Ptr(armnetwork.ApplicationGatewaySSLCipherSuiteTLSECDHERSAWITHAES256GCMSHA384), - // to.Ptr(armnetwork.ApplicationGatewaySSLCipherSuiteTLSECDHERSAWITHAES128GCMSHA256), - // to.Ptr(armnetwork.ApplicationGatewaySSLCipherSuiteTLSECDHERSAWITHAES256CBCSHA384), - // to.Ptr(armnetwork.ApplicationGatewaySSLCipherSuiteTLSECDHERSAWITHAES128CBCSHA256), - // to.Ptr(armnetwork.ApplicationGatewaySSLCipherSuiteTLSECDHERSAWITHAES256CBCSHA), - // to.Ptr(armnetwork.ApplicationGatewaySSLCipherSuiteTLSECDHERSAWITHAES128CBCSHA), - // to.Ptr(armnetwork.ApplicationGatewaySSLCipherSuiteTLSDHERSAWITHAES256GCMSHA384), - // to.Ptr(armnetwork.ApplicationGatewaySSLCipherSuiteTLSDHERSAWITHAES128GCMSHA256), - // to.Ptr(armnetwork.ApplicationGatewaySSLCipherSuiteTLSDHERSAWITHAES256CBCSHA), - // to.Ptr(armnetwork.ApplicationGatewaySSLCipherSuiteTLSDHERSAWITHAES128CBCSHA), - // to.Ptr(armnetwork.ApplicationGatewaySSLCipherSuiteTLSRSAWITHAES256GCMSHA384), - // to.Ptr(armnetwork.ApplicationGatewaySSLCipherSuiteTLSRSAWITHAES128GCMSHA256), - // to.Ptr(armnetwork.ApplicationGatewaySSLCipherSuiteTLSRSAWITHAES256CBCSHA256), - // to.Ptr(armnetwork.ApplicationGatewaySSLCipherSuiteTLSRSAWITHAES128CBCSHA256), - // to.Ptr(armnetwork.ApplicationGatewaySSLCipherSuiteTLSRSAWITHAES256CBCSHA), - // to.Ptr(armnetwork.ApplicationGatewaySSLCipherSuiteTLSRSAWITHAES128CBCSHA), - // to.Ptr(armnetwork.ApplicationGatewaySSLCipherSuiteTLSECDHEECDSAWITHAES256GCMSHA384), - // to.Ptr(armnetwork.ApplicationGatewaySSLCipherSuiteTLSECDHEECDSAWITHAES128GCMSHA256), - // to.Ptr(armnetwork.ApplicationGatewaySSLCipherSuiteTLSECDHEECDSAWITHAES256CBCSHA384), - // to.Ptr(armnetwork.ApplicationGatewaySSLCipherSuiteTLSECDHEECDSAWITHAES128CBCSHA256), - // to.Ptr(armnetwork.ApplicationGatewaySSLCipherSuiteTLSECDHEECDSAWITHAES256CBCSHA), - // to.Ptr(armnetwork.ApplicationGatewaySSLCipherSuiteTLSECDHEECDSAWITHAES128CBCSHA), - // to.Ptr(armnetwork.ApplicationGatewaySSLCipherSuiteTLSDHEDSSWITHAES256CBCSHA256), - // to.Ptr(armnetwork.ApplicationGatewaySSLCipherSuiteTLSDHEDSSWITHAES128CBCSHA256), - // to.Ptr(armnetwork.ApplicationGatewaySSLCipherSuiteTLSDHEDSSWITHAES256CBCSHA), - // to.Ptr(armnetwork.ApplicationGatewaySSLCipherSuiteTLSDHEDSSWITHAES128CBCSHA), - // to.Ptr(armnetwork.ApplicationGatewaySSLCipherSuiteTLSRSAWITH3DESEDECBCSHA), - // to.Ptr(armnetwork.ApplicationGatewaySSLCipherSuiteTLSDHEDSSWITH3DESEDECBCSHA)}, - // MinProtocolVersion: to.Ptr(armnetwork.ApplicationGatewaySSLProtocolTLSv10), - // }, - // }, - // { - // ID: to.Ptr("/subscriptions/subid/resourceGroups//providers/Microsoft.Network/ApplicationGatewayAvailableSslOptions/default/ApplicationGatewaySslPredefinedPolicy/AppGwSslPolicy20170401"), - // Name: to.Ptr("AppGwSslPolicy20170401"), - // Properties: &armnetwork.ApplicationGatewaySSLPredefinedPolicyPropertiesFormat{ - // CipherSuites: []*armnetwork.ApplicationGatewaySSLCipherSuite{ - // to.Ptr(armnetwork.ApplicationGatewaySSLCipherSuiteTLSECDHEECDSAWITHAES128GCMSHA256), - // to.Ptr(armnetwork.ApplicationGatewaySSLCipherSuiteTLSECDHEECDSAWITHAES256GCMSHA384), - // to.Ptr(armnetwork.ApplicationGatewaySSLCipherSuiteTLSECDHEECDSAWITHAES128CBCSHA), - // to.Ptr(armnetwork.ApplicationGatewaySSLCipherSuiteTLSECDHEECDSAWITHAES256CBCSHA), - // to.Ptr(armnetwork.ApplicationGatewaySSLCipherSuiteTLSECDHEECDSAWITHAES128CBCSHA256), - // to.Ptr(armnetwork.ApplicationGatewaySSLCipherSuiteTLSECDHEECDSAWITHAES256CBCSHA384), - // to.Ptr(armnetwork.ApplicationGatewaySSLCipherSuiteTLSECDHERSAWITHAES256GCMSHA384), - // to.Ptr(armnetwork.ApplicationGatewaySSLCipherSuiteTLSECDHERSAWITHAES128GCMSHA256), - // to.Ptr(armnetwork.ApplicationGatewaySSLCipherSuiteTLSECDHERSAWITHAES128CBCSHA), - // to.Ptr(armnetwork.ApplicationGatewaySSLCipherSuiteTLSECDHERSAWITHAES256CBCSHA), - // to.Ptr(armnetwork.ApplicationGatewaySSLCipherSuiteTLSRSAWITHAES256GCMSHA384), - // to.Ptr(armnetwork.ApplicationGatewaySSLCipherSuiteTLSRSAWITHAES128GCMSHA256), - // to.Ptr(armnetwork.ApplicationGatewaySSLCipherSuiteTLSRSAWITHAES256CBCSHA256), - // to.Ptr(armnetwork.ApplicationGatewaySSLCipherSuiteTLSRSAWITHAES128CBCSHA256), - // to.Ptr(armnetwork.ApplicationGatewaySSLCipherSuiteTLSRSAWITHAES256CBCSHA), - // to.Ptr(armnetwork.ApplicationGatewaySSLCipherSuiteTLSRSAWITHAES128CBCSHA)}, - // MinProtocolVersion: to.Ptr(armnetwork.ApplicationGatewaySSLProtocolTLSv11), - // }, - // }, - // { - // ID: to.Ptr("/subscriptions/subid/resourceGroups//providers/Microsoft.Network/ApplicationGatewayAvailableSslOptions/default/ApplicationGatewaySslPredefinedPolicy/AppGwSslPolicy20170401S"), - // Name: to.Ptr("AppGwSslPolicy20170401S"), - // Properties: &armnetwork.ApplicationGatewaySSLPredefinedPolicyPropertiesFormat{ - // CipherSuites: []*armnetwork.ApplicationGatewaySSLCipherSuite{ - // to.Ptr(armnetwork.ApplicationGatewaySSLCipherSuiteTLSECDHEECDSAWITHAES128GCMSHA256), - // to.Ptr(armnetwork.ApplicationGatewaySSLCipherSuiteTLSECDHEECDSAWITHAES256GCMSHA384), - // to.Ptr(armnetwork.ApplicationGatewaySSLCipherSuiteTLSECDHEECDSAWITHAES128CBCSHA), - // to.Ptr(armnetwork.ApplicationGatewaySSLCipherSuiteTLSECDHEECDSAWITHAES256CBCSHA), - // to.Ptr(armnetwork.ApplicationGatewaySSLCipherSuiteTLSECDHEECDSAWITHAES128CBCSHA256), - // to.Ptr(armnetwork.ApplicationGatewaySSLCipherSuiteTLSECDHEECDSAWITHAES256CBCSHA384), - // to.Ptr(armnetwork.ApplicationGatewaySSLCipherSuiteTLSECDHERSAWITHAES256GCMSHA384), - // to.Ptr(armnetwork.ApplicationGatewaySSLCipherSuiteTLSECDHERSAWITHAES128GCMSHA256), - // to.Ptr(armnetwork.ApplicationGatewaySSLCipherSuiteTLSECDHERSAWITHAES128CBCSHA), - // to.Ptr(armnetwork.ApplicationGatewaySSLCipherSuiteTLSECDHERSAWITHAES256CBCSHA), - // to.Ptr(armnetwork.ApplicationGatewaySSLCipherSuiteTLSRSAWITHAES256GCMSHA384), - // to.Ptr(armnetwork.ApplicationGatewaySSLCipherSuiteTLSRSAWITHAES128GCMSHA256), - // to.Ptr(armnetwork.ApplicationGatewaySSLCipherSuiteTLSRSAWITHAES256CBCSHA256), - // to.Ptr(armnetwork.ApplicationGatewaySSLCipherSuiteTLSRSAWITHAES128CBCSHA256), - // to.Ptr(armnetwork.ApplicationGatewaySSLCipherSuiteTLSRSAWITHAES256CBCSHA), - // to.Ptr(armnetwork.ApplicationGatewaySSLCipherSuiteTLSRSAWITHAES128CBCSHA)}, - // MinProtocolVersion: to.Ptr(armnetwork.ApplicationGatewaySSLProtocolTLSv12), - // }, - // }}, - // } - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/4883fa5dbf6f2c9093fac8ce334547e9dfac68fa/specification/network/resource-manager/Microsoft.Network/stable/2024-03-01/examples/ApplicationGatewayAvailableSslOptionsPredefinedPolicyGet.json -func ExampleApplicationGatewaysClient_GetSSLPredefinedPolicy() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armnetwork.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewApplicationGatewaysClient().GetSSLPredefinedPolicy(ctx, "AppGwSslPolicy20150501", nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.ApplicationGatewaySSLPredefinedPolicy = armnetwork.ApplicationGatewaySSLPredefinedPolicy{ - // ID: to.Ptr("/subscriptions/subid/resourceGroups//providers/Microsoft.Network/ApplicationGatewayAvailableSslOptions/default/ApplicationGatewaySslPredefinedPolicy/AppGwSslPolicy20150501"), - // Name: to.Ptr("AppGwSslPolicy20150501"), - // Properties: &armnetwork.ApplicationGatewaySSLPredefinedPolicyPropertiesFormat{ - // CipherSuites: []*armnetwork.ApplicationGatewaySSLCipherSuite{ - // to.Ptr(armnetwork.ApplicationGatewaySSLCipherSuiteTLSECDHERSAWITHAES256GCMSHA384), - // to.Ptr(armnetwork.ApplicationGatewaySSLCipherSuiteTLSECDHERSAWITHAES128GCMSHA256), - // to.Ptr(armnetwork.ApplicationGatewaySSLCipherSuiteTLSECDHERSAWITHAES256CBCSHA384), - // to.Ptr(armnetwork.ApplicationGatewaySSLCipherSuiteTLSECDHERSAWITHAES128CBCSHA256), - // to.Ptr(armnetwork.ApplicationGatewaySSLCipherSuiteTLSECDHERSAWITHAES256CBCSHA), - // to.Ptr(armnetwork.ApplicationGatewaySSLCipherSuiteTLSECDHERSAWITHAES128CBCSHA), - // to.Ptr(armnetwork.ApplicationGatewaySSLCipherSuiteTLSDHERSAWITHAES256GCMSHA384), - // to.Ptr(armnetwork.ApplicationGatewaySSLCipherSuiteTLSDHERSAWITHAES128GCMSHA256), - // to.Ptr(armnetwork.ApplicationGatewaySSLCipherSuiteTLSDHERSAWITHAES256CBCSHA), - // to.Ptr(armnetwork.ApplicationGatewaySSLCipherSuiteTLSDHERSAWITHAES128CBCSHA), - // to.Ptr(armnetwork.ApplicationGatewaySSLCipherSuiteTLSRSAWITHAES256GCMSHA384), - // to.Ptr(armnetwork.ApplicationGatewaySSLCipherSuiteTLSRSAWITHAES128GCMSHA256), - // to.Ptr(armnetwork.ApplicationGatewaySSLCipherSuiteTLSRSAWITHAES256CBCSHA256), - // to.Ptr(armnetwork.ApplicationGatewaySSLCipherSuiteTLSRSAWITHAES128CBCSHA256), - // to.Ptr(armnetwork.ApplicationGatewaySSLCipherSuiteTLSRSAWITHAES256CBCSHA), - // to.Ptr(armnetwork.ApplicationGatewaySSLCipherSuiteTLSRSAWITHAES128CBCSHA), - // to.Ptr(armnetwork.ApplicationGatewaySSLCipherSuiteTLSECDHEECDSAWITHAES256GCMSHA384), - // to.Ptr(armnetwork.ApplicationGatewaySSLCipherSuiteTLSECDHEECDSAWITHAES128GCMSHA256), - // to.Ptr(armnetwork.ApplicationGatewaySSLCipherSuiteTLSECDHEECDSAWITHAES256CBCSHA384), - // to.Ptr(armnetwork.ApplicationGatewaySSLCipherSuiteTLSECDHEECDSAWITHAES128CBCSHA256), - // to.Ptr(armnetwork.ApplicationGatewaySSLCipherSuiteTLSECDHEECDSAWITHAES256CBCSHA), - // to.Ptr(armnetwork.ApplicationGatewaySSLCipherSuiteTLSECDHEECDSAWITHAES128CBCSHA), - // to.Ptr(armnetwork.ApplicationGatewaySSLCipherSuiteTLSDHEDSSWITHAES256CBCSHA256), - // to.Ptr(armnetwork.ApplicationGatewaySSLCipherSuiteTLSDHEDSSWITHAES128CBCSHA256), - // to.Ptr(armnetwork.ApplicationGatewaySSLCipherSuiteTLSDHEDSSWITHAES256CBCSHA), - // to.Ptr(armnetwork.ApplicationGatewaySSLCipherSuiteTLSDHEDSSWITHAES128CBCSHA), - // to.Ptr(armnetwork.ApplicationGatewaySSLCipherSuiteTLSRSAWITH3DESEDECBCSHA), - // to.Ptr(armnetwork.ApplicationGatewaySSLCipherSuiteTLSDHEDSSWITH3DESEDECBCSHA)}, - // MinProtocolVersion: to.Ptr(armnetwork.ApplicationGatewaySSLProtocolTLSv10), - // }, - // } -} diff --git a/sdk/resourcemanager/network/armnetwork/applicationgatewaywafdynamicmanifests_client_example_test.go b/sdk/resourcemanager/network/armnetwork/applicationgatewaywafdynamicmanifests_client_example_test.go deleted file mode 100644 index 47029e180b66..000000000000 --- a/sdk/resourcemanager/network/armnetwork/applicationgatewaywafdynamicmanifests_client_example_test.go +++ /dev/null @@ -1,92 +0,0 @@ -//go:build go1.18 -// +build go1.18 - -// 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. -// DO NOT EDIT. - -package armnetwork_test - -import ( - "context" - "log" - - "github.com/Azure/azure-sdk-for-go/sdk/azidentity" - "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/network/armnetwork/v6" -) - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/4883fa5dbf6f2c9093fac8ce334547e9dfac68fa/specification/network/resource-manager/Microsoft.Network/stable/2024-03-01/examples/GetApplicationGatewayWafDynamicManifests.json -func ExampleApplicationGatewayWafDynamicManifestsClient_NewGetPager() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armnetwork.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := clientFactory.NewApplicationGatewayWafDynamicManifestsClient().NewGetPager("westus", nil) - for pager.More() { - page, err := pager.NextPage(ctx) - if err != nil { - log.Fatalf("failed to advance page: %v", err) - } - for _, v := range page.Value { - // You could use page here. We use blank identifier for just demo purposes. - _ = v - } - // If the HTTP response code is 200 as defined in example definition, your page structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // page.ApplicationGatewayWafDynamicManifestResultList = armnetwork.ApplicationGatewayWafDynamicManifestResultList{ - // Value: []*armnetwork.ApplicationGatewayWafDynamicManifestResult{ - // { - // Name: to.Ptr("default"), - // Type: to.Ptr("Microsoft.Network/applicationGatewayWafDynamicManifest"), - // ID: to.Ptr("/subscriptions/subid/providers/Microsoft.Network/applicationGatewayWafDynamicManifests/default"), - // Properties: &armnetwork.ApplicationGatewayWafDynamicManifestPropertiesResult{ - // AvailableRuleSets: []*armnetwork.ApplicationGatewayFirewallManifestRuleSet{ - // { - // RuleGroups: []*armnetwork.ApplicationGatewayFirewallRuleGroup{ - // { - // Description: to.Ptr(""), - // RuleGroupName: to.Ptr("General"), - // Rules: []*armnetwork.ApplicationGatewayFirewallRule{ - // { - // Description: to.Ptr("Failed to Parse Request Body."), - // Action: to.Ptr(armnetwork.ApplicationGatewayWafRuleActionTypesAnomalyScoring), - // RuleID: to.Ptr[int32](200002), - // RuleIDString: to.Ptr("200002"), - // State: to.Ptr(armnetwork.ApplicationGatewayWafRuleStateTypesEnabled), - // }, - // { - // Description: to.Ptr("Multipart Request Body Strict Validation."), - // Action: to.Ptr(armnetwork.ApplicationGatewayWafRuleActionTypesAnomalyScoring), - // RuleID: to.Ptr[int32](200003), - // RuleIDString: to.Ptr("200003"), - // State: to.Ptr(armnetwork.ApplicationGatewayWafRuleStateTypesEnabled), - // }, - // { - // Description: to.Ptr("Possible Multipart Unmatched Boundary."), - // Action: to.Ptr(armnetwork.ApplicationGatewayWafRuleActionTypesAnomalyScoring), - // RuleID: to.Ptr[int32](200004), - // RuleIDString: to.Ptr("200004"), - // State: to.Ptr(armnetwork.ApplicationGatewayWafRuleStateTypesEnabled), - // }}, - // }}, - // RuleSetType: to.Ptr("OWASP"), - // RuleSetVersion: to.Ptr("3.2"), - // Status: to.Ptr(armnetwork.ApplicationGatewayRuleSetStatusOptions("0")), - // Tiers: []*armnetwork.ApplicationGatewayTierTypes{ - // to.Ptr(armnetwork.ApplicationGatewayTierTypesWAFV2)}, - // }}, - // DefaultRuleSet: &armnetwork.DefaultRuleSetPropertyFormat{ - // RuleSetType: to.Ptr("OWASP"), - // RuleSetVersion: to.Ptr("3.2"), - // }, - // }, - // }}, - // } - } -} diff --git a/sdk/resourcemanager/network/armnetwork/applicationgatewaywafdynamicmanifestsdefault_client_example_test.go b/sdk/resourcemanager/network/armnetwork/applicationgatewaywafdynamicmanifestsdefault_client_example_test.go deleted file mode 100644 index 6bf2b05418af..000000000000 --- a/sdk/resourcemanager/network/armnetwork/applicationgatewaywafdynamicmanifestsdefault_client_example_test.go +++ /dev/null @@ -1,84 +0,0 @@ -//go:build go1.18 -// +build go1.18 - -// 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. -// DO NOT EDIT. - -package armnetwork_test - -import ( - "context" - "log" - - "github.com/Azure/azure-sdk-for-go/sdk/azidentity" - "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/network/armnetwork/v6" -) - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/4883fa5dbf6f2c9093fac8ce334547e9dfac68fa/specification/network/resource-manager/Microsoft.Network/stable/2024-03-01/examples/GetApplicationGatewayWafDynamicManifestsDefault.json -func ExampleApplicationGatewayWafDynamicManifestsDefaultClient_Get() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armnetwork.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewApplicationGatewayWafDynamicManifestsDefaultClient().Get(ctx, "westus", nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.ApplicationGatewayWafDynamicManifestResult = armnetwork.ApplicationGatewayWafDynamicManifestResult{ - // Name: to.Ptr("default"), - // Type: to.Ptr("Microsoft.Network/applicationGatewayWafDynamicManifest"), - // ID: to.Ptr("/subscriptions/subid/providers/Microsoft.Network/applicationGatewayWafDynamicManifests/default"), - // Properties: &armnetwork.ApplicationGatewayWafDynamicManifestPropertiesResult{ - // AvailableRuleSets: []*armnetwork.ApplicationGatewayFirewallManifestRuleSet{ - // { - // RuleGroups: []*armnetwork.ApplicationGatewayFirewallRuleGroup{ - // { - // Description: to.Ptr(""), - // RuleGroupName: to.Ptr("General"), - // Rules: []*armnetwork.ApplicationGatewayFirewallRule{ - // { - // Description: to.Ptr("Failed to Parse Request Body."), - // Action: to.Ptr(armnetwork.ApplicationGatewayWafRuleActionTypesAnomalyScoring), - // RuleID: to.Ptr[int32](200002), - // RuleIDString: to.Ptr("200002"), - // State: to.Ptr(armnetwork.ApplicationGatewayWafRuleStateTypesEnabled), - // }, - // { - // Description: to.Ptr("Multipart Request Body Strict Validation."), - // Action: to.Ptr(armnetwork.ApplicationGatewayWafRuleActionTypesAnomalyScoring), - // RuleID: to.Ptr[int32](200003), - // RuleIDString: to.Ptr("200003"), - // State: to.Ptr(armnetwork.ApplicationGatewayWafRuleStateTypesEnabled), - // }, - // { - // Description: to.Ptr("Possible Multipart Unmatched Boundary."), - // Action: to.Ptr(armnetwork.ApplicationGatewayWafRuleActionTypesAnomalyScoring), - // RuleID: to.Ptr[int32](200004), - // RuleIDString: to.Ptr("200004"), - // State: to.Ptr(armnetwork.ApplicationGatewayWafRuleStateTypesEnabled), - // }}, - // }}, - // RuleSetType: to.Ptr("OWASP"), - // RuleSetVersion: to.Ptr("3.2"), - // Status: to.Ptr(armnetwork.ApplicationGatewayRuleSetStatusOptions("0")), - // Tiers: []*armnetwork.ApplicationGatewayTierTypes{ - // to.Ptr(armnetwork.ApplicationGatewayTierTypesWAFV2)}, - // }}, - // DefaultRuleSet: &armnetwork.DefaultRuleSetPropertyFormat{ - // RuleSetType: to.Ptr("OWASP"), - // RuleSetVersion: to.Ptr("3.2"), - // }, - // }, - // } -} diff --git a/sdk/resourcemanager/network/armnetwork/applicationsecuritygroups_client_example_test.go b/sdk/resourcemanager/network/armnetwork/applicationsecuritygroups_client_example_test.go deleted file mode 100644 index 011a942233ad..000000000000 --- a/sdk/resourcemanager/network/armnetwork/applicationsecuritygroups_client_example_test.go +++ /dev/null @@ -1,242 +0,0 @@ -//go:build go1.18 -// +build go1.18 - -// 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. -// DO NOT EDIT. - -package armnetwork_test - -import ( - "context" - "log" - - "github.com/Azure/azure-sdk-for-go/sdk/azcore/to" - "github.com/Azure/azure-sdk-for-go/sdk/azidentity" - "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/network/armnetwork/v6" -) - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/4883fa5dbf6f2c9093fac8ce334547e9dfac68fa/specification/network/resource-manager/Microsoft.Network/stable/2024-03-01/examples/ApplicationSecurityGroupDelete.json -func ExampleApplicationSecurityGroupsClient_BeginDelete() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armnetwork.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewApplicationSecurityGroupsClient().BeginDelete(ctx, "rg1", "test-asg", nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - _, err = poller.PollUntilDone(ctx, nil) - if err != nil { - log.Fatalf("failed to pull the result: %v", err) - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/4883fa5dbf6f2c9093fac8ce334547e9dfac68fa/specification/network/resource-manager/Microsoft.Network/stable/2024-03-01/examples/ApplicationSecurityGroupGet.json -func ExampleApplicationSecurityGroupsClient_Get() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armnetwork.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewApplicationSecurityGroupsClient().Get(ctx, "rg1", "test-asg", nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.ApplicationSecurityGroup = armnetwork.ApplicationSecurityGroup{ - // Name: to.Ptr("test-asg"), - // Type: to.Ptr("Microsoft.Network/applicationSecurityGroups"), - // ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/applicationSecurityGroups/test-asg"), - // Location: to.Ptr("westus"), - // Properties: &armnetwork.ApplicationSecurityGroupPropertiesFormat{ - // ProvisioningState: to.Ptr(armnetwork.ProvisioningStateSucceeded), - // ResourceGUID: to.Ptr("00000000-0000-0000-0000-000000000000"), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/4883fa5dbf6f2c9093fac8ce334547e9dfac68fa/specification/network/resource-manager/Microsoft.Network/stable/2024-03-01/examples/ApplicationSecurityGroupCreate.json -func ExampleApplicationSecurityGroupsClient_BeginCreateOrUpdate() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armnetwork.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewApplicationSecurityGroupsClient().BeginCreateOrUpdate(ctx, "rg1", "test-asg", armnetwork.ApplicationSecurityGroup{ - Location: to.Ptr("westus"), - Properties: &armnetwork.ApplicationSecurityGroupPropertiesFormat{}, - }, nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - res, err := poller.PollUntilDone(ctx, nil) - if err != nil { - log.Fatalf("failed to pull the result: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.ApplicationSecurityGroup = armnetwork.ApplicationSecurityGroup{ - // Name: to.Ptr("test-asg"), - // Type: to.Ptr("Microsoft.Network/applicationSecurityGroups"), - // ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/applicationSecurityGroups/test-asg"), - // Location: to.Ptr("westus"), - // Properties: &armnetwork.ApplicationSecurityGroupPropertiesFormat{ - // ProvisioningState: to.Ptr(armnetwork.ProvisioningStateSucceeded), - // ResourceGUID: to.Ptr("00000000-0000-0000-0000-000000000000"), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/4883fa5dbf6f2c9093fac8ce334547e9dfac68fa/specification/network/resource-manager/Microsoft.Network/stable/2024-03-01/examples/ApplicationSecurityGroupUpdateTags.json -func ExampleApplicationSecurityGroupsClient_UpdateTags() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armnetwork.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewApplicationSecurityGroupsClient().UpdateTags(ctx, "rg1", "test-asg", armnetwork.TagsObject{ - Tags: map[string]*string{ - "tag1": to.Ptr("value1"), - "tag2": to.Ptr("value2"), - }, - }, nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.ApplicationSecurityGroup = armnetwork.ApplicationSecurityGroup{ - // Name: to.Ptr("test-asg"), - // Type: to.Ptr("Microsoft.Network/applicationSecurityGroups"), - // ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/applicationSecurityGroups/test-asg"), - // Location: to.Ptr("westus"), - // Tags: map[string]*string{ - // "tag1": to.Ptr("value1"), - // "tag2": to.Ptr("value2"), - // }, - // Properties: &armnetwork.ApplicationSecurityGroupPropertiesFormat{ - // ProvisioningState: to.Ptr(armnetwork.ProvisioningStateSucceeded), - // ResourceGUID: to.Ptr("00000000-0000-0000-0000-000000000000"), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/4883fa5dbf6f2c9093fac8ce334547e9dfac68fa/specification/network/resource-manager/Microsoft.Network/stable/2024-03-01/examples/ApplicationSecurityGroupListAll.json -func ExampleApplicationSecurityGroupsClient_NewListAllPager() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armnetwork.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := clientFactory.NewApplicationSecurityGroupsClient().NewListAllPager(nil) - for pager.More() { - page, err := pager.NextPage(ctx) - if err != nil { - log.Fatalf("failed to advance page: %v", err) - } - for _, v := range page.Value { - // You could use page here. We use blank identifier for just demo purposes. - _ = v - } - // If the HTTP response code is 200 as defined in example definition, your page structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // page.ApplicationSecurityGroupListResult = armnetwork.ApplicationSecurityGroupListResult{ - // Value: []*armnetwork.ApplicationSecurityGroup{ - // { - // Name: to.Ptr("asg1"), - // Type: to.Ptr("Microsoft.Network/applicationSecurityGroups"), - // ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/applicationSecurityGroups/asg1"), - // Location: to.Ptr("westus"), - // Properties: &armnetwork.ApplicationSecurityGroupPropertiesFormat{ - // ProvisioningState: to.Ptr(armnetwork.ProvisioningStateSucceeded), - // ResourceGUID: to.Ptr("00000000-0000-0000-0000-000000000000"), - // }, - // }, - // { - // Name: to.Ptr("asg2"), - // Type: to.Ptr("Microsoft.Network/applicationSecurityGroups"), - // ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/applicationSecurityGroups/asg2"), - // Location: to.Ptr("westus"), - // Properties: &armnetwork.ApplicationSecurityGroupPropertiesFormat{ - // ProvisioningState: to.Ptr(armnetwork.ProvisioningStateSucceeded), - // ResourceGUID: to.Ptr("00000000-0000-0000-0000-000000000000"), - // }, - // }}, - // } - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/4883fa5dbf6f2c9093fac8ce334547e9dfac68fa/specification/network/resource-manager/Microsoft.Network/stable/2024-03-01/examples/ApplicationSecurityGroupList.json -func ExampleApplicationSecurityGroupsClient_NewListPager() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armnetwork.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := clientFactory.NewApplicationSecurityGroupsClient().NewListPager("rg1", nil) - for pager.More() { - page, err := pager.NextPage(ctx) - if err != nil { - log.Fatalf("failed to advance page: %v", err) - } - for _, v := range page.Value { - // You could use page here. We use blank identifier for just demo purposes. - _ = v - } - // If the HTTP response code is 200 as defined in example definition, your page structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // page.ApplicationSecurityGroupListResult = armnetwork.ApplicationSecurityGroupListResult{ - // Value: []*armnetwork.ApplicationSecurityGroup{ - // { - // Name: to.Ptr("asg1"), - // Type: to.Ptr("Microsoft.Network/applicationSecurityGroups"), - // ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/applicationSecurityGroups/asg1"), - // Location: to.Ptr("westus"), - // Properties: &armnetwork.ApplicationSecurityGroupPropertiesFormat{ - // ProvisioningState: to.Ptr(armnetwork.ProvisioningStateSucceeded), - // ResourceGUID: to.Ptr("00000000-0000-0000-0000-000000000000"), - // }, - // }, - // { - // Name: to.Ptr("asg2"), - // Type: to.Ptr("Microsoft.Network/applicationSecurityGroups"), - // ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/applicationSecurityGroups/asg2"), - // Location: to.Ptr("westus"), - // Properties: &armnetwork.ApplicationSecurityGroupPropertiesFormat{ - // ProvisioningState: to.Ptr(armnetwork.ProvisioningStateSucceeded), - // ResourceGUID: to.Ptr("00000000-0000-0000-0000-000000000000"), - // }, - // }}, - // } - } -} diff --git a/sdk/resourcemanager/network/armnetwork/autorest.md b/sdk/resourcemanager/network/armnetwork/autorest.md index 107a62ecf7ee..e90e4fc821ed 100644 --- a/sdk/resourcemanager/network/armnetwork/autorest.md +++ b/sdk/resourcemanager/network/armnetwork/autorest.md @@ -5,9 +5,8 @@ ``` yaml azure-arm: true require: -- https://github.com/Azure/azure-rest-api-specs/blob/4883fa5dbf6f2c9093fac8ce334547e9dfac68fa/specification/network/resource-manager/readme.md -- https://github.com/Azure/azure-rest-api-specs/blob/4883fa5dbf6f2c9093fac8ce334547e9dfac68fa/specification/network/resource-manager/readme.go.md +- /mnt/vss/_work/1/s/azure-rest-api-specs/specification/network/resource-manager/readme.md +- /mnt/vss/_work/1/s/azure-rest-api-specs/specification/network/resource-manager/readme.go.md license-header: MICROSOFT_MIT_NO_VERSION -module-version: 6.1.0 -tag: package-2024-03 +module-version: 6.1.1 ``` diff --git a/sdk/resourcemanager/network/armnetwork/availabledelegations_client_example_test.go b/sdk/resourcemanager/network/armnetwork/availabledelegations_client_example_test.go deleted file mode 100644 index d8082cf11f0f..000000000000 --- a/sdk/resourcemanager/network/armnetwork/availabledelegations_client_example_test.go +++ /dev/null @@ -1,54 +0,0 @@ -//go:build go1.18 -// +build go1.18 - -// 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. -// DO NOT EDIT. - -package armnetwork_test - -import ( - "context" - "log" - - "github.com/Azure/azure-sdk-for-go/sdk/azidentity" - "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/network/armnetwork/v6" -) - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/4883fa5dbf6f2c9093fac8ce334547e9dfac68fa/specification/network/resource-manager/Microsoft.Network/stable/2024-03-01/examples/AvailableDelegationsSubscriptionGet.json -func ExampleAvailableDelegationsClient_NewListPager() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armnetwork.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := clientFactory.NewAvailableDelegationsClient().NewListPager("westcentralus", nil) - for pager.More() { - page, err := pager.NextPage(ctx) - if err != nil { - log.Fatalf("failed to advance page: %v", err) - } - for _, v := range page.Value { - // You could use page here. We use blank identifier for just demo purposes. - _ = v - } - // If the HTTP response code is 200 as defined in example definition, your page structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // page.AvailableDelegationsResult = armnetwork.AvailableDelegationsResult{ - // Value: []*armnetwork.AvailableDelegation{ - // { - // Name: to.Ptr("Microsoft.Provider.resourceType"), - // Type: to.Ptr("Microsoft.Network/availableDelegations"), - // Actions: []*string{ - // to.Ptr("Microsoft.Network/resource/action")}, - // ID: to.Ptr("/subscriptions/subId/providers/Microsoft.Network/availableDelegations/Microsoft.Provider.resourceType"), - // ServiceName: to.Ptr("Microsoft.Provider/resourceType"), - // }}, - // } - } -} diff --git a/sdk/resourcemanager/network/armnetwork/availableendpointservices_client_example_test.go b/sdk/resourcemanager/network/armnetwork/availableendpointservices_client_example_test.go deleted file mode 100644 index d50bb55a3f52..000000000000 --- a/sdk/resourcemanager/network/armnetwork/availableendpointservices_client_example_test.go +++ /dev/null @@ -1,61 +0,0 @@ -//go:build go1.18 -// +build go1.18 - -// 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. -// DO NOT EDIT. - -package armnetwork_test - -import ( - "context" - "log" - - "github.com/Azure/azure-sdk-for-go/sdk/azidentity" - "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/network/armnetwork/v6" -) - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/4883fa5dbf6f2c9093fac8ce334547e9dfac68fa/specification/network/resource-manager/Microsoft.Network/stable/2024-03-01/examples/EndpointServicesList.json -func ExampleAvailableEndpointServicesClient_NewListPager() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armnetwork.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := clientFactory.NewAvailableEndpointServicesClient().NewListPager("westus", nil) - for pager.More() { - page, err := pager.NextPage(ctx) - if err != nil { - log.Fatalf("failed to advance page: %v", err) - } - for _, v := range page.Value { - // You could use page here. We use blank identifier for just demo purposes. - _ = v - } - // If the HTTP response code is 200 as defined in example definition, your page structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // page.EndpointServicesListResult = armnetwork.EndpointServicesListResult{ - // Value: []*armnetwork.EndpointServiceResult{ - // { - // ID: to.Ptr("/subscriptions/subid/providers/Microsoft.Network/virtualNetworkEndpointServices/Microsoft.Storage"), - // Name: to.Ptr("Microsoft.Storage"), - // Type: to.Ptr("Microsoft.Network/virtualNetworkEndpointServices"), - // }, - // { - // ID: to.Ptr("/subscriptions/subid/providers/Microsoft.Network/virtualNetworkEndpointServices/Microsoft.Sql"), - // Name: to.Ptr("Microsoft.Sql"), - // Type: to.Ptr("Microsoft.Network/virtualNetworkEndpointServices"), - // }, - // { - // ID: to.Ptr("/subscriptions/subid/providers/Microsoft.Network/virtualNetworkEndpointServices/Microsoft.AzureActiveDirectory"), - // Name: to.Ptr("Microsoft.AzureActiveDirectory"), - // Type: to.Ptr("Microsoft.Network/virtualNetworkEndpointServices"), - // }}, - // } - } -} diff --git a/sdk/resourcemanager/network/armnetwork/availableprivateendpointtypes_client_example_test.go b/sdk/resourcemanager/network/armnetwork/availableprivateendpointtypes_client_example_test.go deleted file mode 100644 index c4f94811af06..000000000000 --- a/sdk/resourcemanager/network/armnetwork/availableprivateendpointtypes_client_example_test.go +++ /dev/null @@ -1,84 +0,0 @@ -//go:build go1.18 -// +build go1.18 - -// 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. -// DO NOT EDIT. - -package armnetwork_test - -import ( - "context" - "log" - - "github.com/Azure/azure-sdk-for-go/sdk/azidentity" - "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/network/armnetwork/v6" -) - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/4883fa5dbf6f2c9093fac8ce334547e9dfac68fa/specification/network/resource-manager/Microsoft.Network/stable/2024-03-01/examples/AvailablePrivateEndpointTypesGet.json -func ExampleAvailablePrivateEndpointTypesClient_NewListPager() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armnetwork.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := clientFactory.NewAvailablePrivateEndpointTypesClient().NewListPager("regionName", nil) - for pager.More() { - page, err := pager.NextPage(ctx) - if err != nil { - log.Fatalf("failed to advance page: %v", err) - } - for _, v := range page.Value { - // You could use page here. We use blank identifier for just demo purposes. - _ = v - } - // If the HTTP response code is 200 as defined in example definition, your page structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // page.AvailablePrivateEndpointTypesResult = armnetwork.AvailablePrivateEndpointTypesResult{ - // Value: []*armnetwork.AvailablePrivateEndpointType{ - // { - // Type: to.Ptr("Microsoft.Network/availablePrivateEndpointTypes"), - // ID: to.Ptr("/subscriptions/subId/providers/Microsoft.Network/availablePrivateEndpointTypes/Microsoft.Provider.resourceType"), - // ResourceName: to.Ptr("Microsoft.Provider/resourceType"), - // }}, - // } - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/4883fa5dbf6f2c9093fac8ce334547e9dfac68fa/specification/network/resource-manager/Microsoft.Network/stable/2024-03-01/examples/AvailablePrivateEndpointTypesResourceGroupGet.json -func ExampleAvailablePrivateEndpointTypesClient_NewListByResourceGroupPager() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armnetwork.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := clientFactory.NewAvailablePrivateEndpointTypesClient().NewListByResourceGroupPager("regionName", "rg1", nil) - for pager.More() { - page, err := pager.NextPage(ctx) - if err != nil { - log.Fatalf("failed to advance page: %v", err) - } - for _, v := range page.Value { - // You could use page here. We use blank identifier for just demo purposes. - _ = v - } - // If the HTTP response code is 200 as defined in example definition, your page structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // page.AvailablePrivateEndpointTypesResult = armnetwork.AvailablePrivateEndpointTypesResult{ - // Value: []*armnetwork.AvailablePrivateEndpointType{ - // { - // Type: to.Ptr("Microsoft.Network/availablePrivateEndpointTypes"), - // ID: to.Ptr("/subscriptions/subId/resourceGroups/rg1/providers/Microsoft.Network/availablePrivateEndpointTypes/Microsoft.Provider.resourceType"), - // ResourceName: to.Ptr("Microsoft.Provider/resourceType"), - // }}, - // } - } -} diff --git a/sdk/resourcemanager/network/armnetwork/availableresourcegroupdelegations_client_example_test.go b/sdk/resourcemanager/network/armnetwork/availableresourcegroupdelegations_client_example_test.go deleted file mode 100644 index 9cc369c7e3d7..000000000000 --- a/sdk/resourcemanager/network/armnetwork/availableresourcegroupdelegations_client_example_test.go +++ /dev/null @@ -1,54 +0,0 @@ -//go:build go1.18 -// +build go1.18 - -// 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. -// DO NOT EDIT. - -package armnetwork_test - -import ( - "context" - "log" - - "github.com/Azure/azure-sdk-for-go/sdk/azidentity" - "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/network/armnetwork/v6" -) - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/4883fa5dbf6f2c9093fac8ce334547e9dfac68fa/specification/network/resource-manager/Microsoft.Network/stable/2024-03-01/examples/AvailableDelegationsResourceGroupGet.json -func ExampleAvailableResourceGroupDelegationsClient_NewListPager() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armnetwork.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := clientFactory.NewAvailableResourceGroupDelegationsClient().NewListPager("westcentralus", "rg1", nil) - for pager.More() { - page, err := pager.NextPage(ctx) - if err != nil { - log.Fatalf("failed to advance page: %v", err) - } - for _, v := range page.Value { - // You could use page here. We use blank identifier for just demo purposes. - _ = v - } - // If the HTTP response code is 200 as defined in example definition, your page structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // page.AvailableDelegationsResult = armnetwork.AvailableDelegationsResult{ - // Value: []*armnetwork.AvailableDelegation{ - // { - // Name: to.Ptr("Microsoft.Provider.resourceType"), - // Type: to.Ptr("Microsoft.Network/availableDelegations"), - // Actions: []*string{ - // to.Ptr("Microsoft.Network/resource/action")}, - // ID: to.Ptr("/subscriptions/subId/resourceGroups/rg1/providers/Microsoft.Network/availableDelegations/Microsoft.Provider.resourceType"), - // ServiceName: to.Ptr("Microsoft.Provider/resourceType"), - // }}, - // } - } -} diff --git a/sdk/resourcemanager/network/armnetwork/availableservicealiases_client_example_test.go b/sdk/resourcemanager/network/armnetwork/availableservicealiases_client_example_test.go deleted file mode 100644 index 77dc9b535b54..000000000000 --- a/sdk/resourcemanager/network/armnetwork/availableservicealiases_client_example_test.go +++ /dev/null @@ -1,98 +0,0 @@ -//go:build go1.18 -// +build go1.18 - -// 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. -// DO NOT EDIT. - -package armnetwork_test - -import ( - "context" - "log" - - "github.com/Azure/azure-sdk-for-go/sdk/azidentity" - "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/network/armnetwork/v6" -) - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/4883fa5dbf6f2c9093fac8ce334547e9dfac68fa/specification/network/resource-manager/Microsoft.Network/stable/2024-03-01/examples/AvailableServiceAliasesList.json -func ExampleAvailableServiceAliasesClient_NewListPager() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armnetwork.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := clientFactory.NewAvailableServiceAliasesClient().NewListPager("westcentralus", nil) - for pager.More() { - page, err := pager.NextPage(ctx) - if err != nil { - log.Fatalf("failed to advance page: %v", err) - } - for _, v := range page.Value { - // You could use page here. We use blank identifier for just demo purposes. - _ = v - } - // If the HTTP response code is 200 as defined in example definition, your page structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // page.AvailableServiceAliasesResult = armnetwork.AvailableServiceAliasesResult{ - // Value: []*armnetwork.AvailableServiceAlias{ - // { - // Name: to.Ptr("servicesAzure"), - // Type: to.Ptr("Microsoft.Network/AvailableServiceAliases"), - // ID: to.Ptr("/subscriptions/subId/providers/Microsoft.Network/AvailableServiceAliases/servicesAzure"), - // ResourceName: to.Ptr("/services/Azure"), - // }, - // { - // Name: to.Ptr("servicesAzureManagedInstance"), - // Type: to.Ptr("Microsoft.Network/AvailableServiceAliases"), - // ID: to.Ptr("/subscriptions/subId/providers/Microsoft.Network/AvailableServiceAliases/servicesAzureManagedInstance"), - // ResourceName: to.Ptr("/services/Azure/ManagedInstance"), - // }}, - // } - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/4883fa5dbf6f2c9093fac8ce334547e9dfac68fa/specification/network/resource-manager/Microsoft.Network/stable/2024-03-01/examples/AvailableServiceAliasesListByResourceGroup.json -func ExampleAvailableServiceAliasesClient_NewListByResourceGroupPager() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armnetwork.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := clientFactory.NewAvailableServiceAliasesClient().NewListByResourceGroupPager("rg1", "westcentralus", nil) - for pager.More() { - page, err := pager.NextPage(ctx) - if err != nil { - log.Fatalf("failed to advance page: %v", err) - } - for _, v := range page.Value { - // You could use page here. We use blank identifier for just demo purposes. - _ = v - } - // If the HTTP response code is 200 as defined in example definition, your page structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // page.AvailableServiceAliasesResult = armnetwork.AvailableServiceAliasesResult{ - // Value: []*armnetwork.AvailableServiceAlias{ - // { - // Name: to.Ptr("servicesAzure"), - // Type: to.Ptr("Microsoft.Network/AvailableServiceAliases"), - // ID: to.Ptr("/subscriptions/subId/providers/Microsoft.Network/AvailableServiceAliases/servicesAzure"), - // ResourceName: to.Ptr("/services/Azure"), - // }, - // { - // Name: to.Ptr("servicesAzureManagedInstance"), - // Type: to.Ptr("Microsoft.Network/AvailableServiceAliases"), - // ID: to.Ptr("/subscriptions/subId/providers/Microsoft.Network/AvailableServiceAliases/servicesAzureManagedInstance"), - // ResourceName: to.Ptr("/services/Azure/ManagedInstance"), - // }}, - // } - } -} diff --git a/sdk/resourcemanager/network/armnetwork/azurefirewallfqdntags_client_example_test.go b/sdk/resourcemanager/network/armnetwork/azurefirewallfqdntags_client_example_test.go deleted file mode 100644 index 9776f28e520e..000000000000 --- a/sdk/resourcemanager/network/armnetwork/azurefirewallfqdntags_client_example_test.go +++ /dev/null @@ -1,60 +0,0 @@ -//go:build go1.18 -// +build go1.18 - -// 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. -// DO NOT EDIT. - -package armnetwork_test - -import ( - "context" - "log" - - "github.com/Azure/azure-sdk-for-go/sdk/azidentity" - "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/network/armnetwork/v6" -) - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/4883fa5dbf6f2c9093fac8ce334547e9dfac68fa/specification/network/resource-manager/Microsoft.Network/stable/2024-03-01/examples/AzureFirewallFqdnTagsListBySubscription.json -func ExampleAzureFirewallFqdnTagsClient_NewListAllPager() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armnetwork.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := clientFactory.NewAzureFirewallFqdnTagsClient().NewListAllPager(nil) - for pager.More() { - page, err := pager.NextPage(ctx) - if err != nil { - log.Fatalf("failed to advance page: %v", err) - } - for _, v := range page.Value { - // You could use page here. We use blank identifier for just demo purposes. - _ = v - } - // If the HTTP response code is 200 as defined in example definition, your page structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // page.AzureFirewallFqdnTagListResult = armnetwork.AzureFirewallFqdnTagListResult{ - // Value: []*armnetwork.AzureFirewallFqdnTag{ - // { - // Name: to.Ptr("azfwfqdntag"), - // Type: to.Ptr("Microsoft.Network/azureFirewallFqdnTags"), - // ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/azureFirewallFqdnTags/azfwfqdntag"), - // Location: to.Ptr("West US"), - // Tags: map[string]*string{ - // "key1": to.Ptr("value1"), - // }, - // Etag: to.Ptr("w/\\00000000-0000-0000-0000-000000000000\\"), - // Properties: &armnetwork.AzureFirewallFqdnTagPropertiesFormat{ - // FqdnTagName: to.Ptr("azfwfqdntag"), - // ProvisioningState: to.Ptr(armnetwork.ProvisioningStateSucceeded), - // }, - // }}, - // } - } -} diff --git a/sdk/resourcemanager/network/armnetwork/azurefirewalls_client_example_test.go b/sdk/resourcemanager/network/armnetwork/azurefirewalls_client_example_test.go deleted file mode 100644 index 37113f9c31e2..000000000000 --- a/sdk/resourcemanager/network/armnetwork/azurefirewalls_client_example_test.go +++ /dev/null @@ -1,2987 +0,0 @@ -//go:build go1.18 -// +build go1.18 - -// 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. -// DO NOT EDIT. - -package armnetwork_test - -import ( - "context" - "log" - - "github.com/Azure/azure-sdk-for-go/sdk/azcore/to" - "github.com/Azure/azure-sdk-for-go/sdk/azidentity" - "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/network/armnetwork/v6" -) - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/4883fa5dbf6f2c9093fac8ce334547e9dfac68fa/specification/network/resource-manager/Microsoft.Network/stable/2024-03-01/examples/AzureFirewallDelete.json -func ExampleAzureFirewallsClient_BeginDelete() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armnetwork.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewAzureFirewallsClient().BeginDelete(ctx, "rg1", "azurefirewall", nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - _, err = poller.PollUntilDone(ctx, nil) - if err != nil { - log.Fatalf("failed to pull the result: %v", err) - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/4883fa5dbf6f2c9093fac8ce334547e9dfac68fa/specification/network/resource-manager/Microsoft.Network/stable/2024-03-01/examples/AzureFirewallGet.json -func ExampleAzureFirewallsClient_Get_getAzureFirewall() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armnetwork.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewAzureFirewallsClient().Get(ctx, "rg1", "azurefirewall", nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.AzureFirewall = armnetwork.AzureFirewall{ - // Name: to.Ptr("azurefirewall"), - // Type: to.Ptr("Microsoft.Network/azureFirewalls"), - // ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/azureFirewalls/azurefirewall"), - // Location: to.Ptr("West US"), - // Tags: map[string]*string{ - // "key1": to.Ptr("value1"), - // }, - // Etag: to.Ptr("w/\\00000000-0000-0000-0000-000000000000\\"), - // Properties: &armnetwork.AzureFirewallPropertiesFormat{ - // AdditionalProperties: map[string]*string{ - // }, - // ApplicationRuleCollections: []*armnetwork.AzureFirewallApplicationRuleCollection{ - // { - // ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/azureFirewalls/azurefirewall/applicationRuleCollections/apprulecoll"), - // Name: to.Ptr("apprulecoll"), - // Properties: &armnetwork.AzureFirewallApplicationRuleCollectionPropertiesFormat{ - // Action: &armnetwork.AzureFirewallRCAction{ - // Type: to.Ptr(armnetwork.AzureFirewallRCActionTypeDeny), - // }, - // Priority: to.Ptr[int32](110), - // Rules: []*armnetwork.AzureFirewallApplicationRule{ - // { - // Name: to.Ptr("rule1"), - // Description: to.Ptr("Deny inbound rule"), - // Protocols: []*armnetwork.AzureFirewallApplicationRuleProtocol{ - // { - // Port: to.Ptr[int32](443), - // ProtocolType: to.Ptr(armnetwork.AzureFirewallApplicationRuleProtocolTypeHTTPS), - // }}, - // SourceAddresses: []*string{ - // to.Ptr("216.58.216.164"), - // to.Ptr("10.0.0.0/24")}, - // TargetFqdns: []*string{ - // to.Ptr("www.test.com")}, - // }}, - // }, - // }}, - // AutoscaleConfiguration: &armnetwork.AzureFirewallAutoscaleConfiguration{ - // MaxCapacity: to.Ptr[int32](15), - // MinCapacity: to.Ptr[int32](10), - // }, - // IPConfigurations: []*armnetwork.AzureFirewallIPConfiguration{ - // { - // ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/azureFirewalls/azurefirewall/ipConfigurations/azureFirewallIpConfiguration"), - // Name: to.Ptr("azureFirewallIpConfiguration"), - // Etag: to.Ptr("w/\\00000000-0000-0000-0000-000000000000\\"), - // Properties: &armnetwork.AzureFirewallIPConfigurationPropertiesFormat{ - // PrivateIPAddress: to.Ptr("10.0.0.0"), - // ProvisioningState: to.Ptr(armnetwork.ProvisioningStateSucceeded), - // PublicIPAddress: &armnetwork.SubResource{ - // ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/publicIPAddresses/pipName"), - // }, - // Subnet: &armnetwork.SubResource{ - // ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/virtualNetworks/vnet2/subnets/AzureFirewallSubnet"), - // }, - // }, - // }}, - // IPGroups: []*armnetwork.AzureFirewallIPGroups{ - // }, - // NatRuleCollections: []*armnetwork.AzureFirewallNatRuleCollection{ - // { - // ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/azureFirewalls/azurefirewall/natRuleCollections/natrulecoll"), - // Name: to.Ptr("natrulecoll"), - // Properties: &armnetwork.AzureFirewallNatRuleCollectionProperties{ - // Action: &armnetwork.AzureFirewallNatRCAction{ - // Type: to.Ptr(armnetwork.AzureFirewallNatRCActionTypeDnat), - // }, - // Priority: to.Ptr[int32](112), - // Rules: []*armnetwork.AzureFirewallNatRule{ - // { - // Name: to.Ptr("DNAT-HTTPS-traffic"), - // Description: to.Ptr("D-NAT all outbound web traffic for inspection"), - // DestinationAddresses: []*string{ - // to.Ptr("1.2.3.4")}, - // DestinationPorts: []*string{ - // to.Ptr("443")}, - // Protocols: []*armnetwork.AzureFirewallNetworkRuleProtocol{ - // to.Ptr(armnetwork.AzureFirewallNetworkRuleProtocolTCP)}, - // SourceAddresses: []*string{ - // to.Ptr("*")}, - // TranslatedAddress: to.Ptr("1.2.3.5"), - // TranslatedPort: to.Ptr("8443"), - // }, - // { - // Name: to.Ptr("DNAT-HTTP-traffic-With-FQDN"), - // Description: to.Ptr("D-NAT all inbound web traffic for inspection"), - // DestinationAddresses: []*string{ - // to.Ptr("1.2.3.4")}, - // DestinationPorts: []*string{ - // to.Ptr("80")}, - // Protocols: []*armnetwork.AzureFirewallNetworkRuleProtocol{ - // to.Ptr(armnetwork.AzureFirewallNetworkRuleProtocolTCP)}, - // SourceAddresses: []*string{ - // to.Ptr("*")}, - // TranslatedFqdn: to.Ptr("internalhttpserver"), - // TranslatedPort: to.Ptr("880"), - // }}, - // }, - // }}, - // NetworkRuleCollections: []*armnetwork.AzureFirewallNetworkRuleCollection{ - // { - // ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/azureFirewalls/azurefirewall/networkRuleCollections/netrulecoll"), - // Name: to.Ptr("netrulecoll"), - // Properties: &armnetwork.AzureFirewallNetworkRuleCollectionPropertiesFormat{ - // Action: &armnetwork.AzureFirewallRCAction{ - // Type: to.Ptr(armnetwork.AzureFirewallRCActionTypeDeny), - // }, - // Priority: to.Ptr[int32](112), - // Rules: []*armnetwork.AzureFirewallNetworkRule{ - // { - // Name: to.Ptr("L4-traffic"), - // Description: to.Ptr("Block traffic based on source IPs and ports"), - // DestinationAddresses: []*string{ - // to.Ptr("*")}, - // DestinationPorts: []*string{ - // to.Ptr("443-444"), - // to.Ptr("8443")}, - // Protocols: []*armnetwork.AzureFirewallNetworkRuleProtocol{ - // to.Ptr(armnetwork.AzureFirewallNetworkRuleProtocolTCP)}, - // SourceAddresses: []*string{ - // to.Ptr("192.168.1.1-192.168.1.12"), - // to.Ptr("10.1.4.12-10.1.4.255")}, - // }, - // { - // Name: to.Ptr("L4-traffic-with-FQDN"), - // Description: to.Ptr("Block traffic based on source IPs and ports to amazon"), - // DestinationFqdns: []*string{ - // to.Ptr("www.amazon.com")}, - // DestinationPorts: []*string{ - // to.Ptr("443-444"), - // to.Ptr("8443")}, - // Protocols: []*armnetwork.AzureFirewallNetworkRuleProtocol{ - // to.Ptr(armnetwork.AzureFirewallNetworkRuleProtocolTCP)}, - // SourceAddresses: []*string{ - // to.Ptr("10.2.4.12-10.2.4.255")}, - // }}, - // }, - // }}, - // ProvisioningState: to.Ptr(armnetwork.ProvisioningStateSucceeded), - // SKU: &armnetwork.AzureFirewallSKU{ - // Name: to.Ptr(armnetwork.AzureFirewallSKUNameAZFWVnet), - // Tier: to.Ptr(armnetwork.AzureFirewallSKUTierStandard), - // }, - // ThreatIntelMode: to.Ptr(armnetwork.AzureFirewallThreatIntelModeAlert), - // }, - // Zones: []*string{ - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/4883fa5dbf6f2c9093fac8ce334547e9dfac68fa/specification/network/resource-manager/Microsoft.Network/stable/2024-03-01/examples/AzureFirewallGetWithAdditionalProperties.json -func ExampleAzureFirewallsClient_Get_getAzureFirewallWithAdditionalProperties() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armnetwork.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewAzureFirewallsClient().Get(ctx, "rg1", "azurefirewall", nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.AzureFirewall = armnetwork.AzureFirewall{ - // Name: to.Ptr("azurefirewall"), - // Type: to.Ptr("Microsoft.Network/azureFirewalls"), - // ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/azureFirewalls/azurefirewall"), - // Location: to.Ptr("West US"), - // Tags: map[string]*string{ - // "key1": to.Ptr("value1"), - // }, - // Etag: to.Ptr("w/\\00000000-0000-0000-0000-000000000000\\"), - // Properties: &armnetwork.AzureFirewallPropertiesFormat{ - // AdditionalProperties: map[string]*string{ - // "key1": to.Ptr("value1"), - // "key2": to.Ptr("value2"), - // }, - // ApplicationRuleCollections: []*armnetwork.AzureFirewallApplicationRuleCollection{ - // { - // ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/azureFirewalls/azurefirewall/applicationRuleCollections/apprulecoll"), - // Name: to.Ptr("apprulecoll"), - // Properties: &armnetwork.AzureFirewallApplicationRuleCollectionPropertiesFormat{ - // Action: &armnetwork.AzureFirewallRCAction{ - // Type: to.Ptr(armnetwork.AzureFirewallRCActionTypeDeny), - // }, - // Priority: to.Ptr[int32](110), - // Rules: []*armnetwork.AzureFirewallApplicationRule{ - // { - // Name: to.Ptr("rule1"), - // Description: to.Ptr("Deny inbound rule"), - // Protocols: []*armnetwork.AzureFirewallApplicationRuleProtocol{ - // { - // Port: to.Ptr[int32](443), - // ProtocolType: to.Ptr(armnetwork.AzureFirewallApplicationRuleProtocolTypeHTTPS), - // }}, - // SourceAddresses: []*string{ - // to.Ptr("216.58.216.164"), - // to.Ptr("10.0.0.0/24")}, - // TargetFqdns: []*string{ - // to.Ptr("www.test.com")}, - // }}, - // }, - // }}, - // IPConfigurations: []*armnetwork.AzureFirewallIPConfiguration{ - // { - // ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/azureFirewalls/azurefirewall/ipConfigurations/azureFirewallIpConfiguration"), - // Name: to.Ptr("azureFirewallIpConfiguration"), - // Etag: to.Ptr("w/\\00000000-0000-0000-0000-000000000000\\"), - // Properties: &armnetwork.AzureFirewallIPConfigurationPropertiesFormat{ - // PrivateIPAddress: to.Ptr("10.0.0.0"), - // ProvisioningState: to.Ptr(armnetwork.ProvisioningStateSucceeded), - // PublicIPAddress: &armnetwork.SubResource{ - // ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/publicIPAddresses/pipName"), - // }, - // Subnet: &armnetwork.SubResource{ - // ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/virtualNetworks/vnet2/subnets/AzureFirewallSubnet"), - // }, - // }, - // }}, - // NatRuleCollections: []*armnetwork.AzureFirewallNatRuleCollection{ - // { - // ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/azureFirewalls/azurefirewall/natRuleCollections/natrulecoll"), - // Name: to.Ptr("natrulecoll"), - // Properties: &armnetwork.AzureFirewallNatRuleCollectionProperties{ - // Action: &armnetwork.AzureFirewallNatRCAction{ - // Type: to.Ptr(armnetwork.AzureFirewallNatRCActionTypeDnat), - // }, - // Priority: to.Ptr[int32](112), - // Rules: []*armnetwork.AzureFirewallNatRule{ - // { - // Name: to.Ptr("DNAT-HTTPS-traffic"), - // Description: to.Ptr("D-NAT all outbound web traffic for inspection"), - // DestinationAddresses: []*string{ - // to.Ptr("1.2.3.4")}, - // DestinationPorts: []*string{ - // to.Ptr("443")}, - // Protocols: []*armnetwork.AzureFirewallNetworkRuleProtocol{ - // to.Ptr(armnetwork.AzureFirewallNetworkRuleProtocolTCP)}, - // SourceAddresses: []*string{ - // to.Ptr("*")}, - // TranslatedAddress: to.Ptr("1.2.3.5"), - // TranslatedPort: to.Ptr("8443"), - // }, - // { - // Name: to.Ptr("DNAT-HTTP-traffic-With-FQDN"), - // Description: to.Ptr("D-NAT all inbound web traffic for inspection"), - // DestinationAddresses: []*string{ - // to.Ptr("1.2.3.4")}, - // DestinationPorts: []*string{ - // to.Ptr("80")}, - // Protocols: []*armnetwork.AzureFirewallNetworkRuleProtocol{ - // to.Ptr(armnetwork.AzureFirewallNetworkRuleProtocolTCP)}, - // SourceAddresses: []*string{ - // to.Ptr("*")}, - // TranslatedFqdn: to.Ptr("internalhttpserver"), - // TranslatedPort: to.Ptr("880"), - // }}, - // }, - // }}, - // NetworkRuleCollections: []*armnetwork.AzureFirewallNetworkRuleCollection{ - // { - // ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/azureFirewalls/azurefirewall/networkRuleCollections/netrulecoll"), - // Name: to.Ptr("netrulecoll"), - // Properties: &armnetwork.AzureFirewallNetworkRuleCollectionPropertiesFormat{ - // Action: &armnetwork.AzureFirewallRCAction{ - // Type: to.Ptr(armnetwork.AzureFirewallRCActionTypeDeny), - // }, - // Priority: to.Ptr[int32](112), - // Rules: []*armnetwork.AzureFirewallNetworkRule{ - // { - // Name: to.Ptr("L4-traffic"), - // Description: to.Ptr("Block traffic based on source IPs and ports"), - // DestinationAddresses: []*string{ - // to.Ptr("*")}, - // DestinationPorts: []*string{ - // to.Ptr("443-444"), - // to.Ptr("8443")}, - // Protocols: []*armnetwork.AzureFirewallNetworkRuleProtocol{ - // to.Ptr(armnetwork.AzureFirewallNetworkRuleProtocolTCP)}, - // SourceAddresses: []*string{ - // to.Ptr("192.168.1.1-192.168.1.12"), - // to.Ptr("10.1.4.12-10.1.4.255")}, - // }, - // { - // Name: to.Ptr("L4-traffic-with-FQDN"), - // Description: to.Ptr("Block traffic based on source IPs and ports to amazon"), - // DestinationFqdns: []*string{ - // to.Ptr("www.amazon.com")}, - // DestinationPorts: []*string{ - // to.Ptr("443-444"), - // to.Ptr("8443")}, - // Protocols: []*armnetwork.AzureFirewallNetworkRuleProtocol{ - // to.Ptr(armnetwork.AzureFirewallNetworkRuleProtocolTCP)}, - // SourceAddresses: []*string{ - // to.Ptr("10.2.4.12-10.2.4.255")}, - // }}, - // }, - // }}, - // ProvisioningState: to.Ptr(armnetwork.ProvisioningStateSucceeded), - // SKU: &armnetwork.AzureFirewallSKU{ - // Name: to.Ptr(armnetwork.AzureFirewallSKUNameAZFWVnet), - // Tier: to.Ptr(armnetwork.AzureFirewallSKUTierStandard), - // }, - // ThreatIntelMode: to.Ptr(armnetwork.AzureFirewallThreatIntelModeAlert), - // }, - // Zones: []*string{ - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/4883fa5dbf6f2c9093fac8ce334547e9dfac68fa/specification/network/resource-manager/Microsoft.Network/stable/2024-03-01/examples/AzureFirewallGetWithIpGroups.json -func ExampleAzureFirewallsClient_Get_getAzureFirewallWithIpGroups() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armnetwork.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewAzureFirewallsClient().Get(ctx, "rg1", "azurefirewall", nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.AzureFirewall = armnetwork.AzureFirewall{ - // Name: to.Ptr("azurefirewall"), - // Type: to.Ptr("Microsoft.Network/azureFirewalls"), - // ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/azureFirewalls/azurefirewall"), - // Location: to.Ptr("West US"), - // Tags: map[string]*string{ - // "key1": to.Ptr("value1"), - // }, - // Etag: to.Ptr("w/\\00000000-0000-0000-0000-000000000000\\"), - // Properties: &armnetwork.AzureFirewallPropertiesFormat{ - // AdditionalProperties: map[string]*string{ - // }, - // ApplicationRuleCollections: []*armnetwork.AzureFirewallApplicationRuleCollection{ - // { - // ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/azureFirewalls/azurefirewall/applicationRuleCollections/apprulecoll"), - // Name: to.Ptr("apprulecoll"), - // Properties: &armnetwork.AzureFirewallApplicationRuleCollectionPropertiesFormat{ - // Action: &armnetwork.AzureFirewallRCAction{ - // Type: to.Ptr(armnetwork.AzureFirewallRCActionTypeDeny), - // }, - // Priority: to.Ptr[int32](110), - // Rules: []*armnetwork.AzureFirewallApplicationRule{ - // { - // Name: to.Ptr("rule1"), - // Description: to.Ptr("Deny inbound rule"), - // Protocols: []*armnetwork.AzureFirewallApplicationRuleProtocol{ - // { - // Port: to.Ptr[int32](443), - // ProtocolType: to.Ptr(armnetwork.AzureFirewallApplicationRuleProtocolTypeHTTPS), - // }}, - // SourceIPGroups: []*string{ - // to.Ptr("/subscriptions/subId/providers/Microsoft.Network/resourceGroup/myResourceGroup/ipGroups/ipGroups1")}, - // TargetFqdns: []*string{ - // to.Ptr("www.test.com")}, - // }}, - // }, - // }}, - // IPConfigurations: []*armnetwork.AzureFirewallIPConfiguration{ - // { - // ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/azureFirewalls/azurefirewall/ipConfigurations/azureFirewallIpConfiguration"), - // Name: to.Ptr("azureFirewallIpConfiguration"), - // Etag: to.Ptr("w/\\00000000-0000-0000-0000-000000000000\\"), - // Properties: &armnetwork.AzureFirewallIPConfigurationPropertiesFormat{ - // PrivateIPAddress: to.Ptr("10.0.0.0"), - // ProvisioningState: to.Ptr(armnetwork.ProvisioningStateSucceeded), - // PublicIPAddress: &armnetwork.SubResource{ - // ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/publicIPAddresses/pipName"), - // }, - // Subnet: &armnetwork.SubResource{ - // ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/virtualNetworks/vnet2/subnets/AzureFirewallSubnet"), - // }, - // }, - // }}, - // IPGroups: []*armnetwork.AzureFirewallIPGroups{ - // { - // ChangeNumber: to.Ptr("5"), - // ID: to.Ptr("/subscriptions/subId/providers/Microsoft.Network/resourceGroup/myResourceGroup/ipGroups/ipGroups1"), - // }, - // { - // ChangeNumber: to.Ptr("4"), - // ID: to.Ptr("/subscriptions/subId/providers/Microsoft.Network/resourceGroup/myResourceGroup/ipGroups/ipGroups2"), - // }, - // { - // ChangeNumber: to.Ptr("1"), - // ID: to.Ptr("/subscriptions/subId/providers/Microsoft.Network/resourceGroup/myResourceGroup/ipGroups/ipGroups3"), - // }}, - // NatRuleCollections: []*armnetwork.AzureFirewallNatRuleCollection{ - // { - // ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/azureFirewalls/azurefirewall/natRuleCollections/natrulecoll"), - // Name: to.Ptr("natrulecoll"), - // Properties: &armnetwork.AzureFirewallNatRuleCollectionProperties{ - // Action: &armnetwork.AzureFirewallNatRCAction{ - // Type: to.Ptr(armnetwork.AzureFirewallNatRCActionTypeDnat), - // }, - // Priority: to.Ptr[int32](112), - // Rules: []*armnetwork.AzureFirewallNatRule{ - // { - // Name: to.Ptr("DNAT-HTTPS-traffic"), - // Description: to.Ptr("D-NAT all outbound web traffic for inspection"), - // DestinationAddresses: []*string{ - // to.Ptr("1.2.3.4")}, - // DestinationPorts: []*string{ - // to.Ptr("443")}, - // Protocols: []*armnetwork.AzureFirewallNetworkRuleProtocol{ - // to.Ptr(armnetwork.AzureFirewallNetworkRuleProtocolTCP)}, - // SourceAddresses: []*string{ - // to.Ptr("*")}, - // TranslatedAddress: to.Ptr("1.2.3.5"), - // TranslatedPort: to.Ptr("8443"), - // }, - // { - // Name: to.Ptr("DNAT-HTTP-traffic-With-FQDN"), - // Description: to.Ptr("D-NAT all inbound web traffic for inspection"), - // DestinationAddresses: []*string{ - // to.Ptr("1.2.3.4")}, - // DestinationPorts: []*string{ - // to.Ptr("80")}, - // Protocols: []*armnetwork.AzureFirewallNetworkRuleProtocol{ - // to.Ptr(armnetwork.AzureFirewallNetworkRuleProtocolTCP)}, - // SourceIPGroups: []*string{ - // to.Ptr("/subscriptions/subId/providers/Microsoft.Network/resourceGroup/myResourceGroup/ipGroups/ipGroups1")}, - // TranslatedFqdn: to.Ptr("internalhttpserver"), - // TranslatedPort: to.Ptr("880"), - // }}, - // }, - // }}, - // NetworkRuleCollections: []*armnetwork.AzureFirewallNetworkRuleCollection{ - // { - // ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/azureFirewalls/azurefirewall/networkRuleCollections/netrulecoll"), - // Name: to.Ptr("netrulecoll"), - // Properties: &armnetwork.AzureFirewallNetworkRuleCollectionPropertiesFormat{ - // Action: &armnetwork.AzureFirewallRCAction{ - // Type: to.Ptr(armnetwork.AzureFirewallRCActionTypeDeny), - // }, - // Priority: to.Ptr[int32](112), - // Rules: []*armnetwork.AzureFirewallNetworkRule{ - // { - // Name: to.Ptr("L4-traffic"), - // Description: to.Ptr("Block traffic based on source IPs and ports"), - // DestinationIPGroups: []*string{ - // to.Ptr("/subscriptions/subId/providers/Microsoft.Network/resourceGroup/myResourceGroup/ipGroups/ipGroups2")}, - // DestinationPorts: []*string{ - // to.Ptr("443-444"), - // to.Ptr("8443")}, - // Protocols: []*armnetwork.AzureFirewallNetworkRuleProtocol{ - // to.Ptr(armnetwork.AzureFirewallNetworkRuleProtocolTCP)}, - // SourceAddresses: []*string{ - // to.Ptr("192.168.1.1-192.168.1.12"), - // to.Ptr("10.1.4.12-10.1.4.255")}, - // }, - // { - // Name: to.Ptr("L4-traffic-with-FQDN"), - // Description: to.Ptr("Block traffic based on source IPs and ports to amazon"), - // DestinationFqdns: []*string{ - // to.Ptr("www.amazon.com")}, - // DestinationPorts: []*string{ - // to.Ptr("443-444"), - // to.Ptr("8443")}, - // Protocols: []*armnetwork.AzureFirewallNetworkRuleProtocol{ - // to.Ptr(armnetwork.AzureFirewallNetworkRuleProtocolTCP)}, - // SourceIPGroups: []*string{ - // to.Ptr("/subscriptions/subId/providers/Microsoft.Network/resourceGroup/myResourceGroup/ipGroups/ipGroups3")}, - // }}, - // }, - // }}, - // ProvisioningState: to.Ptr(armnetwork.ProvisioningStateSucceeded), - // SKU: &armnetwork.AzureFirewallSKU{ - // Name: to.Ptr(armnetwork.AzureFirewallSKUNameAZFWVnet), - // Tier: to.Ptr(armnetwork.AzureFirewallSKUTierStandard), - // }, - // ThreatIntelMode: to.Ptr(armnetwork.AzureFirewallThreatIntelModeAlert), - // }, - // Zones: []*string{ - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/4883fa5dbf6f2c9093fac8ce334547e9dfac68fa/specification/network/resource-manager/Microsoft.Network/stable/2024-03-01/examples/AzureFirewallGetWithZones.json -func ExampleAzureFirewallsClient_Get_getAzureFirewallWithZones() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armnetwork.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewAzureFirewallsClient().Get(ctx, "rg1", "azurefirewall", nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.AzureFirewall = armnetwork.AzureFirewall{ - // Name: to.Ptr("azurefirewall"), - // Type: to.Ptr("Microsoft.Network/azureFirewalls"), - // ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/azureFirewalls/azurefirewall"), - // Location: to.Ptr("West US 2"), - // Tags: map[string]*string{ - // "key1": to.Ptr("value1"), - // }, - // Etag: to.Ptr("w/\\00000000-0000-0000-0000-000000000000\\"), - // Properties: &armnetwork.AzureFirewallPropertiesFormat{ - // AdditionalProperties: map[string]*string{ - // }, - // ApplicationRuleCollections: []*armnetwork.AzureFirewallApplicationRuleCollection{ - // { - // ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/azureFirewalls/azurefirewall/applicationRuleCollections/apprulecoll"), - // Name: to.Ptr("apprulecoll"), - // Properties: &armnetwork.AzureFirewallApplicationRuleCollectionPropertiesFormat{ - // Action: &armnetwork.AzureFirewallRCAction{ - // Type: to.Ptr(armnetwork.AzureFirewallRCActionTypeDeny), - // }, - // Priority: to.Ptr[int32](110), - // Rules: []*armnetwork.AzureFirewallApplicationRule{ - // { - // Name: to.Ptr("rule1"), - // Description: to.Ptr("Deny inbound rule"), - // Protocols: []*armnetwork.AzureFirewallApplicationRuleProtocol{ - // { - // Port: to.Ptr[int32](443), - // ProtocolType: to.Ptr(armnetwork.AzureFirewallApplicationRuleProtocolTypeHTTPS), - // }}, - // SourceAddresses: []*string{ - // to.Ptr("216.58.216.164"), - // to.Ptr("10.0.0.0/24")}, - // TargetFqdns: []*string{ - // to.Ptr("www.test.com")}, - // }}, - // }, - // }}, - // IPConfigurations: []*armnetwork.AzureFirewallIPConfiguration{ - // { - // ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/azureFirewalls/azurefirewall/ipConfigurations/azureFirewallIpConfiguration"), - // Name: to.Ptr("azureFirewallIpConfiguration"), - // Etag: to.Ptr("w/\\00000000-0000-0000-0000-000000000000\\"), - // Properties: &armnetwork.AzureFirewallIPConfigurationPropertiesFormat{ - // PrivateIPAddress: to.Ptr("10.0.0.0"), - // ProvisioningState: to.Ptr(armnetwork.ProvisioningStateSucceeded), - // PublicIPAddress: &armnetwork.SubResource{ - // ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/publicIPAddresses/pipName"), - // }, - // Subnet: &armnetwork.SubResource{ - // ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/virtualNetworks/vnet2/subnets/AzureFirewallSubnet"), - // }, - // }, - // }}, - // IPGroups: []*armnetwork.AzureFirewallIPGroups{ - // }, - // NatRuleCollections: []*armnetwork.AzureFirewallNatRuleCollection{ - // { - // ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/azureFirewalls/azurefirewall/natRuleCollections/natrulecoll"), - // Name: to.Ptr("natrulecoll"), - // Properties: &armnetwork.AzureFirewallNatRuleCollectionProperties{ - // Action: &armnetwork.AzureFirewallNatRCAction{ - // Type: to.Ptr(armnetwork.AzureFirewallNatRCActionTypeDnat), - // }, - // Priority: to.Ptr[int32](112), - // Rules: []*armnetwork.AzureFirewallNatRule{ - // { - // Name: to.Ptr("DNAT-HTTPS-traffic"), - // Description: to.Ptr("D-NAT all outbound web traffic for inspection"), - // DestinationAddresses: []*string{ - // to.Ptr("1.2.3.4")}, - // DestinationPorts: []*string{ - // to.Ptr("443")}, - // Protocols: []*armnetwork.AzureFirewallNetworkRuleProtocol{ - // to.Ptr(armnetwork.AzureFirewallNetworkRuleProtocolTCP)}, - // SourceAddresses: []*string{ - // to.Ptr("*")}, - // TranslatedAddress: to.Ptr("1.2.3.5"), - // TranslatedPort: to.Ptr("8443"), - // }, - // { - // Name: to.Ptr("DNAT-HTTP-traffic-With-FQDN"), - // Description: to.Ptr("D-NAT all inbound web traffic for inspection"), - // DestinationAddresses: []*string{ - // to.Ptr("1.2.3.4")}, - // DestinationPorts: []*string{ - // to.Ptr("80")}, - // Protocols: []*armnetwork.AzureFirewallNetworkRuleProtocol{ - // to.Ptr(armnetwork.AzureFirewallNetworkRuleProtocolTCP)}, - // SourceAddresses: []*string{ - // to.Ptr("*")}, - // TranslatedFqdn: to.Ptr("internalhttpserver"), - // TranslatedPort: to.Ptr("880"), - // }}, - // }, - // }}, - // NetworkRuleCollections: []*armnetwork.AzureFirewallNetworkRuleCollection{ - // { - // ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/azureFirewalls/azurefirewall/networkRuleCollections/netrulecoll"), - // Name: to.Ptr("netrulecoll"), - // Properties: &armnetwork.AzureFirewallNetworkRuleCollectionPropertiesFormat{ - // Action: &armnetwork.AzureFirewallRCAction{ - // Type: to.Ptr(armnetwork.AzureFirewallRCActionTypeDeny), - // }, - // Priority: to.Ptr[int32](112), - // Rules: []*armnetwork.AzureFirewallNetworkRule{ - // { - // Name: to.Ptr("L4-traffic"), - // Description: to.Ptr("Block traffic based on source IPs and ports"), - // DestinationAddresses: []*string{ - // to.Ptr("*")}, - // DestinationPorts: []*string{ - // to.Ptr("443-444"), - // to.Ptr("8443")}, - // Protocols: []*armnetwork.AzureFirewallNetworkRuleProtocol{ - // to.Ptr(armnetwork.AzureFirewallNetworkRuleProtocolTCP)}, - // SourceAddresses: []*string{ - // to.Ptr("192.168.1.1-192.168.1.12"), - // to.Ptr("10.1.4.12-10.1.4.255")}, - // }, - // { - // Name: to.Ptr("L4-traffic-with-FQDN"), - // Description: to.Ptr("Block traffic based on source IPs and ports to amazon"), - // DestinationFqdns: []*string{ - // to.Ptr("www.amazon.com")}, - // DestinationPorts: []*string{ - // to.Ptr("443-444"), - // to.Ptr("8443")}, - // Protocols: []*armnetwork.AzureFirewallNetworkRuleProtocol{ - // to.Ptr(armnetwork.AzureFirewallNetworkRuleProtocolTCP)}, - // SourceAddresses: []*string{ - // to.Ptr("10.2.4.12-10.2.4.255")}, - // }}, - // }, - // }}, - // ProvisioningState: to.Ptr(armnetwork.ProvisioningStateSucceeded), - // SKU: &armnetwork.AzureFirewallSKU{ - // Name: to.Ptr(armnetwork.AzureFirewallSKUNameAZFWVnet), - // Tier: to.Ptr(armnetwork.AzureFirewallSKUTierStandard), - // }, - // ThreatIntelMode: to.Ptr(armnetwork.AzureFirewallThreatIntelModeAlert), - // }, - // Zones: []*string{ - // to.Ptr("1"), - // to.Ptr("2"), - // to.Ptr("3")}, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/4883fa5dbf6f2c9093fac8ce334547e9dfac68fa/specification/network/resource-manager/Microsoft.Network/stable/2024-03-01/examples/AzureFirewallGetWithMgmtSubnet.json -func ExampleAzureFirewallsClient_Get_getAzureFirewallWithManagementSubnet() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armnetwork.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewAzureFirewallsClient().Get(ctx, "rg1", "azurefirewall", nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.AzureFirewall = armnetwork.AzureFirewall{ - // Name: to.Ptr("azurefirewall"), - // Type: to.Ptr("Microsoft.Network/azureFirewalls"), - // ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/azureFirewalls/azurefirewall"), - // Location: to.Ptr("West US"), - // Tags: map[string]*string{ - // "key1": to.Ptr("value1"), - // }, - // Etag: to.Ptr("w/\\00000000-0000-0000-0000-000000000000\\"), - // Properties: &armnetwork.AzureFirewallPropertiesFormat{ - // AdditionalProperties: map[string]*string{ - // }, - // ApplicationRuleCollections: []*armnetwork.AzureFirewallApplicationRuleCollection{ - // { - // ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/azureFirewalls/azurefirewall/applicationRuleCollections/apprulecoll"), - // Name: to.Ptr("apprulecoll"), - // Properties: &armnetwork.AzureFirewallApplicationRuleCollectionPropertiesFormat{ - // Action: &armnetwork.AzureFirewallRCAction{ - // Type: to.Ptr(armnetwork.AzureFirewallRCActionTypeDeny), - // }, - // Priority: to.Ptr[int32](110), - // Rules: []*armnetwork.AzureFirewallApplicationRule{ - // { - // Name: to.Ptr("rule1"), - // Description: to.Ptr("Deny inbound rule"), - // Protocols: []*armnetwork.AzureFirewallApplicationRuleProtocol{ - // { - // Port: to.Ptr[int32](443), - // ProtocolType: to.Ptr(armnetwork.AzureFirewallApplicationRuleProtocolTypeHTTPS), - // }}, - // SourceAddresses: []*string{ - // to.Ptr("216.58.216.164"), - // to.Ptr("10.0.0.0/24")}, - // TargetFqdns: []*string{ - // to.Ptr("www.test.com")}, - // }}, - // }, - // }}, - // IPConfigurations: []*armnetwork.AzureFirewallIPConfiguration{ - // { - // ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/azureFirewalls/azurefirewall/ipConfigurations/azureFirewallIpConfiguration"), - // Name: to.Ptr("azureFirewallIpConfiguration"), - // Etag: to.Ptr("w/\\00000000-0000-0000-0000-000000000000\\"), - // Properties: &armnetwork.AzureFirewallIPConfigurationPropertiesFormat{ - // PrivateIPAddress: to.Ptr("10.0.0.0"), - // ProvisioningState: to.Ptr(armnetwork.ProvisioningStateSucceeded), - // PublicIPAddress: &armnetwork.SubResource{ - // ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/publicIPAddresses/pipName"), - // }, - // Subnet: &armnetwork.SubResource{ - // ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/virtualNetworks/vnet2/subnets/AzureFirewallSubnet"), - // }, - // }, - // }}, - // ManagementIPConfiguration: &armnetwork.AzureFirewallIPConfiguration{ - // ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/azureFirewalls/azurefirewall/ipConfigurations/azureFirewallMgmtIpConfiguration"), - // Name: to.Ptr("azureFirewallMgmtIpConfiguration"), - // Etag: to.Ptr("w/\\00000000-0000-0000-0000-000000000000\\"), - // Properties: &armnetwork.AzureFirewallIPConfigurationPropertiesFormat{ - // ProvisioningState: to.Ptr(armnetwork.ProvisioningStateSucceeded), - // PublicIPAddress: &armnetwork.SubResource{ - // ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/publicIPAddresses/managementPipName"), - // }, - // Subnet: &armnetwork.SubResource{ - // ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/virtualNetworks/vnet2/subnets/AzureFirewallManagementSubnet"), - // }, - // }, - // }, - // NatRuleCollections: []*armnetwork.AzureFirewallNatRuleCollection{ - // { - // ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/azureFirewalls/azurefirewall/natRuleCollections/natrulecoll"), - // Name: to.Ptr("natrulecoll"), - // Properties: &armnetwork.AzureFirewallNatRuleCollectionProperties{ - // Action: &armnetwork.AzureFirewallNatRCAction{ - // Type: to.Ptr(armnetwork.AzureFirewallNatRCActionTypeDnat), - // }, - // Priority: to.Ptr[int32](112), - // Rules: []*armnetwork.AzureFirewallNatRule{ - // { - // Name: to.Ptr("DNAT-HTTPS-traffic"), - // Description: to.Ptr("D-NAT all outbound web traffic for inspection"), - // DestinationAddresses: []*string{ - // to.Ptr("1.2.3.4")}, - // DestinationPorts: []*string{ - // to.Ptr("443")}, - // Protocols: []*armnetwork.AzureFirewallNetworkRuleProtocol{ - // to.Ptr(armnetwork.AzureFirewallNetworkRuleProtocolTCP)}, - // SourceAddresses: []*string{ - // to.Ptr("*")}, - // TranslatedAddress: to.Ptr("1.2.3.5"), - // TranslatedPort: to.Ptr("8443"), - // }, - // { - // Name: to.Ptr("DNAT-HTTP-traffic-With-FQDN"), - // Description: to.Ptr("D-NAT all inbound web traffic for inspection"), - // DestinationAddresses: []*string{ - // to.Ptr("1.2.3.4")}, - // DestinationPorts: []*string{ - // to.Ptr("80")}, - // Protocols: []*armnetwork.AzureFirewallNetworkRuleProtocol{ - // to.Ptr(armnetwork.AzureFirewallNetworkRuleProtocolTCP)}, - // SourceAddresses: []*string{ - // to.Ptr("*")}, - // TranslatedFqdn: to.Ptr("internalhttpserver"), - // TranslatedPort: to.Ptr("880"), - // }}, - // }, - // }}, - // NetworkRuleCollections: []*armnetwork.AzureFirewallNetworkRuleCollection{ - // { - // ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/azureFirewalls/azurefirewall/networkRuleCollections/netrulecoll"), - // Name: to.Ptr("netrulecoll"), - // Properties: &armnetwork.AzureFirewallNetworkRuleCollectionPropertiesFormat{ - // Action: &armnetwork.AzureFirewallRCAction{ - // Type: to.Ptr(armnetwork.AzureFirewallRCActionTypeDeny), - // }, - // Priority: to.Ptr[int32](112), - // Rules: []*armnetwork.AzureFirewallNetworkRule{ - // { - // Name: to.Ptr("L4-traffic"), - // Description: to.Ptr("Block traffic based on source IPs and ports"), - // DestinationAddresses: []*string{ - // to.Ptr("*")}, - // DestinationPorts: []*string{ - // to.Ptr("443-444"), - // to.Ptr("8443")}, - // Protocols: []*armnetwork.AzureFirewallNetworkRuleProtocol{ - // to.Ptr(armnetwork.AzureFirewallNetworkRuleProtocolTCP)}, - // SourceAddresses: []*string{ - // to.Ptr("192.168.1.1-192.168.1.12"), - // to.Ptr("10.1.4.12-10.1.4.255")}, - // }, - // { - // Name: to.Ptr("L4-traffic-with-FQDN"), - // Description: to.Ptr("Block traffic based on source IPs and ports to amazon"), - // DestinationFqdns: []*string{ - // to.Ptr("www.amazon.com")}, - // DestinationPorts: []*string{ - // to.Ptr("443-444"), - // to.Ptr("8443")}, - // Protocols: []*armnetwork.AzureFirewallNetworkRuleProtocol{ - // to.Ptr(armnetwork.AzureFirewallNetworkRuleProtocolTCP)}, - // SourceAddresses: []*string{ - // to.Ptr("10.2.4.12-10.2.4.255")}, - // }}, - // }, - // }}, - // ProvisioningState: to.Ptr(armnetwork.ProvisioningStateSucceeded), - // SKU: &armnetwork.AzureFirewallSKU{ - // Name: to.Ptr(armnetwork.AzureFirewallSKUNameAZFWVnet), - // Tier: to.Ptr(armnetwork.AzureFirewallSKUTierStandard), - // }, - // ThreatIntelMode: to.Ptr(armnetwork.AzureFirewallThreatIntelModeAlert), - // }, - // Zones: []*string{ - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/4883fa5dbf6f2c9093fac8ce334547e9dfac68fa/specification/network/resource-manager/Microsoft.Network/stable/2024-03-01/examples/AzureFirewallPut.json -func ExampleAzureFirewallsClient_BeginCreateOrUpdate_createAzureFirewall() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armnetwork.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewAzureFirewallsClient().BeginCreateOrUpdate(ctx, "rg1", "azurefirewall", armnetwork.AzureFirewall{ - Location: to.Ptr("West US"), - Tags: map[string]*string{ - "key1": to.Ptr("value1"), - }, - Properties: &armnetwork.AzureFirewallPropertiesFormat{ - ApplicationRuleCollections: []*armnetwork.AzureFirewallApplicationRuleCollection{ - { - ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/azureFirewalls/azurefirewall/applicationRuleCollections/apprulecoll"), - Name: to.Ptr("apprulecoll"), - Properties: &armnetwork.AzureFirewallApplicationRuleCollectionPropertiesFormat{ - Action: &armnetwork.AzureFirewallRCAction{ - Type: to.Ptr(armnetwork.AzureFirewallRCActionTypeDeny), - }, - Priority: to.Ptr[int32](110), - Rules: []*armnetwork.AzureFirewallApplicationRule{ - { - Name: to.Ptr("rule1"), - Description: to.Ptr("Deny inbound rule"), - Protocols: []*armnetwork.AzureFirewallApplicationRuleProtocol{ - { - Port: to.Ptr[int32](443), - ProtocolType: to.Ptr(armnetwork.AzureFirewallApplicationRuleProtocolTypeHTTPS), - }}, - SourceAddresses: []*string{ - to.Ptr("216.58.216.164"), - to.Ptr("10.0.0.0/24")}, - TargetFqdns: []*string{ - to.Ptr("www.test.com")}, - }}, - }, - }}, - IPConfigurations: []*armnetwork.AzureFirewallIPConfiguration{ - { - Name: to.Ptr("azureFirewallIpConfiguration"), - Properties: &armnetwork.AzureFirewallIPConfigurationPropertiesFormat{ - PublicIPAddress: &armnetwork.SubResource{ - ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/publicIPAddresses/pipName"), - }, - Subnet: &armnetwork.SubResource{ - ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/virtualNetworks/vnet2/subnets/AzureFirewallSubnet"), - }, - }, - }}, - NatRuleCollections: []*armnetwork.AzureFirewallNatRuleCollection{ - { - ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/azureFirewalls/azurefirewall/natRuleCollections/natrulecoll"), - Name: to.Ptr("natrulecoll"), - Properties: &armnetwork.AzureFirewallNatRuleCollectionProperties{ - Action: &armnetwork.AzureFirewallNatRCAction{ - Type: to.Ptr(armnetwork.AzureFirewallNatRCActionTypeDnat), - }, - Priority: to.Ptr[int32](112), - Rules: []*armnetwork.AzureFirewallNatRule{ - { - Name: to.Ptr("DNAT-HTTPS-traffic"), - Description: to.Ptr("D-NAT all outbound web traffic for inspection"), - DestinationAddresses: []*string{ - to.Ptr("1.2.3.4")}, - DestinationPorts: []*string{ - to.Ptr("443")}, - Protocols: []*armnetwork.AzureFirewallNetworkRuleProtocol{ - to.Ptr(armnetwork.AzureFirewallNetworkRuleProtocolTCP)}, - SourceAddresses: []*string{ - to.Ptr("*")}, - TranslatedAddress: to.Ptr("1.2.3.5"), - TranslatedPort: to.Ptr("8443"), - }, - { - Name: to.Ptr("DNAT-HTTP-traffic-With-FQDN"), - Description: to.Ptr("D-NAT all inbound web traffic for inspection"), - DestinationAddresses: []*string{ - to.Ptr("1.2.3.4")}, - DestinationPorts: []*string{ - to.Ptr("80")}, - Protocols: []*armnetwork.AzureFirewallNetworkRuleProtocol{ - to.Ptr(armnetwork.AzureFirewallNetworkRuleProtocolTCP)}, - SourceAddresses: []*string{ - to.Ptr("*")}, - TranslatedFqdn: to.Ptr("internalhttpserver"), - TranslatedPort: to.Ptr("880"), - }}, - }, - }}, - NetworkRuleCollections: []*armnetwork.AzureFirewallNetworkRuleCollection{ - { - ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/azureFirewalls/azurefirewall/networkRuleCollections/netrulecoll"), - Name: to.Ptr("netrulecoll"), - Properties: &armnetwork.AzureFirewallNetworkRuleCollectionPropertiesFormat{ - Action: &armnetwork.AzureFirewallRCAction{ - Type: to.Ptr(armnetwork.AzureFirewallRCActionTypeDeny), - }, - Priority: to.Ptr[int32](112), - Rules: []*armnetwork.AzureFirewallNetworkRule{ - { - Name: to.Ptr("L4-traffic"), - Description: to.Ptr("Block traffic based on source IPs and ports"), - DestinationAddresses: []*string{ - to.Ptr("*")}, - DestinationPorts: []*string{ - to.Ptr("443-444"), - to.Ptr("8443")}, - Protocols: []*armnetwork.AzureFirewallNetworkRuleProtocol{ - to.Ptr(armnetwork.AzureFirewallNetworkRuleProtocolTCP)}, - SourceAddresses: []*string{ - to.Ptr("192.168.1.1-192.168.1.12"), - to.Ptr("10.1.4.12-10.1.4.255")}, - }, - { - Name: to.Ptr("L4-traffic-with-FQDN"), - Description: to.Ptr("Block traffic based on source IPs and ports to amazon"), - DestinationFqdns: []*string{ - to.Ptr("www.amazon.com")}, - DestinationPorts: []*string{ - to.Ptr("443-444"), - to.Ptr("8443")}, - Protocols: []*armnetwork.AzureFirewallNetworkRuleProtocol{ - to.Ptr(armnetwork.AzureFirewallNetworkRuleProtocolTCP)}, - SourceAddresses: []*string{ - to.Ptr("10.2.4.12-10.2.4.255")}, - }}, - }, - }}, - SKU: &armnetwork.AzureFirewallSKU{ - Name: to.Ptr(armnetwork.AzureFirewallSKUNameAZFWVnet), - Tier: to.Ptr(armnetwork.AzureFirewallSKUTierStandard), - }, - ThreatIntelMode: to.Ptr(armnetwork.AzureFirewallThreatIntelModeAlert), - }, - Zones: []*string{}, - }, nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - res, err := poller.PollUntilDone(ctx, nil) - if err != nil { - log.Fatalf("failed to pull the result: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.AzureFirewall = armnetwork.AzureFirewall{ - // Name: to.Ptr("azurefirewall"), - // Type: to.Ptr("Microsoft.Network/azureFirewalls"), - // ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/azureFirewalls/azurefirewall"), - // Location: to.Ptr("West US"), - // Tags: map[string]*string{ - // "key1": to.Ptr("value1"), - // }, - // Etag: to.Ptr("w/\\00000000-0000-0000-0000-000000000000\\"), - // Properties: &armnetwork.AzureFirewallPropertiesFormat{ - // AdditionalProperties: map[string]*string{ - // }, - // ApplicationRuleCollections: []*armnetwork.AzureFirewallApplicationRuleCollection{ - // { - // ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/azureFirewalls/azurefirewall/applicationRuleCollections/apprulecoll"), - // Name: to.Ptr("apprulecoll"), - // Properties: &armnetwork.AzureFirewallApplicationRuleCollectionPropertiesFormat{ - // Action: &armnetwork.AzureFirewallRCAction{ - // Type: to.Ptr(armnetwork.AzureFirewallRCActionTypeDeny), - // }, - // Priority: to.Ptr[int32](110), - // Rules: []*armnetwork.AzureFirewallApplicationRule{ - // { - // Name: to.Ptr("rule1"), - // Description: to.Ptr("Deny inbound rule"), - // Protocols: []*armnetwork.AzureFirewallApplicationRuleProtocol{ - // { - // Port: to.Ptr[int32](443), - // ProtocolType: to.Ptr(armnetwork.AzureFirewallApplicationRuleProtocolTypeHTTPS), - // }}, - // SourceAddresses: []*string{ - // to.Ptr("216.58.216.164"), - // to.Ptr("10.0.0.0/24")}, - // TargetFqdns: []*string{ - // to.Ptr("www.test.com")}, - // }}, - // }, - // }}, - // IPConfigurations: []*armnetwork.AzureFirewallIPConfiguration{ - // { - // ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/azureFirewalls/azurefirewall/ipConfigurations/azureFirewallIpConfiguration"), - // Name: to.Ptr("azureFirewallIpConfiguration"), - // Etag: to.Ptr("w/\\00000000-0000-0000-0000-000000000000\\"), - // Properties: &armnetwork.AzureFirewallIPConfigurationPropertiesFormat{ - // PrivateIPAddress: to.Ptr("10.0.0.0"), - // ProvisioningState: to.Ptr(armnetwork.ProvisioningStateSucceeded), - // PublicIPAddress: &armnetwork.SubResource{ - // ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/publicIPAddresses/pipName"), - // }, - // Subnet: &armnetwork.SubResource{ - // ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/virtualNetworks/vnet2/subnets/AzureFirewallSubnet"), - // }, - // }, - // }}, - // IPGroups: []*armnetwork.AzureFirewallIPGroups{ - // }, - // NatRuleCollections: []*armnetwork.AzureFirewallNatRuleCollection{ - // { - // ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/azureFirewalls/azurefirewall/natRuleCollections/natrulecoll"), - // Name: to.Ptr("natrulecoll"), - // Properties: &armnetwork.AzureFirewallNatRuleCollectionProperties{ - // Action: &armnetwork.AzureFirewallNatRCAction{ - // Type: to.Ptr(armnetwork.AzureFirewallNatRCActionTypeDnat), - // }, - // Priority: to.Ptr[int32](112), - // Rules: []*armnetwork.AzureFirewallNatRule{ - // { - // Name: to.Ptr("DNAT-HTTPS-traffic"), - // Description: to.Ptr("D-NAT all outbound web traffic for inspection"), - // DestinationAddresses: []*string{ - // to.Ptr("1.2.3.4")}, - // DestinationPorts: []*string{ - // to.Ptr("443")}, - // Protocols: []*armnetwork.AzureFirewallNetworkRuleProtocol{ - // to.Ptr(armnetwork.AzureFirewallNetworkRuleProtocolTCP)}, - // SourceAddresses: []*string{ - // to.Ptr("*")}, - // TranslatedAddress: to.Ptr("1.2.3.5"), - // TranslatedPort: to.Ptr("8443"), - // }, - // { - // Name: to.Ptr("DNAT-HTTP-traffic-With-FQDN"), - // Description: to.Ptr("D-NAT all inbound web traffic for inspection"), - // DestinationAddresses: []*string{ - // to.Ptr("1.2.3.4")}, - // DestinationPorts: []*string{ - // to.Ptr("80")}, - // Protocols: []*armnetwork.AzureFirewallNetworkRuleProtocol{ - // to.Ptr(armnetwork.AzureFirewallNetworkRuleProtocolTCP)}, - // SourceAddresses: []*string{ - // to.Ptr("*")}, - // TranslatedFqdn: to.Ptr("internalhttpserver"), - // TranslatedPort: to.Ptr("880"), - // }}, - // }, - // }}, - // NetworkRuleCollections: []*armnetwork.AzureFirewallNetworkRuleCollection{ - // { - // ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/azureFirewalls/azurefirewall/networkRuleCollections/netrulecoll"), - // Name: to.Ptr("netrulecoll"), - // Properties: &armnetwork.AzureFirewallNetworkRuleCollectionPropertiesFormat{ - // Action: &armnetwork.AzureFirewallRCAction{ - // Type: to.Ptr(armnetwork.AzureFirewallRCActionTypeDeny), - // }, - // Priority: to.Ptr[int32](112), - // Rules: []*armnetwork.AzureFirewallNetworkRule{ - // { - // Name: to.Ptr("L4-traffic"), - // Description: to.Ptr("Block traffic based on source IPs and ports"), - // DestinationAddresses: []*string{ - // to.Ptr("*")}, - // DestinationPorts: []*string{ - // to.Ptr("443-444"), - // to.Ptr("8443")}, - // Protocols: []*armnetwork.AzureFirewallNetworkRuleProtocol{ - // to.Ptr(armnetwork.AzureFirewallNetworkRuleProtocolTCP)}, - // SourceAddresses: []*string{ - // to.Ptr("192.168.1.1-192.168.1.12"), - // to.Ptr("10.1.4.12-10.1.4.255")}, - // }, - // { - // Name: to.Ptr("L4-traffic-with-FQDN"), - // Description: to.Ptr("Block traffic based on source IPs and ports to amazon"), - // DestinationFqdns: []*string{ - // to.Ptr("www.amazon.com")}, - // DestinationPorts: []*string{ - // to.Ptr("443-444"), - // to.Ptr("8443")}, - // Protocols: []*armnetwork.AzureFirewallNetworkRuleProtocol{ - // to.Ptr(armnetwork.AzureFirewallNetworkRuleProtocolTCP)}, - // SourceAddresses: []*string{ - // to.Ptr("10.2.4.12-10.2.4.255")}, - // }}, - // }, - // }}, - // ProvisioningState: to.Ptr(armnetwork.ProvisioningStateSucceeded), - // SKU: &armnetwork.AzureFirewallSKU{ - // Name: to.Ptr(armnetwork.AzureFirewallSKUNameAZFWVnet), - // Tier: to.Ptr(armnetwork.AzureFirewallSKUTierStandard), - // }, - // ThreatIntelMode: to.Ptr(armnetwork.AzureFirewallThreatIntelModeAlert), - // }, - // Zones: []*string{ - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/4883fa5dbf6f2c9093fac8ce334547e9dfac68fa/specification/network/resource-manager/Microsoft.Network/stable/2024-03-01/examples/AzureFirewallPutWithAdditionalProperties.json -func ExampleAzureFirewallsClient_BeginCreateOrUpdate_createAzureFirewallWithAdditionalProperties() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armnetwork.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewAzureFirewallsClient().BeginCreateOrUpdate(ctx, "rg1", "azurefirewall", armnetwork.AzureFirewall{ - Location: to.Ptr("West US"), - Tags: map[string]*string{ - "key1": to.Ptr("value1"), - }, - Properties: &armnetwork.AzureFirewallPropertiesFormat{ - AdditionalProperties: map[string]*string{ - "key1": to.Ptr("value1"), - "key2": to.Ptr("value2"), - }, - ApplicationRuleCollections: []*armnetwork.AzureFirewallApplicationRuleCollection{ - { - ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/azureFirewalls/azurefirewall/applicationRuleCollections/apprulecoll"), - Name: to.Ptr("apprulecoll"), - Properties: &armnetwork.AzureFirewallApplicationRuleCollectionPropertiesFormat{ - Action: &armnetwork.AzureFirewallRCAction{ - Type: to.Ptr(armnetwork.AzureFirewallRCActionTypeDeny), - }, - Priority: to.Ptr[int32](110), - Rules: []*armnetwork.AzureFirewallApplicationRule{ - { - Name: to.Ptr("rule1"), - Description: to.Ptr("Deny inbound rule"), - Protocols: []*armnetwork.AzureFirewallApplicationRuleProtocol{ - { - Port: to.Ptr[int32](443), - ProtocolType: to.Ptr(armnetwork.AzureFirewallApplicationRuleProtocolTypeHTTPS), - }}, - SourceAddresses: []*string{ - to.Ptr("216.58.216.164"), - to.Ptr("10.0.0.0/24")}, - TargetFqdns: []*string{ - to.Ptr("www.test.com")}, - }}, - }, - }}, - IPConfigurations: []*armnetwork.AzureFirewallIPConfiguration{ - { - Name: to.Ptr("azureFirewallIpConfiguration"), - Properties: &armnetwork.AzureFirewallIPConfigurationPropertiesFormat{ - PublicIPAddress: &armnetwork.SubResource{ - ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/publicIPAddresses/pipName"), - }, - Subnet: &armnetwork.SubResource{ - ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/virtualNetworks/vnet2/subnets/AzureFirewallSubnet"), - }, - }, - }}, - IPGroups: []*armnetwork.AzureFirewallIPGroups{}, - NatRuleCollections: []*armnetwork.AzureFirewallNatRuleCollection{ - { - ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/azureFirewalls/azurefirewall/natRuleCollections/natrulecoll"), - Name: to.Ptr("natrulecoll"), - Properties: &armnetwork.AzureFirewallNatRuleCollectionProperties{ - Action: &armnetwork.AzureFirewallNatRCAction{ - Type: to.Ptr(armnetwork.AzureFirewallNatRCActionTypeDnat), - }, - Priority: to.Ptr[int32](112), - Rules: []*armnetwork.AzureFirewallNatRule{ - { - Name: to.Ptr("DNAT-HTTPS-traffic"), - Description: to.Ptr("D-NAT all outbound web traffic for inspection"), - DestinationAddresses: []*string{ - to.Ptr("1.2.3.4")}, - DestinationPorts: []*string{ - to.Ptr("443")}, - Protocols: []*armnetwork.AzureFirewallNetworkRuleProtocol{ - to.Ptr(armnetwork.AzureFirewallNetworkRuleProtocolTCP)}, - SourceAddresses: []*string{ - to.Ptr("*")}, - TranslatedAddress: to.Ptr("1.2.3.5"), - TranslatedPort: to.Ptr("8443"), - }, - { - Name: to.Ptr("DNAT-HTTP-traffic-With-FQDN"), - Description: to.Ptr("D-NAT all inbound web traffic for inspection"), - DestinationAddresses: []*string{ - to.Ptr("1.2.3.4")}, - DestinationPorts: []*string{ - to.Ptr("80")}, - Protocols: []*armnetwork.AzureFirewallNetworkRuleProtocol{ - to.Ptr(armnetwork.AzureFirewallNetworkRuleProtocolTCP)}, - SourceAddresses: []*string{ - to.Ptr("*")}, - TranslatedFqdn: to.Ptr("internalhttpserver"), - TranslatedPort: to.Ptr("880"), - }}, - }, - }}, - NetworkRuleCollections: []*armnetwork.AzureFirewallNetworkRuleCollection{ - { - ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/azureFirewalls/azurefirewall/networkRuleCollections/netrulecoll"), - Name: to.Ptr("netrulecoll"), - Properties: &armnetwork.AzureFirewallNetworkRuleCollectionPropertiesFormat{ - Action: &armnetwork.AzureFirewallRCAction{ - Type: to.Ptr(armnetwork.AzureFirewallRCActionTypeDeny), - }, - Priority: to.Ptr[int32](112), - Rules: []*armnetwork.AzureFirewallNetworkRule{ - { - Name: to.Ptr("L4-traffic"), - Description: to.Ptr("Block traffic based on source IPs and ports"), - DestinationAddresses: []*string{ - to.Ptr("*")}, - DestinationPorts: []*string{ - to.Ptr("443-444"), - to.Ptr("8443")}, - Protocols: []*armnetwork.AzureFirewallNetworkRuleProtocol{ - to.Ptr(armnetwork.AzureFirewallNetworkRuleProtocolTCP)}, - SourceAddresses: []*string{ - to.Ptr("192.168.1.1-192.168.1.12"), - to.Ptr("10.1.4.12-10.1.4.255")}, - }, - { - Name: to.Ptr("L4-traffic-with-FQDN"), - Description: to.Ptr("Block traffic based on source IPs and ports to amazon"), - DestinationFqdns: []*string{ - to.Ptr("www.amazon.com")}, - DestinationPorts: []*string{ - to.Ptr("443-444"), - to.Ptr("8443")}, - Protocols: []*armnetwork.AzureFirewallNetworkRuleProtocol{ - to.Ptr(armnetwork.AzureFirewallNetworkRuleProtocolTCP)}, - SourceAddresses: []*string{ - to.Ptr("10.2.4.12-10.2.4.255")}, - }}, - }, - }}, - SKU: &armnetwork.AzureFirewallSKU{ - Name: to.Ptr(armnetwork.AzureFirewallSKUNameAZFWVnet), - Tier: to.Ptr(armnetwork.AzureFirewallSKUTierStandard), - }, - ThreatIntelMode: to.Ptr(armnetwork.AzureFirewallThreatIntelModeAlert), - }, - Zones: []*string{}, - }, nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - res, err := poller.PollUntilDone(ctx, nil) - if err != nil { - log.Fatalf("failed to pull the result: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.AzureFirewall = armnetwork.AzureFirewall{ - // Name: to.Ptr("azurefirewall"), - // Type: to.Ptr("Microsoft.Network/azureFirewalls"), - // ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/azureFirewalls/azurefirewall"), - // Location: to.Ptr("West US"), - // Tags: map[string]*string{ - // "key1": to.Ptr("value1"), - // }, - // Etag: to.Ptr("w/\\00000000-0000-0000-0000-000000000000\\"), - // Properties: &armnetwork.AzureFirewallPropertiesFormat{ - // AdditionalProperties: map[string]*string{ - // "key1": to.Ptr("value1"), - // "key2": to.Ptr("value2"), - // }, - // ApplicationRuleCollections: []*armnetwork.AzureFirewallApplicationRuleCollection{ - // { - // ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/azureFirewalls/azurefirewall/applicationRuleCollections/apprulecoll"), - // Name: to.Ptr("apprulecoll"), - // Properties: &armnetwork.AzureFirewallApplicationRuleCollectionPropertiesFormat{ - // Action: &armnetwork.AzureFirewallRCAction{ - // Type: to.Ptr(armnetwork.AzureFirewallRCActionTypeDeny), - // }, - // Priority: to.Ptr[int32](110), - // Rules: []*armnetwork.AzureFirewallApplicationRule{ - // { - // Name: to.Ptr("rule1"), - // Description: to.Ptr("Deny inbound rule"), - // Protocols: []*armnetwork.AzureFirewallApplicationRuleProtocol{ - // { - // Port: to.Ptr[int32](443), - // ProtocolType: to.Ptr(armnetwork.AzureFirewallApplicationRuleProtocolTypeHTTPS), - // }}, - // SourceAddresses: []*string{ - // to.Ptr("216.58.216.164"), - // to.Ptr("10.0.0.0/24")}, - // TargetFqdns: []*string{ - // to.Ptr("www.test.com")}, - // }}, - // }, - // }}, - // IPConfigurations: []*armnetwork.AzureFirewallIPConfiguration{ - // { - // ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/azureFirewalls/azurefirewall/ipConfigurations/azureFirewallIpConfiguration"), - // Name: to.Ptr("azureFirewallIpConfiguration"), - // Etag: to.Ptr("w/\\00000000-0000-0000-0000-000000000000\\"), - // Properties: &armnetwork.AzureFirewallIPConfigurationPropertiesFormat{ - // PrivateIPAddress: to.Ptr("10.0.0.0"), - // ProvisioningState: to.Ptr(armnetwork.ProvisioningStateSucceeded), - // PublicIPAddress: &armnetwork.SubResource{ - // ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/publicIPAddresses/pipName"), - // }, - // Subnet: &armnetwork.SubResource{ - // ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/virtualNetworks/vnet2/subnets/AzureFirewallSubnet"), - // }, - // }, - // }}, - // NatRuleCollections: []*armnetwork.AzureFirewallNatRuleCollection{ - // { - // ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/azureFirewalls/azurefirewall/natRuleCollections/natrulecoll"), - // Name: to.Ptr("natrulecoll"), - // Properties: &armnetwork.AzureFirewallNatRuleCollectionProperties{ - // Action: &armnetwork.AzureFirewallNatRCAction{ - // Type: to.Ptr(armnetwork.AzureFirewallNatRCActionTypeDnat), - // }, - // Priority: to.Ptr[int32](112), - // Rules: []*armnetwork.AzureFirewallNatRule{ - // { - // Name: to.Ptr("DNAT-HTTPS-traffic"), - // Description: to.Ptr("D-NAT all outbound web traffic for inspection"), - // DestinationAddresses: []*string{ - // to.Ptr("1.2.3.4")}, - // DestinationPorts: []*string{ - // to.Ptr("443")}, - // Protocols: []*armnetwork.AzureFirewallNetworkRuleProtocol{ - // to.Ptr(armnetwork.AzureFirewallNetworkRuleProtocolTCP)}, - // SourceAddresses: []*string{ - // to.Ptr("*")}, - // TranslatedAddress: to.Ptr("1.2.3.5"), - // TranslatedPort: to.Ptr("8443"), - // }, - // { - // Name: to.Ptr("DNAT-HTTP-traffic-With-FQDN"), - // Description: to.Ptr("D-NAT all inbound web traffic for inspection"), - // DestinationAddresses: []*string{ - // to.Ptr("1.2.3.4")}, - // DestinationPorts: []*string{ - // to.Ptr("80")}, - // Protocols: []*armnetwork.AzureFirewallNetworkRuleProtocol{ - // to.Ptr(armnetwork.AzureFirewallNetworkRuleProtocolTCP)}, - // SourceAddresses: []*string{ - // to.Ptr("*")}, - // TranslatedFqdn: to.Ptr("internalhttpserver"), - // TranslatedPort: to.Ptr("880"), - // }}, - // }, - // }}, - // NetworkRuleCollections: []*armnetwork.AzureFirewallNetworkRuleCollection{ - // { - // ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/azureFirewalls/azurefirewall/networkRuleCollections/netrulecoll"), - // Name: to.Ptr("netrulecoll"), - // Properties: &armnetwork.AzureFirewallNetworkRuleCollectionPropertiesFormat{ - // Action: &armnetwork.AzureFirewallRCAction{ - // Type: to.Ptr(armnetwork.AzureFirewallRCActionTypeDeny), - // }, - // Priority: to.Ptr[int32](112), - // Rules: []*armnetwork.AzureFirewallNetworkRule{ - // { - // Name: to.Ptr("L4-traffic"), - // Description: to.Ptr("Block traffic based on source IPs and ports"), - // DestinationAddresses: []*string{ - // to.Ptr("*")}, - // DestinationPorts: []*string{ - // to.Ptr("443-444"), - // to.Ptr("8443")}, - // Protocols: []*armnetwork.AzureFirewallNetworkRuleProtocol{ - // to.Ptr(armnetwork.AzureFirewallNetworkRuleProtocolTCP)}, - // SourceAddresses: []*string{ - // to.Ptr("192.168.1.1-192.168.1.12"), - // to.Ptr("10.1.4.12-10.1.4.255")}, - // }, - // { - // Name: to.Ptr("L4-traffic-with-FQDN"), - // Description: to.Ptr("Block traffic based on source IPs and ports to amazon"), - // DestinationFqdns: []*string{ - // to.Ptr("www.amazon.com")}, - // DestinationPorts: []*string{ - // to.Ptr("443-444"), - // to.Ptr("8443")}, - // Protocols: []*armnetwork.AzureFirewallNetworkRuleProtocol{ - // to.Ptr(armnetwork.AzureFirewallNetworkRuleProtocolTCP)}, - // SourceAddresses: []*string{ - // to.Ptr("10.2.4.12-10.2.4.255")}, - // }}, - // }, - // }}, - // ProvisioningState: to.Ptr(armnetwork.ProvisioningStateSucceeded), - // SKU: &armnetwork.AzureFirewallSKU{ - // Name: to.Ptr(armnetwork.AzureFirewallSKUNameAZFWVnet), - // Tier: to.Ptr(armnetwork.AzureFirewallSKUTierStandard), - // }, - // ThreatIntelMode: to.Ptr(armnetwork.AzureFirewallThreatIntelModeAlert), - // }, - // Zones: []*string{ - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/4883fa5dbf6f2c9093fac8ce334547e9dfac68fa/specification/network/resource-manager/Microsoft.Network/stable/2024-03-01/examples/AzureFirewallPutWithIpGroups.json -func ExampleAzureFirewallsClient_BeginCreateOrUpdate_createAzureFirewallWithIpGroups() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armnetwork.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewAzureFirewallsClient().BeginCreateOrUpdate(ctx, "rg1", "azurefirewall", armnetwork.AzureFirewall{ - Location: to.Ptr("West US"), - Tags: map[string]*string{ - "key1": to.Ptr("value1"), - }, - Properties: &armnetwork.AzureFirewallPropertiesFormat{ - ApplicationRuleCollections: []*armnetwork.AzureFirewallApplicationRuleCollection{ - { - ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/azureFirewalls/azurefirewall/applicationRuleCollections/apprulecoll"), - Name: to.Ptr("apprulecoll"), - Properties: &armnetwork.AzureFirewallApplicationRuleCollectionPropertiesFormat{ - Action: &armnetwork.AzureFirewallRCAction{ - Type: to.Ptr(armnetwork.AzureFirewallRCActionTypeDeny), - }, - Priority: to.Ptr[int32](110), - Rules: []*armnetwork.AzureFirewallApplicationRule{ - { - Name: to.Ptr("rule1"), - Description: to.Ptr("Deny inbound rule"), - Protocols: []*armnetwork.AzureFirewallApplicationRuleProtocol{ - { - Port: to.Ptr[int32](443), - ProtocolType: to.Ptr(armnetwork.AzureFirewallApplicationRuleProtocolTypeHTTPS), - }}, - SourceAddresses: []*string{ - to.Ptr("216.58.216.164"), - to.Ptr("10.0.0.0/24")}, - TargetFqdns: []*string{ - to.Ptr("www.test.com")}, - }}, - }, - }}, - IPConfigurations: []*armnetwork.AzureFirewallIPConfiguration{ - { - Name: to.Ptr("azureFirewallIpConfiguration"), - Properties: &armnetwork.AzureFirewallIPConfigurationPropertiesFormat{ - PublicIPAddress: &armnetwork.SubResource{ - ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/publicIPAddresses/pipName"), - }, - Subnet: &armnetwork.SubResource{ - ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/virtualNetworks/vnet2/subnets/AzureFirewallSubnet"), - }, - }, - }}, - NatRuleCollections: []*armnetwork.AzureFirewallNatRuleCollection{ - { - ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/azureFirewalls/azurefirewall/natRuleCollections/natrulecoll"), - Name: to.Ptr("natrulecoll"), - Properties: &armnetwork.AzureFirewallNatRuleCollectionProperties{ - Action: &armnetwork.AzureFirewallNatRCAction{ - Type: to.Ptr(armnetwork.AzureFirewallNatRCActionTypeDnat), - }, - Priority: to.Ptr[int32](112), - Rules: []*armnetwork.AzureFirewallNatRule{ - { - Name: to.Ptr("DNAT-HTTPS-traffic"), - Description: to.Ptr("D-NAT all outbound web traffic for inspection"), - DestinationAddresses: []*string{ - to.Ptr("1.2.3.4")}, - DestinationPorts: []*string{ - to.Ptr("443")}, - Protocols: []*armnetwork.AzureFirewallNetworkRuleProtocol{ - to.Ptr(armnetwork.AzureFirewallNetworkRuleProtocolTCP)}, - SourceAddresses: []*string{ - to.Ptr("*")}, - TranslatedAddress: to.Ptr("1.2.3.5"), - TranslatedPort: to.Ptr("8443"), - }, - { - Name: to.Ptr("DNAT-HTTP-traffic-With-FQDN"), - Description: to.Ptr("D-NAT all inbound web traffic for inspection"), - DestinationAddresses: []*string{ - to.Ptr("1.2.3.4")}, - DestinationPorts: []*string{ - to.Ptr("80")}, - Protocols: []*armnetwork.AzureFirewallNetworkRuleProtocol{ - to.Ptr(armnetwork.AzureFirewallNetworkRuleProtocolTCP)}, - SourceAddresses: []*string{ - to.Ptr("*")}, - TranslatedFqdn: to.Ptr("internalhttpserver"), - TranslatedPort: to.Ptr("880"), - }}, - }, - }}, - NetworkRuleCollections: []*armnetwork.AzureFirewallNetworkRuleCollection{ - { - ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/azureFirewalls/azurefirewall/networkRuleCollections/netrulecoll"), - Name: to.Ptr("netrulecoll"), - Properties: &armnetwork.AzureFirewallNetworkRuleCollectionPropertiesFormat{ - Action: &armnetwork.AzureFirewallRCAction{ - Type: to.Ptr(armnetwork.AzureFirewallRCActionTypeDeny), - }, - Priority: to.Ptr[int32](112), - Rules: []*armnetwork.AzureFirewallNetworkRule{ - { - Name: to.Ptr("L4-traffic"), - Description: to.Ptr("Block traffic based on source IPs and ports"), - DestinationAddresses: []*string{ - to.Ptr("*")}, - DestinationPorts: []*string{ - to.Ptr("443-444"), - to.Ptr("8443")}, - Protocols: []*armnetwork.AzureFirewallNetworkRuleProtocol{ - to.Ptr(armnetwork.AzureFirewallNetworkRuleProtocolTCP)}, - SourceAddresses: []*string{ - to.Ptr("192.168.1.1-192.168.1.12"), - to.Ptr("10.1.4.12-10.1.4.255")}, - }, - { - Name: to.Ptr("L4-traffic-with-FQDN"), - Description: to.Ptr("Block traffic based on source IPs and ports to amazon"), - DestinationFqdns: []*string{ - to.Ptr("www.amazon.com")}, - DestinationPorts: []*string{ - to.Ptr("443-444"), - to.Ptr("8443")}, - Protocols: []*armnetwork.AzureFirewallNetworkRuleProtocol{ - to.Ptr(armnetwork.AzureFirewallNetworkRuleProtocolTCP)}, - SourceAddresses: []*string{ - to.Ptr("10.2.4.12-10.2.4.255")}, - }}, - }, - }}, - SKU: &armnetwork.AzureFirewallSKU{ - Name: to.Ptr(armnetwork.AzureFirewallSKUNameAZFWVnet), - Tier: to.Ptr(armnetwork.AzureFirewallSKUTierStandard), - }, - ThreatIntelMode: to.Ptr(armnetwork.AzureFirewallThreatIntelModeAlert), - }, - Zones: []*string{}, - }, nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - res, err := poller.PollUntilDone(ctx, nil) - if err != nil { - log.Fatalf("failed to pull the result: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.AzureFirewall = armnetwork.AzureFirewall{ - // Name: to.Ptr("azurefirewall"), - // Type: to.Ptr("Microsoft.Network/azureFirewalls"), - // ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/azureFirewalls/azurefirewall"), - // Location: to.Ptr("West US"), - // Tags: map[string]*string{ - // "key1": to.Ptr("value1"), - // }, - // Etag: to.Ptr("w/\\00000000-0000-0000-0000-000000000000\\"), - // Properties: &armnetwork.AzureFirewallPropertiesFormat{ - // AdditionalProperties: map[string]*string{ - // }, - // ApplicationRuleCollections: []*armnetwork.AzureFirewallApplicationRuleCollection{ - // { - // ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/azureFirewalls/azurefirewall/applicationRuleCollections/apprulecoll"), - // Name: to.Ptr("apprulecoll"), - // Properties: &armnetwork.AzureFirewallApplicationRuleCollectionPropertiesFormat{ - // Action: &armnetwork.AzureFirewallRCAction{ - // Type: to.Ptr(armnetwork.AzureFirewallRCActionTypeDeny), - // }, - // Priority: to.Ptr[int32](110), - // Rules: []*armnetwork.AzureFirewallApplicationRule{ - // { - // Name: to.Ptr("rule1"), - // Description: to.Ptr("Deny inbound rule"), - // Protocols: []*armnetwork.AzureFirewallApplicationRuleProtocol{ - // { - // Port: to.Ptr[int32](443), - // ProtocolType: to.Ptr(armnetwork.AzureFirewallApplicationRuleProtocolTypeHTTPS), - // }}, - // SourceAddresses: []*string{ - // to.Ptr("216.58.216.164"), - // to.Ptr("10.0.0.0/24")}, - // TargetFqdns: []*string{ - // to.Ptr("www.test.com")}, - // }}, - // }, - // }}, - // IPConfigurations: []*armnetwork.AzureFirewallIPConfiguration{ - // { - // ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/azureFirewalls/azurefirewall/ipConfigurations/azureFirewallIpConfiguration"), - // Name: to.Ptr("azureFirewallIpConfiguration"), - // Etag: to.Ptr("w/\\00000000-0000-0000-0000-000000000000\\"), - // Properties: &armnetwork.AzureFirewallIPConfigurationPropertiesFormat{ - // PrivateIPAddress: to.Ptr("10.0.0.0"), - // ProvisioningState: to.Ptr(armnetwork.ProvisioningStateSucceeded), - // PublicIPAddress: &armnetwork.SubResource{ - // ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/publicIPAddresses/pipName"), - // }, - // Subnet: &armnetwork.SubResource{ - // ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/virtualNetworks/vnet2/subnets/AzureFirewallSubnet"), - // }, - // }, - // }}, - // NatRuleCollections: []*armnetwork.AzureFirewallNatRuleCollection{ - // { - // ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/azureFirewalls/azurefirewall/natRuleCollections/natrulecoll"), - // Name: to.Ptr("natrulecoll"), - // Properties: &armnetwork.AzureFirewallNatRuleCollectionProperties{ - // Action: &armnetwork.AzureFirewallNatRCAction{ - // Type: to.Ptr(armnetwork.AzureFirewallNatRCActionTypeDnat), - // }, - // Priority: to.Ptr[int32](112), - // Rules: []*armnetwork.AzureFirewallNatRule{ - // { - // Name: to.Ptr("DNAT-HTTPS-traffic"), - // Description: to.Ptr("D-NAT all outbound web traffic for inspection"), - // DestinationAddresses: []*string{ - // to.Ptr("1.2.3.4")}, - // DestinationPorts: []*string{ - // to.Ptr("443")}, - // Protocols: []*armnetwork.AzureFirewallNetworkRuleProtocol{ - // to.Ptr(armnetwork.AzureFirewallNetworkRuleProtocolTCP)}, - // SourceAddresses: []*string{ - // to.Ptr("*")}, - // TranslatedAddress: to.Ptr("1.2.3.5"), - // TranslatedPort: to.Ptr("8443"), - // }, - // { - // Name: to.Ptr("DNAT-HTTP-traffic-With-FQDN"), - // Description: to.Ptr("D-NAT all inbound web traffic for inspection"), - // DestinationAddresses: []*string{ - // to.Ptr("1.2.3.4")}, - // DestinationPorts: []*string{ - // to.Ptr("80")}, - // Protocols: []*armnetwork.AzureFirewallNetworkRuleProtocol{ - // to.Ptr(armnetwork.AzureFirewallNetworkRuleProtocolTCP)}, - // SourceAddresses: []*string{ - // to.Ptr("*")}, - // TranslatedFqdn: to.Ptr("internalhttpserver"), - // TranslatedPort: to.Ptr("880"), - // }}, - // }, - // }}, - // NetworkRuleCollections: []*armnetwork.AzureFirewallNetworkRuleCollection{ - // { - // ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/azureFirewalls/azurefirewall/networkRuleCollections/netrulecoll"), - // Name: to.Ptr("netrulecoll"), - // Properties: &armnetwork.AzureFirewallNetworkRuleCollectionPropertiesFormat{ - // Action: &armnetwork.AzureFirewallRCAction{ - // Type: to.Ptr(armnetwork.AzureFirewallRCActionTypeDeny), - // }, - // Priority: to.Ptr[int32](112), - // Rules: []*armnetwork.AzureFirewallNetworkRule{ - // { - // Name: to.Ptr("L4-traffic"), - // Description: to.Ptr("Block traffic based on source IPs and ports"), - // DestinationAddresses: []*string{ - // to.Ptr("*")}, - // DestinationPorts: []*string{ - // to.Ptr("443-444"), - // to.Ptr("8443")}, - // Protocols: []*armnetwork.AzureFirewallNetworkRuleProtocol{ - // to.Ptr(armnetwork.AzureFirewallNetworkRuleProtocolTCP)}, - // SourceAddresses: []*string{ - // to.Ptr("192.168.1.1-192.168.1.12"), - // to.Ptr("10.1.4.12-10.1.4.255")}, - // }, - // { - // Name: to.Ptr("L4-traffic-with-FQDN"), - // Description: to.Ptr("Block traffic based on source IPs and ports to amazon"), - // DestinationFqdns: []*string{ - // to.Ptr("www.amazon.com")}, - // DestinationPorts: []*string{ - // to.Ptr("443-444"), - // to.Ptr("8443")}, - // Protocols: []*armnetwork.AzureFirewallNetworkRuleProtocol{ - // to.Ptr(armnetwork.AzureFirewallNetworkRuleProtocolTCP)}, - // SourceAddresses: []*string{ - // to.Ptr("10.2.4.12-10.2.4.255")}, - // }}, - // }, - // }}, - // ProvisioningState: to.Ptr(armnetwork.ProvisioningStateSucceeded), - // SKU: &armnetwork.AzureFirewallSKU{ - // Name: to.Ptr(armnetwork.AzureFirewallSKUNameAZFWVnet), - // Tier: to.Ptr(armnetwork.AzureFirewallSKUTierStandard), - // }, - // ThreatIntelMode: to.Ptr(armnetwork.AzureFirewallThreatIntelModeAlert), - // }, - // Zones: []*string{ - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/4883fa5dbf6f2c9093fac8ce334547e9dfac68fa/specification/network/resource-manager/Microsoft.Network/stable/2024-03-01/examples/AzureFirewallPutWithZones.json -func ExampleAzureFirewallsClient_BeginCreateOrUpdate_createAzureFirewallWithZones() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armnetwork.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewAzureFirewallsClient().BeginCreateOrUpdate(ctx, "rg1", "azurefirewall", armnetwork.AzureFirewall{ - Location: to.Ptr("West US 2"), - Tags: map[string]*string{ - "key1": to.Ptr("value1"), - }, - Properties: &armnetwork.AzureFirewallPropertiesFormat{ - ApplicationRuleCollections: []*armnetwork.AzureFirewallApplicationRuleCollection{ - { - ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/azureFirewalls/azurefirewall/applicationRuleCollections/apprulecoll"), - Name: to.Ptr("apprulecoll"), - Properties: &armnetwork.AzureFirewallApplicationRuleCollectionPropertiesFormat{ - Action: &armnetwork.AzureFirewallRCAction{ - Type: to.Ptr(armnetwork.AzureFirewallRCActionTypeDeny), - }, - Priority: to.Ptr[int32](110), - Rules: []*armnetwork.AzureFirewallApplicationRule{ - { - Name: to.Ptr("rule1"), - Description: to.Ptr("Deny inbound rule"), - Protocols: []*armnetwork.AzureFirewallApplicationRuleProtocol{ - { - Port: to.Ptr[int32](443), - ProtocolType: to.Ptr(armnetwork.AzureFirewallApplicationRuleProtocolTypeHTTPS), - }}, - SourceAddresses: []*string{ - to.Ptr("216.58.216.164"), - to.Ptr("10.0.0.0/24")}, - TargetFqdns: []*string{ - to.Ptr("www.test.com")}, - }}, - }, - }}, - IPConfigurations: []*armnetwork.AzureFirewallIPConfiguration{ - { - Name: to.Ptr("azureFirewallIpConfiguration"), - Properties: &armnetwork.AzureFirewallIPConfigurationPropertiesFormat{ - PublicIPAddress: &armnetwork.SubResource{ - ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/publicIPAddresses/pipName"), - }, - Subnet: &armnetwork.SubResource{ - ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/virtualNetworks/vnet2/subnets/AzureFirewallSubnet"), - }, - }, - }}, - NatRuleCollections: []*armnetwork.AzureFirewallNatRuleCollection{ - { - ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/azureFirewalls/azurefirewall/natRuleCollections/natrulecoll"), - Name: to.Ptr("natrulecoll"), - Properties: &armnetwork.AzureFirewallNatRuleCollectionProperties{ - Action: &armnetwork.AzureFirewallNatRCAction{ - Type: to.Ptr(armnetwork.AzureFirewallNatRCActionTypeDnat), - }, - Priority: to.Ptr[int32](112), - Rules: []*armnetwork.AzureFirewallNatRule{ - { - Name: to.Ptr("DNAT-HTTPS-traffic"), - Description: to.Ptr("D-NAT all outbound web traffic for inspection"), - DestinationAddresses: []*string{ - to.Ptr("1.2.3.4")}, - DestinationPorts: []*string{ - to.Ptr("443")}, - Protocols: []*armnetwork.AzureFirewallNetworkRuleProtocol{ - to.Ptr(armnetwork.AzureFirewallNetworkRuleProtocolTCP)}, - SourceAddresses: []*string{ - to.Ptr("*")}, - TranslatedAddress: to.Ptr("1.2.3.5"), - TranslatedPort: to.Ptr("8443"), - }, - { - Name: to.Ptr("DNAT-HTTP-traffic-With-FQDN"), - Description: to.Ptr("D-NAT all inbound web traffic for inspection"), - DestinationAddresses: []*string{ - to.Ptr("1.2.3.4")}, - DestinationPorts: []*string{ - to.Ptr("80")}, - Protocols: []*armnetwork.AzureFirewallNetworkRuleProtocol{ - to.Ptr(armnetwork.AzureFirewallNetworkRuleProtocolTCP)}, - SourceAddresses: []*string{ - to.Ptr("*")}, - TranslatedFqdn: to.Ptr("internalhttpserver"), - TranslatedPort: to.Ptr("880"), - }}, - }, - }}, - NetworkRuleCollections: []*armnetwork.AzureFirewallNetworkRuleCollection{ - { - ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/azureFirewalls/azurefirewall/networkRuleCollections/netrulecoll"), - Name: to.Ptr("netrulecoll"), - Properties: &armnetwork.AzureFirewallNetworkRuleCollectionPropertiesFormat{ - Action: &armnetwork.AzureFirewallRCAction{ - Type: to.Ptr(armnetwork.AzureFirewallRCActionTypeDeny), - }, - Priority: to.Ptr[int32](112), - Rules: []*armnetwork.AzureFirewallNetworkRule{ - { - Name: to.Ptr("L4-traffic"), - Description: to.Ptr("Block traffic based on source IPs and ports"), - DestinationAddresses: []*string{ - to.Ptr("*")}, - DestinationPorts: []*string{ - to.Ptr("443-444"), - to.Ptr("8443")}, - Protocols: []*armnetwork.AzureFirewallNetworkRuleProtocol{ - to.Ptr(armnetwork.AzureFirewallNetworkRuleProtocolTCP)}, - SourceAddresses: []*string{ - to.Ptr("192.168.1.1-192.168.1.12"), - to.Ptr("10.1.4.12-10.1.4.255")}, - }, - { - Name: to.Ptr("L4-traffic-with-FQDN"), - Description: to.Ptr("Block traffic based on source IPs and ports to amazon"), - DestinationFqdns: []*string{ - to.Ptr("www.amazon.com")}, - DestinationPorts: []*string{ - to.Ptr("443-444"), - to.Ptr("8443")}, - Protocols: []*armnetwork.AzureFirewallNetworkRuleProtocol{ - to.Ptr(armnetwork.AzureFirewallNetworkRuleProtocolTCP)}, - SourceAddresses: []*string{ - to.Ptr("10.2.4.12-10.2.4.255")}, - }}, - }, - }}, - SKU: &armnetwork.AzureFirewallSKU{ - Name: to.Ptr(armnetwork.AzureFirewallSKUNameAZFWVnet), - Tier: to.Ptr(armnetwork.AzureFirewallSKUTierStandard), - }, - ThreatIntelMode: to.Ptr(armnetwork.AzureFirewallThreatIntelModeAlert), - }, - Zones: []*string{ - to.Ptr("1"), - to.Ptr("2"), - to.Ptr("3")}, - }, nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - res, err := poller.PollUntilDone(ctx, nil) - if err != nil { - log.Fatalf("failed to pull the result: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.AzureFirewall = armnetwork.AzureFirewall{ - // Name: to.Ptr("azurefirewall"), - // Type: to.Ptr("Microsoft.Network/azureFirewalls"), - // ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/azureFirewalls/azurefirewall"), - // Location: to.Ptr("West US 2"), - // Tags: map[string]*string{ - // "key1": to.Ptr("value1"), - // }, - // Etag: to.Ptr("w/\\00000000-0000-0000-0000-000000000000\\"), - // Properties: &armnetwork.AzureFirewallPropertiesFormat{ - // AdditionalProperties: map[string]*string{ - // }, - // ApplicationRuleCollections: []*armnetwork.AzureFirewallApplicationRuleCollection{ - // { - // ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/azureFirewalls/azurefirewall/applicationRuleCollections/apprulecoll"), - // Name: to.Ptr("apprulecoll"), - // Properties: &armnetwork.AzureFirewallApplicationRuleCollectionPropertiesFormat{ - // Action: &armnetwork.AzureFirewallRCAction{ - // Type: to.Ptr(armnetwork.AzureFirewallRCActionTypeDeny), - // }, - // Priority: to.Ptr[int32](110), - // Rules: []*armnetwork.AzureFirewallApplicationRule{ - // { - // Name: to.Ptr("rule1"), - // Description: to.Ptr("Deny inbound rule"), - // Protocols: []*armnetwork.AzureFirewallApplicationRuleProtocol{ - // { - // Port: to.Ptr[int32](443), - // ProtocolType: to.Ptr(armnetwork.AzureFirewallApplicationRuleProtocolTypeHTTPS), - // }}, - // SourceAddresses: []*string{ - // to.Ptr("216.58.216.164"), - // to.Ptr("10.0.0.0/24")}, - // TargetFqdns: []*string{ - // to.Ptr("www.test.com")}, - // }}, - // }, - // }}, - // IPConfigurations: []*armnetwork.AzureFirewallIPConfiguration{ - // { - // ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/azureFirewalls/azurefirewall/ipConfigurations/azureFirewallIpConfiguration"), - // Name: to.Ptr("azureFirewallIpConfiguration"), - // Etag: to.Ptr("w/\\00000000-0000-0000-0000-000000000000\\"), - // Properties: &armnetwork.AzureFirewallIPConfigurationPropertiesFormat{ - // PrivateIPAddress: to.Ptr("10.0.0.0"), - // ProvisioningState: to.Ptr(armnetwork.ProvisioningStateSucceeded), - // PublicIPAddress: &armnetwork.SubResource{ - // ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/publicIPAddresses/pipName"), - // }, - // Subnet: &armnetwork.SubResource{ - // ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/virtualNetworks/vnet2/subnets/AzureFirewallSubnet"), - // }, - // }, - // }}, - // IPGroups: []*armnetwork.AzureFirewallIPGroups{ - // }, - // NatRuleCollections: []*armnetwork.AzureFirewallNatRuleCollection{ - // { - // ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/azureFirewalls/azurefirewall/natRuleCollections/natrulecoll"), - // Name: to.Ptr("natrulecoll"), - // Properties: &armnetwork.AzureFirewallNatRuleCollectionProperties{ - // Action: &armnetwork.AzureFirewallNatRCAction{ - // Type: to.Ptr(armnetwork.AzureFirewallNatRCActionTypeDnat), - // }, - // Priority: to.Ptr[int32](112), - // Rules: []*armnetwork.AzureFirewallNatRule{ - // { - // Name: to.Ptr("DNAT-HTTPS-traffic"), - // Description: to.Ptr("D-NAT all outbound web traffic for inspection"), - // DestinationAddresses: []*string{ - // to.Ptr("1.2.3.4")}, - // DestinationPorts: []*string{ - // to.Ptr("443")}, - // Protocols: []*armnetwork.AzureFirewallNetworkRuleProtocol{ - // to.Ptr(armnetwork.AzureFirewallNetworkRuleProtocolTCP)}, - // SourceAddresses: []*string{ - // to.Ptr("*")}, - // TranslatedAddress: to.Ptr("1.2.3.5"), - // TranslatedPort: to.Ptr("8443"), - // }, - // { - // Name: to.Ptr("DNAT-HTTP-traffic-With-FQDN"), - // Description: to.Ptr("D-NAT all inbound web traffic for inspection"), - // DestinationAddresses: []*string{ - // to.Ptr("1.2.3.4")}, - // DestinationPorts: []*string{ - // to.Ptr("80")}, - // Protocols: []*armnetwork.AzureFirewallNetworkRuleProtocol{ - // to.Ptr(armnetwork.AzureFirewallNetworkRuleProtocolTCP)}, - // SourceAddresses: []*string{ - // to.Ptr("*")}, - // TranslatedFqdn: to.Ptr("internalhttpserver"), - // TranslatedPort: to.Ptr("880"), - // }}, - // }, - // }}, - // NetworkRuleCollections: []*armnetwork.AzureFirewallNetworkRuleCollection{ - // { - // ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/azureFirewalls/azurefirewall/networkRuleCollections/netrulecoll"), - // Name: to.Ptr("netrulecoll"), - // Properties: &armnetwork.AzureFirewallNetworkRuleCollectionPropertiesFormat{ - // Action: &armnetwork.AzureFirewallRCAction{ - // Type: to.Ptr(armnetwork.AzureFirewallRCActionTypeDeny), - // }, - // Priority: to.Ptr[int32](112), - // Rules: []*armnetwork.AzureFirewallNetworkRule{ - // { - // Name: to.Ptr("L4-traffic"), - // Description: to.Ptr("Block traffic based on source IPs and ports"), - // DestinationAddresses: []*string{ - // to.Ptr("*")}, - // DestinationPorts: []*string{ - // to.Ptr("443-444"), - // to.Ptr("8443")}, - // Protocols: []*armnetwork.AzureFirewallNetworkRuleProtocol{ - // to.Ptr(armnetwork.AzureFirewallNetworkRuleProtocolTCP)}, - // SourceAddresses: []*string{ - // to.Ptr("192.168.1.1-192.168.1.12"), - // to.Ptr("10.1.4.12-10.1.4.255")}, - // }, - // { - // Name: to.Ptr("L4-traffic-with-FQDN"), - // Description: to.Ptr("Block traffic based on source IPs and ports to amazon"), - // DestinationFqdns: []*string{ - // to.Ptr("www.amazon.com")}, - // DestinationPorts: []*string{ - // to.Ptr("443-444"), - // to.Ptr("8443")}, - // Protocols: []*armnetwork.AzureFirewallNetworkRuleProtocol{ - // to.Ptr(armnetwork.AzureFirewallNetworkRuleProtocolTCP)}, - // SourceAddresses: []*string{ - // to.Ptr("10.2.4.12-10.2.4.255")}, - // }}, - // }, - // }}, - // ProvisioningState: to.Ptr(armnetwork.ProvisioningStateSucceeded), - // SKU: &armnetwork.AzureFirewallSKU{ - // Name: to.Ptr(armnetwork.AzureFirewallSKUNameAZFWVnet), - // Tier: to.Ptr(armnetwork.AzureFirewallSKUTierStandard), - // }, - // ThreatIntelMode: to.Ptr(armnetwork.AzureFirewallThreatIntelModeAlert), - // }, - // Zones: []*string{ - // to.Ptr("1"), - // to.Ptr("2"), - // to.Ptr("3")}, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/4883fa5dbf6f2c9093fac8ce334547e9dfac68fa/specification/network/resource-manager/Microsoft.Network/stable/2024-03-01/examples/AzureFirewallPutWithMgmtSubnet.json -func ExampleAzureFirewallsClient_BeginCreateOrUpdate_createAzureFirewallWithManagementSubnet() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armnetwork.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewAzureFirewallsClient().BeginCreateOrUpdate(ctx, "rg1", "azurefirewall", armnetwork.AzureFirewall{ - Location: to.Ptr("West US"), - Tags: map[string]*string{ - "key1": to.Ptr("value1"), - }, - Properties: &armnetwork.AzureFirewallPropertiesFormat{ - ApplicationRuleCollections: []*armnetwork.AzureFirewallApplicationRuleCollection{ - { - ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/azureFirewalls/azurefirewall/applicationRuleCollections/apprulecoll"), - Name: to.Ptr("apprulecoll"), - Properties: &armnetwork.AzureFirewallApplicationRuleCollectionPropertiesFormat{ - Action: &armnetwork.AzureFirewallRCAction{ - Type: to.Ptr(armnetwork.AzureFirewallRCActionTypeDeny), - }, - Priority: to.Ptr[int32](110), - Rules: []*armnetwork.AzureFirewallApplicationRule{ - { - Name: to.Ptr("rule1"), - Description: to.Ptr("Deny inbound rule"), - Protocols: []*armnetwork.AzureFirewallApplicationRuleProtocol{ - { - Port: to.Ptr[int32](443), - ProtocolType: to.Ptr(armnetwork.AzureFirewallApplicationRuleProtocolTypeHTTPS), - }}, - SourceAddresses: []*string{ - to.Ptr("216.58.216.164"), - to.Ptr("10.0.0.0/24")}, - TargetFqdns: []*string{ - to.Ptr("www.test.com")}, - }}, - }, - }}, - IPConfigurations: []*armnetwork.AzureFirewallIPConfiguration{ - { - Name: to.Ptr("azureFirewallIpConfiguration"), - Properties: &armnetwork.AzureFirewallIPConfigurationPropertiesFormat{ - PublicIPAddress: &armnetwork.SubResource{ - ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/publicIPAddresses/pipName"), - }, - Subnet: &armnetwork.SubResource{ - ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/virtualNetworks/vnet2/subnets/AzureFirewallSubnet"), - }, - }, - }}, - ManagementIPConfiguration: &armnetwork.AzureFirewallIPConfiguration{ - Name: to.Ptr("azureFirewallMgmtIpConfiguration"), - Properties: &armnetwork.AzureFirewallIPConfigurationPropertiesFormat{ - PublicIPAddress: &armnetwork.SubResource{ - ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/publicIPAddresses/managementPipName"), - }, - Subnet: &armnetwork.SubResource{ - ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/virtualNetworks/vnet2/subnets/AzureFirewallManagementSubnet"), - }, - }, - }, - NatRuleCollections: []*armnetwork.AzureFirewallNatRuleCollection{ - { - ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/azureFirewalls/azurefirewall/natRuleCollections/natrulecoll"), - Name: to.Ptr("natrulecoll"), - Properties: &armnetwork.AzureFirewallNatRuleCollectionProperties{ - Action: &armnetwork.AzureFirewallNatRCAction{ - Type: to.Ptr(armnetwork.AzureFirewallNatRCActionTypeDnat), - }, - Priority: to.Ptr[int32](112), - Rules: []*armnetwork.AzureFirewallNatRule{ - { - Name: to.Ptr("DNAT-HTTPS-traffic"), - Description: to.Ptr("D-NAT all outbound web traffic for inspection"), - DestinationAddresses: []*string{ - to.Ptr("1.2.3.4")}, - DestinationPorts: []*string{ - to.Ptr("443")}, - Protocols: []*armnetwork.AzureFirewallNetworkRuleProtocol{ - to.Ptr(armnetwork.AzureFirewallNetworkRuleProtocolTCP)}, - SourceAddresses: []*string{ - to.Ptr("*")}, - TranslatedAddress: to.Ptr("1.2.3.5"), - TranslatedPort: to.Ptr("8443"), - }, - { - Name: to.Ptr("DNAT-HTTP-traffic-With-FQDN"), - Description: to.Ptr("D-NAT all inbound web traffic for inspection"), - DestinationAddresses: []*string{ - to.Ptr("1.2.3.4")}, - DestinationPorts: []*string{ - to.Ptr("80")}, - Protocols: []*armnetwork.AzureFirewallNetworkRuleProtocol{ - to.Ptr(armnetwork.AzureFirewallNetworkRuleProtocolTCP)}, - SourceAddresses: []*string{ - to.Ptr("*")}, - TranslatedFqdn: to.Ptr("internalhttpserver"), - TranslatedPort: to.Ptr("880"), - }}, - }, - }}, - NetworkRuleCollections: []*armnetwork.AzureFirewallNetworkRuleCollection{ - { - ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/azureFirewalls/azurefirewall/networkRuleCollections/netrulecoll"), - Name: to.Ptr("netrulecoll"), - Properties: &armnetwork.AzureFirewallNetworkRuleCollectionPropertiesFormat{ - Action: &armnetwork.AzureFirewallRCAction{ - Type: to.Ptr(armnetwork.AzureFirewallRCActionTypeDeny), - }, - Priority: to.Ptr[int32](112), - Rules: []*armnetwork.AzureFirewallNetworkRule{ - { - Name: to.Ptr("L4-traffic"), - Description: to.Ptr("Block traffic based on source IPs and ports"), - DestinationAddresses: []*string{ - to.Ptr("*")}, - DestinationPorts: []*string{ - to.Ptr("443-444"), - to.Ptr("8443")}, - Protocols: []*armnetwork.AzureFirewallNetworkRuleProtocol{ - to.Ptr(armnetwork.AzureFirewallNetworkRuleProtocolTCP)}, - SourceAddresses: []*string{ - to.Ptr("192.168.1.1-192.168.1.12"), - to.Ptr("10.1.4.12-10.1.4.255")}, - }, - { - Name: to.Ptr("L4-traffic-with-FQDN"), - Description: to.Ptr("Block traffic based on source IPs and ports to amazon"), - DestinationFqdns: []*string{ - to.Ptr("www.amazon.com")}, - DestinationPorts: []*string{ - to.Ptr("443-444"), - to.Ptr("8443")}, - Protocols: []*armnetwork.AzureFirewallNetworkRuleProtocol{ - to.Ptr(armnetwork.AzureFirewallNetworkRuleProtocolTCP)}, - SourceAddresses: []*string{ - to.Ptr("10.2.4.12-10.2.4.255")}, - }}, - }, - }}, - SKU: &armnetwork.AzureFirewallSKU{ - Name: to.Ptr(armnetwork.AzureFirewallSKUNameAZFWVnet), - Tier: to.Ptr(armnetwork.AzureFirewallSKUTierStandard), - }, - ThreatIntelMode: to.Ptr(armnetwork.AzureFirewallThreatIntelModeAlert), - }, - Zones: []*string{}, - }, nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - res, err := poller.PollUntilDone(ctx, nil) - if err != nil { - log.Fatalf("failed to pull the result: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.AzureFirewall = armnetwork.AzureFirewall{ - // Name: to.Ptr("azurefirewall"), - // Type: to.Ptr("Microsoft.Network/azureFirewalls"), - // ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/azureFirewalls/azurefirewall"), - // Location: to.Ptr("West US"), - // Tags: map[string]*string{ - // "key1": to.Ptr("value1"), - // }, - // Etag: to.Ptr("w/\\00000000-0000-0000-0000-000000000000\\"), - // Properties: &armnetwork.AzureFirewallPropertiesFormat{ - // AdditionalProperties: map[string]*string{ - // }, - // ApplicationRuleCollections: []*armnetwork.AzureFirewallApplicationRuleCollection{ - // { - // ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/azureFirewalls/azurefirewall/applicationRuleCollections/apprulecoll"), - // Name: to.Ptr("apprulecoll"), - // Properties: &armnetwork.AzureFirewallApplicationRuleCollectionPropertiesFormat{ - // Action: &armnetwork.AzureFirewallRCAction{ - // Type: to.Ptr(armnetwork.AzureFirewallRCActionTypeDeny), - // }, - // Priority: to.Ptr[int32](110), - // Rules: []*armnetwork.AzureFirewallApplicationRule{ - // { - // Name: to.Ptr("rule1"), - // Description: to.Ptr("Deny inbound rule"), - // Protocols: []*armnetwork.AzureFirewallApplicationRuleProtocol{ - // { - // Port: to.Ptr[int32](443), - // ProtocolType: to.Ptr(armnetwork.AzureFirewallApplicationRuleProtocolTypeHTTPS), - // }}, - // SourceAddresses: []*string{ - // to.Ptr("216.58.216.164"), - // to.Ptr("10.0.0.0/24")}, - // TargetFqdns: []*string{ - // to.Ptr("www.test.com")}, - // }}, - // }, - // }}, - // IPConfigurations: []*armnetwork.AzureFirewallIPConfiguration{ - // { - // ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/azureFirewalls/azurefirewall/ipConfigurations/azureFirewallIpConfiguration"), - // Name: to.Ptr("azureFirewallIpConfiguration"), - // Etag: to.Ptr("w/\\00000000-0000-0000-0000-000000000000\\"), - // Properties: &armnetwork.AzureFirewallIPConfigurationPropertiesFormat{ - // PrivateIPAddress: to.Ptr("10.0.0.0"), - // ProvisioningState: to.Ptr(armnetwork.ProvisioningStateSucceeded), - // PublicIPAddress: &armnetwork.SubResource{ - // ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/publicIPAddresses/pipName"), - // }, - // Subnet: &armnetwork.SubResource{ - // ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/virtualNetworks/vnet2/subnets/AzureFirewallSubnet"), - // }, - // }, - // }}, - // NatRuleCollections: []*armnetwork.AzureFirewallNatRuleCollection{ - // { - // ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/azureFirewalls/azurefirewall/natRuleCollections/natrulecoll"), - // Name: to.Ptr("natrulecoll"), - // Properties: &armnetwork.AzureFirewallNatRuleCollectionProperties{ - // Action: &armnetwork.AzureFirewallNatRCAction{ - // Type: to.Ptr(armnetwork.AzureFirewallNatRCActionTypeDnat), - // }, - // Priority: to.Ptr[int32](112), - // Rules: []*armnetwork.AzureFirewallNatRule{ - // { - // Name: to.Ptr("DNAT-HTTPS-traffic"), - // Description: to.Ptr("D-NAT all outbound web traffic for inspection"), - // DestinationAddresses: []*string{ - // to.Ptr("1.2.3.4")}, - // DestinationPorts: []*string{ - // to.Ptr("443")}, - // Protocols: []*armnetwork.AzureFirewallNetworkRuleProtocol{ - // to.Ptr(armnetwork.AzureFirewallNetworkRuleProtocolTCP)}, - // SourceAddresses: []*string{ - // to.Ptr("*")}, - // TranslatedAddress: to.Ptr("1.2.3.5"), - // TranslatedPort: to.Ptr("8443"), - // }, - // { - // Name: to.Ptr("DNAT-HTTP-traffic-With-FQDN"), - // Description: to.Ptr("D-NAT all inbound web traffic for inspection"), - // DestinationAddresses: []*string{ - // to.Ptr("1.2.3.4")}, - // DestinationPorts: []*string{ - // to.Ptr("80")}, - // Protocols: []*armnetwork.AzureFirewallNetworkRuleProtocol{ - // to.Ptr(armnetwork.AzureFirewallNetworkRuleProtocolTCP)}, - // SourceAddresses: []*string{ - // to.Ptr("*")}, - // TranslatedFqdn: to.Ptr("internalhttpserver"), - // TranslatedPort: to.Ptr("880"), - // }}, - // }, - // }}, - // NetworkRuleCollections: []*armnetwork.AzureFirewallNetworkRuleCollection{ - // { - // ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/azureFirewalls/azurefirewall/networkRuleCollections/netrulecoll"), - // Name: to.Ptr("netrulecoll"), - // Properties: &armnetwork.AzureFirewallNetworkRuleCollectionPropertiesFormat{ - // Action: &armnetwork.AzureFirewallRCAction{ - // Type: to.Ptr(armnetwork.AzureFirewallRCActionTypeDeny), - // }, - // Priority: to.Ptr[int32](112), - // Rules: []*armnetwork.AzureFirewallNetworkRule{ - // { - // Name: to.Ptr("L4-traffic"), - // Description: to.Ptr("Block traffic based on source IPs and ports"), - // DestinationAddresses: []*string{ - // to.Ptr("*")}, - // DestinationPorts: []*string{ - // to.Ptr("443-444"), - // to.Ptr("8443")}, - // Protocols: []*armnetwork.AzureFirewallNetworkRuleProtocol{ - // to.Ptr(armnetwork.AzureFirewallNetworkRuleProtocolTCP)}, - // SourceAddresses: []*string{ - // to.Ptr("192.168.1.1-192.168.1.12"), - // to.Ptr("10.1.4.12-10.1.4.255")}, - // }, - // { - // Name: to.Ptr("L4-traffic-with-FQDN"), - // Description: to.Ptr("Block traffic based on source IPs and ports to amazon"), - // DestinationFqdns: []*string{ - // to.Ptr("www.amazon.com")}, - // DestinationPorts: []*string{ - // to.Ptr("443-444"), - // to.Ptr("8443")}, - // Protocols: []*armnetwork.AzureFirewallNetworkRuleProtocol{ - // to.Ptr(armnetwork.AzureFirewallNetworkRuleProtocolTCP)}, - // SourceAddresses: []*string{ - // to.Ptr("10.2.4.12-10.2.4.255")}, - // }}, - // }, - // }}, - // ProvisioningState: to.Ptr(armnetwork.ProvisioningStateSucceeded), - // SKU: &armnetwork.AzureFirewallSKU{ - // Name: to.Ptr(armnetwork.AzureFirewallSKUNameAZFWVnet), - // Tier: to.Ptr(armnetwork.AzureFirewallSKUTierStandard), - // }, - // ThreatIntelMode: to.Ptr(armnetwork.AzureFirewallThreatIntelModeAlert), - // }, - // Zones: []*string{ - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/4883fa5dbf6f2c9093fac8ce334547e9dfac68fa/specification/network/resource-manager/Microsoft.Network/stable/2024-03-01/examples/AzureFirewallPutInHub.json -func ExampleAzureFirewallsClient_BeginCreateOrUpdate_createAzureFirewallInVirtualHub() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armnetwork.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewAzureFirewallsClient().BeginCreateOrUpdate(ctx, "rg1", "azurefirewall", armnetwork.AzureFirewall{ - Location: to.Ptr("West US"), - Tags: map[string]*string{ - "key1": to.Ptr("value1"), - }, - Properties: &armnetwork.AzureFirewallPropertiesFormat{ - FirewallPolicy: &armnetwork.SubResource{ - ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/firewallPolicies/policy1"), - }, - HubIPAddresses: &armnetwork.HubIPAddresses{ - PublicIPs: &armnetwork.HubPublicIPAddresses{ - Addresses: []*armnetwork.AzureFirewallPublicIPAddress{}, - Count: to.Ptr[int32](1), - }, - }, - SKU: &armnetwork.AzureFirewallSKU{ - Name: to.Ptr(armnetwork.AzureFirewallSKUNameAZFWHub), - Tier: to.Ptr(armnetwork.AzureFirewallSKUTierStandard), - }, - ThreatIntelMode: to.Ptr(armnetwork.AzureFirewallThreatIntelModeAlert), - VirtualHub: &armnetwork.SubResource{ - ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/virtualHubs/hub1"), - }, - }, - Zones: []*string{}, - }, nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - res, err := poller.PollUntilDone(ctx, nil) - if err != nil { - log.Fatalf("failed to pull the result: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.AzureFirewall = armnetwork.AzureFirewall{ - // Name: to.Ptr("azurefirewall"), - // Type: to.Ptr("Microsoft.Network/azureFirewalls"), - // ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/azureFirewalls/azurefirewall"), - // Location: to.Ptr("West US"), - // Tags: map[string]*string{ - // "key1": to.Ptr("value1"), - // }, - // Etag: to.Ptr("w/\\00000000-0000-0000-0000-000000000000\\"), - // Properties: &armnetwork.AzureFirewallPropertiesFormat{ - // AdditionalProperties: map[string]*string{ - // }, - // FirewallPolicy: &armnetwork.SubResource{ - // ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/firewallPolicies/policy1"), - // }, - // HubIPAddresses: &armnetwork.HubIPAddresses{ - // PrivateIPAddress: to.Ptr("10.0.0.0"), - // PublicIPs: &armnetwork.HubPublicIPAddresses{ - // Addresses: []*armnetwork.AzureFirewallPublicIPAddress{ - // { - // Address: to.Ptr("13.73.240.12"), - // }}, - // Count: to.Ptr[int32](1), - // }, - // }, - // ProvisioningState: to.Ptr(armnetwork.ProvisioningStateSucceeded), - // SKU: &armnetwork.AzureFirewallSKU{ - // Name: to.Ptr(armnetwork.AzureFirewallSKUNameAZFWHub), - // Tier: to.Ptr(armnetwork.AzureFirewallSKUTierStandard), - // }, - // ThreatIntelMode: to.Ptr(armnetwork.AzureFirewallThreatIntelModeAlert), - // VirtualHub: &armnetwork.SubResource{ - // ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/virtualHubs/hub1"), - // }, - // }, - // Zones: []*string{ - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/4883fa5dbf6f2c9093fac8ce334547e9dfac68fa/specification/network/resource-manager/Microsoft.Network/stable/2024-03-01/examples/AzureFirewallUpdateTags.json -func ExampleAzureFirewallsClient_BeginUpdateTags() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armnetwork.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewAzureFirewallsClient().BeginUpdateTags(ctx, "azfwtest", "fw1", armnetwork.TagsObject{ - Tags: map[string]*string{ - "tag1": to.Ptr("value1"), - "tag2": to.Ptr("value2"), - }, - }, nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - res, err := poller.PollUntilDone(ctx, nil) - if err != nil { - log.Fatalf("failed to pull the result: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.AzureFirewall = armnetwork.AzureFirewall{ - // Name: to.Ptr("fw1"), - // Type: to.Ptr("Microsoft.Network/azureFirewalls"), - // ID: to.Ptr("/subscriptions/subid/resourceGroups/azfwtest/providers/Microsoft.Network/azureFirewalls/fw1"), - // Location: to.Ptr("brazilsouth"), - // Tags: map[string]*string{ - // "tag1": to.Ptr("value1"), - // "tag2": to.Ptr("value2"), - // }, - // Properties: &armnetwork.AzureFirewallPropertiesFormat{ - // ProvisioningState: to.Ptr(armnetwork.ProvisioningStateSucceeded), - // ThreatIntelMode: to.Ptr(armnetwork.AzureFirewallThreatIntelModeAlert), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/4883fa5dbf6f2c9093fac8ce334547e9dfac68fa/specification/network/resource-manager/Microsoft.Network/stable/2024-03-01/examples/AzureFirewallListByResourceGroup.json -func ExampleAzureFirewallsClient_NewListPager() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armnetwork.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := clientFactory.NewAzureFirewallsClient().NewListPager("rg1", nil) - for pager.More() { - page, err := pager.NextPage(ctx) - if err != nil { - log.Fatalf("failed to advance page: %v", err) - } - for _, v := range page.Value { - // You could use page here. We use blank identifier for just demo purposes. - _ = v - } - // If the HTTP response code is 200 as defined in example definition, your page structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // page.AzureFirewallListResult = armnetwork.AzureFirewallListResult{ - // Value: []*armnetwork.AzureFirewall{ - // { - // Name: to.Ptr("azurefirewall"), - // Type: to.Ptr("Microsoft.Network/azureFirewalls"), - // ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/azureFirewalls/azurefirewall"), - // Location: to.Ptr("West US"), - // Tags: map[string]*string{ - // "key1": to.Ptr("value1"), - // }, - // Etag: to.Ptr("w/\\00000000-0000-0000-0000-000000000000\\"), - // Properties: &armnetwork.AzureFirewallPropertiesFormat{ - // AdditionalProperties: map[string]*string{ - // "key1": to.Ptr("value1"), - // "key2": to.Ptr("value2"), - // }, - // ApplicationRuleCollections: []*armnetwork.AzureFirewallApplicationRuleCollection{ - // { - // ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/azureFirewalls/azurefirewall/applicationRuleCollections/apprulecoll"), - // Name: to.Ptr("apprulecoll"), - // Properties: &armnetwork.AzureFirewallApplicationRuleCollectionPropertiesFormat{ - // Action: &armnetwork.AzureFirewallRCAction{ - // Type: to.Ptr(armnetwork.AzureFirewallRCActionTypeDeny), - // }, - // Priority: to.Ptr[int32](110), - // Rules: []*armnetwork.AzureFirewallApplicationRule{ - // { - // Name: to.Ptr("rule1"), - // Description: to.Ptr("Deny inbound rule"), - // Protocols: []*armnetwork.AzureFirewallApplicationRuleProtocol{ - // { - // Port: to.Ptr[int32](443), - // ProtocolType: to.Ptr(armnetwork.AzureFirewallApplicationRuleProtocolTypeHTTPS), - // }}, - // SourceAddresses: []*string{ - // to.Ptr("216.58.216.164"), - // to.Ptr("10.0.0.0/24")}, - // TargetFqdns: []*string{ - // to.Ptr("www.test.com")}, - // }}, - // }, - // }}, - // IPConfigurations: []*armnetwork.AzureFirewallIPConfiguration{ - // { - // ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/azureFirewalls/azurefirewall/ipConfigurations/azureFirewallIpConfiguration"), - // Name: to.Ptr("azureFirewallIpConfiguration"), - // Etag: to.Ptr("w/\\00000000-0000-0000-0000-000000000000\\"), - // Properties: &armnetwork.AzureFirewallIPConfigurationPropertiesFormat{ - // PrivateIPAddress: to.Ptr("10.0.0.0"), - // ProvisioningState: to.Ptr(armnetwork.ProvisioningStateSucceeded), - // PublicIPAddress: &armnetwork.SubResource{ - // ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/publicIPAddresses/pipName"), - // }, - // Subnet: &armnetwork.SubResource{ - // ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/virtualNetworks/vnet2/subnets/AzureFirewallSubnet"), - // }, - // }, - // }}, - // IPGroups: []*armnetwork.AzureFirewallIPGroups{ - // }, - // ManagementIPConfiguration: &armnetwork.AzureFirewallIPConfiguration{ - // ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/azureFirewalls/azurefirewall/ipConfigurations/azureFirewallMgmtIpConfiguration"), - // Name: to.Ptr("azureFirewallMgmtIpConfiguration"), - // Etag: to.Ptr("w/\\00000000-0000-0000-0000-000000000000\\"), - // Properties: &armnetwork.AzureFirewallIPConfigurationPropertiesFormat{ - // ProvisioningState: to.Ptr(armnetwork.ProvisioningStateSucceeded), - // PublicIPAddress: &armnetwork.SubResource{ - // ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/publicIPAddresses/managementPipName"), - // }, - // Subnet: &armnetwork.SubResource{ - // ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/virtualNetworks/vnet2/subnets/AzureFirewallManagementSubnet"), - // }, - // }, - // }, - // NatRuleCollections: []*armnetwork.AzureFirewallNatRuleCollection{ - // { - // ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/azureFirewalls/azurefirewall/natRuleCollections/natrulecoll"), - // Name: to.Ptr("natrulecoll"), - // Properties: &armnetwork.AzureFirewallNatRuleCollectionProperties{ - // Action: &armnetwork.AzureFirewallNatRCAction{ - // Type: to.Ptr(armnetwork.AzureFirewallNatRCActionTypeDnat), - // }, - // Priority: to.Ptr[int32](112), - // Rules: []*armnetwork.AzureFirewallNatRule{ - // { - // Name: to.Ptr("DNAT-HTTPS-traffic"), - // Description: to.Ptr("D-NAT all outbound web traffic for inspection"), - // DestinationAddresses: []*string{ - // to.Ptr("1.2.3.4")}, - // DestinationPorts: []*string{ - // to.Ptr("443")}, - // Protocols: []*armnetwork.AzureFirewallNetworkRuleProtocol{ - // to.Ptr(armnetwork.AzureFirewallNetworkRuleProtocolTCP)}, - // SourceAddresses: []*string{ - // to.Ptr("*")}, - // TranslatedAddress: to.Ptr("1.2.3.5"), - // TranslatedPort: to.Ptr("8443"), - // }, - // { - // Name: to.Ptr("DNAT-HTTP-traffic-With-FQDN"), - // Description: to.Ptr("D-NAT all inbound web traffic for inspection"), - // DestinationAddresses: []*string{ - // to.Ptr("1.2.3.4")}, - // DestinationPorts: []*string{ - // to.Ptr("80")}, - // Protocols: []*armnetwork.AzureFirewallNetworkRuleProtocol{ - // to.Ptr(armnetwork.AzureFirewallNetworkRuleProtocolTCP)}, - // SourceAddresses: []*string{ - // to.Ptr("*")}, - // TranslatedFqdn: to.Ptr("internalhttpserver"), - // TranslatedPort: to.Ptr("880"), - // }}, - // }, - // }}, - // NetworkRuleCollections: []*armnetwork.AzureFirewallNetworkRuleCollection{ - // { - // ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/azureFirewalls/azurefirewall/networkRuleCollections/netrulecoll"), - // Name: to.Ptr("netrulecoll"), - // Properties: &armnetwork.AzureFirewallNetworkRuleCollectionPropertiesFormat{ - // Action: &armnetwork.AzureFirewallRCAction{ - // Type: to.Ptr(armnetwork.AzureFirewallRCActionTypeDeny), - // }, - // Priority: to.Ptr[int32](112), - // Rules: []*armnetwork.AzureFirewallNetworkRule{ - // { - // Name: to.Ptr("L4-traffic"), - // Description: to.Ptr("Block traffic based on source IPs and ports"), - // DestinationAddresses: []*string{ - // to.Ptr("*")}, - // DestinationPorts: []*string{ - // to.Ptr("443-444"), - // to.Ptr("8443")}, - // Protocols: []*armnetwork.AzureFirewallNetworkRuleProtocol{ - // to.Ptr(armnetwork.AzureFirewallNetworkRuleProtocolTCP)}, - // SourceAddresses: []*string{ - // to.Ptr("192.168.1.1-192.168.1.12"), - // to.Ptr("10.1.4.12-10.1.4.255")}, - // }, - // { - // Name: to.Ptr("L4-traffic-with-FQDN"), - // Description: to.Ptr("Block traffic based on source IPs and ports to amazon"), - // DestinationFqdns: []*string{ - // to.Ptr("www.amazon.com")}, - // DestinationPorts: []*string{ - // to.Ptr("443-444"), - // to.Ptr("8443")}, - // Protocols: []*armnetwork.AzureFirewallNetworkRuleProtocol{ - // to.Ptr(armnetwork.AzureFirewallNetworkRuleProtocolTCP)}, - // SourceAddresses: []*string{ - // to.Ptr("10.2.4.12-10.2.4.255")}, - // }}, - // }, - // }}, - // ProvisioningState: to.Ptr(armnetwork.ProvisioningStateSucceeded), - // ThreatIntelMode: to.Ptr(armnetwork.AzureFirewallThreatIntelModeAlert), - // }, - // Zones: []*string{ - // }, - // }}, - // } - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/4883fa5dbf6f2c9093fac8ce334547e9dfac68fa/specification/network/resource-manager/Microsoft.Network/stable/2024-03-01/examples/AzureFirewallListBySubscription.json -func ExampleAzureFirewallsClient_NewListAllPager() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armnetwork.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := clientFactory.NewAzureFirewallsClient().NewListAllPager(nil) - for pager.More() { - page, err := pager.NextPage(ctx) - if err != nil { - log.Fatalf("failed to advance page: %v", err) - } - for _, v := range page.Value { - // You could use page here. We use blank identifier for just demo purposes. - _ = v - } - // If the HTTP response code is 200 as defined in example definition, your page structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // page.AzureFirewallListResult = armnetwork.AzureFirewallListResult{ - // Value: []*armnetwork.AzureFirewall{ - // { - // Name: to.Ptr("azurefirewall"), - // Type: to.Ptr("Microsoft.Network/azureFirewalls"), - // ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/azureFirewalls/azurefirewall"), - // Location: to.Ptr("West US"), - // Tags: map[string]*string{ - // "key1": to.Ptr("value1"), - // }, - // Etag: to.Ptr("w/\\00000000-0000-0000-0000-000000000000\\"), - // Properties: &armnetwork.AzureFirewallPropertiesFormat{ - // AdditionalProperties: map[string]*string{ - // "key1": to.Ptr("value1"), - // "key2": to.Ptr("value2"), - // }, - // ApplicationRuleCollections: []*armnetwork.AzureFirewallApplicationRuleCollection{ - // { - // ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/azureFirewalls/azurefirewall/applicationRuleCollections/apprulecoll"), - // Name: to.Ptr("apprulecoll"), - // Properties: &armnetwork.AzureFirewallApplicationRuleCollectionPropertiesFormat{ - // Action: &armnetwork.AzureFirewallRCAction{ - // Type: to.Ptr(armnetwork.AzureFirewallRCActionTypeDeny), - // }, - // Priority: to.Ptr[int32](110), - // Rules: []*armnetwork.AzureFirewallApplicationRule{ - // { - // Name: to.Ptr("rule1"), - // Description: to.Ptr("Deny inbound rule"), - // Protocols: []*armnetwork.AzureFirewallApplicationRuleProtocol{ - // { - // Port: to.Ptr[int32](443), - // ProtocolType: to.Ptr(armnetwork.AzureFirewallApplicationRuleProtocolTypeHTTPS), - // }}, - // SourceAddresses: []*string{ - // to.Ptr("216.58.216.164"), - // to.Ptr("10.0.0.0/24")}, - // TargetFqdns: []*string{ - // to.Ptr("www.test.com")}, - // }}, - // }, - // }}, - // IPConfigurations: []*armnetwork.AzureFirewallIPConfiguration{ - // { - // ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/azureFirewalls/azurefirewall/ipConfigurations/azureFirewallIpConfiguration"), - // Name: to.Ptr("azureFirewallIpConfiguration"), - // Etag: to.Ptr("w/\\00000000-0000-0000-0000-000000000000\\"), - // Properties: &armnetwork.AzureFirewallIPConfigurationPropertiesFormat{ - // PrivateIPAddress: to.Ptr("10.0.0.0"), - // ProvisioningState: to.Ptr(armnetwork.ProvisioningStateSucceeded), - // PublicIPAddress: &armnetwork.SubResource{ - // ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/publicIPAddresses/pipName"), - // }, - // Subnet: &armnetwork.SubResource{ - // ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/virtualNetworks/vnet2/subnets/AzureFirewallSubnet"), - // }, - // }, - // }}, - // IPGroups: []*armnetwork.AzureFirewallIPGroups{ - // }, - // ManagementIPConfiguration: &armnetwork.AzureFirewallIPConfiguration{ - // ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/azureFirewalls/azurefirewall/ipConfigurations/azureFirewallMgmtIpConfiguration"), - // Name: to.Ptr("azureFirewallMgmtIpConfiguration"), - // Etag: to.Ptr("w/\\00000000-0000-0000-0000-000000000000\\"), - // Properties: &armnetwork.AzureFirewallIPConfigurationPropertiesFormat{ - // ProvisioningState: to.Ptr(armnetwork.ProvisioningStateSucceeded), - // PublicIPAddress: &armnetwork.SubResource{ - // ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/publicIPAddresses/managementPipName"), - // }, - // Subnet: &armnetwork.SubResource{ - // ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/virtualNetworks/vnet2/subnets/AzureFirewallManagementSubnet"), - // }, - // }, - // }, - // NatRuleCollections: []*armnetwork.AzureFirewallNatRuleCollection{ - // { - // ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/azureFirewalls/azurefirewall/natRuleCollections/natrulecoll"), - // Name: to.Ptr("natrulecoll"), - // Properties: &armnetwork.AzureFirewallNatRuleCollectionProperties{ - // Action: &armnetwork.AzureFirewallNatRCAction{ - // Type: to.Ptr(armnetwork.AzureFirewallNatRCActionTypeDnat), - // }, - // Priority: to.Ptr[int32](112), - // Rules: []*armnetwork.AzureFirewallNatRule{ - // { - // Name: to.Ptr("DNAT-HTTPS-traffic"), - // Description: to.Ptr("D-NAT all outbound web traffic for inspection"), - // DestinationAddresses: []*string{ - // to.Ptr("1.2.3.4")}, - // DestinationPorts: []*string{ - // to.Ptr("443")}, - // Protocols: []*armnetwork.AzureFirewallNetworkRuleProtocol{ - // to.Ptr(armnetwork.AzureFirewallNetworkRuleProtocolTCP)}, - // SourceAddresses: []*string{ - // to.Ptr("*")}, - // TranslatedAddress: to.Ptr("1.2.3.5"), - // TranslatedPort: to.Ptr("8443"), - // }, - // { - // Name: to.Ptr("DNAT-HTTP-traffic-With-FQDN"), - // Description: to.Ptr("D-NAT all inbound web traffic for inspection"), - // DestinationAddresses: []*string{ - // to.Ptr("1.2.3.4")}, - // DestinationPorts: []*string{ - // to.Ptr("80")}, - // Protocols: []*armnetwork.AzureFirewallNetworkRuleProtocol{ - // to.Ptr(armnetwork.AzureFirewallNetworkRuleProtocolTCP)}, - // SourceAddresses: []*string{ - // to.Ptr("*")}, - // TranslatedFqdn: to.Ptr("internalhttpserver"), - // TranslatedPort: to.Ptr("880"), - // }}, - // }, - // }}, - // NetworkRuleCollections: []*armnetwork.AzureFirewallNetworkRuleCollection{ - // { - // ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/azureFirewalls/azurefirewall/networkRuleCollections/netrulecoll"), - // Name: to.Ptr("netrulecoll"), - // Properties: &armnetwork.AzureFirewallNetworkRuleCollectionPropertiesFormat{ - // Action: &armnetwork.AzureFirewallRCAction{ - // Type: to.Ptr(armnetwork.AzureFirewallRCActionTypeDeny), - // }, - // Priority: to.Ptr[int32](112), - // Rules: []*armnetwork.AzureFirewallNetworkRule{ - // { - // Name: to.Ptr("L4-traffic"), - // Description: to.Ptr("Block traffic based on source IPs and ports"), - // DestinationAddresses: []*string{ - // to.Ptr("*")}, - // DestinationPorts: []*string{ - // to.Ptr("443-444"), - // to.Ptr("8443")}, - // Protocols: []*armnetwork.AzureFirewallNetworkRuleProtocol{ - // to.Ptr(armnetwork.AzureFirewallNetworkRuleProtocolTCP)}, - // SourceAddresses: []*string{ - // to.Ptr("192.168.1.1-192.168.1.12"), - // to.Ptr("10.1.4.12-10.1.4.255")}, - // }, - // { - // Name: to.Ptr("L4-traffic-with-FQDN"), - // Description: to.Ptr("Block traffic based on source IPs and ports to amazon"), - // DestinationFqdns: []*string{ - // to.Ptr("www.amazon.com")}, - // DestinationPorts: []*string{ - // to.Ptr("443-444"), - // to.Ptr("8443")}, - // Protocols: []*armnetwork.AzureFirewallNetworkRuleProtocol{ - // to.Ptr(armnetwork.AzureFirewallNetworkRuleProtocolTCP)}, - // SourceAddresses: []*string{ - // to.Ptr("10.2.4.12-10.2.4.255")}, - // }}, - // }, - // }}, - // ProvisioningState: to.Ptr(armnetwork.ProvisioningStateSucceeded), - // ThreatIntelMode: to.Ptr(armnetwork.AzureFirewallThreatIntelModeAlert), - // }, - // Zones: []*string{ - // }, - // }}, - // } - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/4883fa5dbf6f2c9093fac8ce334547e9dfac68fa/specification/network/resource-manager/Microsoft.Network/stable/2024-03-01/examples/AzureFirewallListLearnedIPPrefixes.json -func ExampleAzureFirewallsClient_BeginListLearnedPrefixes() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armnetwork.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewAzureFirewallsClient().BeginListLearnedPrefixes(ctx, "rg1", "azureFirewall1", nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - res, err := poller.PollUntilDone(ctx, nil) - if err != nil { - log.Fatalf("failed to pull the result: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.IPPrefixesList = armnetwork.IPPrefixesList{ - // IPPrefixes: []*string{ - // to.Ptr("10.101.0.0/16"), - // to.Ptr("10.102.0.0/16")}, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/4883fa5dbf6f2c9093fac8ce334547e9dfac68fa/specification/network/resource-manager/Microsoft.Network/stable/2024-03-01/examples/AzureFirewallPacketCapture.json -func ExampleAzureFirewallsClient_BeginPacketCapture() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armnetwork.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewAzureFirewallsClient().BeginPacketCapture(ctx, "rg1", "azureFirewall1", armnetwork.FirewallPacketCaptureParameters{ - DurationInSeconds: to.Ptr[int32](300), - FileName: to.Ptr("azureFirewallPacketCapture"), - Filters: []*armnetwork.AzureFirewallPacketCaptureRule{ - { - DestinationPorts: []*string{ - to.Ptr("4500")}, - Destinations: []*string{ - to.Ptr("20.1.2.0")}, - Sources: []*string{ - to.Ptr("20.1.1.0")}, - }, - { - DestinationPorts: []*string{ - to.Ptr("123"), - to.Ptr("80")}, - Destinations: []*string{ - to.Ptr("10.1.2.0")}, - Sources: []*string{ - to.Ptr("10.1.1.0"), - to.Ptr("10.1.1.1")}, - }}, - Flags: []*armnetwork.AzureFirewallPacketCaptureFlags{ - { - Type: to.Ptr(armnetwork.AzureFirewallPacketCaptureFlagsTypeSyn), - }, - { - Type: to.Ptr(armnetwork.AzureFirewallPacketCaptureFlagsTypeFin), - }}, - NumberOfPacketsToCapture: to.Ptr[int32](5000), - SasURL: to.Ptr("someSASURL"), - Protocol: to.Ptr(armnetwork.AzureFirewallNetworkRuleProtocolAny), - }, nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - _, err = poller.PollUntilDone(ctx, nil) - if err != nil { - log.Fatalf("failed to pull the result: %v", err) - } -} diff --git a/sdk/resourcemanager/network/armnetwork/bastionhosts_client_example_test.go b/sdk/resourcemanager/network/armnetwork/bastionhosts_client_example_test.go deleted file mode 100644 index 0bba37ebf014..000000000000 --- a/sdk/resourcemanager/network/armnetwork/bastionhosts_client_example_test.go +++ /dev/null @@ -1,761 +0,0 @@ -//go:build go1.18 -// +build go1.18 - -// 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. -// DO NOT EDIT. - -package armnetwork_test - -import ( - "context" - "log" - - "github.com/Azure/azure-sdk-for-go/sdk/azcore/to" - "github.com/Azure/azure-sdk-for-go/sdk/azidentity" - "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/network/armnetwork/v6" -) - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/4883fa5dbf6f2c9093fac8ce334547e9dfac68fa/specification/network/resource-manager/Microsoft.Network/stable/2024-03-01/examples/BastionHostDelete.json -func ExampleBastionHostsClient_BeginDelete_deleteBastionHost() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armnetwork.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewBastionHostsClient().BeginDelete(ctx, "rg1", "bastionhosttenant", nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - _, err = poller.PollUntilDone(ctx, nil) - if err != nil { - log.Fatalf("failed to pull the result: %v", err) - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/4883fa5dbf6f2c9093fac8ce334547e9dfac68fa/specification/network/resource-manager/Microsoft.Network/stable/2024-03-01/examples/BastionHostDeveloperDelete.json -func ExampleBastionHostsClient_BeginDelete_deleteDeveloperBastionHost() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armnetwork.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewBastionHostsClient().BeginDelete(ctx, "rg2", "bastionhostdeveloper", nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - _, err = poller.PollUntilDone(ctx, nil) - if err != nil { - log.Fatalf("failed to pull the result: %v", err) - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/4883fa5dbf6f2c9093fac8ce334547e9dfac68fa/specification/network/resource-manager/Microsoft.Network/stable/2024-03-01/examples/BastionHostGet.json -func ExampleBastionHostsClient_Get_getBastionHost() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armnetwork.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewBastionHostsClient().Get(ctx, "rg1", "bastionhosttenant'", nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.BastionHost = armnetwork.BastionHost{ - // Name: to.Ptr("bastionhost'"), - // Type: to.Ptr("Microsoft.Network/bastionHosts"), - // ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/bastionHosts/bastionhosttenant'"), - // Location: to.Ptr("West US"), - // Tags: map[string]*string{ - // "key1": to.Ptr("value1"), - // }, - // Etag: to.Ptr("w/\\00000000-0000-0000-0000-000000000000\\"), - // Properties: &armnetwork.BastionHostPropertiesFormat{ - // DisableCopyPaste: to.Ptr(false), - // DNSName: to.Ptr("bst-9d89d361-100e-4c01-b92d-466548c476dc.bastion.azure.com"), - // EnableIPConnect: to.Ptr(false), - // EnableKerberos: to.Ptr(false), - // EnableSessionRecording: to.Ptr(false), - // EnableShareableLink: to.Ptr(false), - // EnableTunneling: to.Ptr(false), - // IPConfigurations: []*armnetwork.BastionHostIPConfiguration{ - // { - // ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/bastionHosts/bastionhosttenant/bastionHostIpConfigurations/bastionHostIpConfiguration"), - // Name: to.Ptr("bastionHostIpConfiguration"), - // Type: to.Ptr("Microsoft.Network/bastionHosts/bastionHostIpConfigurations"), - // Etag: to.Ptr("w/\\00000000-0000-0000-0000-000000000000\\"), - // Properties: &armnetwork.BastionHostIPConfigurationPropertiesFormat{ - // PrivateIPAllocationMethod: to.Ptr(armnetwork.IPAllocationMethodDynamic), - // ProvisioningState: to.Ptr(armnetwork.ProvisioningStateSucceeded), - // PublicIPAddress: &armnetwork.SubResource{ - // ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/publicIPAddresses/pipName"), - // }, - // Subnet: &armnetwork.SubResource{ - // ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/virtualNetworks/vnet2/subnets/BastionHostSubnet"), - // }, - // }, - // }}, - // ProvisioningState: to.Ptr(armnetwork.ProvisioningStateSucceeded), - // ScaleUnits: to.Ptr[int32](2), - // }, - // SKU: &armnetwork.SKU{ - // Name: to.Ptr(armnetwork.BastionHostSKUNameStandard), - // }, - // Zones: []*string{ - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/4883fa5dbf6f2c9093fac8ce334547e9dfac68fa/specification/network/resource-manager/Microsoft.Network/stable/2024-03-01/examples/BastionHostGetWithZones.json -func ExampleBastionHostsClient_Get_getBastionHostWithZones() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armnetwork.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewBastionHostsClient().Get(ctx, "rg1", "bastionhosttenant'", nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.BastionHost = armnetwork.BastionHost{ - // Name: to.Ptr("bastionhost'"), - // Type: to.Ptr("Microsoft.Network/bastionHosts"), - // ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/bastionHosts/bastionhosttenant'"), - // Location: to.Ptr("West US"), - // Tags: map[string]*string{ - // "key1": to.Ptr("value1"), - // }, - // Etag: to.Ptr("w/\\00000000-0000-0000-0000-000000000000\\"), - // Properties: &armnetwork.BastionHostPropertiesFormat{ - // DisableCopyPaste: to.Ptr(false), - // DNSName: to.Ptr("bst-9d89d361-100e-4c01-b92d-466548c476dc.bastion.azure.com"), - // EnableIPConnect: to.Ptr(false), - // EnableKerberos: to.Ptr(false), - // EnableSessionRecording: to.Ptr(false), - // EnableShareableLink: to.Ptr(false), - // EnableTunneling: to.Ptr(false), - // IPConfigurations: []*armnetwork.BastionHostIPConfiguration{ - // { - // ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/bastionHosts/bastionhosttenant/bastionHostIpConfigurations/bastionHostIpConfiguration"), - // Name: to.Ptr("bastionHostIpConfiguration"), - // Type: to.Ptr("Microsoft.Network/bastionHosts/bastionHostIpConfigurations"), - // Etag: to.Ptr("w/\\00000000-0000-0000-0000-000000000000\\"), - // Properties: &armnetwork.BastionHostIPConfigurationPropertiesFormat{ - // PrivateIPAllocationMethod: to.Ptr(armnetwork.IPAllocationMethodDynamic), - // ProvisioningState: to.Ptr(armnetwork.ProvisioningStateSucceeded), - // PublicIPAddress: &armnetwork.SubResource{ - // ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/publicIPAddresses/pipName"), - // }, - // Subnet: &armnetwork.SubResource{ - // ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/virtualNetworks/vnet2/subnets/BastionHostSubnet"), - // }, - // }, - // }}, - // ProvisioningState: to.Ptr(armnetwork.ProvisioningStateSucceeded), - // ScaleUnits: to.Ptr[int32](2), - // }, - // SKU: &armnetwork.SKU{ - // Name: to.Ptr(armnetwork.BastionHostSKUNameStandard), - // }, - // Zones: []*string{ - // to.Ptr("1"), - // to.Ptr("2")}, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/4883fa5dbf6f2c9093fac8ce334547e9dfac68fa/specification/network/resource-manager/Microsoft.Network/stable/2024-03-01/examples/BastionHostDeveloperGet.json -func ExampleBastionHostsClient_Get_getDeveloperBastionHost() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armnetwork.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewBastionHostsClient().Get(ctx, "rg1", "bastionhostdeveloper'", nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.BastionHost = armnetwork.BastionHost{ - // Name: to.Ptr("bastionhostdeveloper'"), - // Type: to.Ptr("Microsoft.Network/bastionHosts"), - // ID: to.Ptr("/subscriptions/subid/resourceGroups/rg2/providers/Microsoft.Network/bastionHosts/bastionhostdeveloper'"), - // Location: to.Ptr("West US"), - // Etag: to.Ptr("w/\\00000000-0000-0000-0000-000000000000\\"), - // Properties: &armnetwork.BastionHostPropertiesFormat{ - // DNSName: to.Ptr("omnibrain.uswest.bastionglobal.azure.com"), - // IPConfigurations: []*armnetwork.BastionHostIPConfiguration{ - // }, - // NetworkACLs: &armnetwork.BastionHostPropertiesFormatNetworkACLs{ - // IPRules: []*armnetwork.IPRule{ - // { - // AddressPrefix: to.Ptr("1.1.1.1/16"), - // }}, - // }, - // ProvisioningState: to.Ptr(armnetwork.ProvisioningStateSucceeded), - // VirtualNetwork: &armnetwork.SubResource{ - // ID: to.Ptr("/subscriptions/subid/resourceGroups/rg2/providers/Microsoft.Network/virtualNetworks/vnet2"), - // }, - // }, - // SKU: &armnetwork.SKU{ - // Name: to.Ptr(armnetwork.BastionHostSKUNameDeveloper), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/4883fa5dbf6f2c9093fac8ce334547e9dfac68fa/specification/network/resource-manager/Microsoft.Network/stable/2024-03-01/examples/BastionHostPut.json -func ExampleBastionHostsClient_BeginCreateOrUpdate_createBastionHost() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armnetwork.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewBastionHostsClient().BeginCreateOrUpdate(ctx, "rg1", "bastionhosttenant", armnetwork.BastionHost{ - Properties: &armnetwork.BastionHostPropertiesFormat{ - IPConfigurations: []*armnetwork.BastionHostIPConfiguration{ - { - Name: to.Ptr("bastionHostIpConfiguration"), - Properties: &armnetwork.BastionHostIPConfigurationPropertiesFormat{ - PublicIPAddress: &armnetwork.SubResource{ - ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/publicIPAddresses/pipName"), - }, - Subnet: &armnetwork.SubResource{ - ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/virtualNetworks/vnet2/subnets/BastionHostSubnet"), - }, - }, - }}, - }, - }, nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - res, err := poller.PollUntilDone(ctx, nil) - if err != nil { - log.Fatalf("failed to pull the result: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.BastionHost = armnetwork.BastionHost{ - // Name: to.Ptr("bastionhost"), - // Type: to.Ptr("Microsoft.Network/bastionHosts"), - // ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/bastionHosts/bastionhosttenant'"), - // Location: to.Ptr("West US"), - // Etag: to.Ptr("w/\\00000000-0000-0000-0000-000000000000\\"), - // Properties: &armnetwork.BastionHostPropertiesFormat{ - // DisableCopyPaste: to.Ptr(false), - // DNSName: to.Ptr("bst-9d89d361-100e-4c01-b92d-466548c476dc.bastion.azure.com"), - // EnableIPConnect: to.Ptr(false), - // EnableKerberos: to.Ptr(false), - // EnableSessionRecording: to.Ptr(false), - // EnableShareableLink: to.Ptr(false), - // EnableTunneling: to.Ptr(false), - // IPConfigurations: []*armnetwork.BastionHostIPConfiguration{ - // { - // ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/bastionHosts/bastionhosttenant/bastionHostIpConfigurations/bastionHostIpConfiguration"), - // Name: to.Ptr("bastionHostIpConfiguration"), - // Type: to.Ptr("Microsoft.Network/bastionHosts/bastionHostIpConfigurations"), - // Etag: to.Ptr("w/\\00000000-0000-0000-0000-000000000000\\"), - // Properties: &armnetwork.BastionHostIPConfigurationPropertiesFormat{ - // PrivateIPAllocationMethod: to.Ptr(armnetwork.IPAllocationMethodDynamic), - // ProvisioningState: to.Ptr(armnetwork.ProvisioningStateSucceeded), - // PublicIPAddress: &armnetwork.SubResource{ - // ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/publicIPAddresses/pipName"), - // }, - // Subnet: &armnetwork.SubResource{ - // ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/virtualNetworks/vnet2/subnets/BastionHostSubnet"), - // }, - // }, - // }}, - // ProvisioningState: to.Ptr(armnetwork.ProvisioningStateSucceeded), - // ScaleUnits: to.Ptr[int32](2), - // }, - // SKU: &armnetwork.SKU{ - // Name: to.Ptr(armnetwork.BastionHostSKUNameStandard), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/4883fa5dbf6f2c9093fac8ce334547e9dfac68fa/specification/network/resource-manager/Microsoft.Network/stable/2024-03-01/examples/BastionHostPutWithZones.json -func ExampleBastionHostsClient_BeginCreateOrUpdate_createBastionHostWithZones() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armnetwork.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewBastionHostsClient().BeginCreateOrUpdate(ctx, "rg1", "bastionhosttenant", armnetwork.BastionHost{ - Properties: &armnetwork.BastionHostPropertiesFormat{ - IPConfigurations: []*armnetwork.BastionHostIPConfiguration{ - { - Name: to.Ptr("bastionHostIpConfiguration"), - Properties: &armnetwork.BastionHostIPConfigurationPropertiesFormat{ - PublicIPAddress: &armnetwork.SubResource{ - ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/publicIPAddresses/pipName"), - }, - Subnet: &armnetwork.SubResource{ - ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/virtualNetworks/vnet2/subnets/BastionHostSubnet"), - }, - }, - }}, - }, - }, nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - res, err := poller.PollUntilDone(ctx, nil) - if err != nil { - log.Fatalf("failed to pull the result: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.BastionHost = armnetwork.BastionHost{ - // Name: to.Ptr("bastionhost"), - // Type: to.Ptr("Microsoft.Network/bastionHosts"), - // ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/bastionHosts/bastionhosttenant'"), - // Location: to.Ptr("West US"), - // Etag: to.Ptr("w/\\00000000-0000-0000-0000-000000000000\\"), - // Properties: &armnetwork.BastionHostPropertiesFormat{ - // DisableCopyPaste: to.Ptr(false), - // DNSName: to.Ptr("bst-9d89d361-100e-4c01-b92d-466548c476dc.bastion.azure.com"), - // EnableIPConnect: to.Ptr(false), - // EnableKerberos: to.Ptr(false), - // EnableSessionRecording: to.Ptr(false), - // EnableShareableLink: to.Ptr(false), - // EnableTunneling: to.Ptr(false), - // IPConfigurations: []*armnetwork.BastionHostIPConfiguration{ - // { - // ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/bastionHosts/bastionhosttenant/bastionHostIpConfigurations/bastionHostIpConfiguration"), - // Name: to.Ptr("bastionHostIpConfiguration"), - // Type: to.Ptr("Microsoft.Network/bastionHosts/bastionHostIpConfigurations"), - // Etag: to.Ptr("w/\\00000000-0000-0000-0000-000000000000\\"), - // Properties: &armnetwork.BastionHostIPConfigurationPropertiesFormat{ - // PrivateIPAllocationMethod: to.Ptr(armnetwork.IPAllocationMethodDynamic), - // ProvisioningState: to.Ptr(armnetwork.ProvisioningStateSucceeded), - // PublicIPAddress: &armnetwork.SubResource{ - // ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/publicIPAddresses/pipName"), - // }, - // Subnet: &armnetwork.SubResource{ - // ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/virtualNetworks/vnet2/subnets/BastionHostSubnet"), - // }, - // }, - // }}, - // ProvisioningState: to.Ptr(armnetwork.ProvisioningStateSucceeded), - // ScaleUnits: to.Ptr[int32](2), - // }, - // SKU: &armnetwork.SKU{ - // Name: to.Ptr(armnetwork.BastionHostSKUNameStandard), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/4883fa5dbf6f2c9093fac8ce334547e9dfac68fa/specification/network/resource-manager/Microsoft.Network/stable/2024-03-01/examples/BastionHostDeveloperPut.json -func ExampleBastionHostsClient_BeginCreateOrUpdate_createDeveloperBastionHost() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armnetwork.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewBastionHostsClient().BeginCreateOrUpdate(ctx, "rg2", "bastionhostdeveloper", armnetwork.BastionHost{ - Properties: &armnetwork.BastionHostPropertiesFormat{ - IPConfigurations: []*armnetwork.BastionHostIPConfiguration{}, - NetworkACLs: &armnetwork.BastionHostPropertiesFormatNetworkACLs{ - IPRules: []*armnetwork.IPRule{ - { - AddressPrefix: to.Ptr("1.1.1.1/16"), - }}, - }, - VirtualNetwork: &armnetwork.SubResource{ - ID: to.Ptr("/subscriptions/subid/resourceGroups/rg2/providers/Microsoft.Network/virtualNetworks/vnet2"), - }, - }, - }, nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - res, err := poller.PollUntilDone(ctx, nil) - if err != nil { - log.Fatalf("failed to pull the result: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.BastionHost = armnetwork.BastionHost{ - // Name: to.Ptr("bastionhostdeveloper"), - // Type: to.Ptr("Microsoft.Network/bastionHosts"), - // ID: to.Ptr("/subscriptions/subid/resourceGroups/rg2/providers/Microsoft.Network/bastionHosts/bastionhostdeveloper'"), - // Location: to.Ptr("West US"), - // Etag: to.Ptr("w/\\00000000-0000-0000-0000-000000000000\\"), - // Properties: &armnetwork.BastionHostPropertiesFormat{ - // DNSName: to.Ptr("omnibrain.uswest.bastionglobal.azure.com"), - // IPConfigurations: []*armnetwork.BastionHostIPConfiguration{ - // }, - // NetworkACLs: &armnetwork.BastionHostPropertiesFormatNetworkACLs{ - // IPRules: []*armnetwork.IPRule{ - // { - // AddressPrefix: to.Ptr("1.1.1.1/16"), - // }}, - // }, - // ProvisioningState: to.Ptr(armnetwork.ProvisioningStateSucceeded), - // VirtualNetwork: &armnetwork.SubResource{ - // ID: to.Ptr("/subscriptions/subid/resourceGroups/rg2/providers/Microsoft.Network/virtualNetworks/vnet2"), - // }, - // }, - // SKU: &armnetwork.SKU{ - // Name: to.Ptr(armnetwork.BastionHostSKUNameDeveloper), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/4883fa5dbf6f2c9093fac8ce334547e9dfac68fa/specification/network/resource-manager/Microsoft.Network/stable/2024-03-01/examples/BastionHostPatch.json -func ExampleBastionHostsClient_BeginUpdateTags() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armnetwork.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewBastionHostsClient().BeginUpdateTags(ctx, "rg1", "bastionhosttenant", armnetwork.TagsObject{ - Tags: map[string]*string{ - "tag1": to.Ptr("value1"), - "tag2": to.Ptr("value2"), - }, - }, nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - res, err := poller.PollUntilDone(ctx, nil) - if err != nil { - log.Fatalf("failed to pull the result: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.BastionHost = armnetwork.BastionHost{ - // Name: to.Ptr("bastionhosttenant"), - // Type: to.Ptr("Microsoft.Network/bastionHosts"), - // ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/bastionHosts/bastionhosttenant'"), - // Location: to.Ptr("West US"), - // Tags: map[string]*string{ - // "tag1": to.Ptr("value1"), - // "tag2": to.Ptr("value2"), - // }, - // Etag: to.Ptr("w/\\00000000-0000-0000-0000-000000000000\\"), - // Properties: &armnetwork.BastionHostPropertiesFormat{ - // DisableCopyPaste: to.Ptr(false), - // DNSName: to.Ptr("bst-9d89d361-100e-4c01-b92d-466548c476dc.bastion.azure.com"), - // EnableIPConnect: to.Ptr(false), - // EnableKerberos: to.Ptr(false), - // EnableSessionRecording: to.Ptr(false), - // EnableShareableLink: to.Ptr(false), - // EnableTunneling: to.Ptr(false), - // IPConfigurations: []*armnetwork.BastionHostIPConfiguration{ - // { - // ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/bastionHosts/bastionhosttenant/bastionHostIpConfigurations/bastionHostIpConfiguration"), - // Name: to.Ptr("bastionHostIpConfiguration"), - // Type: to.Ptr("Microsoft.Network/bastionHosts/bastionHostIpConfigurations"), - // Etag: to.Ptr("w/\\00000000-0000-0000-0000-000000000000\\"), - // Properties: &armnetwork.BastionHostIPConfigurationPropertiesFormat{ - // PrivateIPAllocationMethod: to.Ptr(armnetwork.IPAllocationMethodDynamic), - // ProvisioningState: to.Ptr(armnetwork.ProvisioningStateSucceeded), - // PublicIPAddress: &armnetwork.SubResource{ - // ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/publicIPAddresses/pipName"), - // }, - // Subnet: &armnetwork.SubResource{ - // ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/virtualNetworks/vnet2/subnets/BastionHostSubnet"), - // }, - // }, - // }}, - // ProvisioningState: to.Ptr(armnetwork.ProvisioningStateSucceeded), - // ScaleUnits: to.Ptr[int32](2), - // }, - // SKU: &armnetwork.SKU{ - // Name: to.Ptr(armnetwork.BastionHostSKUNameStandard), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/4883fa5dbf6f2c9093fac8ce334547e9dfac68fa/specification/network/resource-manager/Microsoft.Network/stable/2024-03-01/examples/BastionHostListBySubscription.json -func ExampleBastionHostsClient_NewListPager() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armnetwork.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := clientFactory.NewBastionHostsClient().NewListPager(nil) - for pager.More() { - page, err := pager.NextPage(ctx) - if err != nil { - log.Fatalf("failed to advance page: %v", err) - } - for _, v := range page.Value { - // You could use page here. We use blank identifier for just demo purposes. - _ = v - } - // If the HTTP response code is 200 as defined in example definition, your page structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // page.BastionHostListResult = armnetwork.BastionHostListResult{ - // Value: []*armnetwork.BastionHost{ - // { - // Name: to.Ptr("bastionhosttenant"), - // Type: to.Ptr("Microsoft.Network/bastionHosts"), - // ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/bastionHosts/bastionhosttenant"), - // Location: to.Ptr("West US"), - // Etag: to.Ptr("w/\\00000000-0000-0000-0000-000000000000\\"), - // Properties: &armnetwork.BastionHostPropertiesFormat{ - // DisableCopyPaste: to.Ptr(false), - // DNSName: to.Ptr("bst-9d89d361-100e-4c01-b92d-466548c476dc.bastion.azure.com"), - // EnableIPConnect: to.Ptr(false), - // EnableKerberos: to.Ptr(false), - // EnableSessionRecording: to.Ptr(false), - // EnableShareableLink: to.Ptr(false), - // EnableTunneling: to.Ptr(false), - // IPConfigurations: []*armnetwork.BastionHostIPConfiguration{ - // { - // ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/bastionHosts/bastionhosttenant/bastionHostIpConfigurations/bastionHostIpConfiguration"), - // Name: to.Ptr("bastionHostIpConfiguration"), - // Type: to.Ptr("Microsoft.Network/bastionHosts/bastionHostIpConfigurations"), - // Etag: to.Ptr("w/\\00000000-0000-0000-0000-000000000000\\"), - // Properties: &armnetwork.BastionHostIPConfigurationPropertiesFormat{ - // PrivateIPAllocationMethod: to.Ptr(armnetwork.IPAllocationMethodDynamic), - // ProvisioningState: to.Ptr(armnetwork.ProvisioningStateSucceeded), - // PublicIPAddress: &armnetwork.SubResource{ - // ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/publicIPAddresses/pipName"), - // }, - // Subnet: &armnetwork.SubResource{ - // ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/virtualNetworks/vnet/subnets/AzureBastionSubnet"), - // }, - // }, - // }}, - // ProvisioningState: to.Ptr(armnetwork.ProvisioningStateSucceeded), - // ScaleUnits: to.Ptr[int32](2), - // }, - // SKU: &armnetwork.SKU{ - // Name: to.Ptr(armnetwork.BastionHostSKUNameStandard), - // }, - // Zones: []*string{ - // }, - // }, - // { - // Name: to.Ptr("bastionhostdeveloper"), - // Type: to.Ptr("Microsoft.Network/bastionHosts"), - // ID: to.Ptr("/subscriptions/subid/resourceGroups/rg2/providers/Microsoft.Network/bastionHosts/bastionhostdeveloper"), - // Location: to.Ptr("West US"), - // Etag: to.Ptr("w/\\00000000-0000-0000-0000-000000000000\\"), - // Properties: &armnetwork.BastionHostPropertiesFormat{ - // DNSName: to.Ptr("omnibrain.uswest.bastionglobal.azure.com"), - // IPConfigurations: []*armnetwork.BastionHostIPConfiguration{ - // }, - // NetworkACLs: &armnetwork.BastionHostPropertiesFormatNetworkACLs{ - // IPRules: []*armnetwork.IPRule{ - // { - // AddressPrefix: to.Ptr("1.1.1.1/16"), - // }}, - // }, - // ProvisioningState: to.Ptr(armnetwork.ProvisioningStateSucceeded), - // VirtualNetwork: &armnetwork.SubResource{ - // ID: to.Ptr("/subscriptions/subid/resourceGroups/rg2/providers/Microsoft.Network/virtualNetworks/vnet2"), - // }, - // }, - // SKU: &armnetwork.SKU{ - // Name: to.Ptr(armnetwork.BastionHostSKUNameDeveloper), - // }, - // }, - // { - // Name: to.Ptr("bastionhost3"), - // Type: to.Ptr("Microsoft.Network/bastionHosts"), - // ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/bastionHosts/bastionhost3"), - // Location: to.Ptr("West US"), - // Etag: to.Ptr("w/\\00000000-0000-0000-0000-000000000000\\"), - // Properties: &armnetwork.BastionHostPropertiesFormat{ - // DisableCopyPaste: to.Ptr(false), - // DNSName: to.Ptr("bst-9d89d361-100e-4c01-b92d-466548c476dc.bastion.azure.com"), - // EnableIPConnect: to.Ptr(false), - // EnableKerberos: to.Ptr(false), - // EnableSessionRecording: to.Ptr(true), - // EnableShareableLink: to.Ptr(false), - // EnableTunneling: to.Ptr(false), - // IPConfigurations: []*armnetwork.BastionHostIPConfiguration{ - // { - // ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/bastionHosts/bastionhost3/bastionHostIpConfigurations/IpConf"), - // Name: to.Ptr("bastionHostIpConfiguration"), - // Type: to.Ptr("Microsoft.Network/bastionHosts/bastionHostIpConfigurations"), - // Etag: to.Ptr("w/\\00000000-0000-0000-0000-000000000000\\"), - // Properties: &armnetwork.BastionHostIPConfigurationPropertiesFormat{ - // PrivateIPAllocationMethod: to.Ptr(armnetwork.IPAllocationMethodDynamic), - // ProvisioningState: to.Ptr(armnetwork.ProvisioningStateSucceeded), - // PublicIPAddress: &armnetwork.SubResource{ - // ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/publicIPAddresses/pipName3"), - // }, - // Subnet: &armnetwork.SubResource{ - // ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/virtualNetworks/vnet3/subnets/AzureBastionSubnet"), - // }, - // }, - // }}, - // ProvisioningState: to.Ptr(armnetwork.ProvisioningStateSucceeded), - // ScaleUnits: to.Ptr[int32](2), - // }, - // SKU: &armnetwork.SKU{ - // Name: to.Ptr(armnetwork.BastionHostSKUNamePremium), - // }, - // Zones: []*string{ - // }, - // }}, - // } - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/4883fa5dbf6f2c9093fac8ce334547e9dfac68fa/specification/network/resource-manager/Microsoft.Network/stable/2024-03-01/examples/BastionHostListByResourceGroup.json -func ExampleBastionHostsClient_NewListByResourceGroupPager() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armnetwork.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := clientFactory.NewBastionHostsClient().NewListByResourceGroupPager("rg1", nil) - for pager.More() { - page, err := pager.NextPage(ctx) - if err != nil { - log.Fatalf("failed to advance page: %v", err) - } - for _, v := range page.Value { - // You could use page here. We use blank identifier for just demo purposes. - _ = v - } - // If the HTTP response code is 200 as defined in example definition, your page structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // page.BastionHostListResult = armnetwork.BastionHostListResult{ - // Value: []*armnetwork.BastionHost{ - // { - // Name: to.Ptr("bastionhosttenant"), - // Type: to.Ptr("Microsoft.Network/bastionHosts"), - // ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/bastionHosts/bastionhosttenant"), - // Location: to.Ptr("West US"), - // Etag: to.Ptr("w/\\00000000-0000-0000-0000-000000000000\\"), - // Properties: &armnetwork.BastionHostPropertiesFormat{ - // DisableCopyPaste: to.Ptr(false), - // DNSName: to.Ptr("bst-9d89d361-100e-4c01-b92d-466548c476dc.bastion.azure.com"), - // EnableIPConnect: to.Ptr(false), - // EnableKerberos: to.Ptr(false), - // EnableSessionRecording: to.Ptr(false), - // EnableShareableLink: to.Ptr(false), - // EnableTunneling: to.Ptr(false), - // IPConfigurations: []*armnetwork.BastionHostIPConfiguration{ - // { - // ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/bastionHosts/bastionhosttenant/bastionHostIpConfigurations/bastionHostIpConfiguration"), - // Name: to.Ptr("bastionHostIpConfiguration"), - // Type: to.Ptr("Microsoft.Network/bastionHosts/bastionHostIpConfigurations"), - // Etag: to.Ptr("w/\\00000000-0000-0000-0000-000000000000\\"), - // Properties: &armnetwork.BastionHostIPConfigurationPropertiesFormat{ - // PrivateIPAllocationMethod: to.Ptr(armnetwork.IPAllocationMethodDynamic), - // ProvisioningState: to.Ptr(armnetwork.ProvisioningStateSucceeded), - // PublicIPAddress: &armnetwork.SubResource{ - // ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/publicIPAddresses/pipName"), - // }, - // Subnet: &armnetwork.SubResource{ - // ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/virtualNetworks/vnet/subnets/AzureBastionSubnet"), - // }, - // }, - // }}, - // ProvisioningState: to.Ptr(armnetwork.ProvisioningStateSucceeded), - // ScaleUnits: to.Ptr[int32](2), - // }, - // SKU: &armnetwork.SKU{ - // Name: to.Ptr(armnetwork.BastionHostSKUNameStandard), - // }, - // Zones: []*string{ - // }, - // }, - // { - // Name: to.Ptr("bastionhost2"), - // Type: to.Ptr("Microsoft.Network/bastionHosts"), - // ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/bastionHosts/bastionhost2"), - // Location: to.Ptr("West US"), - // Etag: to.Ptr("w/\\00000000-0000-0000-0000-000000000000\\"), - // Properties: &armnetwork.BastionHostPropertiesFormat{ - // DisableCopyPaste: to.Ptr(false), - // DNSName: to.Ptr("bst-9d89d361-100e-4c01-b92d-466548c476dc.bastion.azure.com"), - // EnableIPConnect: to.Ptr(false), - // EnableKerberos: to.Ptr(false), - // EnableSessionRecording: to.Ptr(true), - // EnableShareableLink: to.Ptr(false), - // EnableTunneling: to.Ptr(false), - // IPConfigurations: []*armnetwork.BastionHostIPConfiguration{ - // { - // ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/bastionHosts/bastionhost2/bastionHostIpConfigurations/IpConf"), - // Name: to.Ptr("bastionHostIpConfiguration"), - // Type: to.Ptr("Microsoft.Network/bastionHosts/bastionHostIpConfigurations"), - // Etag: to.Ptr("w/\\00000000-0000-0000-0000-000000000000\\"), - // Properties: &armnetwork.BastionHostIPConfigurationPropertiesFormat{ - // PrivateIPAllocationMethod: to.Ptr(armnetwork.IPAllocationMethodDynamic), - // ProvisioningState: to.Ptr(armnetwork.ProvisioningStateSucceeded), - // PublicIPAddress: &armnetwork.SubResource{ - // ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/publicIPAddresses/pipName2"), - // }, - // Subnet: &armnetwork.SubResource{ - // ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/virtualNetworks/vnet2/subnets/AzureBastionSubnet"), - // }, - // }, - // }}, - // ProvisioningState: to.Ptr(armnetwork.ProvisioningStateSucceeded), - // ScaleUnits: to.Ptr[int32](2), - // }, - // SKU: &armnetwork.SKU{ - // Name: to.Ptr(armnetwork.BastionHostSKUNamePremium), - // }, - // Zones: []*string{ - // }, - // }}, - // } - } -} diff --git a/sdk/resourcemanager/network/armnetwork/bgpservicecommunities_client_example_test.go b/sdk/resourcemanager/network/armnetwork/bgpservicecommunities_client_example_test.go deleted file mode 100644 index 96ce65192f3d..000000000000 --- a/sdk/resourcemanager/network/armnetwork/bgpservicecommunities_client_example_test.go +++ /dev/null @@ -1,84 +0,0 @@ -//go:build go1.18 -// +build go1.18 - -// 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. -// DO NOT EDIT. - -package armnetwork_test - -import ( - "context" - "log" - - "github.com/Azure/azure-sdk-for-go/sdk/azidentity" - "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/network/armnetwork/v6" -) - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/4883fa5dbf6f2c9093fac8ce334547e9dfac68fa/specification/network/resource-manager/Microsoft.Network/stable/2024-03-01/examples/ServiceCommunityList.json -func ExampleBgpServiceCommunitiesClient_NewListPager() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armnetwork.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := clientFactory.NewBgpServiceCommunitiesClient().NewListPager(nil) - for pager.More() { - page, err := pager.NextPage(ctx) - if err != nil { - log.Fatalf("failed to advance page: %v", err) - } - for _, v := range page.Value { - // You could use page here. We use blank identifier for just demo purposes. - _ = v - } - // If the HTTP response code is 200 as defined in example definition, your page structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // page.BgpServiceCommunityListResult = armnetwork.BgpServiceCommunityListResult{ - // Value: []*armnetwork.BgpServiceCommunity{ - // { - // Name: to.Ptr("skype"), - // Type: to.Ptr("Microsoft.Network/bgpServiceCommunities"), - // ID: to.Ptr("/subscriptions/subid/providers/Microsoft.Network/bgpServiceCommunities/skype"), - // Properties: &armnetwork.BgpServiceCommunityPropertiesFormat{ - // BgpCommunities: []*armnetwork.BGPCommunity{ - // { - // CommunityName: to.Ptr("Skype For Business Online"), - // CommunityPrefixes: []*string{ - // to.Ptr("13.67.56.225/32"), - // to.Ptr("13.67.186.105/32")}, - // CommunityValue: to.Ptr("12076:5030"), - // IsAuthorizedToUse: to.Ptr(true), - // ServiceGroup: to.Ptr("O365"), - // ServiceSupportedRegion: to.Ptr("Global"), - // }}, - // ServiceName: to.Ptr("skype"), - // }, - // }, - // { - // Name: to.Ptr("exchange"), - // Type: to.Ptr("Microsoft.Network/bgpServiceCommunities"), - // ID: to.Ptr("/subscriptions/subid/providers/Microsoft.Network/bgpServiceCommunities/exchange"), - // Properties: &armnetwork.BgpServiceCommunityPropertiesFormat{ - // BgpCommunities: []*armnetwork.BGPCommunity{ - // { - // CommunityName: to.Ptr("Exchange Online"), - // CommunityPrefixes: []*string{ - // to.Ptr("13.67.56.225/32"), - // to.Ptr("13.67.186.105/32")}, - // CommunityValue: to.Ptr("12076:5040"), - // IsAuthorizedToUse: to.Ptr(true), - // ServiceGroup: to.Ptr("O365"), - // ServiceSupportedRegion: to.Ptr("Global"), - // }}, - // ServiceName: to.Ptr("exchange"), - // }, - // }}, - // } - } -} diff --git a/sdk/resourcemanager/network/armnetwork/configurationpolicygroups_client_example_test.go b/sdk/resourcemanager/network/armnetwork/configurationpolicygroups_client_example_test.go deleted file mode 100644 index d886619e8c5c..000000000000 --- a/sdk/resourcemanager/network/armnetwork/configurationpolicygroups_client_example_test.go +++ /dev/null @@ -1,226 +0,0 @@ -//go:build go1.18 -// +build go1.18 - -// 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. -// DO NOT EDIT. - -package armnetwork_test - -import ( - "context" - "log" - - "github.com/Azure/azure-sdk-for-go/sdk/azcore/to" - "github.com/Azure/azure-sdk-for-go/sdk/azidentity" - "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/network/armnetwork/v6" -) - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/4883fa5dbf6f2c9093fac8ce334547e9dfac68fa/specification/network/resource-manager/Microsoft.Network/stable/2024-03-01/examples/ConfigurationPolicyGroupPut.json -func ExampleConfigurationPolicyGroupsClient_BeginCreateOrUpdate() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armnetwork.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewConfigurationPolicyGroupsClient().BeginCreateOrUpdate(ctx, "rg1", "vpnServerConfiguration1", "policyGroup1", armnetwork.VPNServerConfigurationPolicyGroup{ - Properties: &armnetwork.VPNServerConfigurationPolicyGroupProperties{ - IsDefault: to.Ptr(true), - PolicyMembers: []*armnetwork.VPNServerConfigurationPolicyGroupMember{ - { - Name: to.Ptr("policy1"), - AttributeType: to.Ptr(armnetwork.VPNPolicyMemberAttributeTypeRadiusAzureGroupID), - AttributeValue: to.Ptr("6ad1bd08"), - }, - { - Name: to.Ptr("policy2"), - AttributeType: to.Ptr(armnetwork.VPNPolicyMemberAttributeTypeCertificateGroupID), - AttributeValue: to.Ptr("red.com"), - }}, - Priority: to.Ptr[int32](0), - }, - }, nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - res, err := poller.PollUntilDone(ctx, nil) - if err != nil { - log.Fatalf("failed to pull the result: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.VPNServerConfigurationPolicyGroup = armnetwork.VPNServerConfigurationPolicyGroup{ - // ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/vpnServerConfigurations/vpnServerConfiguration1/vpnServerConfigurationPolicyGroups/policyGroup1"), - // Name: to.Ptr("policyGroup1"), - // Etag: to.Ptr("w/\\00000000-0000-0000-0000-000000000000\\"), - // Properties: &armnetwork.VPNServerConfigurationPolicyGroupProperties{ - // IsDefault: to.Ptr(true), - // P2SConnectionConfigurations: []*armnetwork.SubResource{ - // { - // ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/p2sVpnGateways/p2sVpnGateway1/p2sConnectionConfigurations/P2SConnectionConfig1"), - // }}, - // PolicyMembers: []*armnetwork.VPNServerConfigurationPolicyGroupMember{ - // { - // Name: to.Ptr("policy1"), - // AttributeType: to.Ptr(armnetwork.VPNPolicyMemberAttributeTypeRadiusAzureGroupID), - // AttributeValue: to.Ptr("6ad1bd08"), - // }, - // { - // Name: to.Ptr("policy2"), - // AttributeType: to.Ptr(armnetwork.VPNPolicyMemberAttributeTypeCertificateGroupID), - // AttributeValue: to.Ptr("red.com"), - // }}, - // Priority: to.Ptr[int32](0), - // ProvisioningState: to.Ptr(armnetwork.ProvisioningStateSucceeded), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/4883fa5dbf6f2c9093fac8ce334547e9dfac68fa/specification/network/resource-manager/Microsoft.Network/stable/2024-03-01/examples/ConfigurationPolicyGroupDelete.json -func ExampleConfigurationPolicyGroupsClient_BeginDelete() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armnetwork.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewConfigurationPolicyGroupsClient().BeginDelete(ctx, "rg1", "vpnServerConfiguration1", "policyGroup1", nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - _, err = poller.PollUntilDone(ctx, nil) - if err != nil { - log.Fatalf("failed to pull the result: %v", err) - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/4883fa5dbf6f2c9093fac8ce334547e9dfac68fa/specification/network/resource-manager/Microsoft.Network/stable/2024-03-01/examples/ConfigurationPolicyGroupGet.json -func ExampleConfigurationPolicyGroupsClient_Get() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armnetwork.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewConfigurationPolicyGroupsClient().Get(ctx, "rg1", "vpnServerConfiguration1", "policyGroup1", nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.VPNServerConfigurationPolicyGroup = armnetwork.VPNServerConfigurationPolicyGroup{ - // ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/vpnServerConfigurations/vpnServerConfiguration1/vpnServerConfigurationPolicyGroups/policyGroup1"), - // Name: to.Ptr("policyGroup1"), - // Type: to.Ptr("Microsoft.Network/vpnServerConfigurations/configurationPolicyGroups"), - // Etag: to.Ptr("w/\\00000000-0000-0000-0000-000000000000\\"), - // Properties: &armnetwork.VPNServerConfigurationPolicyGroupProperties{ - // IsDefault: to.Ptr(true), - // P2SConnectionConfigurations: []*armnetwork.SubResource{ - // { - // ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/p2sVpnGateways/p2sVpnGateway1/p2sConnectionConfigurations/P2SConnectionConfig1"), - // }}, - // PolicyMembers: []*armnetwork.VPNServerConfigurationPolicyGroupMember{ - // { - // Name: to.Ptr("policy1"), - // AttributeType: to.Ptr(armnetwork.VPNPolicyMemberAttributeTypeRadiusAzureGroupID), - // AttributeValue: to.Ptr("6ad1bd08"), - // }, - // { - // Name: to.Ptr("policy2"), - // AttributeType: to.Ptr(armnetwork.VPNPolicyMemberAttributeTypeCertificateGroupID), - // AttributeValue: to.Ptr("red.com"), - // }}, - // Priority: to.Ptr[int32](0), - // ProvisioningState: to.Ptr(armnetwork.ProvisioningStateSucceeded), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/4883fa5dbf6f2c9093fac8ce334547e9dfac68fa/specification/network/resource-manager/Microsoft.Network/stable/2024-03-01/examples/ConfigurationPolicyGroupListByVpnServerConfiguration.json -func ExampleConfigurationPolicyGroupsClient_NewListByVPNServerConfigurationPager() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armnetwork.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := clientFactory.NewConfigurationPolicyGroupsClient().NewListByVPNServerConfigurationPager("rg1", "vpnServerConfiguration1", nil) - for pager.More() { - page, err := pager.NextPage(ctx) - if err != nil { - log.Fatalf("failed to advance page: %v", err) - } - for _, v := range page.Value { - // You could use page here. We use blank identifier for just demo purposes. - _ = v - } - // If the HTTP response code is 200 as defined in example definition, your page structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // page.ListVPNServerConfigurationPolicyGroupsResult = armnetwork.ListVPNServerConfigurationPolicyGroupsResult{ - // Value: []*armnetwork.VPNServerConfigurationPolicyGroup{ - // { - // ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/vpnServerConfigurations/vpnServerConfiguration1/vpnServerConfigurationPolicyGroups/policyGroup1"), - // Name: to.Ptr("policyGroup1"), - // Type: to.Ptr("Microsoft.Network/vpnServerConfigurations/configurationPolicyGroups"), - // Etag: to.Ptr("w/\\00000000-0000-0000-0000-000000000000\\"), - // Properties: &armnetwork.VPNServerConfigurationPolicyGroupProperties{ - // IsDefault: to.Ptr(true), - // P2SConnectionConfigurations: []*armnetwork.SubResource{ - // { - // ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/p2sVpnGateways/p2sVpnGateway1/p2sConnectionConfigurations/P2SConnectionConfig1"), - // }}, - // PolicyMembers: []*armnetwork.VPNServerConfigurationPolicyGroupMember{ - // { - // Name: to.Ptr("policy1"), - // AttributeType: to.Ptr(armnetwork.VPNPolicyMemberAttributeTypeRadiusAzureGroupID), - // AttributeValue: to.Ptr("6ad1bd08"), - // }, - // { - // Name: to.Ptr("policy2"), - // AttributeType: to.Ptr(armnetwork.VPNPolicyMemberAttributeTypeCertificateGroupID), - // AttributeValue: to.Ptr("red.com"), - // }}, - // Priority: to.Ptr[int32](0), - // ProvisioningState: to.Ptr(armnetwork.ProvisioningStateSucceeded), - // }, - // }, - // { - // ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/vpnServerConfigurations/vpnServerConfiguration1/vpnServerConfigurationPolicyGroups/policyGroup2"), - // Name: to.Ptr("policyGroup2"), - // Etag: to.Ptr("w/\\00000000-0000-0000-0000-000000000000\\"), - // Properties: &armnetwork.VPNServerConfigurationPolicyGroupProperties{ - // IsDefault: to.Ptr(true), - // PolicyMembers: []*armnetwork.VPNServerConfigurationPolicyGroupMember{ - // { - // Name: to.Ptr("policy1"), - // AttributeType: to.Ptr(armnetwork.VPNPolicyMemberAttributeTypeRadiusAzureGroupID), - // AttributeValue: to.Ptr("6ad1bd08"), - // }, - // { - // Name: to.Ptr("policy2"), - // AttributeType: to.Ptr(armnetwork.VPNPolicyMemberAttributeTypeCertificateGroupID), - // AttributeValue: to.Ptr("red.com"), - // }}, - // Priority: to.Ptr[int32](0), - // ProvisioningState: to.Ptr(armnetwork.ProvisioningStateSucceeded), - // }, - // }}, - // } - } -} diff --git a/sdk/resourcemanager/network/armnetwork/connectionmonitors_client_example_test.go b/sdk/resourcemanager/network/armnetwork/connectionmonitors_client_example_test.go deleted file mode 100644 index 6377bb14a201..000000000000 --- a/sdk/resourcemanager/network/armnetwork/connectionmonitors_client_example_test.go +++ /dev/null @@ -1,721 +0,0 @@ -//go:build go1.18 -// +build go1.18 - -// 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. -// DO NOT EDIT. - -package armnetwork_test - -import ( - "context" - "log" - - "github.com/Azure/azure-sdk-for-go/sdk/azcore/to" - "github.com/Azure/azure-sdk-for-go/sdk/azidentity" - "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/network/armnetwork/v6" -) - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/4883fa5dbf6f2c9093fac8ce334547e9dfac68fa/specification/network/resource-manager/Microsoft.Network/stable/2024-03-01/examples/NetworkWatcherConnectionMonitorCreate.json -func ExampleConnectionMonitorsClient_BeginCreateOrUpdate_createConnectionMonitorV1() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armnetwork.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewConnectionMonitorsClient().BeginCreateOrUpdate(ctx, "rg1", "nw1", "cm1", armnetwork.ConnectionMonitor{ - Location: to.Ptr("eastus"), - Properties: &armnetwork.ConnectionMonitorParameters{ - Endpoints: []*armnetwork.ConnectionMonitorEndpoint{ - { - Name: to.Ptr("source"), - ResourceID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Compute/virtualMachines/ct1"), - }, - { - Name: to.Ptr("destination"), - Address: to.Ptr("bing.com"), - }}, - TestConfigurations: []*armnetwork.ConnectionMonitorTestConfiguration{ - { - Name: to.Ptr("tcp"), - TCPConfiguration: &armnetwork.ConnectionMonitorTCPConfiguration{ - Port: to.Ptr[int32](80), - }, - TestFrequencySec: to.Ptr[int32](60), - Protocol: to.Ptr(armnetwork.ConnectionMonitorTestConfigurationProtocolTCP), - }}, - TestGroups: []*armnetwork.ConnectionMonitorTestGroup{ - { - Name: to.Ptr("tg"), - Destinations: []*string{ - to.Ptr("destination")}, - Sources: []*string{ - to.Ptr("source")}, - TestConfigurations: []*string{ - to.Ptr("tcp")}, - }}, - }, - }, &armnetwork.ConnectionMonitorsClientBeginCreateOrUpdateOptions{Migrate: nil}) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - res, err := poller.PollUntilDone(ctx, nil) - if err != nil { - log.Fatalf("failed to pull the result: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.ConnectionMonitorResult = armnetwork.ConnectionMonitorResult{ - // Name: to.Ptr("cm1"), - // Type: to.Ptr("Microsoft.Network/networkWatchers/connectionMonitors"), - // Etag: to.Ptr("W/\"e7497f26-5f09-4559-900b-fe98f3dedb6f\""), - // ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/networkWatchers/nw1/connectionMonitors/cm1"), - // Location: to.Ptr("eastus"), - // Properties: &armnetwork.ConnectionMonitorResultProperties{ - // Endpoints: []*armnetwork.ConnectionMonitorEndpoint{ - // { - // Name: to.Ptr("source"), - // ResourceID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Compute/virtualMachines/ct1"), - // }, - // { - // Name: to.Ptr("destination"), - // Address: to.Ptr("bing.com"), - // }}, - // TestConfigurations: []*armnetwork.ConnectionMonitorTestConfiguration{ - // { - // Name: to.Ptr("tcp"), - // TCPConfiguration: &armnetwork.ConnectionMonitorTCPConfiguration{ - // Port: to.Ptr[int32](80), - // }, - // TestFrequencySec: to.Ptr[int32](60), - // Protocol: to.Ptr(armnetwork.ConnectionMonitorTestConfigurationProtocolTCP), - // }}, - // TestGroups: []*armnetwork.ConnectionMonitorTestGroup{ - // { - // Name: to.Ptr("tg"), - // Destinations: []*string{ - // to.Ptr("destination")}, - // Sources: []*string{ - // to.Ptr("source")}, - // TestConfigurations: []*string{ - // to.Ptr("tcp")}, - // }}, - // ProvisioningState: to.Ptr(armnetwork.ProvisioningStateSucceeded), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/4883fa5dbf6f2c9093fac8ce334547e9dfac68fa/specification/network/resource-manager/Microsoft.Network/stable/2024-03-01/examples/NetworkWatcherConnectionMonitorV2Create.json -func ExampleConnectionMonitorsClient_BeginCreateOrUpdate_createConnectionMonitorV2() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armnetwork.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewConnectionMonitorsClient().BeginCreateOrUpdate(ctx, "rg1", "nw1", "cm1", armnetwork.ConnectionMonitor{ - Properties: &armnetwork.ConnectionMonitorParameters{ - Endpoints: []*armnetwork.ConnectionMonitorEndpoint{ - { - Name: to.Ptr("vm1"), - ResourceID: to.Ptr("/subscriptions/96e68903-0a56-4819-9987-8d08ad6a1f99/resourceGroups/NwRgIrinaCentralUSEUAP/providers/Microsoft.Compute/virtualMachines/vm1"), - }, - { - Name: to.Ptr("CanaryWorkspaceVamshi"), - Filter: &armnetwork.ConnectionMonitorEndpointFilter{ - Type: to.Ptr(armnetwork.ConnectionMonitorEndpointFilterTypeInclude), - Items: []*armnetwork.ConnectionMonitorEndpointFilterItem{ - { - Type: to.Ptr(armnetwork.ConnectionMonitorEndpointFilterItemTypeAgentAddress), - Address: to.Ptr("npmuser"), - }}, - }, - ResourceID: to.Ptr("/subscriptions/96e68903-0a56-4819-9987-8d08ad6a1f99/resourceGroups/vasamudrRG/providers/Microsoft.OperationalInsights/workspaces/vasamudrWorkspace"), - }, - { - Name: to.Ptr("bing"), - Address: to.Ptr("bing.com"), - }, - { - Name: to.Ptr("google"), - Address: to.Ptr("google.com"), - }}, - Outputs: []*armnetwork.ConnectionMonitorOutput{}, - TestConfigurations: []*armnetwork.ConnectionMonitorTestConfiguration{ - { - Name: to.Ptr("testConfig1"), - TCPConfiguration: &armnetwork.ConnectionMonitorTCPConfiguration{ - DisableTraceRoute: to.Ptr(false), - Port: to.Ptr[int32](80), - }, - TestFrequencySec: to.Ptr[int32](60), - Protocol: to.Ptr(armnetwork.ConnectionMonitorTestConfigurationProtocolTCP), - }}, - TestGroups: []*armnetwork.ConnectionMonitorTestGroup{ - { - Name: to.Ptr("test1"), - Destinations: []*string{ - to.Ptr("bing"), - to.Ptr("google")}, - Disable: to.Ptr(false), - Sources: []*string{ - to.Ptr("vm1"), - to.Ptr("CanaryWorkspaceVamshi")}, - TestConfigurations: []*string{ - to.Ptr("testConfig1")}, - }}, - }, - }, &armnetwork.ConnectionMonitorsClientBeginCreateOrUpdateOptions{Migrate: nil}) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - res, err := poller.PollUntilDone(ctx, nil) - if err != nil { - log.Fatalf("failed to pull the result: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.ConnectionMonitorResult = armnetwork.ConnectionMonitorResult{ - // Name: to.Ptr("cm1"), - // Type: to.Ptr("Microsoft.Network/networkWatchers/connectionMonitors"), - // Etag: to.Ptr("W/\"e7497f26-5f09-4559-900b-fe98f3dedb6f\""), - // ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/networkWatchers/nw1/connectionMonitors/cm1"), - // Location: to.Ptr("centraluseuap"), - // Properties: &armnetwork.ConnectionMonitorResultProperties{ - // Endpoints: []*armnetwork.ConnectionMonitorEndpoint{ - // { - // Name: to.Ptr("vm1"), - // ResourceID: to.Ptr("/subscriptions/96e68903-0a56-4819-9987-8d08ad6a1f99/resourceGroups/NwRgIrinaCentralUSEUAP/providers/Microsoft.Compute/virtualMachines/vm1"), - // }, - // { - // Name: to.Ptr("CanaryWorkspaceVamshi"), - // Filter: &armnetwork.ConnectionMonitorEndpointFilter{ - // Type: to.Ptr(armnetwork.ConnectionMonitorEndpointFilterTypeInclude), - // Items: []*armnetwork.ConnectionMonitorEndpointFilterItem{ - // { - // Type: to.Ptr(armnetwork.ConnectionMonitorEndpointFilterItemTypeAgentAddress), - // Address: to.Ptr("npmuser"), - // }}, - // }, - // ResourceID: to.Ptr("/subscriptions/96e68903-0a56-4819-9987-8d08ad6a1f99/resourceGroups/vasamudrRG/providers/Microsoft.OperationalInsights/workspaces/vasamudrWorkspace"), - // }, - // { - // Name: to.Ptr("bing"), - // Address: to.Ptr("bing.com"), - // }, - // { - // Name: to.Ptr("google"), - // Address: to.Ptr("google.com"), - // }}, - // Outputs: []*armnetwork.ConnectionMonitorOutput{ - // }, - // TestConfigurations: []*armnetwork.ConnectionMonitorTestConfiguration{ - // { - // Name: to.Ptr("testConfig1"), - // TCPConfiguration: &armnetwork.ConnectionMonitorTCPConfiguration{ - // DisableTraceRoute: to.Ptr(false), - // Port: to.Ptr[int32](80), - // }, - // TestFrequencySec: to.Ptr[int32](60), - // Protocol: to.Ptr(armnetwork.ConnectionMonitorTestConfigurationProtocolTCP), - // }}, - // TestGroups: []*armnetwork.ConnectionMonitorTestGroup{ - // { - // Name: to.Ptr("test1"), - // Destinations: []*string{ - // to.Ptr("bing"), - // to.Ptr("google")}, - // Disable: to.Ptr(false), - // Sources: []*string{ - // to.Ptr("vm1"), - // to.Ptr("CanaryWorkspaceVamshi")}, - // TestConfigurations: []*string{ - // to.Ptr("testConfig1")}, - // }}, - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/4883fa5dbf6f2c9093fac8ce334547e9dfac68fa/specification/network/resource-manager/Microsoft.Network/stable/2024-03-01/examples/NetworkWatcherConnectionMonitorCreateWithArcNetwork.json -func ExampleConnectionMonitorsClient_BeginCreateOrUpdate_createConnectionMonitorWithArcNetwork() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armnetwork.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewConnectionMonitorsClient().BeginCreateOrUpdate(ctx, "rg1", "nw1", "cm1", armnetwork.ConnectionMonitor{ - Properties: &armnetwork.ConnectionMonitorParameters{ - Endpoints: []*armnetwork.ConnectionMonitorEndpoint{ - { - Name: to.Ptr("vm1"), - Type: to.Ptr(armnetwork.EndpointTypeAzureVM), - ResourceID: to.Ptr("/subscriptions/9cece3e3-0f7d-47ca-af0e-9772773f90b7/resourceGroups/testRG/providers/Microsoft.Compute/virtualMachines/TESTVM"), - }, - { - Name: to.Ptr("bing"), - Type: to.Ptr(armnetwork.EndpointTypeExternalAddress), - Address: to.Ptr("bing.com"), - }, - { - Name: to.Ptr("google"), - Type: to.Ptr(armnetwork.EndpointTypeExternalAddress), - Address: to.Ptr("google.com"), - }, - { - Name: to.Ptr("ArcBasedNetwork"), - Type: to.Ptr(armnetwork.EndpointTypeAzureArcNetwork), - LocationDetails: &armnetwork.ConnectionMonitorEndpointLocationDetails{ - Region: to.Ptr("eastus"), - }, - Scope: &armnetwork.ConnectionMonitorEndpointScope{ - Include: []*armnetwork.ConnectionMonitorEndpointScopeItem{ - { - Address: to.Ptr("172.21.128.0/20"), - }}, - }, - SubscriptionID: to.Ptr("9cece3e3-0f7d-47ca-af0e-9772773f90b7"), - }}, - Outputs: []*armnetwork.ConnectionMonitorOutput{}, - TestConfigurations: []*armnetwork.ConnectionMonitorTestConfiguration{ - { - Name: to.Ptr("testConfig1"), - TCPConfiguration: &armnetwork.ConnectionMonitorTCPConfiguration{ - DisableTraceRoute: to.Ptr(false), - Port: to.Ptr[int32](80), - }, - TestFrequencySec: to.Ptr[int32](60), - Protocol: to.Ptr(armnetwork.ConnectionMonitorTestConfigurationProtocolTCP), - }}, - TestGroups: []*armnetwork.ConnectionMonitorTestGroup{ - { - Name: to.Ptr("test1"), - Destinations: []*string{ - to.Ptr("bing"), - to.Ptr("google")}, - Disable: to.Ptr(false), - Sources: []*string{ - to.Ptr("vm1"), - to.Ptr("ArcBasedNetwork")}, - TestConfigurations: []*string{ - to.Ptr("testConfig1")}, - }}, - }, - }, &armnetwork.ConnectionMonitorsClientBeginCreateOrUpdateOptions{Migrate: nil}) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - res, err := poller.PollUntilDone(ctx, nil) - if err != nil { - log.Fatalf("failed to pull the result: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.ConnectionMonitorResult = armnetwork.ConnectionMonitorResult{ - // Name: to.Ptr("cm1"), - // Type: to.Ptr("Microsoft.Network/networkWatchers/connectionMonitors"), - // Etag: to.Ptr("W/\"e7497f26-5f09-4559-900b-fe98f3dedb6f\""), - // ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/networkWatchers/nw1/connectionMonitors/cm1"), - // Location: to.Ptr("centraluseuap"), - // Properties: &armnetwork.ConnectionMonitorResultProperties{ - // Endpoints: []*armnetwork.ConnectionMonitorEndpoint{ - // { - // Name: to.Ptr("vm1"), - // ResourceID: to.Ptr("/subscriptions/9cece3e3-0f7d-47ca-af0e-9772773f90b7/resourceGroups/testRG/providers/Microsoft.Compute/virtualMachines/TESTVM"), - // }, - // { - // Name: to.Ptr("ArcBasedNetwork"), - // Type: to.Ptr(armnetwork.EndpointTypeAzureArcNetwork), - // LocationDetails: &armnetwork.ConnectionMonitorEndpointLocationDetails{ - // Region: to.Ptr("eastus"), - // }, - // Scope: &armnetwork.ConnectionMonitorEndpointScope{ - // Include: []*armnetwork.ConnectionMonitorEndpointScopeItem{ - // { - // Address: to.Ptr("172.21.128.0/20"), - // }}, - // }, - // SubscriptionID: to.Ptr("9cece3e3-0f7d-47ca-af0e-9772773f90b7"), - // }, - // { - // Name: to.Ptr("bing"), - // Address: to.Ptr("bing.com"), - // }, - // { - // Name: to.Ptr("google"), - // Address: to.Ptr("google.com"), - // }}, - // Outputs: []*armnetwork.ConnectionMonitorOutput{ - // }, - // TestConfigurations: []*armnetwork.ConnectionMonitorTestConfiguration{ - // { - // Name: to.Ptr("testConfig1"), - // TCPConfiguration: &armnetwork.ConnectionMonitorTCPConfiguration{ - // DisableTraceRoute: to.Ptr(false), - // Port: to.Ptr[int32](80), - // }, - // TestFrequencySec: to.Ptr[int32](60), - // Protocol: to.Ptr(armnetwork.ConnectionMonitorTestConfigurationProtocolTCP), - // }}, - // TestGroups: []*armnetwork.ConnectionMonitorTestGroup{ - // { - // Name: to.Ptr("test1"), - // Destinations: []*string{ - // to.Ptr("bing"), - // to.Ptr("google")}, - // Disable: to.Ptr(false), - // Sources: []*string{ - // to.Ptr("vm1"), - // to.Ptr("ArcBasedNetwork")}, - // TestConfigurations: []*string{ - // to.Ptr("testConfig1")}, - // }}, - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/4883fa5dbf6f2c9093fac8ce334547e9dfac68fa/specification/network/resource-manager/Microsoft.Network/stable/2024-03-01/examples/NetworkWatcherConnectionMonitorGet.json -func ExampleConnectionMonitorsClient_Get() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armnetwork.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewConnectionMonitorsClient().Get(ctx, "rg1", "nw1", "cm1", nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.ConnectionMonitorResult = armnetwork.ConnectionMonitorResult{ - // Name: to.Ptr("cm1"), - // Type: to.Ptr("Microsoft.Network/networkWatchers/connectionMonitors"), - // Etag: to.Ptr("W/\"00000000-0000-0000-0000-000000000000\""), - // ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/networkWatchers/nw1/connectionMonitors/cm1"), - // Location: to.Ptr("eastus"), - // Properties: &armnetwork.ConnectionMonitorResultProperties{ - // Endpoints: []*armnetwork.ConnectionMonitorEndpoint{ - // { - // Name: to.Ptr("source"), - // ResourceID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Compute/virtualMachines/ct1"), - // }, - // { - // Name: to.Ptr("destination"), - // Address: to.Ptr("bing.com"), - // }}, - // TestConfigurations: []*armnetwork.ConnectionMonitorTestConfiguration{ - // { - // Name: to.Ptr("tcp"), - // TCPConfiguration: &armnetwork.ConnectionMonitorTCPConfiguration{ - // Port: to.Ptr[int32](80), - // }, - // TestFrequencySec: to.Ptr[int32](60), - // Protocol: to.Ptr(armnetwork.ConnectionMonitorTestConfigurationProtocolTCP), - // }}, - // TestGroups: []*armnetwork.ConnectionMonitorTestGroup{ - // { - // Name: to.Ptr("tg"), - // Destinations: []*string{ - // to.Ptr("destination")}, - // Sources: []*string{ - // to.Ptr("source")}, - // TestConfigurations: []*string{ - // to.Ptr("tcp")}, - // }}, - // ProvisioningState: to.Ptr(armnetwork.ProvisioningStateSucceeded), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/4883fa5dbf6f2c9093fac8ce334547e9dfac68fa/specification/network/resource-manager/Microsoft.Network/stable/2024-03-01/examples/NetworkWatcherConnectionMonitorDelete.json -func ExampleConnectionMonitorsClient_BeginDelete() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armnetwork.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewConnectionMonitorsClient().BeginDelete(ctx, "rg1", "nw1", "cm1", nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - _, err = poller.PollUntilDone(ctx, nil) - if err != nil { - log.Fatalf("failed to pull the result: %v", err) - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/4883fa5dbf6f2c9093fac8ce334547e9dfac68fa/specification/network/resource-manager/Microsoft.Network/stable/2024-03-01/examples/NetworkWatcherConnectionMonitorUpdateTags.json -func ExampleConnectionMonitorsClient_UpdateTags() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armnetwork.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewConnectionMonitorsClient().UpdateTags(ctx, "rg1", "nw1", "cm1", armnetwork.TagsObject{ - Tags: map[string]*string{ - "tag1": to.Ptr("value1"), - "tag2": to.Ptr("value2"), - }, - }, nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.ConnectionMonitorResult = armnetwork.ConnectionMonitorResult{ - // Name: to.Ptr("cm1"), - // Type: to.Ptr("Microsoft.Network/networkWatchers/connectionMonitors"), - // Etag: to.Ptr("W/\"00000000-0000-0000-0000-000000000000\""), - // ID: to.Ptr("/subscriptions/subid/`/rg1/providers/Microsoft.Network/networkWatchers/nw1/connectionMonitors/cm1"), - // Location: to.Ptr("westcentralus"), - // Properties: &armnetwork.ConnectionMonitorResultProperties{ - // AutoStart: to.Ptr(true), - // Destination: &armnetwork.ConnectionMonitorDestination{ - // Address: to.Ptr("bing.com"), - // Port: to.Ptr[int32](80), - // }, - // MonitoringIntervalInSeconds: to.Ptr[int32](60), - // Source: &armnetwork.ConnectionMonitorSource{ - // Port: to.Ptr[int32](0), - // ResourceID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Compute/virtualMachines/vm1"), - // }, - // MonitoringStatus: to.Ptr("Running"), - // ProvisioningState: to.Ptr(armnetwork.ProvisioningStateSucceeded), - // StartTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2019-09-04T02:48:10.679Z"); return t}()), - // }, - // Tags: map[string]*string{ - // "tag1": to.Ptr("value1"), - // "tag2": to.Ptr("value2"), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/4883fa5dbf6f2c9093fac8ce334547e9dfac68fa/specification/network/resource-manager/Microsoft.Network/stable/2024-03-01/examples/NetworkWatcherConnectionMonitorStop.json -func ExampleConnectionMonitorsClient_BeginStop() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armnetwork.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewConnectionMonitorsClient().BeginStop(ctx, "rg1", "nw1", "cm1", nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - _, err = poller.PollUntilDone(ctx, nil) - if err != nil { - log.Fatalf("failed to pull the result: %v", err) - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/4883fa5dbf6f2c9093fac8ce334547e9dfac68fa/specification/network/resource-manager/Microsoft.Network/stable/2024-03-01/examples/NetworkWatcherConnectionMonitorStart.json -func ExampleConnectionMonitorsClient_BeginStart() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armnetwork.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewConnectionMonitorsClient().BeginStart(ctx, "rg1", "nw1", "cm1", nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - _, err = poller.PollUntilDone(ctx, nil) - if err != nil { - log.Fatalf("failed to pull the result: %v", err) - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/4883fa5dbf6f2c9093fac8ce334547e9dfac68fa/specification/network/resource-manager/Microsoft.Network/stable/2024-03-01/examples/NetworkWatcherConnectionMonitorQuery.json -func ExampleConnectionMonitorsClient_BeginQuery() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armnetwork.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewConnectionMonitorsClient().BeginQuery(ctx, "rg1", "nw1", "cm1", nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - res, err := poller.PollUntilDone(ctx, nil) - if err != nil { - log.Fatalf("failed to pull the result: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.ConnectionMonitorQueryResult = armnetwork.ConnectionMonitorQueryResult{ - // SourceStatus: to.Ptr(armnetwork.ConnectionMonitorSourceStatusActive), - // States: []*armnetwork.ConnectionStateSnapshot{ - // { - // ConnectionState: to.Ptr(armnetwork.ConnectionStateReachable), - // EndTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2018-01-08T05:12:41.526Z"); return t}()), - // EvaluationState: to.Ptr(armnetwork.EvaluationStateCompleted), - // Hops: []*armnetwork.ConnectivityHop{ - // { - // Type: to.Ptr("Source"), - // Address: to.Ptr("10.1.1.4"), - // ID: to.Ptr("7dbbe7aa-60ba-4650-831e-63d775d38e9e"), - // Issues: []*armnetwork.ConnectivityIssue{ - // }, - // NextHopIDs: []*string{ - // to.Ptr("75c8d819-b208-4584-a311-1aa45ce753f9")}, - // ResourceID: to.Ptr("subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/networkInterfaces/nic0/ipConfigurations/ipconfig1"), - // }, - // { - // Type: to.Ptr("VirtualNetwork"), - // Address: to.Ptr("192.168.100.4"), - // ID: to.Ptr("75c8d819-b208-4584-a311-1aa45ce753f9"), - // Issues: []*armnetwork.ConnectivityIssue{ - // }, - // NextHopIDs: []*string{ - // }, - // ResourceID: to.Ptr("subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/networkInterfaces/nic1/ipConfigurations/ipconfig1"), - // }}, - // StartTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2018-01-08T03:42:33.338Z"); return t}()), - // }}, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/4883fa5dbf6f2c9093fac8ce334547e9dfac68fa/specification/network/resource-manager/Microsoft.Network/stable/2024-03-01/examples/NetworkWatcherConnectionMonitorList.json -func ExampleConnectionMonitorsClient_NewListPager() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armnetwork.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := clientFactory.NewConnectionMonitorsClient().NewListPager("rg1", "nw1", nil) - for pager.More() { - page, err := pager.NextPage(ctx) - if err != nil { - log.Fatalf("failed to advance page: %v", err) - } - for _, v := range page.Value { - // You could use page here. We use blank identifier for just demo purposes. - _ = v - } - // If the HTTP response code is 200 as defined in example definition, your page structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // page.ConnectionMonitorListResult = armnetwork.ConnectionMonitorListResult{ - // Value: []*armnetwork.ConnectionMonitorResult{ - // { - // Name: to.Ptr("cm1"), - // Type: to.Ptr("Microsoft.Network/networkWatchers/connectionMonitors"), - // Etag: to.Ptr("W/\"00000000-0000-0000-0000-000000000000\""), - // ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/networkWatchers/nw1/connectionMonitors/cm1"), - // Location: to.Ptr("eastus"), - // Properties: &armnetwork.ConnectionMonitorResultProperties{ - // Endpoints: []*armnetwork.ConnectionMonitorEndpoint{ - // { - // Name: to.Ptr("source"), - // ResourceID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Compute/virtualMachines/ct1"), - // }, - // { - // Name: to.Ptr("destination"), - // Address: to.Ptr("bing.com"), - // }}, - // TestConfigurations: []*armnetwork.ConnectionMonitorTestConfiguration{ - // { - // Name: to.Ptr("tcp"), - // TCPConfiguration: &armnetwork.ConnectionMonitorTCPConfiguration{ - // Port: to.Ptr[int32](80), - // }, - // TestFrequencySec: to.Ptr[int32](60), - // Protocol: to.Ptr(armnetwork.ConnectionMonitorTestConfigurationProtocolTCP), - // }}, - // TestGroups: []*armnetwork.ConnectionMonitorTestGroup{ - // { - // Name: to.Ptr("tg"), - // Destinations: []*string{ - // to.Ptr("destination")}, - // Sources: []*string{ - // to.Ptr("source")}, - // TestConfigurations: []*string{ - // to.Ptr("tcp")}, - // }}, - // ProvisioningState: to.Ptr(armnetwork.ProvisioningStateSucceeded), - // }, - // }, - // { - // Name: to.Ptr("cm2"), - // Type: to.Ptr("Microsoft.Network/networkWatchers/connectionMonitors"), - // Etag: to.Ptr("W/\"00000000-0000-0000-0000-000000000000\""), - // ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/networkWatchers/nw1/connectionMonitors/cm2"), - // Location: to.Ptr("eastus"), - // Properties: &armnetwork.ConnectionMonitorResultProperties{ - // Endpoints: []*armnetwork.ConnectionMonitorEndpoint{ - // { - // Name: to.Ptr("source"), - // ResourceID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Compute/virtualMachines/ct2"), - // }, - // { - // Name: to.Ptr("destination"), - // Address: to.Ptr("google.com"), - // }}, - // TestConfigurations: []*armnetwork.ConnectionMonitorTestConfiguration{ - // { - // Name: to.Ptr("tcp"), - // TCPConfiguration: &armnetwork.ConnectionMonitorTCPConfiguration{ - // Port: to.Ptr[int32](80), - // }, - // TestFrequencySec: to.Ptr[int32](60), - // Protocol: to.Ptr(armnetwork.ConnectionMonitorTestConfigurationProtocolTCP), - // }}, - // TestGroups: []*armnetwork.ConnectionMonitorTestGroup{ - // { - // Name: to.Ptr("tg"), - // Destinations: []*string{ - // to.Ptr("destination")}, - // Sources: []*string{ - // to.Ptr("source")}, - // TestConfigurations: []*string{ - // to.Ptr("tcp")}, - // }}, - // ProvisioningState: to.Ptr(armnetwork.ProvisioningStateSucceeded), - // }, - // }}, - // } - } -} diff --git a/sdk/resourcemanager/network/armnetwork/connectivityconfigurations_client_example_test.go b/sdk/resourcemanager/network/armnetwork/connectivityconfigurations_client_example_test.go deleted file mode 100644 index e6fd8d245ef0..000000000000 --- a/sdk/resourcemanager/network/armnetwork/connectivityconfigurations_client_example_test.go +++ /dev/null @@ -1,228 +0,0 @@ -//go:build go1.18 -// +build go1.18 - -// 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. -// DO NOT EDIT. - -package armnetwork_test - -import ( - "context" - "log" - - "github.com/Azure/azure-sdk-for-go/sdk/azcore/to" - "github.com/Azure/azure-sdk-for-go/sdk/azidentity" - "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/network/armnetwork/v6" -) - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/4883fa5dbf6f2c9093fac8ce334547e9dfac68fa/specification/network/resource-manager/Microsoft.Network/stable/2024-03-01/examples/NetworkManagerConnectivityConfigurationGet.json -func ExampleConnectivityConfigurationsClient_Get() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armnetwork.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewConnectivityConfigurationsClient().Get(ctx, "myResourceGroup", "testNetworkManager", "myTestConnectivityConfig", nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.ConnectivityConfiguration = armnetwork.ConnectivityConfiguration{ - // Name: to.Ptr("myTestConnectivityConfig"), - // Type: to.Ptr("Microsoft.Network/networkManagers/connectivityConfigurations"), - // ID: to.Ptr("subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/myResourceGroup/providers/Microsoft.Network/networkManagers/testNetworkManager/connectivityConfigurations/myTestConnectivityConfig"), - // Properties: &armnetwork.ConnectivityConfigurationProperties{ - // Description: to.Ptr("Sample Configuration"), - // AppliesToGroups: []*armnetwork.ConnectivityGroupItem{ - // { - // GroupConnectivity: to.Ptr(armnetwork.GroupConnectivityNone), - // IsGlobal: to.Ptr(armnetwork.IsGlobalFalse), - // NetworkGroupID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/myResourceGroup/providers/Microsoft.Network/networkManagers/testNetworkManager/networkGroups/group1"), - // UseHubGateway: to.Ptr(armnetwork.UseHubGatewayTrue), - // }}, - // ConnectivityTopology: to.Ptr(armnetwork.ConnectivityTopologyHubAndSpoke), - // DeleteExistingPeering: to.Ptr(armnetwork.DeleteExistingPeeringTrue), - // Hubs: []*armnetwork.Hub{ - // { - // ResourceID: to.Ptr("subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/myResourceGroup/providers/Microsoft.Network/virtualNetworks/myHubVnet"), - // ResourceType: to.Ptr("Microsoft.Network/virtualNetworks"), - // }}, - // IsGlobal: to.Ptr(armnetwork.IsGlobalTrue), - // ProvisioningState: to.Ptr(armnetwork.ProvisioningStateSucceeded), - // ResourceGUID: to.Ptr("00000000-0000-0000-0000-000000000000"), - // }, - // SystemData: &armnetwork.SystemData{ - // CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-01-11T18:52:27.000Z"); return t}()), - // CreatedBy: to.Ptr("b69a9388-9488-4534-b470-7ec6d41beef5"), - // CreatedByType: to.Ptr(armnetwork.CreatedByTypeUser), - // LastModifiedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-01-11T18:52:27.000Z"); return t}()), - // LastModifiedBy: to.Ptr("b69a9388-9488-4534-b470-7ec6d41beef5"), - // LastModifiedByType: to.Ptr(armnetwork.CreatedByTypeUser), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/4883fa5dbf6f2c9093fac8ce334547e9dfac68fa/specification/network/resource-manager/Microsoft.Network/stable/2024-03-01/examples/NetworkManagerConnectivityConfigurationPut.json -func ExampleConnectivityConfigurationsClient_CreateOrUpdate() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armnetwork.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewConnectivityConfigurationsClient().CreateOrUpdate(ctx, "myResourceGroup", "testNetworkManager", "myTestConnectivityConfig", armnetwork.ConnectivityConfiguration{ - Properties: &armnetwork.ConnectivityConfigurationProperties{ - Description: to.Ptr("Sample Configuration"), - AppliesToGroups: []*armnetwork.ConnectivityGroupItem{ - { - GroupConnectivity: to.Ptr(armnetwork.GroupConnectivityNone), - IsGlobal: to.Ptr(armnetwork.IsGlobalFalse), - NetworkGroupID: to.Ptr("subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/myResourceGroup/providers/Microsoft.Network/networkManagers/testNetworkManager/networkGroups/group1"), - UseHubGateway: to.Ptr(armnetwork.UseHubGatewayTrue), - }}, - ConnectivityTopology: to.Ptr(armnetwork.ConnectivityTopologyHubAndSpoke), - DeleteExistingPeering: to.Ptr(armnetwork.DeleteExistingPeeringTrue), - Hubs: []*armnetwork.Hub{ - { - ResourceID: to.Ptr("subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/myResourceGroup/providers/Microsoft.Network/virtualNetworks/myTestConnectivityConfig"), - ResourceType: to.Ptr("Microsoft.Network/virtualNetworks"), - }}, - IsGlobal: to.Ptr(armnetwork.IsGlobalTrue), - }, - }, nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.ConnectivityConfiguration = armnetwork.ConnectivityConfiguration{ - // Name: to.Ptr("myTestConnectivityConfig"), - // Type: to.Ptr("Microsoft.Network/networkManagers/connectivityConfigurations"), - // ID: to.Ptr("subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/myResourceGroup/providers/Microsoft.Network/networkManagers/testNetworkManager/connectivityConfigurations/myTestConnectivityConfig"), - // Properties: &armnetwork.ConnectivityConfigurationProperties{ - // Description: to.Ptr("Sample Connectivity Configuration"), - // AppliesToGroups: []*armnetwork.ConnectivityGroupItem{ - // { - // GroupConnectivity: to.Ptr(armnetwork.GroupConnectivityNone), - // IsGlobal: to.Ptr(armnetwork.IsGlobalFalse), - // NetworkGroupID: to.Ptr("subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/myResourceGroup/providers/Microsoft.Network/networkManagers/testNetworkManager/groups/group1"), - // UseHubGateway: to.Ptr(armnetwork.UseHubGatewayTrue), - // }}, - // ConnectivityTopology: to.Ptr(armnetwork.ConnectivityTopologyHubAndSpoke), - // DeleteExistingPeering: to.Ptr(armnetwork.DeleteExistingPeeringTrue), - // Hubs: []*armnetwork.Hub{ - // { - // ResourceID: to.Ptr("subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/myResourceGroup/providers/Microsoft.Network/virtualNetworks/myTestConnectivityConfig"), - // ResourceType: to.Ptr("Microsoft.Network/virtualNetworks"), - // }}, - // IsGlobal: to.Ptr(armnetwork.IsGlobalTrue), - // ProvisioningState: to.Ptr(armnetwork.ProvisioningStateSucceeded), - // ResourceGUID: to.Ptr("00000000-0000-0000-0000-000000000000"), - // }, - // SystemData: &armnetwork.SystemData{ - // CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-01-11T18:52:27.000Z"); return t}()), - // CreatedBy: to.Ptr("b69a9388-9488-4534-b470-7ec6d41beef5"), - // CreatedByType: to.Ptr(armnetwork.CreatedByTypeUser), - // LastModifiedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-01-11T18:52:27.000Z"); return t}()), - // LastModifiedBy: to.Ptr("b69a9388-9488-4534-b470-7ec6d41beef5"), - // LastModifiedByType: to.Ptr(armnetwork.CreatedByTypeUser), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/4883fa5dbf6f2c9093fac8ce334547e9dfac68fa/specification/network/resource-manager/Microsoft.Network/stable/2024-03-01/examples/NetworkManagerConnectivityConfigurationDelete.json -func ExampleConnectivityConfigurationsClient_BeginDelete() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armnetwork.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewConnectivityConfigurationsClient().BeginDelete(ctx, "myResourceGroup", "testNetworkManager", "myTestConnectivityConfig", &armnetwork.ConnectivityConfigurationsClientBeginDeleteOptions{Force: to.Ptr(false)}) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - _, err = poller.PollUntilDone(ctx, nil) - if err != nil { - log.Fatalf("failed to pull the result: %v", err) - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/4883fa5dbf6f2c9093fac8ce334547e9dfac68fa/specification/network/resource-manager/Microsoft.Network/stable/2024-03-01/examples/NetworkManagerConnectivityConfigurationList.json -func ExampleConnectivityConfigurationsClient_NewListPager() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armnetwork.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := clientFactory.NewConnectivityConfigurationsClient().NewListPager("myResourceGroup", "testNetworkManager", &armnetwork.ConnectivityConfigurationsClientListOptions{Top: nil, - SkipToken: nil, - }) - for pager.More() { - page, err := pager.NextPage(ctx) - if err != nil { - log.Fatalf("failed to advance page: %v", err) - } - for _, v := range page.Value { - // You could use page here. We use blank identifier for just demo purposes. - _ = v - } - // If the HTTP response code is 200 as defined in example definition, your page structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // page.ConnectivityConfigurationListResult = armnetwork.ConnectivityConfigurationListResult{ - // Value: []*armnetwork.ConnectivityConfiguration{ - // { - // Name: to.Ptr("myTestConnectivityConfig"), - // Type: to.Ptr("Microsoft.Network/networkManagers/connectivityConfigurations"), - // ID: to.Ptr("subscription/00000000-0000-0000-0000-000000000000/resourceGroups/myResourceGroup/providers/Microsoft.Network/networkManagers/testNetworkManager/connectivityConfigurations/myTestConnectivityConfig"), - // Properties: &armnetwork.ConnectivityConfigurationProperties{ - // Description: to.Ptr("Sample Configuration"), - // AppliesToGroups: []*armnetwork.ConnectivityGroupItem{ - // { - // GroupConnectivity: to.Ptr(armnetwork.GroupConnectivityNone), - // IsGlobal: to.Ptr(armnetwork.IsGlobalFalse), - // NetworkGroupID: to.Ptr("subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/myResourceGroup/providers/Microsoft.Network/networkManagers/testNetworkManager/netwrokGroups/group1"), - // UseHubGateway: to.Ptr(armnetwork.UseHubGatewayTrue), - // }}, - // ConnectivityTopology: to.Ptr(armnetwork.ConnectivityTopologyHubAndSpoke), - // DeleteExistingPeering: to.Ptr(armnetwork.DeleteExistingPeeringTrue), - // Hubs: []*armnetwork.Hub{ - // { - // ResourceID: to.Ptr("subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/myResourceGroup/providers/Microsoft.Network/virtualNetworks/myHubVnet"), - // ResourceType: to.Ptr("Microsoft.Network/virtualNetworks"), - // }}, - // IsGlobal: to.Ptr(armnetwork.IsGlobalTrue), - // ProvisioningState: to.Ptr(armnetwork.ProvisioningStateSucceeded), - // ResourceGUID: to.Ptr("00000000-0000-0000-0000-000000000000"), - // }, - // SystemData: &armnetwork.SystemData{ - // CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-01-11T18:52:27.000Z"); return t}()), - // CreatedBy: to.Ptr("b69a9388-9488-4534-b470-7ec6d41beef5"), - // CreatedByType: to.Ptr(armnetwork.CreatedByTypeUser), - // LastModifiedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-01-11T18:52:27.000Z"); return t}()), - // LastModifiedBy: to.Ptr("b69a9388-9488-4534-b470-7ec6d41beef5"), - // LastModifiedByType: to.Ptr(armnetwork.CreatedByTypeUser), - // }, - // }}, - // } - } -} diff --git a/sdk/resourcemanager/network/armnetwork/constants.go b/sdk/resourcemanager/network/armnetwork/constants.go index 4db1cb7968e6..be7016d2a348 100644 --- a/sdk/resourcemanager/network/armnetwork/constants.go +++ b/sdk/resourcemanager/network/armnetwork/constants.go @@ -10,7 +10,7 @@ package armnetwork const ( moduleName = "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/network/armnetwork" - moduleVersion = "v6.1.0" + moduleVersion = "v6.1.1" ) // Access - Access to be allowed or denied. diff --git a/sdk/resourcemanager/network/armnetwork/customipprefixes_client_example_test.go b/sdk/resourcemanager/network/armnetwork/customipprefixes_client_example_test.go deleted file mode 100644 index 64d0f2037296..000000000000 --- a/sdk/resourcemanager/network/armnetwork/customipprefixes_client_example_test.go +++ /dev/null @@ -1,627 +0,0 @@ -//go:build go1.18 -// +build go1.18 - -// 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. -// DO NOT EDIT. - -package armnetwork_test - -import ( - "context" - "log" - - "github.com/Azure/azure-sdk-for-go/sdk/azcore/to" - "github.com/Azure/azure-sdk-for-go/sdk/azidentity" - "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/network/armnetwork/v6" -) - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/4883fa5dbf6f2c9093fac8ce334547e9dfac68fa/specification/network/resource-manager/Microsoft.Network/stable/2024-03-01/examples/CustomIpPrefixDelete.json -func ExampleCustomIPPrefixesClient_BeginDelete() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armnetwork.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewCustomIPPrefixesClient().BeginDelete(ctx, "rg1", "test-customipprefix", nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - _, err = poller.PollUntilDone(ctx, nil) - if err != nil { - log.Fatalf("failed to pull the result: %v", err) - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/4883fa5dbf6f2c9093fac8ce334547e9dfac68fa/specification/network/resource-manager/Microsoft.Network/stable/2024-03-01/examples/CustomIpPrefixGet.json -func ExampleCustomIPPrefixesClient_Get() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armnetwork.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewCustomIPPrefixesClient().Get(ctx, "rg1", "test-customipprefix", &armnetwork.CustomIPPrefixesClientGetOptions{Expand: nil}) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.CustomIPPrefix = armnetwork.CustomIPPrefix{ - // Name: to.Ptr("test-customipprefix"), - // Type: to.Ptr("Microsoft.Network/customIpPrefixes"), - // ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/customIpPrefixes/test-customipprefix"), - // Location: to.Ptr("westus"), - // Etag: to.Ptr("W/\"00000000-0000-0000-0000-00000000\""), - // Properties: &armnetwork.CustomIPPrefixPropertiesFormat{ - // AuthorizationMessage: to.Ptr("authorizationMessage"), - // ChildCustomIPPrefixes: []*armnetwork.SubResource{ - // }, - // Cidr: to.Ptr("0.0.0.0/24"), - // CommissionedState: to.Ptr(armnetwork.CommissionedStateCommissioned), - // ExpressRouteAdvertise: to.Ptr(false), - // FailedReason: to.Ptr(""), - // NoInternetAdvertise: to.Ptr(false), - // ProvisioningState: to.Ptr(armnetwork.ProvisioningStateSucceeded), - // PublicIPPrefixes: []*armnetwork.SubResource{ - // }, - // ResourceGUID: to.Ptr("00000000-0000-0000-0000-00000000"), - // SignedMessage: to.Ptr("signedMessage"), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/4883fa5dbf6f2c9093fac8ce334547e9dfac68fa/specification/network/resource-manager/Microsoft.Network/stable/2024-03-01/examples/CustomIpPrefixCreateCustomizedValues.json -func ExampleCustomIPPrefixesClient_BeginCreateOrUpdate() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armnetwork.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewCustomIPPrefixesClient().BeginCreateOrUpdate(ctx, "rg1", "test-customipprefix", armnetwork.CustomIPPrefix{ - Location: to.Ptr("westus"), - Properties: &armnetwork.CustomIPPrefixPropertiesFormat{ - Cidr: to.Ptr("0.0.0.0/24"), - }, - }, nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - res, err := poller.PollUntilDone(ctx, nil) - if err != nil { - log.Fatalf("failed to pull the result: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.CustomIPPrefix = armnetwork.CustomIPPrefix{ - // Name: to.Ptr("test-customipprefix"), - // Type: to.Ptr("Microsoft.Network/customIpPrefixes"), - // ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/customIpPrefixes/test-customipprefix"), - // Location: to.Ptr("westus"), - // Etag: to.Ptr("W/\"00000000-0000-0000-0000-00000000\""), - // Properties: &armnetwork.CustomIPPrefixPropertiesFormat{ - // AuthorizationMessage: to.Ptr("authorizationMessage"), - // ChildCustomIPPrefixes: []*armnetwork.SubResource{ - // }, - // Cidr: to.Ptr("192.168.254.2/24"), - // CommissionedState: to.Ptr(armnetwork.CommissionedStateProvisioning), - // FailedReason: to.Ptr(""), - // ProvisioningState: to.Ptr(armnetwork.ProvisioningStateSucceeded), - // PublicIPPrefixes: []*armnetwork.SubResource{ - // }, - // ResourceGUID: to.Ptr("00000000-0000-0000-0000-00000000"), - // SignedMessage: to.Ptr("signedMessage"), - // }, - // Zones: []*string{ - // to.Ptr("1")}, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/4883fa5dbf6f2c9093fac8ce334547e9dfac68fa/specification/network/resource-manager/Microsoft.Network/stable/2024-03-01/examples/CustomIpPrefixUpdateTags.json -func ExampleCustomIPPrefixesClient_UpdateTags() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armnetwork.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewCustomIPPrefixesClient().UpdateTags(ctx, "rg1", "test-customipprefix", armnetwork.TagsObject{ - Tags: map[string]*string{ - "tag1": to.Ptr("value1"), - "tag2": to.Ptr("value2"), - }, - }, nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.CustomIPPrefix = armnetwork.CustomIPPrefix{ - // Name: to.Ptr("test-customipprefix"), - // Type: to.Ptr("Microsoft.Network/customIpPrefixes"), - // ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/customIpPrefixes/test-customipprefix"), - // Location: to.Ptr("westus"), - // Tags: map[string]*string{ - // "tag1": to.Ptr("value1"), - // "tag2": to.Ptr("value2"), - // }, - // Etag: to.Ptr("W/\"00000000-0000-0000-0000-00000000\""), - // Properties: &armnetwork.CustomIPPrefixPropertiesFormat{ - // AuthorizationMessage: to.Ptr("authorizationMessage"), - // ChildCustomIPPrefixes: []*armnetwork.SubResource{ - // }, - // Cidr: to.Ptr("192.168.254.2/24"), - // CommissionedState: to.Ptr(armnetwork.CommissionedStateProvisioning), - // FailedReason: to.Ptr(""), - // ProvisioningState: to.Ptr(armnetwork.ProvisioningStateSucceeded), - // PublicIPPrefixes: []*armnetwork.SubResource{ - // }, - // ResourceGUID: to.Ptr("00000000-0000-0000-0000-00000000"), - // SignedMessage: to.Ptr("signedMessage"), - // }, - // Zones: []*string{ - // to.Ptr("1")}, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/4883fa5dbf6f2c9093fac8ce334547e9dfac68fa/specification/network/resource-manager/Microsoft.Network/stable/2024-03-01/examples/CustomIpPrefixListAll.json -func ExampleCustomIPPrefixesClient_NewListAllPager() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armnetwork.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := clientFactory.NewCustomIPPrefixesClient().NewListAllPager(nil) - for pager.More() { - page, err := pager.NextPage(ctx) - if err != nil { - log.Fatalf("failed to advance page: %v", err) - } - for _, v := range page.Value { - // You could use page here. We use blank identifier for just demo purposes. - _ = v - } - // If the HTTP response code is 200 as defined in example definition, your page structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // page.CustomIPPrefixListResult = armnetwork.CustomIPPrefixListResult{ - // Value: []*armnetwork.CustomIPPrefix{ - // { - // Name: to.Ptr("test-customipprefix"), - // Type: to.Ptr("Microsoft.Network/customIpPrefixes"), - // ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/customIpPrefixes/test-customipprefix"), - // Location: to.Ptr("westus"), - // Etag: to.Ptr("W/\"00000000-0000-0000-0000-00000000\""), - // Properties: &armnetwork.CustomIPPrefixPropertiesFormat{ - // AuthorizationMessage: to.Ptr("authorizationMessage"), - // ChildCustomIPPrefixes: []*armnetwork.SubResource{ - // }, - // Cidr: to.Ptr("0.0.0.0/24"), - // CommissionedState: to.Ptr(armnetwork.CommissionedStateCommissioned), - // ExpressRouteAdvertise: to.Ptr(false), - // FailedReason: to.Ptr(""), - // NoInternetAdvertise: to.Ptr(false), - // ProvisioningState: to.Ptr(armnetwork.ProvisioningStateSucceeded), - // PublicIPPrefixes: []*armnetwork.SubResource{ - // }, - // ResourceGUID: to.Ptr("00000000-0000-0000-0000-00000000"), - // SignedMessage: to.Ptr("signedMessage"), - // }, - // }, - // { - // Name: to.Ptr("test-customipprefix2"), - // Type: to.Ptr("Microsoft.Network/customIpPrefixes"), - // ID: to.Ptr("/subscriptions/subid/resourceGroups/rg2/providers/Microsoft.Network/customIpPrefixes/test-customipprefix2"), - // Location: to.Ptr("westus"), - // Etag: to.Ptr("W/\"00000000-0000-0000-0000-00000000\""), - // Properties: &armnetwork.CustomIPPrefixPropertiesFormat{ - // AuthorizationMessage: to.Ptr("authorizationMessage"), - // ChildCustomIPPrefixes: []*armnetwork.SubResource{ - // }, - // Cidr: to.Ptr("0.0.2.0/23"), - // CommissionedState: to.Ptr(armnetwork.CommissionedStateCommissioned), - // ExpressRouteAdvertise: to.Ptr(false), - // FailedReason: to.Ptr(""), - // NoInternetAdvertise: to.Ptr(false), - // ProvisioningState: to.Ptr(armnetwork.ProvisioningStateSucceeded), - // PublicIPPrefixes: []*armnetwork.SubResource{ - // }, - // ResourceGUID: to.Ptr("00000000-0000-0000-0000-00000000"), - // SignedMessage: to.Ptr("signedMessage"), - // }, - // }, - // { - // Name: to.Ptr("test-customipprefix3"), - // Type: to.Ptr("Microsoft.Network/customIpPrefixes"), - // ID: to.Ptr("/subscriptions/subid/resourceGroups/rg3/providers/Microsoft.Network/customIpPrefixes/test-customipprefix3"), - // Location: to.Ptr("eastus"), - // Etag: to.Ptr("W/\"00000000-0000-0000-0000-00000000\""), - // Properties: &armnetwork.CustomIPPrefixPropertiesFormat{ - // AuthorizationMessage: to.Ptr("authorizationMessage"), - // ChildCustomIPPrefixes: []*armnetwork.SubResource{ - // }, - // Cidr: to.Ptr("0.0.4.0/22"), - // CommissionedState: to.Ptr(armnetwork.CommissionedStateProvisioning), - // ExpressRouteAdvertise: to.Ptr(false), - // FailedReason: to.Ptr(""), - // NoInternetAdvertise: to.Ptr(false), - // ProvisioningState: to.Ptr(armnetwork.ProvisioningStateSucceeded), - // PublicIPPrefixes: []*armnetwork.SubResource{ - // }, - // ResourceGUID: to.Ptr("00000000-0000-0000-0000-00000000"), - // SignedMessage: to.Ptr("signedMessage"), - // }, - // }, - // { - // Name: to.Ptr("test-customipprefix4"), - // Type: to.Ptr("Microsoft.Network/customIpPrefixes"), - // ID: to.Ptr("/subscriptions/subid/resourceGroups/rg3/providers/Microsoft.Network/customIpPrefixes/test-customipprefix4"), - // Location: to.Ptr("eastus"), - // Etag: to.Ptr("W/\"00000000-0000-0000-0000-00000000\""), - // Properties: &armnetwork.CustomIPPrefixPropertiesFormat{ - // AuthorizationMessage: to.Ptr("authorizationMessage"), - // ChildCustomIPPrefixes: []*armnetwork.SubResource{ - // }, - // Cidr: to.Ptr("2607:f0d1:1002:0001::/64"), - // CommissionedState: to.Ptr(armnetwork.CommissionedStateCommissioned), - // CustomIPPrefixParent: &armnetwork.SubResource{ - // ID: to.Ptr("/subscriptions/subid/resourceGroups/rg3/providers/Microsoft.Network/customIpPrefixes/test-customipprefix5"), - // }, - // ExpressRouteAdvertise: to.Ptr(false), - // FailedReason: to.Ptr(""), - // NoInternetAdvertise: to.Ptr(false), - // ProvisioningState: to.Ptr(armnetwork.ProvisioningStateSucceeded), - // PublicIPPrefixes: []*armnetwork.SubResource{ - // }, - // ResourceGUID: to.Ptr("00000000-0000-0000-0000-00000000"), - // SignedMessage: to.Ptr("signedMessage"), - // }, - // }, - // { - // Name: to.Ptr("test-customipprefix5"), - // Type: to.Ptr("Microsoft.Network/customIpPrefixes"), - // ID: to.Ptr("/subscriptions/subid/resourceGroups/rg3/providers/Microsoft.Network/customIpPrefixes/test-customipprefix5"), - // Location: to.Ptr("eastus"), - // Etag: to.Ptr("W/\"00000000-0000-0000-0000-00000000\""), - // Properties: &armnetwork.CustomIPPrefixPropertiesFormat{ - // AuthorizationMessage: to.Ptr("authorizationMessage"), - // ChildCustomIPPrefixes: []*armnetwork.SubResource{ - // { - // ID: to.Ptr("/subscriptions/subid/resourceGroups/rg3/providers/Microsoft.Network/customIpPrefixes/test-customipprefix4"), - // }}, - // Cidr: to.Ptr("2607:f0d1:1002::/48"), - // CommissionedState: to.Ptr(armnetwork.CommissionedStateProvisioned), - // ExpressRouteAdvertise: to.Ptr(false), - // FailedReason: to.Ptr(""), - // NoInternetAdvertise: to.Ptr(false), - // ProvisioningState: to.Ptr(armnetwork.ProvisioningStateSucceeded), - // PublicIPPrefixes: []*armnetwork.SubResource{ - // }, - // ResourceGUID: to.Ptr("00000000-0000-0000-0000-00000000"), - // SignedMessage: to.Ptr("signedMessage"), - // }, - // }, - // { - // Name: to.Ptr("test-customipprefix6"), - // Type: to.Ptr("Microsoft.Network/customIpPrefixes"), - // ID: to.Ptr("/subscriptions/subid/resourceGroups/rg3/providers/Microsoft.Network/customIpPrefixes/test-customipprefix6"), - // Location: to.Ptr("eastus"), - // Etag: to.Ptr("W/\"00000000-0000-0000-0000-00000000\""), - // Properties: &armnetwork.CustomIPPrefixPropertiesFormat{ - // AuthorizationMessage: to.Ptr("authorizationMessage"), - // ChildCustomIPPrefixes: []*armnetwork.SubResource{ - // }, - // Cidr: to.Ptr("0.0.5.0/22"), - // CommissionedState: to.Ptr(armnetwork.CommissionedState("ProvisionFailed")), - // ExpressRouteAdvertise: to.Ptr(false), - // FailedReason: to.Ptr("CustomerSignatureNotVerified"), - // NoInternetAdvertise: to.Ptr(false), - // ProvisioningState: to.Ptr(armnetwork.ProvisioningStateSucceeded), - // PublicIPPrefixes: []*armnetwork.SubResource{ - // }, - // ResourceGUID: to.Ptr("00000000-0000-0000-0000-00000000"), - // SignedMessage: to.Ptr("signedMessage"), - // }, - // }, - // { - // Name: to.Ptr("test-customipprefix6"), - // Type: to.Ptr("Microsoft.Network/customIpPrefixes"), - // ID: to.Ptr("/subscriptions/subid/resourceGroups/rg3/providers/Microsoft.Network/customIpPrefixes/test-customipprefix7"), - // Location: to.Ptr("eastus"), - // Etag: to.Ptr("W/\"00000000-0000-0000-0000-00000000\""), - // Properties: &armnetwork.CustomIPPrefixPropertiesFormat{ - // AuthorizationMessage: to.Ptr("authorizationMessage"), - // ChildCustomIPPrefixes: []*armnetwork.SubResource{ - // }, - // Cidr: to.Ptr("0.0.6.0/22"), - // CommissionedState: to.Ptr(armnetwork.CommissionedStateCommissioning), - // ExpressRouteAdvertise: to.Ptr(false), - // FailedReason: to.Ptr(""), - // NoInternetAdvertise: to.Ptr(false), - // ProvisioningState: to.Ptr(armnetwork.ProvisioningStateSucceeded), - // PublicIPPrefixes: []*armnetwork.SubResource{ - // }, - // ResourceGUID: to.Ptr("00000000-0000-0000-0000-00000000"), - // SignedMessage: to.Ptr("signedMessage"), - // }, - // }, - // { - // Name: to.Ptr("test-customipprefix6"), - // Type: to.Ptr("Microsoft.Network/customIpPrefixes"), - // ID: to.Ptr("/subscriptions/subid/resourceGroups/rg3/providers/Microsoft.Network/customIpPrefixes/test-customipprefix8"), - // Location: to.Ptr("eastus"), - // Etag: to.Ptr("W/\"00000000-0000-0000-0000-00000000\""), - // Properties: &armnetwork.CustomIPPrefixPropertiesFormat{ - // AuthorizationMessage: to.Ptr("authorizationMessage"), - // ChildCustomIPPrefixes: []*armnetwork.SubResource{ - // }, - // Cidr: to.Ptr("0.0.7.0/22"), - // CommissionedState: to.Ptr(armnetwork.CommissionedStateCommissioning), - // ExpressRouteAdvertise: to.Ptr(false), - // FailedReason: to.Ptr(""), - // NoInternetAdvertise: to.Ptr(false), - // ProvisioningState: to.Ptr(armnetwork.ProvisioningStateSucceeded), - // PublicIPPrefixes: []*armnetwork.SubResource{ - // }, - // ResourceGUID: to.Ptr("00000000-0000-0000-0000-00000000"), - // SignedMessage: to.Ptr("signedMessage"), - // }, - // }, - // { - // Name: to.Ptr("test-customipprefix6"), - // Type: to.Ptr("Microsoft.Network/customIpPrefixes"), - // ID: to.Ptr("/subscriptions/subid/resourceGroups/rg3/providers/Microsoft.Network/customIpPrefixes/test-customipprefix8"), - // Location: to.Ptr("eastus"), - // Etag: to.Ptr("W/\"00000000-0000-0000-0000-00000000\""), - // Properties: &armnetwork.CustomIPPrefixPropertiesFormat{ - // Asn: to.Ptr("11"), - // AuthorizationMessage: to.Ptr("authorizationMessage"), - // ChildCustomIPPrefixes: []*armnetwork.SubResource{ - // }, - // Cidr: to.Ptr("0.0.7.0/22"), - // CommissionedState: to.Ptr(armnetwork.CommissionedStateCommissioning), - // ExpressRouteAdvertise: to.Ptr(false), - // FailedReason: to.Ptr(""), - // NoInternetAdvertise: to.Ptr(false), - // ProvisioningState: to.Ptr(armnetwork.ProvisioningStateSucceeded), - // PublicIPPrefixes: []*armnetwork.SubResource{ - // }, - // ResourceGUID: to.Ptr("00000000-0000-0000-0000-00000000"), - // SignedMessage: to.Ptr("signedMessage"), - // }, - // }, - // { - // Name: to.Ptr("test-customipprefix6"), - // Type: to.Ptr("Microsoft.Network/customIpPrefixes"), - // ID: to.Ptr("/subscriptions/subid/resourceGroups/rg3/providers/Microsoft.Network/customIpPrefixes/test-customipprefix8"), - // Location: to.Ptr("eastus"), - // Etag: to.Ptr("W/\"00000000-0000-0000-0000-00000000\""), - // Properties: &armnetwork.CustomIPPrefixPropertiesFormat{ - // AuthorizationMessage: to.Ptr("authorizationMessage"), - // ChildCustomIPPrefixes: []*armnetwork.SubResource{ - // }, - // Cidr: to.Ptr("0.0.7.0/22"), - // CommissionedState: to.Ptr(armnetwork.CommissionedStateCommissioning), - // ExpressRouteAdvertise: to.Ptr(false), - // FailedReason: to.Ptr(""), - // Geo: to.Ptr(armnetwork.GeoGLOBAL), - // NoInternetAdvertise: to.Ptr(false), - // ProvisioningState: to.Ptr(armnetwork.ProvisioningStateSucceeded), - // PublicIPPrefixes: []*armnetwork.SubResource{ - // }, - // ResourceGUID: to.Ptr("00000000-0000-0000-0000-00000000"), - // SignedMessage: to.Ptr("signedMessage"), - // }, - // }, - // { - // Name: to.Ptr("test-customipprefix6"), - // Type: to.Ptr("Microsoft.Network/customIpPrefixes"), - // ID: to.Ptr("/subscriptions/subid/resourceGroups/rg3/providers/Microsoft.Network/customIpPrefixes/test-customipprefix8"), - // Location: to.Ptr("eastus"), - // Etag: to.Ptr("W/\"00000000-0000-0000-0000-00000000\""), - // Properties: &armnetwork.CustomIPPrefixPropertiesFormat{ - // AuthorizationMessage: to.Ptr("authorizationMessage"), - // ChildCustomIPPrefixes: []*armnetwork.SubResource{ - // }, - // Cidr: to.Ptr("0.0.7.0/22"), - // CommissionedState: to.Ptr(armnetwork.CommissionedStateCommissioning), - // ExpressRouteAdvertise: to.Ptr(true), - // FailedReason: to.Ptr(""), - // NoInternetAdvertise: to.Ptr(false), - // ProvisioningState: to.Ptr(armnetwork.ProvisioningStateSucceeded), - // PublicIPPrefixes: []*armnetwork.SubResource{ - // }, - // ResourceGUID: to.Ptr("00000000-0000-0000-0000-00000000"), - // SignedMessage: to.Ptr("signedMessage"), - // }, - // }, - // { - // Name: to.Ptr("test-customipprefix6"), - // Type: to.Ptr("Microsoft.Network/customIpPrefixes"), - // ID: to.Ptr("/subscriptions/subid/resourceGroups/rg3/providers/Microsoft.Network/customIpPrefixes/test-customipprefix8"), - // Location: to.Ptr("eastus"), - // Etag: to.Ptr("W/\"00000000-0000-0000-0000-00000000\""), - // Properties: &armnetwork.CustomIPPrefixPropertiesFormat{ - // AuthorizationMessage: to.Ptr("authorizationMessage"), - // ChildCustomIPPrefixes: []*armnetwork.SubResource{ - // }, - // Cidr: to.Ptr("0.0.7.0/22"), - // CommissionedState: to.Ptr(armnetwork.CommissionedStateCommissioning), - // ExpressRouteAdvertise: to.Ptr(true), - // FailedReason: to.Ptr(""), - // NoInternetAdvertise: to.Ptr(false), - // PrefixType: to.Ptr(armnetwork.CustomIPPrefixTypeParent), - // ProvisioningState: to.Ptr(armnetwork.ProvisioningStateSucceeded), - // PublicIPPrefixes: []*armnetwork.SubResource{ - // }, - // ResourceGUID: to.Ptr("00000000-0000-0000-0000-00000000"), - // SignedMessage: to.Ptr("signedMessage"), - // }, - // }}, - // } - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/4883fa5dbf6f2c9093fac8ce334547e9dfac68fa/specification/network/resource-manager/Microsoft.Network/stable/2024-03-01/examples/CustomIpPrefixList.json -func ExampleCustomIPPrefixesClient_NewListPager() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armnetwork.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := clientFactory.NewCustomIPPrefixesClient().NewListPager("rg1", nil) - for pager.More() { - page, err := pager.NextPage(ctx) - if err != nil { - log.Fatalf("failed to advance page: %v", err) - } - for _, v := range page.Value { - // You could use page here. We use blank identifier for just demo purposes. - _ = v - } - // If the HTTP response code is 200 as defined in example definition, your page structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // page.CustomIPPrefixListResult = armnetwork.CustomIPPrefixListResult{ - // Value: []*armnetwork.CustomIPPrefix{ - // { - // Name: to.Ptr("test-customipprefix"), - // Type: to.Ptr("Microsoft.Network/customIpPrefixes"), - // ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/customIpPrefixes/test-customipprefix"), - // Location: to.Ptr("westus"), - // Etag: to.Ptr("W/\"00000000-0000-0000-0000-00000000\""), - // Properties: &armnetwork.CustomIPPrefixPropertiesFormat{ - // AuthorizationMessage: to.Ptr("authorizationMessage"), - // ChildCustomIPPrefixes: []*armnetwork.SubResource{ - // }, - // Cidr: to.Ptr("0.0.0.0/24"), - // CommissionedState: to.Ptr(armnetwork.CommissionedStateCommissioned), - // ExpressRouteAdvertise: to.Ptr(false), - // FailedReason: to.Ptr(""), - // NoInternetAdvertise: to.Ptr(false), - // ProvisioningState: to.Ptr(armnetwork.ProvisioningStateSucceeded), - // PublicIPPrefixes: []*armnetwork.SubResource{ - // }, - // ResourceGUID: to.Ptr("00000000-0000-0000-0000-00000000"), - // SignedMessage: to.Ptr("signedMessage"), - // }, - // }, - // { - // Name: to.Ptr("test-customipprefix2"), - // Type: to.Ptr("Microsoft.Network/customIpPrefixes"), - // ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/customIpPrefixes/test-customipprefix2"), - // Location: to.Ptr("westus"), - // Etag: to.Ptr("W/\"00000000-0000-0000-0000-00000000\""), - // Properties: &armnetwork.CustomIPPrefixPropertiesFormat{ - // AuthorizationMessage: to.Ptr("authorizationMessage"), - // ChildCustomIPPrefixes: []*armnetwork.SubResource{ - // }, - // Cidr: to.Ptr("0.0.1.0/30"), - // CommissionedState: to.Ptr(armnetwork.CommissionedStateCommissioned), - // ExpressRouteAdvertise: to.Ptr(false), - // FailedReason: to.Ptr(""), - // NoInternetAdvertise: to.Ptr(false), - // ProvisioningState: to.Ptr(armnetwork.ProvisioningStateSucceeded), - // PublicIPPrefixes: []*armnetwork.SubResource{ - // }, - // ResourceGUID: to.Ptr("00000000-0000-0000-0000-00000000"), - // SignedMessage: to.Ptr("signedMessage"), - // }, - // }, - // { - // Name: to.Ptr("test-customipprefix4"), - // Type: to.Ptr("Microsoft.Network/customIpPrefixes"), - // ID: to.Ptr("/subscriptions/subid/resourceGroups/rg3/providers/Microsoft.Network/customIpPrefixes/test-customipprefix4"), - // Location: to.Ptr("eastus"), - // Etag: to.Ptr("W/\"00000000-0000-0000-0000-00000000\""), - // Properties: &armnetwork.CustomIPPrefixPropertiesFormat{ - // AuthorizationMessage: to.Ptr("authorizationMessage"), - // ChildCustomIPPrefixes: []*armnetwork.SubResource{ - // }, - // Cidr: to.Ptr("2607:f0d1:1002:0001::/64"), - // CommissionedState: to.Ptr(armnetwork.CommissionedStateCommissioned), - // CustomIPPrefixParent: &armnetwork.SubResource{ - // ID: to.Ptr("/subscriptions/subid/resourceGroups/rg3/providers/Microsoft.Network/customIpPrefixes/test-customipprefix5"), - // }, - // ExpressRouteAdvertise: to.Ptr(false), - // FailedReason: to.Ptr(""), - // NoInternetAdvertise: to.Ptr(false), - // ProvisioningState: to.Ptr(armnetwork.ProvisioningStateSucceeded), - // PublicIPPrefixes: []*armnetwork.SubResource{ - // }, - // ResourceGUID: to.Ptr("00000000-0000-0000-0000-00000000"), - // SignedMessage: to.Ptr("signedMessage"), - // }, - // }, - // { - // Name: to.Ptr("test-customipprefix5"), - // Type: to.Ptr("Microsoft.Network/customIpPrefixes"), - // ID: to.Ptr("/subscriptions/subid/resourceGroups/rg3/providers/Microsoft.Network/customIpPrefixes/test-customipprefix5"), - // Location: to.Ptr("eastus"), - // Etag: to.Ptr("W/\"00000000-0000-0000-0000-00000000\""), - // Properties: &armnetwork.CustomIPPrefixPropertiesFormat{ - // AuthorizationMessage: to.Ptr("authorizationMessage"), - // ChildCustomIPPrefixes: []*armnetwork.SubResource{ - // { - // ID: to.Ptr("/subscriptions/subid/resourceGroups/rg3/providers/Microsoft.Network/customIpPrefixes/test-customipprefix4"), - // }}, - // Cidr: to.Ptr("2607:f0d1:1002::/48"), - // CommissionedState: to.Ptr(armnetwork.CommissionedStateProvisioned), - // ExpressRouteAdvertise: to.Ptr(false), - // FailedReason: to.Ptr(""), - // NoInternetAdvertise: to.Ptr(false), - // ProvisioningState: to.Ptr(armnetwork.ProvisioningStateSucceeded), - // PublicIPPrefixes: []*armnetwork.SubResource{ - // }, - // ResourceGUID: to.Ptr("00000000-0000-0000-0000-00000000"), - // SignedMessage: to.Ptr("signedMessage"), - // }, - // }, - // { - // Name: to.Ptr("test-customipprefix6"), - // Type: to.Ptr("Microsoft.Network/customIpPrefixes"), - // ID: to.Ptr("/subscriptions/subid/resourceGroups/rg3/providers/Microsoft.Network/customIpPrefixes/test-customipprefix8"), - // Location: to.Ptr("eastus"), - // Etag: to.Ptr("W/\"00000000-0000-0000-0000-00000000\""), - // Properties: &armnetwork.CustomIPPrefixPropertiesFormat{ - // AuthorizationMessage: to.Ptr("authorizationMessage"), - // ChildCustomIPPrefixes: []*armnetwork.SubResource{ - // }, - // Cidr: to.Ptr("0.0.7.0/22"), - // CommissionedState: to.Ptr(armnetwork.CommissionedStateCommissioning), - // ExpressRouteAdvertise: to.Ptr(false), - // FailedReason: to.Ptr(""), - // NoInternetAdvertise: to.Ptr(false), - // ProvisioningState: to.Ptr(armnetwork.ProvisioningStateSucceeded), - // PublicIPPrefixes: []*armnetwork.SubResource{ - // }, - // ResourceGUID: to.Ptr("00000000-0000-0000-0000-00000000"), - // SignedMessage: to.Ptr("signedMessage"), - // }, - // }}, - // } - } -} diff --git a/sdk/resourcemanager/network/armnetwork/ddoscustompolicies_client_example_test.go b/sdk/resourcemanager/network/armnetwork/ddoscustompolicies_client_example_test.go deleted file mode 100644 index 348180e7fe8f..000000000000 --- a/sdk/resourcemanager/network/armnetwork/ddoscustompolicies_client_example_test.go +++ /dev/null @@ -1,145 +0,0 @@ -//go:build go1.18 -// +build go1.18 - -// 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. -// DO NOT EDIT. - -package armnetwork_test - -import ( - "context" - "log" - - "github.com/Azure/azure-sdk-for-go/sdk/azcore/to" - "github.com/Azure/azure-sdk-for-go/sdk/azidentity" - "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/network/armnetwork/v6" -) - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/4883fa5dbf6f2c9093fac8ce334547e9dfac68fa/specification/network/resource-manager/Microsoft.Network/stable/2024-03-01/examples/DdosCustomPolicyDelete.json -func ExampleDdosCustomPoliciesClient_BeginDelete() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armnetwork.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewDdosCustomPoliciesClient().BeginDelete(ctx, "rg1", "test-ddos-custom-policy", nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - _, err = poller.PollUntilDone(ctx, nil) - if err != nil { - log.Fatalf("failed to pull the result: %v", err) - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/4883fa5dbf6f2c9093fac8ce334547e9dfac68fa/specification/network/resource-manager/Microsoft.Network/stable/2024-03-01/examples/DdosCustomPolicyGet.json -func ExampleDdosCustomPoliciesClient_Get() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armnetwork.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewDdosCustomPoliciesClient().Get(ctx, "rg1", "test-ddos-custom-policy", nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.DdosCustomPolicy = armnetwork.DdosCustomPolicy{ - // Name: to.Ptr("test-ddos-custom-policy"), - // Type: to.Ptr("Microsoft.Network/ddosCustomPolicies"), - // ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/ddosCustomPolicies/test-ddos-custom-policy"), - // Location: to.Ptr("westus"), - // Properties: &armnetwork.DdosCustomPolicyPropertiesFormat{ - // ProvisioningState: to.Ptr(armnetwork.ProvisioningStateSucceeded), - // ResourceGUID: to.Ptr("00000000-0000-0000-0000-000000000000"), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/4883fa5dbf6f2c9093fac8ce334547e9dfac68fa/specification/network/resource-manager/Microsoft.Network/stable/2024-03-01/examples/DdosCustomPolicyCreate.json -func ExampleDdosCustomPoliciesClient_BeginCreateOrUpdate() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armnetwork.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewDdosCustomPoliciesClient().BeginCreateOrUpdate(ctx, "rg1", "test-ddos-custom-policy", armnetwork.DdosCustomPolicy{ - Location: to.Ptr("centraluseuap"), - }, nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - res, err := poller.PollUntilDone(ctx, nil) - if err != nil { - log.Fatalf("failed to pull the result: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.DdosCustomPolicy = armnetwork.DdosCustomPolicy{ - // Name: to.Ptr("test-ddos-custom-policy"), - // Type: to.Ptr("Microsoft.Network/ddosCustomPolicies"), - // ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/ddosCustomPolicies/test-ddos-custom-policy"), - // Location: to.Ptr("centraluseuap"), - // Properties: &armnetwork.DdosCustomPolicyPropertiesFormat{ - // ProvisioningState: to.Ptr(armnetwork.ProvisioningStateSucceeded), - // ResourceGUID: to.Ptr("00000000-0000-0000-0000-000000000000"), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/4883fa5dbf6f2c9093fac8ce334547e9dfac68fa/specification/network/resource-manager/Microsoft.Network/stable/2024-03-01/examples/DdosCustomPolicyUpdateTags.json -func ExampleDdosCustomPoliciesClient_UpdateTags() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armnetwork.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewDdosCustomPoliciesClient().UpdateTags(ctx, "rg1", "test-ddos-custom-policy", armnetwork.TagsObject{ - Tags: map[string]*string{ - "tag1": to.Ptr("value1"), - "tag2": to.Ptr("value2"), - }, - }, nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.DdosCustomPolicy = armnetwork.DdosCustomPolicy{ - // Name: to.Ptr("test-ddos-custom-policy"), - // Type: to.Ptr("Microsoft.Network/ddosCustomPolicies"), - // ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/ddosCustomPolicies/test-ddos-custom-policy"), - // Location: to.Ptr("westus"), - // Tags: map[string]*string{ - // "tag1": to.Ptr("value1"), - // "tag2": to.Ptr("value2"), - // }, - // Properties: &armnetwork.DdosCustomPolicyPropertiesFormat{ - // ProvisioningState: to.Ptr(armnetwork.ProvisioningStateSucceeded), - // ResourceGUID: to.Ptr("00000000-0000-0000-0000-000000000000"), - // }, - // } -} diff --git a/sdk/resourcemanager/network/armnetwork/ddosprotectionplans_client_example_test.go b/sdk/resourcemanager/network/armnetwork/ddosprotectionplans_client_example_test.go deleted file mode 100644 index b5ad436a337f..000000000000 --- a/sdk/resourcemanager/network/armnetwork/ddosprotectionplans_client_example_test.go +++ /dev/null @@ -1,296 +0,0 @@ -//go:build go1.18 -// +build go1.18 - -// 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. -// DO NOT EDIT. - -package armnetwork_test - -import ( - "context" - "log" - - "github.com/Azure/azure-sdk-for-go/sdk/azcore/to" - "github.com/Azure/azure-sdk-for-go/sdk/azidentity" - "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/network/armnetwork/v6" -) - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/4883fa5dbf6f2c9093fac8ce334547e9dfac68fa/specification/network/resource-manager/Microsoft.Network/stable/2024-03-01/examples/DdosProtectionPlanDelete.json -func ExampleDdosProtectionPlansClient_BeginDelete() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armnetwork.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewDdosProtectionPlansClient().BeginDelete(ctx, "rg1", "test-plan", nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - _, err = poller.PollUntilDone(ctx, nil) - if err != nil { - log.Fatalf("failed to pull the result: %v", err) - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/4883fa5dbf6f2c9093fac8ce334547e9dfac68fa/specification/network/resource-manager/Microsoft.Network/stable/2024-03-01/examples/DdosProtectionPlanGet.json -func ExampleDdosProtectionPlansClient_Get() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armnetwork.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewDdosProtectionPlansClient().Get(ctx, "rg1", "test-plan", nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.DdosProtectionPlan = armnetwork.DdosProtectionPlan{ - // Name: to.Ptr("test-plan"), - // Type: to.Ptr("Microsoft.Network/ddosProtectionPlans"), - // ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/ddosProtectionPlans/test-plan"), - // Location: to.Ptr("westus"), - // Properties: &armnetwork.DdosProtectionPlanPropertiesFormat{ - // ProvisioningState: to.Ptr(armnetwork.ProvisioningStateSucceeded), - // PublicIPAddresses: []*armnetwork.SubResource{ - // { - // ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/publicIPAddresses/test-pip"), - // }}, - // ResourceGUID: to.Ptr("00000000-0000-0000-0000-000000000000"), - // VirtualNetworks: []*armnetwork.SubResource{ - // { - // ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/virtualNetworks/test-vnet"), - // }}, - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/4883fa5dbf6f2c9093fac8ce334547e9dfac68fa/specification/network/resource-manager/Microsoft.Network/stable/2024-03-01/examples/DdosProtectionPlanCreate.json -func ExampleDdosProtectionPlansClient_BeginCreateOrUpdate() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armnetwork.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewDdosProtectionPlansClient().BeginCreateOrUpdate(ctx, "rg1", "test-plan", armnetwork.DdosProtectionPlan{ - Location: to.Ptr("westus"), - Properties: &armnetwork.DdosProtectionPlanPropertiesFormat{}, - }, nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - res, err := poller.PollUntilDone(ctx, nil) - if err != nil { - log.Fatalf("failed to pull the result: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.DdosProtectionPlan = armnetwork.DdosProtectionPlan{ - // Name: to.Ptr("test-plan"), - // Type: to.Ptr("Microsoft.Network/ddosProtectionPlans"), - // ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/ddosProtectionPlans/test-plan"), - // Location: to.Ptr("westus"), - // Properties: &armnetwork.DdosProtectionPlanPropertiesFormat{ - // ProvisioningState: to.Ptr(armnetwork.ProvisioningStateSucceeded), - // PublicIPAddresses: []*armnetwork.SubResource{ - // }, - // ResourceGUID: to.Ptr("00000000-0000-0000-0000-000000000000"), - // VirtualNetworks: []*armnetwork.SubResource{ - // }, - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/4883fa5dbf6f2c9093fac8ce334547e9dfac68fa/specification/network/resource-manager/Microsoft.Network/stable/2024-03-01/examples/DdosProtectionPlanUpdateTags.json -func ExampleDdosProtectionPlansClient_UpdateTags() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armnetwork.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewDdosProtectionPlansClient().UpdateTags(ctx, "rg1", "test-plan", armnetwork.TagsObject{ - Tags: map[string]*string{ - "tag1": to.Ptr("value1"), - "tag2": to.Ptr("value2"), - }, - }, nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.DdosProtectionPlan = armnetwork.DdosProtectionPlan{ - // Name: to.Ptr("test-plan"), - // Type: to.Ptr("Microsoft.Network/ddosProtectionPlans"), - // ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/ddosProtectionPlans/test-plan"), - // Location: to.Ptr("westus"), - // Properties: &armnetwork.DdosProtectionPlanPropertiesFormat{ - // ProvisioningState: to.Ptr(armnetwork.ProvisioningStateSucceeded), - // PublicIPAddresses: []*armnetwork.SubResource{ - // }, - // ResourceGUID: to.Ptr("00000000-0000-0000-0000-000000000000"), - // VirtualNetworks: []*armnetwork.SubResource{ - // }, - // }, - // Tags: map[string]*string{ - // "tag1": to.Ptr("value1"), - // "tag2": to.Ptr("value2"), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/4883fa5dbf6f2c9093fac8ce334547e9dfac68fa/specification/network/resource-manager/Microsoft.Network/stable/2024-03-01/examples/DdosProtectionPlanListAll.json -func ExampleDdosProtectionPlansClient_NewListPager() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armnetwork.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := clientFactory.NewDdosProtectionPlansClient().NewListPager(nil) - for pager.More() { - page, err := pager.NextPage(ctx) - if err != nil { - log.Fatalf("failed to advance page: %v", err) - } - for _, v := range page.Value { - // You could use page here. We use blank identifier for just demo purposes. - _ = v - } - // If the HTTP response code is 200 as defined in example definition, your page structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // page.DdosProtectionPlanListResult = armnetwork.DdosProtectionPlanListResult{ - // Value: []*armnetwork.DdosProtectionPlan{ - // { - // Name: to.Ptr("plan1"), - // Type: to.Ptr("Microsoft.Network/ddosProtectionPlans"), - // ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/ddosProtectionPlans/plan1"), - // Location: to.Ptr("westus"), - // Properties: &armnetwork.DdosProtectionPlanPropertiesFormat{ - // ProvisioningState: to.Ptr(armnetwork.ProvisioningStateSucceeded), - // PublicIPAddresses: []*armnetwork.SubResource{ - // { - // ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/publicIPAddresses/test-pip"), - // }}, - // ResourceGUID: to.Ptr("00000000-0000-0000-0000-000000000000"), - // VirtualNetworks: []*armnetwork.SubResource{ - // { - // ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/virtualNetworks/test-vnet1"), - // }}, - // }, - // }, - // { - // Name: to.Ptr("plan2"), - // Type: to.Ptr("Microsoft.Network/ddosProtectionPlans"), - // ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/ddosProtectionPlans/plan2"), - // Location: to.Ptr("westus"), - // Properties: &armnetwork.DdosProtectionPlanPropertiesFormat{ - // ProvisioningState: to.Ptr(armnetwork.ProvisioningStateSucceeded), - // PublicIPAddresses: []*armnetwork.SubResource{ - // { - // ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/publicIPAddresses/test-pip2"), - // }, - // { - // ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/publicIPAddresses/test-pip3"), - // }}, - // ResourceGUID: to.Ptr("00000000-0000-0000-0000-000000000000"), - // VirtualNetworks: []*armnetwork.SubResource{ - // { - // ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/virtualNetworks/test-vnet2"), - // }, - // { - // ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/virtualNetworks/test-vnet3"), - // }}, - // }, - // }}, - // } - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/4883fa5dbf6f2c9093fac8ce334547e9dfac68fa/specification/network/resource-manager/Microsoft.Network/stable/2024-03-01/examples/DdosProtectionPlanList.json -func ExampleDdosProtectionPlansClient_NewListByResourceGroupPager() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armnetwork.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := clientFactory.NewDdosProtectionPlansClient().NewListByResourceGroupPager("rg1", nil) - for pager.More() { - page, err := pager.NextPage(ctx) - if err != nil { - log.Fatalf("failed to advance page: %v", err) - } - for _, v := range page.Value { - // You could use page here. We use blank identifier for just demo purposes. - _ = v - } - // If the HTTP response code is 200 as defined in example definition, your page structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // page.DdosProtectionPlanListResult = armnetwork.DdosProtectionPlanListResult{ - // Value: []*armnetwork.DdosProtectionPlan{ - // { - // Name: to.Ptr("plan1"), - // Type: to.Ptr("Microsoft.Network/ddosProtectionPlans"), - // ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/ddosProtectionPlans/plan1"), - // Location: to.Ptr("westus"), - // Properties: &armnetwork.DdosProtectionPlanPropertiesFormat{ - // ProvisioningState: to.Ptr(armnetwork.ProvisioningStateSucceeded), - // PublicIPAddresses: []*armnetwork.SubResource{ - // { - // ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/publicIPAddresses/test-pip"), - // }}, - // ResourceGUID: to.Ptr("00000000-0000-0000-0000-000000000000"), - // VirtualNetworks: []*armnetwork.SubResource{ - // { - // ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/virtualNetworks/test-vnet"), - // }}, - // }, - // }, - // { - // Name: to.Ptr("plan2"), - // Type: to.Ptr("Microsoft.Network/ddosProtectionPlans"), - // ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/ddosProtectionPlans/plan2"), - // Location: to.Ptr("westus"), - // Properties: &armnetwork.DdosProtectionPlanPropertiesFormat{ - // ProvisioningState: to.Ptr(armnetwork.ProvisioningStateSucceeded), - // PublicIPAddresses: []*armnetwork.SubResource{ - // { - // ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/publicIPAddresses/test-pip"), - // }}, - // ResourceGUID: to.Ptr("00000000-0000-0000-0000-000000000000"), - // VirtualNetworks: []*armnetwork.SubResource{ - // { - // ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/virtualNetworks/test-vnet"), - // }}, - // }, - // }}, - // } - } -} diff --git a/sdk/resourcemanager/network/armnetwork/defaultsecurityrules_client_example_test.go b/sdk/resourcemanager/network/armnetwork/defaultsecurityrules_client_example_test.go deleted file mode 100644 index 3948d49f0e19..000000000000 --- a/sdk/resourcemanager/network/armnetwork/defaultsecurityrules_client_example_test.go +++ /dev/null @@ -1,234 +0,0 @@ -//go:build go1.18 -// +build go1.18 - -// 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. -// DO NOT EDIT. - -package armnetwork_test - -import ( - "context" - "log" - - "github.com/Azure/azure-sdk-for-go/sdk/azidentity" - "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/network/armnetwork/v6" -) - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/4883fa5dbf6f2c9093fac8ce334547e9dfac68fa/specification/network/resource-manager/Microsoft.Network/stable/2024-03-01/examples/DefaultSecurityRuleList.json -func ExampleDefaultSecurityRulesClient_NewListPager() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armnetwork.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := clientFactory.NewDefaultSecurityRulesClient().NewListPager("testrg", "nsg1", nil) - for pager.More() { - page, err := pager.NextPage(ctx) - if err != nil { - log.Fatalf("failed to advance page: %v", err) - } - for _, v := range page.Value { - // You could use page here. We use blank identifier for just demo purposes. - _ = v - } - // If the HTTP response code is 200 as defined in example definition, your page structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // page.SecurityRuleListResult = armnetwork.SecurityRuleListResult{ - // Value: []*armnetwork.SecurityRule{ - // { - // ID: to.Ptr("/subscriptions/subid/resourceGroups/testrg/providers/Microsoft.Network/networkSecurityGroups/nsg1/defaultSecurityRules/AllowVnetInBound"), - // Name: to.Ptr("AllowVnetInBound"), - // Properties: &armnetwork.SecurityRulePropertiesFormat{ - // Description: to.Ptr("Allow inbound traffic from all VMs in VNET"), - // Access: to.Ptr(armnetwork.SecurityRuleAccessAllow), - // DestinationAddressPrefix: to.Ptr("VirtualNetwork"), - // DestinationAddressPrefixes: []*string{ - // }, - // DestinationPortRange: to.Ptr("*"), - // DestinationPortRanges: []*string{ - // }, - // Direction: to.Ptr(armnetwork.SecurityRuleDirectionInbound), - // Priority: to.Ptr[int32](65000), - // ProvisioningState: to.Ptr(armnetwork.ProvisioningStateSucceeded), - // SourceAddressPrefix: to.Ptr("VirtualNetwork"), - // SourceAddressPrefixes: []*string{ - // }, - // SourcePortRange: to.Ptr("*"), - // SourcePortRanges: []*string{ - // }, - // Protocol: to.Ptr(armnetwork.SecurityRuleProtocolAsterisk), - // }, - // }, - // { - // ID: to.Ptr("/subscriptions/subid/resourceGroups/testrg/providers/Microsoft.Network/networkSecurityGroups/nsg1/defaultSecurityRules/AllowAzureLoadBalancerInBound"), - // Name: to.Ptr("AllowAzureLoadBalancerInBound"), - // Properties: &armnetwork.SecurityRulePropertiesFormat{ - // Description: to.Ptr("Allow inbound traffic from azure load balancer"), - // Access: to.Ptr(armnetwork.SecurityRuleAccessAllow), - // DestinationAddressPrefix: to.Ptr("*"), - // DestinationAddressPrefixes: []*string{ - // }, - // DestinationPortRange: to.Ptr("*"), - // DestinationPortRanges: []*string{ - // }, - // Direction: to.Ptr(armnetwork.SecurityRuleDirectionInbound), - // Priority: to.Ptr[int32](65001), - // ProvisioningState: to.Ptr(armnetwork.ProvisioningStateSucceeded), - // SourceAddressPrefix: to.Ptr("AzureLoadBalancer"), - // SourceAddressPrefixes: []*string{ - // }, - // SourcePortRange: to.Ptr("*"), - // SourcePortRanges: []*string{ - // }, - // Protocol: to.Ptr(armnetwork.SecurityRuleProtocolAsterisk), - // }, - // }, - // { - // ID: to.Ptr("/subscriptions/subid/resourceGroups/testrg/providers/Microsoft.Network/networkSecurityGroups/nsg1/defaultSecurityRules/DenyAllInBound"), - // Name: to.Ptr("DenyAllInBound"), - // Properties: &armnetwork.SecurityRulePropertiesFormat{ - // Description: to.Ptr("Deny all inbound traffic"), - // Access: to.Ptr(armnetwork.SecurityRuleAccessDeny), - // DestinationAddressPrefix: to.Ptr("*"), - // DestinationAddressPrefixes: []*string{ - // }, - // DestinationPortRange: to.Ptr("*"), - // DestinationPortRanges: []*string{ - // }, - // Direction: to.Ptr(armnetwork.SecurityRuleDirectionInbound), - // Priority: to.Ptr[int32](65500), - // ProvisioningState: to.Ptr(armnetwork.ProvisioningStateSucceeded), - // SourceAddressPrefix: to.Ptr("*"), - // SourceAddressPrefixes: []*string{ - // }, - // SourcePortRange: to.Ptr("*"), - // SourcePortRanges: []*string{ - // }, - // Protocol: to.Ptr(armnetwork.SecurityRuleProtocolAsterisk), - // }, - // }, - // { - // ID: to.Ptr("/subscriptions/subid/resourceGroups/testrg/providers/Microsoft.Network/networkSecurityGroups/nsg1/defaultSecurityRules/AllowVnetOutBound"), - // Name: to.Ptr("AllowVnetOutBound"), - // Properties: &armnetwork.SecurityRulePropertiesFormat{ - // Description: to.Ptr("Allow outbound traffic from all VMs to all VMs in VNET"), - // Access: to.Ptr(armnetwork.SecurityRuleAccessAllow), - // DestinationAddressPrefix: to.Ptr("VirtualNetwork"), - // DestinationAddressPrefixes: []*string{ - // }, - // DestinationPortRange: to.Ptr("*"), - // DestinationPortRanges: []*string{ - // }, - // Direction: to.Ptr(armnetwork.SecurityRuleDirectionOutbound), - // Priority: to.Ptr[int32](65000), - // ProvisioningState: to.Ptr(armnetwork.ProvisioningStateSucceeded), - // SourceAddressPrefix: to.Ptr("VirtualNetwork"), - // SourceAddressPrefixes: []*string{ - // }, - // SourcePortRange: to.Ptr("*"), - // SourcePortRanges: []*string{ - // }, - // Protocol: to.Ptr(armnetwork.SecurityRuleProtocolAsterisk), - // }, - // }, - // { - // ID: to.Ptr("/subscriptions/subid/resourceGroups/testrg/providers/Microsoft.Network/networkSecurityGroups/nsg1/defaultSecurityRules/AllowInternetOutBound"), - // Name: to.Ptr("AllowInternetOutBound"), - // Properties: &armnetwork.SecurityRulePropertiesFormat{ - // Description: to.Ptr("Allow outbound traffic from all VMs to Internet"), - // Access: to.Ptr(armnetwork.SecurityRuleAccessAllow), - // DestinationAddressPrefix: to.Ptr("Internet"), - // DestinationAddressPrefixes: []*string{ - // }, - // DestinationPortRange: to.Ptr("*"), - // DestinationPortRanges: []*string{ - // }, - // Direction: to.Ptr(armnetwork.SecurityRuleDirectionOutbound), - // Priority: to.Ptr[int32](65001), - // ProvisioningState: to.Ptr(armnetwork.ProvisioningStateSucceeded), - // SourceAddressPrefix: to.Ptr("*"), - // SourceAddressPrefixes: []*string{ - // }, - // SourcePortRange: to.Ptr("*"), - // SourcePortRanges: []*string{ - // }, - // Protocol: to.Ptr(armnetwork.SecurityRuleProtocolAsterisk), - // }, - // }, - // { - // ID: to.Ptr("/subscriptions/subid/resourceGroups/testrg/providers/Microsoft.Network/networkSecurityGroups/nsg1/defaultSecurityRules/DenyAllOutBound"), - // Name: to.Ptr("DenyAllOutBound"), - // Properties: &armnetwork.SecurityRulePropertiesFormat{ - // Description: to.Ptr("Deny all outbound traffic"), - // Access: to.Ptr(armnetwork.SecurityRuleAccessDeny), - // DestinationAddressPrefix: to.Ptr("*"), - // DestinationAddressPrefixes: []*string{ - // }, - // DestinationPortRange: to.Ptr("*"), - // DestinationPortRanges: []*string{ - // }, - // Direction: to.Ptr(armnetwork.SecurityRuleDirectionOutbound), - // Priority: to.Ptr[int32](65500), - // ProvisioningState: to.Ptr(armnetwork.ProvisioningStateSucceeded), - // SourceAddressPrefix: to.Ptr("*"), - // SourceAddressPrefixes: []*string{ - // }, - // SourcePortRange: to.Ptr("*"), - // SourcePortRanges: []*string{ - // }, - // Protocol: to.Ptr(armnetwork.SecurityRuleProtocolAsterisk), - // }, - // }}, - // } - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/4883fa5dbf6f2c9093fac8ce334547e9dfac68fa/specification/network/resource-manager/Microsoft.Network/stable/2024-03-01/examples/DefaultSecurityRuleGet.json -func ExampleDefaultSecurityRulesClient_Get() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armnetwork.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewDefaultSecurityRulesClient().Get(ctx, "testrg", "nsg1", "AllowVnetInBound", nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.SecurityRule = armnetwork.SecurityRule{ - // ID: to.Ptr("/subscriptions/subid/resourceGroups/testrg/providers/Microsoft.Network/networkSecurityGroups/nsg1/defaultSecurityRules/AllowVnetInBound"), - // Name: to.Ptr("AllowVnetInBound"), - // Properties: &armnetwork.SecurityRulePropertiesFormat{ - // Description: to.Ptr("Allow inbound traffic from all VMs in VNET"), - // Access: to.Ptr(armnetwork.SecurityRuleAccessAllow), - // DestinationAddressPrefix: to.Ptr("VirtualNetwork"), - // DestinationAddressPrefixes: []*string{ - // }, - // DestinationPortRange: to.Ptr("*"), - // DestinationPortRanges: []*string{ - // }, - // Direction: to.Ptr(armnetwork.SecurityRuleDirectionInbound), - // Priority: to.Ptr[int32](65000), - // ProvisioningState: to.Ptr(armnetwork.ProvisioningStateSucceeded), - // SourceAddressPrefix: to.Ptr("VirtualNetwork"), - // SourceAddressPrefixes: []*string{ - // }, - // SourcePortRange: to.Ptr("*"), - // SourcePortRanges: []*string{ - // }, - // Protocol: to.Ptr(armnetwork.SecurityRuleProtocolAsterisk), - // }, - // } -} diff --git a/sdk/resourcemanager/network/armnetwork/dscpconfiguration_client_example_test.go b/sdk/resourcemanager/network/armnetwork/dscpconfiguration_client_example_test.go deleted file mode 100644 index 02112cd41803..000000000000 --- a/sdk/resourcemanager/network/armnetwork/dscpconfiguration_client_example_test.go +++ /dev/null @@ -1,602 +0,0 @@ -//go:build go1.18 -// +build go1.18 - -// 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. -// DO NOT EDIT. - -package armnetwork_test - -import ( - "context" - "log" - - "github.com/Azure/azure-sdk-for-go/sdk/azcore/to" - "github.com/Azure/azure-sdk-for-go/sdk/azidentity" - "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/network/armnetwork/v6" -) - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/4883fa5dbf6f2c9093fac8ce334547e9dfac68fa/specification/network/resource-manager/Microsoft.Network/stable/2024-03-01/examples/DscpConfigurationCreate.json -func ExampleDscpConfigurationClient_BeginCreateOrUpdate() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armnetwork.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewDscpConfigurationClient().BeginCreateOrUpdate(ctx, "rg1", "mydscpconfig", armnetwork.DscpConfiguration{ - Location: to.Ptr("eastus"), - Properties: &armnetwork.DscpConfigurationPropertiesFormat{ - QosDefinitionCollection: []*armnetwork.QosDefinition{ - { - DestinationIPRanges: []*armnetwork.QosIPRange{ - { - EndIP: to.Ptr("127.0.10.2"), - StartIP: to.Ptr("127.0.10.1"), - }}, - DestinationPortRanges: []*armnetwork.QosPortRange{ - { - End: to.Ptr[int32](15), - Start: to.Ptr[int32](15), - }}, - Markings: []*int32{ - to.Ptr[int32](1)}, - SourceIPRanges: []*armnetwork.QosIPRange{ - { - EndIP: to.Ptr("127.0.0.2"), - StartIP: to.Ptr("127.0.0.1"), - }}, - SourcePortRanges: []*armnetwork.QosPortRange{ - { - End: to.Ptr[int32](11), - Start: to.Ptr[int32](10), - }, - { - End: to.Ptr[int32](21), - Start: to.Ptr[int32](20), - }}, - Protocol: to.Ptr(armnetwork.ProtocolTypeTCP), - }, - { - DestinationIPRanges: []*armnetwork.QosIPRange{ - { - EndIP: to.Ptr("12.0.10.2"), - StartIP: to.Ptr("12.0.10.1"), - }}, - DestinationPortRanges: []*armnetwork.QosPortRange{ - { - End: to.Ptr[int32](52), - Start: to.Ptr[int32](51), - }}, - Markings: []*int32{ - to.Ptr[int32](2)}, - SourceIPRanges: []*armnetwork.QosIPRange{ - { - EndIP: to.Ptr("12.0.0.2"), - StartIP: to.Ptr("12.0.0.1"), - }}, - SourcePortRanges: []*armnetwork.QosPortRange{ - { - End: to.Ptr[int32](12), - Start: to.Ptr[int32](11), - }}, - Protocol: to.Ptr(armnetwork.ProtocolTypeUDP), - }}, - }, - }, nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - res, err := poller.PollUntilDone(ctx, nil) - if err != nil { - log.Fatalf("failed to pull the result: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.DscpConfiguration = armnetwork.DscpConfiguration{ - // Name: to.Ptr("mydscpConfig"), - // Type: to.Ptr("Microsoft.Network/dscpConfiguration"), - // ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/dscpConfiguration/mydscpConfig"), - // Location: to.Ptr("eastus"), - // Properties: &armnetwork.DscpConfigurationPropertiesFormat{ - // AssociatedNetworkInterfaces: []*armnetwork.Interface{ - // }, - // ProvisioningState: to.Ptr(armnetwork.ProvisioningStateSucceeded), - // QosCollectionID: to.Ptr("0f8fad5b-d9cb-469f-a165-70867728950e"), - // QosDefinitionCollection: []*armnetwork.QosDefinition{ - // { - // DestinationIPRanges: []*armnetwork.QosIPRange{ - // { - // EndIP: to.Ptr("127.0.10.2"), - // StartIP: to.Ptr("127.0.10.1"), - // }}, - // DestinationPortRanges: []*armnetwork.QosPortRange{ - // { - // End: to.Ptr[int32](62), - // Start: to.Ptr[int32](61), - // }}, - // Markings: []*int32{ - // to.Ptr[int32](1)}, - // SourceIPRanges: []*armnetwork.QosIPRange{ - // { - // EndIP: to.Ptr("127.0.0.2"), - // StartIP: to.Ptr("127.0.0.1"), - // }}, - // SourcePortRanges: []*armnetwork.QosPortRange{ - // { - // End: to.Ptr[int32](12), - // Start: to.Ptr[int32](11), - // }}, - // Protocol: to.Ptr(armnetwork.ProtocolTypeTCP), - // }, - // { - // DestinationIPRanges: []*armnetwork.QosIPRange{ - // { - // EndIP: to.Ptr("12.0.10.2"), - // StartIP: to.Ptr("12.0.10.1"), - // }}, - // DestinationPortRanges: []*armnetwork.QosPortRange{ - // { - // End: to.Ptr[int32](52), - // Start: to.Ptr[int32](51), - // }}, - // Markings: []*int32{ - // to.Ptr[int32](2)}, - // SourceIPRanges: []*armnetwork.QosIPRange{ - // { - // EndIP: to.Ptr("12.0.0.2"), - // StartIP: to.Ptr("12.0.0.1"), - // }}, - // SourcePortRanges: []*armnetwork.QosPortRange{ - // { - // End: to.Ptr[int32](12), - // Start: to.Ptr[int32](11), - // }}, - // Protocol: to.Ptr(armnetwork.ProtocolTypeUDP), - // }}, - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/4883fa5dbf6f2c9093fac8ce334547e9dfac68fa/specification/network/resource-manager/Microsoft.Network/stable/2024-03-01/examples/DscpConfigurationDelete.json -func ExampleDscpConfigurationClient_BeginDelete() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armnetwork.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewDscpConfigurationClient().BeginDelete(ctx, "rg1", "mydscpConfig", nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - _, err = poller.PollUntilDone(ctx, nil) - if err != nil { - log.Fatalf("failed to pull the result: %v", err) - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/4883fa5dbf6f2c9093fac8ce334547e9dfac68fa/specification/network/resource-manager/Microsoft.Network/stable/2024-03-01/examples/DscpConfigurationGet.json -func ExampleDscpConfigurationClient_Get() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armnetwork.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewDscpConfigurationClient().Get(ctx, "rg1", "mydscpConfig", nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.DscpConfiguration = armnetwork.DscpConfiguration{ - // Name: to.Ptr("mydscpConfig"), - // Type: to.Ptr("Microsoft.Network/dscpConfiguration"), - // ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/dscpConfiguration/mydscpConfig"), - // Location: to.Ptr("eastus"), - // Properties: &armnetwork.DscpConfigurationPropertiesFormat{ - // AssociatedNetworkInterfaces: []*armnetwork.Interface{ - // { - // ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/networkInterfaces/test-nic1"), - // }, - // { - // ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/networkInterfaces/test-nic2"), - // }}, - // ProvisioningState: to.Ptr(armnetwork.ProvisioningStateSucceeded), - // QosCollectionID: to.Ptr("0f8fad5b-d9cb-469f-a165-70867728950e"), - // QosDefinitionCollection: []*armnetwork.QosDefinition{ - // { - // DestinationIPRanges: []*armnetwork.QosIPRange{ - // { - // EndIP: to.Ptr("127.0.10.2"), - // StartIP: to.Ptr("127.0.10.1"), - // }}, - // DestinationPortRanges: []*armnetwork.QosPortRange{ - // { - // End: to.Ptr[int32](62), - // Start: to.Ptr[int32](61), - // }}, - // Markings: []*int32{ - // to.Ptr[int32](1)}, - // SourceIPRanges: []*armnetwork.QosIPRange{ - // { - // EndIP: to.Ptr("127.0.0.2"), - // StartIP: to.Ptr("127.0.0.1"), - // }}, - // SourcePortRanges: []*armnetwork.QosPortRange{ - // { - // End: to.Ptr[int32](12), - // Start: to.Ptr[int32](11), - // }}, - // Protocol: to.Ptr(armnetwork.ProtocolTypeTCP), - // }, - // { - // DestinationIPRanges: []*armnetwork.QosIPRange{ - // { - // EndIP: to.Ptr("12.0.10.2"), - // StartIP: to.Ptr("12.0.10.1"), - // }}, - // DestinationPortRanges: []*armnetwork.QosPortRange{ - // { - // End: to.Ptr[int32](52), - // Start: to.Ptr[int32](51), - // }}, - // Markings: []*int32{ - // to.Ptr[int32](2)}, - // SourceIPRanges: []*armnetwork.QosIPRange{ - // { - // EndIP: to.Ptr("12.0.0.2"), - // StartIP: to.Ptr("12.0.0.1"), - // }}, - // SourcePortRanges: []*armnetwork.QosPortRange{ - // { - // End: to.Ptr[int32](12), - // Start: to.Ptr[int32](11), - // }}, - // Protocol: to.Ptr(armnetwork.ProtocolTypeUDP), - // }}, - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/4883fa5dbf6f2c9093fac8ce334547e9dfac68fa/specification/network/resource-manager/Microsoft.Network/stable/2024-03-01/examples/DscpConfigurationList.json -func ExampleDscpConfigurationClient_NewListPager() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armnetwork.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := clientFactory.NewDscpConfigurationClient().NewListPager("rg1", nil) - for pager.More() { - page, err := pager.NextPage(ctx) - if err != nil { - log.Fatalf("failed to advance page: %v", err) - } - for _, v := range page.Value { - // You could use page here. We use blank identifier for just demo purposes. - _ = v - } - // If the HTTP response code is 200 as defined in example definition, your page structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // page.DscpConfigurationListResult = armnetwork.DscpConfigurationListResult{ - // Value: []*armnetwork.DscpConfiguration{ - // { - // Name: to.Ptr("mydscpConfig"), - // Type: to.Ptr("Microsoft.Network/dscpConfiguration"), - // ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/dscpConfiguration/mydscpConfig"), - // Location: to.Ptr("eastus"), - // Properties: &armnetwork.DscpConfigurationPropertiesFormat{ - // AssociatedNetworkInterfaces: []*armnetwork.Interface{ - // { - // ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/networkInterfaces/test-nic1"), - // }, - // { - // ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/networkInterfaces/test-nic2"), - // }}, - // ProvisioningState: to.Ptr(armnetwork.ProvisioningStateSucceeded), - // QosCollectionID: to.Ptr("0f8fad5b-d9cb-469f-a165-70867728950e"), - // QosDefinitionCollection: []*armnetwork.QosDefinition{ - // { - // DestinationIPRanges: []*armnetwork.QosIPRange{ - // { - // EndIP: to.Ptr("127.0.10.2"), - // StartIP: to.Ptr("127.0.10.1"), - // }}, - // DestinationPortRanges: []*armnetwork.QosPortRange{ - // { - // End: to.Ptr[int32](62), - // Start: to.Ptr[int32](61), - // }}, - // Markings: []*int32{ - // to.Ptr[int32](1)}, - // SourceIPRanges: []*armnetwork.QosIPRange{ - // { - // EndIP: to.Ptr("127.0.0.2"), - // StartIP: to.Ptr("127.0.0.1"), - // }}, - // SourcePortRanges: []*armnetwork.QosPortRange{ - // { - // End: to.Ptr[int32](12), - // Start: to.Ptr[int32](11), - // }}, - // Protocol: to.Ptr(armnetwork.ProtocolTypeTCP), - // }, - // { - // DestinationIPRanges: []*armnetwork.QosIPRange{ - // { - // EndIP: to.Ptr("12.0.10.2"), - // StartIP: to.Ptr("12.0.10.1"), - // }}, - // DestinationPortRanges: []*armnetwork.QosPortRange{ - // { - // End: to.Ptr[int32](52), - // Start: to.Ptr[int32](51), - // }}, - // Markings: []*int32{ - // to.Ptr[int32](2)}, - // SourceIPRanges: []*armnetwork.QosIPRange{ - // { - // EndIP: to.Ptr("12.0.0.2"), - // StartIP: to.Ptr("12.0.0.1"), - // }}, - // SourcePortRanges: []*armnetwork.QosPortRange{ - // { - // End: to.Ptr[int32](12), - // Start: to.Ptr[int32](11), - // }}, - // Protocol: to.Ptr(armnetwork.ProtocolTypeUDP), - // }}, - // }, - // }, - // { - // Name: to.Ptr("mydscpConfig2"), - // Type: to.Ptr("Microsoft.Network/dscpConfiguration"), - // ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/dscpConfiguration/mydscpConfig2"), - // Location: to.Ptr("eastus"), - // Properties: &armnetwork.DscpConfigurationPropertiesFormat{ - // AssociatedNetworkInterfaces: []*armnetwork.Interface{ - // { - // ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/networkInterfaces/test-nic3"), - // }, - // { - // ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/networkInterfaces/test-nic4"), - // }}, - // ProvisioningState: to.Ptr(armnetwork.ProvisioningStateSucceeded), - // QosCollectionID: to.Ptr("9as24mf6-d9cb-7a7f-a165-70867728950e"), - // QosDefinitionCollection: []*armnetwork.QosDefinition{ - // { - // DestinationIPRanges: []*armnetwork.QosIPRange{ - // { - // EndIP: to.Ptr("127.0.10.2"), - // StartIP: to.Ptr("127.0.10.1"), - // }}, - // DestinationPortRanges: []*armnetwork.QosPortRange{ - // { - // End: to.Ptr[int32](62), - // Start: to.Ptr[int32](61), - // }}, - // Markings: []*int32{ - // to.Ptr[int32](1)}, - // SourceIPRanges: []*armnetwork.QosIPRange{ - // { - // EndIP: to.Ptr("127.0.0.2"), - // StartIP: to.Ptr("127.0.0.1"), - // }}, - // SourcePortRanges: []*armnetwork.QosPortRange{ - // { - // End: to.Ptr[int32](12), - // Start: to.Ptr[int32](11), - // }}, - // Protocol: to.Ptr(armnetwork.ProtocolTypeTCP), - // }, - // { - // DestinationIPRanges: []*armnetwork.QosIPRange{ - // { - // EndIP: to.Ptr("12.0.10.2"), - // StartIP: to.Ptr("12.0.10.1"), - // }}, - // DestinationPortRanges: []*armnetwork.QosPortRange{ - // { - // End: to.Ptr[int32](52), - // Start: to.Ptr[int32](51), - // }}, - // Markings: []*int32{ - // to.Ptr[int32](2)}, - // SourceIPRanges: []*armnetwork.QosIPRange{ - // { - // EndIP: to.Ptr("12.0.0.2"), - // StartIP: to.Ptr("12.0.0.1"), - // }}, - // SourcePortRanges: []*armnetwork.QosPortRange{ - // { - // End: to.Ptr[int32](12), - // Start: to.Ptr[int32](11), - // }}, - // Protocol: to.Ptr(armnetwork.ProtocolTypeUDP), - // }}, - // }, - // }}, - // } - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/4883fa5dbf6f2c9093fac8ce334547e9dfac68fa/specification/network/resource-manager/Microsoft.Network/stable/2024-03-01/examples/DscpConfigurationListAll.json -func ExampleDscpConfigurationClient_NewListAllPager() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armnetwork.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := clientFactory.NewDscpConfigurationClient().NewListAllPager(nil) - for pager.More() { - page, err := pager.NextPage(ctx) - if err != nil { - log.Fatalf("failed to advance page: %v", err) - } - for _, v := range page.Value { - // You could use page here. We use blank identifier for just demo purposes. - _ = v - } - // If the HTTP response code is 200 as defined in example definition, your page structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // page.DscpConfigurationListResult = armnetwork.DscpConfigurationListResult{ - // Value: []*armnetwork.DscpConfiguration{ - // { - // Name: to.Ptr("mydscpConfig"), - // Type: to.Ptr("Microsoft.Network/dscpConfiguration"), - // ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/dscpConfiguration/mydscpConfig"), - // Location: to.Ptr("eastus"), - // Properties: &armnetwork.DscpConfigurationPropertiesFormat{ - // AssociatedNetworkInterfaces: []*armnetwork.Interface{ - // { - // ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/networkInterfaces/test-nic1"), - // }, - // { - // ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/networkInterfaces/test-nic2"), - // }}, - // ProvisioningState: to.Ptr(armnetwork.ProvisioningStateSucceeded), - // QosCollectionID: to.Ptr("0f8fad5b-d9cb-469f-a165-70867728950e"), - // QosDefinitionCollection: []*armnetwork.QosDefinition{ - // { - // DestinationIPRanges: []*armnetwork.QosIPRange{ - // { - // EndIP: to.Ptr("127.0.10.2"), - // StartIP: to.Ptr("127.0.10.1"), - // }}, - // DestinationPortRanges: []*armnetwork.QosPortRange{ - // { - // End: to.Ptr[int32](62), - // Start: to.Ptr[int32](61), - // }}, - // Markings: []*int32{ - // to.Ptr[int32](1)}, - // SourceIPRanges: []*armnetwork.QosIPRange{ - // { - // EndIP: to.Ptr("127.0.0.2"), - // StartIP: to.Ptr("127.0.0.1"), - // }}, - // SourcePortRanges: []*armnetwork.QosPortRange{ - // { - // End: to.Ptr[int32](12), - // Start: to.Ptr[int32](11), - // }}, - // Protocol: to.Ptr(armnetwork.ProtocolTypeTCP), - // }, - // { - // DestinationIPRanges: []*armnetwork.QosIPRange{ - // { - // EndIP: to.Ptr("12.0.10.2"), - // StartIP: to.Ptr("12.0.10.1"), - // }}, - // DestinationPortRanges: []*armnetwork.QosPortRange{ - // { - // End: to.Ptr[int32](52), - // Start: to.Ptr[int32](51), - // }}, - // Markings: []*int32{ - // to.Ptr[int32](2)}, - // SourceIPRanges: []*armnetwork.QosIPRange{ - // { - // EndIP: to.Ptr("12.0.0.2"), - // StartIP: to.Ptr("12.0.0.1"), - // }}, - // SourcePortRanges: []*armnetwork.QosPortRange{ - // { - // End: to.Ptr[int32](12), - // Start: to.Ptr[int32](11), - // }}, - // Protocol: to.Ptr(armnetwork.ProtocolTypeUDP), - // }}, - // }, - // }, - // { - // Name: to.Ptr("mydscpConfig2"), - // Type: to.Ptr("Microsoft.Network/dscpConfiguration"), - // ID: to.Ptr("/subscriptions/subid/resourceGroups/rg2/providers/Microsoft.Network/dscpConfiguration/mydscpConfig2"), - // Location: to.Ptr("eastus"), - // Properties: &armnetwork.DscpConfigurationPropertiesFormat{ - // AssociatedNetworkInterfaces: []*armnetwork.Interface{ - // { - // ID: to.Ptr("/subscriptions/subid/resourceGroups/rg2/providers/Microsoft.Network/networkInterfaces/test-nic3"), - // }, - // { - // ID: to.Ptr("/subscriptions/subid/resourceGroups/rg2/providers/Microsoft.Network/networkInterfaces/test-nic4"), - // }}, - // ProvisioningState: to.Ptr(armnetwork.ProvisioningStateSucceeded), - // QosCollectionID: to.Ptr("9as24mf6-d9cb-7a7f-a165-70867728950e"), - // QosDefinitionCollection: []*armnetwork.QosDefinition{ - // { - // DestinationIPRanges: []*armnetwork.QosIPRange{ - // { - // EndIP: to.Ptr("127.0.10.2"), - // StartIP: to.Ptr("127.0.10.1"), - // }}, - // DestinationPortRanges: []*armnetwork.QosPortRange{ - // { - // End: to.Ptr[int32](62), - // Start: to.Ptr[int32](61), - // }}, - // Markings: []*int32{ - // to.Ptr[int32](1)}, - // SourceIPRanges: []*armnetwork.QosIPRange{ - // { - // EndIP: to.Ptr("127.0.0.2"), - // StartIP: to.Ptr("127.0.0.1"), - // }}, - // SourcePortRanges: []*armnetwork.QosPortRange{ - // { - // End: to.Ptr[int32](12), - // Start: to.Ptr[int32](11), - // }}, - // Protocol: to.Ptr(armnetwork.ProtocolTypeTCP), - // }, - // { - // DestinationIPRanges: []*armnetwork.QosIPRange{ - // { - // EndIP: to.Ptr("12.0.10.2"), - // StartIP: to.Ptr("12.0.10.1"), - // }}, - // DestinationPortRanges: []*armnetwork.QosPortRange{ - // { - // End: to.Ptr[int32](52), - // Start: to.Ptr[int32](51), - // }}, - // Markings: []*int32{ - // to.Ptr[int32](2)}, - // SourceIPRanges: []*armnetwork.QosIPRange{ - // { - // EndIP: to.Ptr("12.0.0.2"), - // StartIP: to.Ptr("12.0.0.1"), - // }}, - // SourcePortRanges: []*armnetwork.QosPortRange{ - // { - // End: to.Ptr[int32](12), - // Start: to.Ptr[int32](11), - // }}, - // Protocol: to.Ptr(armnetwork.ProtocolTypeUDP), - // }}, - // }, - // }}, - // } - } -} diff --git a/sdk/resourcemanager/network/armnetwork/expressroutecircuitauthorizations_client_example_test.go b/sdk/resourcemanager/network/armnetwork/expressroutecircuitauthorizations_client_example_test.go deleted file mode 100644 index 368126c468c7..000000000000 --- a/sdk/resourcemanager/network/armnetwork/expressroutecircuitauthorizations_client_example_test.go +++ /dev/null @@ -1,143 +0,0 @@ -//go:build go1.18 -// +build go1.18 - -// 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. -// DO NOT EDIT. - -package armnetwork_test - -import ( - "context" - "log" - - "github.com/Azure/azure-sdk-for-go/sdk/azidentity" - "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/network/armnetwork/v6" -) - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/4883fa5dbf6f2c9093fac8ce334547e9dfac68fa/specification/network/resource-manager/Microsoft.Network/stable/2024-03-01/examples/ExpressRouteCircuitAuthorizationDelete.json -func ExampleExpressRouteCircuitAuthorizationsClient_BeginDelete() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armnetwork.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewExpressRouteCircuitAuthorizationsClient().BeginDelete(ctx, "rg1", "circuitName", "authorizationName", nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - _, err = poller.PollUntilDone(ctx, nil) - if err != nil { - log.Fatalf("failed to pull the result: %v", err) - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/4883fa5dbf6f2c9093fac8ce334547e9dfac68fa/specification/network/resource-manager/Microsoft.Network/stable/2024-03-01/examples/ExpressRouteCircuitAuthorizationGet.json -func ExampleExpressRouteCircuitAuthorizationsClient_Get() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armnetwork.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewExpressRouteCircuitAuthorizationsClient().Get(ctx, "rg1", "circuitName", "authorizationName", nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.ExpressRouteCircuitAuthorization = armnetwork.ExpressRouteCircuitAuthorization{ - // ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/expressRouteCircuits/circuitName/authorizations/MyAuthorization1"), - // Name: to.Ptr("MyAuthorization1"), - // Type: to.Ptr("Microsoft.Network/expressRouteCircuits/authorizations"), - // Etag: to.Ptr("W/\"e33c875f-48df-4a91-b7d3-eb95b5ddbb89\""), - // Properties: &armnetwork.AuthorizationPropertiesFormat{ - // AuthorizationKey: to.Ptr("authKey"), - // AuthorizationUseStatus: to.Ptr(armnetwork.AuthorizationUseStatusAvailable), - // ProvisioningState: to.Ptr(armnetwork.ProvisioningStateSucceeded), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/4883fa5dbf6f2c9093fac8ce334547e9dfac68fa/specification/network/resource-manager/Microsoft.Network/stable/2024-03-01/examples/ExpressRouteCircuitAuthorizationCreate.json -func ExampleExpressRouteCircuitAuthorizationsClient_BeginCreateOrUpdate() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armnetwork.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewExpressRouteCircuitAuthorizationsClient().BeginCreateOrUpdate(ctx, "rg1", "circuitName", "authorizatinName", armnetwork.ExpressRouteCircuitAuthorization{ - Properties: &armnetwork.AuthorizationPropertiesFormat{}, - }, nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - res, err := poller.PollUntilDone(ctx, nil) - if err != nil { - log.Fatalf("failed to pull the result: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.ExpressRouteCircuitAuthorization = armnetwork.ExpressRouteCircuitAuthorization{ - // ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/expressRouteCircuits/circuitName/authorizations/authorizationName"), - // Name: to.Ptr("authorizationName"), - // Etag: to.Ptr("W/\"e22dd4b2-4c24-44cf-b702-70a472b62914\""), - // Properties: &armnetwork.AuthorizationPropertiesFormat{ - // AuthorizationUseStatus: to.Ptr(armnetwork.AuthorizationUseStatusAvailable), - // ProvisioningState: to.Ptr(armnetwork.ProvisioningStateSucceeded), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/4883fa5dbf6f2c9093fac8ce334547e9dfac68fa/specification/network/resource-manager/Microsoft.Network/stable/2024-03-01/examples/ExpressRouteCircuitAuthorizationList.json -func ExampleExpressRouteCircuitAuthorizationsClient_NewListPager() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armnetwork.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := clientFactory.NewExpressRouteCircuitAuthorizationsClient().NewListPager("rg1", "circuitName", nil) - for pager.More() { - page, err := pager.NextPage(ctx) - if err != nil { - log.Fatalf("failed to advance page: %v", err) - } - for _, v := range page.Value { - // You could use page here. We use blank identifier for just demo purposes. - _ = v - } - // If the HTTP response code is 200 as defined in example definition, your page structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // page.AuthorizationListResult = armnetwork.AuthorizationListResult{ - // Value: []*armnetwork.ExpressRouteCircuitAuthorization{ - // { - // ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/expressRouteCircuits/circuitName/authorizations/MyAuthorization1"), - // Name: to.Ptr("MyAuthorization1"), - // Etag: to.Ptr("W/\"e33c875f-48df-4a91-b7d3-eb95b5ddbb89\""), - // Properties: &armnetwork.AuthorizationPropertiesFormat{ - // AuthorizationKey: to.Ptr("authKey"), - // AuthorizationUseStatus: to.Ptr(armnetwork.AuthorizationUseStatusAvailable), - // ProvisioningState: to.Ptr(armnetwork.ProvisioningStateSucceeded), - // }, - // }}, - // } - } -} diff --git a/sdk/resourcemanager/network/armnetwork/expressroutecircuitconnections_client_example_test.go b/sdk/resourcemanager/network/armnetwork/expressroutecircuitconnections_client_example_test.go deleted file mode 100644 index ab8cb6537788..000000000000 --- a/sdk/resourcemanager/network/armnetwork/expressroutecircuitconnections_client_example_test.go +++ /dev/null @@ -1,206 +0,0 @@ -//go:build go1.18 -// +build go1.18 - -// 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. -// DO NOT EDIT. - -package armnetwork_test - -import ( - "context" - "log" - - "github.com/Azure/azure-sdk-for-go/sdk/azcore/to" - "github.com/Azure/azure-sdk-for-go/sdk/azidentity" - "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/network/armnetwork/v6" -) - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/4883fa5dbf6f2c9093fac8ce334547e9dfac68fa/specification/network/resource-manager/Microsoft.Network/stable/2024-03-01/examples/ExpressRouteCircuitConnectionDelete.json -func ExampleExpressRouteCircuitConnectionsClient_BeginDelete() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armnetwork.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewExpressRouteCircuitConnectionsClient().BeginDelete(ctx, "rg1", "ExpressRouteARMCircuitA", "AzurePrivatePeering", "circuitConnectionUSAUS", nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - _, err = poller.PollUntilDone(ctx, nil) - if err != nil { - log.Fatalf("failed to pull the result: %v", err) - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/4883fa5dbf6f2c9093fac8ce334547e9dfac68fa/specification/network/resource-manager/Microsoft.Network/stable/2024-03-01/examples/ExpressRouteCircuitConnectionGet.json -func ExampleExpressRouteCircuitConnectionsClient_Get() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armnetwork.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewExpressRouteCircuitConnectionsClient().Get(ctx, "rg1", "ExpressRouteARMCircuitA", "AzurePrivatePeering", "circuitConnectionUSAUS", nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.ExpressRouteCircuitConnection = armnetwork.ExpressRouteCircuitConnection{ - // ID: to.Ptr("/subscriptions/subid1/resourceGroups/dedharcktinit/providers/Microsoft.Network/expressRouteCircuits/ExpressRouteARMCircuitA/peerings/AzurePrivatePeering/connections/circuitConnectionUSAUS"), - // Name: to.Ptr("circuitConnectionUSAUS"), - // Type: to.Ptr("Microsoft.Network/expressRouteCircuits/peerings/connections"), - // Etag: to.Ptr("w/\\00000000-0000-0000-0000-000000000000\\"), - // Properties: &armnetwork.ExpressRouteCircuitConnectionPropertiesFormat{ - // AddressPrefix: to.Ptr("10.0.0.0/24"), - // AuthorizationKey: to.Ptr("946a1918-b7a2-4917-b43c-8c4cdaee006a"), - // CircuitConnectionStatus: to.Ptr(armnetwork.CircuitConnectionStatusConnected), - // ExpressRouteCircuitPeering: &armnetwork.SubResource{ - // ID: to.Ptr("/subscriptions/subid1/resourceGroups/dedharcktinit/providers/Microsoft.Network/expressRouteCircuits/dedharcktlocal/peerings/AzurePrivatePeering"), - // }, - // IPv6CircuitConnectionConfig: &armnetwork.IPv6CircuitConnectionConfig{ - // AddressPrefix: to.Ptr("aa:bb::1/125"), - // CircuitConnectionStatus: to.Ptr(armnetwork.CircuitConnectionStatusConnected), - // }, - // PeerExpressRouteCircuitPeering: &armnetwork.SubResource{ - // ID: to.Ptr("/subscriptions/subid2/resourceGroups/dedharcktpeer/providers/Microsoft.Network/expressRouteCircuits/dedharcktremote/peerings/AzurePrivatePeering"), - // }, - // ProvisioningState: to.Ptr(armnetwork.ProvisioningStateSucceeded), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/4883fa5dbf6f2c9093fac8ce334547e9dfac68fa/specification/network/resource-manager/Microsoft.Network/stable/2024-03-01/examples/ExpressRouteCircuitConnectionCreate.json -func ExampleExpressRouteCircuitConnectionsClient_BeginCreateOrUpdate() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armnetwork.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewExpressRouteCircuitConnectionsClient().BeginCreateOrUpdate(ctx, "rg1", "ExpressRouteARMCircuitA", "AzurePrivatePeering", "circuitConnectionUSAUS", armnetwork.ExpressRouteCircuitConnection{ - Properties: &armnetwork.ExpressRouteCircuitConnectionPropertiesFormat{ - AddressPrefix: to.Ptr("10.0.0.0/29"), - AuthorizationKey: to.Ptr("946a1918-b7a2-4917-b43c-8c4cdaee006a"), - ExpressRouteCircuitPeering: &armnetwork.SubResource{ - ID: to.Ptr("/subscriptions/subid1/resourceGroups/dedharcktinit/providers/Microsoft.Network/expressRouteCircuits/dedharcktlocal/peerings/AzurePrivatePeering"), - }, - IPv6CircuitConnectionConfig: &armnetwork.IPv6CircuitConnectionConfig{ - AddressPrefix: to.Ptr("aa:bb::/125"), - }, - PeerExpressRouteCircuitPeering: &armnetwork.SubResource{ - ID: to.Ptr("/subscriptions/subid2/resourceGroups/dedharcktpeer/providers/Microsoft.Network/expressRouteCircuits/dedharcktremote/peerings/AzurePrivatePeering"), - }, - }, - }, nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - res, err := poller.PollUntilDone(ctx, nil) - if err != nil { - log.Fatalf("failed to pull the result: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.ExpressRouteCircuitConnection = armnetwork.ExpressRouteCircuitConnection{ - // ID: to.Ptr("/subscriptions/subid1/resourceGroups/dedharcktinit/providers/Microsoft.Network/expressRouteCircuits/ExpressRouteARMCircuitA/peerings/AzurePrivatePeering/connections/circuitConnectionUSAUS"), - // Name: to.Ptr("circuitConnectionUSAUS"), - // Etag: to.Ptr("w/\\00000000-0000-0000-0000-000000000000\\"), - // Properties: &armnetwork.ExpressRouteCircuitConnectionPropertiesFormat{ - // AddressPrefix: to.Ptr("10.0.0.0/24"), - // AuthorizationKey: to.Ptr("946a1918-b7a2-4917-b43c-8c4cdaee006a"), - // CircuitConnectionStatus: to.Ptr(armnetwork.CircuitConnectionStatusConnected), - // ExpressRouteCircuitPeering: &armnetwork.SubResource{ - // ID: to.Ptr("/subscriptions/subid1/resourceGroups/dedharcktinit/providers/Microsoft.Network/expressRouteCircuits/dedharcktlocal/peerings/AzurePrivatePeering"), - // }, - // IPv6CircuitConnectionConfig: &armnetwork.IPv6CircuitConnectionConfig{ - // AddressPrefix: to.Ptr("aa:bb::1/125"), - // CircuitConnectionStatus: to.Ptr(armnetwork.CircuitConnectionStatusConnected), - // }, - // PeerExpressRouteCircuitPeering: &armnetwork.SubResource{ - // ID: to.Ptr("/subscriptions/subid2/resourceGroups/dedharcktpeer/providers/Microsoft.Network/expressRouteCircuits/dedharcktremote/peerings/AzurePrivatePeering"), - // }, - // ProvisioningState: to.Ptr(armnetwork.ProvisioningStateSucceeded), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/4883fa5dbf6f2c9093fac8ce334547e9dfac68fa/specification/network/resource-manager/Microsoft.Network/stable/2024-03-01/examples/ExpressRouteCircuitConnectionList.json -func ExampleExpressRouteCircuitConnectionsClient_NewListPager() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armnetwork.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := clientFactory.NewExpressRouteCircuitConnectionsClient().NewListPager("rg1", "ExpressRouteARMCircuitA", "AzurePrivatePeering", nil) - for pager.More() { - page, err := pager.NextPage(ctx) - if err != nil { - log.Fatalf("failed to advance page: %v", err) - } - for _, v := range page.Value { - // You could use page here. We use blank identifier for just demo purposes. - _ = v - } - // If the HTTP response code is 200 as defined in example definition, your page structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // page.ExpressRouteCircuitConnectionListResult = armnetwork.ExpressRouteCircuitConnectionListResult{ - // Value: []*armnetwork.ExpressRouteCircuitConnection{ - // { - // ID: to.Ptr("/subscriptions/subid1/resourceGroups/dedharcktinit/providers/Microsoft.Network/expressRouteCircuits/ExpressRouteARMCircuitA/peerings/AzurePrivatePeering/connections/circuitConnectionUSAUS"), - // Name: to.Ptr("circuitConnectionUSAUS"), - // Etag: to.Ptr("w/\\00000000-0000-0000-0000-000000000000\\"), - // Properties: &armnetwork.ExpressRouteCircuitConnectionPropertiesFormat{ - // AddressPrefix: to.Ptr("10.0.0.0/24"), - // AuthorizationKey: to.Ptr("946a1918-b7a2-4917-b43c-8c4cdaee006a"), - // CircuitConnectionStatus: to.Ptr(armnetwork.CircuitConnectionStatusConnected), - // ExpressRouteCircuitPeering: &armnetwork.SubResource{ - // ID: to.Ptr("/subscriptions/subid1/resourceGroups/dedharcktinit/providers/Microsoft.Network/expressRouteCircuits/dedharcktlocal/peerings/AzurePrivatePeering"), - // }, - // IPv6CircuitConnectionConfig: &armnetwork.IPv6CircuitConnectionConfig{ - // AddressPrefix: to.Ptr("aa:bb::1/125"), - // CircuitConnectionStatus: to.Ptr(armnetwork.CircuitConnectionStatusConnected), - // }, - // PeerExpressRouteCircuitPeering: &armnetwork.SubResource{ - // ID: to.Ptr("/subscriptions/subid2/resourceGroups/dedharcktpeer/providers/Microsoft.Network/expressRouteCircuits/dedharcktremote/peerings/AzurePrivatePeering"), - // }, - // ProvisioningState: to.Ptr(armnetwork.ProvisioningStateSucceeded), - // }, - // }, - // { - // ID: to.Ptr("/subscriptions/subid1/resourceGroups/dedharcktinit/providers/Microsoft.Network/expressRouteCircuits/ExpressRouteARMCircuitA/peerings/AzurePrivatePeering/connections/circuitConnectionUSEUR"), - // Name: to.Ptr("circuitConnectionUSEUR"), - // Etag: to.Ptr("w/\\00000000-0000-0000-0000-000000000000\\"), - // Properties: &armnetwork.ExpressRouteCircuitConnectionPropertiesFormat{ - // AddressPrefix: to.Ptr("20.0.0.0/24"), - // CircuitConnectionStatus: to.Ptr(armnetwork.CircuitConnectionStatusConnected), - // ExpressRouteCircuitPeering: &armnetwork.SubResource{ - // ID: to.Ptr("/subscriptions/subid1/resourceGroups/dedharcktinit/providers/Microsoft.Network/expressRouteCircuits/dedharcktlocal/peerings/AzurePrivatePeering"), - // }, - // PeerExpressRouteCircuitPeering: &armnetwork.SubResource{ - // ID: to.Ptr("/subscriptions/subid1/resourceGroups/dedharckteurope/providers/Microsoft.Network/expressRouteCircuits/dedharcktams/peerings/AzurePrivatePeering"), - // }, - // ProvisioningState: to.Ptr(armnetwork.ProvisioningStateSucceeded), - // }, - // }}, - // } - } -} diff --git a/sdk/resourcemanager/network/armnetwork/expressroutecircuitpeerings_client_example_test.go b/sdk/resourcemanager/network/armnetwork/expressroutecircuitpeerings_client_example_test.go deleted file mode 100644 index 3b80840cbad9..000000000000 --- a/sdk/resourcemanager/network/armnetwork/expressroutecircuitpeerings_client_example_test.go +++ /dev/null @@ -1,266 +0,0 @@ -//go:build go1.18 -// +build go1.18 - -// 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. -// DO NOT EDIT. - -package armnetwork_test - -import ( - "context" - "log" - - "github.com/Azure/azure-sdk-for-go/sdk/azcore/to" - "github.com/Azure/azure-sdk-for-go/sdk/azidentity" - "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/network/armnetwork/v6" -) - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/4883fa5dbf6f2c9093fac8ce334547e9dfac68fa/specification/network/resource-manager/Microsoft.Network/stable/2024-03-01/examples/ExpressRouteCircuitPeeringDelete.json -func ExampleExpressRouteCircuitPeeringsClient_BeginDelete() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armnetwork.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewExpressRouteCircuitPeeringsClient().BeginDelete(ctx, "rg1", "circuitName", "peeringName", nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - _, err = poller.PollUntilDone(ctx, nil) - if err != nil { - log.Fatalf("failed to pull the result: %v", err) - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/4883fa5dbf6f2c9093fac8ce334547e9dfac68fa/specification/network/resource-manager/Microsoft.Network/stable/2024-03-01/examples/ExpressRouteCircuitPeeringGet.json -func ExampleExpressRouteCircuitPeeringsClient_Get() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armnetwork.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewExpressRouteCircuitPeeringsClient().Get(ctx, "rg1", "circuitName", "MicrosoftPeering", nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.ExpressRouteCircuitPeering = armnetwork.ExpressRouteCircuitPeering{ - // ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/expressRouteCircuits/circuitName/peerings/MicrosoftPeering"), - // Name: to.Ptr("MicrosoftPeering"), - // Type: to.Ptr("Microsoft.Network/expressRouteCircuits/peerings"), - // Etag: to.Ptr("W/\"b2a25b98-2e6d-4d46-87f2-089de5f6fdf9\""), - // Properties: &armnetwork.ExpressRouteCircuitPeeringPropertiesFormat{ - // AzureASN: to.Ptr[int32](12076), - // GatewayManagerEtag: to.Ptr("103"), - // IPv6PeeringConfig: &armnetwork.IPv6ExpressRouteCircuitPeeringConfig{ - // MicrosoftPeeringConfig: &armnetwork.ExpressRouteCircuitPeeringConfig{ - // AdvertisedCommunities: []*string{ - // }, - // AdvertisedPublicPrefixes: []*string{ - // to.Ptr("3FFE:FFFF:0:CD31::/120")}, - // AdvertisedPublicPrefixesState: to.Ptr(armnetwork.ExpressRouteCircuitPeeringAdvertisedPublicPrefixStateValidationNeeded), - // CustomerASN: to.Ptr[int32](23), - // LegacyMode: to.Ptr[int32](0), - // RoutingRegistryName: to.Ptr("ARIN"), - // }, - // PrimaryPeerAddressPrefix: to.Ptr("3FFE:FFFF:0:CD30::/126"), - // SecondaryPeerAddressPrefix: to.Ptr("3FFE:FFFF:0:CD30::4/126"), - // State: to.Ptr(armnetwork.ExpressRouteCircuitPeeringStateEnabled), - // }, - // LastModifiedBy: to.Ptr("Customer"), - // MicrosoftPeeringConfig: &armnetwork.ExpressRouteCircuitPeeringConfig{ - // AdvertisedCommunities: []*string{ - // }, - // AdvertisedPublicPrefixes: []*string{ - // to.Ptr("123.1.0.0/24")}, - // AdvertisedPublicPrefixesState: to.Ptr(armnetwork.ExpressRouteCircuitPeeringAdvertisedPublicPrefixStateValidationNeeded), - // CustomerASN: to.Ptr[int32](23), - // LegacyMode: to.Ptr[int32](0), - // RoutingRegistryName: to.Ptr("ARIN"), - // }, - // PeerASN: to.Ptr[int64](100), - // PeeringType: to.Ptr(armnetwork.ExpressRoutePeeringTypeMicrosoftPeering), - // PrimaryAzurePort: to.Ptr("A51-TEST-06GMR-CIS-1-PRI-A"), - // PrimaryPeerAddressPrefix: to.Ptr("123.0.0.0/30"), - // ProvisioningState: to.Ptr(armnetwork.ProvisioningStateSucceeded), - // RouteFilter: &armnetwork.SubResource{ - // ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/routeFilters/filterName"), - // }, - // SecondaryAzurePort: to.Ptr("A51-TEST-06GMR-CIS-2-SEC-A"), - // SecondaryPeerAddressPrefix: to.Ptr("123.0.0.4/30"), - // State: to.Ptr(armnetwork.ExpressRoutePeeringStateEnabled), - // VlanID: to.Ptr[int32](300), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/4883fa5dbf6f2c9093fac8ce334547e9dfac68fa/specification/network/resource-manager/Microsoft.Network/stable/2024-03-01/examples/ExpressRouteCircuitPeeringCreate.json -func ExampleExpressRouteCircuitPeeringsClient_BeginCreateOrUpdate() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armnetwork.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewExpressRouteCircuitPeeringsClient().BeginCreateOrUpdate(ctx, "rg1", "circuitName", "AzurePrivatePeering", armnetwork.ExpressRouteCircuitPeering{ - Properties: &armnetwork.ExpressRouteCircuitPeeringPropertiesFormat{ - PeerASN: to.Ptr[int64](200), - PrimaryPeerAddressPrefix: to.Ptr("192.168.16.252/30"), - SecondaryPeerAddressPrefix: to.Ptr("192.168.18.252/30"), - VlanID: to.Ptr[int32](200), - }, - }, nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - res, err := poller.PollUntilDone(ctx, nil) - if err != nil { - log.Fatalf("failed to pull the result: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.ExpressRouteCircuitPeering = armnetwork.ExpressRouteCircuitPeering{ - // ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/expressRouteCircuits/circuitName/peerings/AzurePrivatePeering"), - // Name: to.Ptr("AzurePrivatePeering"), - // Etag: to.Ptr("W/\"72090554-7e3b-43f2-80ad-99a9020dcb11\""), - // Properties: &armnetwork.ExpressRouteCircuitPeeringPropertiesFormat{ - // AzureASN: to.Ptr[int32](12076), - // ExpressRouteConnection: &armnetwork.ExpressRouteConnectionID{ - // }, - // GatewayManagerEtag: to.Ptr(""), - // IPv6PeeringConfig: &armnetwork.IPv6ExpressRouteCircuitPeeringConfig{ - // PrimaryPeerAddressPrefix: to.Ptr("3FFE:FFFF:0:CD30::/126"), - // SecondaryPeerAddressPrefix: to.Ptr("3FFE:FFFF:0:CD30::4/126"), - // State: to.Ptr(armnetwork.ExpressRouteCircuitPeeringStateEnabled), - // }, - // LastModifiedBy: to.Ptr("Customer"), - // PeerASN: to.Ptr[int64](200), - // PeeringType: to.Ptr(armnetwork.ExpressRoutePeeringTypeAzurePrivatePeering), - // PrimaryAzurePort: to.Ptr(""), - // PrimaryPeerAddressPrefix: to.Ptr("192.168.16.252/30"), - // ProvisioningState: to.Ptr(armnetwork.ProvisioningStateSucceeded), - // SecondaryAzurePort: to.Ptr(""), - // SecondaryPeerAddressPrefix: to.Ptr("192.168.18.252/30"), - // State: to.Ptr(armnetwork.ExpressRoutePeeringStateEnabled), - // VlanID: to.Ptr[int32](200), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/4883fa5dbf6f2c9093fac8ce334547e9dfac68fa/specification/network/resource-manager/Microsoft.Network/stable/2024-03-01/examples/ExpressRouteCircuitPeeringList.json -func ExampleExpressRouteCircuitPeeringsClient_NewListPager() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armnetwork.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := clientFactory.NewExpressRouteCircuitPeeringsClient().NewListPager("rg1", "circuitName", nil) - for pager.More() { - page, err := pager.NextPage(ctx) - if err != nil { - log.Fatalf("failed to advance page: %v", err) - } - for _, v := range page.Value { - // You could use page here. We use blank identifier for just demo purposes. - _ = v - } - // If the HTTP response code is 200 as defined in example definition, your page structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // page.ExpressRouteCircuitPeeringListResult = armnetwork.ExpressRouteCircuitPeeringListResult{ - // Value: []*armnetwork.ExpressRouteCircuitPeering{ - // { - // ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/expressRouteCircuits/circuitName/peerings/MicrosoftPeering"), - // Name: to.Ptr("MicrosoftPeering"), - // Etag: to.Ptr("W/\"b2a25b98-2e6d-4d46-87f2-089de5f6fdf9\""), - // Properties: &armnetwork.ExpressRouteCircuitPeeringPropertiesFormat{ - // AzureASN: to.Ptr[int32](12076), - // ExpressRouteConnection: &armnetwork.ExpressRouteConnectionID{ - // }, - // GatewayManagerEtag: to.Ptr("103"), - // IPv6PeeringConfig: &armnetwork.IPv6ExpressRouteCircuitPeeringConfig{ - // MicrosoftPeeringConfig: &armnetwork.ExpressRouteCircuitPeeringConfig{ - // AdvertisedCommunities: []*string{ - // }, - // AdvertisedPublicPrefixes: []*string{ - // to.Ptr("3FFE:FFFF:0:CD31::/120")}, - // AdvertisedPublicPrefixesState: to.Ptr(armnetwork.ExpressRouteCircuitPeeringAdvertisedPublicPrefixStateValidationNeeded), - // CustomerASN: to.Ptr[int32](23), - // LegacyMode: to.Ptr[int32](0), - // RoutingRegistryName: to.Ptr("ARIN"), - // }, - // PrimaryPeerAddressPrefix: to.Ptr("3FFE:FFFF:0:CD30::/126"), - // SecondaryPeerAddressPrefix: to.Ptr("3FFE:FFFF:0:CD30::4/126"), - // State: to.Ptr(armnetwork.ExpressRouteCircuitPeeringStateEnabled), - // }, - // LastModifiedBy: to.Ptr("Customer"), - // MicrosoftPeeringConfig: &armnetwork.ExpressRouteCircuitPeeringConfig{ - // AdvertisedCommunities: []*string{ - // }, - // AdvertisedPublicPrefixes: []*string{ - // to.Ptr("123.1.0.0/24")}, - // AdvertisedPublicPrefixesState: to.Ptr(armnetwork.ExpressRouteCircuitPeeringAdvertisedPublicPrefixStateValidationNeeded), - // CustomerASN: to.Ptr[int32](23), - // LegacyMode: to.Ptr[int32](0), - // RoutingRegistryName: to.Ptr("ARIN"), - // }, - // PeerASN: to.Ptr[int64](100), - // PeeringType: to.Ptr(armnetwork.ExpressRoutePeeringTypeMicrosoftPeering), - // PrimaryAzurePort: to.Ptr("A51-TEST-06GMR-CIS-1-PRI-A"), - // PrimaryPeerAddressPrefix: to.Ptr("123.0.0.0/30"), - // ProvisioningState: to.Ptr(armnetwork.ProvisioningStateSucceeded), - // SecondaryAzurePort: to.Ptr("A51-TEST-06GMR-CIS-2-SEC-A"), - // SecondaryPeerAddressPrefix: to.Ptr("123.0.0.4/30"), - // State: to.Ptr(armnetwork.ExpressRoutePeeringStateEnabled), - // VlanID: to.Ptr[int32](300), - // }, - // }, - // { - // ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/expressRouteCircuits/circuitName/peerings/AzurePrivatePeering"), - // Name: to.Ptr("AzurePrivatePeering"), - // Etag: to.Ptr("W/\"b2a25b98-2e6d-4d46-87f2-089de5f6fdf9\""), - // Properties: &armnetwork.ExpressRouteCircuitPeeringPropertiesFormat{ - // AzureASN: to.Ptr[int32](12076), - // ExpressRouteConnection: &armnetwork.ExpressRouteConnectionID{ - // ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/expressRouteGateways/expressRouteGatewayName/expressRouteConnections/connectionName"), - // }, - // GatewayManagerEtag: to.Ptr("103"), - // IPv6PeeringConfig: &armnetwork.IPv6ExpressRouteCircuitPeeringConfig{ - // PrimaryPeerAddressPrefix: to.Ptr("3FFE:FFFF:0:CD30::/126"), - // SecondaryPeerAddressPrefix: to.Ptr("3FFE:FFFF:0:CD30::4/126"), - // State: to.Ptr(armnetwork.ExpressRouteCircuitPeeringStateEnabled), - // }, - // LastModifiedBy: to.Ptr("Customer"), - // PeerASN: to.Ptr[int64](100), - // PeeringType: to.Ptr(armnetwork.ExpressRoutePeeringTypeAzurePrivatePeering), - // PrimaryAzurePort: to.Ptr("A51-TEST-06GMR-CIS-1-PRI-A"), - // PrimaryPeerAddressPrefix: to.Ptr("10.0.0.0/30"), - // ProvisioningState: to.Ptr(armnetwork.ProvisioningStateSucceeded), - // SecondaryAzurePort: to.Ptr("A51-TEST-06GMR-CIS-2-SEC-A"), - // SecondaryPeerAddressPrefix: to.Ptr("10.0.0.4/30"), - // State: to.Ptr(armnetwork.ExpressRoutePeeringStateEnabled), - // VlanID: to.Ptr[int32](200), - // }, - // }}, - // } - } -} diff --git a/sdk/resourcemanager/network/armnetwork/expressroutecircuits_client_example_test.go b/sdk/resourcemanager/network/armnetwork/expressroutecircuits_client_example_test.go deleted file mode 100644 index 9095fdf2aae8..000000000000 --- a/sdk/resourcemanager/network/armnetwork/expressroutecircuits_client_example_test.go +++ /dev/null @@ -1,644 +0,0 @@ -//go:build go1.18 -// +build go1.18 - -// 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. -// DO NOT EDIT. - -package armnetwork_test - -import ( - "context" - "log" - - "github.com/Azure/azure-sdk-for-go/sdk/azcore/to" - "github.com/Azure/azure-sdk-for-go/sdk/azidentity" - "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/network/armnetwork/v6" -) - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/4883fa5dbf6f2c9093fac8ce334547e9dfac68fa/specification/network/resource-manager/Microsoft.Network/stable/2024-03-01/examples/ExpressRouteCircuitDelete.json -func ExampleExpressRouteCircuitsClient_BeginDelete() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armnetwork.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewExpressRouteCircuitsClient().BeginDelete(ctx, "rg1", "circuitName", nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - _, err = poller.PollUntilDone(ctx, nil) - if err != nil { - log.Fatalf("failed to pull the result: %v", err) - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/4883fa5dbf6f2c9093fac8ce334547e9dfac68fa/specification/network/resource-manager/Microsoft.Network/stable/2024-03-01/examples/ExpressRouteCircuitGet.json -func ExampleExpressRouteCircuitsClient_Get() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armnetwork.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewExpressRouteCircuitsClient().Get(ctx, "rg1", "circuitName", nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.ExpressRouteCircuit = armnetwork.ExpressRouteCircuit{ - // Name: to.Ptr("circuitName"), - // Type: to.Ptr("Microsoft.Network/expressRouteCircuits"), - // ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/expressRouteCircuits/circuitName"), - // Location: to.Ptr("westus"), - // Etag: to.Ptr("w/\\00000000-0000-0000-0000-000000000000\\"), - // Properties: &armnetwork.ExpressRouteCircuitPropertiesFormat{ - // AllowClassicOperations: to.Ptr(false), - // Authorizations: []*armnetwork.ExpressRouteCircuitAuthorization{ - // }, - // CircuitProvisioningState: to.Ptr("Enabled"), - // Peerings: []*armnetwork.ExpressRouteCircuitPeering{ - // }, - // ProvisioningState: to.Ptr(armnetwork.ProvisioningStateSucceeded), - // ServiceKey: to.Ptr("a1410692-0000-4ceb-b94a-b90b94d398d1"), - // ServiceProviderProperties: &armnetwork.ExpressRouteCircuitServiceProviderProperties{ - // BandwidthInMbps: to.Ptr[int32](200), - // PeeringLocation: to.Ptr("peeringLocation"), - // ServiceProviderName: to.Ptr("providerName"), - // }, - // ServiceProviderProvisioningState: to.Ptr(armnetwork.ServiceProviderProvisioningStateNotProvisioned), - // }, - // SKU: &armnetwork.ExpressRouteCircuitSKU{ - // Name: to.Ptr("Standard_MeteredData"), - // Family: to.Ptr(armnetwork.ExpressRouteCircuitSKUFamilyMeteredData), - // Tier: to.Ptr(armnetwork.ExpressRouteCircuitSKUTierStandard), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/4883fa5dbf6f2c9093fac8ce334547e9dfac68fa/specification/network/resource-manager/Microsoft.Network/stable/2024-03-01/examples/ExpressRouteCircuitCreate.json -func ExampleExpressRouteCircuitsClient_BeginCreateOrUpdate_createExpressRouteCircuit() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armnetwork.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewExpressRouteCircuitsClient().BeginCreateOrUpdate(ctx, "rg1", "circuitName", armnetwork.ExpressRouteCircuit{ - Location: to.Ptr("Brazil South"), - Properties: &armnetwork.ExpressRouteCircuitPropertiesFormat{ - AllowClassicOperations: to.Ptr(false), - Authorizations: []*armnetwork.ExpressRouteCircuitAuthorization{}, - Peerings: []*armnetwork.ExpressRouteCircuitPeering{}, - ServiceProviderProperties: &armnetwork.ExpressRouteCircuitServiceProviderProperties{ - BandwidthInMbps: to.Ptr[int32](200), - PeeringLocation: to.Ptr("Silicon Valley"), - ServiceProviderName: to.Ptr("Equinix"), - }, - }, - SKU: &armnetwork.ExpressRouteCircuitSKU{ - Name: to.Ptr("Standard_MeteredData"), - Family: to.Ptr(armnetwork.ExpressRouteCircuitSKUFamilyMeteredData), - Tier: to.Ptr(armnetwork.ExpressRouteCircuitSKUTierStandard), - }, - }, nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - res, err := poller.PollUntilDone(ctx, nil) - if err != nil { - log.Fatalf("failed to pull the result: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.ExpressRouteCircuit = armnetwork.ExpressRouteCircuit{ - // Name: to.Ptr("circuitName"), - // Type: to.Ptr("Microsoft.Network/expressRouteCircuits"), - // ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/expressRouteCircuits/circuitName"), - // Location: to.Ptr("Brazil South"), - // Etag: to.Ptr("w/\\00000000-0000-0000-0000-000000000000\\"), - // Properties: &armnetwork.ExpressRouteCircuitPropertiesFormat{ - // AllowClassicOperations: to.Ptr(false), - // Authorizations: []*armnetwork.ExpressRouteCircuitAuthorization{ - // }, - // CircuitProvisioningState: to.Ptr("Enabled"), - // Peerings: []*armnetwork.ExpressRouteCircuitPeering{ - // }, - // ProvisioningState: to.Ptr(armnetwork.ProvisioningStateSucceeded), - // ServiceKey: to.Ptr("a1410692-0000-4ceb-b94a-b90b94d398d1"), - // ServiceProviderProperties: &armnetwork.ExpressRouteCircuitServiceProviderProperties{ - // BandwidthInMbps: to.Ptr[int32](200), - // PeeringLocation: to.Ptr("Silicon Valley"), - // ServiceProviderName: to.Ptr("Equinix"), - // }, - // ServiceProviderProvisioningState: to.Ptr(armnetwork.ServiceProviderProvisioningStateNotProvisioned), - // }, - // SKU: &armnetwork.ExpressRouteCircuitSKU{ - // Name: to.Ptr("Standard_MeteredData"), - // Family: to.Ptr(armnetwork.ExpressRouteCircuitSKUFamilyMeteredData), - // Tier: to.Ptr(armnetwork.ExpressRouteCircuitSKUTierStandard), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/4883fa5dbf6f2c9093fac8ce334547e9dfac68fa/specification/network/resource-manager/Microsoft.Network/stable/2024-03-01/examples/ExpressRouteCircuitCreateOnExpressRoutePort.json -func ExampleExpressRouteCircuitsClient_BeginCreateOrUpdate_createExpressRouteCircuitOnExpressRoutePort() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armnetwork.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewExpressRouteCircuitsClient().BeginCreateOrUpdate(ctx, "rg1", "expressRouteCircuit1", armnetwork.ExpressRouteCircuit{ - Location: to.Ptr("westus"), - Properties: &armnetwork.ExpressRouteCircuitPropertiesFormat{ - AuthorizationKey: to.Ptr("b0be57f5-1fba-463b-adec-ffe767354cdd"), - BandwidthInGbps: to.Ptr[float32](10), - EnableDirectPortRateLimit: to.Ptr(false), - ExpressRoutePort: &armnetwork.SubResource{ - ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/expressRoutePorts/portName"), - }, - }, - SKU: &armnetwork.ExpressRouteCircuitSKU{ - Name: to.Ptr("Premium_MeteredData"), - Family: to.Ptr(armnetwork.ExpressRouteCircuitSKUFamilyMeteredData), - Tier: to.Ptr(armnetwork.ExpressRouteCircuitSKUTierPremium), - }, - }, nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - res, err := poller.PollUntilDone(ctx, nil) - if err != nil { - log.Fatalf("failed to pull the result: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.ExpressRouteCircuit = armnetwork.ExpressRouteCircuit{ - // Name: to.Ptr("expressRouteCircuit1"), - // Type: to.Ptr("Microsoft.Network/expressRouteCircuits"), - // ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/expressRouteCircuits/expressRouteCircuit1"), - // Location: to.Ptr("westus"), - // Properties: &armnetwork.ExpressRouteCircuitPropertiesFormat{ - // AllowClassicOperations: to.Ptr(false), - // AuthorizationKey: to.Ptr("b0be57f5-1fba-463b-adec-ffe767354cdd"), - // AuthorizationStatus: to.Ptr("Enabled"), - // Authorizations: []*armnetwork.ExpressRouteCircuitAuthorization{ - // }, - // BandwidthInGbps: to.Ptr[float32](10), - // CircuitProvisioningState: to.Ptr("Enabled"), - // EnableDirectPortRateLimit: to.Ptr(false), - // ExpressRoutePort: &armnetwork.SubResource{ - // ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/expressRoutePorts/portName"), - // }, - // GatewayManagerEtag: to.Ptr("20"), - // Peerings: []*armnetwork.ExpressRouteCircuitPeering{ - // }, - // ProvisioningState: to.Ptr(armnetwork.ProvisioningStateSucceeded), - // ServiceKey: to.Ptr("d281f746-ee01-4d00-8b0a-edec4833772b"), - // ServiceProviderProvisioningState: to.Ptr(armnetwork.ServiceProviderProvisioningStateProvisioned), - // }, - // SKU: &armnetwork.ExpressRouteCircuitSKU{ - // Name: to.Ptr("Premium_MeteredData"), - // Family: to.Ptr(armnetwork.ExpressRouteCircuitSKUFamilyMeteredData), - // Tier: to.Ptr(armnetwork.ExpressRouteCircuitSKUTierPremium), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/4883fa5dbf6f2c9093fac8ce334547e9dfac68fa/specification/network/resource-manager/Microsoft.Network/stable/2024-03-01/examples/ExpressRouteCircuitUpdateTags.json -func ExampleExpressRouteCircuitsClient_UpdateTags() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armnetwork.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewExpressRouteCircuitsClient().UpdateTags(ctx, "ertest", "er1", armnetwork.TagsObject{ - Tags: map[string]*string{ - "tag1": to.Ptr("value1"), - "tag2": to.Ptr("value2"), - }, - }, nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.ExpressRouteCircuit = armnetwork.ExpressRouteCircuit{ - // Name: to.Ptr("er1"), - // Type: to.Ptr("Microsoft.Network/expressRouteCircuits"), - // ID: to.Ptr("/subscriptions/subid/resourceGroups/ertest/providers/Microsoft.Network/expressRouteCircuits/er1"), - // Location: to.Ptr("brazilsouth"), - // Tags: map[string]*string{ - // "tag1": to.Ptr("value1"), - // "tag2": to.Ptr("value2"), - // }, - // Properties: &armnetwork.ExpressRouteCircuitPropertiesFormat{ - // AllowClassicOperations: to.Ptr(false), - // Authorizations: []*armnetwork.ExpressRouteCircuitAuthorization{ - // }, - // CircuitProvisioningState: to.Ptr("Enabled"), - // GatewayManagerEtag: to.Ptr(""), - // Peerings: []*armnetwork.ExpressRouteCircuitPeering{ - // }, - // ProvisioningState: to.Ptr(armnetwork.ProvisioningStateSucceeded), - // ServiceKey: to.Ptr("0b392c2e-1e9d-46d7-b5e0-9ce90ca6b60c"), - // ServiceProviderProperties: &armnetwork.ExpressRouteCircuitServiceProviderProperties{ - // BandwidthInMbps: to.Ptr[int32](1000), - // PeeringLocation: to.Ptr("Silicon Valley"), - // ServiceProviderName: to.Ptr("Equinix"), - // }, - // ServiceProviderProvisioningState: to.Ptr(armnetwork.ServiceProviderProvisioningStateNotProvisioned), - // }, - // SKU: &armnetwork.ExpressRouteCircuitSKU{ - // Name: to.Ptr("Standard_MeteredData"), - // Family: to.Ptr(armnetwork.ExpressRouteCircuitSKUFamilyMeteredData), - // Tier: to.Ptr(armnetwork.ExpressRouteCircuitSKUTierStandard), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/4883fa5dbf6f2c9093fac8ce334547e9dfac68fa/specification/network/resource-manager/Microsoft.Network/stable/2024-03-01/examples/ExpressRouteCircuitARPTableList.json -func ExampleExpressRouteCircuitsClient_BeginListArpTable() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armnetwork.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewExpressRouteCircuitsClient().BeginListArpTable(ctx, "rg1", "circuitName", "peeringName", "devicePath", nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - res, err := poller.PollUntilDone(ctx, nil) - if err != nil { - log.Fatalf("failed to pull the result: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.ExpressRouteCircuitsArpTableListResult = armnetwork.ExpressRouteCircuitsArpTableListResult{ - // Value: []*armnetwork.ExpressRouteCircuitArpTable{ - // { - // Age: to.Ptr[int32](0), - // Interface: to.Ptr("Microsoft"), - // IPAddress: to.Ptr("IPAddress"), - // MacAddress: to.Ptr("macAddress"), - // }}, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/4883fa5dbf6f2c9093fac8ce334547e9dfac68fa/specification/network/resource-manager/Microsoft.Network/stable/2024-03-01/examples/ExpressRouteCircuitRouteTableList.json -func ExampleExpressRouteCircuitsClient_BeginListRoutesTable() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armnetwork.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewExpressRouteCircuitsClient().BeginListRoutesTable(ctx, "rg1", "circuitName", "peeringName", "devicePath", nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - res, err := poller.PollUntilDone(ctx, nil) - if err != nil { - log.Fatalf("failed to pull the result: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.ExpressRouteCircuitsRoutesTableListResult = armnetwork.ExpressRouteCircuitsRoutesTableListResult{ - // Value: []*armnetwork.ExpressRouteCircuitRoutesTable{ - // { - // Path: to.Ptr(""), - // LocPrf: to.Ptr(""), - // Network: to.Ptr(""), - // NextHop: to.Ptr(""), - // Weight: to.Ptr[int32](0), - // }}, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/4883fa5dbf6f2c9093fac8ce334547e9dfac68fa/specification/network/resource-manager/Microsoft.Network/stable/2024-03-01/examples/ExpressRouteCircuitRouteTableSummaryList.json -func ExampleExpressRouteCircuitsClient_BeginListRoutesTableSummary() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armnetwork.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewExpressRouteCircuitsClient().BeginListRoutesTableSummary(ctx, "rg1", "circuitName", "peeringName", "devicePath", nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - res, err := poller.PollUntilDone(ctx, nil) - if err != nil { - log.Fatalf("failed to pull the result: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.ExpressRouteCircuitsRoutesTableSummaryListResult = armnetwork.ExpressRouteCircuitsRoutesTableSummaryListResult{ - // Value: []*armnetwork.ExpressRouteCircuitRoutesTableSummary{ - // { - // As: to.Ptr[int32](9583), - // Neighbor: to.Ptr("100.65.171.1"), - // StatePfxRcd: to.Ptr("Idle"), - // UpDown: to.Ptr("never"), - // V: to.Ptr[int32](4), - // }}, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/4883fa5dbf6f2c9093fac8ce334547e9dfac68fa/specification/network/resource-manager/Microsoft.Network/stable/2024-03-01/examples/ExpressRouteCircuitStats.json -func ExampleExpressRouteCircuitsClient_GetStats() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armnetwork.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewExpressRouteCircuitsClient().GetStats(ctx, "rg1", "circuitName", nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.ExpressRouteCircuitStats = armnetwork.ExpressRouteCircuitStats{ - // PrimarybytesIn: to.Ptr[int64](537408), - // PrimarybytesOut: to.Ptr[int64](44032550), - // SecondarybytesIn: to.Ptr[int64](0), - // SecondarybytesOut: to.Ptr[int64](39002500), - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/4883fa5dbf6f2c9093fac8ce334547e9dfac68fa/specification/network/resource-manager/Microsoft.Network/stable/2024-03-01/examples/ExpressRouteCircuitPeeringStats.json -func ExampleExpressRouteCircuitsClient_GetPeeringStats() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armnetwork.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewExpressRouteCircuitsClient().GetPeeringStats(ctx, "rg1", "circuitName", "peeringName", nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.ExpressRouteCircuitStats = armnetwork.ExpressRouteCircuitStats{ - // PrimarybytesIn: to.Ptr[int64](537408), - // PrimarybytesOut: to.Ptr[int64](44032550), - // SecondarybytesIn: to.Ptr[int64](0), - // SecondarybytesOut: to.Ptr[int64](39002500), - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/4883fa5dbf6f2c9093fac8ce334547e9dfac68fa/specification/network/resource-manager/Microsoft.Network/stable/2024-03-01/examples/ExpressRouteCircuitListByResourceGroup.json -func ExampleExpressRouteCircuitsClient_NewListPager() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armnetwork.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := clientFactory.NewExpressRouteCircuitsClient().NewListPager("rg1", nil) - for pager.More() { - page, err := pager.NextPage(ctx) - if err != nil { - log.Fatalf("failed to advance page: %v", err) - } - for _, v := range page.Value { - // You could use page here. We use blank identifier for just demo purposes. - _ = v - } - // If the HTTP response code is 200 as defined in example definition, your page structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // page.ExpressRouteCircuitListResult = armnetwork.ExpressRouteCircuitListResult{ - // Value: []*armnetwork.ExpressRouteCircuit{ - // { - // Name: to.Ptr("circuitName1"), - // Type: to.Ptr("Microsoft.Network/expressRouteCircuits"), - // ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/expressRouteCircuits/circuitName1"), - // Location: to.Ptr("westus"), - // Etag: to.Ptr("W/\"832b28c3-f5fd-4d2a-a2cb-6e4a2fe452b3\""), - // Properties: &armnetwork.ExpressRouteCircuitPropertiesFormat{ - // AllowClassicOperations: to.Ptr(false), - // Authorizations: []*armnetwork.ExpressRouteCircuitAuthorization{ - // { - // ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/expressRouteCircuits/circuitName/authorizations/MyAuthorization1"), - // Name: to.Ptr("MyAuthorization1"), - // Etag: to.Ptr("W/\"832b28c3-f5fd-4d2a-a2cb-6e4a2fe452b3\""), - // Properties: &armnetwork.AuthorizationPropertiesFormat{ - // AuthorizationKey: to.Ptr("authkey"), - // AuthorizationUseStatus: to.Ptr(armnetwork.AuthorizationUseStatusAvailable), - // ProvisioningState: to.Ptr(armnetwork.ProvisioningStateSucceeded), - // }, - // }}, - // CircuitProvisioningState: to.Ptr("Enabled"), - // GatewayManagerEtag: to.Ptr("113"), - // Peerings: []*armnetwork.ExpressRouteCircuitPeering{ - // }, - // ProvisioningState: to.Ptr(armnetwork.ProvisioningStateSucceeded), - // ServiceKey: to.Ptr("a1410692-ed3b-4ceb-b94a-b90b95d398d1"), - // ServiceProviderProperties: &armnetwork.ExpressRouteCircuitServiceProviderProperties{ - // BandwidthInMbps: to.Ptr[int32](200), - // PeeringLocation: to.Ptr("peeringLocation"), - // ServiceProviderName: to.Ptr("providerName"), - // }, - // ServiceProviderProvisioningState: to.Ptr(armnetwork.ServiceProviderProvisioningStateProvisioned), - // }, - // SKU: &armnetwork.ExpressRouteCircuitSKU{ - // Name: to.Ptr("Standard_MeteredData"), - // Family: to.Ptr(armnetwork.ExpressRouteCircuitSKUFamilyMeteredData), - // Tier: to.Ptr(armnetwork.ExpressRouteCircuitSKUTierStandard), - // }, - // }, - // { - // Name: to.Ptr("circuitName2"), - // Type: to.Ptr("Microsoft.Network/expressRouteCircuits"), - // ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/expressRouteCircuits/circuitName2"), - // Location: to.Ptr("westus"), - // Etag: to.Ptr("W/\"e33c875f-48df-4a91-b7d3-eb95b5ddbb89\""), - // Properties: &armnetwork.ExpressRouteCircuitPropertiesFormat{ - // AllowClassicOperations: to.Ptr(false), - // Authorizations: []*armnetwork.ExpressRouteCircuitAuthorization{ - // { - // ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/expressRouteCircuits/circuitName2/authorizations/MyAuthorization2"), - // Name: to.Ptr("MyAuthorization2"), - // Etag: to.Ptr("W/\"e33c875f-48df-4a91-b7d3-eb95b5ddbb89\""), - // Properties: &armnetwork.AuthorizationPropertiesFormat{ - // AuthorizationKey: to.Ptr("authkey"), - // AuthorizationUseStatus: to.Ptr(armnetwork.AuthorizationUseStatusAvailable), - // ProvisioningState: to.Ptr(armnetwork.ProvisioningStateSucceeded), - // }, - // }}, - // CircuitProvisioningState: to.Ptr("Enabled"), - // GatewayManagerEtag: to.Ptr(""), - // Peerings: []*armnetwork.ExpressRouteCircuitPeering{ - // }, - // ProvisioningState: to.Ptr(armnetwork.ProvisioningStateSucceeded), - // ServiceKey: to.Ptr("6569625a-9ba4-498b-9719-14d778eef609"), - // ServiceProviderProperties: &armnetwork.ExpressRouteCircuitServiceProviderProperties{ - // BandwidthInMbps: to.Ptr[int32](200), - // PeeringLocation: to.Ptr("peeringLocation"), - // ServiceProviderName: to.Ptr("providerName"), - // }, - // ServiceProviderProvisioningState: to.Ptr(armnetwork.ServiceProviderProvisioningStateNotProvisioned), - // }, - // SKU: &armnetwork.ExpressRouteCircuitSKU{ - // Name: to.Ptr("Standard_MeteredData"), - // Family: to.Ptr(armnetwork.ExpressRouteCircuitSKUFamilyMeteredData), - // Tier: to.Ptr(armnetwork.ExpressRouteCircuitSKUTierStandard), - // }, - // }}, - // } - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/4883fa5dbf6f2c9093fac8ce334547e9dfac68fa/specification/network/resource-manager/Microsoft.Network/stable/2024-03-01/examples/ExpressRouteCircuitListBySubscription.json -func ExampleExpressRouteCircuitsClient_NewListAllPager() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armnetwork.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := clientFactory.NewExpressRouteCircuitsClient().NewListAllPager(nil) - for pager.More() { - page, err := pager.NextPage(ctx) - if err != nil { - log.Fatalf("failed to advance page: %v", err) - } - for _, v := range page.Value { - // You could use page here. We use blank identifier for just demo purposes. - _ = v - } - // If the HTTP response code is 200 as defined in example definition, your page structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // page.ExpressRouteCircuitListResult = armnetwork.ExpressRouteCircuitListResult{ - // Value: []*armnetwork.ExpressRouteCircuit{ - // { - // Name: to.Ptr("circuitName1"), - // Type: to.Ptr("Microsoft.Network/expressRouteCircuits"), - // ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/expressRouteCircuits/circuitName1"), - // Location: to.Ptr("westus"), - // Etag: to.Ptr("W/\"832b28c3-f5fd-4d2a-a2cb-6e4a2fe452b3\""), - // Properties: &armnetwork.ExpressRouteCircuitPropertiesFormat{ - // AllowClassicOperations: to.Ptr(false), - // Authorizations: []*armnetwork.ExpressRouteCircuitAuthorization{ - // { - // ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/expressRouteCircuits/circuitName/authorizations/MyAuthorization1"), - // Name: to.Ptr("MyAuthorization1"), - // Etag: to.Ptr("W/\"832b28c3-f5fd-4d2a-a2cb-6e4a2fe452b3\""), - // Properties: &armnetwork.AuthorizationPropertiesFormat{ - // AuthorizationKey: to.Ptr("authkey"), - // AuthorizationUseStatus: to.Ptr(armnetwork.AuthorizationUseStatusAvailable), - // ProvisioningState: to.Ptr(armnetwork.ProvisioningStateSucceeded), - // }, - // }}, - // CircuitProvisioningState: to.Ptr("Enabled"), - // GatewayManagerEtag: to.Ptr("113"), - // Peerings: []*armnetwork.ExpressRouteCircuitPeering{ - // }, - // ProvisioningState: to.Ptr(armnetwork.ProvisioningStateSucceeded), - // ServiceKey: to.Ptr("a1410692-ed3b-4ceb-b94a-b90b95d398d1"), - // ServiceProviderProperties: &armnetwork.ExpressRouteCircuitServiceProviderProperties{ - // BandwidthInMbps: to.Ptr[int32](200), - // PeeringLocation: to.Ptr("peeringLocation"), - // ServiceProviderName: to.Ptr("providerName"), - // }, - // ServiceProviderProvisioningState: to.Ptr(armnetwork.ServiceProviderProvisioningStateProvisioned), - // }, - // SKU: &armnetwork.ExpressRouteCircuitSKU{ - // Name: to.Ptr("Standard_MeteredData"), - // Family: to.Ptr(armnetwork.ExpressRouteCircuitSKUFamilyMeteredData), - // Tier: to.Ptr(armnetwork.ExpressRouteCircuitSKUTierStandard), - // }, - // }, - // { - // Name: to.Ptr("circuitName2"), - // Type: to.Ptr("Microsoft.Network/expressRouteCircuits"), - // ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/expressRouteCircuits/circuitName2"), - // Location: to.Ptr("westus"), - // Etag: to.Ptr("W/\"e33c875f-48df-4a91-b7d3-eb95b5ddbb89\""), - // Properties: &armnetwork.ExpressRouteCircuitPropertiesFormat{ - // AllowClassicOperations: to.Ptr(false), - // Authorizations: []*armnetwork.ExpressRouteCircuitAuthorization{ - // { - // ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/expressRouteCircuits/circuitName2/authorizations/MyAuthorization2"), - // Name: to.Ptr("MyAuthorization2"), - // Etag: to.Ptr("W/\"e33c875f-48df-4a91-b7d3-eb95b5ddbb89\""), - // Properties: &armnetwork.AuthorizationPropertiesFormat{ - // AuthorizationKey: to.Ptr("authkey"), - // AuthorizationUseStatus: to.Ptr(armnetwork.AuthorizationUseStatusAvailable), - // ProvisioningState: to.Ptr(armnetwork.ProvisioningStateSucceeded), - // }, - // }}, - // CircuitProvisioningState: to.Ptr("Enabled"), - // GatewayManagerEtag: to.Ptr(""), - // Peerings: []*armnetwork.ExpressRouteCircuitPeering{ - // }, - // ProvisioningState: to.Ptr(armnetwork.ProvisioningStateSucceeded), - // ServiceKey: to.Ptr("6569625a-9ba4-498b-9719-14d778eef609"), - // ServiceProviderProperties: &armnetwork.ExpressRouteCircuitServiceProviderProperties{ - // BandwidthInMbps: to.Ptr[int32](200), - // PeeringLocation: to.Ptr("peeringLocation"), - // ServiceProviderName: to.Ptr("providerName"), - // }, - // ServiceProviderProvisioningState: to.Ptr(armnetwork.ServiceProviderProvisioningStateNotProvisioned), - // }, - // SKU: &armnetwork.ExpressRouteCircuitSKU{ - // Name: to.Ptr("Standard_MeteredData"), - // Family: to.Ptr(armnetwork.ExpressRouteCircuitSKUFamilyMeteredData), - // Tier: to.Ptr(armnetwork.ExpressRouteCircuitSKUTierStandard), - // }, - // }}, - // } - } -} diff --git a/sdk/resourcemanager/network/armnetwork/expressrouteconnections_client_example_test.go b/sdk/resourcemanager/network/armnetwork/expressrouteconnections_client_example_test.go deleted file mode 100644 index 8a30e160c33e..000000000000 --- a/sdk/resourcemanager/network/armnetwork/expressrouteconnections_client_example_test.go +++ /dev/null @@ -1,266 +0,0 @@ -//go:build go1.18 -// +build go1.18 - -// 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. -// DO NOT EDIT. - -package armnetwork_test - -import ( - "context" - "log" - - "github.com/Azure/azure-sdk-for-go/sdk/azcore/to" - "github.com/Azure/azure-sdk-for-go/sdk/azidentity" - "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/network/armnetwork/v6" -) - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/4883fa5dbf6f2c9093fac8ce334547e9dfac68fa/specification/network/resource-manager/Microsoft.Network/stable/2024-03-01/examples/ExpressRouteConnectionCreate.json -func ExampleExpressRouteConnectionsClient_BeginCreateOrUpdate() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armnetwork.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewExpressRouteConnectionsClient().BeginCreateOrUpdate(ctx, "resourceGroupName", "gateway-2", "connectionName", armnetwork.ExpressRouteConnection{ - ID: to.Ptr("/subscriptions/subid/resourceGroups/resourceGroupName/providers/Microsoft.Network/expressRouteGateways/gateway-2/expressRouteConnections/connectionName"), - Name: to.Ptr("connectionName"), - Properties: &armnetwork.ExpressRouteConnectionProperties{ - AuthorizationKey: to.Ptr("authorizationKey"), - ExpressRouteCircuitPeering: &armnetwork.ExpressRouteCircuitPeeringID{ - ID: to.Ptr("/subscriptions/subid/resourceGroups/resourceGroupName/providers/Microsoft.Network/expressRouteCircuits/circuitName/peerings/AzurePrivatePeering"), - }, - RoutingConfiguration: &armnetwork.RoutingConfiguration{ - AssociatedRouteTable: &armnetwork.SubResource{ - ID: to.Ptr("/subscriptions/subid/resourceGroups/resourceGroupName/providers/Microsoft.Network/virtualHubs/hub1/hubRouteTables/hubRouteTable1"), - }, - InboundRouteMap: &armnetwork.SubResource{ - ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/virtualHubs/virtualHub1/routeMaps/routeMap1"), - }, - OutboundRouteMap: &armnetwork.SubResource{ - ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/virtualHubs/virtualHub1/routeMaps/routeMap2"), - }, - PropagatedRouteTables: &armnetwork.PropagatedRouteTable{ - IDs: []*armnetwork.SubResource{ - { - ID: to.Ptr("/subscriptions/subid/resourceGroups/resourceGroupName/providers/Microsoft.Network/virtualHubs/hub1/hubRouteTables/hubRouteTable1"), - }, - { - ID: to.Ptr("/subscriptions/subid/resourceGroups/resourceGroupName/providers/Microsoft.Network/virtualHubs/hub1/hubRouteTables/hubRouteTable2"), - }, - { - ID: to.Ptr("/subscriptions/subid/resourceGroups/resourceGroupName/providers/Microsoft.Network/virtualHubs/hub1/hubRouteTables/hubRouteTable3"), - }}, - Labels: []*string{ - to.Ptr("label1"), - to.Ptr("label2")}, - }, - }, - RoutingWeight: to.Ptr[int32](2), - }, - }, nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - res, err := poller.PollUntilDone(ctx, nil) - if err != nil { - log.Fatalf("failed to pull the result: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.ExpressRouteConnection = armnetwork.ExpressRouteConnection{ - // ID: to.Ptr("/subscriptions/subid/resourceGroups/resourceGroupName/providers/Microsoft.Network/expressRouteGateways/gateway-2/expressRouteConnections/connectionName"), - // Name: to.Ptr("connectionName"), - // Properties: &armnetwork.ExpressRouteConnectionProperties{ - // AuthorizationKey: to.Ptr("authorizationKey"), - // EnableInternetSecurity: to.Ptr(false), - // EnablePrivateLinkFastPath: to.Ptr(false), - // ExpressRouteCircuitPeering: &armnetwork.ExpressRouteCircuitPeeringID{ - // ID: to.Ptr("/subscriptions/subid/resourceGroups/resourceGroupName/providers/Microsoft.Network/expressRouteCircuits/circuitName/peerings/AzurePrivatePeering"), - // }, - // ExpressRouteGatewayBypass: to.Ptr(false), - // ProvisioningState: to.Ptr(armnetwork.ProvisioningStateSucceeded), - // RoutingConfiguration: &armnetwork.RoutingConfiguration{ - // AssociatedRouteTable: &armnetwork.SubResource{ - // ID: to.Ptr("/subscriptions/subid/resourceGroups/resourceGroupName/providers/Microsoft.Network/virtualHubs/hub1/hubRouteTables/hubRouteTable1"), - // }, - // InboundRouteMap: &armnetwork.SubResource{ - // ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/virtualHubs/virtualHub1/routeMaps/routeMap1"), - // }, - // OutboundRouteMap: &armnetwork.SubResource{ - // ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/virtualHubs/virtualHub1/routeMaps/routeMap2"), - // }, - // PropagatedRouteTables: &armnetwork.PropagatedRouteTable{ - // IDs: []*armnetwork.SubResource{ - // { - // ID: to.Ptr("/subscriptions/subid/resourceGroups/resourceGroupName/providers/Microsoft.Network/virtualHubs/hub1/hubRouteTables/hubRouteTable1"), - // }, - // { - // ID: to.Ptr("/subscriptions/subid/resourceGroups/resourceGroupName/providers/Microsoft.Network/virtualHubs/hub1/hubRouteTables/hubRouteTable2"), - // }, - // { - // ID: to.Ptr("/subscriptions/subid/resourceGroups/resourceGroupName/providers/Microsoft.Network/virtualHubs/hub1/hubRouteTables/hubRouteTable3"), - // }}, - // Labels: []*string{ - // to.Ptr("label1"), - // to.Ptr("label2")}, - // }, - // }, - // RoutingWeight: to.Ptr[int32](2), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/4883fa5dbf6f2c9093fac8ce334547e9dfac68fa/specification/network/resource-manager/Microsoft.Network/stable/2024-03-01/examples/ExpressRouteConnectionGet.json -func ExampleExpressRouteConnectionsClient_Get() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armnetwork.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewExpressRouteConnectionsClient().Get(ctx, "resourceGroupName", "expressRouteGatewayName", "connectionName", nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.ExpressRouteConnection = armnetwork.ExpressRouteConnection{ - // ID: to.Ptr("/subscriptions/subid/resourceGroups/resourceGroupName/providers/Microsoft.Network/expressRouteGateways/expressRouteGatewayName/expressRouteConnections/connectionName"), - // Name: to.Ptr("connectionName"), - // Properties: &armnetwork.ExpressRouteConnectionProperties{ - // AuthorizationKey: to.Ptr("authorizationKey"), - // EnableInternetSecurity: to.Ptr(false), - // EnablePrivateLinkFastPath: to.Ptr(false), - // ExpressRouteCircuitPeering: &armnetwork.ExpressRouteCircuitPeeringID{ - // ID: to.Ptr("/subscriptions/subid/resourceGroups/resourceGroupName/providers/Microsoft.Network/expressRouteCircuits/circuitName/peerings/AzurePrivatePeering"), - // }, - // ExpressRouteGatewayBypass: to.Ptr(false), - // ProvisioningState: to.Ptr(armnetwork.ProvisioningStateSucceeded), - // RoutingConfiguration: &armnetwork.RoutingConfiguration{ - // AssociatedRouteTable: &armnetwork.SubResource{ - // ID: to.Ptr("/subscriptions/subid/resourceGroups/resourceGroupName/providers/Microsoft.Network/virtualHubs/hub1/hubRouteTables/hubRouteTable1"), - // }, - // InboundRouteMap: &armnetwork.SubResource{ - // ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/virtualHubs/virtualHub1/routeMaps/routeMap1"), - // }, - // OutboundRouteMap: &armnetwork.SubResource{ - // ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/virtualHubs/virtualHub1/routeMaps/routeMap2"), - // }, - // PropagatedRouteTables: &armnetwork.PropagatedRouteTable{ - // IDs: []*armnetwork.SubResource{ - // { - // ID: to.Ptr("/subscriptions/subid/resourceGroups/resourceGroupName/providers/Microsoft.Network/virtualHubs/hub1/hubRouteTables/hubRouteTable1"), - // }, - // { - // ID: to.Ptr("/subscriptions/subid/resourceGroups/resourceGroupName/providers/Microsoft.Network/virtualHubs/hub1/hubRouteTables/hubRouteTable2"), - // }, - // { - // ID: to.Ptr("/subscriptions/subid/resourceGroups/resourceGroupName/providers/Microsoft.Network/virtualHubs/hub1/hubRouteTables/hubRouteTable3"), - // }}, - // Labels: []*string{ - // to.Ptr("label1"), - // to.Ptr("label2")}, - // }, - // }, - // RoutingWeight: to.Ptr[int32](1), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/4883fa5dbf6f2c9093fac8ce334547e9dfac68fa/specification/network/resource-manager/Microsoft.Network/stable/2024-03-01/examples/ExpressRouteConnectionDelete.json -func ExampleExpressRouteConnectionsClient_BeginDelete() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armnetwork.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewExpressRouteConnectionsClient().BeginDelete(ctx, "resourceGroupName", "expressRouteGatewayName", "connectionName", nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - _, err = poller.PollUntilDone(ctx, nil) - if err != nil { - log.Fatalf("failed to pull the result: %v", err) - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/4883fa5dbf6f2c9093fac8ce334547e9dfac68fa/specification/network/resource-manager/Microsoft.Network/stable/2024-03-01/examples/ExpressRouteConnectionList.json -func ExampleExpressRouteConnectionsClient_List() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armnetwork.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewExpressRouteConnectionsClient().List(ctx, "resourceGroupName", "expressRouteGatewayName", nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.ExpressRouteConnectionList = armnetwork.ExpressRouteConnectionList{ - // Value: []*armnetwork.ExpressRouteConnection{ - // { - // ID: to.Ptr("/subscriptions/subid/resourceGroups/resourceGroupName/providers/Microsoft.Network/expressRouteGateways/expressRouteGatewayName/expressRouteConnections/connectionName"), - // Name: to.Ptr("connectionName"), - // Properties: &armnetwork.ExpressRouteConnectionProperties{ - // AuthorizationKey: to.Ptr("authorizationKey"), - // EnableInternetSecurity: to.Ptr(false), - // EnablePrivateLinkFastPath: to.Ptr(false), - // ExpressRouteCircuitPeering: &armnetwork.ExpressRouteCircuitPeeringID{ - // ID: to.Ptr("/subscriptions/subid/resourceGroups/resourceGroupName/providers/Microsoft.Network/expressRouteCircuits/circuitName/peerings/AzurePrivatePeering"), - // }, - // ExpressRouteGatewayBypass: to.Ptr(false), - // ProvisioningState: to.Ptr(armnetwork.ProvisioningStateSucceeded), - // RoutingConfiguration: &armnetwork.RoutingConfiguration{ - // AssociatedRouteTable: &armnetwork.SubResource{ - // ID: to.Ptr("/subscriptions/subid/resourceGroups/resourceGroupName/providers/Microsoft.Network/virtualHubs/hub1/hubRouteTables/hubRouteTable1"), - // }, - // InboundRouteMap: &armnetwork.SubResource{ - // ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/virtualHubs/virtualHub1/routeMaps/routeMap1"), - // }, - // OutboundRouteMap: &armnetwork.SubResource{ - // ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/virtualHubs/virtualHub1/routeMaps/routeMap2"), - // }, - // PropagatedRouteTables: &armnetwork.PropagatedRouteTable{ - // IDs: []*armnetwork.SubResource{ - // { - // ID: to.Ptr("/subscriptions/subid/resourceGroups/resourceGroupName/providers/Microsoft.Network/virtualHubs/hub1/hubRouteTables/hubRouteTable1"), - // }, - // { - // ID: to.Ptr("/subscriptions/subid/resourceGroups/resourceGroupName/providers/Microsoft.Network/virtualHubs/hub1/hubRouteTables/hubRouteTable2"), - // }, - // { - // ID: to.Ptr("/subscriptions/subid/resourceGroups/resourceGroupName/providers/Microsoft.Network/virtualHubs/hub1/hubRouteTables/hubRouteTable3"), - // }}, - // Labels: []*string{ - // to.Ptr("label1"), - // to.Ptr("label2")}, - // }, - // }, - // RoutingWeight: to.Ptr[int32](1), - // }, - // }}, - // } -} diff --git a/sdk/resourcemanager/network/armnetwork/expressroutecrossconnectionpeerings_client_example_test.go b/sdk/resourcemanager/network/armnetwork/expressroutecrossconnectionpeerings_client_example_test.go deleted file mode 100644 index ec032d01f35a..000000000000 --- a/sdk/resourcemanager/network/armnetwork/expressroutecrossconnectionpeerings_client_example_test.go +++ /dev/null @@ -1,195 +0,0 @@ -//go:build go1.18 -// +build go1.18 - -// 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. -// DO NOT EDIT. - -package armnetwork_test - -import ( - "context" - "log" - - "github.com/Azure/azure-sdk-for-go/sdk/azcore/to" - "github.com/Azure/azure-sdk-for-go/sdk/azidentity" - "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/network/armnetwork/v6" -) - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/4883fa5dbf6f2c9093fac8ce334547e9dfac68fa/specification/network/resource-manager/Microsoft.Network/stable/2024-03-01/examples/ExpressRouteCrossConnectionBgpPeeringList.json -func ExampleExpressRouteCrossConnectionPeeringsClient_NewListPager() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armnetwork.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := clientFactory.NewExpressRouteCrossConnectionPeeringsClient().NewListPager("CrossConnection-SiliconValley", "", nil) - for pager.More() { - page, err := pager.NextPage(ctx) - if err != nil { - log.Fatalf("failed to advance page: %v", err) - } - for _, v := range page.Value { - // You could use page here. We use blank identifier for just demo purposes. - _ = v - } - // If the HTTP response code is 200 as defined in example definition, your page structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // page.ExpressRouteCrossConnectionPeeringList = armnetwork.ExpressRouteCrossConnectionPeeringList{ - // Value: []*armnetwork.ExpressRouteCrossConnectionPeering{ - // { - // ID: to.Ptr("/subscriptions/subid/resourceGroups/CrossConnection-SiliconValley/providers/Microsoft.Network/expressRouteCrossConnections//peerings/AzurePrivatePeering"), - // Name: to.Ptr("AzurePrivatePeering"), - // Etag: to.Ptr("W/\"72090554-7e3b-43f2-80ad-99a9020dcb11\""), - // Properties: &armnetwork.ExpressRouteCrossConnectionPeeringProperties{ - // AzureASN: to.Ptr[int32](12076), - // GatewayManagerEtag: to.Ptr(""), - // IPv6PeeringConfig: &armnetwork.IPv6ExpressRouteCircuitPeeringConfig{ - // PrimaryPeerAddressPrefix: to.Ptr("3FFE:FFFF:0:CD30::/126"), - // SecondaryPeerAddressPrefix: to.Ptr("3FFE:FFFF:0:CD30::4/126"), - // State: to.Ptr(armnetwork.ExpressRouteCircuitPeeringStateEnabled), - // }, - // LastModifiedBy: to.Ptr("Customer"), - // PeerASN: to.Ptr[int64](200), - // PeeringType: to.Ptr(armnetwork.ExpressRoutePeeringTypeAzurePrivatePeering), - // PrimaryAzurePort: to.Ptr(""), - // PrimaryPeerAddressPrefix: to.Ptr("192.168.16.252/30"), - // ProvisioningState: to.Ptr(armnetwork.ProvisioningStateSucceeded), - // SecondaryAzurePort: to.Ptr(""), - // SecondaryPeerAddressPrefix: to.Ptr("192.168.18.252/30"), - // State: to.Ptr(armnetwork.ExpressRoutePeeringStateEnabled), - // VlanID: to.Ptr[int32](200), - // }, - // }}, - // } - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/4883fa5dbf6f2c9093fac8ce334547e9dfac68fa/specification/network/resource-manager/Microsoft.Network/stable/2024-03-01/examples/ExpressRouteCrossConnectionBgpPeeringDelete.json -func ExampleExpressRouteCrossConnectionPeeringsClient_BeginDelete() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armnetwork.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewExpressRouteCrossConnectionPeeringsClient().BeginDelete(ctx, "CrossConnection-SiliconValley", "", "AzurePrivatePeering", nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - _, err = poller.PollUntilDone(ctx, nil) - if err != nil { - log.Fatalf("failed to pull the result: %v", err) - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/4883fa5dbf6f2c9093fac8ce334547e9dfac68fa/specification/network/resource-manager/Microsoft.Network/stable/2024-03-01/examples/ExpressRouteCrossConnectionBgpPeeringGet.json -func ExampleExpressRouteCrossConnectionPeeringsClient_Get() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armnetwork.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewExpressRouteCrossConnectionPeeringsClient().Get(ctx, "CrossConnection-SiliconValley", "", "AzurePrivatePeering", nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.ExpressRouteCrossConnectionPeering = armnetwork.ExpressRouteCrossConnectionPeering{ - // ID: to.Ptr("/subscriptions/subid/resourceGroups/CrossConnection-Boydton1DC/providers/Microsoft.Network/expressRouteCrossConnections//peerings/AzurePrivatePeering"), - // Name: to.Ptr("AzurePrivatePeering"), - // Etag: to.Ptr("W/\"72090554-7e3b-43f2-80ad-99a9020dcb11\""), - // Properties: &armnetwork.ExpressRouteCrossConnectionPeeringProperties{ - // AzureASN: to.Ptr[int32](12076), - // GatewayManagerEtag: to.Ptr(""), - // IPv6PeeringConfig: &armnetwork.IPv6ExpressRouteCircuitPeeringConfig{ - // PrimaryPeerAddressPrefix: to.Ptr("3FFE:FFFF:0:CD30::/126"), - // SecondaryPeerAddressPrefix: to.Ptr("3FFE:FFFF:0:CD30::4/126"), - // State: to.Ptr(armnetwork.ExpressRouteCircuitPeeringStateEnabled), - // }, - // LastModifiedBy: to.Ptr("Customer"), - // PeerASN: to.Ptr[int64](200), - // PeeringType: to.Ptr(armnetwork.ExpressRoutePeeringTypeAzurePrivatePeering), - // PrimaryAzurePort: to.Ptr(""), - // PrimaryPeerAddressPrefix: to.Ptr("192.168.16.252/30"), - // ProvisioningState: to.Ptr(armnetwork.ProvisioningStateSucceeded), - // SecondaryAzurePort: to.Ptr(""), - // SecondaryPeerAddressPrefix: to.Ptr("192.168.18.252/30"), - // State: to.Ptr(armnetwork.ExpressRoutePeeringStateEnabled), - // VlanID: to.Ptr[int32](200), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/4883fa5dbf6f2c9093fac8ce334547e9dfac68fa/specification/network/resource-manager/Microsoft.Network/stable/2024-03-01/examples/ExpressRouteCrossConnectionBgpPeeringCreate.json -func ExampleExpressRouteCrossConnectionPeeringsClient_BeginCreateOrUpdate() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armnetwork.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewExpressRouteCrossConnectionPeeringsClient().BeginCreateOrUpdate(ctx, "CrossConnection-SiliconValley", "", "AzurePrivatePeering", armnetwork.ExpressRouteCrossConnectionPeering{ - Properties: &armnetwork.ExpressRouteCrossConnectionPeeringProperties{ - IPv6PeeringConfig: &armnetwork.IPv6ExpressRouteCircuitPeeringConfig{ - PrimaryPeerAddressPrefix: to.Ptr("3FFE:FFFF:0:CD30::/126"), - SecondaryPeerAddressPrefix: to.Ptr("3FFE:FFFF:0:CD30::4/126"), - }, - PeerASN: to.Ptr[int64](200), - PrimaryPeerAddressPrefix: to.Ptr("192.168.16.252/30"), - SecondaryPeerAddressPrefix: to.Ptr("192.168.18.252/30"), - VlanID: to.Ptr[int32](200), - }, - }, nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - res, err := poller.PollUntilDone(ctx, nil) - if err != nil { - log.Fatalf("failed to pull the result: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.ExpressRouteCrossConnectionPeering = armnetwork.ExpressRouteCrossConnectionPeering{ - // ID: to.Ptr("/subscriptions/subid/resourceGroups/CrossConnection-Boydton1DC/providers/Microsoft.Network/expressRouteCrossConnections//peerings/AzurePrivatePeering"), - // Name: to.Ptr("AzurePrivatePeering"), - // Etag: to.Ptr("W/\"72090554-7e3b-43f2-80ad-99a9020dcb11\""), - // Properties: &armnetwork.ExpressRouteCrossConnectionPeeringProperties{ - // AzureASN: to.Ptr[int32](12076), - // GatewayManagerEtag: to.Ptr(""), - // IPv6PeeringConfig: &armnetwork.IPv6ExpressRouteCircuitPeeringConfig{ - // PrimaryPeerAddressPrefix: to.Ptr("3FFE:FFFF:0:CD30::/126"), - // SecondaryPeerAddressPrefix: to.Ptr("3FFE:FFFF:0:CD30::4/126"), - // State: to.Ptr(armnetwork.ExpressRouteCircuitPeeringStateEnabled), - // }, - // LastModifiedBy: to.Ptr("Customer"), - // PeerASN: to.Ptr[int64](200), - // PeeringType: to.Ptr(armnetwork.ExpressRoutePeeringTypeAzurePrivatePeering), - // PrimaryAzurePort: to.Ptr(""), - // PrimaryPeerAddressPrefix: to.Ptr("192.168.16.252/30"), - // ProvisioningState: to.Ptr(armnetwork.ProvisioningStateSucceeded), - // SecondaryAzurePort: to.Ptr(""), - // SecondaryPeerAddressPrefix: to.Ptr("192.168.18.252/30"), - // State: to.Ptr(armnetwork.ExpressRoutePeeringStateEnabled), - // VlanID: to.Ptr[int32](200), - // }, - // } -} diff --git a/sdk/resourcemanager/network/armnetwork/expressroutecrossconnections_client_example_test.go b/sdk/resourcemanager/network/armnetwork/expressroutecrossconnections_client_example_test.go deleted file mode 100644 index c47ce42d712a..000000000000 --- a/sdk/resourcemanager/network/armnetwork/expressroutecrossconnections_client_example_test.go +++ /dev/null @@ -1,366 +0,0 @@ -//go:build go1.18 -// +build go1.18 - -// 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. -// DO NOT EDIT. - -package armnetwork_test - -import ( - "context" - "log" - - "github.com/Azure/azure-sdk-for-go/sdk/azcore/to" - "github.com/Azure/azure-sdk-for-go/sdk/azidentity" - "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/network/armnetwork/v6" -) - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/4883fa5dbf6f2c9093fac8ce334547e9dfac68fa/specification/network/resource-manager/Microsoft.Network/stable/2024-03-01/examples/ExpressRouteCrossConnectionList.json -func ExampleExpressRouteCrossConnectionsClient_NewListPager() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armnetwork.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := clientFactory.NewExpressRouteCrossConnectionsClient().NewListPager(&armnetwork.ExpressRouteCrossConnectionsClientListOptions{Filter: nil}) - for pager.More() { - page, err := pager.NextPage(ctx) - if err != nil { - log.Fatalf("failed to advance page: %v", err) - } - for _, v := range page.Value { - // You could use page here. We use blank identifier for just demo purposes. - _ = v - } - // If the HTTP response code is 200 as defined in example definition, your page structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // page.ExpressRouteCrossConnectionListResult = armnetwork.ExpressRouteCrossConnectionListResult{ - // Value: []*armnetwork.ExpressRouteCrossConnection{ - // { - // Name: to.Ptr(""), - // Type: to.Ptr("Microsoft.Network/expressRouteCrossConnections"), - // ID: to.Ptr("/subscriptions/subid/resourceGroups/CrossConnectionSiliconValley/providers/Microsoft.Network/expressRouteCrossConnections/"), - // Location: to.Ptr("brazilsouth"), - // Properties: &armnetwork.ExpressRouteCrossConnectionProperties{ - // BandwidthInMbps: to.Ptr[int32](1000), - // ExpressRouteCircuit: &armnetwork.ExpressRouteCircuitReference{ - // ID: to.Ptr("/subscriptions/subid/resourceGroups/ertest/providers/Microsoft.Network/expressRouteCircuits/er1"), - // }, - // PeeringLocation: to.Ptr("SiliconValley"), - // Peerings: []*armnetwork.ExpressRouteCrossConnectionPeering{ - // }, - // PrimaryAzurePort: to.Ptr("bvtazureixp01"), - // ProvisioningState: to.Ptr(armnetwork.ProvisioningStateSucceeded), - // STag: to.Ptr[int32](2), - // SecondaryAzurePort: to.Ptr("bvtazureixp01"), - // ServiceProviderProvisioningState: to.Ptr(armnetwork.ServiceProviderProvisioningStateNotProvisioned), - // }, - // }}, - // } - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/4883fa5dbf6f2c9093fac8ce334547e9dfac68fa/specification/network/resource-manager/Microsoft.Network/stable/2024-03-01/examples/ExpressRouteCrossConnectionListByResourceGroup.json -func ExampleExpressRouteCrossConnectionsClient_NewListByResourceGroupPager() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armnetwork.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := clientFactory.NewExpressRouteCrossConnectionsClient().NewListByResourceGroupPager("CrossConnection-SiliconValley", nil) - for pager.More() { - page, err := pager.NextPage(ctx) - if err != nil { - log.Fatalf("failed to advance page: %v", err) - } - for _, v := range page.Value { - // You could use page here. We use blank identifier for just demo purposes. - _ = v - } - // If the HTTP response code is 200 as defined in example definition, your page structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // page.ExpressRouteCrossConnectionListResult = armnetwork.ExpressRouteCrossConnectionListResult{ - // Value: []*armnetwork.ExpressRouteCrossConnection{ - // { - // Name: to.Ptr(""), - // Type: to.Ptr("Microsoft.Network/expressRouteCrossConnections"), - // ID: to.Ptr("/subscriptions/subid/resourceGroups/CrossConnectionSilicon-Valley/providers/Microsoft.Network/expressRouteCrossConnections/"), - // Location: to.Ptr("brazilsouth"), - // Properties: &armnetwork.ExpressRouteCrossConnectionProperties{ - // BandwidthInMbps: to.Ptr[int32](1000), - // ExpressRouteCircuit: &armnetwork.ExpressRouteCircuitReference{ - // ID: to.Ptr("/subscriptions/subid/resourceGroups/ertest/providers/Microsoft.Network/expressRouteCircuits/er1"), - // }, - // PeeringLocation: to.Ptr("SiliconValley"), - // Peerings: []*armnetwork.ExpressRouteCrossConnectionPeering{ - // }, - // PrimaryAzurePort: to.Ptr("bvtazureixp01"), - // ProvisioningState: to.Ptr(armnetwork.ProvisioningStateSucceeded), - // STag: to.Ptr[int32](2), - // SecondaryAzurePort: to.Ptr("bvtazureixp01"), - // ServiceProviderProvisioningState: to.Ptr(armnetwork.ServiceProviderProvisioningStateNotProvisioned), - // }, - // }}, - // } - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/4883fa5dbf6f2c9093fac8ce334547e9dfac68fa/specification/network/resource-manager/Microsoft.Network/stable/2024-03-01/examples/ExpressRouteCrossConnectionGet.json -func ExampleExpressRouteCrossConnectionsClient_Get() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armnetwork.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewExpressRouteCrossConnectionsClient().Get(ctx, "CrossConnection-SiliconValley", "", nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.ExpressRouteCrossConnection = armnetwork.ExpressRouteCrossConnection{ - // Name: to.Ptr(""), - // Type: to.Ptr("Microsoft.Network/expressRouteCrossConnections"), - // ID: to.Ptr("/subscriptions/subid/resourceGroups/CrossConnection-SiliconValley/providers/Microsoft.Network/expressRouteCrossConnections/"), - // Location: to.Ptr("brazilsouth"), - // Etag: to.Ptr("W/\"c0e6477e-8150-4d4f-9bf6-bb10e6acb63a\""), - // Properties: &armnetwork.ExpressRouteCrossConnectionProperties{ - // BandwidthInMbps: to.Ptr[int32](1000), - // ExpressRouteCircuit: &armnetwork.ExpressRouteCircuitReference{ - // ID: to.Ptr("/subscriptions/subid/resourceGroups/ertest/providers/Microsoft.Network/expressRouteCircuits/er1"), - // }, - // PeeringLocation: to.Ptr("SiliconValley"), - // Peerings: []*armnetwork.ExpressRouteCrossConnectionPeering{ - // }, - // PrimaryAzurePort: to.Ptr("bvtazureixp01"), - // ProvisioningState: to.Ptr(armnetwork.ProvisioningStateSucceeded), - // STag: to.Ptr[int32](2), - // SecondaryAzurePort: to.Ptr("bvtazureixp01"), - // ServiceProviderProvisioningState: to.Ptr(armnetwork.ServiceProviderProvisioningStateNotProvisioned), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/4883fa5dbf6f2c9093fac8ce334547e9dfac68fa/specification/network/resource-manager/Microsoft.Network/stable/2024-03-01/examples/ExpressRouteCrossConnectionUpdate.json -func ExampleExpressRouteCrossConnectionsClient_BeginCreateOrUpdate() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armnetwork.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewExpressRouteCrossConnectionsClient().BeginCreateOrUpdate(ctx, "CrossConnection-SiliconValley", "", armnetwork.ExpressRouteCrossConnection{ - Properties: &armnetwork.ExpressRouteCrossConnectionProperties{ - ServiceProviderProvisioningState: to.Ptr(armnetwork.ServiceProviderProvisioningStateNotProvisioned), - }, - }, nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - res, err := poller.PollUntilDone(ctx, nil) - if err != nil { - log.Fatalf("failed to pull the result: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.ExpressRouteCrossConnection = armnetwork.ExpressRouteCrossConnection{ - // Name: to.Ptr(""), - // Type: to.Ptr("Microsoft.Network/expressRouteCrossConnections"), - // ID: to.Ptr("/subscriptions/subid/resourceGroups/CrossConnectionSiliconValley/providers/Microsoft.Network/expressRouteCrossConnections/"), - // Location: to.Ptr("brazilsouth"), - // Properties: &armnetwork.ExpressRouteCrossConnectionProperties{ - // BandwidthInMbps: to.Ptr[int32](1000), - // ExpressRouteCircuit: &armnetwork.ExpressRouteCircuitReference{ - // ID: to.Ptr("/subscriptions/subid/resourceGroups/ertest/providers/Microsoft.Network/expressRouteCircuits/er1"), - // }, - // PeeringLocation: to.Ptr("SiliconValley"), - // Peerings: []*armnetwork.ExpressRouteCrossConnectionPeering{ - // }, - // PrimaryAzurePort: to.Ptr("bvtazureixp01"), - // ProvisioningState: to.Ptr(armnetwork.ProvisioningStateSucceeded), - // STag: to.Ptr[int32](2), - // SecondaryAzurePort: to.Ptr("bvtazureixp01"), - // ServiceProviderProvisioningState: to.Ptr(armnetwork.ServiceProviderProvisioningStateNotProvisioned), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/4883fa5dbf6f2c9093fac8ce334547e9dfac68fa/specification/network/resource-manager/Microsoft.Network/stable/2024-03-01/examples/ExpressRouteCrossConnectionUpdateTags.json -func ExampleExpressRouteCrossConnectionsClient_UpdateTags() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armnetwork.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewExpressRouteCrossConnectionsClient().UpdateTags(ctx, "CrossConnection-SiliconValley", "", armnetwork.TagsObject{ - Tags: map[string]*string{ - "tag1": to.Ptr("value1"), - "tag2": to.Ptr("value2"), - }, - }, nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.ExpressRouteCrossConnection = armnetwork.ExpressRouteCrossConnection{ - // Name: to.Ptr("er1"), - // Type: to.Ptr("Microsoft.Network/expressRouteCrossConnections"), - // ID: to.Ptr("/subscriptions/subid/resourceGroups/CrossConnectionSiliconValley/providers/Microsoft.Network/expressRouteCrossConnections/"), - // Location: to.Ptr("brazilsouth"), - // Tags: map[string]*string{ - // "tag1": to.Ptr("value1"), - // "tag2": to.Ptr("value2"), - // }, - // Properties: &armnetwork.ExpressRouteCrossConnectionProperties{ - // BandwidthInMbps: to.Ptr[int32](1000), - // ExpressRouteCircuit: &armnetwork.ExpressRouteCircuitReference{ - // ID: to.Ptr("/subscriptions/subid/resourceGroups/ertest/providers/Microsoft.Network/expressRouteCircuits/er1"), - // }, - // PeeringLocation: to.Ptr("SiliconValley"), - // Peerings: []*armnetwork.ExpressRouteCrossConnectionPeering{ - // }, - // PrimaryAzurePort: to.Ptr("bvtazureixp01"), - // ProvisioningState: to.Ptr(armnetwork.ProvisioningStateSucceeded), - // STag: to.Ptr[int32](2), - // SecondaryAzurePort: to.Ptr("bvtazureixp01"), - // ServiceProviderProvisioningState: to.Ptr(armnetwork.ServiceProviderProvisioningStateNotProvisioned), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/4883fa5dbf6f2c9093fac8ce334547e9dfac68fa/specification/network/resource-manager/Microsoft.Network/stable/2024-03-01/examples/ExpressRouteCrossConnectionsArpTable.json -func ExampleExpressRouteCrossConnectionsClient_BeginListArpTable() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armnetwork.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewExpressRouteCrossConnectionsClient().BeginListArpTable(ctx, "CrossConnection-SiliconValley", "", "AzurePrivatePeering", "primary", nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - res, err := poller.PollUntilDone(ctx, nil) - if err != nil { - log.Fatalf("failed to pull the result: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.ExpressRouteCircuitsArpTableListResult = armnetwork.ExpressRouteCircuitsArpTableListResult{ - // Value: []*armnetwork.ExpressRouteCircuitArpTable{ - // { - // Age: to.Ptr[int32](0), - // Interface: to.Ptr("Microsoft"), - // IPAddress: to.Ptr("192.116.14.254"), - // MacAddress: to.Ptr("885a.9269.9110"), - // }}, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/4883fa5dbf6f2c9093fac8ce334547e9dfac68fa/specification/network/resource-manager/Microsoft.Network/stable/2024-03-01/examples/ExpressRouteCrossConnectionsRouteTableSummary.json -func ExampleExpressRouteCrossConnectionsClient_BeginListRoutesTableSummary() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armnetwork.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewExpressRouteCrossConnectionsClient().BeginListRoutesTableSummary(ctx, "CrossConnection-SiliconValley", "", "AzurePrivatePeering", "primary", nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - res, err := poller.PollUntilDone(ctx, nil) - if err != nil { - log.Fatalf("failed to pull the result: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.ExpressRouteCrossConnectionsRoutesTableSummaryListResult = armnetwork.ExpressRouteCrossConnectionsRoutesTableSummaryListResult{ - // Value: []*armnetwork.ExpressRouteCrossConnectionRoutesTableSummary{ - // { - // Asn: to.Ptr[int32](65514), - // Neighbor: to.Ptr("10.6.1.112"), - // StateOrPrefixesReceived: to.Ptr("Active"), - // UpDown: to.Ptr("1d14h"), - // }, - // { - // Asn: to.Ptr[int32](65514), - // Neighbor: to.Ptr("10.6.1.113"), - // StateOrPrefixesReceived: to.Ptr("1"), - // UpDown: to.Ptr("1d14h"), - // }}, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/4883fa5dbf6f2c9093fac8ce334547e9dfac68fa/specification/network/resource-manager/Microsoft.Network/stable/2024-03-01/examples/ExpressRouteCrossConnectionsRouteTable.json -func ExampleExpressRouteCrossConnectionsClient_BeginListRoutesTable() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armnetwork.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewExpressRouteCrossConnectionsClient().BeginListRoutesTable(ctx, "CrossConnection-SiliconValley", "", "AzurePrivatePeering", "primary", nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - res, err := poller.PollUntilDone(ctx, nil) - if err != nil { - log.Fatalf("failed to pull the result: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.ExpressRouteCircuitsRoutesTableListResult = armnetwork.ExpressRouteCircuitsRoutesTableListResult{ - // Value: []*armnetwork.ExpressRouteCircuitRoutesTable{ - // { - // Path: to.Ptr("65514"), - // LocPrf: to.Ptr(""), - // Network: to.Ptr("10.6.0.0/16"), - // NextHop: to.Ptr("10.6.1.12"), - // Weight: to.Ptr[int32](0), - // }, - // { - // Path: to.Ptr("65514"), - // LocPrf: to.Ptr(""), - // Network: to.Ptr("10.7.0.0/16"), - // NextHop: to.Ptr("10.7.1.13"), - // Weight: to.Ptr[int32](0), - // }}, - // } -} diff --git a/sdk/resourcemanager/network/armnetwork/expressroutegateways_client_example_test.go b/sdk/resourcemanager/network/armnetwork/expressroutegateways_client_example_test.go deleted file mode 100644 index 1b62f9bb1634..000000000000 --- a/sdk/resourcemanager/network/armnetwork/expressroutegateways_client_example_test.go +++ /dev/null @@ -1,337 +0,0 @@ -//go:build go1.18 -// +build go1.18 - -// 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. -// DO NOT EDIT. - -package armnetwork_test - -import ( - "context" - "log" - - "github.com/Azure/azure-sdk-for-go/sdk/azcore/to" - "github.com/Azure/azure-sdk-for-go/sdk/azidentity" - "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/network/armnetwork/v6" -) - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/4883fa5dbf6f2c9093fac8ce334547e9dfac68fa/specification/network/resource-manager/Microsoft.Network/stable/2024-03-01/examples/ExpressRouteGatewayListBySubscription.json -func ExampleExpressRouteGatewaysClient_ListBySubscription() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armnetwork.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewExpressRouteGatewaysClient().ListBySubscription(ctx, nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.ExpressRouteGatewayList = armnetwork.ExpressRouteGatewayList{ - // Value: []*armnetwork.ExpressRouteGateway{ - // { - // Name: to.Ptr("expressRouteGatewayName"), - // Type: to.Ptr("Microsoft.Network/expressRouteGateways"), - // ID: to.Ptr("/subscriptions/subid/resourceGroups/resourceGroupName/providers/Microsoft.Network/expressRouteGateways/expressRouteGatewayName"), - // Location: to.Ptr("westus"), - // Etag: to.Ptr("w/\\00000000-0000-0000-0000-000000000000\\"), - // Properties: &armnetwork.ExpressRouteGatewayProperties{ - // AllowNonVirtualWanTraffic: to.Ptr(false), - // AutoScaleConfiguration: &armnetwork.ExpressRouteGatewayPropertiesAutoScaleConfiguration{ - // Bounds: &armnetwork.ExpressRouteGatewayPropertiesAutoScaleConfigurationBounds{ - // Min: to.Ptr[int32](2), - // }, - // }, - // ExpressRouteConnections: []*armnetwork.ExpressRouteConnection{ - // { - // ID: to.Ptr("/subscriptions/subid/resourceGroups/resourceGroupName/providers/Microsoft.Network/expressRouteGateways/expressRouteGatewayName/expressRouteConnections/connectionName"), - // Name: to.Ptr("connectionName"), - // Properties: &armnetwork.ExpressRouteConnectionProperties{ - // AuthorizationKey: to.Ptr("f28e9c99-78d8-4248-a855-c54cf6beb99d"), - // EnableInternetSecurity: to.Ptr(false), - // ExpressRouteCircuitPeering: &armnetwork.ExpressRouteCircuitPeeringID{ - // ID: to.Ptr("/subscriptions/subid/resourceGroups/resourceGroupName/providers/Microsoft.Network/expressRouteCircuits/circuitName/peerings/AzurePrivatePeering"), - // }, - // ProvisioningState: to.Ptr(armnetwork.ProvisioningStateSucceeded), - // RoutingConfiguration: &armnetwork.RoutingConfiguration{ - // AssociatedRouteTable: &armnetwork.SubResource{ - // ID: to.Ptr("/subscriptions/subid/resourceGroups/resourceGroupName/providers/Microsoft.Network/virtualHubs/virtualHubName/hubRouteTables/hubRouteTable1"), - // }, - // PropagatedRouteTables: &armnetwork.PropagatedRouteTable{ - // IDs: []*armnetwork.SubResource{ - // { - // ID: to.Ptr("/subscriptions/subid/resourceGroups/resourceGroupName/providers/Microsoft.Network/virtualHubs/virtualHubName/hubRouteTables/hubRouteTable1"), - // }, - // { - // ID: to.Ptr("/subscriptions/subid/resourceGroups/resourceGroupName/providers/Microsoft.Network/virtualHubs/virtualHubName/hubRouteTables/hubRouteTable2"), - // }, - // { - // ID: to.Ptr("/subscriptions/subid/resourceGroups/resourceGroupName/providers/Microsoft.Network/virtualHubs/hvirtualHubNameub1/hubRouteTables/hubRouteTable3"), - // }}, - // Labels: []*string{ - // to.Ptr("label1"), - // to.Ptr("label2")}, - // }, - // VnetRoutes: &armnetwork.VnetRoute{ - // StaticRoutes: []*armnetwork.StaticRoute{ - // }, - // }, - // }, - // RoutingWeight: to.Ptr[int32](1), - // }, - // }}, - // ProvisioningState: to.Ptr(armnetwork.ProvisioningStateSucceeded), - // VirtualHub: &armnetwork.VirtualHubID{ - // ID: to.Ptr("/subscriptions/subid/resourceGroups/resourceGroupName/providers/Microsoft.Network/virtualHubs/virtualHubName"), - // }, - // }, - // }}, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/4883fa5dbf6f2c9093fac8ce334547e9dfac68fa/specification/network/resource-manager/Microsoft.Network/stable/2024-03-01/examples/ExpressRouteGatewayListByResourceGroup.json -func ExampleExpressRouteGatewaysClient_ListByResourceGroup() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armnetwork.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewExpressRouteGatewaysClient().ListByResourceGroup(ctx, "resourceGroupName", nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.ExpressRouteGatewayList = armnetwork.ExpressRouteGatewayList{ - // Value: []*armnetwork.ExpressRouteGateway{ - // { - // Name: to.Ptr("expressRouteGatewayName"), - // Type: to.Ptr("Microsoft.Network/expressRouteGateways"), - // ID: to.Ptr("/subscriptions/subid/resourceGroups/resourceGroupName/providers/Microsoft.Network/expressRouteGateways/expressRouteGatewayName"), - // Location: to.Ptr("westus"), - // Etag: to.Ptr("w/\\00000000-0000-0000-0000-000000000000\\"), - // Properties: &armnetwork.ExpressRouteGatewayProperties{ - // AllowNonVirtualWanTraffic: to.Ptr(false), - // AutoScaleConfiguration: &armnetwork.ExpressRouteGatewayPropertiesAutoScaleConfiguration{ - // Bounds: &armnetwork.ExpressRouteGatewayPropertiesAutoScaleConfigurationBounds{ - // Min: to.Ptr[int32](2), - // }, - // }, - // ExpressRouteConnections: []*armnetwork.ExpressRouteConnection{ - // { - // ID: to.Ptr("/subscriptions/subid/resourceGroups/resourceGroupName/providers/Microsoft.Network/expressRouteGateways/expressRouteGatewayName/expressRouteConnections/connectionName"), - // Name: to.Ptr("connectionName"), - // Properties: &armnetwork.ExpressRouteConnectionProperties{ - // AuthorizationKey: to.Ptr("f28e9c99-78d8-4248-a855-c54cf6beb99d"), - // EnableInternetSecurity: to.Ptr(false), - // ExpressRouteCircuitPeering: &armnetwork.ExpressRouteCircuitPeeringID{ - // ID: to.Ptr("/subscriptions/subid/resourceGroups/resourceGroupName/providers/Microsoft.Network/expressRouteCircuits/circuitName/peerings/AzurePrivatePeering"), - // }, - // ProvisioningState: to.Ptr(armnetwork.ProvisioningStateSucceeded), - // RoutingConfiguration: &armnetwork.RoutingConfiguration{ - // AssociatedRouteTable: &armnetwork.SubResource{ - // ID: to.Ptr("/subscriptions/subid/resourceGroups/resourceGroupName/providers/Microsoft.Network/virtualHubs/virtualHubName/hubRouteTables/hubRouteTable1"), - // }, - // PropagatedRouteTables: &armnetwork.PropagatedRouteTable{ - // IDs: []*armnetwork.SubResource{ - // { - // ID: to.Ptr("/subscriptions/subid/resourceGroups/resourceGroupName/providers/Microsoft.Network/virtualHubs/virtualHubName/hubRouteTables/hubRouteTable1"), - // }, - // { - // ID: to.Ptr("/subscriptions/subid/resourceGroups/resourceGroupName/providers/Microsoft.Network/virtualHubs/virtualHubName/hubRouteTables/hubRouteTable2"), - // }, - // { - // ID: to.Ptr("/subscriptions/subid/resourceGroups/resourceGroupName/providers/Microsoft.Network/virtualHubs/hvirtualHubNameub1/hubRouteTables/hubRouteTable3"), - // }}, - // Labels: []*string{ - // to.Ptr("label1"), - // to.Ptr("label2")}, - // }, - // VnetRoutes: &armnetwork.VnetRoute{ - // StaticRoutes: []*armnetwork.StaticRoute{ - // }, - // }, - // }, - // RoutingWeight: to.Ptr[int32](1), - // }, - // }}, - // ProvisioningState: to.Ptr(armnetwork.ProvisioningStateSucceeded), - // VirtualHub: &armnetwork.VirtualHubID{ - // ID: to.Ptr("/subscriptions/subid/resourceGroups/resourceGroupName/providers/Microsoft.Network/virtualHubs/virtualHubName"), - // }, - // }, - // }}, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/4883fa5dbf6f2c9093fac8ce334547e9dfac68fa/specification/network/resource-manager/Microsoft.Network/stable/2024-03-01/examples/ExpressRouteGatewayCreate.json -func ExampleExpressRouteGatewaysClient_BeginCreateOrUpdate() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armnetwork.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewExpressRouteGatewaysClient().BeginCreateOrUpdate(ctx, "resourceGroupName", "gateway-2", armnetwork.ExpressRouteGateway{ - Location: to.Ptr("westus"), - Properties: &armnetwork.ExpressRouteGatewayProperties{ - AllowNonVirtualWanTraffic: to.Ptr(false), - AutoScaleConfiguration: &armnetwork.ExpressRouteGatewayPropertiesAutoScaleConfiguration{ - Bounds: &armnetwork.ExpressRouteGatewayPropertiesAutoScaleConfigurationBounds{ - Min: to.Ptr[int32](3), - }, - }, - VirtualHub: &armnetwork.VirtualHubID{ - ID: to.Ptr("/subscriptions/subid/resourceGroups/resourceGroupId/providers/Microsoft.Network/virtualHubs/virtualHubName"), - }, - }, - }, nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - res, err := poller.PollUntilDone(ctx, nil) - if err != nil { - log.Fatalf("failed to pull the result: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.ExpressRouteGateway = armnetwork.ExpressRouteGateway{ - // Name: to.Ptr("gateway-2"), - // Type: to.Ptr("Microsoft.Network/expressRouteGateways"), - // ID: to.Ptr("/subscriptions/subid/resourceGroups/resourceGroupName/providers/Microsoft.Network/expressRouteGateways/gateway-2"), - // Location: to.Ptr("westus"), - // Etag: to.Ptr("w/\\00000000-0000-0000-0000-000000000000\\"), - // Properties: &armnetwork.ExpressRouteGatewayProperties{ - // AllowNonVirtualWanTraffic: to.Ptr(false), - // AutoScaleConfiguration: &armnetwork.ExpressRouteGatewayPropertiesAutoScaleConfiguration{ - // Bounds: &armnetwork.ExpressRouteGatewayPropertiesAutoScaleConfigurationBounds{ - // Min: to.Ptr[int32](3), - // }, - // }, - // ProvisioningState: to.Ptr(armnetwork.ProvisioningStateSucceeded), - // VirtualHub: &armnetwork.VirtualHubID{ - // ID: to.Ptr("/subscriptions/subid/resourceGroups/resourceGroupName/providers/Microsoft.Network/virtualHubs/virtualHubName"), - // }, - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/4883fa5dbf6f2c9093fac8ce334547e9dfac68fa/specification/network/resource-manager/Microsoft.Network/stable/2024-03-01/examples/ExpressRouteGatewayUpdateTags.json -func ExampleExpressRouteGatewaysClient_BeginUpdateTags() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armnetwork.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewExpressRouteGatewaysClient().BeginUpdateTags(ctx, "resourceGroupName", "expressRouteGatewayName", armnetwork.TagsObject{ - Tags: map[string]*string{ - "tag1": to.Ptr("value1"), - "tag2": to.Ptr("value2"), - }, - }, nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - res, err := poller.PollUntilDone(ctx, nil) - if err != nil { - log.Fatalf("failed to pull the result: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.ExpressRouteGateway = armnetwork.ExpressRouteGateway{ - // Name: to.Ptr("expressRouteGatewayName"), - // Type: to.Ptr("Microsoft.Network/expressRouteGateways"), - // ID: to.Ptr("/subscriptions/subid/resourceGroups/resourceGroupName/providers/Microsoft.Network/expressRouteGateways/expressRouteGatewayName"), - // Location: to.Ptr("westus"), - // Tags: map[string]*string{ - // "tag1": to.Ptr("value1"), - // "tag2": to.Ptr("value2"), - // }, - // Etag: to.Ptr("w/\\00000000-0000-0000-0000-000000000000\\"), - // Properties: &armnetwork.ExpressRouteGatewayProperties{ - // AllowNonVirtualWanTraffic: to.Ptr(false), - // ProvisioningState: to.Ptr(armnetwork.ProvisioningStateSucceeded), - // VirtualHub: &armnetwork.VirtualHubID{ - // ID: to.Ptr("/subscriptions/subid/resourceGroups/resourceGroupName/providers/Microsoft.Network/virtualHubs/virtualHubName"), - // }, - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/4883fa5dbf6f2c9093fac8ce334547e9dfac68fa/specification/network/resource-manager/Microsoft.Network/stable/2024-03-01/examples/ExpressRouteGatewayGet.json -func ExampleExpressRouteGatewaysClient_Get() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armnetwork.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewExpressRouteGatewaysClient().Get(ctx, "resourceGroupName", "expressRouteGatewayName", nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.ExpressRouteGateway = armnetwork.ExpressRouteGateway{ - // Name: to.Ptr("expressRouteGatewayName"), - // Type: to.Ptr("Microsoft.Network/expressRouteGateways"), - // ID: to.Ptr("/subscriptions/subid/resourceGroups/resourceGroupName/providers/Microsoft.Network/expressRouteGateways/expressRouteGatewayName"), - // Location: to.Ptr("westus"), - // Etag: to.Ptr("w/\\00000000-0000-0000-0000-000000000000\\"), - // Properties: &armnetwork.ExpressRouteGatewayProperties{ - // AllowNonVirtualWanTraffic: to.Ptr(false), - // ProvisioningState: to.Ptr(armnetwork.ProvisioningStateSucceeded), - // VirtualHub: &armnetwork.VirtualHubID{ - // ID: to.Ptr("/subscriptions/subid/resourceGroups/resourceGroupName/providers/Microsoft.Network/virtualHubs/virtualHubName"), - // }, - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/4883fa5dbf6f2c9093fac8ce334547e9dfac68fa/specification/network/resource-manager/Microsoft.Network/stable/2024-03-01/examples/ExpressRouteGatewayDelete.json -func ExampleExpressRouteGatewaysClient_BeginDelete() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armnetwork.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewExpressRouteGatewaysClient().BeginDelete(ctx, "resourceGroupName", "expressRouteGatewayName", nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - _, err = poller.PollUntilDone(ctx, nil) - if err != nil { - log.Fatalf("failed to pull the result: %v", err) - } -} diff --git a/sdk/resourcemanager/network/armnetwork/expressroutelinks_client_example_test.go b/sdk/resourcemanager/network/armnetwork/expressroutelinks_client_example_test.go deleted file mode 100644 index 4768bd356b6d..000000000000 --- a/sdk/resourcemanager/network/armnetwork/expressroutelinks_client_example_test.go +++ /dev/null @@ -1,108 +0,0 @@ -//go:build go1.18 -// +build go1.18 - -// 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. -// DO NOT EDIT. - -package armnetwork_test - -import ( - "context" - "log" - - "github.com/Azure/azure-sdk-for-go/sdk/azidentity" - "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/network/armnetwork/v6" -) - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/4883fa5dbf6f2c9093fac8ce334547e9dfac68fa/specification/network/resource-manager/Microsoft.Network/stable/2024-03-01/examples/ExpressRouteLinkGet.json -func ExampleExpressRouteLinksClient_Get() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armnetwork.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewExpressRouteLinksClient().Get(ctx, "rg1", "portName", "linkName", nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.ExpressRouteLink = armnetwork.ExpressRouteLink{ - // ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/expressRoutePorts/portName/links/linkName"), - // Name: to.Ptr("linkName"), - // Properties: &armnetwork.ExpressRouteLinkPropertiesFormat{ - // AdminState: to.Ptr(armnetwork.ExpressRouteLinkAdminStateDisabled), - // ColoLocation: to.Ptr("coloLocationName"), - // ConnectorType: to.Ptr(armnetwork.ExpressRouteLinkConnectorTypeLC), - // InterfaceName: to.Ptr("Ethernet 0/0"), - // PatchPanelID: to.Ptr("patchPanelId1"), - // ProvisioningState: to.Ptr(armnetwork.ProvisioningStateSucceeded), - // RackID: to.Ptr("rackId1"), - // RouterName: to.Ptr("router1"), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/4883fa5dbf6f2c9093fac8ce334547e9dfac68fa/specification/network/resource-manager/Microsoft.Network/stable/2024-03-01/examples/ExpressRouteLinkList.json -func ExampleExpressRouteLinksClient_NewListPager() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armnetwork.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := clientFactory.NewExpressRouteLinksClient().NewListPager("rg1", "portName", nil) - for pager.More() { - page, err := pager.NextPage(ctx) - if err != nil { - log.Fatalf("failed to advance page: %v", err) - } - for _, v := range page.Value { - // You could use page here. We use blank identifier for just demo purposes. - _ = v - } - // If the HTTP response code is 200 as defined in example definition, your page structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // page.ExpressRouteLinkListResult = armnetwork.ExpressRouteLinkListResult{ - // Value: []*armnetwork.ExpressRouteLink{ - // { - // ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/expressRoutePorts/portName/links/link1"), - // Name: to.Ptr("link1"), - // Properties: &armnetwork.ExpressRouteLinkPropertiesFormat{ - // AdminState: to.Ptr(armnetwork.ExpressRouteLinkAdminStateDisabled), - // ColoLocation: to.Ptr("coloLocation1"), - // ConnectorType: to.Ptr(armnetwork.ExpressRouteLinkConnectorTypeLC), - // InterfaceName: to.Ptr("Ethernet 0/0"), - // PatchPanelID: to.Ptr("patchPanelId1"), - // ProvisioningState: to.Ptr(armnetwork.ProvisioningStateSucceeded), - // RackID: to.Ptr("rackId1"), - // RouterName: to.Ptr("router1"), - // }, - // }, - // { - // ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/expressRoutePorts/portName/links/link2"), - // Name: to.Ptr("link2"), - // Properties: &armnetwork.ExpressRouteLinkPropertiesFormat{ - // AdminState: to.Ptr(armnetwork.ExpressRouteLinkAdminStateDisabled), - // ColoLocation: to.Ptr("coloLocation2"), - // ConnectorType: to.Ptr(armnetwork.ExpressRouteLinkConnectorTypeLC), - // InterfaceName: to.Ptr("Ethernet 0/0"), - // PatchPanelID: to.Ptr("patchPanelId2"), - // ProvisioningState: to.Ptr(armnetwork.ProvisioningStateSucceeded), - // RackID: to.Ptr("rackId2"), - // RouterName: to.Ptr("router2"), - // }, - // }}, - // } - } -} diff --git a/sdk/resourcemanager/network/armnetwork/expressrouteportauthorizations_client_example_test.go b/sdk/resourcemanager/network/armnetwork/expressrouteportauthorizations_client_example_test.go deleted file mode 100644 index d0dc450f0044..000000000000 --- a/sdk/resourcemanager/network/armnetwork/expressrouteportauthorizations_client_example_test.go +++ /dev/null @@ -1,148 +0,0 @@ -//go:build go1.18 -// +build go1.18 - -// 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. -// DO NOT EDIT. - -package armnetwork_test - -import ( - "context" - "log" - - "github.com/Azure/azure-sdk-for-go/sdk/azidentity" - "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/network/armnetwork/v6" -) - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/4883fa5dbf6f2c9093fac8ce334547e9dfac68fa/specification/network/resource-manager/Microsoft.Network/stable/2024-03-01/examples/ExpressRoutePortAuthorizationDelete.json -func ExampleExpressRoutePortAuthorizationsClient_BeginDelete() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armnetwork.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewExpressRoutePortAuthorizationsClient().BeginDelete(ctx, "rg1", "expressRoutePortName", "authorizationName", nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - _, err = poller.PollUntilDone(ctx, nil) - if err != nil { - log.Fatalf("failed to pull the result: %v", err) - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/4883fa5dbf6f2c9093fac8ce334547e9dfac68fa/specification/network/resource-manager/Microsoft.Network/stable/2024-03-01/examples/ExpressRoutePortAuthorizationGet.json -func ExampleExpressRoutePortAuthorizationsClient_Get() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armnetwork.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewExpressRoutePortAuthorizationsClient().Get(ctx, "rg1", "expressRoutePortName", "authorizationName", nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.ExpressRoutePortAuthorization = armnetwork.ExpressRoutePortAuthorization{ - // ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/ExpressRoutePorts/expressRoutePortName/authorizations/authorizationName"), - // Name: to.Ptr("authorizationName"), - // Type: to.Ptr("Microsoft.Network/expressRoutePorts/authorizations"), - // Etag: to.Ptr("W/\"e33c875f-48df-4a91-b7d3-eb95b5ddbb89\""), - // Properties: &armnetwork.ExpressRoutePortAuthorizationPropertiesFormat{ - // AuthorizationKey: to.Ptr("authKey"), - // AuthorizationUseStatus: to.Ptr(armnetwork.ExpressRoutePortAuthorizationUseStatusAvailable), - // CircuitResourceURI: to.Ptr(""), - // ProvisioningState: to.Ptr(armnetwork.ProvisioningStateSucceeded), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/4883fa5dbf6f2c9093fac8ce334547e9dfac68fa/specification/network/resource-manager/Microsoft.Network/stable/2024-03-01/examples/ExpressRoutePortAuthorizationCreate.json -func ExampleExpressRoutePortAuthorizationsClient_BeginCreateOrUpdate() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armnetwork.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewExpressRoutePortAuthorizationsClient().BeginCreateOrUpdate(ctx, "rg1", "expressRoutePortName", "authorizatinName", armnetwork.ExpressRoutePortAuthorization{ - Properties: &armnetwork.ExpressRoutePortAuthorizationPropertiesFormat{}, - }, nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - res, err := poller.PollUntilDone(ctx, nil) - if err != nil { - log.Fatalf("failed to pull the result: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.ExpressRoutePortAuthorization = armnetwork.ExpressRoutePortAuthorization{ - // ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/ExpressRoutePorts/expressRoutePortName/authorizations/authorizationName"), - // Name: to.Ptr("authorizationName"), - // Type: to.Ptr("Microsoft.Network/expressRoutePorts/authorizations"), - // Etag: to.Ptr("W/\"e22dd4b2-4c24-44cf-b702-70a472b62914\""), - // Properties: &armnetwork.ExpressRoutePortAuthorizationPropertiesFormat{ - // AuthorizationUseStatus: to.Ptr(armnetwork.ExpressRoutePortAuthorizationUseStatusAvailable), - // CircuitResourceURI: to.Ptr(""), - // ProvisioningState: to.Ptr(armnetwork.ProvisioningStateSucceeded), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/4883fa5dbf6f2c9093fac8ce334547e9dfac68fa/specification/network/resource-manager/Microsoft.Network/stable/2024-03-01/examples/ExpressRoutePortAuthorizationList.json -func ExampleExpressRoutePortAuthorizationsClient_NewListPager() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armnetwork.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := clientFactory.NewExpressRoutePortAuthorizationsClient().NewListPager("rg1", "expressRoutePortName", nil) - for pager.More() { - page, err := pager.NextPage(ctx) - if err != nil { - log.Fatalf("failed to advance page: %v", err) - } - for _, v := range page.Value { - // You could use page here. We use blank identifier for just demo purposes. - _ = v - } - // If the HTTP response code is 200 as defined in example definition, your page structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // page.ExpressRoutePortAuthorizationListResult = armnetwork.ExpressRoutePortAuthorizationListResult{ - // Value: []*armnetwork.ExpressRoutePortAuthorization{ - // { - // ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/ExpressRoutePorts/expressRoutePortName/authorizations/authorizationName"), - // Name: to.Ptr("authorizationName"), - // Type: to.Ptr("Microsoft.Network/expressRoutePorts/authorizations"), - // Etag: to.Ptr("W/\"e33c875f-48df-4a91-b7d3-eb95b5ddbb89\""), - // Properties: &armnetwork.ExpressRoutePortAuthorizationPropertiesFormat{ - // AuthorizationKey: to.Ptr("authKey"), - // AuthorizationUseStatus: to.Ptr(armnetwork.ExpressRoutePortAuthorizationUseStatusAvailable), - // CircuitResourceURI: to.Ptr(""), - // ProvisioningState: to.Ptr(armnetwork.ProvisioningStateSucceeded), - // }, - // }}, - // } - } -} diff --git a/sdk/resourcemanager/network/armnetwork/expressrouteports_client_example_test.go b/sdk/resourcemanager/network/armnetwork/expressrouteports_client_example_test.go deleted file mode 100644 index b88658a7ee44..000000000000 --- a/sdk/resourcemanager/network/armnetwork/expressrouteports_client_example_test.go +++ /dev/null @@ -1,519 +0,0 @@ -//go:build go1.18 -// +build go1.18 - -// 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. -// DO NOT EDIT. - -package armnetwork_test - -import ( - "context" - "log" - - "github.com/Azure/azure-sdk-for-go/sdk/azcore/to" - "github.com/Azure/azure-sdk-for-go/sdk/azidentity" - "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/network/armnetwork/v6" -) - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/4883fa5dbf6f2c9093fac8ce334547e9dfac68fa/specification/network/resource-manager/Microsoft.Network/stable/2024-03-01/examples/ExpressRoutePortDelete.json -func ExampleExpressRoutePortsClient_BeginDelete() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armnetwork.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewExpressRoutePortsClient().BeginDelete(ctx, "rg1", "portName", nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - _, err = poller.PollUntilDone(ctx, nil) - if err != nil { - log.Fatalf("failed to pull the result: %v", err) - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/4883fa5dbf6f2c9093fac8ce334547e9dfac68fa/specification/network/resource-manager/Microsoft.Network/stable/2024-03-01/examples/ExpressRoutePortGet.json -func ExampleExpressRoutePortsClient_Get() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armnetwork.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewExpressRoutePortsClient().Get(ctx, "rg1", "portName", nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.ExpressRoutePort = armnetwork.ExpressRoutePort{ - // Name: to.Ptr("portName"), - // Type: to.Ptr("Microsoft.Network/expressRoutePorts"), - // ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/expressRoutePorts/portName"), - // Location: to.Ptr("westus"), - // Properties: &armnetwork.ExpressRoutePortPropertiesFormat{ - // AllocationDate: to.Ptr("Friday, July 1, 2018"), - // BandwidthInGbps: to.Ptr[int32](100), - // BillingType: to.Ptr(armnetwork.ExpressRoutePortsBillingTypeUnlimitedData), - // Circuits: []*armnetwork.SubResource{ - // }, - // Encapsulation: to.Ptr(armnetwork.ExpressRoutePortsEncapsulationQinQ), - // EtherType: to.Ptr("0x8100"), - // Links: []*armnetwork.ExpressRouteLink{ - // { - // ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/expressRoutePorts/portName/links/link1"), - // Name: to.Ptr("link1"), - // Properties: &armnetwork.ExpressRouteLinkPropertiesFormat{ - // AdminState: to.Ptr(armnetwork.ExpressRouteLinkAdminStateDisabled), - // ColoLocation: to.Ptr("coloLocation1"), - // ConnectorType: to.Ptr(armnetwork.ExpressRouteLinkConnectorTypeLC), - // InterfaceName: to.Ptr("Ethernet 0/0"), - // PatchPanelID: to.Ptr("patchPanelId1"), - // ProvisioningState: to.Ptr(armnetwork.ProvisioningStateSucceeded), - // RackID: to.Ptr("rackId1"), - // RouterName: to.Ptr("router1"), - // }, - // }, - // { - // ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/expressRoutePorts/portName/links/link2"), - // Name: to.Ptr("link2"), - // Properties: &armnetwork.ExpressRouteLinkPropertiesFormat{ - // AdminState: to.Ptr(armnetwork.ExpressRouteLinkAdminStateDisabled), - // ColoLocation: to.Ptr("coloLocation2"), - // ConnectorType: to.Ptr(armnetwork.ExpressRouteLinkConnectorTypeLC), - // InterfaceName: to.Ptr("Ethernet 0/0"), - // PatchPanelID: to.Ptr("patchPanelId2"), - // ProvisioningState: to.Ptr(armnetwork.ProvisioningStateSucceeded), - // RackID: to.Ptr("rackId2"), - // RouterName: to.Ptr("router2"), - // }, - // }}, - // Mtu: to.Ptr("1500"), - // PeeringLocation: to.Ptr("peeringLocationName"), - // ProvisionedBandwidthInGbps: to.Ptr[float32](0), - // ProvisioningState: to.Ptr(armnetwork.ProvisioningStateSucceeded), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/4883fa5dbf6f2c9093fac8ce334547e9dfac68fa/specification/network/resource-manager/Microsoft.Network/stable/2024-03-01/examples/ExpressRoutePortCreate.json -func ExampleExpressRoutePortsClient_BeginCreateOrUpdate_expressRoutePortCreate() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armnetwork.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewExpressRoutePortsClient().BeginCreateOrUpdate(ctx, "rg1", "portName", armnetwork.ExpressRoutePort{ - Location: to.Ptr("westus"), - Properties: &armnetwork.ExpressRoutePortPropertiesFormat{ - BandwidthInGbps: to.Ptr[int32](100), - BillingType: to.Ptr(armnetwork.ExpressRoutePortsBillingTypeUnlimitedData), - Encapsulation: to.Ptr(armnetwork.ExpressRoutePortsEncapsulationQinQ), - PeeringLocation: to.Ptr("peeringLocationName"), - }, - }, nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - res, err := poller.PollUntilDone(ctx, nil) - if err != nil { - log.Fatalf("failed to pull the result: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.ExpressRoutePort = armnetwork.ExpressRoutePort{ - // Name: to.Ptr("portName"), - // Type: to.Ptr("Microsoft.Network/expressRoutePorts"), - // ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/expressRoutePorts/portName"), - // Location: to.Ptr("westus"), - // Properties: &armnetwork.ExpressRoutePortPropertiesFormat{ - // AllocationDate: to.Ptr("Friday, July 1, 2018"), - // BandwidthInGbps: to.Ptr[int32](100), - // BillingType: to.Ptr(armnetwork.ExpressRoutePortsBillingTypeUnlimitedData), - // Circuits: []*armnetwork.SubResource{ - // }, - // Encapsulation: to.Ptr(armnetwork.ExpressRoutePortsEncapsulationQinQ), - // EtherType: to.Ptr("0x8100"), - // Links: []*armnetwork.ExpressRouteLink{ - // { - // ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/expressRoutePorts/portName/links/link1"), - // Name: to.Ptr("link1"), - // Properties: &armnetwork.ExpressRouteLinkPropertiesFormat{ - // AdminState: to.Ptr(armnetwork.ExpressRouteLinkAdminStateDisabled), - // ConnectorType: to.Ptr(armnetwork.ExpressRouteLinkConnectorTypeLC), - // InterfaceName: to.Ptr("Ethernet 0/0"), - // PatchPanelID: to.Ptr("patchPanelId1"), - // ProvisioningState: to.Ptr(armnetwork.ProvisioningStateSucceeded), - // RackID: to.Ptr("rackId1"), - // RouterName: to.Ptr("router1"), - // }, - // }, - // { - // ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/expressRoutePorts/portName/links/link2"), - // Name: to.Ptr("link2"), - // Properties: &armnetwork.ExpressRouteLinkPropertiesFormat{ - // AdminState: to.Ptr(armnetwork.ExpressRouteLinkAdminStateDisabled), - // ConnectorType: to.Ptr(armnetwork.ExpressRouteLinkConnectorTypeLC), - // InterfaceName: to.Ptr("Ethernet 0/0"), - // PatchPanelID: to.Ptr("patchPanelId2"), - // ProvisioningState: to.Ptr(armnetwork.ProvisioningStateSucceeded), - // RackID: to.Ptr("rackId2"), - // RouterName: to.Ptr("router2"), - // }, - // }}, - // Mtu: to.Ptr("1500"), - // PeeringLocation: to.Ptr("peeringLocationName"), - // ProvisionedBandwidthInGbps: to.Ptr[float32](0), - // ProvisioningState: to.Ptr(armnetwork.ProvisioningStateSucceeded), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/4883fa5dbf6f2c9093fac8ce334547e9dfac68fa/specification/network/resource-manager/Microsoft.Network/stable/2024-03-01/examples/ExpressRoutePortUpdateLink.json -func ExampleExpressRoutePortsClient_BeginCreateOrUpdate_expressRoutePortUpdateLink() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armnetwork.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewExpressRoutePortsClient().BeginCreateOrUpdate(ctx, "rg1", "portName", armnetwork.ExpressRoutePort{ - Location: to.Ptr("westus"), - Properties: &armnetwork.ExpressRoutePortPropertiesFormat{ - BandwidthInGbps: to.Ptr[int32](100), - BillingType: to.Ptr(armnetwork.ExpressRoutePortsBillingTypeUnlimitedData), - Encapsulation: to.Ptr(armnetwork.ExpressRoutePortsEncapsulationQinQ), - Links: []*armnetwork.ExpressRouteLink{ - { - Name: to.Ptr("link1"), - Properties: &armnetwork.ExpressRouteLinkPropertiesFormat{ - AdminState: to.Ptr(armnetwork.ExpressRouteLinkAdminStateEnabled), - }, - }}, - PeeringLocation: to.Ptr("peeringLocationName"), - }, - }, nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - res, err := poller.PollUntilDone(ctx, nil) - if err != nil { - log.Fatalf("failed to pull the result: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.ExpressRoutePort = armnetwork.ExpressRoutePort{ - // Name: to.Ptr("portName"), - // Type: to.Ptr("Microsoft.Network/expressRoutePorts"), - // ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/expressRoutePorts/portName"), - // Location: to.Ptr("westus"), - // Properties: &armnetwork.ExpressRoutePortPropertiesFormat{ - // AllocationDate: to.Ptr("Friday, July 1, 2018"), - // BandwidthInGbps: to.Ptr[int32](100), - // BillingType: to.Ptr(armnetwork.ExpressRoutePortsBillingTypeUnlimitedData), - // Circuits: []*armnetwork.SubResource{ - // }, - // Encapsulation: to.Ptr(armnetwork.ExpressRoutePortsEncapsulationQinQ), - // EtherType: to.Ptr("0x8100"), - // Links: []*armnetwork.ExpressRouteLink{ - // { - // ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/expressRoutePorts/portName/links/link1"), - // Name: to.Ptr("link1"), - // Properties: &armnetwork.ExpressRouteLinkPropertiesFormat{ - // AdminState: to.Ptr(armnetwork.ExpressRouteLinkAdminStateEnabled), - // ConnectorType: to.Ptr(armnetwork.ExpressRouteLinkConnectorTypeLC), - // InterfaceName: to.Ptr("Ethernet 0/0"), - // PatchPanelID: to.Ptr("patchPanelId1"), - // ProvisioningState: to.Ptr(armnetwork.ProvisioningStateSucceeded), - // RackID: to.Ptr("rackId1"), - // RouterName: to.Ptr("router1"), - // }, - // }, - // { - // ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/expressRoutePorts/portName/links/link2"), - // Name: to.Ptr("link2"), - // Properties: &armnetwork.ExpressRouteLinkPropertiesFormat{ - // AdminState: to.Ptr(armnetwork.ExpressRouteLinkAdminStateDisabled), - // ConnectorType: to.Ptr(armnetwork.ExpressRouteLinkConnectorTypeLC), - // InterfaceName: to.Ptr("Ethernet 0/0"), - // PatchPanelID: to.Ptr("patchPanelId2"), - // ProvisioningState: to.Ptr(armnetwork.ProvisioningStateSucceeded), - // RackID: to.Ptr("rackId2"), - // RouterName: to.Ptr("router2"), - // }, - // }}, - // Mtu: to.Ptr("1500"), - // PeeringLocation: to.Ptr("peeringLocationName"), - // ProvisionedBandwidthInGbps: to.Ptr[float32](0), - // ProvisioningState: to.Ptr(armnetwork.ProvisioningStateSucceeded), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/4883fa5dbf6f2c9093fac8ce334547e9dfac68fa/specification/network/resource-manager/Microsoft.Network/stable/2024-03-01/examples/ExpressRoutePortUpdateTags.json -func ExampleExpressRoutePortsClient_UpdateTags() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armnetwork.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewExpressRoutePortsClient().UpdateTags(ctx, "rg1", "portName", armnetwork.TagsObject{ - Tags: map[string]*string{ - "tag1": to.Ptr("value1"), - "tag2": to.Ptr("value2"), - }, - }, nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.ExpressRoutePort = armnetwork.ExpressRoutePort{ - // Name: to.Ptr("portName"), - // Type: to.Ptr("Microsoft.Network/expressRoutePorts"), - // ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/expressRoutePorts/portName"), - // Location: to.Ptr("westus"), - // Properties: &armnetwork.ExpressRoutePortPropertiesFormat{ - // AllocationDate: to.Ptr("Friday, July 1, 2018"), - // BandwidthInGbps: to.Ptr[int32](100), - // BillingType: to.Ptr(armnetwork.ExpressRoutePortsBillingTypeUnlimitedData), - // Circuits: []*armnetwork.SubResource{ - // }, - // Encapsulation: to.Ptr(armnetwork.ExpressRoutePortsEncapsulationQinQ), - // EtherType: to.Ptr("0x8100"), - // Links: []*armnetwork.ExpressRouteLink{ - // { - // ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/expressRoutePorts/portName/links/link1"), - // Name: to.Ptr("link1"), - // Properties: &armnetwork.ExpressRouteLinkPropertiesFormat{ - // AdminState: to.Ptr(armnetwork.ExpressRouteLinkAdminStateDisabled), - // ConnectorType: to.Ptr(armnetwork.ExpressRouteLinkConnectorTypeLC), - // InterfaceName: to.Ptr("Ethernet 0/0"), - // PatchPanelID: to.Ptr("patchPanelId1"), - // ProvisioningState: to.Ptr(armnetwork.ProvisioningStateSucceeded), - // RackID: to.Ptr("rackId1"), - // RouterName: to.Ptr("router1"), - // }, - // }, - // { - // ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/expressRoutePorts/portName/links/link2"), - // Name: to.Ptr("link2"), - // Properties: &armnetwork.ExpressRouteLinkPropertiesFormat{ - // AdminState: to.Ptr(armnetwork.ExpressRouteLinkAdminStateDisabled), - // ConnectorType: to.Ptr(armnetwork.ExpressRouteLinkConnectorTypeLC), - // InterfaceName: to.Ptr("Ethernet 0/0"), - // PatchPanelID: to.Ptr("patchPanelId2"), - // ProvisioningState: to.Ptr(armnetwork.ProvisioningStateSucceeded), - // RackID: to.Ptr("rackId2"), - // RouterName: to.Ptr("router2"), - // }, - // }}, - // Mtu: to.Ptr("1500"), - // PeeringLocation: to.Ptr("peeringLocationName"), - // ProvisionedBandwidthInGbps: to.Ptr[float32](0), - // ProvisioningState: to.Ptr(armnetwork.ProvisioningStateSucceeded), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/4883fa5dbf6f2c9093fac8ce334547e9dfac68fa/specification/network/resource-manager/Microsoft.Network/stable/2024-03-01/examples/ExpressRoutePortListByResourceGroup.json -func ExampleExpressRoutePortsClient_NewListByResourceGroupPager() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armnetwork.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := clientFactory.NewExpressRoutePortsClient().NewListByResourceGroupPager("rg1", nil) - for pager.More() { - page, err := pager.NextPage(ctx) - if err != nil { - log.Fatalf("failed to advance page: %v", err) - } - for _, v := range page.Value { - // You could use page here. We use blank identifier for just demo purposes. - _ = v - } - // If the HTTP response code is 200 as defined in example definition, your page structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // page.ExpressRoutePortListResult = armnetwork.ExpressRoutePortListResult{ - // Value: []*armnetwork.ExpressRoutePort{ - // { - // Name: to.Ptr("portName"), - // Type: to.Ptr("Microsoft.Network/expressRoutePorts"), - // ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/expressRoutePorts/portName"), - // Location: to.Ptr("westus"), - // Properties: &armnetwork.ExpressRoutePortPropertiesFormat{ - // AllocationDate: to.Ptr("Friday, July 1, 2018"), - // BandwidthInGbps: to.Ptr[int32](100), - // BillingType: to.Ptr(armnetwork.ExpressRoutePortsBillingTypeUnlimitedData), - // Circuits: []*armnetwork.SubResource{ - // }, - // Encapsulation: to.Ptr(armnetwork.ExpressRoutePortsEncapsulationQinQ), - // EtherType: to.Ptr("0x8100"), - // Links: []*armnetwork.ExpressRouteLink{ - // { - // ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/expressRoutePorts/portName/links/link1"), - // Name: to.Ptr("link1"), - // Properties: &armnetwork.ExpressRouteLinkPropertiesFormat{ - // AdminState: to.Ptr(armnetwork.ExpressRouteLinkAdminStateDisabled), - // ColoLocation: to.Ptr("coloLocation1"), - // ConnectorType: to.Ptr(armnetwork.ExpressRouteLinkConnectorTypeLC), - // InterfaceName: to.Ptr("Ethernet 0/0"), - // PatchPanelID: to.Ptr("patchPanelId1"), - // ProvisioningState: to.Ptr(armnetwork.ProvisioningStateSucceeded), - // RackID: to.Ptr("rackId1"), - // RouterName: to.Ptr("router1"), - // }, - // }, - // { - // ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/expressRoutePorts/portName/links/link2"), - // Name: to.Ptr("link2"), - // Properties: &armnetwork.ExpressRouteLinkPropertiesFormat{ - // AdminState: to.Ptr(armnetwork.ExpressRouteLinkAdminStateDisabled), - // ColoLocation: to.Ptr("coloLocation2"), - // ConnectorType: to.Ptr(armnetwork.ExpressRouteLinkConnectorTypeLC), - // InterfaceName: to.Ptr("Ethernet 0/0"), - // PatchPanelID: to.Ptr("patchPanelId2"), - // ProvisioningState: to.Ptr(armnetwork.ProvisioningStateSucceeded), - // RackID: to.Ptr("rackId2"), - // RouterName: to.Ptr("router2"), - // }, - // }}, - // Mtu: to.Ptr("1500"), - // PeeringLocation: to.Ptr("peeringLocationName"), - // ProvisionedBandwidthInGbps: to.Ptr[float32](0), - // ProvisioningState: to.Ptr(armnetwork.ProvisioningStateSucceeded), - // }, - // }}, - // } - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/4883fa5dbf6f2c9093fac8ce334547e9dfac68fa/specification/network/resource-manager/Microsoft.Network/stable/2024-03-01/examples/ExpressRoutePortList.json -func ExampleExpressRoutePortsClient_NewListPager() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armnetwork.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := clientFactory.NewExpressRoutePortsClient().NewListPager(nil) - for pager.More() { - page, err := pager.NextPage(ctx) - if err != nil { - log.Fatalf("failed to advance page: %v", err) - } - for _, v := range page.Value { - // You could use page here. We use blank identifier for just demo purposes. - _ = v - } - // If the HTTP response code is 200 as defined in example definition, your page structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // page.ExpressRoutePortListResult = armnetwork.ExpressRoutePortListResult{ - // Value: []*armnetwork.ExpressRoutePort{ - // { - // Name: to.Ptr("portName"), - // Type: to.Ptr("Microsoft.Network/expressRoutePorts"), - // ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/expressRoutePorts/portName"), - // Location: to.Ptr("westus"), - // Properties: &armnetwork.ExpressRoutePortPropertiesFormat{ - // AllocationDate: to.Ptr("Friday, July 1, 2018"), - // BandwidthInGbps: to.Ptr[int32](100), - // BillingType: to.Ptr(armnetwork.ExpressRoutePortsBillingTypeUnlimitedData), - // Circuits: []*armnetwork.SubResource{ - // }, - // Encapsulation: to.Ptr(armnetwork.ExpressRoutePortsEncapsulationQinQ), - // EtherType: to.Ptr("0x8100"), - // Links: []*armnetwork.ExpressRouteLink{ - // { - // ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/expressRoutePorts/portName/links/link1"), - // Name: to.Ptr("link1"), - // Properties: &armnetwork.ExpressRouteLinkPropertiesFormat{ - // AdminState: to.Ptr(armnetwork.ExpressRouteLinkAdminStateDisabled), - // ColoLocation: to.Ptr("coloLocation1"), - // ConnectorType: to.Ptr(armnetwork.ExpressRouteLinkConnectorTypeLC), - // InterfaceName: to.Ptr("Ethernet 0/0"), - // PatchPanelID: to.Ptr("patchPanelId1"), - // ProvisioningState: to.Ptr(armnetwork.ProvisioningStateSucceeded), - // RackID: to.Ptr("rackId1"), - // RouterName: to.Ptr("router1"), - // }, - // }, - // { - // ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/expressRoutePorts/portName/links/link2"), - // Name: to.Ptr("link2"), - // Properties: &armnetwork.ExpressRouteLinkPropertiesFormat{ - // AdminState: to.Ptr(armnetwork.ExpressRouteLinkAdminStateDisabled), - // ColoLocation: to.Ptr("coloLocation2"), - // ConnectorType: to.Ptr(armnetwork.ExpressRouteLinkConnectorTypeLC), - // InterfaceName: to.Ptr("Ethernet 0/0"), - // PatchPanelID: to.Ptr("patchPanelId2"), - // ProvisioningState: to.Ptr(armnetwork.ProvisioningStateSucceeded), - // RackID: to.Ptr("rackId2"), - // RouterName: to.Ptr("router2"), - // }, - // }}, - // Mtu: to.Ptr("1500"), - // PeeringLocation: to.Ptr("peeringLocationName"), - // ProvisionedBandwidthInGbps: to.Ptr[float32](0), - // ProvisioningState: to.Ptr(armnetwork.ProvisioningStateSucceeded), - // }, - // }}, - // } - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/4883fa5dbf6f2c9093fac8ce334547e9dfac68fa/specification/network/resource-manager/Microsoft.Network/stable/2024-03-01/examples/GenerateExpressRoutePortsLOA.json -func ExampleExpressRoutePortsClient_GenerateLOA() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armnetwork.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewExpressRoutePortsClient().GenerateLOA(ctx, "rg1", "portName", armnetwork.GenerateExpressRoutePortsLOARequest{ - CustomerName: to.Ptr("customerName"), - }, nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.GenerateExpressRoutePortsLOAResult = armnetwork.GenerateExpressRoutePortsLOAResult{ - // EncodedContent: to.Ptr("TWFuIGlzIGRpc3"), - // } -} diff --git a/sdk/resourcemanager/network/armnetwork/expressrouteportslocations_client_example_test.go b/sdk/resourcemanager/network/armnetwork/expressrouteportslocations_client_example_test.go deleted file mode 100644 index 7ee4f1db3eb5..000000000000 --- a/sdk/resourcemanager/network/armnetwork/expressrouteportslocations_client_example_test.go +++ /dev/null @@ -1,95 +0,0 @@ -//go:build go1.18 -// +build go1.18 - -// 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. -// DO NOT EDIT. - -package armnetwork_test - -import ( - "context" - "log" - - "github.com/Azure/azure-sdk-for-go/sdk/azidentity" - "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/network/armnetwork/v6" -) - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/4883fa5dbf6f2c9093fac8ce334547e9dfac68fa/specification/network/resource-manager/Microsoft.Network/stable/2024-03-01/examples/ExpressRoutePortsLocationList.json -func ExampleExpressRoutePortsLocationsClient_NewListPager() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armnetwork.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := clientFactory.NewExpressRoutePortsLocationsClient().NewListPager(nil) - for pager.More() { - page, err := pager.NextPage(ctx) - if err != nil { - log.Fatalf("failed to advance page: %v", err) - } - for _, v := range page.Value { - // You could use page here. We use blank identifier for just demo purposes. - _ = v - } - // If the HTTP response code is 200 as defined in example definition, your page structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // page.ExpressRoutePortsLocationListResult = armnetwork.ExpressRoutePortsLocationListResult{ - // Value: []*armnetwork.ExpressRoutePortsLocation{ - // { - // Name: to.Ptr("locationName"), - // Type: to.Ptr("Microsoft.Network/expressRoutePortsLocations"), - // ID: to.Ptr("/subscriptions/subid/providers/Microsoft.Network/expressRoutePortsLocations/locationName"), - // Location: to.Ptr("westus"), - // Properties: &armnetwork.ExpressRoutePortsLocationPropertiesFormat{ - // Address: to.Ptr("123 Main Street, City, State, Zip"), - // AvailableBandwidths: []*armnetwork.ExpressRoutePortsLocationBandwidths{ - // }, - // Contact: to.Ptr("email@address.com"), - // ProvisioningState: to.Ptr(armnetwork.ProvisioningStateSucceeded), - // }, - // }}, - // } - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/4883fa5dbf6f2c9093fac8ce334547e9dfac68fa/specification/network/resource-manager/Microsoft.Network/stable/2024-03-01/examples/ExpressRoutePortsLocationGet.json -func ExampleExpressRoutePortsLocationsClient_Get() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armnetwork.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewExpressRoutePortsLocationsClient().Get(ctx, "locationName", nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.ExpressRoutePortsLocation = armnetwork.ExpressRoutePortsLocation{ - // Name: to.Ptr("locationName"), - // Type: to.Ptr("Microsoft.Network/expressRoutePortsLocations"), - // ID: to.Ptr("/subscriptions/subid/providers/Microsoft.Network/expressRoutePortsLocations/locationName"), - // Location: to.Ptr("westus"), - // Properties: &armnetwork.ExpressRoutePortsLocationPropertiesFormat{ - // Address: to.Ptr("123 Main Street, City, State, Zip"), - // AvailableBandwidths: []*armnetwork.ExpressRoutePortsLocationBandwidths{ - // { - // OfferName: to.Ptr("100 Gbps"), - // ValueInGbps: to.Ptr[int32](100), - // }}, - // Contact: to.Ptr("email@address.com"), - // ProvisioningState: to.Ptr(armnetwork.ProvisioningStateSucceeded), - // }, - // } -} diff --git a/sdk/resourcemanager/network/armnetwork/expressrouteproviderportslocation_client_example_test.go b/sdk/resourcemanager/network/armnetwork/expressrouteproviderportslocation_client_example_test.go deleted file mode 100644 index a0a682b7946d..000000000000 --- a/sdk/resourcemanager/network/armnetwork/expressrouteproviderportslocation_client_example_test.go +++ /dev/null @@ -1,73 +0,0 @@ -//go:build go1.18 -// +build go1.18 - -// 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. -// DO NOT EDIT. - -package armnetwork_test - -import ( - "context" - "log" - - "github.com/Azure/azure-sdk-for-go/sdk/azidentity" - "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/network/armnetwork/v6" -) - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/4883fa5dbf6f2c9093fac8ce334547e9dfac68fa/specification/network/resource-manager/Microsoft.Network/stable/2024-03-01/examples/expressRouteProviderPortList.json -func ExampleExpressRouteProviderPortsLocationClient_List() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armnetwork.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewExpressRouteProviderPortsLocationClient().List(ctx, &armnetwork.ExpressRouteProviderPortsLocationClientListOptions{Filter: nil}) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.ExpressRouteProviderPortListResult = armnetwork.ExpressRouteProviderPortListResult{ - // Value: []*armnetwork.ExpressRouteProviderPort{ - // { - // Type: to.Ptr("Microsoft.Network/expressRouteProviderPort"), - // ID: to.Ptr("/subscriptions/subid/providers/Microsoft.Network/ExpressRoutePortsLocations/SiliconValley/bvtazureixpportpair1"), - // Location: to.Ptr("uswest"), - // Etag: to.Ptr("W/\"c0e6477e-8150-4d4f-9bf6-bb10e6acb63a\""), - // Properties: &armnetwork.ExpressRouteProviderPortProperties{ - // OverprovisionFactor: to.Ptr[int32](4), - // PeeringLocation: to.Ptr("SiliconValley"), - // PortBandwidthInMbps: to.Ptr[int32](4000), - // PortPairDescriptor: to.Ptr("bvtazureixpportpair1"), - // PrimaryAzurePort: to.Ptr("bvtazureixp01"), - // RemainingBandwidthInMbps: to.Ptr[int32](1500), - // SecondaryAzurePort: to.Ptr("bvtazureixp01"), - // UsedBandwidthInMbps: to.Ptr[int32](2500), - // }, - // }, - // { - // Type: to.Ptr("Microsoft.Network/expressRouteProviderPort"), - // ID: to.Ptr("/subscriptions/subid/providers/Microsoft.Network/ExpressRoutePortsLocations/SiliconValley/bvtazureixpportpair2"), - // Location: to.Ptr("uswest"), - // Etag: to.Ptr("W/\"c0e6477e-8150-4d4f-9bf6-bb10e6acb63a\""), - // Properties: &armnetwork.ExpressRouteProviderPortProperties{ - // OverprovisionFactor: to.Ptr[int32](4), - // PeeringLocation: to.Ptr("seattle"), - // PortBandwidthInMbps: to.Ptr[int32](4000), - // PortPairDescriptor: to.Ptr("bvtazureixpportpair2"), - // PrimaryAzurePort: to.Ptr("bvtazureixp02"), - // RemainingBandwidthInMbps: to.Ptr[int32](1800), - // SecondaryAzurePort: to.Ptr("bvtazureixp02"), - // UsedBandwidthInMbps: to.Ptr[int32](1200), - // }, - // }}, - // } -} diff --git a/sdk/resourcemanager/network/armnetwork/expressrouteserviceproviders_client_example_test.go b/sdk/resourcemanager/network/armnetwork/expressrouteserviceproviders_client_example_test.go deleted file mode 100644 index 4eb7624879ed..000000000000 --- a/sdk/resourcemanager/network/armnetwork/expressrouteserviceproviders_client_example_test.go +++ /dev/null @@ -1,90 +0,0 @@ -//go:build go1.18 -// +build go1.18 - -// 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. -// DO NOT EDIT. - -package armnetwork_test - -import ( - "context" - "log" - - "github.com/Azure/azure-sdk-for-go/sdk/azidentity" - "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/network/armnetwork/v6" -) - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/4883fa5dbf6f2c9093fac8ce334547e9dfac68fa/specification/network/resource-manager/Microsoft.Network/stable/2024-03-01/examples/ExpressRouteProviderList.json -func ExampleExpressRouteServiceProvidersClient_NewListPager() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armnetwork.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := clientFactory.NewExpressRouteServiceProvidersClient().NewListPager(nil) - for pager.More() { - page, err := pager.NextPage(ctx) - if err != nil { - log.Fatalf("failed to advance page: %v", err) - } - for _, v := range page.Value { - // You could use page here. We use blank identifier for just demo purposes. - _ = v - } - // If the HTTP response code is 200 as defined in example definition, your page structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // page.ExpressRouteServiceProviderListResult = armnetwork.ExpressRouteServiceProviderListResult{ - // Value: []*armnetwork.ExpressRouteServiceProvider{ - // { - // Name: to.Ptr("providerName"), - // Type: to.Ptr("Microsoft.Network/expressRouteServiceProviders"), - // ID: to.Ptr("/subscriptions//resourceGroups//providers/Microsoft.Network/expressRouteServiceProviders/"), - // Properties: &armnetwork.ExpressRouteServiceProviderPropertiesFormat{ - // BandwidthsOffered: []*armnetwork.ExpressRouteServiceProviderBandwidthsOffered{ - // { - // OfferName: to.Ptr("50Mbps"), - // ValueInMbps: to.Ptr[int32](50), - // }, - // { - // OfferName: to.Ptr("100Mbps"), - // ValueInMbps: to.Ptr[int32](100), - // }, - // { - // OfferName: to.Ptr("200Mbps"), - // ValueInMbps: to.Ptr[int32](200), - // }, - // { - // OfferName: to.Ptr("500Mbps"), - // ValueInMbps: to.Ptr[int32](500), - // }, - // { - // OfferName: to.Ptr("1Gbps"), - // ValueInMbps: to.Ptr[int32](1000), - // }, - // { - // OfferName: to.Ptr("2Gbps"), - // ValueInMbps: to.Ptr[int32](2000), - // }, - // { - // OfferName: to.Ptr("5Gbps"), - // ValueInMbps: to.Ptr[int32](5000), - // }, - // { - // OfferName: to.Ptr("10Gbps"), - // ValueInMbps: to.Ptr[int32](10000), - // }}, - // PeeringLocations: []*string{ - // to.Ptr("peeringLocation1"), - // to.Ptr("peeringLocation2")}, - // ProvisioningState: to.Ptr(armnetwork.ProvisioningStateSucceeded), - // }, - // }}, - // } - } -} diff --git a/sdk/resourcemanager/network/armnetwork/firewallpolicies_client_example_test.go b/sdk/resourcemanager/network/armnetwork/firewallpolicies_client_example_test.go deleted file mode 100644 index fffde228c143..000000000000 --- a/sdk/resourcemanager/network/armnetwork/firewallpolicies_client_example_test.go +++ /dev/null @@ -1,601 +0,0 @@ -//go:build go1.18 -// +build go1.18 - -// 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. -// DO NOT EDIT. - -package armnetwork_test - -import ( - "context" - "log" - - "github.com/Azure/azure-sdk-for-go/sdk/azcore/to" - "github.com/Azure/azure-sdk-for-go/sdk/azidentity" - "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/network/armnetwork/v6" -) - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/4883fa5dbf6f2c9093fac8ce334547e9dfac68fa/specification/network/resource-manager/Microsoft.Network/stable/2024-03-01/examples/FirewallPolicyDelete.json -func ExampleFirewallPoliciesClient_BeginDelete() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armnetwork.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewFirewallPoliciesClient().BeginDelete(ctx, "rg1", "firewallPolicy", nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - _, err = poller.PollUntilDone(ctx, nil) - if err != nil { - log.Fatalf("failed to pull the result: %v", err) - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/4883fa5dbf6f2c9093fac8ce334547e9dfac68fa/specification/network/resource-manager/Microsoft.Network/stable/2024-03-01/examples/FirewallPolicyGet.json -func ExampleFirewallPoliciesClient_Get() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armnetwork.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewFirewallPoliciesClient().Get(ctx, "rg1", "firewallPolicy", &armnetwork.FirewallPoliciesClientGetOptions{Expand: nil}) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.FirewallPolicy = armnetwork.FirewallPolicy{ - // Name: to.Ptr("firewallPolicy"), - // Type: to.Ptr("Microsoft.Network/firewallPolicies"), - // ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/firewallPolicies/firewallPolicy"), - // Location: to.Ptr("West US"), - // Tags: map[string]*string{ - // "key1": to.Ptr("value1"), - // }, - // Etag: to.Ptr("w/\\00000000-0000-0000-0000-000000000000\\"), - // Properties: &armnetwork.FirewallPolicyPropertiesFormat{ - // DNSSettings: &armnetwork.DNSSettings{ - // EnableProxy: to.Ptr(true), - // RequireProxyForNetworkRules: to.Ptr(false), - // Servers: []*string{ - // to.Ptr("30.3.4.5")}, - // }, - // Firewalls: []*armnetwork.SubResource{ - // }, - // Insights: &armnetwork.FirewallPolicyInsights{ - // IsEnabled: to.Ptr(true), - // LogAnalyticsResources: &armnetwork.FirewallPolicyLogAnalyticsResources{ - // DefaultWorkspaceID: &armnetwork.SubResource{ - // ID: to.Ptr("/subscriptions/subid/resourcegroups/rg1/providers/microsoft.operationalinsights/workspaces/defaultWorkspace"), - // }, - // Workspaces: []*armnetwork.FirewallPolicyLogAnalyticsWorkspace{ - // { - // Region: to.Ptr("westus"), - // WorkspaceID: &armnetwork.SubResource{ - // ID: to.Ptr("/subscriptions/subid/resourcegroups/rg1/providers/microsoft.operationalinsights/workspaces/workspace1"), - // }, - // }, - // { - // Region: to.Ptr("eastus"), - // WorkspaceID: &armnetwork.SubResource{ - // ID: to.Ptr("/subscriptions/subid/resourcegroups/rg1/providers/microsoft.operationalinsights/workspaces/workspace2"), - // }, - // }}, - // }, - // RetentionDays: to.Ptr[int32](100), - // }, - // IntrusionDetection: &armnetwork.FirewallPolicyIntrusionDetection{ - // Configuration: &armnetwork.FirewallPolicyIntrusionDetectionConfiguration{ - // BypassTrafficSettings: []*armnetwork.FirewallPolicyIntrusionDetectionBypassTrafficSpecifications{ - // { - // Name: to.Ptr("bypassRule1"), - // Description: to.Ptr("Rule 1"), - // DestinationAddresses: []*string{ - // to.Ptr("5.6.7.8")}, - // DestinationPorts: []*string{ - // to.Ptr("*")}, - // SourceAddresses: []*string{ - // to.Ptr("1.2.3.4")}, - // Protocol: to.Ptr(armnetwork.FirewallPolicyIntrusionDetectionProtocolTCP), - // }}, - // SignatureOverrides: []*armnetwork.FirewallPolicyIntrusionDetectionSignatureSpecification{ - // { - // ID: to.Ptr("2525004"), - // Mode: to.Ptr(armnetwork.FirewallPolicyIntrusionDetectionStateTypeDeny), - // }}, - // }, - // Mode: to.Ptr(armnetwork.FirewallPolicyIntrusionDetectionStateTypeAlert), - // }, - // ProvisioningState: to.Ptr(armnetwork.ProvisioningStateSucceeded), - // RuleCollectionGroups: []*armnetwork.SubResource{ - // { - // ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/firewallPolicies/firewallPolicy/ruleCollectionGroups/ruleCollectionGroup1"), - // }}, - // Size: to.Ptr("0.5MB"), - // SKU: &armnetwork.FirewallPolicySKU{ - // Tier: to.Ptr(armnetwork.FirewallPolicySKUTierPremium), - // }, - // Snat: &armnetwork.FirewallPolicySNAT{ - // PrivateRanges: []*string{ - // to.Ptr("IANAPrivateRanges")}, - // }, - // SQL: &armnetwork.FirewallPolicySQL{ - // AllowSQLRedirect: to.Ptr(true), - // }, - // ThreatIntelMode: to.Ptr(armnetwork.AzureFirewallThreatIntelModeAlert), - // ThreatIntelWhitelist: &armnetwork.FirewallPolicyThreatIntelWhitelist{ - // Fqdns: []*string{ - // to.Ptr("*.microsoft.com")}, - // IPAddresses: []*string{ - // to.Ptr("20.3.4.5")}, - // }, - // TransportSecurity: &armnetwork.FirewallPolicyTransportSecurity{ - // CertificateAuthority: &armnetwork.FirewallPolicyCertificateAuthority{ - // Name: to.Ptr("clientcert"), - // KeyVaultSecretID: to.Ptr("https://kv/secret"), - // }, - // }, - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/4883fa5dbf6f2c9093fac8ce334547e9dfac68fa/specification/network/resource-manager/Microsoft.Network/stable/2024-03-01/examples/FirewallPolicyPut.json -func ExampleFirewallPoliciesClient_BeginCreateOrUpdate() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armnetwork.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewFirewallPoliciesClient().BeginCreateOrUpdate(ctx, "rg1", "firewallPolicy", armnetwork.FirewallPolicy{ - Location: to.Ptr("West US"), - Tags: map[string]*string{ - "key1": to.Ptr("value1"), - }, - Properties: &armnetwork.FirewallPolicyPropertiesFormat{ - DNSSettings: &armnetwork.DNSSettings{ - EnableProxy: to.Ptr(true), - RequireProxyForNetworkRules: to.Ptr(false), - Servers: []*string{ - to.Ptr("30.3.4.5")}, - }, - Insights: &armnetwork.FirewallPolicyInsights{ - IsEnabled: to.Ptr(true), - LogAnalyticsResources: &armnetwork.FirewallPolicyLogAnalyticsResources{ - DefaultWorkspaceID: &armnetwork.SubResource{ - ID: to.Ptr("/subscriptions/subid/resourcegroups/rg1/providers/microsoft.operationalinsights/workspaces/defaultWorkspace"), - }, - Workspaces: []*armnetwork.FirewallPolicyLogAnalyticsWorkspace{ - { - Region: to.Ptr("westus"), - WorkspaceID: &armnetwork.SubResource{ - ID: to.Ptr("/subscriptions/subid/resourcegroups/rg1/providers/microsoft.operationalinsights/workspaces/workspace1"), - }, - }, - { - Region: to.Ptr("eastus"), - WorkspaceID: &armnetwork.SubResource{ - ID: to.Ptr("/subscriptions/subid/resourcegroups/rg1/providers/microsoft.operationalinsights/workspaces/workspace2"), - }, - }}, - }, - RetentionDays: to.Ptr[int32](100), - }, - IntrusionDetection: &armnetwork.FirewallPolicyIntrusionDetection{ - Configuration: &armnetwork.FirewallPolicyIntrusionDetectionConfiguration{ - BypassTrafficSettings: []*armnetwork.FirewallPolicyIntrusionDetectionBypassTrafficSpecifications{ - { - Name: to.Ptr("bypassRule1"), - Description: to.Ptr("Rule 1"), - DestinationAddresses: []*string{ - to.Ptr("5.6.7.8")}, - DestinationPorts: []*string{ - to.Ptr("*")}, - SourceAddresses: []*string{ - to.Ptr("1.2.3.4")}, - Protocol: to.Ptr(armnetwork.FirewallPolicyIntrusionDetectionProtocolTCP), - }}, - SignatureOverrides: []*armnetwork.FirewallPolicyIntrusionDetectionSignatureSpecification{ - { - ID: to.Ptr("2525004"), - Mode: to.Ptr(armnetwork.FirewallPolicyIntrusionDetectionStateTypeDeny), - }}, - }, - Mode: to.Ptr(armnetwork.FirewallPolicyIntrusionDetectionStateTypeAlert), - Profile: to.Ptr(armnetwork.FirewallPolicyIntrusionDetectionProfileType("Balanced")), - }, - SKU: &armnetwork.FirewallPolicySKU{ - Tier: to.Ptr(armnetwork.FirewallPolicySKUTierPremium), - }, - Snat: &armnetwork.FirewallPolicySNAT{ - PrivateRanges: []*string{ - to.Ptr("IANAPrivateRanges")}, - }, - SQL: &armnetwork.FirewallPolicySQL{ - AllowSQLRedirect: to.Ptr(true), - }, - ThreatIntelMode: to.Ptr(armnetwork.AzureFirewallThreatIntelModeAlert), - ThreatIntelWhitelist: &armnetwork.FirewallPolicyThreatIntelWhitelist{ - Fqdns: []*string{ - to.Ptr("*.microsoft.com")}, - IPAddresses: []*string{ - to.Ptr("20.3.4.5")}, - }, - TransportSecurity: &armnetwork.FirewallPolicyTransportSecurity{ - CertificateAuthority: &armnetwork.FirewallPolicyCertificateAuthority{ - Name: to.Ptr("clientcert"), - KeyVaultSecretID: to.Ptr("https://kv/secret"), - }, - }, - }, - }, nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - res, err := poller.PollUntilDone(ctx, nil) - if err != nil { - log.Fatalf("failed to pull the result: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.FirewallPolicy = armnetwork.FirewallPolicy{ - // Name: to.Ptr("firewallPolicy"), - // Type: to.Ptr("Microsoft.Network/firewallPolicies"), - // ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/firewallPolicies/firewallPolicy"), - // Location: to.Ptr("West US"), - // Tags: map[string]*string{ - // "key1": to.Ptr("value1"), - // }, - // Etag: to.Ptr("w/\\00000000-0000-0000-0000-000000000000\\"), - // Properties: &armnetwork.FirewallPolicyPropertiesFormat{ - // DNSSettings: &armnetwork.DNSSettings{ - // EnableProxy: to.Ptr(true), - // RequireProxyForNetworkRules: to.Ptr(false), - // Servers: []*string{ - // to.Ptr("30.3.4.5")}, - // }, - // Firewalls: []*armnetwork.SubResource{ - // }, - // Insights: &armnetwork.FirewallPolicyInsights{ - // IsEnabled: to.Ptr(true), - // LogAnalyticsResources: &armnetwork.FirewallPolicyLogAnalyticsResources{ - // DefaultWorkspaceID: &armnetwork.SubResource{ - // ID: to.Ptr("/subscriptions/subid/resourcegroups/rg1/providers/microsoft.operationalinsights/workspaces/defaultWorkspace"), - // }, - // Workspaces: []*armnetwork.FirewallPolicyLogAnalyticsWorkspace{ - // { - // Region: to.Ptr("westus"), - // WorkspaceID: &armnetwork.SubResource{ - // ID: to.Ptr("/subscriptions/subid/resourcegroups/rg1/providers/microsoft.operationalinsights/workspaces/workspace1"), - // }, - // }, - // { - // Region: to.Ptr("eastus"), - // WorkspaceID: &armnetwork.SubResource{ - // ID: to.Ptr("/subscriptions/subid/resourcegroups/rg1/providers/microsoft.operationalinsights/workspaces/workspace2"), - // }, - // }}, - // }, - // RetentionDays: to.Ptr[int32](100), - // }, - // IntrusionDetection: &armnetwork.FirewallPolicyIntrusionDetection{ - // Configuration: &armnetwork.FirewallPolicyIntrusionDetectionConfiguration{ - // BypassTrafficSettings: []*armnetwork.FirewallPolicyIntrusionDetectionBypassTrafficSpecifications{ - // { - // Name: to.Ptr("bypassRule1"), - // Description: to.Ptr("Rule 1"), - // DestinationAddresses: []*string{ - // to.Ptr("5.6.7.8")}, - // DestinationPorts: []*string{ - // to.Ptr("*")}, - // SourceAddresses: []*string{ - // to.Ptr("1.2.3.4")}, - // Protocol: to.Ptr(armnetwork.FirewallPolicyIntrusionDetectionProtocolTCP), - // }}, - // SignatureOverrides: []*armnetwork.FirewallPolicyIntrusionDetectionSignatureSpecification{ - // { - // ID: to.Ptr("2525004"), - // Mode: to.Ptr(armnetwork.FirewallPolicyIntrusionDetectionStateTypeDeny), - // }}, - // }, - // Mode: to.Ptr(armnetwork.FirewallPolicyIntrusionDetectionStateTypeAlert), - // Profile: to.Ptr(armnetwork.FirewallPolicyIntrusionDetectionProfileType("Balanced")), - // }, - // ProvisioningState: to.Ptr(armnetwork.ProvisioningStateSucceeded), - // RuleCollectionGroups: []*armnetwork.SubResource{ - // { - // ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/firewallPolicies/firewallPolicy/ruleCollectionGroups/ruleCollectionGroup1"), - // }, - // { - // ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/firewallPolicies/firewallPolicy/ruleCollectionGroups/ruleCollectionGroup2"), - // }}, - // Size: to.Ptr("0.5MB"), - // SKU: &armnetwork.FirewallPolicySKU{ - // Tier: to.Ptr(armnetwork.FirewallPolicySKUTierPremium), - // }, - // Snat: &armnetwork.FirewallPolicySNAT{ - // PrivateRanges: []*string{ - // to.Ptr("IANAPrivateRanges")}, - // }, - // SQL: &armnetwork.FirewallPolicySQL{ - // AllowSQLRedirect: to.Ptr(true), - // }, - // ThreatIntelMode: to.Ptr(armnetwork.AzureFirewallThreatIntelModeAlert), - // ThreatIntelWhitelist: &armnetwork.FirewallPolicyThreatIntelWhitelist{ - // Fqdns: []*string{ - // to.Ptr("*.microsoft.com")}, - // IPAddresses: []*string{ - // to.Ptr("20.3.4.5")}, - // }, - // TransportSecurity: &armnetwork.FirewallPolicyTransportSecurity{ - // CertificateAuthority: &armnetwork.FirewallPolicyCertificateAuthority{ - // Name: to.Ptr("clientcert"), - // KeyVaultSecretID: to.Ptr("https://kv/secret"), - // }, - // }, - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/4883fa5dbf6f2c9093fac8ce334547e9dfac68fa/specification/network/resource-manager/Microsoft.Network/stable/2024-03-01/examples/FirewallPolicyPatch.json -func ExampleFirewallPoliciesClient_UpdateTags() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armnetwork.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewFirewallPoliciesClient().UpdateTags(ctx, "myResourceGroup", "firewallPolicy", armnetwork.TagsObject{ - Tags: map[string]*string{ - "key1": to.Ptr("value1"), - "key2": to.Ptr("value2"), - }, - }, nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.FirewallPolicy = armnetwork.FirewallPolicy{ - // Name: to.Ptr("firewallPolicy"), - // Type: to.Ptr("Microsoft.Network/firewallPolicies"), - // ID: to.Ptr("/subscriptions/subId/resourceGroups/myResourceGroup/providers/Microsoft.Network/firewallPolicies/firewallPolicy"), - // Location: to.Ptr("West US"), - // Tags: map[string]*string{ - // "key1": to.Ptr("value1"), - // "key2": to.Ptr("value2"), - // }, - // Etag: to.Ptr("w/\\00000000-0000-0000-0000-000000000000\\"), - // Properties: &armnetwork.FirewallPolicyPropertiesFormat{ - // DNSSettings: &armnetwork.DNSSettings{ - // EnableProxy: to.Ptr(true), - // RequireProxyForNetworkRules: to.Ptr(false), - // Servers: []*string{ - // to.Ptr("30.3.4.5")}, - // }, - // Firewalls: []*armnetwork.SubResource{ - // }, - // Insights: &armnetwork.FirewallPolicyInsights{ - // IsEnabled: to.Ptr(true), - // LogAnalyticsResources: &armnetwork.FirewallPolicyLogAnalyticsResources{ - // DefaultWorkspaceID: &armnetwork.SubResource{ - // ID: to.Ptr("/subscriptions/subid/resourcegroups/rg1/providers/microsoft.operationalinsights/workspaces/defaultWorkspace"), - // }, - // Workspaces: []*armnetwork.FirewallPolicyLogAnalyticsWorkspace{ - // { - // Region: to.Ptr("westus"), - // WorkspaceID: &armnetwork.SubResource{ - // ID: to.Ptr("/subscriptions/subid/resourcegroups/rg1/providers/microsoft.operationalinsights/workspaces/workspace1"), - // }, - // }, - // { - // Region: to.Ptr("eastus"), - // WorkspaceID: &armnetwork.SubResource{ - // ID: to.Ptr("/subscriptions/subid/resourcegroups/rg1/providers/microsoft.operationalinsights/workspaces/workspace2"), - // }, - // }}, - // }, - // RetentionDays: to.Ptr[int32](100), - // }, - // IntrusionDetection: &armnetwork.FirewallPolicyIntrusionDetection{ - // Configuration: &armnetwork.FirewallPolicyIntrusionDetectionConfiguration{ - // BypassTrafficSettings: []*armnetwork.FirewallPolicyIntrusionDetectionBypassTrafficSpecifications{ - // { - // Name: to.Ptr("bypassRule1"), - // Description: to.Ptr("Rule 1"), - // DestinationAddresses: []*string{ - // to.Ptr("5.6.7.8")}, - // DestinationPorts: []*string{ - // to.Ptr("*")}, - // SourceAddresses: []*string{ - // to.Ptr("1.2.3.4")}, - // Protocol: to.Ptr(armnetwork.FirewallPolicyIntrusionDetectionProtocolTCP), - // }}, - // SignatureOverrides: []*armnetwork.FirewallPolicyIntrusionDetectionSignatureSpecification{ - // { - // ID: to.Ptr("2525004"), - // Mode: to.Ptr(armnetwork.FirewallPolicyIntrusionDetectionStateTypeDeny), - // }}, - // }, - // Mode: to.Ptr(armnetwork.FirewallPolicyIntrusionDetectionStateTypeAlert), - // }, - // ProvisioningState: to.Ptr(armnetwork.ProvisioningStateSucceeded), - // RuleCollectionGroups: []*armnetwork.SubResource{ - // { - // ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/firewallPolicies/firewallPolicy/ruleCollectionGroups/ruleCollectionGroup1"), - // }}, - // SKU: &armnetwork.FirewallPolicySKU{ - // Tier: to.Ptr(armnetwork.FirewallPolicySKUTierPremium), - // }, - // Snat: &armnetwork.FirewallPolicySNAT{ - // PrivateRanges: []*string{ - // to.Ptr("IANAPrivateRanges")}, - // }, - // SQL: &armnetwork.FirewallPolicySQL{ - // AllowSQLRedirect: to.Ptr(true), - // }, - // ThreatIntelMode: to.Ptr(armnetwork.AzureFirewallThreatIntelModeAlert), - // ThreatIntelWhitelist: &armnetwork.FirewallPolicyThreatIntelWhitelist{ - // Fqdns: []*string{ - // to.Ptr("*.microsoft.com")}, - // IPAddresses: []*string{ - // to.Ptr("20.3.4.5")}, - // }, - // TransportSecurity: &armnetwork.FirewallPolicyTransportSecurity{ - // CertificateAuthority: &armnetwork.FirewallPolicyCertificateAuthority{ - // Name: to.Ptr("clientcert"), - // KeyVaultSecretID: to.Ptr("https://kv/secret"), - // }, - // }, - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/4883fa5dbf6f2c9093fac8ce334547e9dfac68fa/specification/network/resource-manager/Microsoft.Network/stable/2024-03-01/examples/FirewallPolicyListByResourceGroup.json -func ExampleFirewallPoliciesClient_NewListPager() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armnetwork.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := clientFactory.NewFirewallPoliciesClient().NewListPager("rg1", nil) - for pager.More() { - page, err := pager.NextPage(ctx) - if err != nil { - log.Fatalf("failed to advance page: %v", err) - } - for _, v := range page.Value { - // You could use page here. We use blank identifier for just demo purposes. - _ = v - } - // If the HTTP response code is 200 as defined in example definition, your page structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // page.FirewallPolicyListResult = armnetwork.FirewallPolicyListResult{ - // Value: []*armnetwork.FirewallPolicy{ - // { - // Name: to.Ptr("firewallPolicy"), - // Type: to.Ptr("Microsoft.Network/firewallPolicies"), - // ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/firewallPolicies/firewallPolicy"), - // Location: to.Ptr("West US"), - // Tags: map[string]*string{ - // "key1": to.Ptr("value1"), - // }, - // Etag: to.Ptr("w/\\00000000-0000-0000-0000-000000000000\\"), - // Properties: &armnetwork.FirewallPolicyPropertiesFormat{ - // DNSSettings: &armnetwork.DNSSettings{ - // EnableProxy: to.Ptr(true), - // RequireProxyForNetworkRules: to.Ptr(false), - // Servers: []*string{ - // to.Ptr("30.3.4.5")}, - // }, - // Firewalls: []*armnetwork.SubResource{ - // }, - // ProvisioningState: to.Ptr(armnetwork.ProvisioningStateSucceeded), - // RuleCollectionGroups: []*armnetwork.SubResource{ - // { - // ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/firewallPolicies/firewallPolicy/ruleCollectionGroups/ruleCollectionGroup1"), - // }}, - // SKU: &armnetwork.FirewallPolicySKU{ - // Tier: to.Ptr(armnetwork.FirewallPolicySKUTierStandard), - // }, - // Snat: &armnetwork.FirewallPolicySNAT{ - // PrivateRanges: []*string{ - // to.Ptr("IANAPrivateRanges")}, - // }, - // SQL: &armnetwork.FirewallPolicySQL{ - // AllowSQLRedirect: to.Ptr(true), - // }, - // ThreatIntelMode: to.Ptr(armnetwork.AzureFirewallThreatIntelModeAlert), - // }, - // }}, - // } - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/4883fa5dbf6f2c9093fac8ce334547e9dfac68fa/specification/network/resource-manager/Microsoft.Network/stable/2024-03-01/examples/FirewallPolicyListBySubscription.json -func ExampleFirewallPoliciesClient_NewListAllPager() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armnetwork.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := clientFactory.NewFirewallPoliciesClient().NewListAllPager(nil) - for pager.More() { - page, err := pager.NextPage(ctx) - if err != nil { - log.Fatalf("failed to advance page: %v", err) - } - for _, v := range page.Value { - // You could use page here. We use blank identifier for just demo purposes. - _ = v - } - // If the HTTP response code is 200 as defined in example definition, your page structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // page.FirewallPolicyListResult = armnetwork.FirewallPolicyListResult{ - // Value: []*armnetwork.FirewallPolicy{ - // { - // Name: to.Ptr("firewallPolicy"), - // Type: to.Ptr("Microsoft.Network/firewallPolicies"), - // ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/firewallPolicies/firewallPolicy"), - // Location: to.Ptr("West US"), - // Tags: map[string]*string{ - // "key1": to.Ptr("value1"), - // }, - // Etag: to.Ptr("w/\\00000000-0000-0000-0000-000000000000\\"), - // Properties: &armnetwork.FirewallPolicyPropertiesFormat{ - // DNSSettings: &armnetwork.DNSSettings{ - // EnableProxy: to.Ptr(true), - // RequireProxyForNetworkRules: to.Ptr(false), - // Servers: []*string{ - // to.Ptr("30.3.4.5")}, - // }, - // Firewalls: []*armnetwork.SubResource{ - // }, - // ProvisioningState: to.Ptr(armnetwork.ProvisioningStateSucceeded), - // RuleCollectionGroups: []*armnetwork.SubResource{ - // { - // ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/firewallPolicies/firewallPolicy/ruleCollectionGroups/ruleCollectionGroup1"), - // }}, - // SKU: &armnetwork.FirewallPolicySKU{ - // Tier: to.Ptr(armnetwork.FirewallPolicySKUTierStandard), - // }, - // Snat: &armnetwork.FirewallPolicySNAT{ - // PrivateRanges: []*string{ - // to.Ptr("IANAPrivateRanges")}, - // }, - // SQL: &armnetwork.FirewallPolicySQL{ - // AllowSQLRedirect: to.Ptr(true), - // }, - // ThreatIntelMode: to.Ptr(armnetwork.AzureFirewallThreatIntelModeAlert), - // }, - // }}, - // } - } -} diff --git a/sdk/resourcemanager/network/armnetwork/firewallpolicydeployments_client_example_test.go b/sdk/resourcemanager/network/armnetwork/firewallpolicydeployments_client_example_test.go deleted file mode 100644 index 37b88b221590..000000000000 --- a/sdk/resourcemanager/network/armnetwork/firewallpolicydeployments_client_example_test.go +++ /dev/null @@ -1,39 +0,0 @@ -//go:build go1.18 -// +build go1.18 - -// 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. -// DO NOT EDIT. - -package armnetwork_test - -import ( - "context" - "log" - - "github.com/Azure/azure-sdk-for-go/sdk/azidentity" - "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/network/armnetwork/v6" -) - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/4883fa5dbf6f2c9093fac8ce334547e9dfac68fa/specification/network/resource-manager/Microsoft.Network/stable/2024-03-01/examples/FirewallPolicyDraftDeploy.json -func ExampleFirewallPolicyDeploymentsClient_BeginDeploy() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armnetwork.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewFirewallPolicyDeploymentsClient().BeginDeploy(ctx, "rg1", "firewallPolicy", nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - _, err = poller.PollUntilDone(ctx, nil) - if err != nil { - log.Fatalf("failed to pull the result: %v", err) - } -} diff --git a/sdk/resourcemanager/network/armnetwork/firewallpolicydrafts_client_example_test.go b/sdk/resourcemanager/network/armnetwork/firewallpolicydrafts_client_example_test.go deleted file mode 100644 index f4ddf7751058..000000000000 --- a/sdk/resourcemanager/network/armnetwork/firewallpolicydrafts_client_example_test.go +++ /dev/null @@ -1,311 +0,0 @@ -//go:build go1.18 -// +build go1.18 - -// 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. -// DO NOT EDIT. - -package armnetwork_test - -import ( - "context" - "log" - - "github.com/Azure/azure-sdk-for-go/sdk/azcore/to" - "github.com/Azure/azure-sdk-for-go/sdk/azidentity" - "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/network/armnetwork/v6" -) - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/4883fa5dbf6f2c9093fac8ce334547e9dfac68fa/specification/network/resource-manager/Microsoft.Network/stable/2024-03-01/examples/FirewallPolicyDraftPut.json -func ExampleFirewallPolicyDraftsClient_CreateOrUpdate() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armnetwork.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewFirewallPolicyDraftsClient().CreateOrUpdate(ctx, "rg1", "firewallPolicy", armnetwork.FirewallPolicyDraft{ - Properties: &armnetwork.FirewallPolicyDraftProperties{ - DNSSettings: &armnetwork.DNSSettings{ - EnableProxy: to.Ptr(true), - RequireProxyForNetworkRules: to.Ptr(false), - Servers: []*string{ - to.Ptr("30.3.4.5")}, - }, - ExplicitProxy: &armnetwork.ExplicitProxySettings{ - EnableExplicitProxy: to.Ptr(true), - EnablePacFile: to.Ptr(true), - HTTPPort: to.Ptr[int32](8087), - HTTPSPort: to.Ptr[int32](8087), - PacFile: to.Ptr("https://tinawstorage.file.core.windows.net/?sv=2020-02-10&ss=bfqt&srt=sco&sp=rwdlacuptfx&se=2021-06-04T07:01:12Z&st=2021-06-03T23:01:12Z&sip=68.65.171.11&spr=https&sig=Plsa0RRVpGbY0IETZZOT6znOHcSro71LLTTbzquYPgs%3D"), - PacFilePort: to.Ptr[int32](8087), - }, - Insights: &armnetwork.FirewallPolicyInsights{ - IsEnabled: to.Ptr(true), - LogAnalyticsResources: &armnetwork.FirewallPolicyLogAnalyticsResources{ - DefaultWorkspaceID: &armnetwork.SubResource{ - ID: to.Ptr("/subscriptions/subid/resourcegroups/rg1/providers/microsoft.operationalinsights/workspaces/defaultWorkspace"), - }, - Workspaces: []*armnetwork.FirewallPolicyLogAnalyticsWorkspace{ - { - Region: to.Ptr("westus"), - WorkspaceID: &armnetwork.SubResource{ - ID: to.Ptr("/subscriptions/subid/resourcegroups/rg1/providers/microsoft.operationalinsights/workspaces/workspace1"), - }, - }, - { - Region: to.Ptr("eastus"), - WorkspaceID: &armnetwork.SubResource{ - ID: to.Ptr("/subscriptions/subid/resourcegroups/rg1/providers/microsoft.operationalinsights/workspaces/workspace2"), - }, - }}, - }, - RetentionDays: to.Ptr[int32](100), - }, - IntrusionDetection: &armnetwork.FirewallPolicyIntrusionDetection{ - Configuration: &armnetwork.FirewallPolicyIntrusionDetectionConfiguration{ - BypassTrafficSettings: []*armnetwork.FirewallPolicyIntrusionDetectionBypassTrafficSpecifications{ - { - Name: to.Ptr("bypassRule1"), - Description: to.Ptr("Rule 1"), - DestinationAddresses: []*string{ - to.Ptr("5.6.7.8")}, - DestinationPorts: []*string{ - to.Ptr("*")}, - SourceAddresses: []*string{ - to.Ptr("1.2.3.4")}, - Protocol: to.Ptr(armnetwork.FirewallPolicyIntrusionDetectionProtocolTCP), - }}, - SignatureOverrides: []*armnetwork.FirewallPolicyIntrusionDetectionSignatureSpecification{ - { - ID: to.Ptr("2525004"), - Mode: to.Ptr(armnetwork.FirewallPolicyIntrusionDetectionStateTypeDeny), - }}, - }, - Mode: to.Ptr(armnetwork.FirewallPolicyIntrusionDetectionStateTypeAlert), - Profile: to.Ptr(armnetwork.FirewallPolicyIntrusionDetectionProfileType("Balanced")), - }, - Snat: &armnetwork.FirewallPolicySNAT{ - PrivateRanges: []*string{ - to.Ptr("IANAPrivateRanges")}, - }, - SQL: &armnetwork.FirewallPolicySQL{ - AllowSQLRedirect: to.Ptr(true), - }, - ThreatIntelMode: to.Ptr(armnetwork.AzureFirewallThreatIntelModeAlert), - ThreatIntelWhitelist: &armnetwork.FirewallPolicyThreatIntelWhitelist{ - Fqdns: []*string{ - to.Ptr("*.microsoft.com")}, - IPAddresses: []*string{ - to.Ptr("20.3.4.5")}, - }, - }, - }, nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.FirewallPolicyDraft = armnetwork.FirewallPolicyDraft{ - // Name: to.Ptr("firewallPolicy"), - // Type: to.Ptr("Microsoft.Network/firewallPolicies"), - // ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/firewallPolicies/firewallPolicy"), - // Properties: &armnetwork.FirewallPolicyDraftProperties{ - // DNSSettings: &armnetwork.DNSSettings{ - // EnableProxy: to.Ptr(true), - // RequireProxyForNetworkRules: to.Ptr(false), - // Servers: []*string{ - // to.Ptr("30.3.4.5")}, - // }, - // ExplicitProxy: &armnetwork.ExplicitProxySettings{ - // EnableExplicitProxy: to.Ptr(true), - // EnablePacFile: to.Ptr(true), - // HTTPPort: to.Ptr[int32](8087), - // HTTPSPort: to.Ptr[int32](8087), - // PacFile: to.Ptr("https://tinawstorage.file.core.windows.net/?sv=2020-02-10&ss=bfqt&srt=sco&sp=rwdlacuptfx&se=2021-06-04T07:01:12Z&st=2021-06-03T23:01:12Z&sip=68.65.171.11&spr=https&sig=Plsa0RRVpGbY0IETZZOT6znOHcSro71LLTTbzquYPgs%3D"), - // PacFilePort: to.Ptr[int32](8087), - // }, - // Insights: &armnetwork.FirewallPolicyInsights{ - // IsEnabled: to.Ptr(true), - // LogAnalyticsResources: &armnetwork.FirewallPolicyLogAnalyticsResources{ - // DefaultWorkspaceID: &armnetwork.SubResource{ - // ID: to.Ptr("/subscriptions/subid/resourcegroups/rg1/providers/microsoft.operationalinsights/workspaces/defaultWorkspace"), - // }, - // Workspaces: []*armnetwork.FirewallPolicyLogAnalyticsWorkspace{ - // { - // Region: to.Ptr("westus"), - // WorkspaceID: &armnetwork.SubResource{ - // ID: to.Ptr("/subscriptions/subid/resourcegroups/rg1/providers/microsoft.operationalinsights/workspaces/workspace1"), - // }, - // }, - // { - // Region: to.Ptr("eastus"), - // WorkspaceID: &armnetwork.SubResource{ - // ID: to.Ptr("/subscriptions/subid/resourcegroups/rg1/providers/microsoft.operationalinsights/workspaces/workspace2"), - // }, - // }}, - // }, - // RetentionDays: to.Ptr[int32](100), - // }, - // IntrusionDetection: &armnetwork.FirewallPolicyIntrusionDetection{ - // Configuration: &armnetwork.FirewallPolicyIntrusionDetectionConfiguration{ - // BypassTrafficSettings: []*armnetwork.FirewallPolicyIntrusionDetectionBypassTrafficSpecifications{ - // { - // Name: to.Ptr("bypassRule1"), - // Description: to.Ptr("Rule 1"), - // DestinationAddresses: []*string{ - // to.Ptr("5.6.7.8")}, - // DestinationPorts: []*string{ - // to.Ptr("*")}, - // SourceAddresses: []*string{ - // to.Ptr("1.2.3.4")}, - // Protocol: to.Ptr(armnetwork.FirewallPolicyIntrusionDetectionProtocolTCP), - // }}, - // SignatureOverrides: []*armnetwork.FirewallPolicyIntrusionDetectionSignatureSpecification{ - // { - // ID: to.Ptr("2525004"), - // Mode: to.Ptr(armnetwork.FirewallPolicyIntrusionDetectionStateTypeDeny), - // }}, - // }, - // Mode: to.Ptr(armnetwork.FirewallPolicyIntrusionDetectionStateTypeAlert), - // Profile: to.Ptr(armnetwork.FirewallPolicyIntrusionDetectionProfileType("Balanced")), - // }, - // Snat: &armnetwork.FirewallPolicySNAT{ - // PrivateRanges: []*string{ - // to.Ptr("IANAPrivateRanges")}, - // }, - // SQL: &armnetwork.FirewallPolicySQL{ - // AllowSQLRedirect: to.Ptr(true), - // }, - // ThreatIntelMode: to.Ptr(armnetwork.AzureFirewallThreatIntelModeAlert), - // ThreatIntelWhitelist: &armnetwork.FirewallPolicyThreatIntelWhitelist{ - // Fqdns: []*string{ - // to.Ptr("*.microsoft.com")}, - // IPAddresses: []*string{ - // to.Ptr("20.3.4.5")}, - // }, - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/4883fa5dbf6f2c9093fac8ce334547e9dfac68fa/specification/network/resource-manager/Microsoft.Network/stable/2024-03-01/examples/FirewallPolicyDraftDelete.json -func ExampleFirewallPolicyDraftsClient_Delete() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armnetwork.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - _, err = clientFactory.NewFirewallPolicyDraftsClient().Delete(ctx, "rg1", "firewallPolicy", nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/4883fa5dbf6f2c9093fac8ce334547e9dfac68fa/specification/network/resource-manager/Microsoft.Network/stable/2024-03-01/examples/FirewallPolicyDraftGet.json -func ExampleFirewallPolicyDraftsClient_Get() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armnetwork.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewFirewallPolicyDraftsClient().Get(ctx, "rg1", "firewallPolicy", nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.FirewallPolicyDraft = armnetwork.FirewallPolicyDraft{ - // Name: to.Ptr("firewallPolicy"), - // Type: to.Ptr("Microsoft.Network/firewallPolicies"), - // ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/firewallPolicies/firewallPolicy"), - // Properties: &armnetwork.FirewallPolicyDraftProperties{ - // DNSSettings: &armnetwork.DNSSettings{ - // EnableProxy: to.Ptr(true), - // RequireProxyForNetworkRules: to.Ptr(false), - // Servers: []*string{ - // to.Ptr("30.3.4.5")}, - // }, - // ExplicitProxy: &armnetwork.ExplicitProxySettings{ - // EnableExplicitProxy: to.Ptr(true), - // EnablePacFile: to.Ptr(true), - // HTTPPort: to.Ptr[int32](8087), - // HTTPSPort: to.Ptr[int32](8087), - // PacFile: to.Ptr("https://tinawstorage.file.core.windows.net/?sv=2020-02-10&ss=bfqt&srt=sco&sp=rwdlacuptfx&se=2021-06-04T07:01:12Z&st=2021-06-03T23:01:12Z&sip=68.65.171.11&spr=https&sig=Plsa0RRVpGbY0IETZZOT6znOHcSro71LLTTbzquYPgs%3D"), - // PacFilePort: to.Ptr[int32](8087), - // }, - // Insights: &armnetwork.FirewallPolicyInsights{ - // IsEnabled: to.Ptr(true), - // LogAnalyticsResources: &armnetwork.FirewallPolicyLogAnalyticsResources{ - // DefaultWorkspaceID: &armnetwork.SubResource{ - // ID: to.Ptr("/subscriptions/subid/resourcegroups/rg1/providers/microsoft.operationalinsights/workspaces/defaultWorkspace"), - // }, - // Workspaces: []*armnetwork.FirewallPolicyLogAnalyticsWorkspace{ - // { - // Region: to.Ptr("westus"), - // WorkspaceID: &armnetwork.SubResource{ - // ID: to.Ptr("/subscriptions/subid/resourcegroups/rg1/providers/microsoft.operationalinsights/workspaces/workspace1"), - // }, - // }, - // { - // Region: to.Ptr("eastus"), - // WorkspaceID: &armnetwork.SubResource{ - // ID: to.Ptr("/subscriptions/subid/resourcegroups/rg1/providers/microsoft.operationalinsights/workspaces/workspace2"), - // }, - // }}, - // }, - // RetentionDays: to.Ptr[int32](100), - // }, - // IntrusionDetection: &armnetwork.FirewallPolicyIntrusionDetection{ - // Configuration: &armnetwork.FirewallPolicyIntrusionDetectionConfiguration{ - // BypassTrafficSettings: []*armnetwork.FirewallPolicyIntrusionDetectionBypassTrafficSpecifications{ - // { - // Name: to.Ptr("bypassRule1"), - // Description: to.Ptr("Rule 1"), - // DestinationAddresses: []*string{ - // to.Ptr("5.6.7.8")}, - // DestinationPorts: []*string{ - // to.Ptr("*")}, - // SourceAddresses: []*string{ - // to.Ptr("1.2.3.4")}, - // Protocol: to.Ptr(armnetwork.FirewallPolicyIntrusionDetectionProtocolTCP), - // }}, - // SignatureOverrides: []*armnetwork.FirewallPolicyIntrusionDetectionSignatureSpecification{ - // { - // ID: to.Ptr("2525004"), - // Mode: to.Ptr(armnetwork.FirewallPolicyIntrusionDetectionStateTypeDeny), - // }}, - // }, - // Mode: to.Ptr(armnetwork.FirewallPolicyIntrusionDetectionStateTypeAlert), - // }, - // Snat: &armnetwork.FirewallPolicySNAT{ - // PrivateRanges: []*string{ - // to.Ptr("IANAPrivateRanges")}, - // }, - // SQL: &armnetwork.FirewallPolicySQL{ - // AllowSQLRedirect: to.Ptr(true), - // }, - // ThreatIntelMode: to.Ptr(armnetwork.AzureFirewallThreatIntelModeAlert), - // ThreatIntelWhitelist: &armnetwork.FirewallPolicyThreatIntelWhitelist{ - // Fqdns: []*string{ - // to.Ptr("*.microsoft.com")}, - // IPAddresses: []*string{ - // to.Ptr("20.3.4.5")}, - // }, - // }, - // } -} diff --git a/sdk/resourcemanager/network/armnetwork/firewallpolicyidpssignatures_client_example_test.go b/sdk/resourcemanager/network/armnetwork/firewallpolicyidpssignatures_client_example_test.go deleted file mode 100644 index 29c32b6a3564..000000000000 --- a/sdk/resourcemanager/network/armnetwork/firewallpolicyidpssignatures_client_example_test.go +++ /dev/null @@ -1,87 +0,0 @@ -//go:build go1.18 -// +build go1.18 - -// 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. -// DO NOT EDIT. - -package armnetwork_test - -import ( - "context" - "log" - - "github.com/Azure/azure-sdk-for-go/sdk/azcore/to" - "github.com/Azure/azure-sdk-for-go/sdk/azidentity" - "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/network/armnetwork/v6" -) - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/4883fa5dbf6f2c9093fac8ce334547e9dfac68fa/specification/network/resource-manager/Microsoft.Network/stable/2024-03-01/examples/FirewallPolicyQuerySignatureOverrides.json -func ExampleFirewallPolicyIdpsSignaturesClient_List() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armnetwork.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewFirewallPolicyIdpsSignaturesClient().List(ctx, "rg1", "firewallPolicy", armnetwork.IDPSQueryObject{ - Filters: []*armnetwork.FilterItems{ - { - Field: to.Ptr("Mode"), - Values: []*string{ - to.Ptr("Deny")}, - }}, - OrderBy: &armnetwork.OrderBy{ - Field: to.Ptr("severity"), - Order: to.Ptr(armnetwork.FirewallPolicyIDPSQuerySortOrderAscending), - }, - ResultsPerPage: to.Ptr[int32](20), - Search: to.Ptr(""), - Skip: to.Ptr[int32](0), - }, nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.QueryResults = armnetwork.QueryResults{ - // MatchingRecordsCount: to.Ptr[int64](2), - // Signatures: []*armnetwork.SingleQueryResult{ - // { - // Description: to.Ptr("P2P Phatbot Control Connection"), - // DestinationPorts: []*string{ - // to.Ptr("any")}, - // Direction: to.Ptr(armnetwork.FirewallPolicyIDPSSignatureDirectionTwo), - // Group: to.Ptr("A Network Trojan was detected"), - // InheritedFromParentPolicy: to.Ptr(false), - // LastUpdated: to.Ptr("2010-07-30T00:00:00"), - // Mode: to.Ptr(armnetwork.FirewallPolicyIDPSSignatureModeTwo), - // Severity: to.Ptr(armnetwork.FirewallPolicyIDPSSignatureSeverityOne), - // SignatureID: to.Ptr[int32](2000015), - // SourcePorts: []*string{ - // to.Ptr("any")}, - // Protocol: to.Ptr("tcp"), - // }, - // { - // Description: to.Ptr("WEB_SERVER SQL sp_delete_alert attempt"), - // DestinationPorts: []*string{ - // to.Ptr("any")}, - // Direction: to.Ptr(armnetwork.FirewallPolicyIDPSSignatureDirectionOne), - // Group: to.Ptr("Attempted User Privilege Gain"), - // InheritedFromParentPolicy: to.Ptr(false), - // LastUpdated: to.Ptr("2019-09-27T00:00:00"), - // Mode: to.Ptr(armnetwork.FirewallPolicyIDPSSignatureModeTwo), - // Severity: to.Ptr(armnetwork.FirewallPolicyIDPSSignatureSeverityOne), - // SignatureID: to.Ptr[int32](2000106), - // SourcePorts: []*string{ - // to.Ptr("any")}, - // Protocol: to.Ptr("http"), - // }}, - // } -} diff --git a/sdk/resourcemanager/network/armnetwork/firewallpolicyidpssignaturesfiltervalues_client_example_test.go b/sdk/resourcemanager/network/armnetwork/firewallpolicyidpssignaturesfiltervalues_client_example_test.go deleted file mode 100644 index 3f89c10c87d0..000000000000 --- a/sdk/resourcemanager/network/armnetwork/firewallpolicyidpssignaturesfiltervalues_client_example_test.go +++ /dev/null @@ -1,47 +0,0 @@ -//go:build go1.18 -// +build go1.18 - -// 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. -// DO NOT EDIT. - -package armnetwork_test - -import ( - "context" - "log" - - "github.com/Azure/azure-sdk-for-go/sdk/azcore/to" - "github.com/Azure/azure-sdk-for-go/sdk/azidentity" - "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/network/armnetwork/v6" -) - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/4883fa5dbf6f2c9093fac8ce334547e9dfac68fa/specification/network/resource-manager/Microsoft.Network/stable/2024-03-01/examples/FirewallPolicyQuerySignatureOverridesFilterValues.json -func ExampleFirewallPolicyIdpsSignaturesFilterValuesClient_List() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armnetwork.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewFirewallPolicyIdpsSignaturesFilterValuesClient().List(ctx, "rg1", "firewallPolicy", armnetwork.SignatureOverridesFilterValuesQuery{ - FilterName: to.Ptr("severity"), - }, nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.SignatureOverridesFilterValuesResponse = armnetwork.SignatureOverridesFilterValuesResponse{ - // FilterValues: []*string{ - // to.Ptr("low"), - // to.Ptr("medium"), - // to.Ptr("high")}, - // } -} diff --git a/sdk/resourcemanager/network/armnetwork/firewallpolicyidpssignaturesoverrides_client_example_test.go b/sdk/resourcemanager/network/armnetwork/firewallpolicyidpssignaturesoverrides_client_example_test.go deleted file mode 100644 index 9e144d5c2f53..000000000000 --- a/sdk/resourcemanager/network/armnetwork/firewallpolicyidpssignaturesoverrides_client_example_test.go +++ /dev/null @@ -1,166 +0,0 @@ -//go:build go1.18 -// +build go1.18 - -// 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. -// DO NOT EDIT. - -package armnetwork_test - -import ( - "context" - "log" - - "github.com/Azure/azure-sdk-for-go/sdk/azcore/to" - "github.com/Azure/azure-sdk-for-go/sdk/azidentity" - "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/network/armnetwork/v6" -) - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/4883fa5dbf6f2c9093fac8ce334547e9dfac68fa/specification/network/resource-manager/Microsoft.Network/stable/2024-03-01/examples/FirewallPolicySignatureOverridesPatch.json -func ExampleFirewallPolicyIdpsSignaturesOverridesClient_Patch() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armnetwork.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewFirewallPolicyIdpsSignaturesOverridesClient().Patch(ctx, "rg1", "firewallPolicy", armnetwork.SignaturesOverrides{ - Name: to.Ptr("default"), - Type: to.Ptr("Microsoft.Network/firewallPolicies/signatureOverrides"), - ID: to.Ptr("/subscriptions/e747cc13-97d4-4a79-b463-42d7f4e558f2/resourceGroups/rg1/providers/Microsoft.Network/firewallPolicies/firewallPolicy/signatureOverrides/default"), - Properties: &armnetwork.SignaturesOverridesProperties{ - Signatures: map[string]*string{ - "2000105": to.Ptr("Off"), - "2000106": to.Ptr("Deny"), - }, - }, - }, nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.SignaturesOverrides = armnetwork.SignaturesOverrides{ - // Name: to.Ptr("default"), - // Type: to.Ptr("Microsoft.Network/firewallPolicies/signatureOverrides"), - // ID: to.Ptr("/subscriptions/e747cc13-97d4-4a79-b463-42d7f4e558f2/resourceGroups/rg1/providers/Microsoft.Network/firewallPolicies/firewallPolicy/signatureOverrides/default"), - // Properties: &armnetwork.SignaturesOverridesProperties{ - // Signatures: map[string]*string{ - // "2000105": to.Ptr("Off"), - // "2000106": to.Ptr("Deny"), - // }, - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/4883fa5dbf6f2c9093fac8ce334547e9dfac68fa/specification/network/resource-manager/Microsoft.Network/stable/2024-03-01/examples/FirewallPolicySignatureOverridesPut.json -func ExampleFirewallPolicyIdpsSignaturesOverridesClient_Put() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armnetwork.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewFirewallPolicyIdpsSignaturesOverridesClient().Put(ctx, "rg1", "firewallPolicy", armnetwork.SignaturesOverrides{ - Name: to.Ptr("default"), - Type: to.Ptr("Microsoft.Network/firewallPolicies/signatureOverrides"), - ID: to.Ptr("/subscriptions/e747cc13-97d4-4a79-b463-42d7f4e558f2/resourceGroups/rg1/providers/Microsoft.Network/firewallPolicies/firewallPolicy/signatureOverrides/default"), - Properties: &armnetwork.SignaturesOverridesProperties{ - Signatures: map[string]*string{ - "2000105": to.Ptr("Off"), - "2000106": to.Ptr("Deny"), - }, - }, - }, nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.SignaturesOverrides = armnetwork.SignaturesOverrides{ - // Name: to.Ptr("default"), - // Type: to.Ptr("Microsoft.Network/firewallPolicies/signatureOverrides"), - // ID: to.Ptr("/subscriptions/e747cc13-97d4-4a79-b463-42d7f4e558f2/resourceGroups/rg1/providers/Microsoft.Network/firewallPolicies/firewallPolicy/signatureOverrides/default"), - // Properties: &armnetwork.SignaturesOverridesProperties{ - // Signatures: map[string]*string{ - // "2000105": to.Ptr("Off"), - // "2000106": to.Ptr("Deny"), - // }, - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/4883fa5dbf6f2c9093fac8ce334547e9dfac68fa/specification/network/resource-manager/Microsoft.Network/stable/2024-03-01/examples/FirewallPolicySignatureOverridesGet.json -func ExampleFirewallPolicyIdpsSignaturesOverridesClient_Get() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armnetwork.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewFirewallPolicyIdpsSignaturesOverridesClient().Get(ctx, "rg1", "firewallPolicy", nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.SignaturesOverrides = armnetwork.SignaturesOverrides{ - // Name: to.Ptr("default"), - // Type: to.Ptr("Microsoft.Network/firewallPolicies/signatureOverrides"), - // ID: to.Ptr("/subscriptions/e747cc13-97d4-4a79-b463-42d7f4e558f2/resourceGroups/rg1/providers/Microsoft.Network/firewallPolicies/firewallPolicy/signatureOverrides/default"), - // Properties: &armnetwork.SignaturesOverridesProperties{ - // Signatures: map[string]*string{ - // "2000105": to.Ptr("Off"), - // "2000106": to.Ptr("Deny"), - // }, - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/4883fa5dbf6f2c9093fac8ce334547e9dfac68fa/specification/network/resource-manager/Microsoft.Network/stable/2024-03-01/examples/FirewallPolicySignatureOverridesList.json -func ExampleFirewallPolicyIdpsSignaturesOverridesClient_List() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armnetwork.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewFirewallPolicyIdpsSignaturesOverridesClient().List(ctx, "rg1", "firewallPolicy", nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.SignaturesOverridesList = armnetwork.SignaturesOverridesList{ - // Value: []*armnetwork.SignaturesOverrides{ - // { - // Name: to.Ptr("default"), - // Type: to.Ptr("Microsoft.Network/firewallPolicies/signatureOverrides"), - // ID: to.Ptr("/subscriptions/e747cc13-97d4-4a79-b463-42d7f4e558f2/resourceGroups/rg1/providers/Microsoft.Network/firewallPolicies/firewallPolicy/signatureOverrides/default"), - // Properties: &armnetwork.SignaturesOverridesProperties{ - // Signatures: map[string]*string{ - // "2000105": to.Ptr("Off"), - // "2000106": to.Ptr("Deny"), - // }, - // }, - // }}, - // } -} diff --git a/sdk/resourcemanager/network/armnetwork/firewallpolicyrulecollectiongroupdrafts_client_example_test.go b/sdk/resourcemanager/network/armnetwork/firewallpolicyrulecollectiongroupdrafts_client_example_test.go deleted file mode 100644 index e9a599f45c72..000000000000 --- a/sdk/resourcemanager/network/armnetwork/firewallpolicyrulecollectiongroupdrafts_client_example_test.go +++ /dev/null @@ -1,160 +0,0 @@ -//go:build go1.18 -// +build go1.18 - -// 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. -// DO NOT EDIT. - -package armnetwork_test - -import ( - "context" - "log" - - "github.com/Azure/azure-sdk-for-go/sdk/azcore/to" - "github.com/Azure/azure-sdk-for-go/sdk/azidentity" - "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/network/armnetwork/v6" -) - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/4883fa5dbf6f2c9093fac8ce334547e9dfac68fa/specification/network/resource-manager/Microsoft.Network/stable/2024-03-01/examples/FirewallPolicyRuleCollectionGroupDraftDelete.json -func ExampleFirewallPolicyRuleCollectionGroupDraftsClient_Delete() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armnetwork.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - _, err = clientFactory.NewFirewallPolicyRuleCollectionGroupDraftsClient().Delete(ctx, "rg1", "firewallPolicy", "ruleCollectionGroup1", nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/4883fa5dbf6f2c9093fac8ce334547e9dfac68fa/specification/network/resource-manager/Microsoft.Network/stable/2024-03-01/examples/FirewallPolicyRuleCollectionGroupDraftPut.json -func ExampleFirewallPolicyRuleCollectionGroupDraftsClient_CreateOrUpdate() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armnetwork.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewFirewallPolicyRuleCollectionGroupDraftsClient().CreateOrUpdate(ctx, "rg1", "firewallPolicy", "ruleCollectionGroup1", armnetwork.FirewallPolicyRuleCollectionGroupDraft{ - Properties: &armnetwork.FirewallPolicyRuleCollectionGroupDraftProperties{ - Priority: to.Ptr[int32](100), - RuleCollections: []armnetwork.FirewallPolicyRuleCollectionClassification{ - &armnetwork.FirewallPolicyFilterRuleCollection{ - Name: to.Ptr("Example-Filter-Rule-Collection"), - Priority: to.Ptr[int32](100), - RuleCollectionType: to.Ptr(armnetwork.FirewallPolicyRuleCollectionTypeFirewallPolicyFilterRuleCollection), - Action: &armnetwork.FirewallPolicyFilterRuleCollectionAction{ - Type: to.Ptr(armnetwork.FirewallPolicyFilterRuleCollectionActionTypeDeny), - }, - Rules: []armnetwork.FirewallPolicyRuleClassification{ - &armnetwork.Rule{ - Name: to.Ptr("network-rule1"), - RuleType: to.Ptr(armnetwork.FirewallPolicyRuleTypeNetworkRule), - DestinationAddresses: []*string{ - to.Ptr("*")}, - DestinationPorts: []*string{ - to.Ptr("*")}, - IPProtocols: []*armnetwork.FirewallPolicyRuleNetworkProtocol{ - to.Ptr(armnetwork.FirewallPolicyRuleNetworkProtocolTCP)}, - SourceAddresses: []*string{ - to.Ptr("10.1.25.0/24")}, - }}, - }}, - }, - }, nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.FirewallPolicyRuleCollectionGroupDraft = armnetwork.FirewallPolicyRuleCollectionGroupDraft{ - // ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/firewallPolicies/firewallPolicy/ruleCollectionGroups/ruleCollectionGroup1"), - // Name: to.Ptr("ruleCollectionGroup1"), - // Properties: &armnetwork.FirewallPolicyRuleCollectionGroupDraftProperties{ - // Priority: to.Ptr[int32](100), - // RuleCollections: []armnetwork.FirewallPolicyRuleCollectionClassification{ - // &armnetwork.FirewallPolicyFilterRuleCollection{ - // Name: to.Ptr("Example-Filter-Rule-Collection"), - // Priority: to.Ptr[int32](100), - // RuleCollectionType: to.Ptr(armnetwork.FirewallPolicyRuleCollectionTypeFirewallPolicyFilterRuleCollection), - // Action: &armnetwork.FirewallPolicyFilterRuleCollectionAction{ - // Type: to.Ptr(armnetwork.FirewallPolicyFilterRuleCollectionActionTypeDeny), - // }, - // Rules: []armnetwork.FirewallPolicyRuleClassification{ - // &armnetwork.Rule{ - // Name: to.Ptr("network-rule1"), - // RuleType: to.Ptr(armnetwork.FirewallPolicyRuleTypeNetworkRule), - // DestinationAddresses: []*string{ - // to.Ptr("*")}, - // DestinationPorts: []*string{ - // to.Ptr("*")}, - // IPProtocols: []*armnetwork.FirewallPolicyRuleNetworkProtocol{ - // to.Ptr(armnetwork.FirewallPolicyRuleNetworkProtocolTCP)}, - // SourceAddresses: []*string{ - // to.Ptr("10.1.25.0/24")}, - // }}, - // }}, - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/4883fa5dbf6f2c9093fac8ce334547e9dfac68fa/specification/network/resource-manager/Microsoft.Network/stable/2024-03-01/examples/FirewallPolicyRuleCollectionGroupDraftGet.json -func ExampleFirewallPolicyRuleCollectionGroupDraftsClient_Get() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armnetwork.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewFirewallPolicyRuleCollectionGroupDraftsClient().Get(ctx, "rg1", "firewallPolicy", "ruleCollectionGroup1", nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.FirewallPolicyRuleCollectionGroupDraft = armnetwork.FirewallPolicyRuleCollectionGroupDraft{ - // ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/firewallPolicies/firewallPolicy/ruleCollectionGroups/ruleCollectionGroup1"), - // Name: to.Ptr("ruleCollectionGroup1"), - // Properties: &armnetwork.FirewallPolicyRuleCollectionGroupDraftProperties{ - // Priority: to.Ptr[int32](110), - // RuleCollections: []armnetwork.FirewallPolicyRuleCollectionClassification{ - // &armnetwork.FirewallPolicyFilterRuleCollection{ - // Name: to.Ptr("Example-Filter-Rule-Collection"), - // Priority: to.Ptr[int32](200), - // RuleCollectionType: to.Ptr(armnetwork.FirewallPolicyRuleCollectionTypeFirewallPolicyFilterRuleCollection), - // Action: &armnetwork.FirewallPolicyFilterRuleCollectionAction{ - // Type: to.Ptr(armnetwork.FirewallPolicyFilterRuleCollectionActionTypeDeny), - // }, - // Rules: []armnetwork.FirewallPolicyRuleClassification{ - // &armnetwork.Rule{ - // Name: to.Ptr("network-rule1"), - // RuleType: to.Ptr(armnetwork.FirewallPolicyRuleTypeNetworkRule), - // DestinationAddresses: []*string{ - // to.Ptr("*")}, - // DestinationPorts: []*string{ - // to.Ptr("*")}, - // IPProtocols: []*armnetwork.FirewallPolicyRuleNetworkProtocol{ - // to.Ptr(armnetwork.FirewallPolicyRuleNetworkProtocolTCP)}, - // SourceAddresses: []*string{ - // to.Ptr("10.1.25.0/24")}, - // }}, - // }}, - // }, - // } -} diff --git a/sdk/resourcemanager/network/armnetwork/firewallpolicyrulecollectiongroups_client_example_test.go b/sdk/resourcemanager/network/armnetwork/firewallpolicyrulecollectiongroups_client_example_test.go deleted file mode 100644 index b38fa55cd6c9..000000000000 --- a/sdk/resourcemanager/network/armnetwork/firewallpolicyrulecollectiongroups_client_example_test.go +++ /dev/null @@ -1,866 +0,0 @@ -//go:build go1.18 -// +build go1.18 - -// 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. -// DO NOT EDIT. - -package armnetwork_test - -import ( - "context" - "log" - - "github.com/Azure/azure-sdk-for-go/sdk/azcore/to" - "github.com/Azure/azure-sdk-for-go/sdk/azidentity" - "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/network/armnetwork/v6" -) - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/4883fa5dbf6f2c9093fac8ce334547e9dfac68fa/specification/network/resource-manager/Microsoft.Network/stable/2024-03-01/examples/FirewallPolicyRuleCollectionGroupDelete.json -func ExampleFirewallPolicyRuleCollectionGroupsClient_BeginDelete() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armnetwork.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewFirewallPolicyRuleCollectionGroupsClient().BeginDelete(ctx, "rg1", "firewallPolicy", "ruleCollectionGroup1", nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - _, err = poller.PollUntilDone(ctx, nil) - if err != nil { - log.Fatalf("failed to pull the result: %v", err) - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/4883fa5dbf6f2c9093fac8ce334547e9dfac68fa/specification/network/resource-manager/Microsoft.Network/stable/2024-03-01/examples/FirewallPolicyNatRuleCollectionGroupGet.json -func ExampleFirewallPolicyRuleCollectionGroupsClient_Get_getFirewallPolicyNatRuleCollectionGroup() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armnetwork.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewFirewallPolicyRuleCollectionGroupsClient().Get(ctx, "rg1", "firewallPolicy", "ruleCollectionGroup1", nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.FirewallPolicyRuleCollectionGroup = armnetwork.FirewallPolicyRuleCollectionGroup{ - // ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/firewallPolicies/firewallPolicy/ruleCollectionGroups/ruleCollectionGroup1"), - // Name: to.Ptr("ruleCollectionGroup1"), - // Etag: to.Ptr("W/\"72090554-7e3b-43f2-80ad-99a9020dcb11\""), - // Properties: &armnetwork.FirewallPolicyRuleCollectionGroupProperties{ - // Priority: to.Ptr[int32](100), - // ProvisioningState: to.Ptr(armnetwork.ProvisioningStateSucceeded), - // RuleCollections: []armnetwork.FirewallPolicyRuleCollectionClassification{ - // &armnetwork.FirewallPolicyNatRuleCollection{ - // Name: to.Ptr("NatRC"), - // Priority: to.Ptr[int32](100), - // RuleCollectionType: to.Ptr(armnetwork.FirewallPolicyRuleCollectionTypeFirewallPolicyNatRuleCollection), - // Action: &armnetwork.FirewallPolicyNatRuleCollectionAction{ - // Type: to.Ptr(armnetwork.FirewallPolicyNatRuleCollectionActionTypeDNAT), - // }, - // Rules: []armnetwork.FirewallPolicyRuleClassification{ - // &armnetwork.NatRule{ - // Name: to.Ptr("NatRule1"), - // RuleType: to.Ptr(armnetwork.FirewallPolicyRuleTypeNatRule), - // DestinationAddresses: []*string{ - // to.Ptr("152.23.32.23")}, - // DestinationPorts: []*string{ - // to.Ptr("8080")}, - // IPProtocols: []*armnetwork.FirewallPolicyRuleNetworkProtocol{ - // to.Ptr(armnetwork.FirewallPolicyRuleNetworkProtocolTCP), - // to.Ptr(armnetwork.FirewallPolicyRuleNetworkProtocolUDP)}, - // SourceAddresses: []*string{ - // to.Ptr("2.2.2.2")}, - // SourceIPGroups: []*string{ - // }, - // TranslatedFqdn: to.Ptr("internalhttpserver"), - // TranslatedPort: to.Ptr("8080"), - // }}, - // }}, - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/4883fa5dbf6f2c9093fac8ce334547e9dfac68fa/specification/network/resource-manager/Microsoft.Network/stable/2024-03-01/examples/FirewallPolicyRuleCollectionGroupGet.json -func ExampleFirewallPolicyRuleCollectionGroupsClient_Get_getFirewallPolicyRuleCollectionGroup() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armnetwork.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewFirewallPolicyRuleCollectionGroupsClient().Get(ctx, "rg1", "firewallPolicy", "ruleCollectionGroup1", nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.FirewallPolicyRuleCollectionGroup = armnetwork.FirewallPolicyRuleCollectionGroup{ - // ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/firewallPolicies/firewallPolicy/ruleCollectionGroups/ruleCollectionGroup1"), - // Name: to.Ptr("ruleCollectionGroup1"), - // Etag: to.Ptr("W/\"72090554-7e3b-43f2-80ad-99a9020dcb11\""), - // Properties: &armnetwork.FirewallPolicyRuleCollectionGroupProperties{ - // Priority: to.Ptr[int32](110), - // ProvisioningState: to.Ptr(armnetwork.ProvisioningStateSucceeded), - // RuleCollections: []armnetwork.FirewallPolicyRuleCollectionClassification{ - // &armnetwork.FirewallPolicyFilterRuleCollection{ - // Name: to.Ptr("Example-Filter-Rule-Collection"), - // Priority: to.Ptr[int32](200), - // RuleCollectionType: to.Ptr(armnetwork.FirewallPolicyRuleCollectionTypeFirewallPolicyFilterRuleCollection), - // Action: &armnetwork.FirewallPolicyFilterRuleCollectionAction{ - // Type: to.Ptr(armnetwork.FirewallPolicyFilterRuleCollectionActionTypeDeny), - // }, - // Rules: []armnetwork.FirewallPolicyRuleClassification{ - // &armnetwork.Rule{ - // Name: to.Ptr("network-rule1"), - // RuleType: to.Ptr(armnetwork.FirewallPolicyRuleTypeNetworkRule), - // DestinationAddresses: []*string{ - // to.Ptr("*")}, - // DestinationPorts: []*string{ - // to.Ptr("*")}, - // IPProtocols: []*armnetwork.FirewallPolicyRuleNetworkProtocol{ - // to.Ptr(armnetwork.FirewallPolicyRuleNetworkProtocolTCP)}, - // SourceAddresses: []*string{ - // to.Ptr("10.1.25.0/24")}, - // }}, - // }}, - // Size: to.Ptr("1.2MB"), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/4883fa5dbf6f2c9093fac8ce334547e9dfac68fa/specification/network/resource-manager/Microsoft.Network/stable/2024-03-01/examples/FirewallPolicyRuleCollectionGroupWithIpGroupsGet.json -func ExampleFirewallPolicyRuleCollectionGroupsClient_Get_getFirewallPolicyRuleCollectionGroupWithIpGroups() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armnetwork.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewFirewallPolicyRuleCollectionGroupsClient().Get(ctx, "rg1", "firewallPolicy", "ruleGroup1", nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.FirewallPolicyRuleCollectionGroup = armnetwork.FirewallPolicyRuleCollectionGroup{ - // ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/firewallPolicies/firewallPolicy/ruleGroups/ruleGroup1"), - // Name: to.Ptr("ruleGroup1"), - // Etag: to.Ptr("W/\"72090554-7e3b-43f2-80ad-99a9020dcb11\""), - // Properties: &armnetwork.FirewallPolicyRuleCollectionGroupProperties{ - // Priority: to.Ptr[int32](110), - // ProvisioningState: to.Ptr(armnetwork.ProvisioningStateSucceeded), - // RuleCollections: []armnetwork.FirewallPolicyRuleCollectionClassification{ - // &armnetwork.FirewallPolicyFilterRuleCollection{ - // Name: to.Ptr("Example-Filter-Rule-Collection"), - // Priority: to.Ptr[int32](200), - // RuleCollectionType: to.Ptr(armnetwork.FirewallPolicyRuleCollectionTypeFirewallPolicyFilterRuleCollection), - // Action: &armnetwork.FirewallPolicyFilterRuleCollectionAction{ - // Type: to.Ptr(armnetwork.FirewallPolicyFilterRuleCollectionActionTypeDeny), - // }, - // Rules: []armnetwork.FirewallPolicyRuleClassification{ - // &armnetwork.Rule{ - // Name: to.Ptr("network-rule1"), - // RuleType: to.Ptr(armnetwork.FirewallPolicyRuleTypeNetworkRule), - // DestinationIPGroups: []*string{ - // to.Ptr("/subscriptions/subid/providers/Microsoft.Network/resourceGroup/rg1/ipGroups/ipGroups2")}, - // DestinationPorts: []*string{ - // to.Ptr("*")}, - // IPProtocols: []*armnetwork.FirewallPolicyRuleNetworkProtocol{ - // to.Ptr(armnetwork.FirewallPolicyRuleNetworkProtocolTCP)}, - // SourceIPGroups: []*string{ - // to.Ptr("/subscriptions/subid/providers/Microsoft.Network/resourceGroup/rg1/ipGroups/ipGroups1")}, - // }}, - // }}, - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/4883fa5dbf6f2c9093fac8ce334547e9dfac68fa/specification/network/resource-manager/Microsoft.Network/stable/2024-03-01/examples/FirewallPolicyRuleCollectionGroupWithWebCategoriesGet.json -func ExampleFirewallPolicyRuleCollectionGroupsClient_Get_getFirewallPolicyRuleCollectionGroupWithWebCategories() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armnetwork.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewFirewallPolicyRuleCollectionGroupsClient().Get(ctx, "rg1", "firewallPolicy", "ruleCollectionGroup1", nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.FirewallPolicyRuleCollectionGroup = armnetwork.FirewallPolicyRuleCollectionGroup{ - // ID: to.Ptr("/subscriptions/e747cc13-97d4-4a79-b463-42d7f4e558f2/resourceGroups/rg1/providers/Microsoft.Network/firewallPolicies/firewallPolicy/ruleCollectionGroups/ruleCollectionGroup1"), - // Name: to.Ptr("ruleCollectionGroup1"), - // Etag: to.Ptr("W/\"72090554-7e3b-43f2-80ad-99a9020dcb11\""), - // Properties: &armnetwork.FirewallPolicyRuleCollectionGroupProperties{ - // Priority: to.Ptr[int32](110), - // ProvisioningState: to.Ptr(armnetwork.ProvisioningStateSucceeded), - // RuleCollections: []armnetwork.FirewallPolicyRuleCollectionClassification{ - // &armnetwork.FirewallPolicyFilterRuleCollection{ - // Name: to.Ptr("Example-Filter-Rule-Collection"), - // Priority: to.Ptr[int32](200), - // RuleCollectionType: to.Ptr(armnetwork.FirewallPolicyRuleCollectionTypeFirewallPolicyFilterRuleCollection), - // Action: &armnetwork.FirewallPolicyFilterRuleCollectionAction{ - // Type: to.Ptr(armnetwork.FirewallPolicyFilterRuleCollectionActionTypeDeny), - // }, - // Rules: []armnetwork.FirewallPolicyRuleClassification{ - // &armnetwork.ApplicationRule{ - // Name: to.Ptr("rule1"), - // Description: to.Ptr("Deny inbound rule"), - // RuleType: to.Ptr(armnetwork.FirewallPolicyRuleTypeApplicationRule), - // Protocols: []*armnetwork.FirewallPolicyRuleApplicationProtocol{ - // { - // Port: to.Ptr[int32](443), - // ProtocolType: to.Ptr(armnetwork.FirewallPolicyRuleApplicationProtocolTypeHTTPS), - // }}, - // SourceAddresses: []*string{ - // to.Ptr("216.58.216.164"), - // to.Ptr("10.0.0.0/24")}, - // WebCategories: []*string{ - // to.Ptr("Hacking")}, - // }}, - // }}, - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/4883fa5dbf6f2c9093fac8ce334547e9dfac68fa/specification/network/resource-manager/Microsoft.Network/stable/2024-03-01/examples/FirewallPolicyNatRuleCollectionGroupPut.json -func ExampleFirewallPolicyRuleCollectionGroupsClient_BeginCreateOrUpdate_createFirewallPolicyNatRuleCollectionGroup() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armnetwork.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewFirewallPolicyRuleCollectionGroupsClient().BeginCreateOrUpdate(ctx, "rg1", "firewallPolicy", "ruleCollectionGroup1", armnetwork.FirewallPolicyRuleCollectionGroup{ - Properties: &armnetwork.FirewallPolicyRuleCollectionGroupProperties{ - Priority: to.Ptr[int32](100), - RuleCollections: []armnetwork.FirewallPolicyRuleCollectionClassification{ - &armnetwork.FirewallPolicyNatRuleCollection{ - Name: to.Ptr("Example-Nat-Rule-Collection"), - Priority: to.Ptr[int32](100), - RuleCollectionType: to.Ptr(armnetwork.FirewallPolicyRuleCollectionTypeFirewallPolicyNatRuleCollection), - Action: &armnetwork.FirewallPolicyNatRuleCollectionAction{ - Type: to.Ptr(armnetwork.FirewallPolicyNatRuleCollectionActionTypeDNAT), - }, - Rules: []armnetwork.FirewallPolicyRuleClassification{ - &armnetwork.NatRule{ - Name: to.Ptr("nat-rule1"), - RuleType: to.Ptr(armnetwork.FirewallPolicyRuleTypeNatRule), - DestinationAddresses: []*string{ - to.Ptr("152.23.32.23")}, - DestinationPorts: []*string{ - to.Ptr("8080")}, - IPProtocols: []*armnetwork.FirewallPolicyRuleNetworkProtocol{ - to.Ptr(armnetwork.FirewallPolicyRuleNetworkProtocolTCP), - to.Ptr(armnetwork.FirewallPolicyRuleNetworkProtocolUDP)}, - SourceAddresses: []*string{ - to.Ptr("2.2.2.2")}, - SourceIPGroups: []*string{}, - TranslatedFqdn: to.Ptr("internalhttp.server.net"), - TranslatedPort: to.Ptr("8080"), - }}, - }}, - }, - }, nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - res, err := poller.PollUntilDone(ctx, nil) - if err != nil { - log.Fatalf("failed to pull the result: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.FirewallPolicyRuleCollectionGroup = armnetwork.FirewallPolicyRuleCollectionGroup{ - // ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/firewallPolicies/firewallPolicy/ruleCollectionGroups/ruleCollectionGroup1"), - // Name: to.Ptr("ruleCollectionGroup1"), - // Etag: to.Ptr("w/\\00000000-0000-0000-0000-000000000000\\"), - // Properties: &armnetwork.FirewallPolicyRuleCollectionGroupProperties{ - // Priority: to.Ptr[int32](100), - // ProvisioningState: to.Ptr(armnetwork.ProvisioningStateSucceeded), - // RuleCollections: []armnetwork.FirewallPolicyRuleCollectionClassification{ - // &armnetwork.FirewallPolicyNatRuleCollection{ - // Name: to.Ptr("Example-Nat-Rule-Collection"), - // Priority: to.Ptr[int32](100), - // RuleCollectionType: to.Ptr(armnetwork.FirewallPolicyRuleCollectionTypeFirewallPolicyNatRuleCollection), - // Action: &armnetwork.FirewallPolicyNatRuleCollectionAction{ - // Type: to.Ptr(armnetwork.FirewallPolicyNatRuleCollectionActionTypeDNAT), - // }, - // Rules: []armnetwork.FirewallPolicyRuleClassification{ - // &armnetwork.NatRule{ - // Name: to.Ptr("nat-rule1"), - // RuleType: to.Ptr(armnetwork.FirewallPolicyRuleTypeNatRule), - // DestinationAddresses: []*string{ - // to.Ptr("152.23.32.23")}, - // DestinationPorts: []*string{ - // to.Ptr("8080")}, - // IPProtocols: []*armnetwork.FirewallPolicyRuleNetworkProtocol{ - // to.Ptr(armnetwork.FirewallPolicyRuleNetworkProtocolTCP), - // to.Ptr(armnetwork.FirewallPolicyRuleNetworkProtocolUDP)}, - // SourceAddresses: []*string{ - // to.Ptr("2.2.2.2")}, - // SourceIPGroups: []*string{ - // }, - // TranslatedFqdn: to.Ptr("internalhttp.server.net"), - // TranslatedPort: to.Ptr("8080"), - // }}, - // }}, - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/4883fa5dbf6f2c9093fac8ce334547e9dfac68fa/specification/network/resource-manager/Microsoft.Network/stable/2024-03-01/examples/FirewallPolicyRuleCollectionGroupPut.json -func ExampleFirewallPolicyRuleCollectionGroupsClient_BeginCreateOrUpdate_createFirewallPolicyRuleCollectionGroup() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armnetwork.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewFirewallPolicyRuleCollectionGroupsClient().BeginCreateOrUpdate(ctx, "rg1", "firewallPolicy", "ruleCollectionGroup1", armnetwork.FirewallPolicyRuleCollectionGroup{ - Properties: &armnetwork.FirewallPolicyRuleCollectionGroupProperties{ - Priority: to.Ptr[int32](100), - RuleCollections: []armnetwork.FirewallPolicyRuleCollectionClassification{ - &armnetwork.FirewallPolicyFilterRuleCollection{ - Name: to.Ptr("Example-Filter-Rule-Collection"), - Priority: to.Ptr[int32](100), - RuleCollectionType: to.Ptr(armnetwork.FirewallPolicyRuleCollectionTypeFirewallPolicyFilterRuleCollection), - Action: &armnetwork.FirewallPolicyFilterRuleCollectionAction{ - Type: to.Ptr(armnetwork.FirewallPolicyFilterRuleCollectionActionTypeDeny), - }, - Rules: []armnetwork.FirewallPolicyRuleClassification{ - &armnetwork.Rule{ - Name: to.Ptr("network-rule1"), - RuleType: to.Ptr(armnetwork.FirewallPolicyRuleTypeNetworkRule), - DestinationAddresses: []*string{ - to.Ptr("*")}, - DestinationPorts: []*string{ - to.Ptr("*")}, - IPProtocols: []*armnetwork.FirewallPolicyRuleNetworkProtocol{ - to.Ptr(armnetwork.FirewallPolicyRuleNetworkProtocolTCP)}, - SourceAddresses: []*string{ - to.Ptr("10.1.25.0/24")}, - }}, - }}, - }, - }, nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - res, err := poller.PollUntilDone(ctx, nil) - if err != nil { - log.Fatalf("failed to pull the result: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.FirewallPolicyRuleCollectionGroup = armnetwork.FirewallPolicyRuleCollectionGroup{ - // ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/firewallPolicies/firewallPolicy/ruleCollectionGroups/ruleCollectionGroup1"), - // Name: to.Ptr("ruleCollectionGroup1"), - // Etag: to.Ptr("w/\\00000000-0000-0000-0000-000000000000\\"), - // Properties: &armnetwork.FirewallPolicyRuleCollectionGroupProperties{ - // Priority: to.Ptr[int32](100), - // ProvisioningState: to.Ptr(armnetwork.ProvisioningStateSucceeded), - // RuleCollections: []armnetwork.FirewallPolicyRuleCollectionClassification{ - // &armnetwork.FirewallPolicyFilterRuleCollection{ - // Name: to.Ptr("Example-Filter-Rule-Collection"), - // Priority: to.Ptr[int32](100), - // RuleCollectionType: to.Ptr(armnetwork.FirewallPolicyRuleCollectionTypeFirewallPolicyFilterRuleCollection), - // Action: &armnetwork.FirewallPolicyFilterRuleCollectionAction{ - // Type: to.Ptr(armnetwork.FirewallPolicyFilterRuleCollectionActionTypeDeny), - // }, - // Rules: []armnetwork.FirewallPolicyRuleClassification{ - // &armnetwork.Rule{ - // Name: to.Ptr("network-rule1"), - // RuleType: to.Ptr(armnetwork.FirewallPolicyRuleTypeNetworkRule), - // DestinationAddresses: []*string{ - // to.Ptr("*")}, - // DestinationPorts: []*string{ - // to.Ptr("*")}, - // IPProtocols: []*armnetwork.FirewallPolicyRuleNetworkProtocol{ - // to.Ptr(armnetwork.FirewallPolicyRuleNetworkProtocolTCP)}, - // SourceAddresses: []*string{ - // to.Ptr("10.1.25.0/24")}, - // }}, - // }}, - // Size: to.Ptr("1.2MB"), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/4883fa5dbf6f2c9093fac8ce334547e9dfac68fa/specification/network/resource-manager/Microsoft.Network/stable/2024-03-01/examples/FirewallPolicyRuleCollectionGroupWithIpGroupsPut.json -func ExampleFirewallPolicyRuleCollectionGroupsClient_BeginCreateOrUpdate_createFirewallPolicyRuleCollectionGroupWithIpGroups() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armnetwork.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewFirewallPolicyRuleCollectionGroupsClient().BeginCreateOrUpdate(ctx, "rg1", "firewallPolicy", "ruleCollectionGroup1", armnetwork.FirewallPolicyRuleCollectionGroup{ - Properties: &armnetwork.FirewallPolicyRuleCollectionGroupProperties{ - Priority: to.Ptr[int32](110), - RuleCollections: []armnetwork.FirewallPolicyRuleCollectionClassification{ - &armnetwork.FirewallPolicyFilterRuleCollection{ - Name: to.Ptr("Example-Filter-Rule-Collection"), - RuleCollectionType: to.Ptr(armnetwork.FirewallPolicyRuleCollectionTypeFirewallPolicyFilterRuleCollection), - Action: &armnetwork.FirewallPolicyFilterRuleCollectionAction{ - Type: to.Ptr(armnetwork.FirewallPolicyFilterRuleCollectionActionTypeDeny), - }, - Rules: []armnetwork.FirewallPolicyRuleClassification{ - &armnetwork.Rule{ - Name: to.Ptr("network-1"), - RuleType: to.Ptr(armnetwork.FirewallPolicyRuleTypeNetworkRule), - DestinationIPGroups: []*string{ - to.Ptr("/subscriptions/subid/providers/Microsoft.Network/resourceGroup/rg1/ipGroups/ipGroups2")}, - DestinationPorts: []*string{ - to.Ptr("*")}, - IPProtocols: []*armnetwork.FirewallPolicyRuleNetworkProtocol{ - to.Ptr(armnetwork.FirewallPolicyRuleNetworkProtocolTCP)}, - SourceIPGroups: []*string{ - to.Ptr("/subscriptions/subid/providers/Microsoft.Network/resourceGroup/rg1/ipGroups/ipGroups1")}, - }}, - }}, - }, - }, nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - res, err := poller.PollUntilDone(ctx, nil) - if err != nil { - log.Fatalf("failed to pull the result: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.FirewallPolicyRuleCollectionGroup = armnetwork.FirewallPolicyRuleCollectionGroup{ - // ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/firewallPolicies/firewallPolicy/ruleCollectionGroups/ruleCollectionGroup1"), - // Name: to.Ptr("ruleCollectionGroup1"), - // Etag: to.Ptr("w/\\00000000-0000-0000-0000-000000000000\\"), - // Properties: &armnetwork.FirewallPolicyRuleCollectionGroupProperties{ - // Priority: to.Ptr[int32](110), - // ProvisioningState: to.Ptr(armnetwork.ProvisioningStateSucceeded), - // RuleCollections: []armnetwork.FirewallPolicyRuleCollectionClassification{ - // &armnetwork.FirewallPolicyFilterRuleCollection{ - // Name: to.Ptr("Example-Filter-Rule-Collection"), - // RuleCollectionType: to.Ptr(armnetwork.FirewallPolicyRuleCollectionTypeFirewallPolicyFilterRuleCollection), - // Action: &armnetwork.FirewallPolicyFilterRuleCollectionAction{ - // Type: to.Ptr(armnetwork.FirewallPolicyFilterRuleCollectionActionTypeDeny), - // }, - // Rules: []armnetwork.FirewallPolicyRuleClassification{ - // &armnetwork.Rule{ - // Name: to.Ptr("network-1"), - // RuleType: to.Ptr(armnetwork.FirewallPolicyRuleTypeNetworkRule), - // DestinationIPGroups: []*string{ - // to.Ptr("/subscriptions/subid/providers/Microsoft.Network/resourceGroup/rg1/ipGroups/ipGroups2")}, - // DestinationPorts: []*string{ - // to.Ptr("*")}, - // IPProtocols: []*armnetwork.FirewallPolicyRuleNetworkProtocol{ - // to.Ptr(armnetwork.FirewallPolicyRuleNetworkProtocolTCP)}, - // SourceIPGroups: []*string{ - // to.Ptr("/subscriptions/subid/providers/Microsoft.Network/resourceGroup/rg1/ipGroups/ipGroups1")}, - // }}, - // }}, - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/4883fa5dbf6f2c9093fac8ce334547e9dfac68fa/specification/network/resource-manager/Microsoft.Network/stable/2024-03-01/examples/FirewallPolicyRuleCollectionGroupWithWebCategoriesPut.json -func ExampleFirewallPolicyRuleCollectionGroupsClient_BeginCreateOrUpdate_createFirewallPolicyRuleCollectionGroupWithWebCategories() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armnetwork.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewFirewallPolicyRuleCollectionGroupsClient().BeginCreateOrUpdate(ctx, "rg1", "firewallPolicy", "ruleCollectionGroup1", armnetwork.FirewallPolicyRuleCollectionGroup{ - Properties: &armnetwork.FirewallPolicyRuleCollectionGroupProperties{ - Priority: to.Ptr[int32](110), - RuleCollections: []armnetwork.FirewallPolicyRuleCollectionClassification{ - &armnetwork.FirewallPolicyFilterRuleCollection{ - Name: to.Ptr("Example-Filter-Rule-Collection"), - RuleCollectionType: to.Ptr(armnetwork.FirewallPolicyRuleCollectionTypeFirewallPolicyFilterRuleCollection), - Action: &armnetwork.FirewallPolicyFilterRuleCollectionAction{ - Type: to.Ptr(armnetwork.FirewallPolicyFilterRuleCollectionActionTypeDeny), - }, - Rules: []armnetwork.FirewallPolicyRuleClassification{ - &armnetwork.ApplicationRule{ - Name: to.Ptr("rule1"), - Description: to.Ptr("Deny inbound rule"), - RuleType: to.Ptr(armnetwork.FirewallPolicyRuleTypeApplicationRule), - Protocols: []*armnetwork.FirewallPolicyRuleApplicationProtocol{ - { - Port: to.Ptr[int32](443), - ProtocolType: to.Ptr(armnetwork.FirewallPolicyRuleApplicationProtocolTypeHTTPS), - }}, - SourceAddresses: []*string{ - to.Ptr("216.58.216.164"), - to.Ptr("10.0.0.0/24")}, - WebCategories: []*string{ - to.Ptr("Hacking")}, - }}, - }}, - }, - }, nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - res, err := poller.PollUntilDone(ctx, nil) - if err != nil { - log.Fatalf("failed to pull the result: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.FirewallPolicyRuleCollectionGroup = armnetwork.FirewallPolicyRuleCollectionGroup{ - // ID: to.Ptr("/subscriptions/e747cc13-97d4-4a79-b463-42d7f4e558f2/resourceGroups/rg1/providers/Microsoft.Network/firewallPolicies/firewallPolicy/ruleCollectionGroups/ruleCollectionGroup1"), - // Name: to.Ptr("ruleCollectionGroup1"), - // Etag: to.Ptr("w/\\00000000-0000-0000-0000-000000000000\\"), - // Properties: &armnetwork.FirewallPolicyRuleCollectionGroupProperties{ - // Priority: to.Ptr[int32](110), - // ProvisioningState: to.Ptr(armnetwork.ProvisioningStateSucceeded), - // RuleCollections: []armnetwork.FirewallPolicyRuleCollectionClassification{ - // &armnetwork.FirewallPolicyFilterRuleCollection{ - // Name: to.Ptr("Example-Filter-Rule-Collection"), - // RuleCollectionType: to.Ptr(armnetwork.FirewallPolicyRuleCollectionTypeFirewallPolicyFilterRuleCollection), - // Action: &armnetwork.FirewallPolicyFilterRuleCollectionAction{ - // Type: to.Ptr(armnetwork.FirewallPolicyFilterRuleCollectionActionTypeDeny), - // }, - // Rules: []armnetwork.FirewallPolicyRuleClassification{ - // &armnetwork.ApplicationRule{ - // Name: to.Ptr("rule1"), - // Description: to.Ptr("Deny inbound rule"), - // RuleType: to.Ptr(armnetwork.FirewallPolicyRuleTypeApplicationRule), - // Protocols: []*armnetwork.FirewallPolicyRuleApplicationProtocol{ - // { - // Port: to.Ptr[int32](443), - // ProtocolType: to.Ptr(armnetwork.FirewallPolicyRuleApplicationProtocolTypeHTTPS), - // }}, - // SourceAddresses: []*string{ - // to.Ptr("216.58.216.164"), - // to.Ptr("10.0.0.0/24")}, - // WebCategories: []*string{ - // to.Ptr("Hacking")}, - // }}, - // }}, - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/4883fa5dbf6f2c9093fac8ce334547e9dfac68fa/specification/network/resource-manager/Microsoft.Network/stable/2024-03-01/examples/FirewallPolicyRuleCollectionGroupWithHttpHeadersToInsert.json -func ExampleFirewallPolicyRuleCollectionGroupsClient_BeginCreateOrUpdate_createFirewallPolicyRuleCollectionGroupWithHttpHeaderToInsert() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armnetwork.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewFirewallPolicyRuleCollectionGroupsClient().BeginCreateOrUpdate(ctx, "rg1", "firewallPolicy", "ruleCollectionGroup1", armnetwork.FirewallPolicyRuleCollectionGroup{ - Properties: &armnetwork.FirewallPolicyRuleCollectionGroupProperties{ - Priority: to.Ptr[int32](110), - RuleCollections: []armnetwork.FirewallPolicyRuleCollectionClassification{ - &armnetwork.FirewallPolicyFilterRuleCollection{ - Name: to.Ptr("Example-Filter-Rule-Collection"), - RuleCollectionType: to.Ptr(armnetwork.FirewallPolicyRuleCollectionTypeFirewallPolicyFilterRuleCollection), - Action: &armnetwork.FirewallPolicyFilterRuleCollectionAction{ - Type: to.Ptr(armnetwork.FirewallPolicyFilterRuleCollectionActionTypeAllow), - }, - Rules: []armnetwork.FirewallPolicyRuleClassification{ - &armnetwork.ApplicationRule{ - Name: to.Ptr("rule1"), - Description: to.Ptr("Insert trusted tenants header"), - RuleType: to.Ptr(armnetwork.FirewallPolicyRuleTypeApplicationRule), - FqdnTags: []*string{ - to.Ptr("WindowsVirtualDesktop")}, - HTTPHeadersToInsert: []*armnetwork.FirewallPolicyHTTPHeaderToInsert{ - { - HeaderName: to.Ptr("Restrict-Access-To-Tenants"), - HeaderValue: to.Ptr("contoso.com,fabrikam.onmicrosoft.com"), - }}, - Protocols: []*armnetwork.FirewallPolicyRuleApplicationProtocol{ - { - Port: to.Ptr[int32](80), - ProtocolType: to.Ptr(armnetwork.FirewallPolicyRuleApplicationProtocolTypeHTTP), - }}, - SourceAddresses: []*string{ - to.Ptr("216.58.216.164"), - to.Ptr("10.0.0.0/24")}, - }}, - }}, - }, - }, nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - res, err := poller.PollUntilDone(ctx, nil) - if err != nil { - log.Fatalf("failed to pull the result: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.FirewallPolicyRuleCollectionGroup = armnetwork.FirewallPolicyRuleCollectionGroup{ - // ID: to.Ptr("/subscriptions/e747cc13-97d4-4a79-b463-42d7f4e558f2/resourceGroups/rg1/providers/Microsoft.Network/firewallPolicies/firewallPolicy/ruleCollectionGroups/ruleCollectionGroup1"), - // Name: to.Ptr("ruleCollectionGroup1"), - // Etag: to.Ptr("w/\\00000000-0000-0000-0000-000000000000\\"), - // Properties: &armnetwork.FirewallPolicyRuleCollectionGroupProperties{ - // Priority: to.Ptr[int32](110), - // ProvisioningState: to.Ptr(armnetwork.ProvisioningStateSucceeded), - // RuleCollections: []armnetwork.FirewallPolicyRuleCollectionClassification{ - // &armnetwork.FirewallPolicyFilterRuleCollection{ - // Name: to.Ptr("Example-Filter-Rule-Collection"), - // RuleCollectionType: to.Ptr(armnetwork.FirewallPolicyRuleCollectionTypeFirewallPolicyFilterRuleCollection), - // Action: &armnetwork.FirewallPolicyFilterRuleCollectionAction{ - // Type: to.Ptr(armnetwork.FirewallPolicyFilterRuleCollectionActionTypeAllow), - // }, - // Rules: []armnetwork.FirewallPolicyRuleClassification{ - // &armnetwork.ApplicationRule{ - // Name: to.Ptr("rule1"), - // Description: to.Ptr("Insert trusted tenants header"), - // RuleType: to.Ptr(armnetwork.FirewallPolicyRuleTypeApplicationRule), - // FqdnTags: []*string{ - // to.Ptr("WindowsVirtualDesktop")}, - // HTTPHeadersToInsert: []*armnetwork.FirewallPolicyHTTPHeaderToInsert{ - // { - // HeaderName: to.Ptr("Restrict-Access-To-Tenants"), - // HeaderValue: to.Ptr("contoso.com,fabrikam.onmicrosoft.com"), - // }}, - // Protocols: []*armnetwork.FirewallPolicyRuleApplicationProtocol{ - // { - // Port: to.Ptr[int32](80), - // ProtocolType: to.Ptr(armnetwork.FirewallPolicyRuleApplicationProtocolTypeHTTP), - // }}, - // SourceAddresses: []*string{ - // to.Ptr("216.58.216.164"), - // to.Ptr("10.0.0.0/24")}, - // }}, - // }}, - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/4883fa5dbf6f2c9093fac8ce334547e9dfac68fa/specification/network/resource-manager/Microsoft.Network/stable/2024-03-01/examples/FirewallPolicyRuleCollectionGroupWithWebCategoriesList.json -func ExampleFirewallPolicyRuleCollectionGroupsClient_NewListPager_listAllFirewallPolicyRuleCollectionGroupWithWebCategories() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armnetwork.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := clientFactory.NewFirewallPolicyRuleCollectionGroupsClient().NewListPager("rg1", "firewallPolicy", nil) - for pager.More() { - page, err := pager.NextPage(ctx) - if err != nil { - log.Fatalf("failed to advance page: %v", err) - } - for _, v := range page.Value { - // You could use page here. We use blank identifier for just demo purposes. - _ = v - } - // If the HTTP response code is 200 as defined in example definition, your page structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // page.FirewallPolicyRuleCollectionGroupListResult = armnetwork.FirewallPolicyRuleCollectionGroupListResult{ - // Value: []*armnetwork.FirewallPolicyRuleCollectionGroup{ - // { - // ID: to.Ptr("/subscriptions/e747cc13-97d4-4a79-b463-42d7f4e558f2/resourceGroups/rg1/providers/Microsoft.Network/firewallPolicies/firewallPolicy/ruleCollectionGroups/ruleCollectionGroup1"), - // Name: to.Ptr("ruleCollectionGroup1"), - // Etag: to.Ptr("W/\"72090554-7e3b-43f2-80ad-99a9020dcb11\""), - // Properties: &armnetwork.FirewallPolicyRuleCollectionGroupProperties{ - // Priority: to.Ptr[int32](110), - // ProvisioningState: to.Ptr(armnetwork.ProvisioningStateSucceeded), - // RuleCollections: []armnetwork.FirewallPolicyRuleCollectionClassification{ - // &armnetwork.FirewallPolicyFilterRuleCollection{ - // Name: to.Ptr("Example-Filter-Rule-Collection"), - // Priority: to.Ptr[int32](120), - // RuleCollectionType: to.Ptr(armnetwork.FirewallPolicyRuleCollectionTypeFirewallPolicyFilterRuleCollection), - // Action: &armnetwork.FirewallPolicyFilterRuleCollectionAction{ - // Type: to.Ptr(armnetwork.FirewallPolicyFilterRuleCollectionActionTypeDeny), - // }, - // Rules: []armnetwork.FirewallPolicyRuleClassification{ - // &armnetwork.ApplicationRule{ - // Name: to.Ptr("rule1"), - // Description: to.Ptr("Deny inbound rule"), - // RuleType: to.Ptr(armnetwork.FirewallPolicyRuleTypeApplicationRule), - // Protocols: []*armnetwork.FirewallPolicyRuleApplicationProtocol{ - // { - // Port: to.Ptr[int32](443), - // ProtocolType: to.Ptr(armnetwork.FirewallPolicyRuleApplicationProtocolTypeHTTPS), - // }}, - // SourceAddresses: []*string{ - // to.Ptr("216.58.216.164"), - // to.Ptr("10.0.0.0/24")}, - // WebCategories: []*string{ - // to.Ptr("Hacking")}, - // }}, - // }}, - // }, - // }}, - // } - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/4883fa5dbf6f2c9093fac8ce334547e9dfac68fa/specification/network/resource-manager/Microsoft.Network/stable/2024-03-01/examples/FirewallPolicyRuleCollectionGroupList.json -func ExampleFirewallPolicyRuleCollectionGroupsClient_NewListPager_listAllFirewallPolicyRuleCollectionGroupsForAGivenFirewallPolicy() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armnetwork.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := clientFactory.NewFirewallPolicyRuleCollectionGroupsClient().NewListPager("rg1", "firewallPolicy", nil) - for pager.More() { - page, err := pager.NextPage(ctx) - if err != nil { - log.Fatalf("failed to advance page: %v", err) - } - for _, v := range page.Value { - // You could use page here. We use blank identifier for just demo purposes. - _ = v - } - // If the HTTP response code is 200 as defined in example definition, your page structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // page.FirewallPolicyRuleCollectionGroupListResult = armnetwork.FirewallPolicyRuleCollectionGroupListResult{ - // Value: []*armnetwork.FirewallPolicyRuleCollectionGroup{ - // { - // ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/firewallPolicies/firewallPolicy/ruleCollectionGroups/ruleCollectionGroup1"), - // Name: to.Ptr("ruleCollectionGroup1"), - // Etag: to.Ptr("W/\"72090554-7e3b-43f2-80ad-99a9020dcb11\""), - // Properties: &armnetwork.FirewallPolicyRuleCollectionGroupProperties{ - // Priority: to.Ptr[int32](110), - // ProvisioningState: to.Ptr(armnetwork.ProvisioningStateSucceeded), - // RuleCollections: []armnetwork.FirewallPolicyRuleCollectionClassification{ - // &armnetwork.FirewallPolicyFilterRuleCollection{ - // Name: to.Ptr("Example-Filter-Rule-Collection"), - // Priority: to.Ptr[int32](120), - // RuleCollectionType: to.Ptr(armnetwork.FirewallPolicyRuleCollectionTypeFirewallPolicyFilterRuleCollection), - // Action: &armnetwork.FirewallPolicyFilterRuleCollectionAction{ - // Type: to.Ptr(armnetwork.FirewallPolicyFilterRuleCollectionActionTypeDeny), - // }, - // Rules: []armnetwork.FirewallPolicyRuleClassification{ - // &armnetwork.Rule{ - // Name: to.Ptr("network-rule-1"), - // Description: to.Ptr("Network rule"), - // RuleType: to.Ptr(armnetwork.FirewallPolicyRuleTypeNetworkRule), - // DestinationAddresses: []*string{ - // to.Ptr("*")}, - // DestinationPorts: []*string{ - // to.Ptr("*")}, - // IPProtocols: []*armnetwork.FirewallPolicyRuleNetworkProtocol{ - // to.Ptr(armnetwork.FirewallPolicyRuleNetworkProtocolTCP)}, - // SourceAddresses: []*string{ - // to.Ptr("10.1.25.0/24")}, - // }}, - // }}, - // }, - // }}, - // } - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/4883fa5dbf6f2c9093fac8ce334547e9dfac68fa/specification/network/resource-manager/Microsoft.Network/stable/2024-03-01/examples/FirewallPolicyRuleCollectionGroupWithIpGroupsList.json -func ExampleFirewallPolicyRuleCollectionGroupsClient_NewListPager_listAllFirewallPolicyRuleCollectionGroupsWithIpGroupsForAGivenFirewallPolicy() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armnetwork.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := clientFactory.NewFirewallPolicyRuleCollectionGroupsClient().NewListPager("rg1", "firewallPolicy", nil) - for pager.More() { - page, err := pager.NextPage(ctx) - if err != nil { - log.Fatalf("failed to advance page: %v", err) - } - for _, v := range page.Value { - // You could use page here. We use blank identifier for just demo purposes. - _ = v - } - // If the HTTP response code is 200 as defined in example definition, your page structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // page.FirewallPolicyRuleCollectionGroupListResult = armnetwork.FirewallPolicyRuleCollectionGroupListResult{ - // Value: []*armnetwork.FirewallPolicyRuleCollectionGroup{ - // { - // ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/firewallPolicies/firewallPolicy/ruleCollectionGroups/ruleCollectionGroup1"), - // Name: to.Ptr("ruleCollectionGroup1"), - // Etag: to.Ptr("W/\"72090554-7e3b-43f2-80ad-99a9020dcb11\""), - // Properties: &armnetwork.FirewallPolicyRuleCollectionGroupProperties{ - // Priority: to.Ptr[int32](110), - // ProvisioningState: to.Ptr(armnetwork.ProvisioningStateSucceeded), - // RuleCollections: []armnetwork.FirewallPolicyRuleCollectionClassification{ - // &armnetwork.FirewallPolicyFilterRuleCollection{ - // Name: to.Ptr("Example-Filter-Rule-Collection"), - // Priority: to.Ptr[int32](120), - // RuleCollectionType: to.Ptr(armnetwork.FirewallPolicyRuleCollectionTypeFirewallPolicyFilterRuleCollection), - // Action: &armnetwork.FirewallPolicyFilterRuleCollectionAction{ - // Type: to.Ptr(armnetwork.FirewallPolicyFilterRuleCollectionActionTypeDeny), - // }, - // Rules: []armnetwork.FirewallPolicyRuleClassification{ - // &armnetwork.Rule{ - // Name: to.Ptr("network-rule-1"), - // Description: to.Ptr("Network rule"), - // RuleType: to.Ptr(armnetwork.FirewallPolicyRuleTypeNetworkRule), - // DestinationIPGroups: []*string{ - // to.Ptr("/subscriptions/subid/providers/Microsoft.Network/resourceGroup/rg1/ipGroups/ipGroups2")}, - // DestinationPorts: []*string{ - // to.Ptr("*")}, - // IPProtocols: []*armnetwork.FirewallPolicyRuleNetworkProtocol{ - // to.Ptr(armnetwork.FirewallPolicyRuleNetworkProtocolTCP)}, - // SourceIPGroups: []*string{ - // to.Ptr("/subscriptions/subid/providers/Microsoft.Network/resourceGroup/rg1/ipGroups/ipGroups1")}, - // }}, - // }}, - // }, - // }}, - // } - } -} diff --git a/sdk/resourcemanager/network/armnetwork/flowlogs_client_example_test.go b/sdk/resourcemanager/network/armnetwork/flowlogs_client_example_test.go deleted file mode 100644 index 76a8392df6b2..000000000000 --- a/sdk/resourcemanager/network/armnetwork/flowlogs_client_example_test.go +++ /dev/null @@ -1,341 +0,0 @@ -//go:build go1.18 -// +build go1.18 - -// 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. -// DO NOT EDIT. - -package armnetwork_test - -import ( - "context" - "log" - - "github.com/Azure/azure-sdk-for-go/sdk/azcore/to" - "github.com/Azure/azure-sdk-for-go/sdk/azidentity" - "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/network/armnetwork/v6" -) - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/4883fa5dbf6f2c9093fac8ce334547e9dfac68fa/specification/network/resource-manager/Microsoft.Network/stable/2024-03-01/examples/NetworkWatcherFlowLogCreate.json -func ExampleFlowLogsClient_BeginCreateOrUpdate() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armnetwork.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewFlowLogsClient().BeginCreateOrUpdate(ctx, "rg1", "nw1", "fl", armnetwork.FlowLog{ - Location: to.Ptr("centraluseuap"), - Identity: &armnetwork.ManagedServiceIdentity{ - Type: to.Ptr(armnetwork.ResourceIdentityTypeUserAssigned), - UserAssignedIdentities: map[string]*armnetwork.Components1Jq1T4ISchemasManagedserviceidentityPropertiesUserassignedidentitiesAdditionalproperties{ - "/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.ManagedIdentity/userAssignedIdentities/id1": {}, - }, - }, - Properties: &armnetwork.FlowLogPropertiesFormat{ - Format: &armnetwork.FlowLogFormatParameters{ - Type: to.Ptr(armnetwork.FlowLogFormatTypeJSON), - Version: to.Ptr[int32](1), - }, - Enabled: to.Ptr(true), - EnabledFilteringCriteria: to.Ptr("srcIP=158.255.7.8 || dstPort=56891"), - StorageID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Storage/storageAccounts/nwtest1mgvbfmqsigdxe"), - TargetResourceID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/networkSecurityGroups/desmondcentral-nsg"), - }, - }, nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - res, err := poller.PollUntilDone(ctx, nil) - if err != nil { - log.Fatalf("failed to pull the result: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.FlowLog = armnetwork.FlowLog{ - // Name: to.Ptr("Microsoft.Networkdesmond-rgdesmondcentral-nsg"), - // Type: to.Ptr("Microsoft.Network/networkWatchers/FlowLogs"), - // ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/networkWatchers/nw/FlowLogs/fl"), - // Location: to.Ptr("centraluseuap"), - // Etag: to.Ptr("W/\"00000000-0000-0000-0000-000000000000\""), - // Identity: &armnetwork.ManagedServiceIdentity{ - // Type: to.Ptr(armnetwork.ResourceIdentityTypeUserAssigned), - // UserAssignedIdentities: map[string]*armnetwork.Components1Jq1T4ISchemasManagedserviceidentityPropertiesUserassignedidentitiesAdditionalproperties{ - // "/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.ManagedIdentity/userAssignedIdentities/id1": &armnetwork.Components1Jq1T4ISchemasManagedserviceidentityPropertiesUserassignedidentitiesAdditionalproperties{ - // ClientID: to.Ptr("c16d15e1-f60a-40e4-8a05-df3d3f655c14"), - // PrincipalID: to.Ptr("e3858881-e40c-43bd-9cde-88da39c05023"), - // }, - // }, - // }, - // Properties: &armnetwork.FlowLogPropertiesFormat{ - // Format: &armnetwork.FlowLogFormatParameters{ - // Type: to.Ptr(armnetwork.FlowLogFormatTypeJSON), - // Version: to.Ptr[int32](1), - // }, - // Enabled: to.Ptr(true), - // EnabledFilteringCriteria: to.Ptr("srcIP=158.255.7.8 || dstPort=56891"), - // FlowAnalyticsConfiguration: &armnetwork.TrafficAnalyticsProperties{ - // }, - // ProvisioningState: to.Ptr(armnetwork.ProvisioningStateSucceeded), - // RetentionPolicy: &armnetwork.RetentionPolicyParameters{ - // Days: to.Ptr[int32](0), - // Enabled: to.Ptr(false), - // }, - // StorageID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Storage/storageAccounts/nwtest1mgvbfmqsigdxe"), - // TargetResourceGUID: to.Ptr("00000000-0000-0000-0000-000000000000"), - // TargetResourceID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/networkSecurityGroups/desmondcentral-nsg"), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/4883fa5dbf6f2c9093fac8ce334547e9dfac68fa/specification/network/resource-manager/Microsoft.Network/stable/2024-03-01/examples/NetworkWatcherFlowLogUpdateTags.json -func ExampleFlowLogsClient_UpdateTags() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armnetwork.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewFlowLogsClient().UpdateTags(ctx, "rg1", "nw", "fl", armnetwork.TagsObject{ - Tags: map[string]*string{ - "tag1": to.Ptr("value1"), - "tag2": to.Ptr("value2"), - }, - }, nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.FlowLog = armnetwork.FlowLog{ - // Name: to.Ptr("Microsoft.Networkdesmond-rgdesmondcentral-nsg"), - // Type: to.Ptr("Microsoft.Network/networkWatchers/FlowLogs"), - // ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/networkWatchers/nw/FlowLogs/fl"), - // Location: to.Ptr("centralus"), - // Tags: map[string]*string{ - // "tag1": to.Ptr("value1"), - // "tag2": to.Ptr("value2"), - // }, - // Etag: to.Ptr("W/\"00000000-0000-0000-0000-000000000000\""), - // Identity: &armnetwork.ManagedServiceIdentity{ - // Type: to.Ptr(armnetwork.ResourceIdentityTypeUserAssigned), - // UserAssignedIdentities: map[string]*armnetwork.Components1Jq1T4ISchemasManagedserviceidentityPropertiesUserassignedidentitiesAdditionalproperties{ - // "/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.ManagedIdentity/userAssignedIdentities/id1": &armnetwork.Components1Jq1T4ISchemasManagedserviceidentityPropertiesUserassignedidentitiesAdditionalproperties{ - // ClientID: to.Ptr("c16d15e1-f60a-40e4-8a05-df3d3f655c14"), - // PrincipalID: to.Ptr("e3858881-e40c-43bd-9cde-88da39c05023"), - // }, - // }, - // }, - // Properties: &armnetwork.FlowLogPropertiesFormat{ - // Format: &armnetwork.FlowLogFormatParameters{ - // Type: to.Ptr(armnetwork.FlowLogFormatTypeJSON), - // Version: to.Ptr[int32](1), - // }, - // Enabled: to.Ptr(true), - // EnabledFilteringCriteria: to.Ptr("srcIP=158.255.7.8 || dstPort=56891"), - // FlowAnalyticsConfiguration: &armnetwork.TrafficAnalyticsProperties{ - // }, - // ProvisioningState: to.Ptr(armnetwork.ProvisioningStateSucceeded), - // RetentionPolicy: &armnetwork.RetentionPolicyParameters{ - // Days: to.Ptr[int32](0), - // Enabled: to.Ptr(false), - // }, - // StorageID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Storage/storageAccounts/nwtest1mgvbfmqsigdxe"), - // TargetResourceGUID: to.Ptr("00000000-0000-0000-0000-000000000000"), - // TargetResourceID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/networkSecurityGroups/desmondcentral-nsg"), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/4883fa5dbf6f2c9093fac8ce334547e9dfac68fa/specification/network/resource-manager/Microsoft.Network/stable/2024-03-01/examples/NetworkWatcherFlowLogGet.json -func ExampleFlowLogsClient_Get() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armnetwork.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewFlowLogsClient().Get(ctx, "rg1", "nw1", "flowLog1", nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.FlowLog = armnetwork.FlowLog{ - // Name: to.Ptr("flowLog1"), - // Type: to.Ptr("Microsoft.Network/networkWatchers/FlowLogs"), - // ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/networkWatchers/тц1/FlowLogs/flowLog1"), - // Location: to.Ptr("centraluseuap"), - // Etag: to.Ptr("W/\"00000000-0000-0000-0000-000000000000\""), - // Identity: &armnetwork.ManagedServiceIdentity{ - // Type: to.Ptr(armnetwork.ResourceIdentityTypeUserAssigned), - // UserAssignedIdentities: map[string]*armnetwork.Components1Jq1T4ISchemasManagedserviceidentityPropertiesUserassignedidentitiesAdditionalproperties{ - // "/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.ManagedIdentity/userAssignedIdentities/id1": &armnetwork.Components1Jq1T4ISchemasManagedserviceidentityPropertiesUserassignedidentitiesAdditionalproperties{ - // ClientID: to.Ptr("c16d15e1-f60a-40e4-8a05-df3d3f655c14"), - // PrincipalID: to.Ptr("e3858881-e40c-43bd-9cde-88da39c05023"), - // }, - // }, - // }, - // Properties: &armnetwork.FlowLogPropertiesFormat{ - // Format: &armnetwork.FlowLogFormatParameters{ - // Type: to.Ptr(armnetwork.FlowLogFormatTypeJSON), - // Version: to.Ptr[int32](2), - // }, - // Enabled: to.Ptr(true), - // EnabledFilteringCriteria: to.Ptr("srcIP=158.255.7.8 || dstPort=56891"), - // FlowAnalyticsConfiguration: &armnetwork.TrafficAnalyticsProperties{ - // NetworkWatcherFlowAnalyticsConfiguration: &armnetwork.TrafficAnalyticsConfigurationProperties{ - // Enabled: to.Ptr(false), - // TrafficAnalyticsInterval: to.Ptr[int32](60), - // WorkspaceID: to.Ptr("-"), - // WorkspaceRegion: to.Ptr("-"), - // }, - // }, - // ProvisioningState: to.Ptr(armnetwork.ProvisioningStateSucceeded), - // RetentionPolicy: &armnetwork.RetentionPolicyParameters{ - // Days: to.Ptr[int32](0), - // Enabled: to.Ptr(false), - // }, - // StorageID: to.Ptr("/subscriptions/subid/resourceGroups/rg/providers/Microsoft.Storage/storageAccounts/wzstorage002"), - // TargetResourceGUID: to.Ptr("00000000-0000-0000-0000-000000000000"), - // TargetResourceID: to.Ptr("/subscriptions/subid/resourceGroups/rg/providers/Microsoft.Network/networkSecurityGroups/vm5-nsg"), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/4883fa5dbf6f2c9093fac8ce334547e9dfac68fa/specification/network/resource-manager/Microsoft.Network/stable/2024-03-01/examples/NetworkWatcherFlowLogDelete.json -func ExampleFlowLogsClient_BeginDelete() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armnetwork.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewFlowLogsClient().BeginDelete(ctx, "rg1", "nw1", "fl", nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - _, err = poller.PollUntilDone(ctx, nil) - if err != nil { - log.Fatalf("failed to pull the result: %v", err) - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/4883fa5dbf6f2c9093fac8ce334547e9dfac68fa/specification/network/resource-manager/Microsoft.Network/stable/2024-03-01/examples/NetworkWatcherFlowLogList.json -func ExampleFlowLogsClient_NewListPager() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armnetwork.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := clientFactory.NewFlowLogsClient().NewListPager("rg1", "nw1", nil) - for pager.More() { - page, err := pager.NextPage(ctx) - if err != nil { - log.Fatalf("failed to advance page: %v", err) - } - for _, v := range page.Value { - // You could use page here. We use blank identifier for just demo purposes. - _ = v - } - // If the HTTP response code is 200 as defined in example definition, your page structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // page.FlowLogListResult = armnetwork.FlowLogListResult{ - // Value: []*armnetwork.FlowLog{ - // { - // Name: to.Ptr("flowLog1"), - // Type: to.Ptr("Microsoft.Network/networkWatchers/FlowLogs"), - // ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/networkWatchers/тц1/FlowLogs/flowLog1"), - // Location: to.Ptr("centraluseuap"), - // Etag: to.Ptr("W/\"00000000-0000-0000-0000-000000000000\""), - // Identity: &armnetwork.ManagedServiceIdentity{ - // Type: to.Ptr(armnetwork.ResourceIdentityTypeUserAssigned), - // UserAssignedIdentities: map[string]*armnetwork.Components1Jq1T4ISchemasManagedserviceidentityPropertiesUserassignedidentitiesAdditionalproperties{ - // "/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.ManagedIdentity/userAssignedIdentities/id1": &armnetwork.Components1Jq1T4ISchemasManagedserviceidentityPropertiesUserassignedidentitiesAdditionalproperties{ - // ClientID: to.Ptr("c16d15e1-f60a-40e4-8a05-df3d3f655c14"), - // PrincipalID: to.Ptr("e3858881-e40c-43bd-9cde-88da39c05023"), - // }, - // }, - // }, - // Properties: &armnetwork.FlowLogPropertiesFormat{ - // Format: &armnetwork.FlowLogFormatParameters{ - // Type: to.Ptr(armnetwork.FlowLogFormatTypeJSON), - // Version: to.Ptr[int32](2), - // }, - // Enabled: to.Ptr(true), - // EnabledFilteringCriteria: to.Ptr("srcIP=158.255.7.8 || dstPort=56891"), - // FlowAnalyticsConfiguration: &armnetwork.TrafficAnalyticsProperties{ - // NetworkWatcherFlowAnalyticsConfiguration: &armnetwork.TrafficAnalyticsConfigurationProperties{ - // Enabled: to.Ptr(false), - // TrafficAnalyticsInterval: to.Ptr[int32](60), - // WorkspaceID: to.Ptr("-"), - // WorkspaceRegion: to.Ptr("-"), - // }, - // }, - // ProvisioningState: to.Ptr(armnetwork.ProvisioningStateSucceeded), - // RetentionPolicy: &armnetwork.RetentionPolicyParameters{ - // Days: to.Ptr[int32](0), - // Enabled: to.Ptr(false), - // }, - // StorageID: to.Ptr("/subscriptions/subid/resourceGroups/rg/providers/Microsoft.Storage/storageAccounts/wzstorage002"), - // TargetResourceGUID: to.Ptr("00000000-0000-0000-0000-000000000000"), - // TargetResourceID: to.Ptr("/subscriptions/subid/resourceGroups/rg/providers/Microsoft.Network/networkSecurityGroups/vm5-nsg"), - // }, - // }, - // { - // Name: to.Ptr("flowLog2"), - // Type: to.Ptr("Microsoft.Network/networkWatchers/FlowLogs"), - // ID: to.Ptr("/subscriptions/96e68903-0a56-4819-9987-8d08ad6a1f99/resourceGroups/NetworkWatcherRG/providers/Microsoft.Network/networkWatchers/NetworkWatcher_centraluseuap/FlowLogs/flowLog2"), - // Location: to.Ptr("centraluseuap"), - // Etag: to.Ptr("W/\"00000000-0000-0000-0000-000000000000\""), - // Identity: &armnetwork.ManagedServiceIdentity{ - // Type: to.Ptr(armnetwork.ResourceIdentityTypeUserAssigned), - // UserAssignedIdentities: map[string]*armnetwork.Components1Jq1T4ISchemasManagedserviceidentityPropertiesUserassignedidentitiesAdditionalproperties{ - // "/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.ManagedIdentity/userAssignedIdentities/id1": &armnetwork.Components1Jq1T4ISchemasManagedserviceidentityPropertiesUserassignedidentitiesAdditionalproperties{ - // ClientID: to.Ptr("c16d15e1-f60a-40e4-8a05-df3d3f655c14"), - // PrincipalID: to.Ptr("e3858881-e40c-43bd-9cde-88da39c05023"), - // }, - // }, - // }, - // Properties: &armnetwork.FlowLogPropertiesFormat{ - // Format: &armnetwork.FlowLogFormatParameters{ - // Type: to.Ptr(armnetwork.FlowLogFormatTypeJSON), - // Version: to.Ptr[int32](2), - // }, - // Enabled: to.Ptr(true), - // EnabledFilteringCriteria: to.Ptr("srcIP=158.255.7.8 || dstPort=56891"), - // FlowAnalyticsConfiguration: &armnetwork.TrafficAnalyticsProperties{ - // }, - // ProvisioningState: to.Ptr(armnetwork.ProvisioningStateSucceeded), - // RetentionPolicy: &armnetwork.RetentionPolicyParameters{ - // Days: to.Ptr[int32](0), - // Enabled: to.Ptr(false), - // }, - // StorageID: to.Ptr("/subscriptions/subid/resourceGroups/rg/providers/Microsoft.Storage/storageAccounts/iraflowlogtest2diag"), - // TargetResourceGUID: to.Ptr("00000000-0000-0000-0000-000000000000"), - // TargetResourceID: to.Ptr("/subscriptions/subid/resourceGroups/rg/providers/Microsoft.Network/networkSecurityGroups/DSCP-test-vm1-nsg"), - // }, - // }}, - // } - } -} diff --git a/sdk/resourcemanager/network/armnetwork/go.mod b/sdk/resourcemanager/network/armnetwork/go.mod index 8f2eee8faca7..5218d5601db8 100644 --- a/sdk/resourcemanager/network/armnetwork/go.mod +++ b/sdk/resourcemanager/network/armnetwork/go.mod @@ -4,13 +4,13 @@ go 1.18 require ( github.com/Azure/azure-sdk-for-go/sdk/azcore v1.13.0 - github.com/Azure/azure-sdk-for-go/sdk/azidentity v1.7.0 github.com/Azure/azure-sdk-for-go/sdk/internal v1.10.0 github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/internal/v3 v3.1.0 github.com/stretchr/testify v1.9.0 ) require ( + github.com/Azure/azure-sdk-for-go/sdk/azidentity v1.7.0 // indirect github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/resources/armresources v1.2.0 // indirect github.com/AzureAD/microsoft-authentication-library-for-go v1.2.2 // indirect github.com/davecgh/go-spew v1.1.1 // indirect diff --git a/sdk/resourcemanager/network/armnetwork/groups_client_example_test.go b/sdk/resourcemanager/network/armnetwork/groups_client_example_test.go deleted file mode 100644 index f1c115082f0d..000000000000 --- a/sdk/resourcemanager/network/armnetwork/groups_client_example_test.go +++ /dev/null @@ -1,172 +0,0 @@ -//go:build go1.18 -// +build go1.18 - -// 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. -// DO NOT EDIT. - -package armnetwork_test - -import ( - "context" - "log" - - "github.com/Azure/azure-sdk-for-go/sdk/azcore/to" - "github.com/Azure/azure-sdk-for-go/sdk/azidentity" - "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/network/armnetwork/v6" -) - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/4883fa5dbf6f2c9093fac8ce334547e9dfac68fa/specification/network/resource-manager/Microsoft.Network/stable/2024-03-01/examples/NetworkManagerGroupGet.json -func ExampleGroupsClient_Get() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armnetwork.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewGroupsClient().Get(ctx, "rg1", "testNetworkManager", "testNetworkGroup", nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.Group = armnetwork.Group{ - // Name: to.Ptr("testNetworkGroup"), - // Type: to.Ptr("Microsoft.Network/networkManagers/networkGroups"), - // ID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroup/rg1/providers/Microsoft.Network/networkManagers/testNetworkManager/networkGroups/testNetworkGroup"), - // Properties: &armnetwork.GroupProperties{ - // Description: to.Ptr("A sample group"), - // MemberType: to.Ptr(armnetwork.GroupMemberTypeVirtualNetwork), - // ProvisioningState: to.Ptr(armnetwork.ProvisioningStateSucceeded), - // ResourceGUID: to.Ptr("00000000-0000-0000-0000-000000000000"), - // }, - // SystemData: &armnetwork.SystemData{ - // CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-01-11T18:52:27.000Z"); return t}()), - // CreatedBy: to.Ptr("b69a9388-9488-4534-b470-7ec6d41beef5"), - // CreatedByType: to.Ptr(armnetwork.CreatedByTypeUser), - // LastModifiedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-01-11T18:52:27.000Z"); return t}()), - // LastModifiedBy: to.Ptr("b69a9388-9488-4534-b470-7ec6d41beef5"), - // LastModifiedByType: to.Ptr(armnetwork.CreatedByTypeUser), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/4883fa5dbf6f2c9093fac8ce334547e9dfac68fa/specification/network/resource-manager/Microsoft.Network/stable/2024-03-01/examples/NetworkManagerGroupPut.json -func ExampleGroupsClient_CreateOrUpdate() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armnetwork.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewGroupsClient().CreateOrUpdate(ctx, "rg1", "testNetworkManager", "testNetworkGroup", armnetwork.Group{ - Properties: &armnetwork.GroupProperties{ - Description: to.Ptr("A sample group"), - MemberType: to.Ptr(armnetwork.GroupMemberTypeVirtualNetwork), - }, - }, &armnetwork.GroupsClientCreateOrUpdateOptions{IfMatch: nil}) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.Group = armnetwork.Group{ - // Name: to.Ptr("testNetworkGroup"), - // Type: to.Ptr("Microsoft.Network/networkManagers/networkGroups"), - // ID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroup/rg1/providers/Microsoft.Network/networkManagers/testNetworkManager/networkGroups/testNetworkGroup"), - // Properties: &armnetwork.GroupProperties{ - // Description: to.Ptr("A sample group"), - // MemberType: to.Ptr(armnetwork.GroupMemberTypeVirtualNetwork), - // ProvisioningState: to.Ptr(armnetwork.ProvisioningStateSucceeded), - // ResourceGUID: to.Ptr("00000000-0000-0000-0000-000000000000"), - // }, - // SystemData: &armnetwork.SystemData{ - // CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-01-11T18:52:27.000Z"); return t}()), - // CreatedBy: to.Ptr("b69a9388-9488-4534-b470-7ec6d41beef5"), - // CreatedByType: to.Ptr(armnetwork.CreatedByTypeUser), - // LastModifiedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-01-11T18:52:27.000Z"); return t}()), - // LastModifiedBy: to.Ptr("b69a9388-9488-4534-b470-7ec6d41beef5"), - // LastModifiedByType: to.Ptr(armnetwork.CreatedByTypeUser), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/4883fa5dbf6f2c9093fac8ce334547e9dfac68fa/specification/network/resource-manager/Microsoft.Network/stable/2024-03-01/examples/NetworkManagerGroupDelete.json -func ExampleGroupsClient_BeginDelete() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armnetwork.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewGroupsClient().BeginDelete(ctx, "rg1", "testNetworkManager", "testNetworkGroup", &armnetwork.GroupsClientBeginDeleteOptions{Force: to.Ptr(false)}) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - _, err = poller.PollUntilDone(ctx, nil) - if err != nil { - log.Fatalf("failed to pull the result: %v", err) - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/4883fa5dbf6f2c9093fac8ce334547e9dfac68fa/specification/network/resource-manager/Microsoft.Network/stable/2024-03-01/examples/NetworkManagerGroupList.json -func ExampleGroupsClient_NewListPager() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armnetwork.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := clientFactory.NewGroupsClient().NewListPager("rg1", "testNetworkManager", &armnetwork.GroupsClientListOptions{Top: nil, - SkipToken: nil, - }) - for pager.More() { - page, err := pager.NextPage(ctx) - if err != nil { - log.Fatalf("failed to advance page: %v", err) - } - for _, v := range page.Value { - // You could use page here. We use blank identifier for just demo purposes. - _ = v - } - // If the HTTP response code is 200 as defined in example definition, your page structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // page.GroupListResult = armnetwork.GroupListResult{ - // Value: []*armnetwork.Group{ - // { - // Name: to.Ptr("testNetworkGroup"), - // Type: to.Ptr("Microsoft.Network/networkManagers/networkGroups"), - // ID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroup/rg1/providers/Microsoft.Network/networkManagers/testNetworkManager/networkGroups/testNetworkGroup"), - // Properties: &armnetwork.GroupProperties{ - // Description: to.Ptr("A sample group"), - // MemberType: to.Ptr(armnetwork.GroupMemberTypeVirtualNetwork), - // ProvisioningState: to.Ptr(armnetwork.ProvisioningStateSucceeded), - // ResourceGUID: to.Ptr("00000000-0000-0000-0000-000000000000"), - // }, - // SystemData: &armnetwork.SystemData{ - // CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-01-11T18:52:27.000Z"); return t}()), - // CreatedBy: to.Ptr("b69a9388-9488-4534-b470-7ec6d41beef5"), - // CreatedByType: to.Ptr(armnetwork.CreatedByTypeUser), - // LastModifiedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-01-11T18:52:27.000Z"); return t}()), - // LastModifiedBy: to.Ptr("b69a9388-9488-4534-b470-7ec6d41beef5"), - // LastModifiedByType: to.Ptr(armnetwork.CreatedByTypeUser), - // }, - // }}, - // } - } -} diff --git a/sdk/resourcemanager/network/armnetwork/hubroutetables_client_example_test.go b/sdk/resourcemanager/network/armnetwork/hubroutetables_client_example_test.go deleted file mode 100644 index e97ccf6d1e2b..000000000000 --- a/sdk/resourcemanager/network/armnetwork/hubroutetables_client_example_test.go +++ /dev/null @@ -1,186 +0,0 @@ -//go:build go1.18 -// +build go1.18 - -// 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. -// DO NOT EDIT. - -package armnetwork_test - -import ( - "context" - "log" - - "github.com/Azure/azure-sdk-for-go/sdk/azcore/to" - "github.com/Azure/azure-sdk-for-go/sdk/azidentity" - "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/network/armnetwork/v6" -) - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/4883fa5dbf6f2c9093fac8ce334547e9dfac68fa/specification/network/resource-manager/Microsoft.Network/stable/2024-03-01/examples/HubRouteTablePut.json -func ExampleHubRouteTablesClient_BeginCreateOrUpdate() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armnetwork.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewHubRouteTablesClient().BeginCreateOrUpdate(ctx, "rg1", "virtualHub1", "hubRouteTable1", armnetwork.HubRouteTable{ - Properties: &armnetwork.HubRouteTableProperties{ - Labels: []*string{ - to.Ptr("label1"), - to.Ptr("label2")}, - Routes: []*armnetwork.HubRoute{ - { - Name: to.Ptr("route1"), - DestinationType: to.Ptr("CIDR"), - Destinations: []*string{ - to.Ptr("10.0.0.0/8"), - to.Ptr("20.0.0.0/8"), - to.Ptr("30.0.0.0/8")}, - NextHop: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/azureFirewalls/azureFirewall1"), - NextHopType: to.Ptr("ResourceId"), - }}, - }, - }, nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - res, err := poller.PollUntilDone(ctx, nil) - if err != nil { - log.Fatalf("failed to pull the result: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.HubRouteTable = armnetwork.HubRouteTable{ - // ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/virtualHubs/virtualHub1/hubRouteTables/hubRouteTable1"), - // Name: to.Ptr("hubRouteTable1"), - // Type: to.Ptr("Microsoft.Network/virtualHubs/hubRouteTables"), - // Etag: to.Ptr("w/\\00000000-0000-0000-0000-000000000000\\"), - // Properties: &armnetwork.HubRouteTableProperties{ - // AssociatedConnections: []*string{ - // to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/virtualHubs/virtualHub1/hubVirtualNetworkConnections/vnetConnn1"), - // to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/virtualHubs/virtualHub1/hubVirtualNetworkConnections/vnetConnn2")}, - // Labels: []*string{ - // to.Ptr("label1"), - // to.Ptr("label2")}, - // PropagatingConnections: []*string{ - // to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/expressRouteGateways/erg1/expressRouteConnections/erConn1"), - // to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/vpnGateways/vpngw1/vpnConnections/vpnConn2")}, - // ProvisioningState: to.Ptr(armnetwork.ProvisioningStateSucceeded), - // Routes: []*armnetwork.HubRoute{ - // { - // Name: to.Ptr("route1"), - // DestinationType: to.Ptr("CIDR"), - // Destinations: []*string{ - // to.Ptr("10.0.0.0/8"), - // to.Ptr("20.0.0.0/8"), - // to.Ptr("30.0.0.0/8")}, - // NextHop: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/azureFirewalls/azureFirewall1"), - // NextHopType: to.Ptr("ResourceId"), - // }}, - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/4883fa5dbf6f2c9093fac8ce334547e9dfac68fa/specification/network/resource-manager/Microsoft.Network/stable/2024-03-01/examples/HubRouteTableGet.json -func ExampleHubRouteTablesClient_Get() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armnetwork.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewHubRouteTablesClient().Get(ctx, "rg1", "virtualHub1", "hubRouteTable1", nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.HubRouteTable = armnetwork.HubRouteTable{ - // ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/virtualHubs/virtualHub1/hubRouteTables/hubRouteTable1"), - // Name: to.Ptr("hubRouteTable1"), - // Type: to.Ptr("Microsoft.Network/virtualHubs/hubRouteTables"), - // Etag: to.Ptr("w/\\00000000-0000-0000-0000-000000000000\\"), - // Properties: &armnetwork.HubRouteTableProperties{ - // AssociatedConnections: []*string{ - // to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/virtualHubs/virtualHub1/hubVirtualNetworkConnections/vnetConnn1"), - // to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/virtualHubs/virtualHub1/hubVirtualNetworkConnections/vnetConnn2")}, - // Labels: []*string{ - // to.Ptr("label1"), - // to.Ptr("label2")}, - // PropagatingConnections: []*string{ - // to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/expressRouteGateways/erg1/expressRouteConnections/erConn1"), - // to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/vpnGateways/vpngw1/vpnConnections/vpnConn2")}, - // ProvisioningState: to.Ptr(armnetwork.ProvisioningStateSucceeded), - // Routes: []*armnetwork.HubRoute{ - // { - // Name: to.Ptr("route1"), - // DestinationType: to.Ptr("CIDR"), - // Destinations: []*string{ - // to.Ptr("10.0.0.0/8"), - // to.Ptr("20.0.0.0/8"), - // to.Ptr("30.0.0.0/8")}, - // NextHop: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/azureFirewalls/azureFirewall1"), - // NextHopType: to.Ptr("ResourceId"), - // }}, - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/4883fa5dbf6f2c9093fac8ce334547e9dfac68fa/specification/network/resource-manager/Microsoft.Network/stable/2024-03-01/examples/HubRouteTableDelete.json -func ExampleHubRouteTablesClient_BeginDelete() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armnetwork.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewHubRouteTablesClient().BeginDelete(ctx, "rg1", "virtualHub1", "hubRouteTable1", nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - _, err = poller.PollUntilDone(ctx, nil) - if err != nil { - log.Fatalf("failed to pull the result: %v", err) - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/4883fa5dbf6f2c9093fac8ce334547e9dfac68fa/specification/network/resource-manager/Microsoft.Network/stable/2024-03-01/examples/HubRouteTableList.json -func ExampleHubRouteTablesClient_NewListPager() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armnetwork.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := clientFactory.NewHubRouteTablesClient().NewListPager("rg1", "virtualHub1", nil) - for pager.More() { - page, err := pager.NextPage(ctx) - if err != nil { - log.Fatalf("failed to advance page: %v", err) - } - for _, v := range page.Value { - // You could use page here. We use blank identifier for just demo purposes. - _ = v - } - // If the HTTP response code is 200 as defined in example definition, your page structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // page.ListHubRouteTablesResult = armnetwork.ListHubRouteTablesResult{ - // } - } -} diff --git a/sdk/resourcemanager/network/armnetwork/hubvirtualnetworkconnections_client_example_test.go b/sdk/resourcemanager/network/armnetwork/hubvirtualnetworkconnections_client_example_test.go deleted file mode 100644 index 273014737fe4..000000000000 --- a/sdk/resourcemanager/network/armnetwork/hubvirtualnetworkconnections_client_example_test.go +++ /dev/null @@ -1,278 +0,0 @@ -//go:build go1.18 -// +build go1.18 - -// 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. -// DO NOT EDIT. - -package armnetwork_test - -import ( - "context" - "log" - - "github.com/Azure/azure-sdk-for-go/sdk/azcore/to" - "github.com/Azure/azure-sdk-for-go/sdk/azidentity" - "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/network/armnetwork/v6" -) - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/4883fa5dbf6f2c9093fac8ce334547e9dfac68fa/specification/network/resource-manager/Microsoft.Network/stable/2024-03-01/examples/HubVirtualNetworkConnectionPut.json -func ExampleHubVirtualNetworkConnectionsClient_BeginCreateOrUpdate() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armnetwork.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewHubVirtualNetworkConnectionsClient().BeginCreateOrUpdate(ctx, "rg1", "virtualHub1", "connection1", armnetwork.HubVirtualNetworkConnection{ - Properties: &armnetwork.HubVirtualNetworkConnectionProperties{ - EnableInternetSecurity: to.Ptr(false), - RemoteVirtualNetwork: &armnetwork.SubResource{ - ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/virtualNetworks/SpokeVnet1"), - }, - RoutingConfiguration: &armnetwork.RoutingConfiguration{ - AssociatedRouteTable: &armnetwork.SubResource{ - ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/virtualHubs/virtualHub1/hubRouteTables/hubRouteTable1"), - }, - InboundRouteMap: &armnetwork.SubResource{ - ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/virtualHubs/virtualHub1/routeMaps/routeMap1"), - }, - OutboundRouteMap: &armnetwork.SubResource{ - ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/virtualHubs/virtualHub1/routeMaps/routeMap2"), - }, - PropagatedRouteTables: &armnetwork.PropagatedRouteTable{ - IDs: []*armnetwork.SubResource{ - { - ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/virtualHubs/virtualHub1/hubRouteTables/hubRouteTable1"), - }}, - Labels: []*string{ - to.Ptr("label1"), - to.Ptr("label2")}, - }, - VnetRoutes: &armnetwork.VnetRoute{ - StaticRoutes: []*armnetwork.StaticRoute{ - { - Name: to.Ptr("route1"), - AddressPrefixes: []*string{ - to.Ptr("10.1.0.0/16"), - to.Ptr("10.2.0.0/16")}, - NextHopIPAddress: to.Ptr("10.0.0.68"), - }, - { - Name: to.Ptr("route2"), - AddressPrefixes: []*string{ - to.Ptr("10.3.0.0/16"), - to.Ptr("10.4.0.0/16")}, - NextHopIPAddress: to.Ptr("10.0.0.65"), - }}, - StaticRoutesConfig: &armnetwork.StaticRoutesConfig{ - VnetLocalRouteOverrideCriteria: to.Ptr(armnetwork.VnetLocalRouteOverrideCriteriaEqual), - }, - }, - }, - }, - }, nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - res, err := poller.PollUntilDone(ctx, nil) - if err != nil { - log.Fatalf("failed to pull the result: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.HubVirtualNetworkConnection = armnetwork.HubVirtualNetworkConnection{ - // ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/virtualHubs/virtualHub1/hubVirtualNetworkConnections/connection1"), - // Name: to.Ptr("connection1"), - // Etag: to.Ptr("w/\\00000000-0000-0000-0000-000000000000\\"), - // Properties: &armnetwork.HubVirtualNetworkConnectionProperties{ - // EnableInternetSecurity: to.Ptr(false), - // ProvisioningState: to.Ptr(armnetwork.ProvisioningStateSucceeded), - // RemoteVirtualNetwork: &armnetwork.SubResource{ - // ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/virtualNetworks/SpokeVnet1"), - // }, - // RoutingConfiguration: &armnetwork.RoutingConfiguration{ - // AssociatedRouteTable: &armnetwork.SubResource{ - // ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/virtualHubs/virtualHub1/hubRouteTables/hubRouteTable1"), - // }, - // InboundRouteMap: &armnetwork.SubResource{ - // ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/virtualHubs/virtualHub1/routeMaps/routeMap1"), - // }, - // OutboundRouteMap: &armnetwork.SubResource{ - // ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/virtualHubs/virtualHub1/routeMaps/routeMap2"), - // }, - // PropagatedRouteTables: &armnetwork.PropagatedRouteTable{ - // IDs: []*armnetwork.SubResource{ - // { - // ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/virtualHubs/virtualHub1/hubRouteTables/hubRouteTable1"), - // }}, - // Labels: []*string{ - // to.Ptr("label1"), - // to.Ptr("label2")}, - // }, - // VnetRoutes: &armnetwork.VnetRoute{ - // BgpConnections: []*armnetwork.SubResource{ - // { - // ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/virtualHubs/virtualHub1/bgpConnections/bgpConn1"), - // }}, - // StaticRoutes: []*armnetwork.StaticRoute{ - // { - // Name: to.Ptr("route1"), - // AddressPrefixes: []*string{ - // to.Ptr("10.1.0.0/16"), - // to.Ptr("10.2.0.0/16")}, - // NextHopIPAddress: to.Ptr("10.0.0.68"), - // }, - // { - // Name: to.Ptr("route2"), - // AddressPrefixes: []*string{ - // to.Ptr("10.3.0.0/16"), - // to.Ptr("10.4.0.0/16")}, - // NextHopIPAddress: to.Ptr("10.0.0.65"), - // }}, - // StaticRoutesConfig: &armnetwork.StaticRoutesConfig{ - // PropagateStaticRoutes: to.Ptr(true), - // VnetLocalRouteOverrideCriteria: to.Ptr(armnetwork.VnetLocalRouteOverrideCriteriaEqual), - // }, - // }, - // }, - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/4883fa5dbf6f2c9093fac8ce334547e9dfac68fa/specification/network/resource-manager/Microsoft.Network/stable/2024-03-01/examples/HubVirtualNetworkConnectionDelete.json -func ExampleHubVirtualNetworkConnectionsClient_BeginDelete() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armnetwork.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewHubVirtualNetworkConnectionsClient().BeginDelete(ctx, "rg1", "virtualHub1", "connection1", nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - _, err = poller.PollUntilDone(ctx, nil) - if err != nil { - log.Fatalf("failed to pull the result: %v", err) - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/4883fa5dbf6f2c9093fac8ce334547e9dfac68fa/specification/network/resource-manager/Microsoft.Network/stable/2024-03-01/examples/HubVirtualNetworkConnectionGet.json -func ExampleHubVirtualNetworkConnectionsClient_Get() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armnetwork.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewHubVirtualNetworkConnectionsClient().Get(ctx, "rg1", "virtualHub1", "connection1", nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.HubVirtualNetworkConnection = armnetwork.HubVirtualNetworkConnection{ - // ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/virtualHubs/virtualHub1/virtualHubVnetConnections/connection1"), - // Name: to.Ptr("connection1"), - // Etag: to.Ptr("w/\\00000000-0000-0000-0000-000000000000\\"), - // Properties: &armnetwork.HubVirtualNetworkConnectionProperties{ - // EnableInternetSecurity: to.Ptr(false), - // ProvisioningState: to.Ptr(armnetwork.ProvisioningStateSucceeded), - // RemoteVirtualNetwork: &armnetwork.SubResource{ - // ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/virtualNetworks/vnet1"), - // }, - // RoutingConfiguration: &armnetwork.RoutingConfiguration{ - // AssociatedRouteTable: &armnetwork.SubResource{ - // ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/virtualHubs/virtualHub1/hubRouteTables/hubRouteTable1"), - // }, - // InboundRouteMap: &armnetwork.SubResource{ - // ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/virtualHubs/virtualHub1/routeMaps/routeMap1"), - // }, - // OutboundRouteMap: &armnetwork.SubResource{ - // ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/virtualHubs/virtualHub1/routeMaps/routeMap2"), - // }, - // PropagatedRouteTables: &armnetwork.PropagatedRouteTable{ - // IDs: []*armnetwork.SubResource{ - // { - // ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/virtualHubs/virtualHub1/hubRouteTables/hubRouteTable1"), - // }, - // { - // ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/virtualHubs/virtualHub1/hubRouteTables/hubRouteTable2"), - // }, - // { - // ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/virtualHubs/virtualHub1/hubRouteTables/hubRouteTable3"), - // }}, - // Labels: []*string{ - // to.Ptr("label1"), - // to.Ptr("label2")}, - // }, - // VnetRoutes: &armnetwork.VnetRoute{ - // BgpConnections: []*armnetwork.SubResource{ - // { - // ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/virtualHubs/virtualHub1/bgpConnections/bgpConn1"), - // }}, - // StaticRoutes: []*armnetwork.StaticRoute{ - // { - // Name: to.Ptr("route1"), - // AddressPrefixes: []*string{ - // to.Ptr("10.1.0.0/16"), - // to.Ptr("10.2.0.0/16")}, - // NextHopIPAddress: to.Ptr("10.0.0.68"), - // }, - // { - // Name: to.Ptr("route2"), - // AddressPrefixes: []*string{ - // to.Ptr("10.3.0.0/16"), - // to.Ptr("10.4.0.0/16")}, - // NextHopIPAddress: to.Ptr("10.0.0.65"), - // }}, - // StaticRoutesConfig: &armnetwork.StaticRoutesConfig{ - // PropagateStaticRoutes: to.Ptr(true), - // VnetLocalRouteOverrideCriteria: to.Ptr(armnetwork.VnetLocalRouteOverrideCriteriaEqual), - // }, - // }, - // }, - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/4883fa5dbf6f2c9093fac8ce334547e9dfac68fa/specification/network/resource-manager/Microsoft.Network/stable/2024-03-01/examples/HubVirtualNetworkConnectionList.json -func ExampleHubVirtualNetworkConnectionsClient_NewListPager() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armnetwork.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := clientFactory.NewHubVirtualNetworkConnectionsClient().NewListPager("rg1", "virtualHub1", nil) - for pager.More() { - page, err := pager.NextPage(ctx) - if err != nil { - log.Fatalf("failed to advance page: %v", err) - } - for _, v := range page.Value { - // You could use page here. We use blank identifier for just demo purposes. - _ = v - } - // If the HTTP response code is 200 as defined in example definition, your page structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // page.ListHubVirtualNetworkConnectionsResult = armnetwork.ListHubVirtualNetworkConnectionsResult{ - // } - } -} diff --git a/sdk/resourcemanager/network/armnetwork/inboundnatrules_client_example_test.go b/sdk/resourcemanager/network/armnetwork/inboundnatrules_client_example_test.go deleted file mode 100644 index fd07234286df..000000000000 --- a/sdk/resourcemanager/network/armnetwork/inboundnatrules_client_example_test.go +++ /dev/null @@ -1,200 +0,0 @@ -//go:build go1.18 -// +build go1.18 - -// 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. -// DO NOT EDIT. - -package armnetwork_test - -import ( - "context" - "log" - - "github.com/Azure/azure-sdk-for-go/sdk/azcore/to" - "github.com/Azure/azure-sdk-for-go/sdk/azidentity" - "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/network/armnetwork/v6" -) - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/4883fa5dbf6f2c9093fac8ce334547e9dfac68fa/specification/network/resource-manager/Microsoft.Network/stable/2024-03-01/examples/InboundNatRuleList.json -func ExampleInboundNatRulesClient_NewListPager() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armnetwork.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := clientFactory.NewInboundNatRulesClient().NewListPager("testrg", "lb1", nil) - for pager.More() { - page, err := pager.NextPage(ctx) - if err != nil { - log.Fatalf("failed to advance page: %v", err) - } - for _, v := range page.Value { - // You could use page here. We use blank identifier for just demo purposes. - _ = v - } - // If the HTTP response code is 200 as defined in example definition, your page structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // page.InboundNatRuleListResult = armnetwork.InboundNatRuleListResult{ - // Value: []*armnetwork.InboundNatRule{ - // { - // ID: to.Ptr("/subscriptions/subid/resourceGroups/testrg/providers/Microsoft.Network/loadBalancers/lb1/inboundNatRules/natRule1.1"), - // Name: to.Ptr("natRule1.1"), - // Properties: &armnetwork.InboundNatRulePropertiesFormat{ - // BackendIPConfiguration: &armnetwork.InterfaceIPConfiguration{ - // ID: to.Ptr("/subscriptions/subid/resourceGroups/testrg/providers/Microsoft.Compute/virtualMachineScaleSets/vmss1/virtualMachines/1/networkInterfaces/nic1/ipConfigurations/ip1"), - // }, - // BackendPort: to.Ptr[int32](3389), - // EnableFloatingIP: to.Ptr(false), - // EnableTCPReset: to.Ptr(true), - // FrontendIPConfiguration: &armnetwork.SubResource{ - // ID: to.Ptr("/subscriptions/subid/resourceGroups/testrg/providers/Microsoft.Network/loadBalancers/lb1/frontendIPConfigurations/ip1"), - // }, - // FrontendPort: to.Ptr[int32](3390), - // IdleTimeoutInMinutes: to.Ptr[int32](4), - // ProvisioningState: to.Ptr(armnetwork.ProvisioningStateSucceeded), - // Protocol: to.Ptr(armnetwork.TransportProtocolTCP), - // }, - // }, - // { - // ID: to.Ptr("/subscriptions/subid/resourceGroups/testrg/providers/Microsoft.Network/loadBalancers/lb1/inboundNatRules/natRule1.3"), - // Name: to.Ptr("natRule1.3"), - // Properties: &armnetwork.InboundNatRulePropertiesFormat{ - // BackendIPConfiguration: &armnetwork.InterfaceIPConfiguration{ - // ID: to.Ptr("/subscriptions/subid/resourceGroups/testrg/providers/Microsoft.Compute/virtualMachineScaleSets/vmss1/virtualMachines/3/networkInterfaces/nic1/ipConfigurations/ip1"), - // }, - // BackendPort: to.Ptr[int32](3389), - // EnableFloatingIP: to.Ptr(false), - // EnableTCPReset: to.Ptr(true), - // FrontendIPConfiguration: &armnetwork.SubResource{ - // ID: to.Ptr("/subscriptions/subid/resourceGroups/testrg/providers/Microsoft.Network/loadBalancers/lb1/frontendIPConfigurations/ip1"), - // }, - // FrontendPort: to.Ptr[int32](3392), - // IdleTimeoutInMinutes: to.Ptr[int32](4), - // ProvisioningState: to.Ptr(armnetwork.ProvisioningStateSucceeded), - // Protocol: to.Ptr(armnetwork.TransportProtocolTCP), - // }, - // }}, - // } - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/4883fa5dbf6f2c9093fac8ce334547e9dfac68fa/specification/network/resource-manager/Microsoft.Network/stable/2024-03-01/examples/InboundNatRuleDelete.json -func ExampleInboundNatRulesClient_BeginDelete() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armnetwork.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewInboundNatRulesClient().BeginDelete(ctx, "testrg", "lb1", "natRule1.1", nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - _, err = poller.PollUntilDone(ctx, nil) - if err != nil { - log.Fatalf("failed to pull the result: %v", err) - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/4883fa5dbf6f2c9093fac8ce334547e9dfac68fa/specification/network/resource-manager/Microsoft.Network/stable/2024-03-01/examples/InboundNatRuleGet.json -func ExampleInboundNatRulesClient_Get() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armnetwork.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewInboundNatRulesClient().Get(ctx, "testrg", "lb1", "natRule1.1", &armnetwork.InboundNatRulesClientGetOptions{Expand: nil}) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.InboundNatRule = armnetwork.InboundNatRule{ - // ID: to.Ptr("/subscriptions/subid/resourceGroups/testrg/providers/Microsoft.Network/loadBalancers/lb1/inboundNatRules/natRule1.1"), - // Name: to.Ptr("natRule1.1"), - // Properties: &armnetwork.InboundNatRulePropertiesFormat{ - // BackendIPConfiguration: &armnetwork.InterfaceIPConfiguration{ - // ID: to.Ptr("/subscriptions/subid/resourceGroups/testrg/providers/Microsoft.Compute/virtualMachineScaleSets/vmss1/virtualMachines/1/networkInterfaces/nic1/ipConfigurations/ip1"), - // }, - // BackendPort: to.Ptr[int32](3389), - // EnableFloatingIP: to.Ptr(false), - // EnableTCPReset: to.Ptr(true), - // FrontendIPConfiguration: &armnetwork.SubResource{ - // ID: to.Ptr("/subscriptions/subid/resourceGroups/testrg/providers/Microsoft.Network/loadBalancers/lb1/frontendIPConfigurations/ip1"), - // }, - // FrontendPort: to.Ptr[int32](3390), - // IdleTimeoutInMinutes: to.Ptr[int32](4), - // ProvisioningState: to.Ptr(armnetwork.ProvisioningStateSucceeded), - // Protocol: to.Ptr(armnetwork.TransportProtocolTCP), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/4883fa5dbf6f2c9093fac8ce334547e9dfac68fa/specification/network/resource-manager/Microsoft.Network/stable/2024-03-01/examples/InboundNatRuleCreate.json -func ExampleInboundNatRulesClient_BeginCreateOrUpdate() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armnetwork.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewInboundNatRulesClient().BeginCreateOrUpdate(ctx, "testrg", "lb1", "natRule1.1", armnetwork.InboundNatRule{ - Properties: &armnetwork.InboundNatRulePropertiesFormat{ - BackendPort: to.Ptr[int32](3389), - EnableFloatingIP: to.Ptr(false), - EnableTCPReset: to.Ptr(false), - FrontendIPConfiguration: &armnetwork.SubResource{ - ID: to.Ptr("/subscriptions/subid/resourceGroups/testrg/providers/Microsoft.Network/loadBalancers/lb1/frontendIPConfigurations/ip1"), - }, - FrontendPort: to.Ptr[int32](3390), - IdleTimeoutInMinutes: to.Ptr[int32](4), - Protocol: to.Ptr(armnetwork.TransportProtocolTCP), - }, - }, nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - res, err := poller.PollUntilDone(ctx, nil) - if err != nil { - log.Fatalf("failed to pull the result: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.InboundNatRule = armnetwork.InboundNatRule{ - // ID: to.Ptr("/subscriptions/subid/resourceGroups/testrg/providers/Microsoft.Network/loadBalancers/lb1/inboundNatRules/natRule1.1"), - // Name: to.Ptr("natRule1.1"), - // Properties: &armnetwork.InboundNatRulePropertiesFormat{ - // BackendIPConfiguration: &armnetwork.InterfaceIPConfiguration{ - // ID: to.Ptr("/subscriptions/subid/resourceGroups/testrg/providers/Microsoft.Compute/virtualMachineScaleSets/vmss1/virtualMachines/1/networkInterfaces/nic1/ipConfigurations/ip1"), - // }, - // BackendPort: to.Ptr[int32](3389), - // EnableFloatingIP: to.Ptr(false), - // EnableTCPReset: to.Ptr(false), - // FrontendIPConfiguration: &armnetwork.SubResource{ - // ID: to.Ptr("/subscriptions/subid/resourceGroups/testrg/providers/Microsoft.Network/loadBalancers/lb1/frontendIPConfigurations/ip1"), - // }, - // FrontendPort: to.Ptr[int32](3390), - // IdleTimeoutInMinutes: to.Ptr[int32](4), - // ProvisioningState: to.Ptr(armnetwork.ProvisioningStateSucceeded), - // Protocol: to.Ptr(armnetwork.TransportProtocolTCP), - // }, - // } -} diff --git a/sdk/resourcemanager/network/armnetwork/inboundsecurityrule_client_example_test.go b/sdk/resourcemanager/network/armnetwork/inboundsecurityrule_client_example_test.go deleted file mode 100644 index a56641e4c1af..000000000000 --- a/sdk/resourcemanager/network/armnetwork/inboundsecurityrule_client_example_test.go +++ /dev/null @@ -1,118 +0,0 @@ -//go:build go1.18 -// +build go1.18 - -// 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. -// DO NOT EDIT. - -package armnetwork_test - -import ( - "context" - "log" - - "github.com/Azure/azure-sdk-for-go/sdk/azcore/to" - "github.com/Azure/azure-sdk-for-go/sdk/azidentity" - "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/network/armnetwork/v6" -) - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/4883fa5dbf6f2c9093fac8ce334547e9dfac68fa/specification/network/resource-manager/Microsoft.Network/stable/2024-03-01/examples/InboundSecurityRulePut.json -func ExampleInboundSecurityRuleClient_BeginCreateOrUpdate() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armnetwork.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewInboundSecurityRuleClient().BeginCreateOrUpdate(ctx, "rg1", "nva", "rule1", armnetwork.InboundSecurityRule{ - Properties: &armnetwork.InboundSecurityRuleProperties{ - RuleType: to.Ptr(armnetwork.InboundSecurityRuleTypePermanent), - Rules: []*armnetwork.InboundSecurityRules{ - { - Name: to.Ptr("inboundRule1"), - AppliesOn: []*string{ - to.Ptr("slbip1")}, - DestinationPortRange: to.Ptr[int32](22), - DestinationPortRanges: []*string{ - to.Ptr("80-100")}, - SourceAddressPrefix: to.Ptr("50.20.121.5/32"), - Protocol: to.Ptr(armnetwork.InboundSecurityRulesProtocolTCP), - }}, - }, - }, nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - res, err := poller.PollUntilDone(ctx, nil) - if err != nil { - log.Fatalf("failed to pull the result: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.InboundSecurityRule = armnetwork.InboundSecurityRule{ - // ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/networkVirtualAppliances/nva/InboundSecurityRules/rule1"), - // Name: to.Ptr("rule1"), - // Etag: to.Ptr("W/\"72090554-7e3b-43f2-80ad-99a9020dcb11\""), - // Properties: &armnetwork.InboundSecurityRuleProperties{ - // ProvisioningState: to.Ptr(armnetwork.ProvisioningStateSucceeded), - // RuleType: to.Ptr(armnetwork.InboundSecurityRuleTypePermanent), - // Rules: []*armnetwork.InboundSecurityRules{ - // { - // Name: to.Ptr("inboundRule1"), - // AppliesOn: []*string{ - // to.Ptr("slbip1")}, - // DestinationPortRange: to.Ptr[int32](22), - // DestinationPortRanges: []*string{ - // to.Ptr("80-100")}, - // SourceAddressPrefix: to.Ptr("50.20.121.5/32"), - // Protocol: to.Ptr(armnetwork.InboundSecurityRulesProtocolTCP), - // }}, - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/4883fa5dbf6f2c9093fac8ce334547e9dfac68fa/specification/network/resource-manager/Microsoft.Network/stable/2024-03-01/examples/InboundSecurityRuleGet.json -func ExampleInboundSecurityRuleClient_Get() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armnetwork.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewInboundSecurityRuleClient().Get(ctx, "rg1", "nva", "rule1", nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.InboundSecurityRule = armnetwork.InboundSecurityRule{ - // ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/networkVirtualAppliances/nva/InboundSecurityRules/rule1"), - // Name: to.Ptr("rule1"), - // Etag: to.Ptr("W/\"72090554-7e3b-43f2-80ad-99a9020dcb11\""), - // Properties: &armnetwork.InboundSecurityRuleProperties{ - // ProvisioningState: to.Ptr(armnetwork.ProvisioningStateSucceeded), - // RuleType: to.Ptr(armnetwork.InboundSecurityRuleTypePermanent), - // Rules: []*armnetwork.InboundSecurityRules{ - // { - // Name: to.Ptr("inboundRule1"), - // AppliesOn: []*string{ - // to.Ptr("slbip1")}, - // DestinationPortRange: to.Ptr[int32](22), - // DestinationPortRanges: []*string{ - // to.Ptr("80-100")}, - // SourceAddressPrefix: to.Ptr("50.20.121.5/32"), - // Protocol: to.Ptr(armnetwork.InboundSecurityRulesProtocolTCP), - // }}, - // }, - // } -} diff --git a/sdk/resourcemanager/network/armnetwork/interfaceipconfigurations_client_example_test.go b/sdk/resourcemanager/network/armnetwork/interfaceipconfigurations_client_example_test.go deleted file mode 100644 index 3161361cddf3..000000000000 --- a/sdk/resourcemanager/network/armnetwork/interfaceipconfigurations_client_example_test.go +++ /dev/null @@ -1,110 +0,0 @@ -//go:build go1.18 -// +build go1.18 - -// 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. -// DO NOT EDIT. - -package armnetwork_test - -import ( - "context" - "log" - - "github.com/Azure/azure-sdk-for-go/sdk/azidentity" - "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/network/armnetwork/v6" -) - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/4883fa5dbf6f2c9093fac8ce334547e9dfac68fa/specification/network/resource-manager/Microsoft.Network/stable/2024-03-01/examples/NetworkInterfaceIPConfigurationList.json -func ExampleInterfaceIPConfigurationsClient_NewListPager() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armnetwork.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := clientFactory.NewInterfaceIPConfigurationsClient().NewListPager("testrg", "nic1", nil) - for pager.More() { - page, err := pager.NextPage(ctx) - if err != nil { - log.Fatalf("failed to advance page: %v", err) - } - for _, v := range page.Value { - // You could use page here. We use blank identifier for just demo purposes. - _ = v - } - // If the HTTP response code is 200 as defined in example definition, your page structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // page.InterfaceIPConfigurationListResult = armnetwork.InterfaceIPConfigurationListResult{ - // Value: []*armnetwork.InterfaceIPConfiguration{ - // { - // ID: to.Ptr("/subscriptions/subid/resourceGroups/testrg/providers/Microsoft.Network/networkInterfaces/nic1/ipConfigurations/ipconfig1"), - // Name: to.Ptr("ipconfig1"), - // Etag: to.Ptr("W/\\\"00000000-0000-0000-0000-000000000000\\\""), - // Properties: &armnetwork.InterfaceIPConfigurationPropertiesFormat{ - // Primary: to.Ptr(true), - // PrivateIPAddress: to.Ptr("10.0.0.4"), - // PrivateIPAddressVersion: to.Ptr(armnetwork.IPVersionIPv4), - // PrivateIPAllocationMethod: to.Ptr(armnetwork.IPAllocationMethodDynamic), - // ProvisioningState: to.Ptr(armnetwork.ProvisioningStateSucceeded), - // Subnet: &armnetwork.Subnet{ - // ID: to.Ptr("/subscriptions/subid/resourceGroups/testrg/providers/Microsoft.Network/virtualNetworks/vnet12/subnets/subnet12"), - // }, - // }, - // }}, - // } - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/4883fa5dbf6f2c9093fac8ce334547e9dfac68fa/specification/network/resource-manager/Microsoft.Network/stable/2024-03-01/examples/NetworkInterfaceIPConfigurationGet.json -func ExampleInterfaceIPConfigurationsClient_Get() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armnetwork.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewInterfaceIPConfigurationsClient().Get(ctx, "testrg", "mynic", "ipconfig1", nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.InterfaceIPConfiguration = armnetwork.InterfaceIPConfiguration{ - // ID: to.Ptr("/subscriptions/subid/resourceGroups/testrg/providers/Microsoft.Network/networkInterfaces/mynic/ipConfigurations/ipconfig1"), - // Name: to.Ptr("ipconfig1"), - // Etag: to.Ptr("W/\\\"00000000-0000-0000-0000-000000000000\\\""), - // Properties: &armnetwork.InterfaceIPConfigurationPropertiesFormat{ - // LoadBalancerBackendAddressPools: []*armnetwork.BackendAddressPool{ - // { - // ID: to.Ptr("/subscriptions/subid/resourceGroups/testrg/providers/Microsoft.Network/loadBalancers/lbname1/backendAddressPools/bepool1"), - // }}, - // LoadBalancerInboundNatRules: []*armnetwork.InboundNatRule{ - // { - // ID: to.Ptr("/subscriptions/subid/resourceGroups/testrg/providers/Microsoft.Network/loadBalancers/lbname1/inboundNatRules/inbound1"), - // }}, - // PrivateIPAddress: to.Ptr("10.0.1.4"), - // PrivateIPAddressVersion: to.Ptr(armnetwork.IPVersionIPv4), - // PrivateIPAllocationMethod: to.Ptr(armnetwork.IPAllocationMethodDynamic), - // ProvisioningState: to.Ptr(armnetwork.ProvisioningStateSucceeded), - // Subnet: &armnetwork.Subnet{ - // ID: to.Ptr("/subscriptions/subid/resourceGroups/testrg/providers/Microsoft.Network/virtualNetworks/myVirtualNetwork/subnets/frontendSubnet"), - // }, - // VirtualNetworkTaps: []*armnetwork.VirtualNetworkTap{ - // { - // ID: to.Ptr("/subscriptions/subid/resourceGroups/testrg/providers/Microsoft.Network/virtualNetworkTaps/vTAP1"), - // }, - // { - // ID: to.Ptr("/subscriptions/subid/resourceGroups/testrg/providers/Microsoft.Network/virtualNetworkTaps/vTAP2"), - // }}, - // }, - // } -} diff --git a/sdk/resourcemanager/network/armnetwork/interfaceloadbalancers_client_example_test.go b/sdk/resourcemanager/network/armnetwork/interfaceloadbalancers_client_example_test.go deleted file mode 100644 index 9a3f3ccfae8a..000000000000 --- a/sdk/resourcemanager/network/armnetwork/interfaceloadbalancers_client_example_test.go +++ /dev/null @@ -1,162 +0,0 @@ -//go:build go1.18 -// +build go1.18 - -// 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. -// DO NOT EDIT. - -package armnetwork_test - -import ( - "context" - "log" - - "github.com/Azure/azure-sdk-for-go/sdk/azidentity" - "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/network/armnetwork/v6" -) - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/4883fa5dbf6f2c9093fac8ce334547e9dfac68fa/specification/network/resource-manager/Microsoft.Network/stable/2024-03-01/examples/NetworkInterfaceLoadBalancerList.json -func ExampleInterfaceLoadBalancersClient_NewListPager() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armnetwork.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := clientFactory.NewInterfaceLoadBalancersClient().NewListPager("testrg", "nic1", nil) - for pager.More() { - page, err := pager.NextPage(ctx) - if err != nil { - log.Fatalf("failed to advance page: %v", err) - } - for _, v := range page.Value { - // You could use page here. We use blank identifier for just demo purposes. - _ = v - } - // If the HTTP response code is 200 as defined in example definition, your page structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // page.InterfaceLoadBalancerListResult = armnetwork.InterfaceLoadBalancerListResult{ - // Value: []*armnetwork.LoadBalancer{ - // { - // Name: to.Ptr("lbname1"), - // Type: to.Ptr("Microsoft.Network/loadBalancers"), - // ID: to.Ptr("/subscriptions/subid/resourceGroups/testrg/providers/Microsoft.Network/loadBalancers/lbname1"), - // Location: to.Ptr("westus"), - // Etag: to.Ptr("W/\\\"00000000-0000-0000-0000-000000000000\\\""), - // Properties: &armnetwork.LoadBalancerPropertiesFormat{ - // BackendAddressPools: []*armnetwork.BackendAddressPool{ - // { - // ID: to.Ptr("/subscriptions/subid/resourceGroups/testrg/providers/Microsoft.Network/loadBalancers/lbname1/backendAddressPools/bepool1"), - // Name: to.Ptr("bepool1"), - // Etag: to.Ptr("W/\\\"00000000-0000-0000-0000-000000000000\\\""), - // Properties: &armnetwork.BackendAddressPoolPropertiesFormat{ - // BackendIPConfigurations: []*armnetwork.InterfaceIPConfiguration{ - // { - // ID: to.Ptr("/subscriptions/subid/resourceGroups/testrg/providers/Microsoft.Network/networkInterfaces/nic1/ipConfigurations/ipconfig1"), - // }}, - // LoadBalancingRules: []*armnetwork.SubResource{ - // { - // ID: to.Ptr("/subscriptions/subid/resourceGroups/testrg/providers/Microsoft.Network/loadBalancers/lbname1/loadBalancingRules/rule1"), - // }}, - // ProvisioningState: to.Ptr(armnetwork.ProvisioningStateSucceeded), - // }, - // }}, - // FrontendIPConfigurations: []*armnetwork.FrontendIPConfiguration{ - // { - // ID: to.Ptr("/subscriptions/subid/resourceGroups/testrg/providers/Microsoft.Network/loadBalancers/lbname1/frontendIPConfigurations/lbfrontend"), - // Name: to.Ptr("lbfrontend"), - // Etag: to.Ptr("W/\\\"00000000-0000-0000-0000-000000000000\\\""), - // Properties: &armnetwork.FrontendIPConfigurationPropertiesFormat{ - // InboundNatRules: []*armnetwork.SubResource{ - // { - // ID: to.Ptr("/subscriptions/subid/resourceGroups/testrg/providers/Microsoft.Network/loadBalancers/lbname1/inboundNatRules/inbound1"), - // }}, - // LoadBalancingRules: []*armnetwork.SubResource{ - // { - // ID: to.Ptr("/subscriptions/subid/resourceGroups/testrg/providers/Microsoft.Network/loadBalancers/lbname1/loadBalancingRules/rule1"), - // }}, - // PrivateIPAllocationMethod: to.Ptr(armnetwork.IPAllocationMethodDynamic), - // ProvisioningState: to.Ptr(armnetwork.ProvisioningStateSucceeded), - // PublicIPAddress: &armnetwork.PublicIPAddress{ - // ID: to.Ptr("/subscriptions/subid/resourceGroups/testrg/providers/Microsoft.Network/publicIPAddresses/myDynamicPublicIP"), - // }, - // }, - // }}, - // InboundNatPools: []*armnetwork.InboundNatPool{ - // }, - // InboundNatRules: []*armnetwork.InboundNatRule{ - // { - // ID: to.Ptr("/subscriptions/subid/resourceGroups/testrg/providers/Microsoft.Network/loadBalancers/lbname1/inboundNatRules/inbound1"), - // Name: to.Ptr("inbound1"), - // Etag: to.Ptr("W/\\\"00000000-0000-0000-0000-000000000000\\\""), - // Properties: &armnetwork.InboundNatRulePropertiesFormat{ - // BackendIPConfiguration: &armnetwork.InterfaceIPConfiguration{ - // ID: to.Ptr("/subscriptions/subid/resourceGroups/testrg/providers/Microsoft.Network/networkInterfaces/nic1/ipConfigurations/ipconfig1"), - // }, - // BackendPort: to.Ptr[int32](3389), - // EnableFloatingIP: to.Ptr(false), - // FrontendIPConfiguration: &armnetwork.SubResource{ - // ID: to.Ptr("/subscriptions/subid/resourceGroups/testrg/providers/Microsoft.Network/loadBalancers/lbname1/frontendIPConfigurations/lbfrontend"), - // }, - // FrontendPort: to.Ptr[int32](3389), - // IdleTimeoutInMinutes: to.Ptr[int32](15), - // ProvisioningState: to.Ptr(armnetwork.ProvisioningStateSucceeded), - // Protocol: to.Ptr(armnetwork.TransportProtocolTCP), - // }, - // }}, - // LoadBalancingRules: []*armnetwork.LoadBalancingRule{ - // { - // ID: to.Ptr("/subscriptions/subid/resourceGroups/testrg/providers/Microsoft.Network/loadBalancers/lbname1/loadBalancingRules/rule1"), - // Name: to.Ptr("rule1"), - // Etag: to.Ptr("W/\\\"00000000-0000-0000-0000-000000000000\\\""), - // Properties: &armnetwork.LoadBalancingRulePropertiesFormat{ - // BackendAddressPool: &armnetwork.SubResource{ - // ID: to.Ptr("/subscriptions/subid/resourceGroups/testrg/providers/Microsoft.Network/loadBalancers/lbname1/backendAddressPools/bepool1"), - // }, - // BackendPort: to.Ptr[int32](80), - // EnableFloatingIP: to.Ptr(false), - // FrontendIPConfiguration: &armnetwork.SubResource{ - // ID: to.Ptr("/subscriptions/subid/resourceGroups/testrg/providers/Microsoft.Network/loadBalancers/lbname1/frontendIPConfigurations/lbfrontend"), - // }, - // FrontendPort: to.Ptr[int32](80), - // IdleTimeoutInMinutes: to.Ptr[int32](15), - // LoadDistribution: to.Ptr(armnetwork.LoadDistributionDefault), - // Probe: &armnetwork.SubResource{ - // ID: to.Ptr("/subscriptions/subid/resourceGroups/testrg/providers/Microsoft.Network/loadBalancers/lbname1/probes/probe1"), - // }, - // ProvisioningState: to.Ptr(armnetwork.ProvisioningStateSucceeded), - // Protocol: to.Ptr(armnetwork.TransportProtocolTCP), - // }, - // }}, - // OutboundRules: []*armnetwork.OutboundRule{ - // }, - // Probes: []*armnetwork.Probe{ - // { - // ID: to.Ptr("/subscriptions/subid/resourceGroups/testrg/providers/Microsoft.Network/loadBalancers/lbname1/probes/probe1"), - // Name: to.Ptr("probe1"), - // Etag: to.Ptr("W/\\\"00000000-0000-0000-0000-000000000000\\\""), - // Properties: &armnetwork.ProbePropertiesFormat{ - // IntervalInSeconds: to.Ptr[int32](15), - // LoadBalancingRules: []*armnetwork.SubResource{ - // { - // ID: to.Ptr("/subscriptions/subid/resourceGroups/testrg/providers/Microsoft.Network/loadBalancers/lbname1/loadBalancingRules/rule1"), - // }}, - // NumberOfProbes: to.Ptr[int32](2), - // Port: to.Ptr[int32](80), - // ProbeThreshold: to.Ptr[int32](1), - // ProvisioningState: to.Ptr(armnetwork.ProvisioningStateSucceeded), - // RequestPath: to.Ptr("healthcheck.aspx"), - // Protocol: to.Ptr(armnetwork.ProbeProtocolHTTP), - // }, - // }}, - // ProvisioningState: to.Ptr(armnetwork.ProvisioningStateSucceeded), - // ResourceGUID: to.Ptr("00000000-0000-0000-0000-000000000000"), - // }, - // }}, - // } - } -} diff --git a/sdk/resourcemanager/network/armnetwork/interfaces_client_example_test.go b/sdk/resourcemanager/network/armnetwork/interfaces_client_example_test.go deleted file mode 100644 index 604df28e12b5..000000000000 --- a/sdk/resourcemanager/network/armnetwork/interfaces_client_example_test.go +++ /dev/null @@ -1,1403 +0,0 @@ -//go:build go1.18 -// +build go1.18 - -// 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. -// DO NOT EDIT. - -package armnetwork_test - -import ( - "context" - "log" - - "github.com/Azure/azure-sdk-for-go/sdk/azcore/to" - "github.com/Azure/azure-sdk-for-go/sdk/azidentity" - "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/network/armnetwork/v6" -) - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/4883fa5dbf6f2c9093fac8ce334547e9dfac68fa/specification/network/resource-manager/Microsoft.Network/stable/2024-03-01/examples/CloudServiceRoleInstanceNetworkInterfaceList.json -func ExampleInterfacesClient_NewListCloudServiceRoleInstanceNetworkInterfacesPager() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armnetwork.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := clientFactory.NewInterfacesClient().NewListCloudServiceRoleInstanceNetworkInterfacesPager("rg1", "cs1", "TestVMRole_IN_0", nil) - for pager.More() { - page, err := pager.NextPage(ctx) - if err != nil { - log.Fatalf("failed to advance page: %v", err) - } - for _, v := range page.Value { - // You could use page here. We use blank identifier for just demo purposes. - _ = v - } - // If the HTTP response code is 200 as defined in example definition, your page structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // page.InterfaceListResult = armnetwork.InterfaceListResult{ - // Value: []*armnetwork.Interface{ - // { - // Name: to.Ptr("nic1"), - // ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Compute/cloudServices/cs1/roleInstances/TestVMRole_IN_0/networkInterfaces/nic1"), - // Properties: &armnetwork.InterfacePropertiesFormat{ - // DNSSettings: &armnetwork.InterfaceDNSSettings{ - // AppliedDNSServers: []*string{ - // }, - // DNSServers: []*string{ - // }, - // InternalDomainNameSuffix: to.Ptr("ruw4wz3grewudjsyzrxj44pxod.cdmx.internal.cloudapp.net"), - // }, - // EnableAcceleratedNetworking: to.Ptr(false), - // EnableIPForwarding: to.Ptr(false), - // IPConfigurations: []*armnetwork.InterfaceIPConfiguration{ - // { - // ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Compute/cloudServices/cs1/roleInstances/TestVMRole_IN_0/networkInterfaces/nic1/ipConfigurations/ip1"), - // Name: to.Ptr("ip1"), - // Properties: &armnetwork.InterfaceIPConfigurationPropertiesFormat{ - // LoadBalancerBackendAddressPools: []*armnetwork.BackendAddressPool{ - // { - // ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/loadBalancers/lb1/backendAddressPools/addressPool1"), - // }}, - // LoadBalancerInboundNatRules: []*armnetwork.InboundNatRule{ - // { - // ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/loadBalancers/lb1/inboundNatRules/natPool1.1"), - // }}, - // Primary: to.Ptr(true), - // PrivateIPAddress: to.Ptr("10.0.0.5"), - // PrivateIPAddressVersion: to.Ptr(armnetwork.IPVersionIPv4), - // PrivateIPAllocationMethod: to.Ptr(armnetwork.IPAllocationMethodDynamic), - // ProvisioningState: to.Ptr(armnetwork.ProvisioningStateSucceeded), - // PublicIPAddress: &armnetwork.PublicIPAddress{ - // ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Compute/cloudServices/cs1/roleInstances/TestVMRole_IN_0/networkInterfaces/nic1/ipConfigurations/ip1/publicIPAddresses/pub1"), - // }, - // Subnet: &armnetwork.Subnet{ - // ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/virtualNetworks/vnet1/subnets/subnet1"), - // }, - // }, - // }}, - // MacAddress: to.Ptr("00-00-00-00-00-00"), - // NetworkSecurityGroup: &armnetwork.SecurityGroup{ - // ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/networkSecurityGroups/nsg1"), - // }, - // Primary: to.Ptr(true), - // ProvisioningState: to.Ptr(armnetwork.ProvisioningStateSucceeded), - // }, - // }}, - // } - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/4883fa5dbf6f2c9093fac8ce334547e9dfac68fa/specification/network/resource-manager/Microsoft.Network/stable/2024-03-01/examples/CloudServiceNetworkInterfaceList.json -func ExampleInterfacesClient_NewListCloudServiceNetworkInterfacesPager() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armnetwork.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := clientFactory.NewInterfacesClient().NewListCloudServiceNetworkInterfacesPager("rg1", "cs1", nil) - for pager.More() { - page, err := pager.NextPage(ctx) - if err != nil { - log.Fatalf("failed to advance page: %v", err) - } - for _, v := range page.Value { - // You could use page here. We use blank identifier for just demo purposes. - _ = v - } - // If the HTTP response code is 200 as defined in example definition, your page structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // page.InterfaceListResult = armnetwork.InterfaceListResult{ - // Value: []*armnetwork.Interface{ - // { - // Name: to.Ptr("nic1"), - // ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Compute/cloudServices/cs1/roleInstances/TestVMRole_IN_0/networkInterfaces/nic1"), - // Properties: &armnetwork.InterfacePropertiesFormat{ - // DNSSettings: &armnetwork.InterfaceDNSSettings{ - // AppliedDNSServers: []*string{ - // }, - // DNSServers: []*string{ - // }, - // InternalDomainNameSuffix: to.Ptr("ruw4wz3grewudjsyzrxj44pxod.cdmx.internal.cloudapp.net"), - // }, - // EnableAcceleratedNetworking: to.Ptr(false), - // EnableIPForwarding: to.Ptr(false), - // IPConfigurations: []*armnetwork.InterfaceIPConfiguration{ - // { - // ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Compute/cloudServices/cs1/roleInstances/TestVMRole_IN_0/networkInterfaces/nic1/ipConfigurations/ip1"), - // Name: to.Ptr("ip1"), - // Properties: &armnetwork.InterfaceIPConfigurationPropertiesFormat{ - // LoadBalancerBackendAddressPools: []*armnetwork.BackendAddressPool{ - // { - // ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/loadBalancers/lb1/backendAddressPools/addressPool1"), - // }}, - // LoadBalancerInboundNatRules: []*armnetwork.InboundNatRule{ - // { - // ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/loadBalancers/lb1/inboundNatRules/natPool1.0"), - // }}, - // Primary: to.Ptr(true), - // PrivateIPAddress: to.Ptr("10.0.0.4"), - // PrivateIPAddressVersion: to.Ptr(armnetwork.IPVersionIPv4), - // PrivateIPAllocationMethod: to.Ptr(armnetwork.IPAllocationMethodDynamic), - // ProvisioningState: to.Ptr(armnetwork.ProvisioningStateSucceeded), - // PublicIPAddress: &armnetwork.PublicIPAddress{ - // ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Compute/cloudServices/cs1/roleInstances/TestVMRole_IN_0/networkInterfaces/nic1/ipConfigurations/ip1/publicIPAddresses/pub1"), - // }, - // Subnet: &armnetwork.Subnet{ - // ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/virtualNetworks/vnet1/subnets/subnet1"), - // }, - // }, - // }}, - // MacAddress: to.Ptr("00-00-00-00-00-00"), - // NetworkSecurityGroup: &armnetwork.SecurityGroup{ - // ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/networkSecurityGroups/nsg1"), - // }, - // Primary: to.Ptr(true), - // ProvisioningState: to.Ptr(armnetwork.ProvisioningStateSucceeded), - // }, - // }, - // { - // Name: to.Ptr("nic1"), - // ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Compute/cloudServices/cs1/roleInstances/TestVMRole_IN_1/networkInterfaces/nic1"), - // Properties: &armnetwork.InterfacePropertiesFormat{ - // DNSSettings: &armnetwork.InterfaceDNSSettings{ - // AppliedDNSServers: []*string{ - // }, - // DNSServers: []*string{ - // }, - // InternalDomainNameSuffix: to.Ptr("ruw4wz3grewudjsyzrxj44pxod.cdmx.internal.cloudapp.net"), - // }, - // EnableAcceleratedNetworking: to.Ptr(false), - // EnableIPForwarding: to.Ptr(false), - // IPConfigurations: []*armnetwork.InterfaceIPConfiguration{ - // { - // ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Compute/cloudServices/cs1/roleInstances/TestVMRole_IN_1/networkInterfaces/nic1/ipConfigurations/ip1"), - // Name: to.Ptr("ip1"), - // Properties: &armnetwork.InterfaceIPConfigurationPropertiesFormat{ - // LoadBalancerBackendAddressPools: []*armnetwork.BackendAddressPool{ - // { - // ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/loadBalancers/lb1/backendAddressPools/addressPool1"), - // }}, - // LoadBalancerInboundNatRules: []*armnetwork.InboundNatRule{ - // { - // ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/loadBalancers/lb1/inboundNatRules/natPool1.1"), - // }}, - // Primary: to.Ptr(true), - // PrivateIPAddress: to.Ptr("10.0.0.5"), - // PrivateIPAddressVersion: to.Ptr(armnetwork.IPVersionIPv4), - // PrivateIPAllocationMethod: to.Ptr(armnetwork.IPAllocationMethodDynamic), - // ProvisioningState: to.Ptr(armnetwork.ProvisioningStateSucceeded), - // PublicIPAddress: &armnetwork.PublicIPAddress{ - // ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Compute/cloudServices/cs1/roleInstances/TestVMRole_IN_1/networkInterfaces/nic1/ipConfigurations/ip1/publicIPAddresses/pub1"), - // }, - // Subnet: &armnetwork.Subnet{ - // ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/virtualNetworks/vnet1/subnets/subnet1"), - // }, - // }, - // }}, - // MacAddress: to.Ptr("00-00-00-00-00-00"), - // NetworkSecurityGroup: &armnetwork.SecurityGroup{ - // ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/networkSecurityGroups/nsg1"), - // }, - // Primary: to.Ptr(true), - // ProvisioningState: to.Ptr(armnetwork.ProvisioningStateSucceeded), - // }, - // }}, - // } - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/4883fa5dbf6f2c9093fac8ce334547e9dfac68fa/specification/network/resource-manager/Microsoft.Network/stable/2024-03-01/examples/CloudServiceNetworkInterfaceGet.json -func ExampleInterfacesClient_GetCloudServiceNetworkInterface() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armnetwork.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewInterfacesClient().GetCloudServiceNetworkInterface(ctx, "rg1", "cs1", "TestVMRole_IN_0", "nic1", &armnetwork.InterfacesClientGetCloudServiceNetworkInterfaceOptions{Expand: nil}) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.Interface = armnetwork.Interface{ - // Name: to.Ptr("nic1"), - // ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Compute/cloudServices/cs1/roleInstances/TestVMRole_IN_0/networkInterfaces/nic1"), - // Properties: &armnetwork.InterfacePropertiesFormat{ - // DNSSettings: &armnetwork.InterfaceDNSSettings{ - // AppliedDNSServers: []*string{ - // }, - // DNSServers: []*string{ - // }, - // InternalDomainNameSuffix: to.Ptr("dns.cdmx.internal.cloudapp.net"), - // }, - // EnableAcceleratedNetworking: to.Ptr(false), - // EnableIPForwarding: to.Ptr(false), - // IPConfigurations: []*armnetwork.InterfaceIPConfiguration{ - // { - // ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Compute/cloudServices/cs1/roleInstances/TestVMRole_IN_0/networkInterfaces/nic1/ipConfigurations/ip1"), - // Name: to.Ptr("ip1"), - // Properties: &armnetwork.InterfaceIPConfigurationPropertiesFormat{ - // LoadBalancerBackendAddressPools: []*armnetwork.BackendAddressPool{ - // { - // ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/loadBalancers/lb1/backendAddressPools/addressPool1"), - // }}, - // LoadBalancerInboundNatRules: []*armnetwork.InboundNatRule{ - // { - // ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/loadBalancers/lb1/inboundNatRules/natPool1.1"), - // }}, - // Primary: to.Ptr(true), - // PrivateIPAddress: to.Ptr("10.0.0.5"), - // PrivateIPAddressVersion: to.Ptr(armnetwork.IPVersionIPv4), - // PrivateIPAllocationMethod: to.Ptr(armnetwork.IPAllocationMethodDynamic), - // ProvisioningState: to.Ptr(armnetwork.ProvisioningStateSucceeded), - // PublicIPAddress: &armnetwork.PublicIPAddress{ - // ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Compute/cloudServices/cs1/roleInstances/TestVMRole_IN_0/networkInterfaces/nic1/ipConfigurations/ip1/publicIPAddresses/pub1"), - // }, - // Subnet: &armnetwork.Subnet{ - // ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/virtualNetworks/vnet1/subnets/subnet1"), - // }, - // }, - // }}, - // MacAddress: to.Ptr("00-00-00-00-00-00"), - // NetworkSecurityGroup: &armnetwork.SecurityGroup{ - // ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/networkSecurityGroups/nsg1"), - // }, - // Primary: to.Ptr(true), - // ProvisioningState: to.Ptr(armnetwork.ProvisioningStateSucceeded), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/4883fa5dbf6f2c9093fac8ce334547e9dfac68fa/specification/network/resource-manager/Microsoft.Network/stable/2024-03-01/examples/NetworkInterfaceDelete.json -func ExampleInterfacesClient_BeginDelete() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armnetwork.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewInterfacesClient().BeginDelete(ctx, "rg1", "test-nic", nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - _, err = poller.PollUntilDone(ctx, nil) - if err != nil { - log.Fatalf("failed to pull the result: %v", err) - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/4883fa5dbf6f2c9093fac8ce334547e9dfac68fa/specification/network/resource-manager/Microsoft.Network/stable/2024-03-01/examples/NetworkInterfaceGet.json -func ExampleInterfacesClient_Get() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armnetwork.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewInterfacesClient().Get(ctx, "rg1", "test-nic", &armnetwork.InterfacesClientGetOptions{Expand: nil}) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.Interface = armnetwork.Interface{ - // Name: to.Ptr("test-nic"), - // Type: to.Ptr("Microsoft.Network/networkInterfaces"), - // ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/networkInterfaces/test-nic"), - // Location: to.Ptr("eastus"), - // Properties: &armnetwork.InterfacePropertiesFormat{ - // DisableTCPStateTracking: to.Ptr(true), - // DNSSettings: &armnetwork.InterfaceDNSSettings{ - // AppliedDNSServers: []*string{ - // }, - // DNSServers: []*string{ - // }, - // InternalDomainNameSuffix: to.Ptr("test.bx.internal.cloudapp.net"), - // }, - // DscpConfiguration: &armnetwork.SubResource{ - // ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Compute/dscpConfiguration/mydscpconfiguration"), - // }, - // EnableAcceleratedNetworking: to.Ptr(true), - // EnableIPForwarding: to.Ptr(false), - // IPConfigurations: []*armnetwork.InterfaceIPConfiguration{ - // { - // ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/networkInterfaces/test-nic/ipConfigurations/ipconfig1"), - // Name: to.Ptr("ipconfig1"), - // Properties: &armnetwork.InterfaceIPConfigurationPropertiesFormat{ - // Primary: to.Ptr(true), - // PrivateIPAddress: to.Ptr("172.20.2.4"), - // PrivateIPAddressVersion: to.Ptr(armnetwork.IPVersionIPv4), - // PrivateIPAllocationMethod: to.Ptr(armnetwork.IPAllocationMethodDynamic), - // ProvisioningState: to.Ptr(armnetwork.ProvisioningStateSucceeded), - // PublicIPAddress: &armnetwork.PublicIPAddress{ - // ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/publicIPAddresses/test-ip"), - // }, - // Subnet: &armnetwork.Subnet{ - // ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/virtualNetworks/rg1-vnet/subnets/default"), - // }, - // }, - // }, - // { - // ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/networkInterfaces/test-nic/ipConfigurations/ipconfig2"), - // Name: to.Ptr("ipconfig2"), - // Properties: &armnetwork.InterfaceIPConfigurationPropertiesFormat{ - // Primary: to.Ptr(false), - // PrivateIPAddress: to.Ptr("172.20.2.16/28"), - // PrivateIPAddressPrefixLength: to.Ptr[int32](28), - // PrivateIPAddressVersion: to.Ptr(armnetwork.IPVersionIPv4), - // PrivateIPAllocationMethod: to.Ptr(armnetwork.IPAllocationMethodDynamic), - // ProvisioningState: to.Ptr(armnetwork.ProvisioningStateSucceeded), - // Subnet: &armnetwork.Subnet{ - // ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/virtualNetworks/rg1-vnet/subnets/default"), - // }, - // }, - // }}, - // MacAddress: to.Ptr("00-0D-3A-1B-C7-21"), - // NetworkSecurityGroup: &armnetwork.SecurityGroup{ - // ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/networkSecurityGroups/nsg"), - // }, - // Primary: to.Ptr(true), - // ProvisioningState: to.Ptr(armnetwork.ProvisioningStateSucceeded), - // VirtualMachine: &armnetwork.SubResource{ - // ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Compute/virtualMachines/vm1"), - // }, - // VnetEncryptionSupported: to.Ptr(false), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/4883fa5dbf6f2c9093fac8ce334547e9dfac68fa/specification/network/resource-manager/Microsoft.Network/stable/2024-03-01/examples/NetworkInterfaceCreate.json -func ExampleInterfacesClient_BeginCreateOrUpdate_createNetworkInterface() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armnetwork.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewInterfacesClient().BeginCreateOrUpdate(ctx, "rg1", "test-nic", armnetwork.Interface{ - Location: to.Ptr("eastus"), - Properties: &armnetwork.InterfacePropertiesFormat{ - DisableTCPStateTracking: to.Ptr(true), - EnableAcceleratedNetworking: to.Ptr(true), - IPConfigurations: []*armnetwork.InterfaceIPConfiguration{ - { - Name: to.Ptr("ipconfig1"), - Properties: &armnetwork.InterfaceIPConfigurationPropertiesFormat{ - PublicIPAddress: &armnetwork.PublicIPAddress{ - ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/publicIPAddresses/test-ip"), - }, - Subnet: &armnetwork.Subnet{ - ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/virtualNetworks/rg1-vnet/subnets/default"), - }, - }, - }, - { - Name: to.Ptr("ipconfig2"), - Properties: &armnetwork.InterfaceIPConfigurationPropertiesFormat{ - PrivateIPAddressPrefixLength: to.Ptr[int32](28), - }, - }}, - }, - }, nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - res, err := poller.PollUntilDone(ctx, nil) - if err != nil { - log.Fatalf("failed to pull the result: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.Interface = armnetwork.Interface{ - // Name: to.Ptr("test-nic"), - // Type: to.Ptr("Microsoft.Network/networkInterfaces"), - // ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/networkInterfaces/test-nic"), - // Location: to.Ptr("eastus"), - // Properties: &armnetwork.InterfacePropertiesFormat{ - // DisableTCPStateTracking: to.Ptr(true), - // DNSSettings: &armnetwork.InterfaceDNSSettings{ - // AppliedDNSServers: []*string{ - // }, - // DNSServers: []*string{ - // }, - // }, - // EnableAcceleratedNetworking: to.Ptr(true), - // EnableIPForwarding: to.Ptr(false), - // IPConfigurations: []*armnetwork.InterfaceIPConfiguration{ - // { - // ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/networkInterfaces/test-nic/ipConfigurations/ipconfig1"), - // Name: to.Ptr("ipconfig1"), - // Properties: &armnetwork.InterfaceIPConfigurationPropertiesFormat{ - // Primary: to.Ptr(true), - // PrivateIPAddress: to.Ptr("172.20.2.4"), - // PrivateIPAddressVersion: to.Ptr(armnetwork.IPVersionIPv4), - // PrivateIPAllocationMethod: to.Ptr(armnetwork.IPAllocationMethodDynamic), - // ProvisioningState: to.Ptr(armnetwork.ProvisioningStateSucceeded), - // PublicIPAddress: &armnetwork.PublicIPAddress{ - // ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/publicIPAddresses/test-ip"), - // }, - // Subnet: &armnetwork.Subnet{ - // ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/virtualNetworks/rg1-vnet/subnets/default"), - // }, - // }, - // }, - // { - // ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/networkInterfaces/test-nic/ipConfigurations/ipconfig2"), - // Name: to.Ptr("ipconfig2"), - // Properties: &armnetwork.InterfaceIPConfigurationPropertiesFormat{ - // Primary: to.Ptr(false), - // PrivateIPAddress: to.Ptr("172.20.2.16/28"), - // PrivateIPAddressPrefixLength: to.Ptr[int32](28), - // PrivateIPAddressVersion: to.Ptr(armnetwork.IPVersionIPv4), - // PrivateIPAllocationMethod: to.Ptr(armnetwork.IPAllocationMethodDynamic), - // ProvisioningState: to.Ptr(armnetwork.ProvisioningStateSucceeded), - // Subnet: &armnetwork.Subnet{ - // ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/virtualNetworks/rg1-vnet/subnets/default"), - // }, - // }, - // }}, - // ProvisioningState: to.Ptr(armnetwork.ProvisioningStateSucceeded), - // VnetEncryptionSupported: to.Ptr(false), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/4883fa5dbf6f2c9093fac8ce334547e9dfac68fa/specification/network/resource-manager/Microsoft.Network/stable/2024-03-01/examples/NetworkInterfaceCreateGatewayLoadBalancerConsumer.json -func ExampleInterfacesClient_BeginCreateOrUpdate_createNetworkInterfaceWithGatewayLoadBalancerConsumerConfigured() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armnetwork.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewInterfacesClient().BeginCreateOrUpdate(ctx, "rg1", "test-nic", armnetwork.Interface{ - Location: to.Ptr("eastus"), - Properties: &armnetwork.InterfacePropertiesFormat{ - EnableAcceleratedNetworking: to.Ptr(true), - IPConfigurations: []*armnetwork.InterfaceIPConfiguration{ - { - Name: to.Ptr("ipconfig1"), - Properties: &armnetwork.InterfaceIPConfigurationPropertiesFormat{ - GatewayLoadBalancer: &armnetwork.SubResource{ - ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/loadBalancers/lb/frontendIPConfigurations/fe-lb-provider"), - }, - PublicIPAddress: &armnetwork.PublicIPAddress{ - ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/publicIPAddresses/test-ip"), - }, - Subnet: &armnetwork.Subnet{ - ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/virtualNetworks/rg1-vnet/subnets/default"), - }, - }, - }}, - }, - }, nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - res, err := poller.PollUntilDone(ctx, nil) - if err != nil { - log.Fatalf("failed to pull the result: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.Interface = armnetwork.Interface{ - // Name: to.Ptr("test-nic"), - // Type: to.Ptr("Microsoft.Network/networkInterfaces"), - // ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/networkInterfaces/test-nic"), - // Location: to.Ptr("eastus"), - // Properties: &armnetwork.InterfacePropertiesFormat{ - // DNSSettings: &armnetwork.InterfaceDNSSettings{ - // AppliedDNSServers: []*string{ - // }, - // DNSServers: []*string{ - // }, - // }, - // EnableAcceleratedNetworking: to.Ptr(true), - // EnableIPForwarding: to.Ptr(false), - // IPConfigurations: []*armnetwork.InterfaceIPConfiguration{ - // { - // ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/networkInterfaces/test-nic/ipConfigurations/ipconfig1"), - // Name: to.Ptr("ipconfig1"), - // Properties: &armnetwork.InterfaceIPConfigurationPropertiesFormat{ - // GatewayLoadBalancer: &armnetwork.SubResource{ - // ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/loadBalancers/lb/frontendIPConfigurations/fe-lb-provider"), - // }, - // Primary: to.Ptr(true), - // PrivateIPAddress: to.Ptr("172.20.2.4"), - // PrivateIPAddressVersion: to.Ptr(armnetwork.IPVersionIPv4), - // PrivateIPAllocationMethod: to.Ptr(armnetwork.IPAllocationMethodDynamic), - // ProvisioningState: to.Ptr(armnetwork.ProvisioningStateSucceeded), - // PublicIPAddress: &armnetwork.PublicIPAddress{ - // ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/publicIPAddresses/test-ip"), - // }, - // Subnet: &armnetwork.Subnet{ - // ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/virtualNetworks/rg1-vnet/subnets/default"), - // }, - // }, - // }}, - // ProvisioningState: to.Ptr(armnetwork.ProvisioningStateSucceeded), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/4883fa5dbf6f2c9093fac8ce334547e9dfac68fa/specification/network/resource-manager/Microsoft.Network/stable/2024-03-01/examples/NetworkInterfaceUpdateTags.json -func ExampleInterfacesClient_UpdateTags() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armnetwork.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewInterfacesClient().UpdateTags(ctx, "rg1", "test-nic", armnetwork.TagsObject{ - Tags: map[string]*string{ - "tag1": to.Ptr("value1"), - "tag2": to.Ptr("value2"), - }, - }, nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.Interface = armnetwork.Interface{ - // Name: to.Ptr("test-nic"), - // Type: to.Ptr("Microsoft.Network/networkInterfaces"), - // ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/networkInterfaces/test-nic"), - // Location: to.Ptr("eastus"), - // Tags: map[string]*string{ - // "tag1": to.Ptr("value1"), - // "tag2": to.Ptr("value2"), - // }, - // Properties: &armnetwork.InterfacePropertiesFormat{ - // DisableTCPStateTracking: to.Ptr(true), - // DNSSettings: &armnetwork.InterfaceDNSSettings{ - // AppliedDNSServers: []*string{ - // }, - // DNSServers: []*string{ - // }, - // }, - // EnableAcceleratedNetworking: to.Ptr(true), - // EnableIPForwarding: to.Ptr(false), - // IPConfigurations: []*armnetwork.InterfaceIPConfiguration{ - // { - // ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/networkInterfaces/test-nic/ipConfigurations/ipconfig1"), - // Name: to.Ptr("ipconfig1"), - // Properties: &armnetwork.InterfaceIPConfigurationPropertiesFormat{ - // Primary: to.Ptr(true), - // PrivateIPAddress: to.Ptr("172.20.2.4"), - // PrivateIPAddressVersion: to.Ptr(armnetwork.IPVersionIPv4), - // PrivateIPAllocationMethod: to.Ptr(armnetwork.IPAllocationMethodDynamic), - // ProvisioningState: to.Ptr(armnetwork.ProvisioningStateSucceeded), - // PublicIPAddress: &armnetwork.PublicIPAddress{ - // ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/publicIPAddresses/test-ip"), - // }, - // Subnet: &armnetwork.Subnet{ - // ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/virtualNetworks/rg1-vnet/subnets/default"), - // }, - // }, - // }}, - // ProvisioningState: to.Ptr(armnetwork.ProvisioningStateSucceeded), - // VnetEncryptionSupported: to.Ptr(false), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/4883fa5dbf6f2c9093fac8ce334547e9dfac68fa/specification/network/resource-manager/Microsoft.Network/stable/2024-03-01/examples/NetworkInterfaceListAll.json -func ExampleInterfacesClient_NewListAllPager() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armnetwork.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := clientFactory.NewInterfacesClient().NewListAllPager(nil) - for pager.More() { - page, err := pager.NextPage(ctx) - if err != nil { - log.Fatalf("failed to advance page: %v", err) - } - for _, v := range page.Value { - // You could use page here. We use blank identifier for just demo purposes. - _ = v - } - // If the HTTP response code is 200 as defined in example definition, your page structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // page.InterfaceListResult = armnetwork.InterfaceListResult{ - // Value: []*armnetwork.Interface{ - // { - // Name: to.Ptr("test-nic"), - // Type: to.Ptr("Microsoft.Network/networkInterfaces"), - // ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/networkInterfaces/test-nic"), - // Location: to.Ptr("eastus"), - // Properties: &armnetwork.InterfacePropertiesFormat{ - // DisableTCPStateTracking: to.Ptr(true), - // DNSSettings: &armnetwork.InterfaceDNSSettings{ - // AppliedDNSServers: []*string{ - // }, - // DNSServers: []*string{ - // }, - // InternalDomainNameSuffix: to.Ptr("test.bx.internal.cloudapp.net"), - // }, - // EnableAcceleratedNetworking: to.Ptr(true), - // EnableIPForwarding: to.Ptr(false), - // IPConfigurations: []*armnetwork.InterfaceIPConfiguration{ - // { - // ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/networkInterfaces/test-nic/ipConfigurations/ipconfig1"), - // Name: to.Ptr("ipconfig1"), - // Properties: &armnetwork.InterfaceIPConfigurationPropertiesFormat{ - // Primary: to.Ptr(true), - // PrivateIPAddress: to.Ptr("172.20.2.4"), - // PrivateIPAddressVersion: to.Ptr(armnetwork.IPVersionIPv4), - // PrivateIPAllocationMethod: to.Ptr(armnetwork.IPAllocationMethodDynamic), - // ProvisioningState: to.Ptr(armnetwork.ProvisioningStateSucceeded), - // PublicIPAddress: &armnetwork.PublicIPAddress{ - // ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/publicIPAddresses/test-ip"), - // }, - // Subnet: &armnetwork.Subnet{ - // ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/virtualNetworks/rg1-vnet/subnets/default"), - // }, - // }, - // }}, - // MacAddress: to.Ptr("00-0D-3A-1B-C7-21"), - // NetworkSecurityGroup: &armnetwork.SecurityGroup{ - // ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/networkSecurityGroups/nsg"), - // }, - // Primary: to.Ptr(true), - // ProvisioningState: to.Ptr(armnetwork.ProvisioningStateSucceeded), - // VirtualMachine: &armnetwork.SubResource{ - // ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Compute/virtualMachines/vm1"), - // }, - // VnetEncryptionSupported: to.Ptr(false), - // }, - // }, - // { - // Name: to.Ptr("test-nic2"), - // Type: to.Ptr("Microsoft.Network/networkInterfaces"), - // ID: to.Ptr("/subscriptions/subid/resourceGroups/rgnew/providers/Microsoft.Network/networkInterfaces/test-nic2"), - // Location: to.Ptr("eastus"), - // Properties: &armnetwork.InterfacePropertiesFormat{ - // DisableTCPStateTracking: to.Ptr(true), - // DNSSettings: &armnetwork.InterfaceDNSSettings{ - // AppliedDNSServers: []*string{ - // }, - // DNSServers: []*string{ - // }, - // }, - // EnableAcceleratedNetworking: to.Ptr(true), - // EnableIPForwarding: to.Ptr(false), - // IPConfigurations: []*armnetwork.InterfaceIPConfiguration{ - // { - // ID: to.Ptr("/subscriptions/subid/resourceGroups/rgnew/providers/Microsoft.Network/networkInterfaces/test-nic2/ipConfigurations/ipconfig1"), - // Name: to.Ptr("ipconfig1"), - // Properties: &armnetwork.InterfaceIPConfigurationPropertiesFormat{ - // Primary: to.Ptr(true), - // PrivateIPAddress: to.Ptr("172.20.2.4"), - // PrivateIPAddressVersion: to.Ptr(armnetwork.IPVersionIPv4), - // PrivateIPAllocationMethod: to.Ptr(armnetwork.IPAllocationMethodDynamic), - // ProvisioningState: to.Ptr(armnetwork.ProvisioningStateSucceeded), - // PublicIPAddress: &armnetwork.PublicIPAddress{ - // ID: to.Ptr("/subscriptions/subid/resourceGroups/rgnew/providers/Microsoft.Network/publicIPAddresses/test-ip2"), - // }, - // Subnet: &armnetwork.Subnet{ - // ID: to.Ptr("/subscriptions/subid/resourceGroups/rgnew/providers/Microsoft.Network/virtualNetworks/rgnew-vnet2/subnets/default"), - // }, - // }, - // }}, - // ProvisioningState: to.Ptr(armnetwork.ProvisioningStateSucceeded), - // VnetEncryptionSupported: to.Ptr(false), - // }, - // }}, - // } - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/4883fa5dbf6f2c9093fac8ce334547e9dfac68fa/specification/network/resource-manager/Microsoft.Network/stable/2024-03-01/examples/NetworkInterfaceList.json -func ExampleInterfacesClient_NewListPager() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armnetwork.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := clientFactory.NewInterfacesClient().NewListPager("rg1", nil) - for pager.More() { - page, err := pager.NextPage(ctx) - if err != nil { - log.Fatalf("failed to advance page: %v", err) - } - for _, v := range page.Value { - // You could use page here. We use blank identifier for just demo purposes. - _ = v - } - // If the HTTP response code is 200 as defined in example definition, your page structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // page.InterfaceListResult = armnetwork.InterfaceListResult{ - // Value: []*armnetwork.Interface{ - // { - // Name: to.Ptr("test-nic"), - // Type: to.Ptr("Microsoft.Network/networkInterfaces"), - // ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/networkInterfaces/test-nic"), - // Location: to.Ptr("eastus"), - // Properties: &armnetwork.InterfacePropertiesFormat{ - // DisableTCPStateTracking: to.Ptr(true), - // DNSSettings: &armnetwork.InterfaceDNSSettings{ - // AppliedDNSServers: []*string{ - // }, - // DNSServers: []*string{ - // }, - // InternalDomainNameSuffix: to.Ptr("test.bx.internal.cloudapp.net"), - // }, - // EnableAcceleratedNetworking: to.Ptr(true), - // EnableIPForwarding: to.Ptr(false), - // IPConfigurations: []*armnetwork.InterfaceIPConfiguration{ - // { - // ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/networkInterfaces/test-nic/ipConfigurations/ipconfig1"), - // Name: to.Ptr("ipconfig1"), - // Properties: &armnetwork.InterfaceIPConfigurationPropertiesFormat{ - // Primary: to.Ptr(true), - // PrivateIPAddress: to.Ptr("172.20.2.4"), - // PrivateIPAddressVersion: to.Ptr(armnetwork.IPVersionIPv4), - // PrivateIPAllocationMethod: to.Ptr(armnetwork.IPAllocationMethodDynamic), - // ProvisioningState: to.Ptr(armnetwork.ProvisioningStateSucceeded), - // PublicIPAddress: &armnetwork.PublicIPAddress{ - // ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/publicIPAddresses/test-ip"), - // }, - // Subnet: &armnetwork.Subnet{ - // ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/virtualNetworks/rg1-vnet/subnets/default"), - // }, - // }, - // }}, - // MacAddress: to.Ptr("00-0D-3A-1B-C7-21"), - // NetworkSecurityGroup: &armnetwork.SecurityGroup{ - // ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/networkSecurityGroups/nsg"), - // }, - // Primary: to.Ptr(true), - // ProvisioningState: to.Ptr(armnetwork.ProvisioningStateSucceeded), - // VirtualMachine: &armnetwork.SubResource{ - // ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Compute/virtualMachines/vm1"), - // }, - // VnetEncryptionSupported: to.Ptr(false), - // }, - // }, - // { - // Name: to.Ptr("test-nic2"), - // Type: to.Ptr("Microsoft.Network/networkInterfaces"), - // ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/networkInterfaces/test-nic2"), - // Location: to.Ptr("eastus"), - // Properties: &armnetwork.InterfacePropertiesFormat{ - // DNSSettings: &armnetwork.InterfaceDNSSettings{ - // AppliedDNSServers: []*string{ - // }, - // DNSServers: []*string{ - // }, - // }, - // EnableAcceleratedNetworking: to.Ptr(true), - // EnableIPForwarding: to.Ptr(false), - // IPConfigurations: []*armnetwork.InterfaceIPConfiguration{ - // { - // ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/networkInterfaces/test-nic2/ipConfigurations/ipconfig1"), - // Name: to.Ptr("ipconfig1"), - // Properties: &armnetwork.InterfaceIPConfigurationPropertiesFormat{ - // Primary: to.Ptr(true), - // PrivateIPAddress: to.Ptr("172.20.2.4"), - // PrivateIPAddressVersion: to.Ptr(armnetwork.IPVersionIPv4), - // PrivateIPAllocationMethod: to.Ptr(armnetwork.IPAllocationMethodDynamic), - // ProvisioningState: to.Ptr(armnetwork.ProvisioningStateSucceeded), - // PublicIPAddress: &armnetwork.PublicIPAddress{ - // ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/publicIPAddresses/test-ip2"), - // }, - // Subnet: &armnetwork.Subnet{ - // ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/virtualNetworks/rg1-vnet2/subnets/default"), - // }, - // }, - // }, - // { - // ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/networkInterfaces/test-nic/ipConfigurations/ipconfig2"), - // Name: to.Ptr("ipconfig2"), - // Properties: &armnetwork.InterfaceIPConfigurationPropertiesFormat{ - // Primary: to.Ptr(false), - // PrivateIPAddress: to.Ptr("172.20.2.16/28"), - // PrivateIPAddressPrefixLength: to.Ptr[int32](28), - // PrivateIPAddressVersion: to.Ptr(armnetwork.IPVersionIPv4), - // PrivateIPAllocationMethod: to.Ptr(armnetwork.IPAllocationMethodDynamic), - // ProvisioningState: to.Ptr(armnetwork.ProvisioningStateSucceeded), - // Subnet: &armnetwork.Subnet{ - // ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/virtualNetworks/rg1-vnet/subnets/default"), - // }, - // }, - // }}, - // ProvisioningState: to.Ptr(armnetwork.ProvisioningStateSucceeded), - // VnetEncryptionSupported: to.Ptr(false), - // }, - // }}, - // } - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/4883fa5dbf6f2c9093fac8ce334547e9dfac68fa/specification/network/resource-manager/Microsoft.Network/stable/2024-03-01/examples/NetworkInterfaceEffectiveRouteTableList.json -func ExampleInterfacesClient_BeginGetEffectiveRouteTable() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armnetwork.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewInterfacesClient().BeginGetEffectiveRouteTable(ctx, "rg1", "nic1", nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - res, err := poller.PollUntilDone(ctx, nil) - if err != nil { - log.Fatalf("failed to pull the result: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.EffectiveRouteListResult = armnetwork.EffectiveRouteListResult{ - // Value: []*armnetwork.EffectiveRoute{ - // { - // AddressPrefix: []*string{ - // to.Ptr("172.20.2.0/24")}, - // NextHopIPAddress: []*string{ - // }, - // NextHopType: to.Ptr(armnetwork.RouteNextHopTypeVnetLocal), - // Source: to.Ptr(armnetwork.EffectiveRouteSourceDefault), - // State: to.Ptr(armnetwork.EffectiveRouteStateActive), - // }, - // { - // AddressPrefix: []*string{ - // to.Ptr("0.0.0.0/0")}, - // NextHopIPAddress: []*string{ - // }, - // NextHopType: to.Ptr(armnetwork.RouteNextHopTypeInternet), - // Source: to.Ptr(armnetwork.EffectiveRouteSourceDefault), - // State: to.Ptr(armnetwork.EffectiveRouteStateActive), - // }, - // { - // AddressPrefix: []*string{ - // to.Ptr("10.0.0.0/8")}, - // NextHopIPAddress: []*string{ - // }, - // NextHopType: to.Ptr(armnetwork.RouteNextHopTypeNone), - // Source: to.Ptr(armnetwork.EffectiveRouteSourceDefault), - // State: to.Ptr(armnetwork.EffectiveRouteStateActive), - // }, - // { - // AddressPrefix: []*string{ - // to.Ptr("100.64.0.0/10")}, - // NextHopIPAddress: []*string{ - // }, - // NextHopType: to.Ptr(armnetwork.RouteNextHopTypeNone), - // Source: to.Ptr(armnetwork.EffectiveRouteSourceDefault), - // State: to.Ptr(armnetwork.EffectiveRouteStateActive), - // }, - // { - // AddressPrefix: []*string{ - // to.Ptr("172.16.0.0/12")}, - // NextHopIPAddress: []*string{ - // }, - // NextHopType: to.Ptr(armnetwork.RouteNextHopTypeNone), - // Source: to.Ptr(armnetwork.EffectiveRouteSourceDefault), - // State: to.Ptr(armnetwork.EffectiveRouteStateActive), - // }, - // { - // AddressPrefix: []*string{ - // to.Ptr("192.168.0.0/16")}, - // NextHopIPAddress: []*string{ - // }, - // NextHopType: to.Ptr(armnetwork.RouteNextHopTypeNone), - // Source: to.Ptr(armnetwork.EffectiveRouteSourceDefault), - // State: to.Ptr(armnetwork.EffectiveRouteStateActive), - // }}, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/4883fa5dbf6f2c9093fac8ce334547e9dfac68fa/specification/network/resource-manager/Microsoft.Network/stable/2024-03-01/examples/NetworkInterfaceEffectiveNSGList.json -func ExampleInterfacesClient_BeginListEffectiveNetworkSecurityGroups() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armnetwork.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewInterfacesClient().BeginListEffectiveNetworkSecurityGroups(ctx, "rg1", "nic1", nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - res, err := poller.PollUntilDone(ctx, nil) - if err != nil { - log.Fatalf("failed to pull the result: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.EffectiveNetworkSecurityGroupListResult = armnetwork.EffectiveNetworkSecurityGroupListResult{ - // Value: []*armnetwork.EffectiveNetworkSecurityGroup{ - // { - // Association: &armnetwork.EffectiveNetworkSecurityGroupAssociation{ - // NetworkInterface: &armnetwork.SubResource{ - // ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/networkInterfaces/nic1"), - // }, - // NetworkManager: &armnetwork.SubResource{ - // ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/networkManagers/nm1"), - // }, - // Subnet: &armnetwork.SubResource{ - // ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/virtualNetworks/rg1-vnet/subnets/default"), - // }, - // }, - // EffectiveSecurityRules: []*armnetwork.EffectiveNetworkSecurityRule{ - // { - // Name: to.Ptr("securityRules/rule1"), - // Access: to.Ptr(armnetwork.SecurityRuleAccessAllow), - // DestinationAddressPrefix: to.Ptr("0.0.0.0/32"), - // DestinationPortRange: to.Ptr("6579-6579"), - // Direction: to.Ptr(armnetwork.SecurityRuleDirectionInbound), - // Priority: to.Ptr[int32](234), - // SourceAddressPrefix: to.Ptr("0.0.0.0/32"), - // SourcePortRange: to.Ptr("456-456"), - // Protocol: to.Ptr(armnetwork.EffectiveSecurityRuleProtocolTCP), - // }, - // { - // Name: to.Ptr("securityRules/default-allow-rdp"), - // Access: to.Ptr(armnetwork.SecurityRuleAccessAllow), - // DestinationAddressPrefix: to.Ptr("0.0.0.0/0"), - // DestinationPortRange: to.Ptr("3389-3389"), - // Direction: to.Ptr(armnetwork.SecurityRuleDirectionInbound), - // Priority: to.Ptr[int32](1000), - // SourceAddressPrefix: to.Ptr("1.1.1.1/32"), - // SourcePortRange: to.Ptr("0-65535"), - // Protocol: to.Ptr(armnetwork.EffectiveSecurityRuleProtocolTCP), - // }, - // { - // Name: to.Ptr("defaultSecurityRules/AllowInternetOutBound"), - // Access: to.Ptr(armnetwork.SecurityRuleAccessAllow), - // DestinationAddressPrefix: to.Ptr("Internet"), - // DestinationPortRange: to.Ptr("0-65535"), - // Direction: to.Ptr(armnetwork.SecurityRuleDirectionOutbound), - // ExpandedDestinationAddressPrefix: []*string{ - // to.Ptr("32.0.0.0/3"), - // to.Ptr("4.0.0.0/6"), - // to.Ptr("2.0.0.0/7"), - // to.Ptr("1.0.0.0/8")}, - // Priority: to.Ptr[int32](65001), - // SourceAddressPrefix: to.Ptr("0.0.0.0/0"), - // SourcePortRange: to.Ptr("0-65535"), - // Protocol: to.Ptr(armnetwork.EffectiveSecurityRuleProtocolAll), - // }}, - // NetworkSecurityGroup: &armnetwork.SubResource{ - // ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/networkSecurityGroups/test-nsg"), - // }, - // }}, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/4883fa5dbf6f2c9093fac8ce334547e9dfac68fa/specification/network/resource-manager/Microsoft.Network/stable/2024-03-01/examples/VmssVmNetworkInterfaceList.json -func ExampleInterfacesClient_NewListVirtualMachineScaleSetVMNetworkInterfacesPager() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armnetwork.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := clientFactory.NewInterfacesClient().NewListVirtualMachineScaleSetVMNetworkInterfacesPager("rg1", "vmss1", "1", nil) - for pager.More() { - page, err := pager.NextPage(ctx) - if err != nil { - log.Fatalf("failed to advance page: %v", err) - } - for _, v := range page.Value { - // You could use page here. We use blank identifier for just demo purposes. - _ = v - } - // If the HTTP response code is 200 as defined in example definition, your page structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // page.InterfaceListResult = armnetwork.InterfaceListResult{ - // Value: []*armnetwork.Interface{ - // { - // Name: to.Ptr("nic1"), - // ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Compute/virtualMachineScaleSets/vmss1/virtualMachines/1/networkInterfaces/nic1"), - // Properties: &armnetwork.InterfacePropertiesFormat{ - // DNSSettings: &armnetwork.InterfaceDNSSettings{ - // AppliedDNSServers: []*string{ - // }, - // DNSServers: []*string{ - // }, - // InternalDomainNameSuffix: to.Ptr("ruw4wz3grewudjsyzrxj44pxod.cdmx.internal.cloudapp.net"), - // }, - // EnableAcceleratedNetworking: to.Ptr(false), - // EnableIPForwarding: to.Ptr(false), - // IPConfigurations: []*armnetwork.InterfaceIPConfiguration{ - // { - // ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Compute/virtualMachineScaleSets/vmss1/virtualMachines/1/networkInterfaces/nic1/ipConfigurations/ip1"), - // Name: to.Ptr("ip1"), - // Properties: &armnetwork.InterfaceIPConfigurationPropertiesFormat{ - // LoadBalancerBackendAddressPools: []*armnetwork.BackendAddressPool{ - // { - // ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/loadBalancers/lb1/backendAddressPools/addressPool1"), - // }}, - // LoadBalancerInboundNatRules: []*armnetwork.InboundNatRule{ - // { - // ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/loadBalancers/lb1/inboundNatRules/natPool1.1"), - // }}, - // Primary: to.Ptr(true), - // PrivateIPAddress: to.Ptr("10.0.0.5"), - // PrivateIPAddressVersion: to.Ptr(armnetwork.IPVersionIPv4), - // PrivateIPAllocationMethod: to.Ptr(armnetwork.IPAllocationMethodDynamic), - // ProvisioningState: to.Ptr(armnetwork.ProvisioningStateSucceeded), - // PublicIPAddress: &armnetwork.PublicIPAddress{ - // ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Compute/virtualMachineScaleSets/vmss1/virtualMachines/1/networkInterfaces/nic1/ipConfigurations/ip1/publicIPAddresses/pub1"), - // }, - // Subnet: &armnetwork.Subnet{ - // ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/virtualNetworks/vnet1/subnets/subnet1"), - // }, - // }, - // }}, - // MacAddress: to.Ptr("00-00-00-00-00-00"), - // NetworkSecurityGroup: &armnetwork.SecurityGroup{ - // ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/networkSecurityGroups/nsg1"), - // }, - // Primary: to.Ptr(true), - // ProvisioningState: to.Ptr(armnetwork.ProvisioningStateSucceeded), - // VirtualMachine: &armnetwork.SubResource{ - // ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Compute/virtualMachineScaleSets/vmss1/virtualMachines/1"), - // }, - // }, - // }}, - // } - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/4883fa5dbf6f2c9093fac8ce334547e9dfac68fa/specification/network/resource-manager/Microsoft.Network/stable/2024-03-01/examples/VmssNetworkInterfaceList.json -func ExampleInterfacesClient_NewListVirtualMachineScaleSetNetworkInterfacesPager() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armnetwork.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := clientFactory.NewInterfacesClient().NewListVirtualMachineScaleSetNetworkInterfacesPager("rg1", "vmss1", nil) - for pager.More() { - page, err := pager.NextPage(ctx) - if err != nil { - log.Fatalf("failed to advance page: %v", err) - } - for _, v := range page.Value { - // You could use page here. We use blank identifier for just demo purposes. - _ = v - } - // If the HTTP response code is 200 as defined in example definition, your page structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // page.InterfaceListResult = armnetwork.InterfaceListResult{ - // Value: []*armnetwork.Interface{ - // { - // Name: to.Ptr("nic1"), - // ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Compute/virtualMachineScaleSets/vmss1/virtualMachines/0/networkInterfaces/nic1"), - // Properties: &armnetwork.InterfacePropertiesFormat{ - // DNSSettings: &armnetwork.InterfaceDNSSettings{ - // AppliedDNSServers: []*string{ - // }, - // DNSServers: []*string{ - // }, - // InternalDomainNameSuffix: to.Ptr("ruw4wz3grewudjsyzrxj44pxod.cdmx.internal.cloudapp.net"), - // }, - // EnableAcceleratedNetworking: to.Ptr(false), - // EnableIPForwarding: to.Ptr(false), - // IPConfigurations: []*armnetwork.InterfaceIPConfiguration{ - // { - // ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Compute/virtualMachineScaleSets/vmss1/virtualMachines/0/networkInterfaces/nic1/ipConfigurations/ip1"), - // Name: to.Ptr("ip1"), - // Properties: &armnetwork.InterfaceIPConfigurationPropertiesFormat{ - // LoadBalancerBackendAddressPools: []*armnetwork.BackendAddressPool{ - // { - // ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/loadBalancers/lb1/backendAddressPools/addressPool1"), - // }}, - // LoadBalancerInboundNatRules: []*armnetwork.InboundNatRule{ - // { - // ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/loadBalancers/lb1/inboundNatRules/natPool1.0"), - // }}, - // Primary: to.Ptr(true), - // PrivateIPAddress: to.Ptr("10.0.0.4"), - // PrivateIPAddressVersion: to.Ptr(armnetwork.IPVersionIPv4), - // PrivateIPAllocationMethod: to.Ptr(armnetwork.IPAllocationMethodDynamic), - // ProvisioningState: to.Ptr(armnetwork.ProvisioningStateSucceeded), - // PublicIPAddress: &armnetwork.PublicIPAddress{ - // ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Compute/virtualMachineScaleSets/vmss1/virtualMachines/0/networkInterfaces/nic1/ipConfigurations/ip1/publicIPAddresses/pub1"), - // }, - // Subnet: &armnetwork.Subnet{ - // ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/virtualNetworks/vnet1/subnets/subnet1"), - // }, - // }, - // }}, - // MacAddress: to.Ptr("00-00-00-00-00-00"), - // NetworkSecurityGroup: &armnetwork.SecurityGroup{ - // ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/networkSecurityGroups/nsg1"), - // }, - // Primary: to.Ptr(true), - // ProvisioningState: to.Ptr(armnetwork.ProvisioningStateSucceeded), - // VirtualMachine: &armnetwork.SubResource{ - // ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Compute/virtualMachineScaleSets/vmss1/virtualMachines/0"), - // }, - // }, - // }, - // { - // Name: to.Ptr("nic1"), - // ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Compute/virtualMachineScaleSets/vmss1/virtualMachines/1/networkInterfaces/nic1"), - // Properties: &armnetwork.InterfacePropertiesFormat{ - // DNSSettings: &armnetwork.InterfaceDNSSettings{ - // AppliedDNSServers: []*string{ - // }, - // DNSServers: []*string{ - // }, - // InternalDomainNameSuffix: to.Ptr("ruw4wz3grewudjsyzrxj44pxod.cdmx.internal.cloudapp.net"), - // }, - // EnableAcceleratedNetworking: to.Ptr(false), - // EnableIPForwarding: to.Ptr(false), - // IPConfigurations: []*armnetwork.InterfaceIPConfiguration{ - // { - // ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Compute/virtualMachineScaleSets/vmss1/virtualMachines/1/networkInterfaces/nic1/ipConfigurations/ip1"), - // Name: to.Ptr("ip1"), - // Properties: &armnetwork.InterfaceIPConfigurationPropertiesFormat{ - // LoadBalancerBackendAddressPools: []*armnetwork.BackendAddressPool{ - // { - // ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/loadBalancers/lb1/backendAddressPools/addressPool1"), - // }}, - // LoadBalancerInboundNatRules: []*armnetwork.InboundNatRule{ - // { - // ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/loadBalancers/lb1/inboundNatRules/natPool1.1"), - // }}, - // Primary: to.Ptr(true), - // PrivateIPAddress: to.Ptr("10.0.0.5"), - // PrivateIPAddressVersion: to.Ptr(armnetwork.IPVersionIPv4), - // PrivateIPAllocationMethod: to.Ptr(armnetwork.IPAllocationMethodDynamic), - // ProvisioningState: to.Ptr(armnetwork.ProvisioningStateSucceeded), - // PublicIPAddress: &armnetwork.PublicIPAddress{ - // ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Compute/virtualMachineScaleSets/vmss1/virtualMachines/1/networkInterfaces/nic1/ipConfigurations/ip1/publicIPAddresses/pub1"), - // }, - // Subnet: &armnetwork.Subnet{ - // ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/virtualNetworks/vnet1/subnets/subnet1"), - // }, - // }, - // }}, - // MacAddress: to.Ptr("00-00-00-00-00-00"), - // NetworkSecurityGroup: &armnetwork.SecurityGroup{ - // ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/networkSecurityGroups/nsg1"), - // }, - // Primary: to.Ptr(true), - // ProvisioningState: to.Ptr(armnetwork.ProvisioningStateSucceeded), - // VirtualMachine: &armnetwork.SubResource{ - // ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Compute/virtualMachineScaleSets/vmss1/virtualMachines/1"), - // }, - // }, - // }}, - // } - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/4883fa5dbf6f2c9093fac8ce334547e9dfac68fa/specification/network/resource-manager/Microsoft.Network/stable/2024-03-01/examples/VmssNetworkInterfaceGet.json -func ExampleInterfacesClient_GetVirtualMachineScaleSetNetworkInterface() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armnetwork.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewInterfacesClient().GetVirtualMachineScaleSetNetworkInterface(ctx, "rg1", "vmss1", "1", "nic1", &armnetwork.InterfacesClientGetVirtualMachineScaleSetNetworkInterfaceOptions{Expand: nil}) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.Interface = armnetwork.Interface{ - // Name: to.Ptr("nic1"), - // ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Compute/virtualMachineScaleSets/vmss1/virtualMachines/1/networkInterfaces/nic1"), - // Properties: &armnetwork.InterfacePropertiesFormat{ - // DNSSettings: &armnetwork.InterfaceDNSSettings{ - // AppliedDNSServers: []*string{ - // }, - // DNSServers: []*string{ - // }, - // InternalDomainNameSuffix: to.Ptr("dns.cdmx.internal.cloudapp.net"), - // }, - // EnableAcceleratedNetworking: to.Ptr(false), - // EnableIPForwarding: to.Ptr(false), - // IPConfigurations: []*armnetwork.InterfaceIPConfiguration{ - // { - // ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Compute/virtualMachineScaleSets/vmss1/virtualMachines/1/networkInterfaces/nic1/ipConfigurations/ip1"), - // Name: to.Ptr("ip1"), - // Properties: &armnetwork.InterfaceIPConfigurationPropertiesFormat{ - // LoadBalancerBackendAddressPools: []*armnetwork.BackendAddressPool{ - // { - // ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/loadBalancers/lb1/backendAddressPools/addressPool1"), - // }}, - // LoadBalancerInboundNatRules: []*armnetwork.InboundNatRule{ - // { - // ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/loadBalancers/lb1/inboundNatRules/natPool1.1"), - // }}, - // Primary: to.Ptr(true), - // PrivateIPAddress: to.Ptr("10.0.0.5"), - // PrivateIPAddressVersion: to.Ptr(armnetwork.IPVersionIPv4), - // PrivateIPAllocationMethod: to.Ptr(armnetwork.IPAllocationMethodDynamic), - // ProvisioningState: to.Ptr(armnetwork.ProvisioningStateSucceeded), - // PublicIPAddress: &armnetwork.PublicIPAddress{ - // ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Compute/virtualMachineScaleSets/vmss1/virtualMachines/1/networkInterfaces/nic1/ipConfigurations/ip1/publicIPAddresses/pub1"), - // }, - // Subnet: &armnetwork.Subnet{ - // ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/virtualNetworks/vnet1/subnets/subnet1"), - // }, - // }, - // }}, - // MacAddress: to.Ptr("00-00-00-00-00-00"), - // NetworkSecurityGroup: &armnetwork.SecurityGroup{ - // ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/networkSecurityGroups/nsg1"), - // }, - // Primary: to.Ptr(true), - // ProvisioningState: to.Ptr(armnetwork.ProvisioningStateSucceeded), - // VirtualMachine: &armnetwork.SubResource{ - // ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Compute/virtualMachineScaleSets/vmss1/virtualMachines/1"), - // }, - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/4883fa5dbf6f2c9093fac8ce334547e9dfac68fa/specification/network/resource-manager/Microsoft.Network/stable/2024-03-01/examples/VmssNetworkInterfaceIpConfigList.json -func ExampleInterfacesClient_NewListVirtualMachineScaleSetIPConfigurationsPager() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armnetwork.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := clientFactory.NewInterfacesClient().NewListVirtualMachineScaleSetIPConfigurationsPager("rg1", "vmss1", "2", "nic1", &armnetwork.InterfacesClientListVirtualMachineScaleSetIPConfigurationsOptions{Expand: nil}) - for pager.More() { - page, err := pager.NextPage(ctx) - if err != nil { - log.Fatalf("failed to advance page: %v", err) - } - for _, v := range page.Value { - // You could use page here. We use blank identifier for just demo purposes. - _ = v - } - // If the HTTP response code is 200 as defined in example definition, your page structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // page.InterfaceIPConfigurationListResult = armnetwork.InterfaceIPConfigurationListResult{ - // Value: []*armnetwork.InterfaceIPConfiguration{ - // { - // ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Compute/virtualMachineScaleSets/vmss1/virtualMachines/2/networkInterfaces/nic1/ipConfigurations/ip1"), - // Name: to.Ptr("ip1"), - // Properties: &armnetwork.InterfaceIPConfigurationPropertiesFormat{ - // LoadBalancerBackendAddressPools: []*armnetwork.BackendAddressPool{ - // { - // ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/loadBalancers/lb1/backendAddressPools/addressPool1"), - // }}, - // LoadBalancerInboundNatRules: []*armnetwork.InboundNatRule{ - // { - // ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/loadBalancers/lb1/inboundNatRules/natPool1.2"), - // }}, - // Primary: to.Ptr(true), - // PrivateIPAddress: to.Ptr("10.0.0.6"), - // PrivateIPAddressVersion: to.Ptr(armnetwork.IPVersionIPv4), - // PrivateIPAllocationMethod: to.Ptr(armnetwork.IPAllocationMethodDynamic), - // ProvisioningState: to.Ptr(armnetwork.ProvisioningStateSucceeded), - // Subnet: &armnetwork.Subnet{ - // ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/virtualNetworks/vnet1/subnets/subnet1"), - // }, - // }, - // }}, - // } - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/4883fa5dbf6f2c9093fac8ce334547e9dfac68fa/specification/network/resource-manager/Microsoft.Network/stable/2024-03-01/examples/VmssNetworkInterfaceIpConfigGet.json -func ExampleInterfacesClient_GetVirtualMachineScaleSetIPConfiguration() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armnetwork.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewInterfacesClient().GetVirtualMachineScaleSetIPConfiguration(ctx, "rg1", "vmss1", "2", "nic1", "ip1", &armnetwork.InterfacesClientGetVirtualMachineScaleSetIPConfigurationOptions{Expand: nil}) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.InterfaceIPConfiguration = armnetwork.InterfaceIPConfiguration{ - // ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Compute/virtualMachineScaleSets/vmss1/virtualMachines/2/networkInterfaces/nic1/ipConfigurations/ip1"), - // Name: to.Ptr("ip1"), - // Properties: &armnetwork.InterfaceIPConfigurationPropertiesFormat{ - // LoadBalancerBackendAddressPools: []*armnetwork.BackendAddressPool{ - // { - // ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/loadBalancers/lb1/backendAddressPools/addressPool1"), - // }}, - // LoadBalancerInboundNatRules: []*armnetwork.InboundNatRule{ - // { - // ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/loadBalancers/lb1/inboundNatRules/natPool1.2"), - // }}, - // Primary: to.Ptr(true), - // PrivateIPAddress: to.Ptr("10.0.0.6"), - // PrivateIPAddressVersion: to.Ptr(armnetwork.IPVersionIPv4), - // PrivateIPAllocationMethod: to.Ptr(armnetwork.IPAllocationMethodDynamic), - // ProvisioningState: to.Ptr(armnetwork.ProvisioningStateSucceeded), - // Subnet: &armnetwork.Subnet{ - // ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/virtualNetworks/vnet1/subnets/subnet1"), - // }, - // }, - // } -} diff --git a/sdk/resourcemanager/network/armnetwork/interfacetapconfigurations_client_example_test.go b/sdk/resourcemanager/network/armnetwork/interfacetapconfigurations_client_example_test.go deleted file mode 100644 index e1e416ac8c0b..000000000000 --- a/sdk/resourcemanager/network/armnetwork/interfacetapconfigurations_client_example_test.go +++ /dev/null @@ -1,154 +0,0 @@ -//go:build go1.18 -// +build go1.18 - -// 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. -// DO NOT EDIT. - -package armnetwork_test - -import ( - "context" - "log" - - "github.com/Azure/azure-sdk-for-go/sdk/azcore/to" - "github.com/Azure/azure-sdk-for-go/sdk/azidentity" - "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/network/armnetwork/v6" -) - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/4883fa5dbf6f2c9093fac8ce334547e9dfac68fa/specification/network/resource-manager/Microsoft.Network/stable/2024-03-01/examples/NetworkInterfaceTapConfigurationDelete.json -func ExampleInterfaceTapConfigurationsClient_BeginDelete() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armnetwork.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewInterfaceTapConfigurationsClient().BeginDelete(ctx, "testrg", "mynic", "tapconfiguration1", nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - _, err = poller.PollUntilDone(ctx, nil) - if err != nil { - log.Fatalf("failed to pull the result: %v", err) - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/4883fa5dbf6f2c9093fac8ce334547e9dfac68fa/specification/network/resource-manager/Microsoft.Network/stable/2024-03-01/examples/NetworkInterfaceTapConfigurationGet.json -func ExampleInterfaceTapConfigurationsClient_Get() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armnetwork.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewInterfaceTapConfigurationsClient().Get(ctx, "testrg", "mynic", "tapconfiguration1", nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.InterfaceTapConfiguration = armnetwork.InterfaceTapConfiguration{ - // ID: to.Ptr("/subscriptions/subid/resourceGroups/testrg/providers/Microsoft.Network/networkInterfaces/mynic/tapConfigurations/tapConfiguration1"), - // Name: to.Ptr("tapConfiguration1"), - // Type: to.Ptr("Microsoft.Network/networkInterfaces/tapConfigurations"), - // Etag: to.Ptr("etag"), - // Properties: &armnetwork.InterfaceTapConfigurationPropertiesFormat{ - // ProvisioningState: to.Ptr(armnetwork.ProvisioningStateSucceeded), - // VirtualNetworkTap: &armnetwork.VirtualNetworkTap{ - // ID: to.Ptr("/subscriptions/subid/resourceGroups/testrg/providers/Microsoft.Network/virtualNetworkTaps/testvtap"), - // }, - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/4883fa5dbf6f2c9093fac8ce334547e9dfac68fa/specification/network/resource-manager/Microsoft.Network/stable/2024-03-01/examples/NetworkInterfaceTapConfigurationCreate.json -func ExampleInterfaceTapConfigurationsClient_BeginCreateOrUpdate() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armnetwork.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewInterfaceTapConfigurationsClient().BeginCreateOrUpdate(ctx, "testrg", "mynic", "tapconfiguration1", armnetwork.InterfaceTapConfiguration{ - Properties: &armnetwork.InterfaceTapConfigurationPropertiesFormat{ - VirtualNetworkTap: &armnetwork.VirtualNetworkTap{ - ID: to.Ptr("/subscriptions/subid/resourceGroups/testrg/providers/Microsoft.Network/virtualNetworkTaps/testvtap"), - }, - }, - }, nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - res, err := poller.PollUntilDone(ctx, nil) - if err != nil { - log.Fatalf("failed to pull the result: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.InterfaceTapConfiguration = armnetwork.InterfaceTapConfiguration{ - // ID: to.Ptr("/subscriptions/subid/resourceGroups/testrg/providers/Microsoft.Network/networkInterfaces/mynic/tapConfigurations/tapConfiguration1"), - // Name: to.Ptr("tapConfiguration1"), - // Type: to.Ptr("Microsoft.Network/networkInterfaces/tapConfigurations"), - // Etag: to.Ptr("etag"), - // Properties: &armnetwork.InterfaceTapConfigurationPropertiesFormat{ - // ProvisioningState: to.Ptr(armnetwork.ProvisioningStateSucceeded), - // VirtualNetworkTap: &armnetwork.VirtualNetworkTap{ - // ID: to.Ptr("/subscriptions/subid/resourceGroups/testrg/providers/Microsoft.Network/virtualNetworkTaps/testvtap"), - // }, - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/4883fa5dbf6f2c9093fac8ce334547e9dfac68fa/specification/network/resource-manager/Microsoft.Network/stable/2024-03-01/examples/NetworkInterfaceTapConfigurationList.json -func ExampleInterfaceTapConfigurationsClient_NewListPager() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armnetwork.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := clientFactory.NewInterfaceTapConfigurationsClient().NewListPager("testrg", "mynic", nil) - for pager.More() { - page, err := pager.NextPage(ctx) - if err != nil { - log.Fatalf("failed to advance page: %v", err) - } - for _, v := range page.Value { - // You could use page here. We use blank identifier for just demo purposes. - _ = v - } - // If the HTTP response code is 200 as defined in example definition, your page structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // page.InterfaceTapConfigurationListResult = armnetwork.InterfaceTapConfigurationListResult{ - // Value: []*armnetwork.InterfaceTapConfiguration{ - // { - // ID: to.Ptr("/subscriptions/subid/resourceGroups/testrg/providers/Microsoft.Network/networkInterfaces/mynic/tapConfigurations/tapConfiguration1"), - // Name: to.Ptr("tapConfiguration1"), - // Type: to.Ptr("Microsoft.Network/networkInterfaces/tapConfigurations"), - // Etag: to.Ptr("etag"), - // Properties: &armnetwork.InterfaceTapConfigurationPropertiesFormat{ - // ProvisioningState: to.Ptr(armnetwork.ProvisioningStateSucceeded), - // VirtualNetworkTap: &armnetwork.VirtualNetworkTap{ - // ID: to.Ptr("/subscriptions/subid/resourceGroups/testrg/providers/Microsoft.Network/virtualNetworkTaps/testvtap"), - // }, - // }, - // }}, - // } - } -} diff --git a/sdk/resourcemanager/network/armnetwork/ipallocations_client_example_test.go b/sdk/resourcemanager/network/armnetwork/ipallocations_client_example_test.go deleted file mode 100644 index 36d9757378a4..000000000000 --- a/sdk/resourcemanager/network/armnetwork/ipallocations_client_example_test.go +++ /dev/null @@ -1,276 +0,0 @@ -//go:build go1.18 -// +build go1.18 - -// 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. -// DO NOT EDIT. - -package armnetwork_test - -import ( - "context" - "log" - - "github.com/Azure/azure-sdk-for-go/sdk/azcore/to" - "github.com/Azure/azure-sdk-for-go/sdk/azidentity" - "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/network/armnetwork/v6" -) - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/4883fa5dbf6f2c9093fac8ce334547e9dfac68fa/specification/network/resource-manager/Microsoft.Network/stable/2024-03-01/examples/IpAllocationDelete.json -func ExampleIPAllocationsClient_BeginDelete() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armnetwork.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewIPAllocationsClient().BeginDelete(ctx, "rg1", "test-ipallocation", nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - _, err = poller.PollUntilDone(ctx, nil) - if err != nil { - log.Fatalf("failed to pull the result: %v", err) - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/4883fa5dbf6f2c9093fac8ce334547e9dfac68fa/specification/network/resource-manager/Microsoft.Network/stable/2024-03-01/examples/IpAllocationGet.json -func ExampleIPAllocationsClient_Get() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armnetwork.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewIPAllocationsClient().Get(ctx, "rg1", "test-ipallocation", &armnetwork.IPAllocationsClientGetOptions{Expand: nil}) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.IPAllocation = armnetwork.IPAllocation{ - // Name: to.Ptr("test-ipallocation"), - // Type: to.Ptr("Microsoft.Network/IpAllocations"), - // ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/IpAllocations/test-ipallocation"), - // Location: to.Ptr("centraluseuap"), - // Properties: &armnetwork.IPAllocationPropertiesFormat{ - // Type: to.Ptr(armnetwork.IPAllocationTypeHypernet), - // AllocationTags: map[string]*string{ - // "VNetID": to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/virtualNetworks/HypernetVnet1"), - // }, - // IpamAllocationID: to.Ptr("916d3b28-663f-448b-9abc-1bea9d5fed8f"), - // Prefix: to.Ptr("3.2.5.0/24"), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/4883fa5dbf6f2c9093fac8ce334547e9dfac68fa/specification/network/resource-manager/Microsoft.Network/stable/2024-03-01/examples/IpAllocationCreate.json -func ExampleIPAllocationsClient_BeginCreateOrUpdate() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armnetwork.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewIPAllocationsClient().BeginCreateOrUpdate(ctx, "rg1", "test-ipallocation", armnetwork.IPAllocation{ - Location: to.Ptr("centraluseuap"), - Properties: &armnetwork.IPAllocationPropertiesFormat{ - Type: to.Ptr(armnetwork.IPAllocationTypeHypernet), - AllocationTags: map[string]*string{ - "VNetID": to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/virtualNetworks/HypernetVnet1"), - }, - Prefix: to.Ptr("3.2.5.0/24"), - }, - }, nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - res, err := poller.PollUntilDone(ctx, nil) - if err != nil { - log.Fatalf("failed to pull the result: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.IPAllocation = armnetwork.IPAllocation{ - // Name: to.Ptr("test-ipallocation"), - // Type: to.Ptr("Microsoft.Network/IpAllocations"), - // ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/IpAllocations/test-ipallocation"), - // Location: to.Ptr("centraluseuap"), - // Properties: &armnetwork.IPAllocationPropertiesFormat{ - // Type: to.Ptr(armnetwork.IPAllocationTypeHypernet), - // AllocationTags: map[string]*string{ - // "VNetID": to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/virtualNetworks/HypernetVnet1"), - // }, - // IpamAllocationID: to.Ptr("916d3b28-663f-448b-9abc-1bea9d5fed8f"), - // Prefix: to.Ptr("3.2.5.0/24"), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/4883fa5dbf6f2c9093fac8ce334547e9dfac68fa/specification/network/resource-manager/Microsoft.Network/stable/2024-03-01/examples/IpAllocationUpdateTags.json -func ExampleIPAllocationsClient_UpdateTags() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armnetwork.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewIPAllocationsClient().UpdateTags(ctx, "rg1", "test-ipallocation", armnetwork.TagsObject{ - Tags: map[string]*string{ - "tag1": to.Ptr("value1"), - "tag2": to.Ptr("value2"), - }, - }, nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.IPAllocation = armnetwork.IPAllocation{ - // Name: to.Ptr("test-ipallocation"), - // Type: to.Ptr("Microsoft.Network/IpAllocations"), - // ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/IpAllocations/test-ipallocation"), - // Location: to.Ptr("centraluseuap"), - // Tags: map[string]*string{ - // "tag1": to.Ptr("value1"), - // "tag2": to.Ptr("value2"), - // }, - // Properties: &armnetwork.IPAllocationPropertiesFormat{ - // Type: to.Ptr(armnetwork.IPAllocationTypeHypernet), - // AllocationTags: map[string]*string{ - // "VNetID": to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/virtualNetworks/HypernetVnet1"), - // }, - // IpamAllocationID: to.Ptr("916d3b28-663f-448b-9abc-1bea9d5fed8f"), - // Prefix: to.Ptr("3.2.5.0/24"), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/4883fa5dbf6f2c9093fac8ce334547e9dfac68fa/specification/network/resource-manager/Microsoft.Network/stable/2024-03-01/examples/IpAllocationList.json -func ExampleIPAllocationsClient_NewListPager() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armnetwork.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := clientFactory.NewIPAllocationsClient().NewListPager(nil) - for pager.More() { - page, err := pager.NextPage(ctx) - if err != nil { - log.Fatalf("failed to advance page: %v", err) - } - for _, v := range page.Value { - // You could use page here. We use blank identifier for just demo purposes. - _ = v - } - // If the HTTP response code is 200 as defined in example definition, your page structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // page.IPAllocationListResult = armnetwork.IPAllocationListResult{ - // Value: []*armnetwork.IPAllocation{ - // { - // Name: to.Ptr("test-ipallocation1"), - // Type: to.Ptr("Microsoft.Network/IpAllocations"), - // ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/IpAllocations/test-ipallocation1"), - // Location: to.Ptr("centraluseuap"), - // Properties: &armnetwork.IPAllocationPropertiesFormat{ - // Type: to.Ptr(armnetwork.IPAllocationTypeHypernet), - // AllocationTags: map[string]*string{ - // "VNetID": to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/virtualNetworks/HypernetVnet1"), - // }, - // IpamAllocationID: to.Ptr("916d3b28-663f-448b-9abc-1bea9d5fed8f"), - // Prefix: to.Ptr("3.2.5.0/24"), - // }, - // }, - // { - // Name: to.Ptr("test-ipallocation2"), - // Type: to.Ptr("Microsoft.Network/IpAllocations"), - // ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/IpAllocations/test-ipallocation2"), - // Location: to.Ptr("centraluseuap"), - // Properties: &armnetwork.IPAllocationPropertiesFormat{ - // Type: to.Ptr(armnetwork.IPAllocationTypeHypernet), - // AllocationTags: map[string]*string{ - // "VNetID": to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/virtualNetworks/HypernetVnet2"), - // }, - // IpamAllocationID: to.Ptr("57dc7256-2ff7-43f2-b9c8-85a70b5c6408"), - // Prefix: to.Ptr("3.2.6.0/24"), - // }, - // }}, - // } - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/4883fa5dbf6f2c9093fac8ce334547e9dfac68fa/specification/network/resource-manager/Microsoft.Network/stable/2024-03-01/examples/IpAllocationListByResourceGroup.json -func ExampleIPAllocationsClient_NewListByResourceGroupPager() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armnetwork.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := clientFactory.NewIPAllocationsClient().NewListByResourceGroupPager("rg1", nil) - for pager.More() { - page, err := pager.NextPage(ctx) - if err != nil { - log.Fatalf("failed to advance page: %v", err) - } - for _, v := range page.Value { - // You could use page here. We use blank identifier for just demo purposes. - _ = v - } - // If the HTTP response code is 200 as defined in example definition, your page structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // page.IPAllocationListResult = armnetwork.IPAllocationListResult{ - // Value: []*armnetwork.IPAllocation{ - // { - // Name: to.Ptr("test-ipallocation1"), - // Type: to.Ptr("Microsoft.Network/IpAllocations"), - // ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/IpAllocations/test-ipallocation1"), - // Location: to.Ptr("centraluseuap"), - // Properties: &armnetwork.IPAllocationPropertiesFormat{ - // Type: to.Ptr(armnetwork.IPAllocationTypeHypernet), - // AllocationTags: map[string]*string{ - // "VNetID": to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/virtualNetworks/HypernetVnet1"), - // }, - // IpamAllocationID: to.Ptr("916d3b28-663f-448b-9abc-1bea9d5fed8f"), - // Prefix: to.Ptr("3.2.5.0/24"), - // }, - // }, - // { - // Name: to.Ptr("test-ipallocation2"), - // Type: to.Ptr("Microsoft.Network/IpAllocations"), - // ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/IpAllocations/test-ipallocation2"), - // Location: to.Ptr("centraluseuap"), - // Properties: &armnetwork.IPAllocationPropertiesFormat{ - // Type: to.Ptr(armnetwork.IPAllocationTypeHypernet), - // AllocationTags: map[string]*string{ - // "VNetID": to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/virtualNetworks/HypernetVnet2"), - // }, - // IpamAllocationID: to.Ptr("57dc7256-2ff7-43f2-b9c8-85a70b5c6408"), - // Prefix: to.Ptr("3.2.6.0/24"), - // }, - // }}, - // } - } -} diff --git a/sdk/resourcemanager/network/armnetwork/ipgroups_client_example_test.go b/sdk/resourcemanager/network/armnetwork/ipgroups_client_example_test.go deleted file mode 100644 index b14a4e5cba74..000000000000 --- a/sdk/resourcemanager/network/armnetwork/ipgroups_client_example_test.go +++ /dev/null @@ -1,320 +0,0 @@ -//go:build go1.18 -// +build go1.18 - -// 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. -// DO NOT EDIT. - -package armnetwork_test - -import ( - "context" - "log" - - "github.com/Azure/azure-sdk-for-go/sdk/azcore/to" - "github.com/Azure/azure-sdk-for-go/sdk/azidentity" - "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/network/armnetwork/v6" -) - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/4883fa5dbf6f2c9093fac8ce334547e9dfac68fa/specification/network/resource-manager/Microsoft.Network/stable/2024-03-01/examples/IpGroupsGet.json -func ExampleIPGroupsClient_Get() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armnetwork.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewIPGroupsClient().Get(ctx, "myResourceGroup", "ipGroups1", &armnetwork.IPGroupsClientGetOptions{Expand: nil}) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.IPGroup = armnetwork.IPGroup{ - // Name: to.Ptr("ipGroups1"), - // Type: to.Ptr("Microsoft.Network/ipGroups"), - // ID: to.Ptr("/subscriptions/subId/providers/Microsoft.Network/resourceGroup/myResourceGroup/ipGroups/ipGroups1"), - // Location: to.Ptr("westcentralus"), - // Etag: to.Ptr("w/\\00000000-0000-0000-0000-000000000000\\"), - // Properties: &armnetwork.IPGroupPropertiesFormat{ - // FirewallPolicies: []*armnetwork.SubResource{ - // }, - // Firewalls: []*armnetwork.SubResource{ - // { - // ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/azureFirewalls/azurefirewall"), - // }}, - // IPAddresses: []*string{ - // to.Ptr("13.64.39.16/32"), - // to.Ptr("40.74.146.80/31"), - // to.Ptr("40.74.147.32/28")}, - // ProvisioningState: to.Ptr(armnetwork.ProvisioningStateSucceeded), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/4883fa5dbf6f2c9093fac8ce334547e9dfac68fa/specification/network/resource-manager/Microsoft.Network/stable/2024-03-01/examples/IpGroupsCreate.json -func ExampleIPGroupsClient_BeginCreateOrUpdate() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armnetwork.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewIPGroupsClient().BeginCreateOrUpdate(ctx, "myResourceGroup", "ipGroups1", armnetwork.IPGroup{ - Location: to.Ptr("West US"), - Tags: map[string]*string{ - "key1": to.Ptr("value1"), - }, - Properties: &armnetwork.IPGroupPropertiesFormat{ - IPAddresses: []*string{ - to.Ptr("13.64.39.16/32"), - to.Ptr("40.74.146.80/31"), - to.Ptr("40.74.147.32/28")}, - }, - }, nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - res, err := poller.PollUntilDone(ctx, nil) - if err != nil { - log.Fatalf("failed to pull the result: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.IPGroup = armnetwork.IPGroup{ - // Name: to.Ptr("ipGroups1"), - // Type: to.Ptr("Microsoft.Network/ipGroups"), - // ID: to.Ptr("/subscriptions/subId/providers/Microsoft.Network/resourceGroup/myResourceGroup/ipGroups/ipGroups1"), - // Location: to.Ptr("westcentralus"), - // Etag: to.Ptr("w/\\00000000-0000-0000-0000-000000000000\\"), - // Properties: &armnetwork.IPGroupPropertiesFormat{ - // FirewallPolicies: []*armnetwork.SubResource{ - // }, - // Firewalls: []*armnetwork.SubResource{ - // { - // ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/azureFirewalls/azurefirewall"), - // }}, - // IPAddresses: []*string{ - // to.Ptr("13.64.39.16/32"), - // to.Ptr("40.74.146.80/31"), - // to.Ptr("40.74.147.32/28")}, - // ProvisioningState: to.Ptr(armnetwork.ProvisioningStateSucceeded), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/4883fa5dbf6f2c9093fac8ce334547e9dfac68fa/specification/network/resource-manager/Microsoft.Network/stable/2024-03-01/examples/IpGroupsUpdateTags.json -func ExampleIPGroupsClient_UpdateGroups() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armnetwork.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewIPGroupsClient().UpdateGroups(ctx, "myResourceGroup", "ipGroups1", armnetwork.TagsObject{ - Tags: map[string]*string{ - "key1": to.Ptr("value1"), - "key2": to.Ptr("value2"), - }, - }, nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.IPGroup = armnetwork.IPGroup{ - // Name: to.Ptr("ipGroups1"), - // Type: to.Ptr("Microsoft.Network/ipGroups"), - // ID: to.Ptr("/subscriptions/subId/providers/Microsoft.Network/resourceGroup/myResourceGroup/ipGroups/ipGroups1"), - // Location: to.Ptr("westcentralus"), - // Tags: map[string]*string{ - // "key1": to.Ptr("value1"), - // "key2": to.Ptr("value2"), - // }, - // Etag: to.Ptr("w/\\00000000-0000-0000-0000-000000000000\\"), - // Properties: &armnetwork.IPGroupPropertiesFormat{ - // FirewallPolicies: []*armnetwork.SubResource{ - // }, - // Firewalls: []*armnetwork.SubResource{ - // { - // ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/azureFirewalls/azurefirewall"), - // }}, - // IPAddresses: []*string{ - // to.Ptr("13.64.39.16/32"), - // to.Ptr("40.74.146.80/31"), - // to.Ptr("40.74.147.32/28")}, - // ProvisioningState: to.Ptr(armnetwork.ProvisioningStateSucceeded), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/4883fa5dbf6f2c9093fac8ce334547e9dfac68fa/specification/network/resource-manager/Microsoft.Network/stable/2024-03-01/examples/IpGroupsDelete.json -func ExampleIPGroupsClient_BeginDelete() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armnetwork.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewIPGroupsClient().BeginDelete(ctx, "myResourceGroup", "ipGroups1", nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - _, err = poller.PollUntilDone(ctx, nil) - if err != nil { - log.Fatalf("failed to pull the result: %v", err) - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/4883fa5dbf6f2c9093fac8ce334547e9dfac68fa/specification/network/resource-manager/Microsoft.Network/stable/2024-03-01/examples/IpGroupsListByResourceGroup.json -func ExampleIPGroupsClient_NewListByResourceGroupPager() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armnetwork.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := clientFactory.NewIPGroupsClient().NewListByResourceGroupPager("myResourceGroup", nil) - for pager.More() { - page, err := pager.NextPage(ctx) - if err != nil { - log.Fatalf("failed to advance page: %v", err) - } - for _, v := range page.Value { - // You could use page here. We use blank identifier for just demo purposes. - _ = v - } - // If the HTTP response code is 200 as defined in example definition, your page structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // page.IPGroupListResult = armnetwork.IPGroupListResult{ - // Value: []*armnetwork.IPGroup{ - // { - // Name: to.Ptr("ipGroups1"), - // Type: to.Ptr("Microsoft.Network/ipGroups"), - // ID: to.Ptr("/subscriptions/subId/providers/Microsoft.Network/resourceGroup/myResourceGroup/ipGroups"), - // Location: to.Ptr("westcentralus"), - // Etag: to.Ptr("w/\\00000000-0000-0000-0000-000000000000\\"), - // Properties: &armnetwork.IPGroupPropertiesFormat{ - // FirewallPolicies: []*armnetwork.SubResource{ - // }, - // Firewalls: []*armnetwork.SubResource{ - // { - // ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/azureFirewalls/azurefirewall"), - // }}, - // IPAddresses: []*string{ - // to.Ptr("13.64.39.16/32"), - // to.Ptr("40.74.146.80/31"), - // to.Ptr("40.74.147.32/28")}, - // ProvisioningState: to.Ptr(armnetwork.ProvisioningStateSucceeded), - // }, - // }, - // { - // Name: to.Ptr("ipGroups2"), - // Type: to.Ptr("Microsoft.Network/ipGroups"), - // ID: to.Ptr("/subscriptions/subId/providers/Microsoft.Network/resourceGroup/myResourceGroup/ipGroups"), - // Location: to.Ptr("centralus"), - // Etag: to.Ptr("w/\\00000000-0000-0000-0000-000000000000\\"), - // Properties: &armnetwork.IPGroupPropertiesFormat{ - // FirewallPolicies: []*armnetwork.SubResource{ - // }, - // Firewalls: []*armnetwork.SubResource{ - // { - // ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/azureFirewalls/azurefirewall"), - // }}, - // IPAddresses: []*string{ - // to.Ptr("14.64.39.16/32"), - // to.Ptr("41.74.146.80/31"), - // to.Ptr("42.74.147.32/28")}, - // ProvisioningState: to.Ptr(armnetwork.ProvisioningStateSucceeded), - // }, - // }}, - // } - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/4883fa5dbf6f2c9093fac8ce334547e9dfac68fa/specification/network/resource-manager/Microsoft.Network/stable/2024-03-01/examples/IpGroupsListBySubscription.json -func ExampleIPGroupsClient_NewListPager() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armnetwork.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := clientFactory.NewIPGroupsClient().NewListPager(nil) - for pager.More() { - page, err := pager.NextPage(ctx) - if err != nil { - log.Fatalf("failed to advance page: %v", err) - } - for _, v := range page.Value { - // You could use page here. We use blank identifier for just demo purposes. - _ = v - } - // If the HTTP response code is 200 as defined in example definition, your page structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // page.IPGroupListResult = armnetwork.IPGroupListResult{ - // Value: []*armnetwork.IPGroup{ - // { - // Name: to.Ptr("iptag1"), - // Type: to.Ptr("Microsoft.Network/ipGroups"), - // ID: to.Ptr("/subscriptions/subId/providers/Microsoft.Network/resourceGroup/myResourceGroup1/ipGroups"), - // Location: to.Ptr("westcentralus"), - // Etag: to.Ptr("w/\\00000000-0000-0000-0000-000000000000\\"), - // Properties: &armnetwork.IPGroupPropertiesFormat{ - // FirewallPolicies: []*armnetwork.SubResource{ - // }, - // Firewalls: []*armnetwork.SubResource{ - // { - // ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/azureFirewalls/azurefirewall"), - // }}, - // IPAddresses: []*string{ - // to.Ptr("13.64.39.16/32"), - // to.Ptr("40.74.146.80/31"), - // to.Ptr("40.74.147.32/28")}, - // ProvisioningState: to.Ptr(armnetwork.ProvisioningStateSucceeded), - // }, - // }, - // { - // Name: to.Ptr("iptag2"), - // Type: to.Ptr("Microsoft.Network/ipGroups"), - // ID: to.Ptr("/subscriptions/subId/providers/Microsoft.Network/resourceGroup/myResourceGroup2/ipGroups"), - // Location: to.Ptr("centralus"), - // Etag: to.Ptr("w/\\00000000-0000-0000-0000-000000000000\\"), - // Properties: &armnetwork.IPGroupPropertiesFormat{ - // FirewallPolicies: []*armnetwork.SubResource{ - // }, - // Firewalls: []*armnetwork.SubResource{ - // { - // ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/azureFirewalls/azurefirewall"), - // }}, - // IPAddresses: []*string{ - // to.Ptr("14.64.39.16/32"), - // to.Ptr("41.74.146.80/31"), - // to.Ptr("42.74.147.32/28")}, - // ProvisioningState: to.Ptr(armnetwork.ProvisioningStateSucceeded), - // }, - // }}, - // } - } -} diff --git a/sdk/resourcemanager/network/armnetwork/loadbalancerbackendaddresspools_client_example_test.go b/sdk/resourcemanager/network/armnetwork/loadbalancerbackendaddresspools_client_example_test.go deleted file mode 100644 index 2d536ce13c66..000000000000 --- a/sdk/resourcemanager/network/armnetwork/loadbalancerbackendaddresspools_client_example_test.go +++ /dev/null @@ -1,312 +0,0 @@ -//go:build go1.18 -// +build go1.18 - -// 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. -// DO NOT EDIT. - -package armnetwork_test - -import ( - "context" - "log" - - "github.com/Azure/azure-sdk-for-go/sdk/azcore/to" - "github.com/Azure/azure-sdk-for-go/sdk/azidentity" - "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/network/armnetwork/v6" -) - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/4883fa5dbf6f2c9093fac8ce334547e9dfac68fa/specification/network/resource-manager/Microsoft.Network/stable/2024-03-01/examples/LBBackendAddressPoolListWithBackendAddressesPoolType.json -func ExampleLoadBalancerBackendAddressPoolsClient_NewListPager_loadBalancerWithBackendAddressPoolContainingBackendAddresses() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armnetwork.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := clientFactory.NewLoadBalancerBackendAddressPoolsClient().NewListPager("testrg", "lb", nil) - for pager.More() { - page, err := pager.NextPage(ctx) - if err != nil { - log.Fatalf("failed to advance page: %v", err) - } - for _, v := range page.Value { - // You could use page here. We use blank identifier for just demo purposes. - _ = v - } - // If the HTTP response code is 200 as defined in example definition, your page structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // page.LoadBalancerBackendAddressPoolListResult = armnetwork.LoadBalancerBackendAddressPoolListResult{ - // Value: []*armnetwork.BackendAddressPool{ - // { - // ID: to.Ptr("/subscriptions/subid/resourceGroups/testrg/providers/Microsoft.Network/loadBalancers/lb/backendAddressPools/backend"), - // Name: to.Ptr("backend"), - // Type: to.Ptr("Microsoft.Network/loadBalancers/backendAddressPools"), - // Etag: to.Ptr("W/\"00000000-0000-0000-0000-000000000000\""), - // Properties: &armnetwork.BackendAddressPoolPropertiesFormat{ - // LoadBalancerBackendAddresses: []*armnetwork.LoadBalancerBackendAddress{ - // { - // Name: to.Ptr("address1"), - // Properties: &armnetwork.LoadBalancerBackendAddressPropertiesFormat{ - // IPAddress: to.Ptr("10.0.0.4"), - // VirtualNetwork: &armnetwork.SubResource{ - // ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/virtualNetworks/vnetlb"), - // }, - // }, - // }, - // { - // Name: to.Ptr("address2"), - // Properties: &armnetwork.LoadBalancerBackendAddressPropertiesFormat{ - // IPAddress: to.Ptr("10.0.0.5"), - // VirtualNetwork: &armnetwork.SubResource{ - // ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/virtualNetworks/vnetlb"), - // }, - // }, - // }}, - // LoadBalancingRules: []*armnetwork.SubResource{ - // { - // ID: to.Ptr("/subscriptions/subid/resourceGroups/testrg/providers/Microsoft.Network/loadBalancers/lb/loadBalancingRules/rulelb"), - // }}, - // ProvisioningState: to.Ptr(armnetwork.ProvisioningStateSucceeded), - // }, - // }}, - // } - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/4883fa5dbf6f2c9093fac8ce334547e9dfac68fa/specification/network/resource-manager/Microsoft.Network/stable/2024-03-01/examples/LoadBalancerBackendAddressPoolList.json -func ExampleLoadBalancerBackendAddressPoolsClient_NewListPager_loadBalancerBackendAddressPoolList() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armnetwork.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := clientFactory.NewLoadBalancerBackendAddressPoolsClient().NewListPager("testrg", "lb", nil) - for pager.More() { - page, err := pager.NextPage(ctx) - if err != nil { - log.Fatalf("failed to advance page: %v", err) - } - for _, v := range page.Value { - // You could use page here. We use blank identifier for just demo purposes. - _ = v - } - // If the HTTP response code is 200 as defined in example definition, your page structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // page.LoadBalancerBackendAddressPoolListResult = armnetwork.LoadBalancerBackendAddressPoolListResult{ - // Value: []*armnetwork.BackendAddressPool{ - // { - // ID: to.Ptr("/subscriptions/subid/resourceGroups/testrg/providers/Microsoft.Network/loadBalancers/lb/backendAddressPools/backend"), - // Name: to.Ptr("backend"), - // Type: to.Ptr("Microsoft.Network/loadBalancers/backendAddressPools"), - // Etag: to.Ptr("W/\"00000000-0000-0000-0000-000000000000\""), - // Properties: &armnetwork.BackendAddressPoolPropertiesFormat{ - // BackendIPConfigurations: []*armnetwork.InterfaceIPConfiguration{ - // { - // ID: to.Ptr("/subscriptions/subid/resourceGroups/testrg/providers/Microsoft.Network/networkInterfaces/nic/ipConfigurations/default-ip-config"), - // }}, - // LoadBalancingRules: []*armnetwork.SubResource{ - // { - // ID: to.Ptr("/subscriptions/subid/resourceGroups/testrg/providers/Microsoft.Network/loadBalancers/lb/loadBalancingRules/rulelb"), - // }}, - // ProvisioningState: to.Ptr(armnetwork.ProvisioningStateSucceeded), - // }, - // }}, - // } - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/4883fa5dbf6f2c9093fac8ce334547e9dfac68fa/specification/network/resource-manager/Microsoft.Network/stable/2024-03-01/examples/LBBackendAddressPoolWithBackendAddressesGet.json -func ExampleLoadBalancerBackendAddressPoolsClient_Get_loadBalancerWithBackendAddressPoolWithBackendAddresses() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armnetwork.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewLoadBalancerBackendAddressPoolsClient().Get(ctx, "testrg", "lb", "backend", nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.BackendAddressPool = armnetwork.BackendAddressPool{ - // ID: to.Ptr("/subscriptions/subid/resourceGroups/testrg/providers/Microsoft.Network/loadBalancers/lb/backendAddressPools/backend"), - // Name: to.Ptr("backend"), - // Type: to.Ptr("Microsoft.Network/loadBalancers/backendAddressPools"), - // Etag: to.Ptr("W/\"00000000-0000-0000-0000-000000000000\""), - // Properties: &armnetwork.BackendAddressPoolPropertiesFormat{ - // LoadBalancerBackendAddresses: []*armnetwork.LoadBalancerBackendAddress{ - // { - // Name: to.Ptr("address1"), - // Properties: &armnetwork.LoadBalancerBackendAddressPropertiesFormat{ - // IPAddress: to.Ptr("10.0.0.4"), - // VirtualNetwork: &armnetwork.SubResource{ - // ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/virtualNetworks/vnetlb"), - // }, - // }, - // }, - // { - // Name: to.Ptr("address2"), - // Properties: &armnetwork.LoadBalancerBackendAddressPropertiesFormat{ - // IPAddress: to.Ptr("10.0.0.5"), - // VirtualNetwork: &armnetwork.SubResource{ - // ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/virtualNetworks/vnetlb"), - // }, - // }, - // }}, - // LoadBalancingRules: []*armnetwork.SubResource{ - // { - // ID: to.Ptr("/subscriptions/subid/resourceGroups/testrg/providers/Microsoft.Network/loadBalancers/lb/loadBalancingRules/rulelb"), - // }}, - // ProvisioningState: to.Ptr(armnetwork.ProvisioningStateSucceeded), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/4883fa5dbf6f2c9093fac8ce334547e9dfac68fa/specification/network/resource-manager/Microsoft.Network/stable/2024-03-01/examples/LoadBalancerBackendAddressPoolGet.json -func ExampleLoadBalancerBackendAddressPoolsClient_Get_loadBalancerBackendAddressPoolGet() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armnetwork.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewLoadBalancerBackendAddressPoolsClient().Get(ctx, "testrg", "lb", "backend", nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.BackendAddressPool = armnetwork.BackendAddressPool{ - // ID: to.Ptr("/subscriptions/subid/resourceGroups/testrg/providers/Microsoft.Network/loadBalancers/lb/backendAddressPools/backend"), - // Name: to.Ptr("backend"), - // Type: to.Ptr("Microsoft.Network/loadBalancers/backendAddressPools"), - // Etag: to.Ptr("W/\"00000000-0000-0000-0000-000000000000\""), - // Properties: &armnetwork.BackendAddressPoolPropertiesFormat{ - // BackendIPConfigurations: []*armnetwork.InterfaceIPConfiguration{ - // { - // ID: to.Ptr("/subscriptions/subid/resourceGroups/testrg/providers/Microsoft.Network/networkInterfaces/nic/ipConfigurations/default-ip-config"), - // }}, - // LoadBalancingRules: []*armnetwork.SubResource{ - // { - // ID: to.Ptr("/subscriptions/subid/resourceGroups/testrg/providers/Microsoft.Network/loadBalancers/lb/loadBalancingRules/rulelb"), - // }}, - // ProvisioningState: to.Ptr(armnetwork.ProvisioningStateSucceeded), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/4883fa5dbf6f2c9093fac8ce334547e9dfac68fa/specification/network/resource-manager/Microsoft.Network/stable/2024-03-01/examples/LBBackendAddressPoolWithBackendAddressesPut.json -func ExampleLoadBalancerBackendAddressPoolsClient_BeginCreateOrUpdate() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armnetwork.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewLoadBalancerBackendAddressPoolsClient().BeginCreateOrUpdate(ctx, "testrg", "lb", "backend", armnetwork.BackendAddressPool{ - Properties: &armnetwork.BackendAddressPoolPropertiesFormat{ - LoadBalancerBackendAddresses: []*armnetwork.LoadBalancerBackendAddress{ - { - Name: to.Ptr("address1"), - Properties: &armnetwork.LoadBalancerBackendAddressPropertiesFormat{ - IPAddress: to.Ptr("10.0.0.4"), - VirtualNetwork: &armnetwork.SubResource{ - ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/virtualNetworks/vnetlb"), - }, - }, - }, - { - Name: to.Ptr("address2"), - Properties: &armnetwork.LoadBalancerBackendAddressPropertiesFormat{ - IPAddress: to.Ptr("10.0.0.5"), - VirtualNetwork: &armnetwork.SubResource{ - ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/virtualNetworks/vnetlb"), - }, - }, - }}, - }, - }, nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - res, err := poller.PollUntilDone(ctx, nil) - if err != nil { - log.Fatalf("failed to pull the result: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.BackendAddressPool = armnetwork.BackendAddressPool{ - // ID: to.Ptr("/subscriptions/subid/resourceGroups/testrg/providers/Microsoft.Network/loadBalancers/lb/backendAddressPools/backend"), - // Name: to.Ptr("backend"), - // Type: to.Ptr("Microsoft.Network/loadBalancers/backendAddressPools"), - // Etag: to.Ptr("W/\"00000000-0000-0000-0000-000000000000\""), - // Properties: &armnetwork.BackendAddressPoolPropertiesFormat{ - // LoadBalancerBackendAddresses: []*armnetwork.LoadBalancerBackendAddress{ - // { - // Name: to.Ptr("address1"), - // Properties: &armnetwork.LoadBalancerBackendAddressPropertiesFormat{ - // IPAddress: to.Ptr("10.0.0.4"), - // VirtualNetwork: &armnetwork.SubResource{ - // ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/virtualNetworks/vnetlb"), - // }, - // }, - // }, - // { - // Name: to.Ptr("address2"), - // Properties: &armnetwork.LoadBalancerBackendAddressPropertiesFormat{ - // IPAddress: to.Ptr("10.0.0.5"), - // VirtualNetwork: &armnetwork.SubResource{ - // ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/virtualNetworks/vnetlb"), - // }, - // }, - // }}, - // LoadBalancingRules: []*armnetwork.SubResource{ - // { - // ID: to.Ptr("/subscriptions/subid/resourceGroups/testrg/providers/Microsoft.Network/loadBalancers/lb/loadBalancingRules/rulelb"), - // }}, - // ProvisioningState: to.Ptr(armnetwork.ProvisioningStateSucceeded), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/4883fa5dbf6f2c9093fac8ce334547e9dfac68fa/specification/network/resource-manager/Microsoft.Network/stable/2024-03-01/examples/LoadBalancerBackendAddressPoolDelete.json -func ExampleLoadBalancerBackendAddressPoolsClient_BeginDelete() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armnetwork.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewLoadBalancerBackendAddressPoolsClient().BeginDelete(ctx, "testrg", "lb", "backend", nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - _, err = poller.PollUntilDone(ctx, nil) - if err != nil { - log.Fatalf("failed to pull the result: %v", err) - } -} diff --git a/sdk/resourcemanager/network/armnetwork/loadbalancerfrontendipconfigurations_client_example_test.go b/sdk/resourcemanager/network/armnetwork/loadbalancerfrontendipconfigurations_client_example_test.go deleted file mode 100644 index 57988c5f33ad..000000000000 --- a/sdk/resourcemanager/network/armnetwork/loadbalancerfrontendipconfigurations_client_example_test.go +++ /dev/null @@ -1,112 +0,0 @@ -//go:build go1.18 -// +build go1.18 - -// 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. -// DO NOT EDIT. - -package armnetwork_test - -import ( - "context" - "log" - - "github.com/Azure/azure-sdk-for-go/sdk/azidentity" - "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/network/armnetwork/v6" -) - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/4883fa5dbf6f2c9093fac8ce334547e9dfac68fa/specification/network/resource-manager/Microsoft.Network/stable/2024-03-01/examples/LoadBalancerFrontendIPConfigurationList.json -func ExampleLoadBalancerFrontendIPConfigurationsClient_NewListPager() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armnetwork.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := clientFactory.NewLoadBalancerFrontendIPConfigurationsClient().NewListPager("testrg", "lb", nil) - for pager.More() { - page, err := pager.NextPage(ctx) - if err != nil { - log.Fatalf("failed to advance page: %v", err) - } - for _, v := range page.Value { - // You could use page here. We use blank identifier for just demo purposes. - _ = v - } - // If the HTTP response code is 200 as defined in example definition, your page structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // page.LoadBalancerFrontendIPConfigurationListResult = armnetwork.LoadBalancerFrontendIPConfigurationListResult{ - // Value: []*armnetwork.FrontendIPConfiguration{ - // { - // ID: to.Ptr("/subscriptions/subid/resourceGroups/testrg/providers/Microsoft.Network/loadBalancers/lb/frontendIPConfigurations/frontend"), - // Name: to.Ptr("frontend"), - // Type: to.Ptr("Microsoft.Network/loadBalancers/frontendIPConfigurations"), - // Etag: to.Ptr("W/\"00000000-0000-0000-0000-000000000000\""), - // Properties: &armnetwork.FrontendIPConfigurationPropertiesFormat{ - // InboundNatRules: []*armnetwork.SubResource{ - // { - // ID: to.Ptr("/subscriptions/subid/resourceGroups/testrg/providers/Microsoft.Network/loadBalancers/lb/inboundNatRules/inrlb"), - // }}, - // LoadBalancingRules: []*armnetwork.SubResource{ - // { - // ID: to.Ptr("/subscriptions/subid/resourceGroups/testrg/providers/Microsoft.Network/loadBalancers/lb/loadBalancingRules/rulelb"), - // }}, - // PrivateIPAddress: to.Ptr("10.0.1.4"), - // PrivateIPAddressVersion: to.Ptr(armnetwork.IPVersionIPv4), - // PrivateIPAllocationMethod: to.Ptr(armnetwork.IPAllocationMethodDynamic), - // ProvisioningState: to.Ptr(armnetwork.ProvisioningStateSucceeded), - // Subnet: &armnetwork.Subnet{ - // ID: to.Ptr("/subscriptions/subid/resourceGroups/testrg/providers/Microsoft.Network/virtualNetworks/vnetlb/subnets/subnetlb"), - // }, - // }, - // }}, - // } - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/4883fa5dbf6f2c9093fac8ce334547e9dfac68fa/specification/network/resource-manager/Microsoft.Network/stable/2024-03-01/examples/LoadBalancerFrontendIPConfigurationGet.json -func ExampleLoadBalancerFrontendIPConfigurationsClient_Get() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armnetwork.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewLoadBalancerFrontendIPConfigurationsClient().Get(ctx, "testrg", "lb", "frontend", nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.FrontendIPConfiguration = armnetwork.FrontendIPConfiguration{ - // ID: to.Ptr("/subscriptions/subid/resourceGroups/testrg/providers/Microsoft.Network/loadBalancers/lb/frontendIPConfigurations/frontend"), - // Name: to.Ptr("frontend"), - // Type: to.Ptr("Microsoft.Network/loadBalancers/frontendIPConfigurations"), - // Etag: to.Ptr("W/\"00000000-0000-0000-0000-000000000000\""), - // Properties: &armnetwork.FrontendIPConfigurationPropertiesFormat{ - // InboundNatRules: []*armnetwork.SubResource{ - // { - // ID: to.Ptr("/subscriptions/subid/resourceGroups/testrg/providers/Microsoft.Network/loadBalancers/lb/inboundNatRules/inrlb"), - // }}, - // LoadBalancingRules: []*armnetwork.SubResource{ - // { - // ID: to.Ptr("/subscriptions/subid/resourceGroups/testrg/providers/Microsoft.Network/loadBalancers/lb/loadBalancingRules/rulelb"), - // }}, - // PrivateIPAddress: to.Ptr("10.0.1.4"), - // PrivateIPAddressVersion: to.Ptr(armnetwork.IPVersionIPv4), - // PrivateIPAllocationMethod: to.Ptr(armnetwork.IPAllocationMethodDynamic), - // ProvisioningState: to.Ptr(armnetwork.ProvisioningStateSucceeded), - // Subnet: &armnetwork.Subnet{ - // ID: to.Ptr("/subscriptions/subid/resourceGroups/testrg/providers/Microsoft.Network/virtualNetworks/vnetlb/subnets/subnetlb"), - // }, - // }, - // } -} diff --git a/sdk/resourcemanager/network/armnetwork/loadbalancerloadbalancingrules_client_example_test.go b/sdk/resourcemanager/network/armnetwork/loadbalancerloadbalancingrules_client_example_test.go deleted file mode 100644 index ad95cd127c02..000000000000 --- a/sdk/resourcemanager/network/armnetwork/loadbalancerloadbalancingrules_client_example_test.go +++ /dev/null @@ -1,116 +0,0 @@ -//go:build go1.18 -// +build go1.18 - -// 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. -// DO NOT EDIT. - -package armnetwork_test - -import ( - "context" - "log" - - "github.com/Azure/azure-sdk-for-go/sdk/azidentity" - "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/network/armnetwork/v6" -) - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/4883fa5dbf6f2c9093fac8ce334547e9dfac68fa/specification/network/resource-manager/Microsoft.Network/stable/2024-03-01/examples/LoadBalancerLoadBalancingRuleList.json -func ExampleLoadBalancerLoadBalancingRulesClient_NewListPager() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armnetwork.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := clientFactory.NewLoadBalancerLoadBalancingRulesClient().NewListPager("testrg", "lb1", nil) - for pager.More() { - page, err := pager.NextPage(ctx) - if err != nil { - log.Fatalf("failed to advance page: %v", err) - } - for _, v := range page.Value { - // You could use page here. We use blank identifier for just demo purposes. - _ = v - } - // If the HTTP response code is 200 as defined in example definition, your page structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // page.LoadBalancerLoadBalancingRuleListResult = armnetwork.LoadBalancerLoadBalancingRuleListResult{ - // Value: []*armnetwork.LoadBalancingRule{ - // { - // ID: to.Ptr("/subscriptions/subid/resourceGroups/testrg/providers/Microsoft.Network/loadBalancers/lb1/loadBalancingRules/rule1"), - // Name: to.Ptr("rule1"), - // Type: to.Ptr("Microsoft.Network/loadBalancers/loadBalancingRules"), - // Etag: to.Ptr("W/\"00000000-0000-0000-0000-000000000000\""), - // Properties: &armnetwork.LoadBalancingRulePropertiesFormat{ - // BackendAddressPool: &armnetwork.SubResource{ - // ID: to.Ptr("/subscriptions/subid/resourceGroups/testrg/providers/Microsoft.Network/loadBalancers/lb1/backendAddressPools/bepool1"), - // }, - // BackendPort: to.Ptr[int32](80), - // EnableFloatingIP: to.Ptr(false), - // EnableTCPReset: to.Ptr(true), - // FrontendIPConfiguration: &armnetwork.SubResource{ - // ID: to.Ptr("/subscriptions/subid/resourceGroups/testrg/providers/Microsoft.Network/loadBalancers/lb1/frontendIPConfigurations/lbfrontend"), - // }, - // FrontendPort: to.Ptr[int32](80), - // IdleTimeoutInMinutes: to.Ptr[int32](15), - // LoadDistribution: to.Ptr(armnetwork.LoadDistributionDefault), - // Probe: &armnetwork.SubResource{ - // ID: to.Ptr("/subscriptions/subid/resourceGroups/testrg/providers/Microsoft.Network/loadBalancers/lb1/probes/probe1"), - // }, - // ProvisioningState: to.Ptr(armnetwork.ProvisioningStateSucceeded), - // Protocol: to.Ptr(armnetwork.TransportProtocolTCP), - // }, - // }}, - // } - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/4883fa5dbf6f2c9093fac8ce334547e9dfac68fa/specification/network/resource-manager/Microsoft.Network/stable/2024-03-01/examples/LoadBalancerLoadBalancingRuleGet.json -func ExampleLoadBalancerLoadBalancingRulesClient_Get() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armnetwork.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewLoadBalancerLoadBalancingRulesClient().Get(ctx, "testrg", "lb1", "rule1", nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.LoadBalancingRule = armnetwork.LoadBalancingRule{ - // ID: to.Ptr("/subscriptions/subid/resourceGroups/testrg/providers/Microsoft.Network/loadBalancers/lb1/loadBalancingRules/rule1"), - // Name: to.Ptr("rule1"), - // Type: to.Ptr("Microsoft.Network/loadBalancers/loadBalancingRules"), - // Etag: to.Ptr("W/\"00000000-0000-0000-0000-000000000000\""), - // Properties: &armnetwork.LoadBalancingRulePropertiesFormat{ - // BackendAddressPool: &armnetwork.SubResource{ - // ID: to.Ptr("/subscriptions/subid/resourceGroups/testrg/providers/Microsoft.Network/loadBalancers/lb1/backendAddressPools/bepool1"), - // }, - // BackendPort: to.Ptr[int32](80), - // EnableFloatingIP: to.Ptr(false), - // EnableTCPReset: to.Ptr(true), - // FrontendIPConfiguration: &armnetwork.SubResource{ - // ID: to.Ptr("/subscriptions/subid/resourceGroups/testrg/providers/Microsoft.Network/loadBalancers/lb1/frontendIPConfigurations/lbfrontend"), - // }, - // FrontendPort: to.Ptr[int32](80), - // IdleTimeoutInMinutes: to.Ptr[int32](15), - // LoadDistribution: to.Ptr(armnetwork.LoadDistributionDefault), - // Probe: &armnetwork.SubResource{ - // ID: to.Ptr("/subscriptions/subid/resourceGroups/testrg/providers/Microsoft.Network/loadBalancers/lb1/probes/probe1"), - // }, - // ProvisioningState: to.Ptr(armnetwork.ProvisioningStateSucceeded), - // Protocol: to.Ptr(armnetwork.TransportProtocolTCP), - // }, - // } -} diff --git a/sdk/resourcemanager/network/armnetwork/loadbalancernetworkinterfaces_client_example_test.go b/sdk/resourcemanager/network/armnetwork/loadbalancernetworkinterfaces_client_example_test.go deleted file mode 100644 index 50a30fbab2b2..000000000000 --- a/sdk/resourcemanager/network/armnetwork/loadbalancernetworkinterfaces_client_example_test.go +++ /dev/null @@ -1,210 +0,0 @@ -//go:build go1.18 -// +build go1.18 - -// 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. -// DO NOT EDIT. - -package armnetwork_test - -import ( - "context" - "log" - - "github.com/Azure/azure-sdk-for-go/sdk/azidentity" - "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/network/armnetwork/v6" -) - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/4883fa5dbf6f2c9093fac8ce334547e9dfac68fa/specification/network/resource-manager/Microsoft.Network/stable/2024-03-01/examples/LoadBalancerNetworkInterfaceListSimple.json -func ExampleLoadBalancerNetworkInterfacesClient_NewListPager_loadBalancerNetworkInterfaceListSimple() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armnetwork.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := clientFactory.NewLoadBalancerNetworkInterfacesClient().NewListPager("testrg", "lb", nil) - for pager.More() { - page, err := pager.NextPage(ctx) - if err != nil { - log.Fatalf("failed to advance page: %v", err) - } - for _, v := range page.Value { - // You could use page here. We use blank identifier for just demo purposes. - _ = v - } - // If the HTTP response code is 200 as defined in example definition, your page structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // page.InterfaceListResult = armnetwork.InterfaceListResult{ - // Value: []*armnetwork.Interface{ - // { - // Name: to.Ptr("mynic"), - // Type: to.Ptr("Microsoft.Network/networkInterfaces"), - // ID: to.Ptr("/subscriptions/subid/resourceGroups/testrg/providers/Microsoft.Network/networkInterfaces/mynic"), - // Location: to.Ptr("westus"), - // Etag: to.Ptr("W/\\\"00000000-0000-0000-0000-000000000000\\\""), - // Properties: &armnetwork.InterfacePropertiesFormat{ - // DNSSettings: &armnetwork.InterfaceDNSSettings{ - // AppliedDNSServers: []*string{ - // }, - // DNSServers: []*string{ - // }, - // }, - // EnableAcceleratedNetworking: to.Ptr(false), - // EnableIPForwarding: to.Ptr(false), - // IPConfigurations: []*armnetwork.InterfaceIPConfiguration{ - // { - // ID: to.Ptr("/subscriptions/subid/resourceGroups/testrg/providers/Microsoft.Network/networkInterfaces/mynic/ipConfigurations/ipconfig1"), - // Name: to.Ptr("ipconfig1"), - // Etag: to.Ptr("W/\\\"00000000-0000-0000-0000-000000000000\\\""), - // Properties: &armnetwork.InterfaceIPConfigurationPropertiesFormat{ - // LoadBalancerBackendAddressPools: []*armnetwork.BackendAddressPool{ - // { - // ID: to.Ptr("/subscriptions/subid/resourceGroups/testrg/providers/Microsoft.Network/loadBalancers/lb/backendAddressPools/bepool1"), - // }}, - // LoadBalancerInboundNatRules: []*armnetwork.InboundNatRule{ - // { - // ID: to.Ptr("/subscriptions/subid/resourceGroups/testrg/providers/Microsoft.Network/loadBalancers/lb/inboundNatRules/inbound1"), - // }}, - // PrivateIPAddress: to.Ptr("10.0.1.4"), - // PrivateIPAddressVersion: to.Ptr(armnetwork.IPVersionIPv4), - // PrivateIPAllocationMethod: to.Ptr(armnetwork.IPAllocationMethodDynamic), - // ProvisioningState: to.Ptr(armnetwork.ProvisioningStateSucceeded), - // Subnet: &armnetwork.Subnet{ - // ID: to.Ptr("/subscriptions/subid/resourceGroups/testrg/providers/Microsoft.Network/virtualNetworks/myVirtualNetwork/subnets/frontendSubnet"), - // }, - // }, - // }}, - // ProvisioningState: to.Ptr(armnetwork.ProvisioningStateSucceeded), - // ResourceGUID: to.Ptr("00000000-0000-0000-0000-000000000000"), - // }, - // }}, - // } - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/4883fa5dbf6f2c9093fac8ce334547e9dfac68fa/specification/network/resource-manager/Microsoft.Network/stable/2024-03-01/examples/LoadBalancerNetworkInterfaceListVmss.json -func ExampleLoadBalancerNetworkInterfacesClient_NewListPager_loadBalancerNetworkInterfaceListVmss() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armnetwork.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := clientFactory.NewLoadBalancerNetworkInterfacesClient().NewListPager("testrg", "lb", nil) - for pager.More() { - page, err := pager.NextPage(ctx) - if err != nil { - log.Fatalf("failed to advance page: %v", err) - } - for _, v := range page.Value { - // You could use page here. We use blank identifier for just demo purposes. - _ = v - } - // If the HTTP response code is 200 as defined in example definition, your page structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // page.InterfaceListResult = armnetwork.InterfaceListResult{ - // Value: []*armnetwork.Interface{ - // { - // Name: to.Ptr("vmss1Nic"), - // ID: to.Ptr("/subscriptions/subid/resourceGroups/testrg/providers/Microsoft.Compute/virtualMachineScaleSets/vmss1/virtualMachines/0/networkInterfaces/vmss1Nic"), - // Etag: to.Ptr("W/\\\"00000000-0000-0000-0000-000000000000\\\""), - // Properties: &armnetwork.InterfacePropertiesFormat{ - // DNSSettings: &armnetwork.InterfaceDNSSettings{ - // AppliedDNSServers: []*string{ - // }, - // DNSServers: []*string{ - // }, - // InternalDomainNameSuffix: to.Ptr("aaaaaaaaaaaaaaaaaaaaaaaaaa.dx.internal.cloudapp.net"), - // }, - // EnableAcceleratedNetworking: to.Ptr(false), - // EnableIPForwarding: to.Ptr(false), - // IPConfigurations: []*armnetwork.InterfaceIPConfiguration{ - // { - // ID: to.Ptr("/subscriptions/subid/resourceGroups/testrg/providers/Microsoft.Compute/virtualMachineScaleSets/vmss1/virtualMachines/0/networkInterfaces/vmss1Nic/ipConfigurations/vmss1IpConfig"), - // Name: to.Ptr("vmss1IpConfig"), - // Etag: to.Ptr("W/\\\"00000000-0000-0000-0000-000000000000\\\""), - // Properties: &armnetwork.InterfaceIPConfigurationPropertiesFormat{ - // LoadBalancerBackendAddressPools: []*armnetwork.BackendAddressPool{ - // { - // ID: to.Ptr("/subscriptions/subid/resourceGroups/testrg/providers/Microsoft.Network/loadBalancers/lb/backendAddressPools/bepool"), - // }}, - // LoadBalancerInboundNatRules: []*armnetwork.InboundNatRule{ - // { - // ID: to.Ptr("/subscriptions/subid/resourceGroups/testrg/providers/Microsoft.Network/loadBalancers/lb/inboundNatRules/natpool.0"), - // }}, - // Primary: to.Ptr(true), - // PrivateIPAddress: to.Ptr("10.0.0.4"), - // PrivateIPAddressVersion: to.Ptr(armnetwork.IPVersionIPv4), - // PrivateIPAllocationMethod: to.Ptr(armnetwork.IPAllocationMethodDynamic), - // ProvisioningState: to.Ptr(armnetwork.ProvisioningStateSucceeded), - // Subnet: &armnetwork.Subnet{ - // ID: to.Ptr("/subscriptions/subid/resourceGroups/testrg/providers/Microsoft.Network/virtualNetworks/vmss1Vnet/subnets/default"), - // }, - // }, - // }}, - // MacAddress: to.Ptr("00-00-00-00-00-00"), - // Primary: to.Ptr(true), - // ProvisioningState: to.Ptr(armnetwork.ProvisioningStateSucceeded), - // ResourceGUID: to.Ptr("00000000-0000-0000-0000-000000000000"), - // VirtualMachine: &armnetwork.SubResource{ - // ID: to.Ptr("/subscriptions/subid/resourceGroups/testrg/providers/Microsoft.Compute/virtualMachineScaleSets/vmss1/virtualMachines/0"), - // }, - // }, - // }, - // { - // Name: to.Ptr("vmss1Nic"), - // ID: to.Ptr("/subscriptions/subid/resourceGroups/testrg/providers/Microsoft.Compute/virtualMachineScaleSets/vmss1/virtualMachines/1/networkInterfaces/vmss1Nic"), - // Etag: to.Ptr("W/\\\"00000000-0000-0000-0000-000000000000\\\""), - // Properties: &armnetwork.InterfacePropertiesFormat{ - // DNSSettings: &armnetwork.InterfaceDNSSettings{ - // AppliedDNSServers: []*string{ - // }, - // DNSServers: []*string{ - // }, - // InternalDomainNameSuffix: to.Ptr("aaaaaaaaaaaaaaaaaaaaaaaaaa.dx.internal.cloudapp.net"), - // }, - // EnableAcceleratedNetworking: to.Ptr(false), - // EnableIPForwarding: to.Ptr(false), - // IPConfigurations: []*armnetwork.InterfaceIPConfiguration{ - // { - // ID: to.Ptr("/subscriptions/subid/resourceGroups/testrg/providers/Microsoft.Compute/virtualMachineScaleSets/vmss1/virtualMachines/1/networkInterfaces/vmss1Nic/ipConfigurations/vmss1IpConfig"), - // Name: to.Ptr("vmss1IpConfig"), - // Etag: to.Ptr("W/\\\"00000000-0000-0000-0000-000000000000\\\""), - // Properties: &armnetwork.InterfaceIPConfigurationPropertiesFormat{ - // LoadBalancerBackendAddressPools: []*armnetwork.BackendAddressPool{ - // { - // ID: to.Ptr("/subscriptions/subid/resourceGroups/testrg/providers/Microsoft.Network/loadBalancers/lb/backendAddressPools/bepool"), - // }}, - // LoadBalancerInboundNatRules: []*armnetwork.InboundNatRule{ - // { - // ID: to.Ptr("/subscriptions/subid/resourceGroups/testrg/providers/Microsoft.Network/loadBalancers/lb/inboundNatRules/natpool.1"), - // }}, - // Primary: to.Ptr(true), - // PrivateIPAddress: to.Ptr("10.0.0.5"), - // PrivateIPAddressVersion: to.Ptr(armnetwork.IPVersionIPv4), - // PrivateIPAllocationMethod: to.Ptr(armnetwork.IPAllocationMethodDynamic), - // ProvisioningState: to.Ptr(armnetwork.ProvisioningStateSucceeded), - // Subnet: &armnetwork.Subnet{ - // ID: to.Ptr("/subscriptions/subid/resourceGroups/testrg/providers/Microsoft.Network/virtualNetworks/vmss1Vnet/subnets/default"), - // }, - // }, - // }}, - // MacAddress: to.Ptr("00-00-00-00-00-00"), - // Primary: to.Ptr(true), - // ProvisioningState: to.Ptr(armnetwork.ProvisioningStateSucceeded), - // ResourceGUID: to.Ptr("00000000-0000-0000-0000-000000000000"), - // VirtualMachine: &armnetwork.SubResource{ - // ID: to.Ptr("/subscriptions/subid/resourceGroups/testrg/providers/Microsoft.Compute/virtualMachineScaleSets/vmss1/virtualMachines/1"), - // }, - // }, - // }}, - // } - } -} diff --git a/sdk/resourcemanager/network/armnetwork/loadbalanceroutboundrules_client_example_test.go b/sdk/resourcemanager/network/armnetwork/loadbalanceroutboundrules_client_example_test.go deleted file mode 100644 index a7df5ffc60a7..000000000000 --- a/sdk/resourcemanager/network/armnetwork/loadbalanceroutboundrules_client_example_test.go +++ /dev/null @@ -1,106 +0,0 @@ -//go:build go1.18 -// +build go1.18 - -// 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. -// DO NOT EDIT. - -package armnetwork_test - -import ( - "context" - "log" - - "github.com/Azure/azure-sdk-for-go/sdk/azidentity" - "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/network/armnetwork/v6" -) - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/4883fa5dbf6f2c9093fac8ce334547e9dfac68fa/specification/network/resource-manager/Microsoft.Network/stable/2024-03-01/examples/LoadBalancerOutboundRuleList.json -func ExampleLoadBalancerOutboundRulesClient_NewListPager() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armnetwork.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := clientFactory.NewLoadBalancerOutboundRulesClient().NewListPager("testrg", "lb1", nil) - for pager.More() { - page, err := pager.NextPage(ctx) - if err != nil { - log.Fatalf("failed to advance page: %v", err) - } - for _, v := range page.Value { - // You could use page here. We use blank identifier for just demo purposes. - _ = v - } - // If the HTTP response code is 200 as defined in example definition, your page structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // page.LoadBalancerOutboundRuleListResult = armnetwork.LoadBalancerOutboundRuleListResult{ - // Value: []*armnetwork.OutboundRule{ - // { - // ID: to.Ptr("/subscriptions/subid/resourceGroups/testrg/providers/Microsoft.Network/loadBalancers/lb1/outboundRules/rule1"), - // Name: to.Ptr("rule1"), - // Type: to.Ptr("Microsoft.Network/loadBalancers/outboundRules"), - // Etag: to.Ptr("W/\"00000000-0000-0000-0000-000000000000\""), - // Properties: &armnetwork.OutboundRulePropertiesFormat{ - // AllocatedOutboundPorts: to.Ptr[int32](64), - // BackendAddressPool: &armnetwork.SubResource{ - // ID: to.Ptr("/subscriptions/subid/resourceGroups/testrg/providers/Microsoft.Network/loadBalancers/lb1/backendAddressPools/bepool1"), - // }, - // EnableTCPReset: to.Ptr(true), - // FrontendIPConfigurations: []*armnetwork.SubResource{ - // { - // ID: to.Ptr("/subscriptions/subid/resourceGroups/testrg/providers/Microsoft.Network/loadBalancers/lb1/frontendIPConfigurations/lbfrontend"), - // }}, - // IdleTimeoutInMinutes: to.Ptr[int32](15), - // ProvisioningState: to.Ptr(armnetwork.ProvisioningStateSucceeded), - // Protocol: to.Ptr(armnetwork.LoadBalancerOutboundRuleProtocolTCP), - // }, - // }}, - // } - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/4883fa5dbf6f2c9093fac8ce334547e9dfac68fa/specification/network/resource-manager/Microsoft.Network/stable/2024-03-01/examples/LoadBalancerOutboundRuleGet.json -func ExampleLoadBalancerOutboundRulesClient_Get() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armnetwork.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewLoadBalancerOutboundRulesClient().Get(ctx, "testrg", "lb1", "rule1", nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.OutboundRule = armnetwork.OutboundRule{ - // ID: to.Ptr("/subscriptions/subid/resourceGroups/testrg/providers/Microsoft.Network/loadBalancers/lb1/outboundRules/rule1"), - // Name: to.Ptr("rule1"), - // Type: to.Ptr("Microsoft.Network/loadBalancers/outboundRules"), - // Etag: to.Ptr("W/\"00000000-0000-0000-0000-000000000000\""), - // Properties: &armnetwork.OutboundRulePropertiesFormat{ - // AllocatedOutboundPorts: to.Ptr[int32](64), - // BackendAddressPool: &armnetwork.SubResource{ - // ID: to.Ptr("/subscriptions/subid/resourceGroups/testrg/providers/Microsoft.Network/loadBalancers/lb1/backendAddressPools/bepool1"), - // }, - // EnableTCPReset: to.Ptr(true), - // FrontendIPConfigurations: []*armnetwork.SubResource{ - // { - // ID: to.Ptr("/subscriptions/subid/resourceGroups/testrg/providers/Microsoft.Network/loadBalancers/lb1/frontendIPConfigurations/lbfrontend"), - // }}, - // IdleTimeoutInMinutes: to.Ptr[int32](15), - // ProvisioningState: to.Ptr(armnetwork.ProvisioningStateSucceeded), - // Protocol: to.Ptr(armnetwork.LoadBalancerOutboundRuleProtocolTCP), - // }, - // } -} diff --git a/sdk/resourcemanager/network/armnetwork/loadbalancerprobes_client_example_test.go b/sdk/resourcemanager/network/armnetwork/loadbalancerprobes_client_example_test.go deleted file mode 100644 index ead62f292178..000000000000 --- a/sdk/resourcemanager/network/armnetwork/loadbalancerprobes_client_example_test.go +++ /dev/null @@ -1,104 +0,0 @@ -//go:build go1.18 -// +build go1.18 - -// 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. -// DO NOT EDIT. - -package armnetwork_test - -import ( - "context" - "log" - - "github.com/Azure/azure-sdk-for-go/sdk/azidentity" - "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/network/armnetwork/v6" -) - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/4883fa5dbf6f2c9093fac8ce334547e9dfac68fa/specification/network/resource-manager/Microsoft.Network/stable/2024-03-01/examples/LoadBalancerProbeList.json -func ExampleLoadBalancerProbesClient_NewListPager() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armnetwork.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := clientFactory.NewLoadBalancerProbesClient().NewListPager("testrg", "lb", nil) - for pager.More() { - page, err := pager.NextPage(ctx) - if err != nil { - log.Fatalf("failed to advance page: %v", err) - } - for _, v := range page.Value { - // You could use page here. We use blank identifier for just demo purposes. - _ = v - } - // If the HTTP response code is 200 as defined in example definition, your page structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // page.LoadBalancerProbeListResult = armnetwork.LoadBalancerProbeListResult{ - // Value: []*armnetwork.Probe{ - // { - // ID: to.Ptr("/subscriptions/subid/resourceGroups/testrg/providers/Microsoft.Network/loadBalancers/lb/probes/prlb"), - // Name: to.Ptr("prlb"), - // Type: to.Ptr("Microsoft.Network/loadBalancers/probes"), - // Etag: to.Ptr("W/\"00000000-0000-0000-0000-000000000000\""), - // Properties: &armnetwork.ProbePropertiesFormat{ - // IntervalInSeconds: to.Ptr[int32](15), - // LoadBalancingRules: []*armnetwork.SubResource{ - // { - // ID: to.Ptr("/subscriptions/subid/resourceGroups/testrg/providers/Microsoft.Network/loadBalancers/lb/loadBalancingRules/rulelb"), - // }}, - // NumberOfProbes: to.Ptr[int32](2), - // Port: to.Ptr[int32](80), - // ProbeThreshold: to.Ptr[int32](1), - // ProvisioningState: to.Ptr(armnetwork.ProvisioningStateSucceeded), - // RequestPath: to.Ptr("healthcheck.aspx"), - // Protocol: to.Ptr(armnetwork.ProbeProtocolHTTP), - // }, - // }}, - // } - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/4883fa5dbf6f2c9093fac8ce334547e9dfac68fa/specification/network/resource-manager/Microsoft.Network/stable/2024-03-01/examples/LoadBalancerProbeGet.json -func ExampleLoadBalancerProbesClient_Get() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armnetwork.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewLoadBalancerProbesClient().Get(ctx, "testrg", "lb", "probe1", nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.Probe = armnetwork.Probe{ - // ID: to.Ptr("/subscriptions/subid/resourceGroups/testrg/providers/Microsoft.Network/loadBalancers/lb/probes/probe1"), - // Name: to.Ptr("probe1"), - // Type: to.Ptr("Microsoft.Network/loadBalancers/probes"), - // Etag: to.Ptr("W/\"00000000-0000-0000-0000-000000000000\""), - // Properties: &armnetwork.ProbePropertiesFormat{ - // IntervalInSeconds: to.Ptr[int32](15), - // LoadBalancingRules: []*armnetwork.SubResource{ - // { - // ID: to.Ptr("/subscriptions/subid/resourceGroups/testrg/providers/Microsoft.Network/loadBalancers/lb/loadBalancingRules/rulelb"), - // }}, - // NumberOfProbes: to.Ptr[int32](2), - // Port: to.Ptr[int32](80), - // ProbeThreshold: to.Ptr[int32](1), - // ProvisioningState: to.Ptr(armnetwork.ProvisioningStateSucceeded), - // RequestPath: to.Ptr("healthcheck.aspx"), - // Protocol: to.Ptr(armnetwork.ProbeProtocolHTTP), - // }, - // } -} diff --git a/sdk/resourcemanager/network/armnetwork/loadbalancers_client_example_test.go b/sdk/resourcemanager/network/armnetwork/loadbalancers_client_example_test.go deleted file mode 100644 index 7484e97baf17..000000000000 --- a/sdk/resourcemanager/network/armnetwork/loadbalancers_client_example_test.go +++ /dev/null @@ -1,3017 +0,0 @@ -//go:build go1.18 -// +build go1.18 - -// 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. -// DO NOT EDIT. - -package armnetwork_test - -import ( - "context" - "log" - - "github.com/Azure/azure-sdk-for-go/sdk/azcore/to" - "github.com/Azure/azure-sdk-for-go/sdk/azidentity" - "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/network/armnetwork/v6" -) - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/4883fa5dbf6f2c9093fac8ce334547e9dfac68fa/specification/network/resource-manager/Microsoft.Network/stable/2024-03-01/examples/LoadBalancerDelete.json -func ExampleLoadBalancersClient_BeginDelete() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armnetwork.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewLoadBalancersClient().BeginDelete(ctx, "rg1", "lb", nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - _, err = poller.PollUntilDone(ctx, nil) - if err != nil { - log.Fatalf("failed to pull the result: %v", err) - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/4883fa5dbf6f2c9093fac8ce334547e9dfac68fa/specification/network/resource-manager/Microsoft.Network/stable/2024-03-01/examples/LoadBalancerGet.json -func ExampleLoadBalancersClient_Get_getLoadBalancer() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armnetwork.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewLoadBalancersClient().Get(ctx, "rg1", "lb", &armnetwork.LoadBalancersClientGetOptions{Expand: nil}) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.LoadBalancer = armnetwork.LoadBalancer{ - // Name: to.Ptr("lb"), - // Type: to.Ptr("Microsoft.Network/loadBalancers"), - // ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/loadBalancers/lb"), - // Location: to.Ptr("westus"), - // Etag: to.Ptr("W/\"00000000-0000-0000-0000-00000000\""), - // Properties: &armnetwork.LoadBalancerPropertiesFormat{ - // BackendAddressPools: []*armnetwork.BackendAddressPool{ - // { - // ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/loadBalancers/lb/backendAddressPools/be-lb"), - // Name: to.Ptr("be-lb"), - // Type: to.Ptr("Microsoft.Network/loadBalancers/backendAddressPools"), - // Etag: to.Ptr("W/\"00000000-0000-0000-0000-00000000\""), - // Properties: &armnetwork.BackendAddressPoolPropertiesFormat{ - // LoadBalancingRules: []*armnetwork.SubResource{ - // { - // ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/loadBalancers/lb/loadBalancingRules/rulelb"), - // }}, - // ProvisioningState: to.Ptr(armnetwork.ProvisioningStateSucceeded), - // }, - // }}, - // FrontendIPConfigurations: []*armnetwork.FrontendIPConfiguration{ - // { - // ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/loadBalancers/lb/frontendIPConfigurations/fe-lb"), - // Name: to.Ptr("fe-lb"), - // Type: to.Ptr("Microsoft.Network/loadBalancers/frontendIPConfigurations"), - // Etag: to.Ptr("W/\"00000000-0000-0000-0000-00000000\""), - // Properties: &armnetwork.FrontendIPConfigurationPropertiesFormat{ - // InboundNatRules: []*armnetwork.SubResource{ - // { - // ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/loadBalancers/lb/inboundNatRules/in-nat-rule"), - // }}, - // LoadBalancingRules: []*armnetwork.SubResource{ - // { - // ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/loadBalancers/lb/loadBalancingRules/rulelb"), - // }}, - // PrivateIPAddress: to.Ptr("10.0.1.4"), - // PrivateIPAddressVersion: to.Ptr(armnetwork.IPVersionIPv4), - // PrivateIPAllocationMethod: to.Ptr(armnetwork.IPAllocationMethodDynamic), - // ProvisioningState: to.Ptr(armnetwork.ProvisioningStateSucceeded), - // Subnet: &armnetwork.Subnet{ - // ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/virtualNetworks/vnetlb/subnets/subnetlb"), - // }, - // }, - // }}, - // InboundNatPools: []*armnetwork.InboundNatPool{ - // }, - // InboundNatRules: []*armnetwork.InboundNatRule{ - // { - // ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/loadBalancers/lb/inboundNatRules/in-nat-rule"), - // Name: to.Ptr("in-nat-rule"), - // Type: to.Ptr("Microsoft.Network/loadBalancers/inboundNatRules"), - // Etag: to.Ptr("W/\"00000000-0000-0000-0000-00000000\""), - // Properties: &armnetwork.InboundNatRulePropertiesFormat{ - // BackendPort: to.Ptr[int32](3389), - // EnableFloatingIP: to.Ptr(true), - // EnableTCPReset: to.Ptr(true), - // FrontendIPConfiguration: &armnetwork.SubResource{ - // ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/loadBalancers/lb/frontendIPConfigurations/fe-lb"), - // }, - // FrontendPort: to.Ptr[int32](3389), - // IdleTimeoutInMinutes: to.Ptr[int32](15), - // ProvisioningState: to.Ptr(armnetwork.ProvisioningStateSucceeded), - // Protocol: to.Ptr(armnetwork.TransportProtocolTCP), - // }, - // }}, - // LoadBalancingRules: []*armnetwork.LoadBalancingRule{ - // { - // ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/loadBalancers/lb/loadBalancingRules/rulelb"), - // Name: to.Ptr("rulelb"), - // Type: to.Ptr("Microsoft.Network/loadBalancers/loadBalancingRules"), - // Etag: to.Ptr("W/\"00000000-0000-0000-0000-00000000\""), - // Properties: &armnetwork.LoadBalancingRulePropertiesFormat{ - // BackendAddressPool: &armnetwork.SubResource{ - // ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/loadBalancers/lb/backendAddressPools/be-lb"), - // }, - // BackendPort: to.Ptr[int32](80), - // DisableOutboundSnat: to.Ptr(false), - // EnableFloatingIP: to.Ptr(true), - // EnableTCPReset: to.Ptr(true), - // FrontendIPConfiguration: &armnetwork.SubResource{ - // ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/loadBalancers/lb/frontendIPConfigurations/fe-lb"), - // }, - // FrontendPort: to.Ptr[int32](80), - // IdleTimeoutInMinutes: to.Ptr[int32](15), - // LoadDistribution: to.Ptr(armnetwork.LoadDistributionDefault), - // Probe: &armnetwork.SubResource{ - // ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/loadBalancers/lb/probes/probe-lb"), - // }, - // ProvisioningState: to.Ptr(armnetwork.ProvisioningStateSucceeded), - // Protocol: to.Ptr(armnetwork.TransportProtocolTCP), - // }, - // }}, - // Probes: []*armnetwork.Probe{ - // { - // ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/loadBalancers/lb/probes/probe-lb"), - // Name: to.Ptr("probe-lb"), - // Type: to.Ptr("Microsoft.Network/loadBalancers/probes"), - // Etag: to.Ptr("W/\"00000000-0000-0000-0000-00000000\""), - // Properties: &armnetwork.ProbePropertiesFormat{ - // IntervalInSeconds: to.Ptr[int32](15), - // LoadBalancingRules: []*armnetwork.SubResource{ - // { - // ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/loadBalancers/lb/loadBalancingRules/rulelb"), - // }}, - // NumberOfProbes: to.Ptr[int32](2), - // Port: to.Ptr[int32](80), - // ProbeThreshold: to.Ptr[int32](1), - // ProvisioningState: to.Ptr(armnetwork.ProvisioningStateSucceeded), - // RequestPath: to.Ptr("healthcheck.aspx"), - // Protocol: to.Ptr(armnetwork.ProbeProtocolHTTP), - // }, - // }}, - // ProvisioningState: to.Ptr(armnetwork.ProvisioningStateSucceeded), - // ResourceGUID: to.Ptr("00000000-0000-0000-0000-00000000"), - // }, - // SKU: &armnetwork.LoadBalancerSKU{ - // Name: to.Ptr(armnetwork.LoadBalancerSKUNameBasic), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/4883fa5dbf6f2c9093fac8ce334547e9dfac68fa/specification/network/resource-manager/Microsoft.Network/stable/2024-03-01/examples/LoadBalancerGetInboundNatRulePortMapping.json -func ExampleLoadBalancersClient_Get_getLoadBalancerWithInboundNatRulePortMapping() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armnetwork.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewLoadBalancersClient().Get(ctx, "rg1", "lb", &armnetwork.LoadBalancersClientGetOptions{Expand: nil}) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.LoadBalancer = armnetwork.LoadBalancer{ - // Name: to.Ptr("lb"), - // Type: to.Ptr("Microsoft.Network/loadBalancers"), - // ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/loadBalancers/lb"), - // Location: to.Ptr("westus"), - // Etag: to.Ptr("W/\"00000000-0000-0000-0000-00000000\""), - // Properties: &armnetwork.LoadBalancerPropertiesFormat{ - // BackendAddressPools: []*armnetwork.BackendAddressPool{ - // { - // ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/loadBalancers/lb/backendAddressPools/be-lb"), - // Name: to.Ptr("be-lb"), - // Type: to.Ptr("Microsoft.Network/loadBalancers/backendAddressPools"), - // Etag: to.Ptr("W/\"00000000-0000-0000-0000-00000000\""), - // Properties: &armnetwork.BackendAddressPoolPropertiesFormat{ - // InboundNatRules: []*armnetwork.SubResource{ - // { - // ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/loadBalancers/lb/inboundNatRules/in-nat-rule"), - // }}, - // LoadBalancerBackendAddresses: []*armnetwork.LoadBalancerBackendAddress{ - // { - // Name: to.Ptr("8bec96ef-0a6a-45b8-9860-4ffde7bf3572"), - // Properties: &armnetwork.LoadBalancerBackendAddressPropertiesFormat{ - // InboundNatRulesPortMapping: []*armnetwork.NatRulePortMapping{ - // { - // BackendPort: to.Ptr[int32](3389), - // FrontendPort: to.Ptr[int32](3389), - // InboundNatRuleName: to.Ptr("natRule"), - // }}, - // IPAddress: to.Ptr("10.0.0.4"), - // Subnet: &armnetwork.SubResource{ - // ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/virtualNetworks/vnetlb/subnets/subnetlb"), - // }, - // }, - // }}, - // LoadBalancingRules: []*armnetwork.SubResource{ - // { - // ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/loadBalancers/lb/loadBalancingRules/rulelb"), - // }}, - // ProvisioningState: to.Ptr(armnetwork.ProvisioningStateSucceeded), - // }, - // }}, - // FrontendIPConfigurations: []*armnetwork.FrontendIPConfiguration{ - // { - // ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/loadBalancers/lb/frontendIPConfigurations/fe-lb"), - // Name: to.Ptr("fe-lb"), - // Type: to.Ptr("Microsoft.Network/loadBalancers/frontendIPConfigurations"), - // Etag: to.Ptr("W/\"00000000-0000-0000-0000-00000000\""), - // Properties: &armnetwork.FrontendIPConfigurationPropertiesFormat{ - // LoadBalancingRules: []*armnetwork.SubResource{ - // { - // ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/loadBalancers/lb/loadBalancingRules/rulelb"), - // }}, - // PrivateIPAddress: to.Ptr("10.0.1.4"), - // PrivateIPAddressVersion: to.Ptr(armnetwork.IPVersionIPv4), - // PrivateIPAllocationMethod: to.Ptr(armnetwork.IPAllocationMethodDynamic), - // ProvisioningState: to.Ptr(armnetwork.ProvisioningStateSucceeded), - // Subnet: &armnetwork.Subnet{ - // ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/virtualNetworks/vnetlb/subnets/subnetlb"), - // }, - // }, - // }}, - // InboundNatPools: []*armnetwork.InboundNatPool{ - // }, - // InboundNatRules: []*armnetwork.InboundNatRule{ - // { - // ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/loadBalancers/lb/inboundNatRules/in-nat-rule"), - // Name: to.Ptr("in-nat-rule"), - // Type: to.Ptr("Microsoft.Network/loadBalancers/inboundNatRules"), - // Etag: to.Ptr("W/\"00000000-0000-0000-0000-00000000\""), - // Properties: &armnetwork.InboundNatRulePropertiesFormat{ - // BackendAddressPool: &armnetwork.SubResource{ - // ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/loadBalancers/lb/backendAddressPools/be-lb"), - // }, - // BackendPort: to.Ptr[int32](3389), - // EnableFloatingIP: to.Ptr(true), - // EnableTCPReset: to.Ptr(true), - // FrontendIPConfiguration: &armnetwork.SubResource{ - // ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/loadBalancers/lb/frontendIPConfigurations/fe-lb"), - // }, - // FrontendPort: to.Ptr[int32](0), - // FrontendPortRangeEnd: to.Ptr[int32](4000), - // FrontendPortRangeStart: to.Ptr[int32](3389), - // IdleTimeoutInMinutes: to.Ptr[int32](15), - // ProvisioningState: to.Ptr(armnetwork.ProvisioningStateSucceeded), - // Protocol: to.Ptr(armnetwork.TransportProtocolTCP), - // }, - // }}, - // LoadBalancingRules: []*armnetwork.LoadBalancingRule{ - // { - // ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/loadBalancers/lb/loadBalancingRules/rulelb"), - // Name: to.Ptr("rulelb"), - // Type: to.Ptr("Microsoft.Network/loadBalancers/loadBalancingRules"), - // Etag: to.Ptr("W/\"00000000-0000-0000-0000-00000000\""), - // Properties: &armnetwork.LoadBalancingRulePropertiesFormat{ - // BackendAddressPool: &armnetwork.SubResource{ - // ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/loadBalancers/lb/backendAddressPools/be-lb"), - // }, - // BackendPort: to.Ptr[int32](80), - // DisableOutboundSnat: to.Ptr(false), - // EnableFloatingIP: to.Ptr(true), - // EnableTCPReset: to.Ptr(true), - // FrontendIPConfiguration: &armnetwork.SubResource{ - // ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/loadBalancers/lb/frontendIPConfigurations/fe-lb"), - // }, - // FrontendPort: to.Ptr[int32](80), - // IdleTimeoutInMinutes: to.Ptr[int32](15), - // LoadDistribution: to.Ptr(armnetwork.LoadDistributionDefault), - // Probe: &armnetwork.SubResource{ - // ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/loadBalancers/lb/probes/probe-lb"), - // }, - // ProvisioningState: to.Ptr(armnetwork.ProvisioningStateSucceeded), - // Protocol: to.Ptr(armnetwork.TransportProtocolTCP), - // }, - // }}, - // Probes: []*armnetwork.Probe{ - // { - // ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/loadBalancers/lb/probes/probe-lb"), - // Name: to.Ptr("probe-lb"), - // Type: to.Ptr("Microsoft.Network/loadBalancers/probes"), - // Etag: to.Ptr("W/\"00000000-0000-0000-0000-00000000\""), - // Properties: &armnetwork.ProbePropertiesFormat{ - // IntervalInSeconds: to.Ptr[int32](15), - // LoadBalancingRules: []*armnetwork.SubResource{ - // { - // ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/loadBalancers/lb/loadBalancingRules/rulelb"), - // }}, - // NumberOfProbes: to.Ptr[int32](2), - // Port: to.Ptr[int32](80), - // ProbeThreshold: to.Ptr[int32](1), - // ProvisioningState: to.Ptr(armnetwork.ProvisioningStateSucceeded), - // RequestPath: to.Ptr("healthcheck.aspx"), - // Protocol: to.Ptr(armnetwork.ProbeProtocolHTTP), - // }, - // }}, - // ProvisioningState: to.Ptr(armnetwork.ProvisioningStateSucceeded), - // ResourceGUID: to.Ptr("00000000-0000-0000-0000-00000000"), - // }, - // SKU: &armnetwork.LoadBalancerSKU{ - // Name: to.Ptr(armnetwork.LoadBalancerSKUNameStandard), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/4883fa5dbf6f2c9093fac8ce334547e9dfac68fa/specification/network/resource-manager/Microsoft.Network/stable/2024-03-01/examples/LoadBalancerCreate.json -func ExampleLoadBalancersClient_BeginCreateOrUpdate_createLoadBalancer() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armnetwork.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewLoadBalancersClient().BeginCreateOrUpdate(ctx, "rg1", "lb", armnetwork.LoadBalancer{ - Location: to.Ptr("eastus"), - Properties: &armnetwork.LoadBalancerPropertiesFormat{ - BackendAddressPools: []*armnetwork.BackendAddressPool{ - { - Name: to.Ptr("be-lb"), - Properties: &armnetwork.BackendAddressPoolPropertiesFormat{}, - }}, - FrontendIPConfigurations: []*armnetwork.FrontendIPConfiguration{ - { - Name: to.Ptr("fe-lb"), - Properties: &armnetwork.FrontendIPConfigurationPropertiesFormat{ - Subnet: &armnetwork.Subnet{ - ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/virtualNetworks/vnetlb/subnets/subnetlb"), - }, - }, - }}, - InboundNatPools: []*armnetwork.InboundNatPool{}, - InboundNatRules: []*armnetwork.InboundNatRule{ - { - Name: to.Ptr("in-nat-rule"), - Properties: &armnetwork.InboundNatRulePropertiesFormat{ - BackendPort: to.Ptr[int32](3389), - EnableFloatingIP: to.Ptr(true), - EnableTCPReset: to.Ptr(false), - FrontendIPConfiguration: &armnetwork.SubResource{ - ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/loadBalancers/lb/frontendIPConfigurations/fe-lb"), - }, - FrontendPort: to.Ptr[int32](3389), - IdleTimeoutInMinutes: to.Ptr[int32](15), - Protocol: to.Ptr(armnetwork.TransportProtocolTCP), - }, - }}, - LoadBalancingRules: []*armnetwork.LoadBalancingRule{ - { - Name: to.Ptr("rulelb"), - Properties: &armnetwork.LoadBalancingRulePropertiesFormat{ - BackendAddressPool: &armnetwork.SubResource{ - ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/loadBalancers/lb/backendAddressPools/be-lb"), - }, - BackendPort: to.Ptr[int32](80), - EnableFloatingIP: to.Ptr(true), - EnableTCPReset: to.Ptr(false), - FrontendIPConfiguration: &armnetwork.SubResource{ - ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/loadBalancers/lb/frontendIPConfigurations/fe-lb"), - }, - FrontendPort: to.Ptr[int32](80), - IdleTimeoutInMinutes: to.Ptr[int32](15), - LoadDistribution: to.Ptr(armnetwork.LoadDistributionDefault), - Probe: &armnetwork.SubResource{ - ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/loadBalancers/lb/probes/probe-lb"), - }, - Protocol: to.Ptr(armnetwork.TransportProtocolTCP), - }, - }}, - Probes: []*armnetwork.Probe{ - { - Name: to.Ptr("probe-lb"), - Properties: &armnetwork.ProbePropertiesFormat{ - IntervalInSeconds: to.Ptr[int32](15), - NumberOfProbes: to.Ptr[int32](2), - Port: to.Ptr[int32](80), - ProbeThreshold: to.Ptr[int32](1), - RequestPath: to.Ptr("healthcheck.aspx"), - Protocol: to.Ptr(armnetwork.ProbeProtocolHTTP), - }, - }}, - }, - }, nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - res, err := poller.PollUntilDone(ctx, nil) - if err != nil { - log.Fatalf("failed to pull the result: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.LoadBalancer = armnetwork.LoadBalancer{ - // Name: to.Ptr("lb"), - // Type: to.Ptr("Microsoft.Network/loadBalancers"), - // ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/loadBalancers/lb"), - // Location: to.Ptr("eastus"), - // Etag: to.Ptr("W/\"00000000-0000-0000-0000-00000000\""), - // Properties: &armnetwork.LoadBalancerPropertiesFormat{ - // BackendAddressPools: []*armnetwork.BackendAddressPool{ - // { - // ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/loadBalancers/lb/backendAddressPools/be-lb"), - // Name: to.Ptr("be-lb"), - // Type: to.Ptr("Microsoft.Network/loadBalancers/backendAddressPools"), - // Etag: to.Ptr("W/\"00000000-0000-0000-0000-00000000\""), - // Properties: &armnetwork.BackendAddressPoolPropertiesFormat{ - // LoadBalancingRules: []*armnetwork.SubResource{ - // { - // ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/loadBalancers/lb/loadBalancingRules/rulelb"), - // }}, - // ProvisioningState: to.Ptr(armnetwork.ProvisioningStateSucceeded), - // }, - // }}, - // FrontendIPConfigurations: []*armnetwork.FrontendIPConfiguration{ - // { - // ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/loadBalancers/lb/frontendIPConfigurations/fe-lb"), - // Name: to.Ptr("fe-lb"), - // Type: to.Ptr("Microsoft.Network/loadBalancers/frontendIPConfigurations"), - // Etag: to.Ptr("W/\"00000000-0000-0000-0000-00000000\""), - // Properties: &armnetwork.FrontendIPConfigurationPropertiesFormat{ - // InboundNatRules: []*armnetwork.SubResource{ - // { - // ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/loadBalancers/lb/inboundNatRules/in-nat-rule"), - // }}, - // LoadBalancingRules: []*armnetwork.SubResource{ - // { - // ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/loadBalancers/lb/loadBalancingRules/rulelb"), - // }}, - // PrivateIPAddress: to.Ptr("10.0.1.4"), - // PrivateIPAllocationMethod: to.Ptr(armnetwork.IPAllocationMethodDynamic), - // ProvisioningState: to.Ptr(armnetwork.ProvisioningStateSucceeded), - // Subnet: &armnetwork.Subnet{ - // ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/virtualNetworks/vnetlb/subnets/subnetlb"), - // }, - // }, - // }}, - // InboundNatPools: []*armnetwork.InboundNatPool{ - // }, - // InboundNatRules: []*armnetwork.InboundNatRule{ - // { - // ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/loadBalancers/lb/inboundNatRules/in-nat-rule"), - // Name: to.Ptr("in-nat-rule"), - // Type: to.Ptr("Microsoft.Network/loadBalancers/inboundNatRules"), - // Etag: to.Ptr("W/\"00000000-0000-0000-0000-00000000\""), - // Properties: &armnetwork.InboundNatRulePropertiesFormat{ - // BackendPort: to.Ptr[int32](3389), - // EnableFloatingIP: to.Ptr(true), - // EnableTCPReset: to.Ptr(false), - // FrontendIPConfiguration: &armnetwork.SubResource{ - // ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/loadBalancers/lb/frontendIPConfigurations/fe-lb"), - // }, - // FrontendPort: to.Ptr[int32](3389), - // IdleTimeoutInMinutes: to.Ptr[int32](15), - // ProvisioningState: to.Ptr(armnetwork.ProvisioningStateSucceeded), - // Protocol: to.Ptr(armnetwork.TransportProtocolTCP), - // }, - // }}, - // LoadBalancingRules: []*armnetwork.LoadBalancingRule{ - // { - // ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/loadBalancers/lb/loadBalancingRules/rulelb"), - // Name: to.Ptr("rulelb"), - // Type: to.Ptr("Microsoft.Network/loadBalancers/loadBalancingRules"), - // Etag: to.Ptr("W/\"00000000-0000-0000-0000-00000000\""), - // Properties: &armnetwork.LoadBalancingRulePropertiesFormat{ - // BackendAddressPool: &armnetwork.SubResource{ - // ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/loadBalancers/lb/backendAddressPools/be-lb"), - // }, - // BackendPort: to.Ptr[int32](80), - // DisableOutboundSnat: to.Ptr(false), - // EnableFloatingIP: to.Ptr(true), - // EnableTCPReset: to.Ptr(false), - // FrontendIPConfiguration: &armnetwork.SubResource{ - // ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/loadBalancers/lb/frontendIPConfigurations/fe-lb"), - // }, - // FrontendPort: to.Ptr[int32](80), - // IdleTimeoutInMinutes: to.Ptr[int32](15), - // LoadDistribution: to.Ptr(armnetwork.LoadDistributionDefault), - // Probe: &armnetwork.SubResource{ - // ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/loadBalancers/lb/probes/probe-lb"), - // }, - // ProvisioningState: to.Ptr(armnetwork.ProvisioningStateSucceeded), - // Protocol: to.Ptr(armnetwork.TransportProtocolTCP), - // }, - // }}, - // Probes: []*armnetwork.Probe{ - // { - // ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/loadBalancers/lb/probes/probe-lb"), - // Name: to.Ptr("probe-lb"), - // Type: to.Ptr("Microsoft.Network/loadBalancers/probes"), - // Etag: to.Ptr("W/\"00000000-0000-0000-0000-00000000\""), - // Properties: &armnetwork.ProbePropertiesFormat{ - // IntervalInSeconds: to.Ptr[int32](15), - // LoadBalancingRules: []*armnetwork.SubResource{ - // { - // ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/loadBalancers/lb/loadBalancingRules/rulelb"), - // }}, - // NumberOfProbes: to.Ptr[int32](2), - // Port: to.Ptr[int32](80), - // ProbeThreshold: to.Ptr[int32](1), - // ProvisioningState: to.Ptr(armnetwork.ProvisioningStateSucceeded), - // RequestPath: to.Ptr("healthcheck.aspx"), - // Protocol: to.Ptr(armnetwork.ProbeProtocolHTTP), - // }, - // }}, - // ProvisioningState: to.Ptr(armnetwork.ProvisioningStateSucceeded), - // ResourceGUID: to.Ptr("00000000-0000-0000-0000-00000000"), - // }, - // SKU: &armnetwork.LoadBalancerSKU{ - // Name: to.Ptr(armnetwork.LoadBalancerSKUNameBasic), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/4883fa5dbf6f2c9093fac8ce334547e9dfac68fa/specification/network/resource-manager/Microsoft.Network/stable/2024-03-01/examples/LoadBalancerCreateWithZones.json -func ExampleLoadBalancersClient_BeginCreateOrUpdate_createLoadBalancerWithFrontendIpInZone1() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armnetwork.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewLoadBalancersClient().BeginCreateOrUpdate(ctx, "rg1", "lb", armnetwork.LoadBalancer{ - Location: to.Ptr("eastus"), - Properties: &armnetwork.LoadBalancerPropertiesFormat{ - BackendAddressPools: []*armnetwork.BackendAddressPool{ - { - Name: to.Ptr("be-lb"), - Properties: &armnetwork.BackendAddressPoolPropertiesFormat{}, - }}, - FrontendIPConfigurations: []*armnetwork.FrontendIPConfiguration{ - { - Name: to.Ptr("fe-lb"), - Properties: &armnetwork.FrontendIPConfigurationPropertiesFormat{ - Subnet: &armnetwork.Subnet{ - ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/virtualNetworks/vnetlb/subnets/subnetlb"), - }, - }, - Zones: []*string{ - to.Ptr("1")}, - }}, - InboundNatPools: []*armnetwork.InboundNatPool{}, - InboundNatRules: []*armnetwork.InboundNatRule{ - { - Name: to.Ptr("in-nat-rule"), - Properties: &armnetwork.InboundNatRulePropertiesFormat{ - BackendPort: to.Ptr[int32](3389), - EnableFloatingIP: to.Ptr(true), - FrontendIPConfiguration: &armnetwork.SubResource{ - ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/loadBalancers/lb/frontendIPConfigurations/fe-lb"), - }, - FrontendPort: to.Ptr[int32](3389), - IdleTimeoutInMinutes: to.Ptr[int32](15), - Protocol: to.Ptr(armnetwork.TransportProtocolTCP), - }, - }}, - LoadBalancingRules: []*armnetwork.LoadBalancingRule{ - { - Name: to.Ptr("rulelb"), - Properties: &armnetwork.LoadBalancingRulePropertiesFormat{ - BackendAddressPool: &armnetwork.SubResource{ - ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/loadBalancers/lb/backendAddressPools/be-lb"), - }, - BackendPort: to.Ptr[int32](80), - EnableFloatingIP: to.Ptr(true), - FrontendIPConfiguration: &armnetwork.SubResource{ - ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/loadBalancers/lb/frontendIPConfigurations/fe-lb"), - }, - FrontendPort: to.Ptr[int32](80), - IdleTimeoutInMinutes: to.Ptr[int32](15), - LoadDistribution: to.Ptr(armnetwork.LoadDistributionDefault), - Probe: &armnetwork.SubResource{ - ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/loadBalancers/lb/probes/probe-lb"), - }, - Protocol: to.Ptr(armnetwork.TransportProtocolTCP), - }, - }}, - OutboundRules: []*armnetwork.OutboundRule{}, - Probes: []*armnetwork.Probe{ - { - Name: to.Ptr("probe-lb"), - Properties: &armnetwork.ProbePropertiesFormat{ - IntervalInSeconds: to.Ptr[int32](15), - NumberOfProbes: to.Ptr[int32](2), - Port: to.Ptr[int32](80), - ProbeThreshold: to.Ptr[int32](1), - RequestPath: to.Ptr("healthcheck.aspx"), - Protocol: to.Ptr(armnetwork.ProbeProtocolHTTP), - }, - }}, - }, - SKU: &armnetwork.LoadBalancerSKU{ - Name: to.Ptr(armnetwork.LoadBalancerSKUNameStandard), - }, - }, nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - res, err := poller.PollUntilDone(ctx, nil) - if err != nil { - log.Fatalf("failed to pull the result: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.LoadBalancer = armnetwork.LoadBalancer{ - // Name: to.Ptr("lb"), - // Type: to.Ptr("Microsoft.Network/loadBalancers"), - // ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/loadBalancers/lb"), - // Location: to.Ptr("eastus"), - // Etag: to.Ptr("W/\"00000000-0000-0000-0000-00000000\""), - // Properties: &armnetwork.LoadBalancerPropertiesFormat{ - // BackendAddressPools: []*armnetwork.BackendAddressPool{ - // { - // ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/loadBalancers/lb/backendAddressPools/be-lb"), - // Name: to.Ptr("be-lb"), - // Type: to.Ptr("Microsoft.Network/loadBalancers/backendAddressPools"), - // Etag: to.Ptr("W/\"00000000-0000-0000-0000-00000000\""), - // Properties: &armnetwork.BackendAddressPoolPropertiesFormat{ - // LoadBalancingRules: []*armnetwork.SubResource{ - // { - // ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/loadBalancers/lb/loadBalancingRules/rulelb"), - // }}, - // ProvisioningState: to.Ptr(armnetwork.ProvisioningStateSucceeded), - // }, - // }}, - // FrontendIPConfigurations: []*armnetwork.FrontendIPConfiguration{ - // { - // ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/loadBalancers/lb/frontendIPConfigurations/fe-lb"), - // Name: to.Ptr("fe-lb"), - // Type: to.Ptr("Microsoft.Network/loadBalancers/frontendIPConfigurations"), - // Etag: to.Ptr("W/\"00000000-0000-0000-0000-00000000\""), - // Properties: &armnetwork.FrontendIPConfigurationPropertiesFormat{ - // InboundNatRules: []*armnetwork.SubResource{ - // { - // ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/loadBalancers/lb/inboundNatRules/in-nat-rule"), - // }}, - // LoadBalancingRules: []*armnetwork.SubResource{ - // { - // ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/loadBalancers/lb/loadBalancingRules/rulelb"), - // }}, - // PrivateIPAddress: to.Ptr("10.0.1.4"), - // PrivateIPAllocationMethod: to.Ptr(armnetwork.IPAllocationMethodDynamic), - // ProvisioningState: to.Ptr(armnetwork.ProvisioningStateSucceeded), - // Subnet: &armnetwork.Subnet{ - // ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/virtualNetworks/vnetlb/subnets/subnetlb"), - // }, - // }, - // Zones: []*string{ - // to.Ptr("1")}, - // }}, - // InboundNatPools: []*armnetwork.InboundNatPool{ - // }, - // InboundNatRules: []*armnetwork.InboundNatRule{ - // { - // ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/loadBalancers/lb/inboundNatRules/in-nat-rule"), - // Name: to.Ptr("in-nat-rule"), - // Type: to.Ptr("Microsoft.Network/loadBalancers/inboundNatRules"), - // Etag: to.Ptr("W/\"00000000-0000-0000-0000-00000000\""), - // Properties: &armnetwork.InboundNatRulePropertiesFormat{ - // BackendPort: to.Ptr[int32](3389), - // EnableFloatingIP: to.Ptr(true), - // FrontendIPConfiguration: &armnetwork.SubResource{ - // ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/loadBalancers/lb/frontendIPConfigurations/fe-lb"), - // }, - // FrontendPort: to.Ptr[int32](3389), - // IdleTimeoutInMinutes: to.Ptr[int32](15), - // ProvisioningState: to.Ptr(armnetwork.ProvisioningStateSucceeded), - // Protocol: to.Ptr(armnetwork.TransportProtocolTCP), - // }, - // }}, - // LoadBalancingRules: []*armnetwork.LoadBalancingRule{ - // { - // ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/loadBalancers/lb/loadBalancingRules/rulelb"), - // Name: to.Ptr("rulelb"), - // Type: to.Ptr("Microsoft.Network/loadBalancers/loadBalancingRules"), - // Etag: to.Ptr("W/\"00000000-0000-0000-0000-00000000\""), - // Properties: &armnetwork.LoadBalancingRulePropertiesFormat{ - // BackendAddressPool: &armnetwork.SubResource{ - // ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/loadBalancers/lb/backendAddressPools/be-lb"), - // }, - // BackendPort: to.Ptr[int32](80), - // DisableOutboundSnat: to.Ptr(false), - // EnableFloatingIP: to.Ptr(true), - // FrontendIPConfiguration: &armnetwork.SubResource{ - // ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/loadBalancers/lb/frontendIPConfigurations/fe-lb"), - // }, - // FrontendPort: to.Ptr[int32](80), - // IdleTimeoutInMinutes: to.Ptr[int32](15), - // LoadDistribution: to.Ptr(armnetwork.LoadDistributionDefault), - // Probe: &armnetwork.SubResource{ - // ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/loadBalancers/lb/probes/probe-lb"), - // }, - // ProvisioningState: to.Ptr(armnetwork.ProvisioningStateSucceeded), - // Protocol: to.Ptr(armnetwork.TransportProtocolTCP), - // }, - // }}, - // OutboundRules: []*armnetwork.OutboundRule{ - // }, - // Probes: []*armnetwork.Probe{ - // { - // ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/loadBalancers/lb/probes/probe-lb"), - // Name: to.Ptr("probe-lb"), - // Type: to.Ptr("Microsoft.Network/loadBalancers/probes"), - // Etag: to.Ptr("W/\"00000000-0000-0000-0000-00000000\""), - // Properties: &armnetwork.ProbePropertiesFormat{ - // IntervalInSeconds: to.Ptr[int32](15), - // LoadBalancingRules: []*armnetwork.SubResource{ - // { - // ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/loadBalancers/lb/loadBalancingRules/rulelb"), - // }}, - // NumberOfProbes: to.Ptr[int32](2), - // Port: to.Ptr[int32](80), - // ProbeThreshold: to.Ptr[int32](1), - // ProvisioningState: to.Ptr(armnetwork.ProvisioningStateSucceeded), - // RequestPath: to.Ptr("healthcheck.aspx"), - // Protocol: to.Ptr(armnetwork.ProbeProtocolHTTP), - // }, - // }}, - // ProvisioningState: to.Ptr(armnetwork.ProvisioningStateSucceeded), - // ResourceGUID: to.Ptr("00000000-0000-0000-0000-00000000"), - // }, - // SKU: &armnetwork.LoadBalancerSKU{ - // Name: to.Ptr(armnetwork.LoadBalancerSKUNameStandard), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/4883fa5dbf6f2c9093fac8ce334547e9dfac68fa/specification/network/resource-manager/Microsoft.Network/stable/2024-03-01/examples/LoadBalancerCreateGatewayLoadBalancerConsumer.json -func ExampleLoadBalancersClient_BeginCreateOrUpdate_createLoadBalancerWithGatewayLoadBalancerConsumerConfigured() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armnetwork.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewLoadBalancersClient().BeginCreateOrUpdate(ctx, "rg1", "lb", armnetwork.LoadBalancer{ - Location: to.Ptr("eastus"), - Properties: &armnetwork.LoadBalancerPropertiesFormat{ - BackendAddressPools: []*armnetwork.BackendAddressPool{ - { - Name: to.Ptr("be-lb"), - Properties: &armnetwork.BackendAddressPoolPropertiesFormat{}, - }}, - FrontendIPConfigurations: []*armnetwork.FrontendIPConfiguration{ - { - Name: to.Ptr("fe-lb"), - Properties: &armnetwork.FrontendIPConfigurationPropertiesFormat{ - GatewayLoadBalancer: &armnetwork.SubResource{ - ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/loadBalancers/lb/frontendIPConfigurations/fe-lb-provider"), - }, - Subnet: &armnetwork.Subnet{ - ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/virtualNetworks/vnetlb/subnets/subnetlb"), - }, - }, - }}, - InboundNatPools: []*armnetwork.InboundNatPool{}, - InboundNatRules: []*armnetwork.InboundNatRule{ - { - Name: to.Ptr("in-nat-rule"), - Properties: &armnetwork.InboundNatRulePropertiesFormat{ - BackendPort: to.Ptr[int32](3389), - EnableFloatingIP: to.Ptr(true), - FrontendIPConfiguration: &armnetwork.SubResource{ - ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/loadBalancers/lb/frontendIPConfigurations/fe-lb"), - }, - FrontendPort: to.Ptr[int32](3389), - IdleTimeoutInMinutes: to.Ptr[int32](15), - Protocol: to.Ptr(armnetwork.TransportProtocolTCP), - }, - }}, - LoadBalancingRules: []*armnetwork.LoadBalancingRule{ - { - Name: to.Ptr("rulelb"), - Properties: &armnetwork.LoadBalancingRulePropertiesFormat{ - BackendAddressPool: &armnetwork.SubResource{ - ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/loadBalancers/lb/backendAddressPools/be-lb"), - }, - BackendPort: to.Ptr[int32](80), - EnableFloatingIP: to.Ptr(true), - FrontendIPConfiguration: &armnetwork.SubResource{ - ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/loadBalancers/lb/frontendIPConfigurations/fe-lb"), - }, - FrontendPort: to.Ptr[int32](80), - IdleTimeoutInMinutes: to.Ptr[int32](15), - LoadDistribution: to.Ptr(armnetwork.LoadDistributionDefault), - Probe: &armnetwork.SubResource{ - ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/loadBalancers/lb/probes/probe-lb"), - }, - Protocol: to.Ptr(armnetwork.TransportProtocolTCP), - }, - }}, - OutboundRules: []*armnetwork.OutboundRule{}, - Probes: []*armnetwork.Probe{ - { - Name: to.Ptr("probe-lb"), - Properties: &armnetwork.ProbePropertiesFormat{ - IntervalInSeconds: to.Ptr[int32](15), - NumberOfProbes: to.Ptr[int32](2), - Port: to.Ptr[int32](80), - ProbeThreshold: to.Ptr[int32](1), - RequestPath: to.Ptr("healthcheck.aspx"), - Protocol: to.Ptr(armnetwork.ProbeProtocolHTTP), - }, - }}, - }, - SKU: &armnetwork.LoadBalancerSKU{ - Name: to.Ptr(armnetwork.LoadBalancerSKUNameStandard), - }, - }, nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - res, err := poller.PollUntilDone(ctx, nil) - if err != nil { - log.Fatalf("failed to pull the result: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.LoadBalancer = armnetwork.LoadBalancer{ - // Name: to.Ptr("lb"), - // Type: to.Ptr("Microsoft.Network/loadBalancers"), - // ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/loadBalancers/lb"), - // Location: to.Ptr("eastus"), - // Etag: to.Ptr("W/\"00000000-0000-0000-0000-00000000\""), - // Properties: &armnetwork.LoadBalancerPropertiesFormat{ - // BackendAddressPools: []*armnetwork.BackendAddressPool{ - // { - // ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/loadBalancers/lb/backendAddressPools/be-lb"), - // Name: to.Ptr("be-lb"), - // Type: to.Ptr("Microsoft.Network/loadBalancers/backendAddressPools"), - // Etag: to.Ptr("W/\"00000000-0000-0000-0000-00000000\""), - // Properties: &armnetwork.BackendAddressPoolPropertiesFormat{ - // LoadBalancingRules: []*armnetwork.SubResource{ - // { - // ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/loadBalancers/lb/loadBalancingRules/rulelb"), - // }}, - // ProvisioningState: to.Ptr(armnetwork.ProvisioningStateSucceeded), - // }, - // }}, - // FrontendIPConfigurations: []*armnetwork.FrontendIPConfiguration{ - // { - // ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/loadBalancers/lb/frontendIPConfigurations/fe-lb"), - // Name: to.Ptr("fe-lb"), - // Type: to.Ptr("Microsoft.Network/loadBalancers/frontendIPConfigurations"), - // Etag: to.Ptr("W/\"00000000-0000-0000-0000-00000000\""), - // Properties: &armnetwork.FrontendIPConfigurationPropertiesFormat{ - // GatewayLoadBalancer: &armnetwork.SubResource{ - // ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/loadBalancers/lb/frontendIPConfigurations/fe-lb-provider"), - // }, - // InboundNatRules: []*armnetwork.SubResource{ - // { - // ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/loadBalancers/lb/inboundNatRules/in-nat-rule"), - // }}, - // LoadBalancingRules: []*armnetwork.SubResource{ - // { - // ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/loadBalancers/lb/loadBalancingRules/rulelb"), - // }}, - // PrivateIPAddress: to.Ptr("10.0.1.4"), - // PrivateIPAllocationMethod: to.Ptr(armnetwork.IPAllocationMethodDynamic), - // ProvisioningState: to.Ptr(armnetwork.ProvisioningStateSucceeded), - // Subnet: &armnetwork.Subnet{ - // ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/virtualNetworks/vnetlb/subnets/subnetlb"), - // }, - // }, - // }}, - // InboundNatPools: []*armnetwork.InboundNatPool{ - // }, - // InboundNatRules: []*armnetwork.InboundNatRule{ - // { - // ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/loadBalancers/lb/inboundNatRules/in-nat-rule"), - // Name: to.Ptr("in-nat-rule"), - // Type: to.Ptr("Microsoft.Network/loadBalancers/inboundNatRules"), - // Etag: to.Ptr("W/\"00000000-0000-0000-0000-00000000\""), - // Properties: &armnetwork.InboundNatRulePropertiesFormat{ - // BackendPort: to.Ptr[int32](3389), - // EnableFloatingIP: to.Ptr(true), - // FrontendIPConfiguration: &armnetwork.SubResource{ - // ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/loadBalancers/lb/frontendIPConfigurations/fe-lb"), - // }, - // FrontendPort: to.Ptr[int32](3389), - // IdleTimeoutInMinutes: to.Ptr[int32](15), - // ProvisioningState: to.Ptr(armnetwork.ProvisioningStateSucceeded), - // Protocol: to.Ptr(armnetwork.TransportProtocolTCP), - // }, - // }}, - // LoadBalancingRules: []*armnetwork.LoadBalancingRule{ - // { - // ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/loadBalancers/lb/loadBalancingRules/rulelb"), - // Name: to.Ptr("rulelb"), - // Type: to.Ptr("Microsoft.Network/loadBalancers/loadBalancingRules"), - // Etag: to.Ptr("W/\"00000000-0000-0000-0000-00000000\""), - // Properties: &armnetwork.LoadBalancingRulePropertiesFormat{ - // BackendAddressPool: &armnetwork.SubResource{ - // ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/loadBalancers/lb/backendAddressPools/be-lb"), - // }, - // BackendPort: to.Ptr[int32](80), - // DisableOutboundSnat: to.Ptr(false), - // EnableFloatingIP: to.Ptr(true), - // FrontendIPConfiguration: &armnetwork.SubResource{ - // ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/loadBalancers/lb/frontendIPConfigurations/fe-lb"), - // }, - // FrontendPort: to.Ptr[int32](80), - // IdleTimeoutInMinutes: to.Ptr[int32](15), - // LoadDistribution: to.Ptr(armnetwork.LoadDistributionDefault), - // Probe: &armnetwork.SubResource{ - // ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/loadBalancers/lb/probes/probe-lb"), - // }, - // ProvisioningState: to.Ptr(armnetwork.ProvisioningStateSucceeded), - // Protocol: to.Ptr(armnetwork.TransportProtocolTCP), - // }, - // }}, - // OutboundRules: []*armnetwork.OutboundRule{ - // }, - // Probes: []*armnetwork.Probe{ - // { - // ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/loadBalancers/lb/probes/probe-lb"), - // Name: to.Ptr("probe-lb"), - // Type: to.Ptr("Microsoft.Network/loadBalancers/probes"), - // Etag: to.Ptr("W/\"00000000-0000-0000-0000-00000000\""), - // Properties: &armnetwork.ProbePropertiesFormat{ - // IntervalInSeconds: to.Ptr[int32](15), - // LoadBalancingRules: []*armnetwork.SubResource{ - // { - // ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/loadBalancers/lb/loadBalancingRules/rulelb"), - // }}, - // NumberOfProbes: to.Ptr[int32](2), - // Port: to.Ptr[int32](80), - // ProbeThreshold: to.Ptr[int32](1), - // ProvisioningState: to.Ptr(armnetwork.ProvisioningStateSucceeded), - // RequestPath: to.Ptr("healthcheck.aspx"), - // Protocol: to.Ptr(armnetwork.ProbeProtocolHTTP), - // }, - // }}, - // ProvisioningState: to.Ptr(armnetwork.ProvisioningStateSucceeded), - // ResourceGUID: to.Ptr("00000000-0000-0000-0000-00000000"), - // }, - // SKU: &armnetwork.LoadBalancerSKU{ - // Name: to.Ptr(armnetwork.LoadBalancerSKUNameStandard), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/4883fa5dbf6f2c9093fac8ce334547e9dfac68fa/specification/network/resource-manager/Microsoft.Network/stable/2024-03-01/examples/LoadBalancerCreateGatewayLoadBalancerProviderWithOneBackendPool.json -func ExampleLoadBalancersClient_BeginCreateOrUpdate_createLoadBalancerWithGatewayLoadBalancerProviderConfiguredWithOneBackendPool() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armnetwork.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewLoadBalancersClient().BeginCreateOrUpdate(ctx, "rg1", "lb", armnetwork.LoadBalancer{ - Location: to.Ptr("eastus"), - Properties: &armnetwork.LoadBalancerPropertiesFormat{ - BackendAddressPools: []*armnetwork.BackendAddressPool{ - { - Name: to.Ptr("be-lb"), - Properties: &armnetwork.BackendAddressPoolPropertiesFormat{ - TunnelInterfaces: []*armnetwork.GatewayLoadBalancerTunnelInterface{ - { - Type: to.Ptr(armnetwork.GatewayLoadBalancerTunnelInterfaceTypeInternal), - Identifier: to.Ptr[int32](900), - Port: to.Ptr[int32](15000), - Protocol: to.Ptr(armnetwork.GatewayLoadBalancerTunnelProtocolVXLAN), - }, - { - Type: to.Ptr(armnetwork.GatewayLoadBalancerTunnelInterfaceTypeInternal), - Identifier: to.Ptr[int32](901), - Port: to.Ptr[int32](15001), - Protocol: to.Ptr(armnetwork.GatewayLoadBalancerTunnelProtocolVXLAN), - }}, - }, - }}, - FrontendIPConfigurations: []*armnetwork.FrontendIPConfiguration{ - { - Name: to.Ptr("fe-lb"), - Properties: &armnetwork.FrontendIPConfigurationPropertiesFormat{ - Subnet: &armnetwork.Subnet{ - ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/virtualNetworks/vnetlb/subnets/subnetlb"), - }, - }, - }}, - InboundNatPools: []*armnetwork.InboundNatPool{}, - LoadBalancingRules: []*armnetwork.LoadBalancingRule{ - { - Name: to.Ptr("rulelb"), - Properties: &armnetwork.LoadBalancingRulePropertiesFormat{ - BackendAddressPools: []*armnetwork.SubResource{ - { - ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/loadBalancers/lb/backendAddressPools/be-lb"), - }}, - BackendPort: to.Ptr[int32](0), - EnableFloatingIP: to.Ptr(true), - FrontendIPConfiguration: &armnetwork.SubResource{ - ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/loadBalancers/lb/frontendIPConfigurations/fe-lb"), - }, - FrontendPort: to.Ptr[int32](0), - IdleTimeoutInMinutes: to.Ptr[int32](15), - LoadDistribution: to.Ptr(armnetwork.LoadDistributionDefault), - Probe: &armnetwork.SubResource{ - ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/loadBalancers/lb/probes/probe-lb"), - }, - Protocol: to.Ptr(armnetwork.TransportProtocolAll), - }, - }}, - OutboundRules: []*armnetwork.OutboundRule{}, - Probes: []*armnetwork.Probe{ - { - Name: to.Ptr("probe-lb"), - Properties: &armnetwork.ProbePropertiesFormat{ - IntervalInSeconds: to.Ptr[int32](15), - NumberOfProbes: to.Ptr[int32](2), - Port: to.Ptr[int32](80), - ProbeThreshold: to.Ptr[int32](1), - RequestPath: to.Ptr("healthcheck.aspx"), - Protocol: to.Ptr(armnetwork.ProbeProtocolHTTP), - }, - }}, - }, - SKU: &armnetwork.LoadBalancerSKU{ - Name: to.Ptr(armnetwork.LoadBalancerSKUNameGateway), - }, - }, nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - res, err := poller.PollUntilDone(ctx, nil) - if err != nil { - log.Fatalf("failed to pull the result: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.LoadBalancer = armnetwork.LoadBalancer{ - // Name: to.Ptr("lb"), - // Type: to.Ptr("Microsoft.Network/loadBalancers"), - // ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/loadBalancers/lb"), - // Location: to.Ptr("eastus"), - // Etag: to.Ptr("W/\"00000000-0000-0000-0000-00000000\""), - // Properties: &armnetwork.LoadBalancerPropertiesFormat{ - // BackendAddressPools: []*armnetwork.BackendAddressPool{ - // { - // ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/loadBalancers/lb/backendAddressPools/be-lb"), - // Name: to.Ptr("be-lb"), - // Type: to.Ptr("Microsoft.Network/loadBalancers/backendAddressPools"), - // Etag: to.Ptr("W/\"00000000-0000-0000-0000-00000000\""), - // Properties: &armnetwork.BackendAddressPoolPropertiesFormat{ - // LoadBalancingRules: []*armnetwork.SubResource{ - // { - // ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/loadBalancers/lb/loadBalancingRules/rulelb"), - // }}, - // ProvisioningState: to.Ptr(armnetwork.ProvisioningStateSucceeded), - // TunnelInterfaces: []*armnetwork.GatewayLoadBalancerTunnelInterface{ - // { - // Type: to.Ptr(armnetwork.GatewayLoadBalancerTunnelInterfaceTypeInternal), - // Identifier: to.Ptr[int32](900), - // Port: to.Ptr[int32](15000), - // Protocol: to.Ptr(armnetwork.GatewayLoadBalancerTunnelProtocolVXLAN), - // }, - // { - // Type: to.Ptr(armnetwork.GatewayLoadBalancerTunnelInterfaceTypeInternal), - // Identifier: to.Ptr[int32](901), - // Port: to.Ptr[int32](15001), - // Protocol: to.Ptr(armnetwork.GatewayLoadBalancerTunnelProtocolVXLAN), - // }}, - // }, - // }}, - // FrontendIPConfigurations: []*armnetwork.FrontendIPConfiguration{ - // { - // ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/loadBalancers/lb/frontendIPConfigurations/fe-lb"), - // Name: to.Ptr("fe-lb"), - // Type: to.Ptr("Microsoft.Network/loadBalancers/frontendIPConfigurations"), - // Etag: to.Ptr("W/\"00000000-0000-0000-0000-00000000\""), - // Properties: &armnetwork.FrontendIPConfigurationPropertiesFormat{ - // InboundNatRules: []*armnetwork.SubResource{ - // { - // ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/loadBalancers/lb/inboundNatRules/in-nat-rule"), - // }}, - // LoadBalancingRules: []*armnetwork.SubResource{ - // { - // ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/loadBalancers/lb/loadBalancingRules/rulelb"), - // }}, - // PrivateIPAddress: to.Ptr("10.0.1.4"), - // PrivateIPAllocationMethod: to.Ptr(armnetwork.IPAllocationMethodDynamic), - // ProvisioningState: to.Ptr(armnetwork.ProvisioningStateSucceeded), - // Subnet: &armnetwork.Subnet{ - // ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/virtualNetworks/vnetlb/subnets/subnetlb"), - // }, - // }, - // }}, - // InboundNatPools: []*armnetwork.InboundNatPool{ - // }, - // LoadBalancingRules: []*armnetwork.LoadBalancingRule{ - // { - // ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/loadBalancers/lb/loadBalancingRules/rulelb"), - // Name: to.Ptr("rulelb"), - // Type: to.Ptr("Microsoft.Network/loadBalancers/loadBalancingRules"), - // Etag: to.Ptr("W/\"00000000-0000-0000-0000-00000000\""), - // Properties: &armnetwork.LoadBalancingRulePropertiesFormat{ - // BackendAddressPools: []*armnetwork.SubResource{ - // { - // ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/loadBalancers/lb/backendAddressPools/be-lb"), - // }}, - // BackendPort: to.Ptr[int32](80), - // DisableOutboundSnat: to.Ptr(false), - // EnableFloatingIP: to.Ptr(true), - // FrontendIPConfiguration: &armnetwork.SubResource{ - // ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/loadBalancers/lb/frontendIPConfigurations/fe-lb"), - // }, - // FrontendPort: to.Ptr[int32](80), - // IdleTimeoutInMinutes: to.Ptr[int32](15), - // LoadDistribution: to.Ptr(armnetwork.LoadDistributionDefault), - // Probe: &armnetwork.SubResource{ - // ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/loadBalancers/lb/probes/probe-lb"), - // }, - // ProvisioningState: to.Ptr(armnetwork.ProvisioningStateSucceeded), - // Protocol: to.Ptr(armnetwork.TransportProtocolTCP), - // }, - // }}, - // OutboundRules: []*armnetwork.OutboundRule{ - // }, - // Probes: []*armnetwork.Probe{ - // { - // ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/loadBalancers/lb/probes/probe-lb"), - // Name: to.Ptr("probe-lb"), - // Type: to.Ptr("Microsoft.Network/loadBalancers/probes"), - // Etag: to.Ptr("W/\"00000000-0000-0000-0000-00000000\""), - // Properties: &armnetwork.ProbePropertiesFormat{ - // IntervalInSeconds: to.Ptr[int32](15), - // LoadBalancingRules: []*armnetwork.SubResource{ - // { - // ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/loadBalancers/lb/loadBalancingRules/rulelb"), - // }}, - // NumberOfProbes: to.Ptr[int32](2), - // Port: to.Ptr[int32](80), - // ProbeThreshold: to.Ptr[int32](1), - // ProvisioningState: to.Ptr(armnetwork.ProvisioningStateSucceeded), - // RequestPath: to.Ptr("healthcheck.aspx"), - // Protocol: to.Ptr(armnetwork.ProbeProtocolHTTP), - // }, - // }}, - // ProvisioningState: to.Ptr(armnetwork.ProvisioningStateSucceeded), - // ResourceGUID: to.Ptr("00000000-0000-0000-0000-00000000"), - // }, - // SKU: &armnetwork.LoadBalancerSKU{ - // Name: to.Ptr(armnetwork.LoadBalancerSKUNameGateway), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/4883fa5dbf6f2c9093fac8ce334547e9dfac68fa/specification/network/resource-manager/Microsoft.Network/stable/2024-03-01/examples/LoadBalancerCreateGatewayLoadBalancerProviderWithTwoBackendPool.json -func ExampleLoadBalancersClient_BeginCreateOrUpdate_createLoadBalancerWithGatewayLoadBalancerProviderConfiguredWithTwoBackendPool() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armnetwork.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewLoadBalancersClient().BeginCreateOrUpdate(ctx, "rg1", "lb", armnetwork.LoadBalancer{ - Location: to.Ptr("eastus"), - Properties: &armnetwork.LoadBalancerPropertiesFormat{ - BackendAddressPools: []*armnetwork.BackendAddressPool{ - { - Name: to.Ptr("be-lb1"), - Properties: &armnetwork.BackendAddressPoolPropertiesFormat{}, - }, - { - Name: to.Ptr("be-lb2"), - Properties: &armnetwork.BackendAddressPoolPropertiesFormat{}, - }}, - FrontendIPConfigurations: []*armnetwork.FrontendIPConfiguration{ - { - Name: to.Ptr("fe-lb"), - Properties: &armnetwork.FrontendIPConfigurationPropertiesFormat{ - Subnet: &armnetwork.Subnet{ - ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/virtualNetworks/vnetlb/subnets/subnetlb"), - }, - }, - }}, - InboundNatPools: []*armnetwork.InboundNatPool{}, - LoadBalancingRules: []*armnetwork.LoadBalancingRule{ - { - Name: to.Ptr("rulelb"), - Properties: &armnetwork.LoadBalancingRulePropertiesFormat{ - BackendAddressPool: &armnetwork.SubResource{}, - BackendAddressPools: []*armnetwork.SubResource{ - { - ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/loadBalancers/lb/backendAddressPools/be-lb1"), - }, - { - ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/loadBalancers/lb/backendAddressPools/be-lb2"), - }}, - BackendPort: to.Ptr[int32](0), - EnableFloatingIP: to.Ptr(true), - FrontendIPConfiguration: &armnetwork.SubResource{ - ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/loadBalancers/lb/frontendIPConfigurations/fe-lb"), - }, - FrontendPort: to.Ptr[int32](0), - IdleTimeoutInMinutes: to.Ptr[int32](15), - LoadDistribution: to.Ptr(armnetwork.LoadDistributionDefault), - Probe: &armnetwork.SubResource{ - ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/loadBalancers/lb/probes/probe-lb"), - }, - Protocol: to.Ptr(armnetwork.TransportProtocolAll), - }, - }}, - OutboundRules: []*armnetwork.OutboundRule{}, - Probes: []*armnetwork.Probe{ - { - Name: to.Ptr("probe-lb"), - Properties: &armnetwork.ProbePropertiesFormat{ - IntervalInSeconds: to.Ptr[int32](15), - NumberOfProbes: to.Ptr[int32](2), - Port: to.Ptr[int32](80), - ProbeThreshold: to.Ptr[int32](1), - RequestPath: to.Ptr("healthcheck.aspx"), - Protocol: to.Ptr(armnetwork.ProbeProtocolHTTP), - }, - }}, - }, - SKU: &armnetwork.LoadBalancerSKU{ - Name: to.Ptr(armnetwork.LoadBalancerSKUNameGateway), - }, - }, nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - res, err := poller.PollUntilDone(ctx, nil) - if err != nil { - log.Fatalf("failed to pull the result: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.LoadBalancer = armnetwork.LoadBalancer{ - // Name: to.Ptr("lb"), - // Type: to.Ptr("Microsoft.Network/loadBalancers"), - // ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/loadBalancers/lb"), - // Location: to.Ptr("eastus"), - // Etag: to.Ptr("W/\"00000000-0000-0000-0000-00000000\""), - // Properties: &armnetwork.LoadBalancerPropertiesFormat{ - // BackendAddressPools: []*armnetwork.BackendAddressPool{ - // { - // ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/loadBalancers/lb/backendAddressPools/be-lb1"), - // Name: to.Ptr("be-lb1"), - // Type: to.Ptr("Microsoft.Network/loadBalancers/backendAddressPools"), - // Etag: to.Ptr("W/\"00000000-0000-0000-0000-00000000\""), - // Properties: &armnetwork.BackendAddressPoolPropertiesFormat{ - // LoadBalancingRules: []*armnetwork.SubResource{ - // { - // ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/loadBalancers/lb/loadBalancingRules/rulelb"), - // }}, - // ProvisioningState: to.Ptr(armnetwork.ProvisioningStateSucceeded), - // TunnelInterfaces: []*armnetwork.GatewayLoadBalancerTunnelInterface{ - // { - // Type: to.Ptr(armnetwork.GatewayLoadBalancerTunnelInterfaceTypeInternal), - // Identifier: to.Ptr[int32](900), - // Port: to.Ptr[int32](15000), - // Protocol: to.Ptr(armnetwork.GatewayLoadBalancerTunnelProtocolVXLAN), - // }}, - // }, - // }, - // { - // ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/loadBalancers/lb/backendAddressPools/be-lb2"), - // Name: to.Ptr("be-lb2"), - // Type: to.Ptr("Microsoft.Network/loadBalancers/backendAddressPools"), - // Etag: to.Ptr("W/\"00000000-0000-0000-0000-00000000\""), - // Properties: &armnetwork.BackendAddressPoolPropertiesFormat{ - // LoadBalancingRules: []*armnetwork.SubResource{ - // { - // ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/loadBalancers/lb/loadBalancingRules/rulelb"), - // }}, - // ProvisioningState: to.Ptr(armnetwork.ProvisioningStateSucceeded), - // TunnelInterfaces: []*armnetwork.GatewayLoadBalancerTunnelInterface{ - // { - // Type: to.Ptr(armnetwork.GatewayLoadBalancerTunnelInterfaceTypeInternal), - // Identifier: to.Ptr[int32](901), - // Port: to.Ptr[int32](15001), - // Protocol: to.Ptr(armnetwork.GatewayLoadBalancerTunnelProtocolVXLAN), - // }}, - // }, - // }}, - // FrontendIPConfigurations: []*armnetwork.FrontendIPConfiguration{ - // { - // ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/loadBalancers/lb/frontendIPConfigurations/fe-lb"), - // Name: to.Ptr("fe-lb"), - // Type: to.Ptr("Microsoft.Network/loadBalancers/frontendIPConfigurations"), - // Etag: to.Ptr("W/\"00000000-0000-0000-0000-00000000\""), - // Properties: &armnetwork.FrontendIPConfigurationPropertiesFormat{ - // InboundNatRules: []*armnetwork.SubResource{ - // { - // ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/loadBalancers/lb/inboundNatRules/in-nat-rule"), - // }}, - // LoadBalancingRules: []*armnetwork.SubResource{ - // { - // ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/loadBalancers/lb/loadBalancingRules/rulelb"), - // }}, - // PrivateIPAddress: to.Ptr("10.0.1.4"), - // PrivateIPAllocationMethod: to.Ptr(armnetwork.IPAllocationMethodDynamic), - // ProvisioningState: to.Ptr(armnetwork.ProvisioningStateSucceeded), - // Subnet: &armnetwork.Subnet{ - // ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/virtualNetworks/vnetlb/subnets/subnetlb"), - // }, - // }, - // }}, - // InboundNatPools: []*armnetwork.InboundNatPool{ - // }, - // LoadBalancingRules: []*armnetwork.LoadBalancingRule{ - // { - // ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/loadBalancers/lb/loadBalancingRules/rulelb"), - // Name: to.Ptr("rulelb"), - // Type: to.Ptr("Microsoft.Network/loadBalancers/loadBalancingRules"), - // Etag: to.Ptr("W/\"00000000-0000-0000-0000-00000000\""), - // Properties: &armnetwork.LoadBalancingRulePropertiesFormat{ - // BackendAddressPools: []*armnetwork.SubResource{ - // { - // ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/loadBalancers/lb/backendAddressPools/be-lb1"), - // }, - // { - // ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/loadBalancers/lb/backendAddressPools/be-lb2"), - // }}, - // BackendPort: to.Ptr[int32](0), - // DisableOutboundSnat: to.Ptr(false), - // EnableFloatingIP: to.Ptr(true), - // FrontendIPConfiguration: &armnetwork.SubResource{ - // ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/loadBalancers/lb/frontendIPConfigurations/fe-lb"), - // }, - // FrontendPort: to.Ptr[int32](0), - // IdleTimeoutInMinutes: to.Ptr[int32](15), - // LoadDistribution: to.Ptr(armnetwork.LoadDistributionDefault), - // Probe: &armnetwork.SubResource{ - // ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/loadBalancers/lb/probes/probe-lb"), - // }, - // ProvisioningState: to.Ptr(armnetwork.ProvisioningStateSucceeded), - // Protocol: to.Ptr(armnetwork.TransportProtocolTCP), - // }, - // }}, - // OutboundRules: []*armnetwork.OutboundRule{ - // }, - // Probes: []*armnetwork.Probe{ - // { - // ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/loadBalancers/lb/probes/probe-lb"), - // Name: to.Ptr("probe-lb"), - // Type: to.Ptr("Microsoft.Network/loadBalancers/probes"), - // Etag: to.Ptr("W/\"00000000-0000-0000-0000-00000000\""), - // Properties: &armnetwork.ProbePropertiesFormat{ - // IntervalInSeconds: to.Ptr[int32](15), - // LoadBalancingRules: []*armnetwork.SubResource{ - // { - // ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/loadBalancers/lb/loadBalancingRules/rulelb"), - // }}, - // NumberOfProbes: to.Ptr[int32](2), - // Port: to.Ptr[int32](80), - // ProbeThreshold: to.Ptr[int32](1), - // ProvisioningState: to.Ptr(armnetwork.ProvisioningStateSucceeded), - // RequestPath: to.Ptr("healthcheck.aspx"), - // Protocol: to.Ptr(armnetwork.ProbeProtocolHTTP), - // }, - // }}, - // ProvisioningState: to.Ptr(armnetwork.ProvisioningStateSucceeded), - // ResourceGUID: to.Ptr("00000000-0000-0000-0000-00000000"), - // }, - // SKU: &armnetwork.LoadBalancerSKU{ - // Name: to.Ptr(armnetwork.LoadBalancerSKUNameGateway), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/4883fa5dbf6f2c9093fac8ce334547e9dfac68fa/specification/network/resource-manager/Microsoft.Network/stable/2024-03-01/examples/LoadBalancerCreateGlobalTier.json -func ExampleLoadBalancersClient_BeginCreateOrUpdate_createLoadBalancerWithGlobalTierAndOneRegionalLoadBalancerInItsBackendPool() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armnetwork.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewLoadBalancersClient().BeginCreateOrUpdate(ctx, "rg1", "lb", armnetwork.LoadBalancer{ - Location: to.Ptr("eastus"), - Properties: &armnetwork.LoadBalancerPropertiesFormat{ - BackendAddressPools: []*armnetwork.BackendAddressPool{ - { - Name: to.Ptr("be-lb"), - Properties: &armnetwork.BackendAddressPoolPropertiesFormat{ - LoadBalancerBackendAddresses: []*armnetwork.LoadBalancerBackendAddress{ - { - Name: to.Ptr("regional-lb1-address"), - Properties: &armnetwork.LoadBalancerBackendAddressPropertiesFormat{ - LoadBalancerFrontendIPConfiguration: &armnetwork.SubResource{ - ID: to.Ptr("/subscriptions/subid/resourceGroups/regional-lb-rg1/providers/Microsoft.Network/loadBalancers/regional-lb/frontendIPConfigurations/fe-rlb"), - }, - }, - }}, - }, - }}, - FrontendIPConfigurations: []*armnetwork.FrontendIPConfiguration{ - { - Name: to.Ptr("fe-lb"), - Properties: &armnetwork.FrontendIPConfigurationPropertiesFormat{ - Subnet: &armnetwork.Subnet{ - ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/virtualNetworks/vnetlb/subnets/subnetlb"), - }, - }, - }}, - LoadBalancingRules: []*armnetwork.LoadBalancingRule{ - { - Name: to.Ptr("rulelb"), - Properties: &armnetwork.LoadBalancingRulePropertiesFormat{ - BackendAddressPool: &armnetwork.SubResource{ - ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/loadBalancers/lb/backendAddressPools/be-lb"), - }, - BackendPort: to.Ptr[int32](80), - EnableFloatingIP: to.Ptr(false), - FrontendIPConfiguration: &armnetwork.SubResource{ - ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/loadBalancers/lb/frontendIPConfigurations/fe-lb"), - }, - FrontendPort: to.Ptr[int32](80), - IdleTimeoutInMinutes: to.Ptr[int32](15), - LoadDistribution: to.Ptr(armnetwork.LoadDistributionDefault), - Probe: &armnetwork.SubResource{ - ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/loadBalancers/lb/probes/probe-lb"), - }, - Protocol: to.Ptr(armnetwork.TransportProtocolTCP), - }, - }}, - Probes: []*armnetwork.Probe{ - { - Name: to.Ptr("probe-lb"), - Properties: &armnetwork.ProbePropertiesFormat{ - IntervalInSeconds: to.Ptr[int32](15), - NumberOfProbes: to.Ptr[int32](2), - Port: to.Ptr[int32](80), - ProbeThreshold: to.Ptr[int32](1), - RequestPath: to.Ptr("healthcheck.aspx"), - Protocol: to.Ptr(armnetwork.ProbeProtocolHTTP), - }, - }}, - }, - SKU: &armnetwork.LoadBalancerSKU{ - Name: to.Ptr(armnetwork.LoadBalancerSKUNameStandard), - Tier: to.Ptr(armnetwork.LoadBalancerSKUTierGlobal), - }, - }, nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - res, err := poller.PollUntilDone(ctx, nil) - if err != nil { - log.Fatalf("failed to pull the result: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.LoadBalancer = armnetwork.LoadBalancer{ - // Name: to.Ptr("lb"), - // Type: to.Ptr("Microsoft.Network/loadBalancers"), - // ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/loadBalancers/lb"), - // Location: to.Ptr("eastus"), - // Etag: to.Ptr("W/\"00000000-0000-0000-0000-00000000\""), - // Properties: &armnetwork.LoadBalancerPropertiesFormat{ - // BackendAddressPools: []*armnetwork.BackendAddressPool{ - // { - // ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/loadBalancers/lb/backendAddressPools/be-lb"), - // Name: to.Ptr("be-lb"), - // Type: to.Ptr("Microsoft.Network/loadBalancers/backendAddressPools"), - // Etag: to.Ptr("W/\"00000000-0000-0000-0000-00000000\""), - // Properties: &armnetwork.BackendAddressPoolPropertiesFormat{ - // LoadBalancerBackendAddresses: []*armnetwork.LoadBalancerBackendAddress{ - // { - // Name: to.Ptr("regional-lb1-address"), - // Properties: &armnetwork.LoadBalancerBackendAddressPropertiesFormat{ - // LoadBalancerFrontendIPConfiguration: &armnetwork.SubResource{ - // ID: to.Ptr("/subscriptions/subid/resourceGroups/regional-lb-rg1/providers/Microsoft.Network/loadBalancers/regional-lb/frontendIPConfigurations/fe-rlb"), - // }, - // }, - // }}, - // LoadBalancingRules: []*armnetwork.SubResource{ - // { - // ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/loadBalancers/lb/loadBalancingRules/rulelb"), - // }}, - // ProvisioningState: to.Ptr(armnetwork.ProvisioningStateSucceeded), - // }, - // }}, - // FrontendIPConfigurations: []*armnetwork.FrontendIPConfiguration{ - // { - // ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/loadBalancers/lb/frontendIPConfigurations/fe-lb"), - // Name: to.Ptr("fe-lb"), - // Type: to.Ptr("Microsoft.Network/loadBalancers/frontendIPConfigurations"), - // Etag: to.Ptr("W/\"00000000-0000-0000-0000-00000000\""), - // Properties: &armnetwork.FrontendIPConfigurationPropertiesFormat{ - // InboundNatRules: []*armnetwork.SubResource{ - // { - // ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/loadBalancers/lb/inboundNatRules/in-nat-rule"), - // }}, - // LoadBalancingRules: []*armnetwork.SubResource{ - // { - // ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/loadBalancers/lb/loadBalancingRules/rulelb"), - // }}, - // PrivateIPAddress: to.Ptr("10.0.1.4"), - // PrivateIPAllocationMethod: to.Ptr(armnetwork.IPAllocationMethodDynamic), - // ProvisioningState: to.Ptr(armnetwork.ProvisioningStateSucceeded), - // Subnet: &armnetwork.Subnet{ - // ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/virtualNetworks/vnetlb/subnets/subnetlb"), - // }, - // }, - // }}, - // LoadBalancingRules: []*armnetwork.LoadBalancingRule{ - // { - // ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/loadBalancers/lb/loadBalancingRules/rulelb"), - // Name: to.Ptr("rulelb"), - // Type: to.Ptr("Microsoft.Network/loadBalancers/loadBalancingRules"), - // Etag: to.Ptr("W/\"00000000-0000-0000-0000-00000000\""), - // Properties: &armnetwork.LoadBalancingRulePropertiesFormat{ - // BackendAddressPool: &armnetwork.SubResource{ - // ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/loadBalancers/lb/backendAddressPools/be-lb"), - // }, - // BackendPort: to.Ptr[int32](80), - // DisableOutboundSnat: to.Ptr(false), - // EnableFloatingIP: to.Ptr(false), - // FrontendIPConfiguration: &armnetwork.SubResource{ - // ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/loadBalancers/lb/frontendIPConfigurations/fe-lb"), - // }, - // FrontendPort: to.Ptr[int32](80), - // IdleTimeoutInMinutes: to.Ptr[int32](15), - // LoadDistribution: to.Ptr(armnetwork.LoadDistributionDefault), - // Probe: &armnetwork.SubResource{ - // ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/loadBalancers/lb/probes/probe-lb"), - // }, - // ProvisioningState: to.Ptr(armnetwork.ProvisioningStateSucceeded), - // Protocol: to.Ptr(armnetwork.TransportProtocolTCP), - // }, - // }}, - // Probes: []*armnetwork.Probe{ - // { - // ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/loadBalancers/lb/probes/probe-lb"), - // Name: to.Ptr("probe-lb"), - // Type: to.Ptr("Microsoft.Network/loadBalancers/probes"), - // Etag: to.Ptr("W/\"00000000-0000-0000-0000-00000000\""), - // Properties: &armnetwork.ProbePropertiesFormat{ - // IntervalInSeconds: to.Ptr[int32](15), - // LoadBalancingRules: []*armnetwork.SubResource{ - // { - // ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/loadBalancers/lb/loadBalancingRules/rulelb"), - // }}, - // NumberOfProbes: to.Ptr[int32](2), - // Port: to.Ptr[int32](80), - // ProbeThreshold: to.Ptr[int32](1), - // ProvisioningState: to.Ptr(armnetwork.ProvisioningStateSucceeded), - // RequestPath: to.Ptr("healthcheck.aspx"), - // Protocol: to.Ptr(armnetwork.ProbeProtocolHTTP), - // }, - // }}, - // ProvisioningState: to.Ptr(armnetwork.ProvisioningStateSucceeded), - // ResourceGUID: to.Ptr("00000000-0000-0000-0000-00000000"), - // }, - // SKU: &armnetwork.LoadBalancerSKU{ - // Name: to.Ptr(armnetwork.LoadBalancerSKUNameStandard), - // Tier: to.Ptr(armnetwork.LoadBalancerSKUTierGlobal), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/4883fa5dbf6f2c9093fac8ce334547e9dfac68fa/specification/network/resource-manager/Microsoft.Network/stable/2024-03-01/examples/LoadBalancerCreateStandardSku.json -func ExampleLoadBalancersClient_BeginCreateOrUpdate_createLoadBalancerWithStandardSku() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armnetwork.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewLoadBalancersClient().BeginCreateOrUpdate(ctx, "rg1", "lb", armnetwork.LoadBalancer{ - Location: to.Ptr("eastus"), - Properties: &armnetwork.LoadBalancerPropertiesFormat{ - BackendAddressPools: []*armnetwork.BackendAddressPool{ - { - Name: to.Ptr("be-lb"), - Properties: &armnetwork.BackendAddressPoolPropertiesFormat{}, - }}, - FrontendIPConfigurations: []*armnetwork.FrontendIPConfiguration{ - { - Name: to.Ptr("fe-lb"), - Properties: &armnetwork.FrontendIPConfigurationPropertiesFormat{ - Subnet: &armnetwork.Subnet{ - ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/virtualNetworks/vnetlb/subnets/subnetlb"), - }, - }, - }}, - InboundNatPools: []*armnetwork.InboundNatPool{}, - InboundNatRules: []*armnetwork.InboundNatRule{ - { - Name: to.Ptr("in-nat-rule"), - Properties: &armnetwork.InboundNatRulePropertiesFormat{ - BackendPort: to.Ptr[int32](3389), - EnableFloatingIP: to.Ptr(true), - FrontendIPConfiguration: &armnetwork.SubResource{ - ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/loadBalancers/lb/frontendIPConfigurations/fe-lb"), - }, - FrontendPort: to.Ptr[int32](3389), - IdleTimeoutInMinutes: to.Ptr[int32](15), - Protocol: to.Ptr(armnetwork.TransportProtocolTCP), - }, - }}, - LoadBalancingRules: []*armnetwork.LoadBalancingRule{ - { - Name: to.Ptr("rulelb"), - Properties: &armnetwork.LoadBalancingRulePropertiesFormat{ - BackendAddressPool: &armnetwork.SubResource{ - ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/loadBalancers/lb/backendAddressPools/be-lb"), - }, - BackendPort: to.Ptr[int32](80), - EnableFloatingIP: to.Ptr(true), - FrontendIPConfiguration: &armnetwork.SubResource{ - ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/loadBalancers/lb/frontendIPConfigurations/fe-lb"), - }, - FrontendPort: to.Ptr[int32](80), - IdleTimeoutInMinutes: to.Ptr[int32](15), - LoadDistribution: to.Ptr(armnetwork.LoadDistributionDefault), - Probe: &armnetwork.SubResource{ - ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/loadBalancers/lb/probes/probe-lb"), - }, - Protocol: to.Ptr(armnetwork.TransportProtocolTCP), - }, - }}, - OutboundRules: []*armnetwork.OutboundRule{}, - Probes: []*armnetwork.Probe{ - { - Name: to.Ptr("probe-lb"), - Properties: &armnetwork.ProbePropertiesFormat{ - IntervalInSeconds: to.Ptr[int32](15), - NumberOfProbes: to.Ptr[int32](2), - Port: to.Ptr[int32](80), - ProbeThreshold: to.Ptr[int32](1), - RequestPath: to.Ptr("healthcheck.aspx"), - Protocol: to.Ptr(armnetwork.ProbeProtocolHTTP), - }, - }}, - }, - SKU: &armnetwork.LoadBalancerSKU{ - Name: to.Ptr(armnetwork.LoadBalancerSKUNameStandard), - }, - }, nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - res, err := poller.PollUntilDone(ctx, nil) - if err != nil { - log.Fatalf("failed to pull the result: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.LoadBalancer = armnetwork.LoadBalancer{ - // Name: to.Ptr("lb"), - // Type: to.Ptr("Microsoft.Network/loadBalancers"), - // ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/loadBalancers/lb"), - // Location: to.Ptr("eastus"), - // Etag: to.Ptr("W/\"00000000-0000-0000-0000-00000000\""), - // Properties: &armnetwork.LoadBalancerPropertiesFormat{ - // BackendAddressPools: []*armnetwork.BackendAddressPool{ - // { - // ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/loadBalancers/lb/backendAddressPools/be-lb"), - // Name: to.Ptr("be-lb"), - // Type: to.Ptr("Microsoft.Network/loadBalancers/backendAddressPools"), - // Etag: to.Ptr("W/\"00000000-0000-0000-0000-00000000\""), - // Properties: &armnetwork.BackendAddressPoolPropertiesFormat{ - // LoadBalancingRules: []*armnetwork.SubResource{ - // { - // ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/loadBalancers/lb/loadBalancingRules/rulelb"), - // }}, - // ProvisioningState: to.Ptr(armnetwork.ProvisioningStateSucceeded), - // }, - // }}, - // FrontendIPConfigurations: []*armnetwork.FrontendIPConfiguration{ - // { - // ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/loadBalancers/lb/frontendIPConfigurations/fe-lb"), - // Name: to.Ptr("fe-lb"), - // Type: to.Ptr("Microsoft.Network/loadBalancers/frontendIPConfigurations"), - // Etag: to.Ptr("W/\"00000000-0000-0000-0000-00000000\""), - // Properties: &armnetwork.FrontendIPConfigurationPropertiesFormat{ - // InboundNatRules: []*armnetwork.SubResource{ - // { - // ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/loadBalancers/lb/inboundNatRules/in-nat-rule"), - // }}, - // LoadBalancingRules: []*armnetwork.SubResource{ - // { - // ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/loadBalancers/lb/loadBalancingRules/rulelb"), - // }}, - // PrivateIPAddress: to.Ptr("10.0.1.4"), - // PrivateIPAllocationMethod: to.Ptr(armnetwork.IPAllocationMethodDynamic), - // ProvisioningState: to.Ptr(armnetwork.ProvisioningStateSucceeded), - // Subnet: &armnetwork.Subnet{ - // ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/virtualNetworks/vnetlb/subnets/subnetlb"), - // }, - // }, - // }}, - // InboundNatPools: []*armnetwork.InboundNatPool{ - // }, - // InboundNatRules: []*armnetwork.InboundNatRule{ - // { - // ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/loadBalancers/lb/inboundNatRules/in-nat-rule"), - // Name: to.Ptr("in-nat-rule"), - // Type: to.Ptr("Microsoft.Network/loadBalancers/inboundNatRules"), - // Etag: to.Ptr("W/\"00000000-0000-0000-0000-00000000\""), - // Properties: &armnetwork.InboundNatRulePropertiesFormat{ - // BackendPort: to.Ptr[int32](3389), - // EnableFloatingIP: to.Ptr(true), - // FrontendIPConfiguration: &armnetwork.SubResource{ - // ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/loadBalancers/lb/frontendIPConfigurations/fe-lb"), - // }, - // FrontendPort: to.Ptr[int32](3389), - // IdleTimeoutInMinutes: to.Ptr[int32](15), - // ProvisioningState: to.Ptr(armnetwork.ProvisioningStateSucceeded), - // Protocol: to.Ptr(armnetwork.TransportProtocolTCP), - // }, - // }}, - // LoadBalancingRules: []*armnetwork.LoadBalancingRule{ - // { - // ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/loadBalancers/lb/loadBalancingRules/rulelb"), - // Name: to.Ptr("rulelb"), - // Type: to.Ptr("Microsoft.Network/loadBalancers/loadBalancingRules"), - // Etag: to.Ptr("W/\"00000000-0000-0000-0000-00000000\""), - // Properties: &armnetwork.LoadBalancingRulePropertiesFormat{ - // BackendAddressPool: &armnetwork.SubResource{ - // ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/loadBalancers/lb/backendAddressPools/be-lb"), - // }, - // BackendPort: to.Ptr[int32](80), - // DisableOutboundSnat: to.Ptr(false), - // EnableFloatingIP: to.Ptr(true), - // FrontendIPConfiguration: &armnetwork.SubResource{ - // ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/loadBalancers/lb/frontendIPConfigurations/fe-lb"), - // }, - // FrontendPort: to.Ptr[int32](80), - // IdleTimeoutInMinutes: to.Ptr[int32](15), - // LoadDistribution: to.Ptr(armnetwork.LoadDistributionDefault), - // Probe: &armnetwork.SubResource{ - // ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/loadBalancers/lb/probes/probe-lb"), - // }, - // ProvisioningState: to.Ptr(armnetwork.ProvisioningStateSucceeded), - // Protocol: to.Ptr(armnetwork.TransportProtocolTCP), - // }, - // }}, - // OutboundRules: []*armnetwork.OutboundRule{ - // }, - // Probes: []*armnetwork.Probe{ - // { - // ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/loadBalancers/lb/probes/probe-lb"), - // Name: to.Ptr("probe-lb"), - // Type: to.Ptr("Microsoft.Network/loadBalancers/probes"), - // Etag: to.Ptr("W/\"00000000-0000-0000-0000-00000000\""), - // Properties: &armnetwork.ProbePropertiesFormat{ - // IntervalInSeconds: to.Ptr[int32](15), - // LoadBalancingRules: []*armnetwork.SubResource{ - // { - // ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/loadBalancers/lb/loadBalancingRules/rulelb"), - // }}, - // NumberOfProbes: to.Ptr[int32](2), - // Port: to.Ptr[int32](80), - // ProbeThreshold: to.Ptr[int32](1), - // ProvisioningState: to.Ptr(armnetwork.ProvisioningStateSucceeded), - // RequestPath: to.Ptr("healthcheck.aspx"), - // Protocol: to.Ptr(armnetwork.ProbeProtocolHTTP), - // }, - // }}, - // ProvisioningState: to.Ptr(armnetwork.ProvisioningStateSucceeded), - // ResourceGUID: to.Ptr("00000000-0000-0000-0000-00000000"), - // }, - // SKU: &armnetwork.LoadBalancerSKU{ - // Name: to.Ptr(armnetwork.LoadBalancerSKUNameStandard), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/4883fa5dbf6f2c9093fac8ce334547e9dfac68fa/specification/network/resource-manager/Microsoft.Network/stable/2024-03-01/examples/LoadBalancerCreateWithSyncModePropertyOnPool.json -func ExampleLoadBalancersClient_BeginCreateOrUpdate_createLoadBalancerWithSyncModePropertyOnPool() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armnetwork.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewLoadBalancersClient().BeginCreateOrUpdate(ctx, "rg1", "lb", armnetwork.LoadBalancer{ - Location: to.Ptr("eastus"), - Properties: &armnetwork.LoadBalancerPropertiesFormat{ - BackendAddressPools: []*armnetwork.BackendAddressPool{ - { - Name: to.Ptr("be-lb"), - Properties: &armnetwork.BackendAddressPoolPropertiesFormat{ - SyncMode: to.Ptr(armnetwork.SyncModeAutomatic), - VirtualNetwork: &armnetwork.SubResource{ - ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/virtualNetworks/vnetlb"), - }, - }, - }}, - FrontendIPConfigurations: []*armnetwork.FrontendIPConfiguration{ - { - Name: to.Ptr("fe-lb"), - Properties: &armnetwork.FrontendIPConfigurationPropertiesFormat{ - Subnet: &armnetwork.Subnet{ - ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/virtualNetworks/vnetlb/subnets/subnetlb"), - }, - }, - }}, - InboundNatPools: []*armnetwork.InboundNatPool{}, - InboundNatRules: []*armnetwork.InboundNatRule{ - { - Name: to.Ptr("in-nat-rule"), - Properties: &armnetwork.InboundNatRulePropertiesFormat{ - BackendPort: to.Ptr[int32](3389), - EnableFloatingIP: to.Ptr(true), - FrontendIPConfiguration: &armnetwork.SubResource{ - ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/loadBalancers/lb/frontendIPConfigurations/fe-lb"), - }, - FrontendPort: to.Ptr[int32](3389), - IdleTimeoutInMinutes: to.Ptr[int32](15), - Protocol: to.Ptr(armnetwork.TransportProtocolTCP), - }, - }}, - LoadBalancingRules: []*armnetwork.LoadBalancingRule{ - { - Name: to.Ptr("rulelb"), - Properties: &armnetwork.LoadBalancingRulePropertiesFormat{ - BackendAddressPool: &armnetwork.SubResource{ - ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/loadBalancers/lb/backendAddressPools/be-lb"), - }, - BackendPort: to.Ptr[int32](80), - EnableFloatingIP: to.Ptr(true), - FrontendIPConfiguration: &armnetwork.SubResource{ - ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/loadBalancers/lb/frontendIPConfigurations/fe-lb"), - }, - FrontendPort: to.Ptr[int32](80), - IdleTimeoutInMinutes: to.Ptr[int32](15), - LoadDistribution: to.Ptr(armnetwork.LoadDistributionDefault), - Probe: &armnetwork.SubResource{ - ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/loadBalancers/lb/probes/probe-lb"), - }, - Protocol: to.Ptr(armnetwork.TransportProtocolTCP), - }, - }}, - OutboundRules: []*armnetwork.OutboundRule{}, - Probes: []*armnetwork.Probe{ - { - Name: to.Ptr("probe-lb"), - Properties: &armnetwork.ProbePropertiesFormat{ - IntervalInSeconds: to.Ptr[int32](15), - NumberOfProbes: to.Ptr[int32](2), - Port: to.Ptr[int32](80), - ProbeThreshold: to.Ptr[int32](1), - RequestPath: to.Ptr("healthcheck.aspx"), - Protocol: to.Ptr(armnetwork.ProbeProtocolHTTP), - }, - }}, - }, - SKU: &armnetwork.LoadBalancerSKU{ - Name: to.Ptr(armnetwork.LoadBalancerSKUNameStandard), - }, - }, nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - res, err := poller.PollUntilDone(ctx, nil) - if err != nil { - log.Fatalf("failed to pull the result: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.LoadBalancer = armnetwork.LoadBalancer{ - // Name: to.Ptr("lb"), - // Type: to.Ptr("Microsoft.Network/loadBalancers"), - // ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/loadBalancers/lb"), - // Location: to.Ptr("eastus"), - // Etag: to.Ptr("W/\"00000000-0000-0000-0000-00000000\""), - // Properties: &armnetwork.LoadBalancerPropertiesFormat{ - // BackendAddressPools: []*armnetwork.BackendAddressPool{ - // { - // ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/loadBalancers/lb/backendAddressPools/be-lb"), - // Name: to.Ptr("be-lb"), - // Type: to.Ptr("Microsoft.Network/loadBalancers/backendAddressPools"), - // Etag: to.Ptr("W/\"00000000-0000-0000-0000-00000000\""), - // Properties: &armnetwork.BackendAddressPoolPropertiesFormat{ - // LoadBalancingRules: []*armnetwork.SubResource{ - // { - // ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/loadBalancers/lb/loadBalancingRules/rulelb"), - // }}, - // ProvisioningState: to.Ptr(armnetwork.ProvisioningStateSucceeded), - // SyncMode: to.Ptr(armnetwork.SyncModeAutomatic), - // VirtualNetwork: &armnetwork.SubResource{ - // ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/virtualNetworks/vnetlb"), - // }, - // }, - // }}, - // FrontendIPConfigurations: []*armnetwork.FrontendIPConfiguration{ - // { - // ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/loadBalancers/lb/frontendIPConfigurations/fe-lb"), - // Name: to.Ptr("fe-lb"), - // Type: to.Ptr("Microsoft.Network/loadBalancers/frontendIPConfigurations"), - // Etag: to.Ptr("W/\"00000000-0000-0000-0000-00000000\""), - // Properties: &armnetwork.FrontendIPConfigurationPropertiesFormat{ - // InboundNatRules: []*armnetwork.SubResource{ - // { - // ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/loadBalancers/lb/inboundNatRules/in-nat-rule"), - // }}, - // LoadBalancingRules: []*armnetwork.SubResource{ - // { - // ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/loadBalancers/lb/loadBalancingRules/rulelb"), - // }}, - // PrivateIPAddress: to.Ptr("10.0.1.4"), - // PrivateIPAllocationMethod: to.Ptr(armnetwork.IPAllocationMethodDynamic), - // ProvisioningState: to.Ptr(armnetwork.ProvisioningStateSucceeded), - // Subnet: &armnetwork.Subnet{ - // ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/virtualNetworks/vnetlb/subnets/subnetlb"), - // }, - // }, - // }}, - // InboundNatPools: []*armnetwork.InboundNatPool{ - // }, - // InboundNatRules: []*armnetwork.InboundNatRule{ - // { - // ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/loadBalancers/lb/inboundNatRules/in-nat-rule"), - // Name: to.Ptr("in-nat-rule"), - // Type: to.Ptr("Microsoft.Network/loadBalancers/inboundNatRules"), - // Etag: to.Ptr("W/\"00000000-0000-0000-0000-00000000\""), - // Properties: &armnetwork.InboundNatRulePropertiesFormat{ - // BackendPort: to.Ptr[int32](3389), - // EnableFloatingIP: to.Ptr(true), - // FrontendIPConfiguration: &armnetwork.SubResource{ - // ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/loadBalancers/lb/frontendIPConfigurations/fe-lb"), - // }, - // FrontendPort: to.Ptr[int32](3389), - // IdleTimeoutInMinutes: to.Ptr[int32](15), - // ProvisioningState: to.Ptr(armnetwork.ProvisioningStateSucceeded), - // Protocol: to.Ptr(armnetwork.TransportProtocolTCP), - // }, - // }}, - // LoadBalancingRules: []*armnetwork.LoadBalancingRule{ - // { - // ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/loadBalancers/lb/loadBalancingRules/rulelb"), - // Name: to.Ptr("rulelb"), - // Type: to.Ptr("Microsoft.Network/loadBalancers/loadBalancingRules"), - // Etag: to.Ptr("W/\"00000000-0000-0000-0000-00000000\""), - // Properties: &armnetwork.LoadBalancingRulePropertiesFormat{ - // BackendAddressPool: &armnetwork.SubResource{ - // ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/loadBalancers/lb/backendAddressPools/be-lb"), - // }, - // BackendPort: to.Ptr[int32](80), - // DisableOutboundSnat: to.Ptr(false), - // EnableFloatingIP: to.Ptr(true), - // FrontendIPConfiguration: &armnetwork.SubResource{ - // ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/loadBalancers/lb/frontendIPConfigurations/fe-lb"), - // }, - // FrontendPort: to.Ptr[int32](80), - // IdleTimeoutInMinutes: to.Ptr[int32](15), - // LoadDistribution: to.Ptr(armnetwork.LoadDistributionDefault), - // Probe: &armnetwork.SubResource{ - // ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/loadBalancers/lb/probes/probe-lb"), - // }, - // ProvisioningState: to.Ptr(armnetwork.ProvisioningStateSucceeded), - // Protocol: to.Ptr(armnetwork.TransportProtocolTCP), - // }, - // }}, - // OutboundRules: []*armnetwork.OutboundRule{ - // }, - // Probes: []*armnetwork.Probe{ - // { - // ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/loadBalancers/lb/probes/probe-lb"), - // Name: to.Ptr("probe-lb"), - // Type: to.Ptr("Microsoft.Network/loadBalancers/probes"), - // Etag: to.Ptr("W/\"00000000-0000-0000-0000-00000000\""), - // Properties: &armnetwork.ProbePropertiesFormat{ - // IntervalInSeconds: to.Ptr[int32](15), - // LoadBalancingRules: []*armnetwork.SubResource{ - // { - // ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/loadBalancers/lb/loadBalancingRules/rulelb"), - // }}, - // NumberOfProbes: to.Ptr[int32](2), - // Port: to.Ptr[int32](80), - // ProbeThreshold: to.Ptr[int32](1), - // ProvisioningState: to.Ptr(armnetwork.ProvisioningStateSucceeded), - // RequestPath: to.Ptr("healthcheck.aspx"), - // Protocol: to.Ptr(armnetwork.ProbeProtocolHTTP), - // }, - // }}, - // ProvisioningState: to.Ptr(armnetwork.ProvisioningStateSucceeded), - // ResourceGUID: to.Ptr("00000000-0000-0000-0000-00000000"), - // }, - // SKU: &armnetwork.LoadBalancerSKU{ - // Name: to.Ptr(armnetwork.LoadBalancerSKUNameStandard), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/4883fa5dbf6f2c9093fac8ce334547e9dfac68fa/specification/network/resource-manager/Microsoft.Network/stable/2024-03-01/examples/LoadBalancerCreateWithInboundNatPool.json -func ExampleLoadBalancersClient_BeginCreateOrUpdate_createLoadBalancerWithInboundNatPool() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armnetwork.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewLoadBalancersClient().BeginCreateOrUpdate(ctx, "rg1", "lb", armnetwork.LoadBalancer{ - Location: to.Ptr("eastus"), - Properties: &armnetwork.LoadBalancerPropertiesFormat{ - BackendAddressPools: []*armnetwork.BackendAddressPool{}, - FrontendIPConfigurations: []*armnetwork.FrontendIPConfiguration{ - { - ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/loadBalancers/lb/frontendIPConfigurations/test"), - Name: to.Ptr("test"), - Properties: &armnetwork.FrontendIPConfigurationPropertiesFormat{ - PrivateIPAllocationMethod: to.Ptr(armnetwork.IPAllocationMethodDynamic), - Subnet: &armnetwork.Subnet{ - ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/virtualNetworks/lbvnet/subnets/lbsubnet"), - }, - }, - Zones: []*string{}, - }}, - InboundNatPools: []*armnetwork.InboundNatPool{ - { - ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/loadBalancers/lb/inboundNatPools/test"), - Name: to.Ptr("test"), - Properties: &armnetwork.InboundNatPoolPropertiesFormat{ - BackendPort: to.Ptr[int32](8888), - EnableFloatingIP: to.Ptr(true), - EnableTCPReset: to.Ptr(true), - FrontendIPConfiguration: &armnetwork.SubResource{ - ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/loadBalancers/lb/frontendIPConfigurations/test"), - }, - FrontendPortRangeEnd: to.Ptr[int32](8085), - FrontendPortRangeStart: to.Ptr[int32](8080), - IdleTimeoutInMinutes: to.Ptr[int32](10), - Protocol: to.Ptr(armnetwork.TransportProtocolTCP), - }, - }}, - InboundNatRules: []*armnetwork.InboundNatRule{}, - LoadBalancingRules: []*armnetwork.LoadBalancingRule{}, - OutboundRules: []*armnetwork.OutboundRule{}, - Probes: []*armnetwork.Probe{}, - }, - SKU: &armnetwork.LoadBalancerSKU{ - Name: to.Ptr(armnetwork.LoadBalancerSKUNameStandard), - }, - }, nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - res, err := poller.PollUntilDone(ctx, nil) - if err != nil { - log.Fatalf("failed to pull the result: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.LoadBalancer = armnetwork.LoadBalancer{ - // Name: to.Ptr("lb"), - // Type: to.Ptr("Microsoft.Network/loadBalancers"), - // ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/loadBalancers/lb"), - // Location: to.Ptr("eastus"), - // Etag: to.Ptr("W/\"00000000-0000-0000-0000-00000000\""), - // Properties: &armnetwork.LoadBalancerPropertiesFormat{ - // BackendAddressPools: []*armnetwork.BackendAddressPool{ - // }, - // FrontendIPConfigurations: []*armnetwork.FrontendIPConfiguration{ - // { - // ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/loadBalancers/lb/frontendIPConfigurations/test"), - // Name: to.Ptr("test"), - // Type: to.Ptr("Microsoft.Network/loadBalancers/frontendIPConfigurations"), - // Etag: to.Ptr("W/\"00000000-0000-0000-0000-00000000\""), - // Properties: &armnetwork.FrontendIPConfigurationPropertiesFormat{ - // InboundNatPools: []*armnetwork.SubResource{ - // { - // ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/loadBalancers/lb/inboundNatPools/test"), - // }}, - // PrivateIPAddress: to.Ptr("10.0.1.4"), - // PrivateIPAllocationMethod: to.Ptr(armnetwork.IPAllocationMethodDynamic), - // ProvisioningState: to.Ptr(armnetwork.ProvisioningStateSucceeded), - // Subnet: &armnetwork.Subnet{ - // ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/virtualNetworks/lbvnet/subnets/lbsubnet"), - // }, - // }, - // }}, - // InboundNatPools: []*armnetwork.InboundNatPool{ - // { - // ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/loadBalancers/lb/inboundNatPools/test"), - // Name: to.Ptr("test"), - // Type: to.Ptr("Microsoft.Network/loadBalancers/inboundNatPools"), - // Etag: to.Ptr("W/\"00000000-0000-0000-0000-00000000\""), - // Properties: &armnetwork.InboundNatPoolPropertiesFormat{ - // BackendPort: to.Ptr[int32](8888), - // EnableFloatingIP: to.Ptr(true), - // EnableTCPReset: to.Ptr(true), - // FrontendIPConfiguration: &armnetwork.SubResource{ - // ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/loadBalancers/lb/frontendIPConfigurations/test"), - // }, - // FrontendPortRangeEnd: to.Ptr[int32](8085), - // FrontendPortRangeStart: to.Ptr[int32](8080), - // IdleTimeoutInMinutes: to.Ptr[int32](10), - // ProvisioningState: to.Ptr(armnetwork.ProvisioningStateSucceeded), - // Protocol: to.Ptr(armnetwork.TransportProtocolTCP), - // }, - // }}, - // InboundNatRules: []*armnetwork.InboundNatRule{ - // }, - // LoadBalancingRules: []*armnetwork.LoadBalancingRule{ - // }, - // OutboundRules: []*armnetwork.OutboundRule{ - // }, - // Probes: []*armnetwork.Probe{ - // }, - // ProvisioningState: to.Ptr(armnetwork.ProvisioningStateSucceeded), - // ResourceGUID: to.Ptr("00000000-0000-0000-0000-00000000"), - // }, - // SKU: &armnetwork.LoadBalancerSKU{ - // Name: to.Ptr(armnetwork.LoadBalancerSKUNameStandard), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/4883fa5dbf6f2c9093fac8ce334547e9dfac68fa/specification/network/resource-manager/Microsoft.Network/stable/2024-03-01/examples/LoadBalancerCreateWithOutboundRules.json -func ExampleLoadBalancersClient_BeginCreateOrUpdate_createLoadBalancerWithOutboundRules() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armnetwork.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewLoadBalancersClient().BeginCreateOrUpdate(ctx, "rg1", "lb", armnetwork.LoadBalancer{ - Location: to.Ptr("eastus"), - Properties: &armnetwork.LoadBalancerPropertiesFormat{ - BackendAddressPools: []*armnetwork.BackendAddressPool{ - { - Name: to.Ptr("be-lb"), - Properties: &armnetwork.BackendAddressPoolPropertiesFormat{}, - }}, - FrontendIPConfigurations: []*armnetwork.FrontendIPConfiguration{ - { - Name: to.Ptr("fe-lb"), - Properties: &armnetwork.FrontendIPConfigurationPropertiesFormat{ - PublicIPAddress: &armnetwork.PublicIPAddress{ - ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/publicIPAddresses/pip"), - }, - }, - }}, - InboundNatPools: []*armnetwork.InboundNatPool{}, - InboundNatRules: []*armnetwork.InboundNatRule{ - { - Name: to.Ptr("in-nat-rule"), - Properties: &armnetwork.InboundNatRulePropertiesFormat{ - BackendPort: to.Ptr[int32](3389), - EnableFloatingIP: to.Ptr(true), - FrontendIPConfiguration: &armnetwork.SubResource{ - ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/loadBalancers/lb/frontendIPConfigurations/fe-lb"), - }, - FrontendPort: to.Ptr[int32](3389), - IdleTimeoutInMinutes: to.Ptr[int32](15), - Protocol: to.Ptr(armnetwork.TransportProtocolTCP), - }, - }}, - LoadBalancingRules: []*armnetwork.LoadBalancingRule{ - { - Name: to.Ptr("rulelb"), - Properties: &armnetwork.LoadBalancingRulePropertiesFormat{ - BackendAddressPool: &armnetwork.SubResource{ - ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/loadBalancers/lb/backendAddressPools/be-lb"), - }, - BackendPort: to.Ptr[int32](80), - DisableOutboundSnat: to.Ptr(true), - EnableFloatingIP: to.Ptr(true), - FrontendIPConfiguration: &armnetwork.SubResource{ - ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/loadBalancers/lb/frontendIPConfigurations/fe-lb"), - }, - FrontendPort: to.Ptr[int32](80), - IdleTimeoutInMinutes: to.Ptr[int32](15), - LoadDistribution: to.Ptr(armnetwork.LoadDistributionDefault), - Probe: &armnetwork.SubResource{ - ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/loadBalancers/lb/probes/probe-lb"), - }, - Protocol: to.Ptr(armnetwork.TransportProtocolTCP), - }, - }}, - OutboundRules: []*armnetwork.OutboundRule{ - { - Name: to.Ptr("rule1"), - Properties: &armnetwork.OutboundRulePropertiesFormat{ - BackendAddressPool: &armnetwork.SubResource{ - ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/loadBalancers/lb/backendAddressPools/be-lb"), - }, - FrontendIPConfigurations: []*armnetwork.SubResource{ - { - ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/loadBalancers/lb/frontendIPConfigurations/fe-lb"), - }}, - Protocol: to.Ptr(armnetwork.LoadBalancerOutboundRuleProtocolAll), - }, - }}, - Probes: []*armnetwork.Probe{ - { - Name: to.Ptr("probe-lb"), - Properties: &armnetwork.ProbePropertiesFormat{ - IntervalInSeconds: to.Ptr[int32](15), - NumberOfProbes: to.Ptr[int32](2), - Port: to.Ptr[int32](80), - ProbeThreshold: to.Ptr[int32](1), - RequestPath: to.Ptr("healthcheck.aspx"), - Protocol: to.Ptr(armnetwork.ProbeProtocolHTTP), - }, - }}, - }, - SKU: &armnetwork.LoadBalancerSKU{ - Name: to.Ptr(armnetwork.LoadBalancerSKUNameStandard), - }, - }, nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - res, err := poller.PollUntilDone(ctx, nil) - if err != nil { - log.Fatalf("failed to pull the result: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.LoadBalancer = armnetwork.LoadBalancer{ - // Name: to.Ptr("lb"), - // Type: to.Ptr("Microsoft.Network/loadBalancers"), - // ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/loadBalancers/lb"), - // Location: to.Ptr("eastus"), - // Etag: to.Ptr("W/\"00000000-0000-0000-0000-00000000\""), - // Properties: &armnetwork.LoadBalancerPropertiesFormat{ - // BackendAddressPools: []*armnetwork.BackendAddressPool{ - // { - // ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/loadBalancers/lb/backendAddressPools/be-lb"), - // Name: to.Ptr("be-lb"), - // Type: to.Ptr("Microsoft.Network/loadBalancers/backendAddressPools"), - // Etag: to.Ptr("W/\"00000000-0000-0000-0000-00000000\""), - // Properties: &armnetwork.BackendAddressPoolPropertiesFormat{ - // LoadBalancingRules: []*armnetwork.SubResource{ - // { - // ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/loadBalancers/lb/loadBalancingRules/rulelb"), - // }}, - // OutboundRules: []*armnetwork.SubResource{ - // { - // ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/loadBalancers/lb/outboundRules/rule1"), - // }}, - // ProvisioningState: to.Ptr(armnetwork.ProvisioningStateSucceeded), - // }, - // }}, - // FrontendIPConfigurations: []*armnetwork.FrontendIPConfiguration{ - // { - // ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/loadBalancers/lb/frontendIPConfigurations/fe-lb"), - // Name: to.Ptr("fe-lb"), - // Type: to.Ptr("Microsoft.Network/loadBalancers/frontendIPConfigurations"), - // Etag: to.Ptr("W/\"00000000-0000-0000-0000-00000000\""), - // Properties: &armnetwork.FrontendIPConfigurationPropertiesFormat{ - // InboundNatRules: []*armnetwork.SubResource{ - // { - // ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/loadBalancers/lb/inboundNatRules/in-nat-rule"), - // }}, - // LoadBalancingRules: []*armnetwork.SubResource{ - // { - // ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/loadBalancers/lb/loadBalancingRules/rulelb"), - // }}, - // OutboundRules: []*armnetwork.SubResource{ - // { - // ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/loadBalancers/lb/outboundRules/rule1"), - // }}, - // PrivateIPAddressVersion: to.Ptr(armnetwork.IPVersionIPv4), - // PrivateIPAllocationMethod: to.Ptr(armnetwork.IPAllocationMethodDynamic), - // ProvisioningState: to.Ptr(armnetwork.ProvisioningStateSucceeded), - // PublicIPAddress: &armnetwork.PublicIPAddress{ - // ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/publicIPAddresses/pip"), - // }, - // }, - // }}, - // InboundNatPools: []*armnetwork.InboundNatPool{ - // }, - // InboundNatRules: []*armnetwork.InboundNatRule{ - // { - // ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/loadBalancers/lb/inboundNatRules/in-nat-rule"), - // Name: to.Ptr("in-nat-rule"), - // Type: to.Ptr("Microsoft.Network/loadBalancers/inboundNatRules"), - // Etag: to.Ptr("W/\"00000000-0000-0000-0000-00000000\""), - // Properties: &armnetwork.InboundNatRulePropertiesFormat{ - // BackendPort: to.Ptr[int32](3389), - // EnableFloatingIP: to.Ptr(true), - // EnableTCPReset: to.Ptr(false), - // FrontendIPConfiguration: &armnetwork.SubResource{ - // ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/loadBalancers/lb/frontendIPConfigurations/fe-lb"), - // }, - // FrontendPort: to.Ptr[int32](3389), - // IdleTimeoutInMinutes: to.Ptr[int32](15), - // ProvisioningState: to.Ptr(armnetwork.ProvisioningStateSucceeded), - // Protocol: to.Ptr(armnetwork.TransportProtocolTCP), - // }, - // }}, - // LoadBalancingRules: []*armnetwork.LoadBalancingRule{ - // { - // ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/loadBalancers/lb/loadBalancingRules/rulelb"), - // Name: to.Ptr("rulelb"), - // Type: to.Ptr("Microsoft.Network/loadBalancers/loadBalancingRules"), - // Etag: to.Ptr("W/\"00000000-0000-0000-0000-00000000\""), - // Properties: &armnetwork.LoadBalancingRulePropertiesFormat{ - // BackendAddressPool: &armnetwork.SubResource{ - // ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/loadBalancers/lb/backendAddressPools/be-lb"), - // }, - // BackendPort: to.Ptr[int32](80), - // DisableOutboundSnat: to.Ptr(true), - // EnableFloatingIP: to.Ptr(true), - // EnableTCPReset: to.Ptr(false), - // FrontendIPConfiguration: &armnetwork.SubResource{ - // ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/loadBalancers/lb/frontendIPConfigurations/fe-lb"), - // }, - // FrontendPort: to.Ptr[int32](80), - // IdleTimeoutInMinutes: to.Ptr[int32](15), - // LoadDistribution: to.Ptr(armnetwork.LoadDistributionDefault), - // Probe: &armnetwork.SubResource{ - // ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/loadBalancers/lb/probes/probe-lb"), - // }, - // ProvisioningState: to.Ptr(armnetwork.ProvisioningStateSucceeded), - // Protocol: to.Ptr(armnetwork.TransportProtocolTCP), - // }, - // }}, - // OutboundRules: []*armnetwork.OutboundRule{ - // { - // ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/loadBalancers/lb/outboundRules/rule1"), - // Name: to.Ptr("rule1"), - // Type: to.Ptr("Microsoft.Network/loadBalancers/outboundRules"), - // Etag: to.Ptr("W/\"00000000-0000-0000-0000-00000000\""), - // Properties: &armnetwork.OutboundRulePropertiesFormat{ - // AllocatedOutboundPorts: to.Ptr[int32](1024), - // BackendAddressPool: &armnetwork.SubResource{ - // ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/loadBalancers/lb/backendAddressPools/be-lb"), - // }, - // EnableTCPReset: to.Ptr(false), - // FrontendIPConfigurations: []*armnetwork.SubResource{ - // { - // ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/loadBalancers/lb/frontendIPConfigurations/fe-lb"), - // }}, - // IdleTimeoutInMinutes: to.Ptr[int32](4), - // ProvisioningState: to.Ptr(armnetwork.ProvisioningStateSucceeded), - // Protocol: to.Ptr(armnetwork.LoadBalancerOutboundRuleProtocolAll), - // }, - // }}, - // Probes: []*armnetwork.Probe{ - // { - // ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/loadBalancers/lb/probes/probe-lb"), - // Name: to.Ptr("probe-lb"), - // Type: to.Ptr("Microsoft.Network/loadBalancers/probes"), - // Etag: to.Ptr("W/\"00000000-0000-0000-0000-00000000\""), - // Properties: &armnetwork.ProbePropertiesFormat{ - // IntervalInSeconds: to.Ptr[int32](15), - // LoadBalancingRules: []*armnetwork.SubResource{ - // { - // ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/loadBalancers/lb/loadBalancingRules/rulelb"), - // }}, - // NumberOfProbes: to.Ptr[int32](2), - // Port: to.Ptr[int32](80), - // ProbeThreshold: to.Ptr[int32](1), - // ProvisioningState: to.Ptr(armnetwork.ProvisioningStateSucceeded), - // RequestPath: to.Ptr("healthcheck.aspx"), - // Protocol: to.Ptr(armnetwork.ProbeProtocolHTTP), - // }, - // }}, - // ProvisioningState: to.Ptr(armnetwork.ProvisioningStateSucceeded), - // ResourceGUID: to.Ptr("00000000-0000-0000-0000-00000000"), - // }, - // SKU: &armnetwork.LoadBalancerSKU{ - // Name: to.Ptr(armnetwork.LoadBalancerSKUNameStandard), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/4883fa5dbf6f2c9093fac8ce334547e9dfac68fa/specification/network/resource-manager/Microsoft.Network/stable/2024-03-01/examples/LoadBalancerUpdateTags.json -func ExampleLoadBalancersClient_UpdateTags() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armnetwork.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewLoadBalancersClient().UpdateTags(ctx, "rg1", "lb", armnetwork.TagsObject{ - Tags: map[string]*string{ - "tag1": to.Ptr("value1"), - "tag2": to.Ptr("value2"), - }, - }, nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.LoadBalancer = armnetwork.LoadBalancer{ - // Name: to.Ptr("lb"), - // Type: to.Ptr("Microsoft.Network/loadBalancers"), - // ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/loadBalancers/lb"), - // Location: to.Ptr("westus"), - // Tags: map[string]*string{ - // "tag1": to.Ptr("value1"), - // "tag2": to.Ptr("value2"), - // }, - // Properties: &armnetwork.LoadBalancerPropertiesFormat{ - // BackendAddressPools: []*armnetwork.BackendAddressPool{ - // { - // ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/loadBalancers/lb/backendAddressPools/be-lb"), - // Name: to.Ptr("be-lb"), - // Properties: &armnetwork.BackendAddressPoolPropertiesFormat{ - // LoadBalancingRules: []*armnetwork.SubResource{ - // { - // ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/loadBalancers/lb/loadBalancingRules/rulelb"), - // }}, - // ProvisioningState: to.Ptr(armnetwork.ProvisioningStateSucceeded), - // }, - // }}, - // FrontendIPConfigurations: []*armnetwork.FrontendIPConfiguration{ - // { - // ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/loadBalancers/lb/frontendIPConfigurations/fe-lb"), - // Name: to.Ptr("fe-lb"), - // Properties: &armnetwork.FrontendIPConfigurationPropertiesFormat{ - // InboundNatRules: []*armnetwork.SubResource{ - // { - // ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/loadBalancers/lb/inboundNatRules/in-nat-rule"), - // }}, - // LoadBalancingRules: []*armnetwork.SubResource{ - // { - // ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/loadBalancers/lb/loadBalancingRules/rulelb"), - // }}, - // PrivateIPAddress: to.Ptr("10.0.1.4"), - // PrivateIPAllocationMethod: to.Ptr(armnetwork.IPAllocationMethodDynamic), - // ProvisioningState: to.Ptr(armnetwork.ProvisioningStateSucceeded), - // Subnet: &armnetwork.Subnet{ - // ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/virtualNetworks/vnetlb/subnets/subnetlb"), - // }, - // }, - // }}, - // InboundNatPools: []*armnetwork.InboundNatPool{ - // }, - // InboundNatRules: []*armnetwork.InboundNatRule{ - // { - // ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/loadBalancers/lb/inboundNatRules/in-nat-rule"), - // Name: to.Ptr("in-nat-rule"), - // Properties: &armnetwork.InboundNatRulePropertiesFormat{ - // BackendPort: to.Ptr[int32](3389), - // EnableFloatingIP: to.Ptr(true), - // FrontendIPConfiguration: &armnetwork.SubResource{ - // ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/loadBalancers/lb/frontendIPConfigurations/fe-lb"), - // }, - // FrontendPort: to.Ptr[int32](3389), - // IdleTimeoutInMinutes: to.Ptr[int32](15), - // ProvisioningState: to.Ptr(armnetwork.ProvisioningStateSucceeded), - // Protocol: to.Ptr(armnetwork.TransportProtocolTCP), - // }, - // }}, - // LoadBalancingRules: []*armnetwork.LoadBalancingRule{ - // { - // ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/loadBalancers/lb/loadBalancingRules/rulelb"), - // Name: to.Ptr("rulelb"), - // Properties: &armnetwork.LoadBalancingRulePropertiesFormat{ - // BackendAddressPool: &armnetwork.SubResource{ - // ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/loadBalancers/lb/backendAddressPools/be-lb"), - // }, - // BackendPort: to.Ptr[int32](80), - // DisableOutboundSnat: to.Ptr(false), - // EnableFloatingIP: to.Ptr(true), - // FrontendIPConfiguration: &armnetwork.SubResource{ - // ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/loadBalancers/lb/frontendIPConfigurations/fe-lb"), - // }, - // FrontendPort: to.Ptr[int32](80), - // IdleTimeoutInMinutes: to.Ptr[int32](15), - // LoadDistribution: to.Ptr(armnetwork.LoadDistributionDefault), - // Probe: &armnetwork.SubResource{ - // ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/loadBalancers/lb/probes/probe-lb"), - // }, - // ProvisioningState: to.Ptr(armnetwork.ProvisioningStateSucceeded), - // Protocol: to.Ptr(armnetwork.TransportProtocolTCP), - // }, - // }}, - // OutboundRules: []*armnetwork.OutboundRule{ - // }, - // Probes: []*armnetwork.Probe{ - // { - // ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/loadBalancers/lb/probes/probe-lb"), - // Name: to.Ptr("probe-lb"), - // Properties: &armnetwork.ProbePropertiesFormat{ - // IntervalInSeconds: to.Ptr[int32](15), - // LoadBalancingRules: []*armnetwork.SubResource{ - // { - // ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/loadBalancers/lb/loadBalancingRules/rulelb"), - // }}, - // NumberOfProbes: to.Ptr[int32](2), - // Port: to.Ptr[int32](80), - // ProbeThreshold: to.Ptr[int32](1), - // ProvisioningState: to.Ptr(armnetwork.ProvisioningStateSucceeded), - // RequestPath: to.Ptr("healthcheck.aspx"), - // Protocol: to.Ptr(armnetwork.ProbeProtocolHTTP), - // }, - // }}, - // ProvisioningState: to.Ptr(armnetwork.ProvisioningStateSucceeded), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/4883fa5dbf6f2c9093fac8ce334547e9dfac68fa/specification/network/resource-manager/Microsoft.Network/stable/2024-03-01/examples/LoadBalancerListAll.json -func ExampleLoadBalancersClient_NewListAllPager() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armnetwork.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := clientFactory.NewLoadBalancersClient().NewListAllPager(nil) - for pager.More() { - page, err := pager.NextPage(ctx) - if err != nil { - log.Fatalf("failed to advance page: %v", err) - } - for _, v := range page.Value { - // You could use page here. We use blank identifier for just demo purposes. - _ = v - } - // If the HTTP response code is 200 as defined in example definition, your page structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // page.LoadBalancerListResult = armnetwork.LoadBalancerListResult{ - // Value: []*armnetwork.LoadBalancer{ - // { - // Name: to.Ptr("lb"), - // Type: to.Ptr("Microsoft.Network/loadBalancers"), - // ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/loadBalancers/lb"), - // Location: to.Ptr("westus"), - // Etag: to.Ptr("W/\"00000000-0000-0000-0000-00000000\""), - // Properties: &armnetwork.LoadBalancerPropertiesFormat{ - // BackendAddressPools: []*armnetwork.BackendAddressPool{ - // { - // ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/loadBalancers/lb/backendAddressPools/belb"), - // Name: to.Ptr("belb"), - // Type: to.Ptr("Microsoft.Network/loadBalancers/backendAddressPools"), - // Etag: to.Ptr("W/\"00000000-0000-0000-0000-00000000\""), - // Properties: &armnetwork.BackendAddressPoolPropertiesFormat{ - // LoadBalancingRules: []*armnetwork.SubResource{ - // { - // ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/loadBalancers/lb/loadBalancingRules/rulelb"), - // }}, - // ProvisioningState: to.Ptr(armnetwork.ProvisioningStateSucceeded), - // }, - // }}, - // FrontendIPConfigurations: []*armnetwork.FrontendIPConfiguration{ - // { - // ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/loadBalancers/lb/frontendIPConfigurations/felb"), - // Name: to.Ptr("felb"), - // Type: to.Ptr("Microsoft.Network/loadBalancers/frontendIPConfigurations"), - // Etag: to.Ptr("W/\"00000000-0000-0000-0000-00000000\""), - // Properties: &armnetwork.FrontendIPConfigurationPropertiesFormat{ - // InboundNatRules: []*armnetwork.SubResource{ - // { - // ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/loadBalancers/lb/inboundNatRules/inrlb"), - // }}, - // LoadBalancingRules: []*armnetwork.SubResource{ - // { - // ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/loadBalancers/lb/loadBalancingRules/rulelb"), - // }}, - // PrivateIPAddress: to.Ptr("10.0.1.4"), - // PrivateIPAddressVersion: to.Ptr(armnetwork.IPVersionIPv4), - // PrivateIPAllocationMethod: to.Ptr(armnetwork.IPAllocationMethodDynamic), - // ProvisioningState: to.Ptr(armnetwork.ProvisioningStateSucceeded), - // Subnet: &armnetwork.Subnet{ - // ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/virtualNetworks/vnetlb/subnets/subnetlb"), - // }, - // }, - // }}, - // InboundNatPools: []*armnetwork.InboundNatPool{ - // }, - // InboundNatRules: []*armnetwork.InboundNatRule{ - // { - // ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/loadBalancers/lb/inboundNatRules/inrlb"), - // Name: to.Ptr("inrlb"), - // Type: to.Ptr("Microsoft.Network/loadBalancers/inboundNatRules"), - // Etag: to.Ptr("W/\"00000000-0000-0000-0000-00000000\""), - // Properties: &armnetwork.InboundNatRulePropertiesFormat{ - // BackendPort: to.Ptr[int32](3389), - // EnableFloatingIP: to.Ptr(true), - // EnableTCPReset: to.Ptr(true), - // FrontendIPConfiguration: &armnetwork.SubResource{ - // ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/loadBalancers/lb/frontendIPConfigurations/felb"), - // }, - // FrontendPort: to.Ptr[int32](3389), - // IdleTimeoutInMinutes: to.Ptr[int32](15), - // ProvisioningState: to.Ptr(armnetwork.ProvisioningStateSucceeded), - // Protocol: to.Ptr(armnetwork.TransportProtocolTCP), - // }, - // }}, - // LoadBalancingRules: []*armnetwork.LoadBalancingRule{ - // { - // ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/loadBalancers/lb/loadBalancingRules/rulelb"), - // Name: to.Ptr("rulelb"), - // Type: to.Ptr("Microsoft.Network/loadBalancers/loadBalancingRules"), - // Etag: to.Ptr("W/\"00000000-0000-0000-0000-00000000\""), - // Properties: &armnetwork.LoadBalancingRulePropertiesFormat{ - // BackendAddressPool: &armnetwork.SubResource{ - // ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/loadBalancers/lb/backendAddressPools/belb"), - // }, - // BackendPort: to.Ptr[int32](80), - // EnableFloatingIP: to.Ptr(true), - // EnableTCPReset: to.Ptr(true), - // FrontendIPConfiguration: &armnetwork.SubResource{ - // ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/loadBalancers/lb/frontendIPConfigurations/felb"), - // }, - // FrontendPort: to.Ptr[int32](80), - // IdleTimeoutInMinutes: to.Ptr[int32](15), - // LoadDistribution: to.Ptr(armnetwork.LoadDistributionDefault), - // Probe: &armnetwork.SubResource{ - // ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/loadBalancers/lb/probes/prlb"), - // }, - // ProvisioningState: to.Ptr(armnetwork.ProvisioningStateSucceeded), - // Protocol: to.Ptr(armnetwork.TransportProtocolTCP), - // }, - // }}, - // Probes: []*armnetwork.Probe{ - // { - // ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/loadBalancers/lb/probes/prlb"), - // Name: to.Ptr("prlb"), - // Type: to.Ptr("Microsoft.Network/loadBalancers/probes"), - // Etag: to.Ptr("W/\"00000000-0000-0000-0000-00000000\""), - // Properties: &armnetwork.ProbePropertiesFormat{ - // IntervalInSeconds: to.Ptr[int32](15), - // LoadBalancingRules: []*armnetwork.SubResource{ - // { - // ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/loadBalancers/lb/loadBalancingRules/rulelb"), - // }}, - // NumberOfProbes: to.Ptr[int32](2), - // Port: to.Ptr[int32](80), - // ProbeThreshold: to.Ptr[int32](1), - // ProvisioningState: to.Ptr(armnetwork.ProvisioningStateSucceeded), - // RequestPath: to.Ptr("healthcheck.aspx"), - // Protocol: to.Ptr(armnetwork.ProbeProtocolHTTP), - // }, - // }}, - // ProvisioningState: to.Ptr(armnetwork.ProvisioningStateSucceeded), - // ResourceGUID: to.Ptr("00000000-0000-0000-0000-00000000"), - // }, - // SKU: &armnetwork.LoadBalancerSKU{ - // Name: to.Ptr(armnetwork.LoadBalancerSKUNameBasic), - // }, - // }, - // { - // Name: to.Ptr("lb3"), - // Type: to.Ptr("Microsoft.Network/loadBalancers"), - // ID: to.Ptr("/subscriptions/subid/resourceGroups/rg2/providers/Microsoft.Network/loadBalancers/lb3"), - // Location: to.Ptr("westus"), - // Etag: to.Ptr("W/\"00000000-0000-0000-0000-00000000\""), - // Properties: &armnetwork.LoadBalancerPropertiesFormat{ - // BackendAddressPools: []*armnetwork.BackendAddressPool{ - // }, - // FrontendIPConfigurations: []*armnetwork.FrontendIPConfiguration{ - // }, - // InboundNatPools: []*armnetwork.InboundNatPool{ - // }, - // InboundNatRules: []*armnetwork.InboundNatRule{ - // }, - // LoadBalancingRules: []*armnetwork.LoadBalancingRule{ - // }, - // Probes: []*armnetwork.Probe{ - // }, - // ProvisioningState: to.Ptr(armnetwork.ProvisioningStateSucceeded), - // ResourceGUID: to.Ptr("00000000-0000-0000-0000-00000000"), - // }, - // SKU: &armnetwork.LoadBalancerSKU{ - // Name: to.Ptr(armnetwork.LoadBalancerSKUNameBasic), - // }, - // }}, - // } - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/4883fa5dbf6f2c9093fac8ce334547e9dfac68fa/specification/network/resource-manager/Microsoft.Network/stable/2024-03-01/examples/LoadBalancerList.json -func ExampleLoadBalancersClient_NewListPager() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armnetwork.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := clientFactory.NewLoadBalancersClient().NewListPager("rg1", nil) - for pager.More() { - page, err := pager.NextPage(ctx) - if err != nil { - log.Fatalf("failed to advance page: %v", err) - } - for _, v := range page.Value { - // You could use page here. We use blank identifier for just demo purposes. - _ = v - } - // If the HTTP response code is 200 as defined in example definition, your page structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // page.LoadBalancerListResult = armnetwork.LoadBalancerListResult{ - // Value: []*armnetwork.LoadBalancer{ - // { - // Name: to.Ptr("lb"), - // Type: to.Ptr("Microsoft.Network/loadBalancers"), - // ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/loadBalancers/lb"), - // Location: to.Ptr("westus"), - // Etag: to.Ptr("W/\"00000000-0000-0000-0000-00000000\""), - // Properties: &armnetwork.LoadBalancerPropertiesFormat{ - // BackendAddressPools: []*armnetwork.BackendAddressPool{ - // { - // ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/loadBalancers/lb/backendAddressPools/belb"), - // Name: to.Ptr("belb"), - // Type: to.Ptr("Microsoft.Network/loadBalancers/backendAddressPools"), - // Etag: to.Ptr("W/\"00000000-0000-0000-0000-00000000\""), - // Properties: &armnetwork.BackendAddressPoolPropertiesFormat{ - // LoadBalancingRules: []*armnetwork.SubResource{ - // { - // ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/loadBalancers/lb/loadBalancingRules/rulelb"), - // }}, - // ProvisioningState: to.Ptr(armnetwork.ProvisioningStateSucceeded), - // }, - // }}, - // FrontendIPConfigurations: []*armnetwork.FrontendIPConfiguration{ - // { - // ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/loadBalancers/lb/frontendIPConfigurations/felb"), - // Name: to.Ptr("felb"), - // Type: to.Ptr("Microsoft.Network/loadBalancers/frontendIPConfigurations"), - // Etag: to.Ptr("W/\"00000000-0000-0000-0000-00000000\""), - // Properties: &armnetwork.FrontendIPConfigurationPropertiesFormat{ - // InboundNatRules: []*armnetwork.SubResource{ - // { - // ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/loadBalancers/lb/inboundNatRules/inrlb"), - // }}, - // LoadBalancingRules: []*armnetwork.SubResource{ - // { - // ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/loadBalancers/lb/loadBalancingRules/rulelb"), - // }}, - // PrivateIPAddress: to.Ptr("10.0.1.4"), - // PrivateIPAddressVersion: to.Ptr(armnetwork.IPVersionIPv4), - // PrivateIPAllocationMethod: to.Ptr(armnetwork.IPAllocationMethodDynamic), - // ProvisioningState: to.Ptr(armnetwork.ProvisioningStateSucceeded), - // Subnet: &armnetwork.Subnet{ - // ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/virtualNetworks/vnetlb/subnets/subnetlb"), - // }, - // }, - // }}, - // InboundNatPools: []*armnetwork.InboundNatPool{ - // }, - // InboundNatRules: []*armnetwork.InboundNatRule{ - // { - // ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/loadBalancers/lb/inboundNatRules/inrlb"), - // Name: to.Ptr("inrlb"), - // Type: to.Ptr("Microsoft.Network/loadBalancers/inboundNatRules"), - // Etag: to.Ptr("W/\"00000000-0000-0000-0000-00000000\""), - // Properties: &armnetwork.InboundNatRulePropertiesFormat{ - // BackendPort: to.Ptr[int32](3389), - // EnableFloatingIP: to.Ptr(true), - // EnableTCPReset: to.Ptr(true), - // FrontendIPConfiguration: &armnetwork.SubResource{ - // ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/loadBalancers/lb/frontendIPConfigurations/felb"), - // }, - // FrontendPort: to.Ptr[int32](3389), - // IdleTimeoutInMinutes: to.Ptr[int32](15), - // ProvisioningState: to.Ptr(armnetwork.ProvisioningStateSucceeded), - // Protocol: to.Ptr(armnetwork.TransportProtocolTCP), - // }, - // }}, - // LoadBalancingRules: []*armnetwork.LoadBalancingRule{ - // { - // ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/loadBalancers/lb/loadBalancingRules/rulelb"), - // Name: to.Ptr("rulelb"), - // Type: to.Ptr("Microsoft.Network/loadBalancers/loadBalancingRules"), - // Etag: to.Ptr("W/\"00000000-0000-0000-0000-00000000\""), - // Properties: &armnetwork.LoadBalancingRulePropertiesFormat{ - // BackendAddressPool: &armnetwork.SubResource{ - // ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/loadBalancers/lb/backendAddressPools/belb"), - // }, - // BackendPort: to.Ptr[int32](80), - // EnableFloatingIP: to.Ptr(true), - // EnableTCPReset: to.Ptr(true), - // FrontendIPConfiguration: &armnetwork.SubResource{ - // ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/loadBalancers/lb/frontendIPConfigurations/felb"), - // }, - // FrontendPort: to.Ptr[int32](80), - // IdleTimeoutInMinutes: to.Ptr[int32](15), - // LoadDistribution: to.Ptr(armnetwork.LoadDistributionDefault), - // Probe: &armnetwork.SubResource{ - // ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/loadBalancers/lb/probes/prlb"), - // }, - // ProvisioningState: to.Ptr(armnetwork.ProvisioningStateSucceeded), - // Protocol: to.Ptr(armnetwork.TransportProtocolTCP), - // }, - // }}, - // Probes: []*armnetwork.Probe{ - // { - // ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/loadBalancers/lb/probes/prlb"), - // Name: to.Ptr("prlb"), - // Type: to.Ptr("Microsoft.Network/loadBalancers/probes"), - // Etag: to.Ptr("W/\"00000000-0000-0000-0000-00000000\""), - // Properties: &armnetwork.ProbePropertiesFormat{ - // IntervalInSeconds: to.Ptr[int32](15), - // LoadBalancingRules: []*armnetwork.SubResource{ - // { - // ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/loadBalancers/lb/loadBalancingRules/rulelb"), - // }}, - // NumberOfProbes: to.Ptr[int32](2), - // Port: to.Ptr[int32](80), - // ProbeThreshold: to.Ptr[int32](1), - // ProvisioningState: to.Ptr(armnetwork.ProvisioningStateSucceeded), - // RequestPath: to.Ptr("healthcheck.aspx"), - // Protocol: to.Ptr(armnetwork.ProbeProtocolHTTP), - // }, - // }}, - // ProvisioningState: to.Ptr(armnetwork.ProvisioningStateSucceeded), - // ResourceGUID: to.Ptr("00000000-0000-0000-0000-00000000"), - // }, - // SKU: &armnetwork.LoadBalancerSKU{ - // Name: to.Ptr(armnetwork.LoadBalancerSKUNameBasic), - // }, - // }, - // { - // Name: to.Ptr("lb2"), - // Type: to.Ptr("Microsoft.Network/loadBalancers"), - // ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/loadBalancers/lb2"), - // Location: to.Ptr("westus"), - // Etag: to.Ptr("W/\"00000000-0000-0000-0000-00000000\""), - // Properties: &armnetwork.LoadBalancerPropertiesFormat{ - // BackendAddressPools: []*armnetwork.BackendAddressPool{ - // }, - // FrontendIPConfigurations: []*armnetwork.FrontendIPConfiguration{ - // }, - // InboundNatPools: []*armnetwork.InboundNatPool{ - // }, - // InboundNatRules: []*armnetwork.InboundNatRule{ - // }, - // LoadBalancingRules: []*armnetwork.LoadBalancingRule{ - // }, - // Probes: []*armnetwork.Probe{ - // }, - // ProvisioningState: to.Ptr(armnetwork.ProvisioningStateSucceeded), - // ResourceGUID: to.Ptr("00000000-0000-0000-0000-00000000"), - // }, - // SKU: &armnetwork.LoadBalancerSKU{ - // Name: to.Ptr(armnetwork.LoadBalancerSKUNameBasic), - // }, - // }}, - // } - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/4883fa5dbf6f2c9093fac8ce334547e9dfac68fa/specification/network/resource-manager/Microsoft.Network/stable/2024-03-01/examples/LoadBalancersSwapPublicIpAddresses.json -func ExampleLoadBalancersClient_BeginSwapPublicIPAddresses() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armnetwork.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewLoadBalancersClient().BeginSwapPublicIPAddresses(ctx, "westus", armnetwork.LoadBalancerVipSwapRequest{ - FrontendIPConfigurations: []*armnetwork.LoadBalancerVipSwapRequestFrontendIPConfiguration{ - { - ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/loadBalancers/lb1/frontendIPConfigurations/lbfe1"), - Properties: &armnetwork.LoadBalancerVipSwapRequestFrontendIPConfigurationProperties{ - PublicIPAddress: &armnetwork.SubResource{ - ID: to.Ptr("/subscriptions/subid/resourceGroups/rg2/providers/Microsoft.Network/publicIPAddresses/pip2"), - }, - }, - }, - { - ID: to.Ptr("/subscriptions/subid/resourceGroups/rg2/providers/Microsoft.Network/loadBalancers/lb2/frontendIPConfigurations/lbfe2"), - Properties: &armnetwork.LoadBalancerVipSwapRequestFrontendIPConfigurationProperties{ - PublicIPAddress: &armnetwork.SubResource{ - ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/publicIPAddresses/pip1"), - }, - }, - }}, - }, nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - _, err = poller.PollUntilDone(ctx, nil) - if err != nil { - log.Fatalf("failed to pull the result: %v", err) - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/4883fa5dbf6f2c9093fac8ce334547e9dfac68fa/specification/network/resource-manager/Microsoft.Network/stable/2024-03-01/examples/QueryInboundNatRulePortMapping.json -func ExampleLoadBalancersClient_BeginListInboundNatRulePortMappings() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armnetwork.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewLoadBalancersClient().BeginListInboundNatRulePortMappings(ctx, "rg1", "lb1", "bp1", armnetwork.QueryInboundNatRulePortMappingRequest{ - IPAddress: to.Ptr("10.0.0.4"), - }, nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - res, err := poller.PollUntilDone(ctx, nil) - if err != nil { - log.Fatalf("failed to pull the result: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.BackendAddressInboundNatRulePortMappings = armnetwork.BackendAddressInboundNatRulePortMappings{ - // InboundNatRulePortMappings: []*armnetwork.InboundNatRulePortMapping{ - // { - // BackendPort: to.Ptr[int32](3389), - // FrontendPort: to.Ptr[int32](3389), - // InboundNatRuleName: to.Ptr("natRule"), - // Protocol: to.Ptr(armnetwork.TransportProtocolTCP), - // }}, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/4883fa5dbf6f2c9093fac8ce334547e9dfac68fa/specification/network/resource-manager/Microsoft.Network/stable/2024-03-01/examples/MigrateLoadBalancerToIPBased.json -func ExampleLoadBalancersClient_MigrateToIPBased() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armnetwork.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewLoadBalancersClient().MigrateToIPBased(ctx, "rg1", "lb1", &armnetwork.LoadBalancersClientMigrateToIPBasedOptions{Parameters: &armnetwork.MigrateLoadBalancerToIPBasedRequest{ - Pools: []*string{ - to.Ptr("pool1"), - to.Ptr("pool2")}, - }, - }) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.MigratedPools = armnetwork.MigratedPools{ - // MigratedPools: []*string{ - // to.Ptr("pool1"), - // to.Ptr("pool2")}, - // } -} diff --git a/sdk/resourcemanager/network/armnetwork/localnetworkgateways_client_example_test.go b/sdk/resourcemanager/network/armnetwork/localnetworkgateways_client_example_test.go deleted file mode 100644 index 9a374cc8fe2d..000000000000 --- a/sdk/resourcemanager/network/armnetwork/localnetworkgateways_client_example_test.go +++ /dev/null @@ -1,230 +0,0 @@ -//go:build go1.18 -// +build go1.18 - -// 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. -// DO NOT EDIT. - -package armnetwork_test - -import ( - "context" - "log" - - "github.com/Azure/azure-sdk-for-go/sdk/azcore/to" - "github.com/Azure/azure-sdk-for-go/sdk/azidentity" - "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/network/armnetwork/v6" -) - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/4883fa5dbf6f2c9093fac8ce334547e9dfac68fa/specification/network/resource-manager/Microsoft.Network/stable/2024-03-01/examples/LocalNetworkGatewayCreate.json -func ExampleLocalNetworkGatewaysClient_BeginCreateOrUpdate() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armnetwork.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewLocalNetworkGatewaysClient().BeginCreateOrUpdate(ctx, "rg1", "localgw", armnetwork.LocalNetworkGateway{ - Location: to.Ptr("Central US"), - Properties: &armnetwork.LocalNetworkGatewayPropertiesFormat{ - Fqdn: to.Ptr("site1.contoso.com"), - GatewayIPAddress: to.Ptr("11.12.13.14"), - LocalNetworkAddressSpace: &armnetwork.AddressSpace{ - AddressPrefixes: []*string{ - to.Ptr("10.1.0.0/16")}, - }, - }, - }, nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - res, err := poller.PollUntilDone(ctx, nil) - if err != nil { - log.Fatalf("failed to pull the result: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.LocalNetworkGateway = armnetwork.LocalNetworkGateway{ - // Name: to.Ptr("localgw"), - // Type: to.Ptr("Microsoft.Network/localNetworkGateways"), - // ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/localNetworkGateways/localgw"), - // Location: to.Ptr("centralus"), - // Etag: to.Ptr("W/\"00000000-0000-0000-0000-000000000000\""), - // Properties: &armnetwork.LocalNetworkGatewayPropertiesFormat{ - // GatewayIPAddress: to.Ptr("11.12.13.14"), - // LocalNetworkAddressSpace: &armnetwork.AddressSpace{ - // AddressPrefixes: []*string{ - // to.Ptr("10.1.0.0/16")}, - // }, - // ProvisioningState: to.Ptr(armnetwork.ProvisioningStateSucceeded), - // ResourceGUID: to.Ptr("00000000-0000-0000-0000-000000000000"), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/4883fa5dbf6f2c9093fac8ce334547e9dfac68fa/specification/network/resource-manager/Microsoft.Network/stable/2024-03-01/examples/LocalNetworkGatewayGet.json -func ExampleLocalNetworkGatewaysClient_Get() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armnetwork.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewLocalNetworkGatewaysClient().Get(ctx, "rg1", "localgw", nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.LocalNetworkGateway = armnetwork.LocalNetworkGateway{ - // Name: to.Ptr("localgw"), - // Type: to.Ptr("Microsoft.Network/localNetworkGateways"), - // ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/localNetworkGateways/localgw"), - // Location: to.Ptr("centralus"), - // Etag: to.Ptr("W/\"00000000-0000-0000-0000-000000000000\""), - // Properties: &armnetwork.LocalNetworkGatewayPropertiesFormat{ - // GatewayIPAddress: to.Ptr("x.x.x.x"), - // LocalNetworkAddressSpace: &armnetwork.AddressSpace{ - // AddressPrefixes: []*string{ - // to.Ptr("10.1.0.0/16")}, - // }, - // ProvisioningState: to.Ptr(armnetwork.ProvisioningStateSucceeded), - // ResourceGUID: to.Ptr("00000000-0000-0000-0000-000000000000"), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/4883fa5dbf6f2c9093fac8ce334547e9dfac68fa/specification/network/resource-manager/Microsoft.Network/stable/2024-03-01/examples/LocalNetworkGatewayDelete.json -func ExampleLocalNetworkGatewaysClient_BeginDelete() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armnetwork.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewLocalNetworkGatewaysClient().BeginDelete(ctx, "rg1", "localgw", nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - _, err = poller.PollUntilDone(ctx, nil) - if err != nil { - log.Fatalf("failed to pull the result: %v", err) - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/4883fa5dbf6f2c9093fac8ce334547e9dfac68fa/specification/network/resource-manager/Microsoft.Network/stable/2024-03-01/examples/LocalNetworkGatewayUpdateTags.json -func ExampleLocalNetworkGatewaysClient_UpdateTags() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armnetwork.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewLocalNetworkGatewaysClient().UpdateTags(ctx, "rg1", "lgw", armnetwork.TagsObject{ - Tags: map[string]*string{ - "tag1": to.Ptr("value1"), - "tag2": to.Ptr("value2"), - }, - }, nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.LocalNetworkGateway = armnetwork.LocalNetworkGateway{ - // Name: to.Ptr("lgw"), - // Type: to.Ptr("Microsoft.Network/localNetworkGateways"), - // ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/localNetworkGateways/lgw"), - // Location: to.Ptr("westus"), - // Tags: map[string]*string{ - // "tag1": to.Ptr("value1"), - // "tag2": to.Ptr("value2"), - // }, - // Properties: &armnetwork.LocalNetworkGatewayPropertiesFormat{ - // GatewayIPAddress: to.Ptr("12.0.0.1"), - // LocalNetworkAddressSpace: &armnetwork.AddressSpace{ - // AddressPrefixes: []*string{ - // to.Ptr("12.0.0.0/8")}, - // }, - // ProvisioningState: to.Ptr(armnetwork.ProvisioningStateSucceeded), - // ResourceGUID: to.Ptr("00000000-0000-0000-0000-000000000000"), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/4883fa5dbf6f2c9093fac8ce334547e9dfac68fa/specification/network/resource-manager/Microsoft.Network/stable/2024-03-01/examples/LocalNetworkGatewayList.json -func ExampleLocalNetworkGatewaysClient_NewListPager() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armnetwork.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := clientFactory.NewLocalNetworkGatewaysClient().NewListPager("rg1", nil) - for pager.More() { - page, err := pager.NextPage(ctx) - if err != nil { - log.Fatalf("failed to advance page: %v", err) - } - for _, v := range page.Value { - // You could use page here. We use blank identifier for just demo purposes. - _ = v - } - // If the HTTP response code is 200 as defined in example definition, your page structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // page.LocalNetworkGatewayListResult = armnetwork.LocalNetworkGatewayListResult{ - // Value: []*armnetwork.LocalNetworkGateway{ - // { - // Name: to.Ptr("localgw1"), - // Type: to.Ptr("Microsoft.Network/localNetworkGateways"), - // ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/localNetworkGateways/localgw1"), - // Location: to.Ptr("centralus"), - // Etag: to.Ptr("W/\"00000000-0000-0000-0000-000000000000\""), - // Properties: &armnetwork.LocalNetworkGatewayPropertiesFormat{ - // GatewayIPAddress: to.Ptr("x.x.x.x"), - // LocalNetworkAddressSpace: &armnetwork.AddressSpace{ - // AddressPrefixes: []*string{ - // to.Ptr("10.1.0.0/16")}, - // }, - // ProvisioningState: to.Ptr(armnetwork.ProvisioningStateSucceeded), - // ResourceGUID: to.Ptr("00000000-0000-0000-0000-000000000000"), - // }, - // }, - // { - // Name: to.Ptr("localgw2"), - // Type: to.Ptr("Microsoft.Network/localNetworkGateways"), - // ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/localNetworkGateways/localgw2"), - // Location: to.Ptr("eastus"), - // Etag: to.Ptr("W/\"00000000-0000-0000-0000-000000000000\""), - // Properties: &armnetwork.LocalNetworkGatewayPropertiesFormat{ - // GatewayIPAddress: to.Ptr("x.x.x.x"), - // LocalNetworkAddressSpace: &armnetwork.AddressSpace{ - // AddressPrefixes: []*string{ - // to.Ptr("10.2.0.0/16")}, - // }, - // ProvisioningState: to.Ptr(armnetwork.ProvisioningStateSucceeded), - // ResourceGUID: to.Ptr("00000000-0000-0000-0000-000000000000"), - // }, - // }}, - // } - } -} diff --git a/sdk/resourcemanager/network/armnetwork/management_client_example_test.go b/sdk/resourcemanager/network/armnetwork/management_client_example_test.go deleted file mode 100644 index df3dda91cb9a..000000000000 --- a/sdk/resourcemanager/network/armnetwork/management_client_example_test.go +++ /dev/null @@ -1,654 +0,0 @@ -//go:build go1.18 -// +build go1.18 - -// 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. -// DO NOT EDIT. - -package armnetwork_test - -import ( - "context" - "log" - - "github.com/Azure/azure-sdk-for-go/sdk/azcore/to" - "github.com/Azure/azure-sdk-for-go/sdk/azidentity" - "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/network/armnetwork/v6" -) - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/4883fa5dbf6f2c9093fac8ce334547e9dfac68fa/specification/network/resource-manager/Microsoft.Network/stable/2024-03-01/examples/BastionShareableLinkCreate.json -func ExampleManagementClient_BeginPutBastionShareableLink() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armnetwork.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewManagementClient().BeginPutBastionShareableLink(ctx, "rg1", "bastionhosttenant", armnetwork.BastionShareableLinkListRequest{ - VMs: []*armnetwork.BastionShareableLink{ - { - VM: &armnetwork.VM{ - ID: to.Ptr("/subscriptions/subid/resourceGroups/rgx/providers/Microsoft.Compute/virtualMachines/vm1"), - }, - }, - { - VM: &armnetwork.VM{ - ID: to.Ptr("/subscriptions/subid/resourceGroups/rgx/providers/Microsoft.Compute/virtualMachines/vm2"), - }, - }}, - }, nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - res, err := poller.PollUntilDone(ctx, nil) - if err != nil { - log.Fatalf("failed to pull the result: %v", err) - } - for res.More() { - page, err := res.NextPage(ctx) - if err != nil { - log.Fatalf("failed to advance page: %v", err) - } - for _, v := range page.Value { - // You could use page here. We use blank identifier for just demo purposes. - _ = v - } - // If the HTTP response code is 200 as defined in example definition, your page structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // page.BastionShareableLinkListResult = armnetwork.BastionShareableLinkListResult{ - // Value: []*armnetwork.BastionShareableLink{ - // { - // Bsl: to.Ptr("http://bst-bastionhostid.bastion.com/api/shareable-url/tokenvm1"), - // CreatedAt: to.Ptr("2019-10-18T12:00:00.0000Z"), - // VM: &armnetwork.VM{ - // ID: to.Ptr("/subscriptions/subid/resourceGroups/rgx/providers/Microsoft.Compute/virtualMachines/vm1"), - // }, - // }, - // { - // Bsl: to.Ptr("http://bst-bastionhostid.bastion.com/api/shareable-url/tokenvm2"), - // CreatedAt: to.Ptr("2019-10-17T12:00:00.0000Z"), - // VM: &armnetwork.VM{ - // ID: to.Ptr("/subscriptions/subid/resourceGroups/rgx/providers/Microsoft.Compute/virtualMachines/vm2"), - // }, - // }}, - // } - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/4883fa5dbf6f2c9093fac8ce334547e9dfac68fa/specification/network/resource-manager/Microsoft.Network/stable/2024-03-01/examples/BastionShareableLinkDelete.json -func ExampleManagementClient_BeginDeleteBastionShareableLink() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armnetwork.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewManagementClient().BeginDeleteBastionShareableLink(ctx, "rg1", "bastionhosttenant", armnetwork.BastionShareableLinkListRequest{ - VMs: []*armnetwork.BastionShareableLink{ - { - VM: &armnetwork.VM{ - ID: to.Ptr("/subscriptions/subid/resourceGroups/rgx/providers/Microsoft.Compute/virtualMachines/vm1"), - }, - }, - { - VM: &armnetwork.VM{ - ID: to.Ptr("/subscriptions/subid/resourceGroups/rgx/providers/Microsoft.Compute/virtualMachines/vm2"), - }, - }}, - }, nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - _, err = poller.PollUntilDone(ctx, nil) - if err != nil { - log.Fatalf("failed to pull the result: %v", err) - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/4883fa5dbf6f2c9093fac8ce334547e9dfac68fa/specification/network/resource-manager/Microsoft.Network/stable/2024-03-01/examples/BastionShareableLinkDeleteByToken.json -func ExampleManagementClient_BeginDeleteBastionShareableLinkByToken() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armnetwork.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewManagementClient().BeginDeleteBastionShareableLinkByToken(ctx, "rg1", "bastionhosttenant", armnetwork.BastionShareableLinkTokenListRequest{ - Tokens: []*string{ - to.Ptr("abcd1234-efgh-hijk-5678-abcdefgh1234"), - to.Ptr("dcba4321-hgfe-kjih-8765-hgfedcba4321")}, - }, nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - _, err = poller.PollUntilDone(ctx, nil) - if err != nil { - log.Fatalf("failed to pull the result: %v", err) - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/4883fa5dbf6f2c9093fac8ce334547e9dfac68fa/specification/network/resource-manager/Microsoft.Network/stable/2024-03-01/examples/BastionShareableLinkGet.json -func ExampleManagementClient_NewGetBastionShareableLinkPager() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armnetwork.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := clientFactory.NewManagementClient().NewGetBastionShareableLinkPager("rg1", "bastionhosttenant", armnetwork.BastionShareableLinkListRequest{ - VMs: []*armnetwork.BastionShareableLink{ - { - VM: &armnetwork.VM{ - ID: to.Ptr("/subscriptions/subid/resourceGroups/rgx/providers/Microsoft.Compute/virtualMachines/vm1"), - }, - }, - { - VM: &armnetwork.VM{ - ID: to.Ptr("/subscriptions/subid/resourceGroups/rgx/providers/Microsoft.Compute/virtualMachines/vm2"), - }, - }}, - }, nil) - for pager.More() { - page, err := pager.NextPage(ctx) - if err != nil { - log.Fatalf("failed to advance page: %v", err) - } - for _, v := range page.Value { - // You could use page here. We use blank identifier for just demo purposes. - _ = v - } - // If the HTTP response code is 200 as defined in example definition, your page structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // page.BastionShareableLinkListResult = armnetwork.BastionShareableLinkListResult{ - // Value: []*armnetwork.BastionShareableLink{ - // { - // Bsl: to.Ptr("http://bst-bastionhostid.bastion.com/api/shareable-url/tokenvm1"), - // CreatedAt: to.Ptr("2019-10-18T12:00:00.0000Z"), - // VM: &armnetwork.VM{ - // ID: to.Ptr("/subscriptions/subid/resourceGroups/rgx/providers/Microsoft.Compute/virtualMachines/vm1"), - // }, - // }, - // { - // Bsl: to.Ptr("http://bst-bastionhostid.bastion.com/api/shareable-url/tokenvm2"), - // CreatedAt: to.Ptr("2019-10-17T12:00:00.0000Z"), - // VM: &armnetwork.VM{ - // ID: to.Ptr("/subscriptions/subid/resourceGroups/rgx/providers/Microsoft.Compute/virtualMachines/vm2"), - // }, - // }}, - // } - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/4883fa5dbf6f2c9093fac8ce334547e9dfac68fa/specification/network/resource-manager/Microsoft.Network/stable/2024-03-01/examples/BastionSessionsList.json -func ExampleManagementClient_BeginGetActiveSessions() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armnetwork.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewManagementClient().BeginGetActiveSessions(ctx, "rg1", "bastionhosttenant", nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - res, err := poller.PollUntilDone(ctx, nil) - if err != nil { - log.Fatalf("failed to pull the result: %v", err) - } - for res.More() { - page, err := res.NextPage(ctx) - if err != nil { - log.Fatalf("failed to advance page: %v", err) - } - for _, v := range page.Value { - // You could use page here. We use blank identifier for just demo purposes. - _ = v - } - // If the HTTP response code is 200 as defined in example definition, your page structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // page.BastionActiveSessionListResult = armnetwork.BastionActiveSessionListResult{ - // Value: []*armnetwork.BastionActiveSession{ - // { - // ResourceType: to.Ptr("VM"), - // SessionDurationInMins: to.Ptr[float32](0), - // SessionID: to.Ptr("sessionId"), - // StartTime: "2019-1-1T12:00:00.0000Z", - // TargetHostName: to.Ptr("vm01"), - // TargetIPAddress: to.Ptr("1.1.1.1"), - // TargetResourceGroup: to.Ptr("rg1"), - // TargetResourceID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Compute/virtualMachines/vm01"), - // TargetSubscriptionID: to.Ptr("subid"), - // UserName: to.Ptr("user"), - // Protocol: to.Ptr(armnetwork.BastionConnectProtocolSSH), - // }}, - // } - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/4883fa5dbf6f2c9093fac8ce334547e9dfac68fa/specification/network/resource-manager/Microsoft.Network/stable/2024-03-01/examples/BastionSessionDelete.json -func ExampleManagementClient_NewDisconnectActiveSessionsPager() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armnetwork.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := clientFactory.NewManagementClient().NewDisconnectActiveSessionsPager("rg1", "bastionhosttenant", armnetwork.SessionIDs{}, nil) - for pager.More() { - page, err := pager.NextPage(ctx) - if err != nil { - log.Fatalf("failed to advance page: %v", err) - } - for _, v := range page.Value { - // You could use page here. We use blank identifier for just demo purposes. - _ = v - } - // If the HTTP response code is 200 as defined in example definition, your page structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // page.BastionSessionDeleteResult = armnetwork.BastionSessionDeleteResult{ - // Value: []*armnetwork.BastionSessionState{ - // { - // Message: to.Ptr("session session1 invalidated!"), - // SessionID: to.Ptr("session1"), - // State: to.Ptr("Disconnected"), - // }, - // { - // Message: to.Ptr("session session2 could not be disconnected!"), - // SessionID: to.Ptr("session2"), - // State: to.Ptr("Failed"), - // }, - // { - // Message: to.Ptr("session session3 not found!"), - // SessionID: to.Ptr("session3"), - // State: to.Ptr("NotFound"), - // }}, - // } - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/4883fa5dbf6f2c9093fac8ce334547e9dfac68fa/specification/network/resource-manager/Microsoft.Network/stable/2024-03-01/examples/CheckDnsNameAvailability.json -func ExampleManagementClient_CheckDNSNameAvailability() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armnetwork.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewManagementClient().CheckDNSNameAvailability(ctx, "westus", "testdns", nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.DNSNameAvailabilityResult = armnetwork.DNSNameAvailabilityResult{ - // Available: to.Ptr(false), - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/4883fa5dbf6f2c9093fac8ce334547e9dfac68fa/specification/network/resource-manager/Microsoft.Network/stable/2024-03-01/examples/expressRouteProviderPort.json -func ExampleManagementClient_ExpressRouteProviderPort() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armnetwork.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewManagementClient().ExpressRouteProviderPort(ctx, "abc", nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.ExpressRouteProviderPort = armnetwork.ExpressRouteProviderPort{ - // Type: to.Ptr("Microsoft.Network/expressRouteProviderPort"), - // ID: to.Ptr("/subscriptions/subid/providers/Microsoft.Network/ExpressRoutePortsLocations/SiliconValley/bvtazureixpportpair1"), - // Location: to.Ptr("uswest"), - // Etag: to.Ptr("W/\"c0e6477e-8150-4d4f-9bf6-bb10e6acb63a\""), - // Properties: &armnetwork.ExpressRouteProviderPortProperties{ - // OverprovisionFactor: to.Ptr[int32](4), - // PeeringLocation: to.Ptr("SiliconValley"), - // PortBandwidthInMbps: to.Ptr[int32](4000), - // PortPairDescriptor: to.Ptr("bvtazureixpportpair1"), - // PrimaryAzurePort: to.Ptr("bvtazureixp01"), - // RemainingBandwidthInMbps: to.Ptr[int32](1500), - // SecondaryAzurePort: to.Ptr("bvtazureixp01"), - // UsedBandwidthInMbps: to.Ptr[int32](2500), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/4883fa5dbf6f2c9093fac8ce334547e9dfac68fa/specification/network/resource-manager/Microsoft.Network/stable/2024-03-01/examples/NetworkManagerActiveConnectivityConfigurationsList.json -func ExampleManagementClient_ListActiveConnectivityConfigurations() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armnetwork.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewManagementClient().ListActiveConnectivityConfigurations(ctx, "myResourceGroup", "testNetworkManager", armnetwork.ActiveConfigurationParameter{ - Regions: []*string{ - to.Ptr("westus")}, - SkipToken: to.Ptr("fakeSkipTokenCode"), - }, &armnetwork.ManagementClientListActiveConnectivityConfigurationsOptions{Top: nil}) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.ActiveConnectivityConfigurationsListResult = armnetwork.ActiveConnectivityConfigurationsListResult{ - // SkipToken: to.Ptr("FakeSkipTokenCode"), - // Value: []*armnetwork.ActiveConnectivityConfiguration{ - // { - // ConfigurationGroups: []*armnetwork.ConfigurationGroup{ - // { - // ID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroup/myResourceGroup/providers/Microsoft.Network/networkManagers/testNetworkManager/networkGroups/group1"), - // Properties: &armnetwork.GroupProperties{ - // Description: to.Ptr("A group for all test Virtual Networks"), - // ProvisioningState: to.Ptr(armnetwork.ProvisioningStateSucceeded), - // }, - // }}, - // ID: to.Ptr("subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/myResourceGroup/providers/Microsoft.Network/networkManagers/testNetworkManager/connectivityConfigurations/myTestConnectivityConfig"), - // Properties: &armnetwork.ConnectivityConfigurationProperties{ - // Description: to.Ptr("Sample Configuration"), - // AppliesToGroups: []*armnetwork.ConnectivityGroupItem{ - // { - // GroupConnectivity: to.Ptr(armnetwork.GroupConnectivityNone), - // IsGlobal: to.Ptr(armnetwork.IsGlobalFalse), - // NetworkGroupID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/myResourceGroup/providers/Microsoft.Network/networkManagers/testNetworkManager/networkGroups/group1"), - // UseHubGateway: to.Ptr(armnetwork.UseHubGatewayTrue), - // }}, - // ConnectivityTopology: to.Ptr(armnetwork.ConnectivityTopologyHubAndSpoke), - // DeleteExistingPeering: to.Ptr(armnetwork.DeleteExistingPeeringTrue), - // Hubs: []*armnetwork.Hub{ - // { - // ResourceID: to.Ptr("subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/myResourceGroup/providers/Microsoft.Network/virtualNetworks/myTestConnectivityConfig"), - // ResourceType: to.Ptr("Microsoft.Network/virtualNetworks"), - // }}, - // IsGlobal: to.Ptr(armnetwork.IsGlobalTrue), - // ProvisioningState: to.Ptr(armnetwork.ProvisioningStateSucceeded), - // }, - // CommitTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2020-07-10T12:33:22.257Z"); return t}()), - // Region: to.Ptr("westus"), - // }}, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/4883fa5dbf6f2c9093fac8ce334547e9dfac68fa/specification/network/resource-manager/Microsoft.Network/stable/2024-03-01/examples/NetworkManagerActiveSecurityAdminRulesList.json -func ExampleManagementClient_ListActiveSecurityAdminRules() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armnetwork.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewManagementClient().ListActiveSecurityAdminRules(ctx, "myResourceGroup", "testNetworkManager", armnetwork.ActiveConfigurationParameter{ - Regions: []*string{ - to.Ptr("westus")}, - SkipToken: to.Ptr("fakeSkipTokenCode"), - }, &armnetwork.ManagementClientListActiveSecurityAdminRulesOptions{Top: nil}) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.ActiveSecurityAdminRulesListResult = armnetwork.ActiveSecurityAdminRulesListResult{ - // SkipToken: to.Ptr("FakeSkipTokenCode"), - // Value: []armnetwork.ActiveBaseSecurityAdminRuleClassification{ - // &armnetwork.ActiveDefaultSecurityAdminRule{ - // CommitTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2020-07-10T12:33:22.257Z"); return t}()), - // ConfigurationDescription: to.Ptr("SampleDescription"), - // ID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/myResourceGroup/providers/Microsoft.Network/networkManagers/testNetworkManager/securityAdminConfigurations/myTestSecurityConfig/ruleCollections/testRuleCollection/rules/SampleAdminRule"), - // Kind: to.Ptr(armnetwork.EffectiveAdminRuleKindDefault), - // Region: to.Ptr("westus"), - // RuleCollectionAppliesToGroups: []*armnetwork.ManagerSecurityGroupItem{ - // { - // NetworkGroupID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroup/myResourceGroup/providers/Microsoft.Network/networkManagers/testNetworkManager/networkGroups/group1"), - // }}, - // RuleCollectionDescription: to.Ptr("SampleRuleCollectionDescription"), - // RuleGroups: []*armnetwork.ConfigurationGroup{ - // { - // ID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroup/myResourceGroup/providers/Microsoft.Network/networkManagers/testNetworkManager/networkGroups/group1"), - // Properties: &armnetwork.GroupProperties{ - // Description: to.Ptr("A group for all test Virtual Networks"), - // ProvisioningState: to.Ptr(armnetwork.ProvisioningStateSucceeded), - // }, - // }}, - // Properties: &armnetwork.DefaultAdminPropertiesFormat{ - // Description: to.Ptr("Sample Admin Rule"), - // Access: to.Ptr(armnetwork.SecurityConfigurationRuleAccessDeny), - // DestinationPortRanges: []*string{ - // to.Ptr("22")}, - // Destinations: []*armnetwork.AddressPrefixItem{ - // { - // AddressPrefix: to.Ptr("*"), - // AddressPrefixType: to.Ptr(armnetwork.AddressPrefixTypeIPPrefix), - // }}, - // Direction: to.Ptr(armnetwork.SecurityConfigurationRuleDirectionInbound), - // Flag: to.Ptr("AllowVnetInbound"), - // Priority: to.Ptr[int32](1), - // ProvisioningState: to.Ptr(armnetwork.ProvisioningStateSucceeded), - // SourcePortRanges: []*string{ - // to.Ptr("0-65535")}, - // Sources: []*armnetwork.AddressPrefixItem{ - // { - // AddressPrefix: to.Ptr("*"), - // AddressPrefixType: to.Ptr(armnetwork.AddressPrefixTypeIPPrefix), - // }}, - // Protocol: to.Ptr(armnetwork.SecurityConfigurationRuleProtocolTCP), - // }, - // }}, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/4883fa5dbf6f2c9093fac8ce334547e9dfac68fa/specification/network/resource-manager/Microsoft.Network/stable/2024-03-01/examples/NetworkManagerEffectiveConnectivityConfigurationsList.json -func ExampleManagementClient_ListNetworkManagerEffectiveConnectivityConfigurations() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armnetwork.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewManagementClient().ListNetworkManagerEffectiveConnectivityConfigurations(ctx, "myResourceGroup", "testVirtualNetwork", armnetwork.QueryRequestOptions{ - SkipToken: to.Ptr("FakeSkipTokenCode"), - }, &armnetwork.ManagementClientListNetworkManagerEffectiveConnectivityConfigurationsOptions{Top: nil}) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.ManagerEffectiveConnectivityConfigurationListResult = armnetwork.ManagerEffectiveConnectivityConfigurationListResult{ - // SkipToken: to.Ptr("FakeSkipTokenCode"), - // Value: []*armnetwork.EffectiveConnectivityConfiguration{ - // { - // ConfigurationGroups: []*armnetwork.ConfigurationGroup{ - // { - // ID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroup/myResourceGroup/providers/Microsoft.Network/networkManagers/testNetworkManager/networkGroups/group1"), - // Properties: &armnetwork.GroupProperties{ - // Description: to.Ptr("A group for all test Virtual Networks"), - // ProvisioningState: to.Ptr(armnetwork.ProvisioningStateSucceeded), - // }, - // }}, - // ID: to.Ptr("subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/myResourceGroup/providers/Microsoft.Network/networkManagers/testNetworkManager/connectivityConfigurations/myTestConnectivityConfig"), - // Properties: &armnetwork.ConnectivityConfigurationProperties{ - // Description: to.Ptr("Sample Configuration"), - // AppliesToGroups: []*armnetwork.ConnectivityGroupItem{ - // { - // GroupConnectivity: to.Ptr(armnetwork.GroupConnectivityNone), - // IsGlobal: to.Ptr(armnetwork.IsGlobalFalse), - // NetworkGroupID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/myResourceGroup/providers/Microsoft.Network/networkManagers/testNetworkManager/groups/group1"), - // UseHubGateway: to.Ptr(armnetwork.UseHubGatewayTrue), - // }}, - // ConnectivityTopology: to.Ptr(armnetwork.ConnectivityTopologyHubAndSpoke), - // DeleteExistingPeering: to.Ptr(armnetwork.DeleteExistingPeeringTrue), - // Hubs: []*armnetwork.Hub{ - // { - // ResourceID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/myResourceGroup/providers/Microsoft.Network/virtualNetworks/myHubVnet"), - // ResourceType: to.Ptr("Microsoft.Network/virtualNetworks"), - // }}, - // IsGlobal: to.Ptr(armnetwork.IsGlobalTrue), - // ProvisioningState: to.Ptr(armnetwork.ProvisioningStateSucceeded), - // }, - // }}, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/4883fa5dbf6f2c9093fac8ce334547e9dfac68fa/specification/network/resource-manager/Microsoft.Network/stable/2024-03-01/examples/NetworkManagerEffectiveSecurityAdminRulesList.json -func ExampleManagementClient_ListNetworkManagerEffectiveSecurityAdminRules() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armnetwork.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewManagementClient().ListNetworkManagerEffectiveSecurityAdminRules(ctx, "myResourceGroup", "testVirtualNetwork", armnetwork.QueryRequestOptions{ - SkipToken: to.Ptr("FakeSkipTokenCode"), - }, &armnetwork.ManagementClientListNetworkManagerEffectiveSecurityAdminRulesOptions{Top: nil}) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.ManagerEffectiveSecurityAdminRulesListResult = armnetwork.ManagerEffectiveSecurityAdminRulesListResult{ - // SkipToken: to.Ptr("FakeSkipTokenCode"), - // Value: []armnetwork.EffectiveBaseSecurityAdminRuleClassification{ - // &armnetwork.EffectiveDefaultSecurityAdminRule{ - // ConfigurationDescription: to.Ptr("SampleDescription"), - // ID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/myResourceGroup/providers/Microsoft.Network/networkManagers/testNetworkManager/securityAdminConfigurations/myTestSecurityConfig/ruleCollections/testRuleCollection/rules/SampleAdminRule"), - // Kind: to.Ptr(armnetwork.EffectiveAdminRuleKindDefault), - // RuleCollectionAppliesToGroups: []*armnetwork.ManagerSecurityGroupItem{ - // { - // NetworkGroupID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroup/myResourceGroup/providers/Microsoft.Network/networkManagers/testNetworkManager/networkGroups/group1"), - // }}, - // RuleCollectionDescription: to.Ptr("SampleRuleCollectionDescription"), - // RuleGroups: []*armnetwork.ConfigurationGroup{ - // { - // ID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroup/myResourceGroup/providers/Microsoft.Network/networkManagers/testNetworkManager/networkGroups/group1"), - // Properties: &armnetwork.GroupProperties{ - // Description: to.Ptr("A group for all test Virtual Networks"), - // ProvisioningState: to.Ptr(armnetwork.ProvisioningStateSucceeded), - // }, - // }}, - // Properties: &armnetwork.DefaultAdminPropertiesFormat{ - // Description: to.Ptr("Sample Admin Rule"), - // Access: to.Ptr(armnetwork.SecurityConfigurationRuleAccessDeny), - // DestinationPortRanges: []*string{ - // to.Ptr("22")}, - // Destinations: []*armnetwork.AddressPrefixItem{ - // { - // AddressPrefix: to.Ptr("*"), - // AddressPrefixType: to.Ptr(armnetwork.AddressPrefixTypeIPPrefix), - // }}, - // Direction: to.Ptr(armnetwork.SecurityConfigurationRuleDirectionInbound), - // Flag: to.Ptr("AllowVnetInbound"), - // Priority: to.Ptr[int32](1), - // ProvisioningState: to.Ptr(armnetwork.ProvisioningStateSucceeded), - // SourcePortRanges: []*string{ - // to.Ptr("0-65535")}, - // Sources: []*armnetwork.AddressPrefixItem{ - // { - // AddressPrefix: to.Ptr("*"), - // AddressPrefixType: to.Ptr(armnetwork.AddressPrefixTypeIPPrefix), - // }}, - // Protocol: to.Ptr(armnetwork.SecurityConfigurationRuleProtocolTCP), - // }, - // }}, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/4883fa5dbf6f2c9093fac8ce334547e9dfac68fa/specification/network/resource-manager/Microsoft.Network/stable/2024-03-01/examples/VirtualWanSupportedSecurityProviders.json -func ExampleManagementClient_SupportedSecurityProviders() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armnetwork.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewManagementClient().SupportedSecurityProviders(ctx, "rg1", "wan1", nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.VirtualWanSecurityProviders = armnetwork.VirtualWanSecurityProviders{ - // SupportedProviders: []*armnetwork.VirtualWanSecurityProvider{ - // { - // Name: to.Ptr("AzureFirewall"), - // Type: to.Ptr(armnetwork.VirtualWanSecurityProviderTypeNative), - // URL: to.Ptr(""), - // }}, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/4883fa5dbf6f2c9093fac8ce334547e9dfac68fa/specification/network/resource-manager/Microsoft.Network/stable/2024-03-01/examples/GenerateVirtualWanVpnServerConfigurationVpnProfile.json -func ExampleManagementClient_BeginGeneratevirtualwanvpnserverconfigurationvpnprofile() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armnetwork.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewManagementClient().BeginGeneratevirtualwanvpnserverconfigurationvpnprofile(ctx, "rg1", "wan1", armnetwork.VirtualWanVPNProfileParameters{ - AuthenticationMethod: to.Ptr(armnetwork.AuthenticationMethodEAPTLS), - VPNServerConfigurationResourceID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/vpnServerConfigurations/vpnconfig1"), - }, nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - res, err := poller.PollUntilDone(ctx, nil) - if err != nil { - log.Fatalf("failed to pull the result: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.VPNProfileResponse = armnetwork.VPNProfileResponse{ - // ProfileURL: to.Ptr("aaaaaaaaaaaaaaaaaaaaaaaaaaa"), - // } -} diff --git a/sdk/resourcemanager/network/armnetwork/managementgroupnetworkmanagerconnections_client_example_test.go b/sdk/resourcemanager/network/armnetwork/managementgroupnetworkmanagerconnections_client_example_test.go deleted file mode 100644 index af07db6bb4ba..000000000000 --- a/sdk/resourcemanager/network/armnetwork/managementgroupnetworkmanagerconnections_client_example_test.go +++ /dev/null @@ -1,164 +0,0 @@ -//go:build go1.18 -// +build go1.18 - -// 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. -// DO NOT EDIT. - -package armnetwork_test - -import ( - "context" - "log" - - "github.com/Azure/azure-sdk-for-go/sdk/azcore/to" - "github.com/Azure/azure-sdk-for-go/sdk/azidentity" - "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/network/armnetwork/v6" -) - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/4883fa5dbf6f2c9093fac8ce334547e9dfac68fa/specification/network/resource-manager/Microsoft.Network/stable/2024-03-01/examples/NetworkManagerConnectionManagementGroupPut.json -func ExampleManagementGroupNetworkManagerConnectionsClient_CreateOrUpdate() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armnetwork.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewManagementGroupNetworkManagerConnectionsClient().CreateOrUpdate(ctx, "managementGroupA", "TestNMConnection", armnetwork.ManagerConnection{ - Properties: &armnetwork.ManagerConnectionProperties{ - NetworkManagerID: to.Ptr("/subscriptions/subscriptionC/resourceGroup/rg1/providers/Microsoft.Network/networkManagers/testNetworkManager"), - }, - }, nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.ManagerConnection = armnetwork.ManagerConnection{ - // Name: to.Ptr("TestNMConnection"), - // Type: to.Ptr("Microsoft.Network/networkManagerConnections"), - // ID: to.Ptr("/providers/Microsoft.Management/managementGroups/managementGroupA/providers/Microsoft.Network/networkManagerConnections/TestNMConnection"), - // Properties: &armnetwork.ManagerConnectionProperties{ - // Description: to.Ptr("This is a network manager connection to testNetworkManager."), - // ConnectionState: to.Ptr(armnetwork.ScopeConnectionStatePending), - // NetworkManagerID: to.Ptr("/subscriptions/subscriptionC/resourceGroup/rg1/providers/Microsoft.Network/networkManagers/testNetworkManager"), - // }, - // SystemData: &armnetwork.SystemData{ - // CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-01-11T18:52:27.000Z"); return t}()), - // CreatedBy: to.Ptr("b69a9388-9488-4534-b470-7ec6d41beef5"), - // CreatedByType: to.Ptr(armnetwork.CreatedByTypeUser), - // LastModifiedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-01-11T18:52:27.000Z"); return t}()), - // LastModifiedBy: to.Ptr("b69a9388-9488-4534-b470-7ec6d41beef5"), - // LastModifiedByType: to.Ptr(armnetwork.CreatedByTypeUser), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/4883fa5dbf6f2c9093fac8ce334547e9dfac68fa/specification/network/resource-manager/Microsoft.Network/stable/2024-03-01/examples/NetworkManagerConnectionManagementGroupGet.json -func ExampleManagementGroupNetworkManagerConnectionsClient_Get() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armnetwork.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewManagementGroupNetworkManagerConnectionsClient().Get(ctx, "managementGroupA", "TestNMConnection", nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.ManagerConnection = armnetwork.ManagerConnection{ - // Name: to.Ptr("TestNMConnection"), - // Type: to.Ptr("Microsoft.Network/networkManagerConnections"), - // ID: to.Ptr("providers/Microsoft.Management/managementGroups/managementGroupA/providers/Microsoft.Network/networkManagerConnections/TestNMConnection"), - // Properties: &armnetwork.ManagerConnectionProperties{ - // Description: to.Ptr("This is a network manager connection to testNetworkManager."), - // ConnectionState: to.Ptr(armnetwork.ScopeConnectionStatePending), - // NetworkManagerID: to.Ptr("/subscriptions/subscriptionC/resourceGroup/rg1/providers/Microsoft.Network/networkManagers/testNetworkManager"), - // }, - // SystemData: &armnetwork.SystemData{ - // CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-01-11T18:52:27.000Z"); return t}()), - // CreatedBy: to.Ptr("b69a9388-9488-4534-b470-7ec6d41beef5"), - // CreatedByType: to.Ptr(armnetwork.CreatedByTypeUser), - // LastModifiedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-01-11T18:52:27.000Z"); return t}()), - // LastModifiedBy: to.Ptr("b69a9388-9488-4534-b470-7ec6d41beef5"), - // LastModifiedByType: to.Ptr(armnetwork.CreatedByTypeUser), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/4883fa5dbf6f2c9093fac8ce334547e9dfac68fa/specification/network/resource-manager/Microsoft.Network/stable/2024-03-01/examples/NetworkManagerConnectionManagementGroupDelete.json -func ExampleManagementGroupNetworkManagerConnectionsClient_Delete() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armnetwork.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - _, err = clientFactory.NewManagementGroupNetworkManagerConnectionsClient().Delete(ctx, "managementGroupA", "TestNMConnection", nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/4883fa5dbf6f2c9093fac8ce334547e9dfac68fa/specification/network/resource-manager/Microsoft.Network/stable/2024-03-01/examples/NetworkManagerConnectionManagementGroupList.json -func ExampleManagementGroupNetworkManagerConnectionsClient_NewListPager() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armnetwork.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := clientFactory.NewManagementGroupNetworkManagerConnectionsClient().NewListPager("managementGroupA", &armnetwork.ManagementGroupNetworkManagerConnectionsClientListOptions{Top: nil, - SkipToken: nil, - }) - for pager.More() { - page, err := pager.NextPage(ctx) - if err != nil { - log.Fatalf("failed to advance page: %v", err) - } - for _, v := range page.Value { - // You could use page here. We use blank identifier for just demo purposes. - _ = v - } - // If the HTTP response code is 200 as defined in example definition, your page structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // page.ManagerConnectionListResult = armnetwork.ManagerConnectionListResult{ - // Value: []*armnetwork.ManagerConnection{ - // { - // Name: to.Ptr("TestNMConnection"), - // Type: to.Ptr("Microsoft.Network/networkManagerConnections"), - // ID: to.Ptr("/providers/Microsoft.Management/managementGroups/managementGroupA/providers/Microsoft.Network/networkManagerConnections/TestNMConnection"), - // Properties: &armnetwork.ManagerConnectionProperties{ - // Description: to.Ptr("This is a network manager connection to testNetworkManager."), - // ConnectionState: to.Ptr(armnetwork.ScopeConnectionStatePending), - // NetworkManagerID: to.Ptr("/subscriptions/subscriptionC/resourceGroup/rg1/providers/Microsoft.Network/networkManagers/testNetworkManager"), - // }, - // SystemData: &armnetwork.SystemData{ - // CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-01-11T18:52:27.000Z"); return t}()), - // CreatedBy: to.Ptr("b69a9388-9488-4534-b470-7ec6d41beef5"), - // CreatedByType: to.Ptr(armnetwork.CreatedByTypeUser), - // LastModifiedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-01-11T18:52:27.000Z"); return t}()), - // LastModifiedBy: to.Ptr("b69a9388-9488-4534-b470-7ec6d41beef5"), - // LastModifiedByType: to.Ptr(armnetwork.CreatedByTypeUser), - // }, - // }}, - // } - } -} diff --git a/sdk/resourcemanager/network/armnetwork/managercommits_client_example_test.go b/sdk/resourcemanager/network/armnetwork/managercommits_client_example_test.go deleted file mode 100644 index 93d61834194c..000000000000 --- a/sdk/resourcemanager/network/armnetwork/managercommits_client_example_test.go +++ /dev/null @@ -1,57 +0,0 @@ -//go:build go1.18 -// +build go1.18 - -// 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. -// DO NOT EDIT. - -package armnetwork_test - -import ( - "context" - "log" - - "github.com/Azure/azure-sdk-for-go/sdk/azcore/to" - "github.com/Azure/azure-sdk-for-go/sdk/azidentity" - "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/network/armnetwork/v6" -) - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/4883fa5dbf6f2c9093fac8ce334547e9dfac68fa/specification/network/resource-manager/Microsoft.Network/stable/2024-03-01/examples/NetworkManagerCommitPost.json -func ExampleManagerCommitsClient_BeginPost() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armnetwork.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewManagerCommitsClient().BeginPost(ctx, "resoureGroupSample", "testNetworkManager", armnetwork.ManagerCommit{ - CommitType: to.Ptr(armnetwork.ConfigurationTypeSecurityAdmin), - ConfigurationIDs: []*string{ - to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/resoureGroupSample/providers/Microsoft.Network/networkManagers/testNetworkManager/securityAdminConfigurations/SampleSecurityAdminConfig")}, - TargetLocations: []*string{ - to.Ptr("useast")}, - }, nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - res, err := poller.PollUntilDone(ctx, nil) - if err != nil { - log.Fatalf("failed to pull the result: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.ManagerCommit = armnetwork.ManagerCommit{ - // CommitID: to.Ptr("testCommitId"), - // CommitType: to.Ptr(armnetwork.ConfigurationTypeSecurityAdmin), - // ConfigurationIDs: []*string{ - // to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/resoureGroupSample/providers/Microsoft.Network/networkManagers/testNetworkManager/securityAdminConfigurations/SampleSecurityAdminConfig")}, - // TargetLocations: []*string{ - // to.Ptr("useast")}, - // } -} diff --git a/sdk/resourcemanager/network/armnetwork/managerdeploymentstatus_client_example_test.go b/sdk/resourcemanager/network/armnetwork/managerdeploymentstatus_client_example_test.go deleted file mode 100644 index d44b2e061c71..000000000000 --- a/sdk/resourcemanager/network/armnetwork/managerdeploymentstatus_client_example_test.go +++ /dev/null @@ -1,71 +0,0 @@ -//go:build go1.18 -// +build go1.18 - -// 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. -// DO NOT EDIT. - -package armnetwork_test - -import ( - "context" - "log" - - "github.com/Azure/azure-sdk-for-go/sdk/azcore/to" - "github.com/Azure/azure-sdk-for-go/sdk/azidentity" - "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/network/armnetwork/v6" -) - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/4883fa5dbf6f2c9093fac8ce334547e9dfac68fa/specification/network/resource-manager/Microsoft.Network/stable/2024-03-01/examples/NetworkManagerDeploymentStatusList.json -func ExampleManagerDeploymentStatusClient_List() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armnetwork.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewManagerDeploymentStatusClient().List(ctx, "resoureGroupSample", "testNetworkManager", armnetwork.ManagerDeploymentStatusParameter{ - DeploymentTypes: []*armnetwork.ConfigurationType{ - to.Ptr(armnetwork.ConfigurationTypeConnectivity), - to.Ptr(armnetwork.ConfigurationType("AdminPolicy"))}, - Regions: []*string{ - to.Ptr("eastus"), - to.Ptr("westus")}, - SkipToken: to.Ptr("FakeSkipTokenCode"), - }, &armnetwork.ManagerDeploymentStatusClientListOptions{Top: nil}) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.ManagerDeploymentStatusListResult = armnetwork.ManagerDeploymentStatusListResult{ - // SkipToken: to.Ptr("NextFakeSkipTokenCode"), - // Value: []*armnetwork.ManagerDeploymentStatus{ - // { - // CommitTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-01-26T06:58:50.883Z"); return t}()), - // ConfigurationIDs: []*string{ - // to.Ptr("SecConfig1"), - // to.Ptr("SecConfig2")}, - // DeploymentStatus: to.Ptr(armnetwork.DeploymentStatusDeploying), - // DeploymentType: to.Ptr(armnetwork.ConfigurationType("AdminPolicy")), - // ErrorMessage: to.Ptr(""), - // Region: to.Ptr("eastus"), - // }, - // { - // CommitTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-01-26T06:58:50.883Z"); return t}()), - // ConfigurationIDs: []*string{ - // to.Ptr("ConnConfig1"), - // to.Ptr("ConnConfig2")}, - // DeploymentStatus: to.Ptr(armnetwork.DeploymentStatusDeployed), - // DeploymentType: to.Ptr(armnetwork.ConfigurationTypeConnectivity), - // ErrorMessage: to.Ptr(""), - // Region: to.Ptr("eastus"), - // }}, - // } -} diff --git a/sdk/resourcemanager/network/armnetwork/managerroutingconfigurations_client_example_test.go b/sdk/resourcemanager/network/armnetwork/managerroutingconfigurations_client_example_test.go deleted file mode 100644 index f5e265ff4542..000000000000 --- a/sdk/resourcemanager/network/armnetwork/managerroutingconfigurations_client_example_test.go +++ /dev/null @@ -1,168 +0,0 @@ -//go:build go1.18 -// +build go1.18 - -// 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. -// DO NOT EDIT. - -package armnetwork_test - -import ( - "context" - "log" - - "github.com/Azure/azure-sdk-for-go/sdk/azcore/to" - "github.com/Azure/azure-sdk-for-go/sdk/azidentity" - "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/network/armnetwork/v6" -) - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/4883fa5dbf6f2c9093fac8ce334547e9dfac68fa/specification/network/resource-manager/Microsoft.Network/stable/2024-03-01/examples/NetworkManagerRoutingConfigurationList.json -func ExampleManagerRoutingConfigurationsClient_NewListPager() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armnetwork.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := clientFactory.NewManagerRoutingConfigurationsClient().NewListPager("rg1", "testNetworkManager", &armnetwork.ManagerRoutingConfigurationsClientListOptions{Top: nil, - SkipToken: nil, - }) - for pager.More() { - page, err := pager.NextPage(ctx) - if err != nil { - log.Fatalf("failed to advance page: %v", err) - } - for _, v := range page.Value { - // You could use page here. We use blank identifier for just demo purposes. - _ = v - } - // If the HTTP response code is 200 as defined in example definition, your page structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // page.ManagerRoutingConfigurationListResult = armnetwork.ManagerRoutingConfigurationListResult{ - // Value: []*armnetwork.ManagerRoutingConfiguration{ - // { - // Name: to.Ptr("myTestRoutingConfig"), - // Type: to.Ptr("Microsoft.Network/networkManagers/routingConfigurations"), - // ID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/rg1/providers/Microsoft.Network/networkManagers/testNetworkManager/routingConfigurations/myTestRoutingConfig"), - // Properties: &armnetwork.ManagerRoutingConfigurationPropertiesFormat{ - // Description: to.Ptr("A sample policy"), - // ProvisioningState: to.Ptr(armnetwork.ProvisioningStateSucceeded), - // ResourceGUID: to.Ptr("00000000-0000-0000-0000-000000000000"), - // }, - // SystemData: &armnetwork.SystemData{ - // CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-01-11T18:52:27.000Z"); return t}()), - // CreatedBy: to.Ptr("b69a9388-9488-4534-b470-7ec6d41beef5"), - // CreatedByType: to.Ptr(armnetwork.CreatedByTypeUser), - // LastModifiedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-01-11T18:52:27.000Z"); return t}()), - // LastModifiedBy: to.Ptr("b69a9388-9488-4534-b470-7ec6d41beef5"), - // LastModifiedByType: to.Ptr(armnetwork.CreatedByTypeUser), - // }, - // }}, - // } - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/4883fa5dbf6f2c9093fac8ce334547e9dfac68fa/specification/network/resource-manager/Microsoft.Network/stable/2024-03-01/examples/NetworkManagerRoutingConfigurationGet.json -func ExampleManagerRoutingConfigurationsClient_Get() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armnetwork.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewManagerRoutingConfigurationsClient().Get(ctx, "rg1", "testNetworkManager", "myTestRoutingConfig", nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.ManagerRoutingConfiguration = armnetwork.ManagerRoutingConfiguration{ - // Name: to.Ptr("myTestRoutingConfig"), - // Type: to.Ptr("Microsoft.Network/networkManagers/routingConfigurations"), - // ID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/rg1/providers/Microsoft.Network/networkManagers/testNetworkManager/routingConfigurations/myTestRoutingConfig"), - // Properties: &armnetwork.ManagerRoutingConfigurationPropertiesFormat{ - // Description: to.Ptr("A sample policy"), - // ProvisioningState: to.Ptr(armnetwork.ProvisioningStateSucceeded), - // ResourceGUID: to.Ptr("00000000-0000-0000-0000-000000000000"), - // }, - // SystemData: &armnetwork.SystemData{ - // CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-01-11T18:52:27.000Z"); return t}()), - // CreatedBy: to.Ptr("b69a9388-9488-4534-b470-7ec6d41beef5"), - // CreatedByType: to.Ptr(armnetwork.CreatedByTypeUser), - // LastModifiedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-01-11T18:52:27.000Z"); return t}()), - // LastModifiedBy: to.Ptr("b69a9388-9488-4534-b470-7ec6d41beef5"), - // LastModifiedByType: to.Ptr(armnetwork.CreatedByTypeUser), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/4883fa5dbf6f2c9093fac8ce334547e9dfac68fa/specification/network/resource-manager/Microsoft.Network/stable/2024-03-01/examples/NetworkManagerRoutingConfigurationPut.json -func ExampleManagerRoutingConfigurationsClient_CreateOrUpdate() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armnetwork.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewManagerRoutingConfigurationsClient().CreateOrUpdate(ctx, "rg1", "testNetworkManager", "myTestRoutingConfig", armnetwork.ManagerRoutingConfiguration{ - Properties: &armnetwork.ManagerRoutingConfigurationPropertiesFormat{ - Description: to.Ptr("A sample policy"), - }, - }, nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.ManagerRoutingConfiguration = armnetwork.ManagerRoutingConfiguration{ - // Name: to.Ptr("myTestRoutingConfig"), - // Type: to.Ptr("Microsoft.Network/networkManagers/routingConfigurations"), - // ID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/rg1/providers/Microsoft.Network/networkManager/testNetworkManager/routingConfigurations/myTestRoutingConfig"), - // Properties: &armnetwork.ManagerRoutingConfigurationPropertiesFormat{ - // Description: to.Ptr("A sample policy"), - // ProvisioningState: to.Ptr(armnetwork.ProvisioningStateSucceeded), - // ResourceGUID: to.Ptr("00000000-0000-0000-0000-000000000000"), - // }, - // SystemData: &armnetwork.SystemData{ - // CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-01-11T18:52:27.000Z"); return t}()), - // CreatedBy: to.Ptr("b69a9388-9488-4534-b470-7ec6d41beef5"), - // CreatedByType: to.Ptr(armnetwork.CreatedByTypeUser), - // LastModifiedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-01-11T18:52:27.000Z"); return t}()), - // LastModifiedBy: to.Ptr("b69a9388-9488-4534-b470-7ec6d41beef5"), - // LastModifiedByType: to.Ptr(armnetwork.CreatedByTypeUser), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/4883fa5dbf6f2c9093fac8ce334547e9dfac68fa/specification/network/resource-manager/Microsoft.Network/stable/2024-03-01/examples/NetworkManagerRoutingConfigurationDelete.json -func ExampleManagerRoutingConfigurationsClient_BeginDelete() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armnetwork.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewManagerRoutingConfigurationsClient().BeginDelete(ctx, "rg1", "testNetworkManager", "myTestRoutingConfig", &armnetwork.ManagerRoutingConfigurationsClientBeginDeleteOptions{Force: nil}) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - _, err = poller.PollUntilDone(ctx, nil) - if err != nil { - log.Fatalf("failed to pull the result: %v", err) - } -} diff --git a/sdk/resourcemanager/network/armnetwork/managers_client_example_test.go b/sdk/resourcemanager/network/armnetwork/managers_client_example_test.go deleted file mode 100644 index 3621ae79a18f..000000000000 --- a/sdk/resourcemanager/network/armnetwork/managers_client_example_test.go +++ /dev/null @@ -1,316 +0,0 @@ -//go:build go1.18 -// +build go1.18 - -// 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. -// DO NOT EDIT. - -package armnetwork_test - -import ( - "context" - "log" - - "github.com/Azure/azure-sdk-for-go/sdk/azcore/to" - "github.com/Azure/azure-sdk-for-go/sdk/azidentity" - "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/network/armnetwork/v6" -) - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/4883fa5dbf6f2c9093fac8ce334547e9dfac68fa/specification/network/resource-manager/Microsoft.Network/stable/2024-03-01/examples/NetworkManagerGet.json -func ExampleManagersClient_Get() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armnetwork.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewManagersClient().Get(ctx, "rg1", "testNetworkManager", nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.Manager = armnetwork.Manager{ - // Name: to.Ptr("testNetworkManager"), - // Type: to.Ptr("Microsoft.Network/networkManagers"), - // ID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroup/rg1/providers/Microsoft.Network/networkManagers/testNetworkManager"), - // Properties: &armnetwork.ManagerProperties{ - // Description: to.Ptr("My Test Network Manager"), - // NetworkManagerScopeAccesses: []*armnetwork.ConfigurationType{ - // to.Ptr(armnetwork.ConfigurationTypeSecurityUser)}, - // NetworkManagerScopes: &armnetwork.ManagerPropertiesNetworkManagerScopes{ - // ManagementGroups: []*string{ - // }, - // Subscriptions: []*string{ - // to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000")}, - // }, - // ProvisioningState: to.Ptr(armnetwork.ProvisioningStateSucceeded), - // ResourceGUID: to.Ptr("00000000-0000-0000-0000-000000000000"), - // }, - // SystemData: &armnetwork.SystemData{ - // CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-01-11T18:52:27.000Z"); return t}()), - // CreatedBy: to.Ptr("b69a9388-9488-4534-b470-7ec6d41beef5"), - // CreatedByType: to.Ptr(armnetwork.CreatedByTypeUser), - // LastModifiedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-01-11T18:52:27.000Z"); return t}()), - // LastModifiedBy: to.Ptr("b69a9388-9488-4534-b470-7ec6d41beef5"), - // LastModifiedByType: to.Ptr(armnetwork.CreatedByTypeUser), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/4883fa5dbf6f2c9093fac8ce334547e9dfac68fa/specification/network/resource-manager/Microsoft.Network/stable/2024-03-01/examples/NetworkManagerPut.json -func ExampleManagersClient_CreateOrUpdate() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armnetwork.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewManagersClient().CreateOrUpdate(ctx, "rg1", "TestNetworkManager", armnetwork.Manager{ - Properties: &armnetwork.ManagerProperties{ - Description: to.Ptr("My Test Network Manager"), - NetworkManagerScopeAccesses: []*armnetwork.ConfigurationType{ - to.Ptr(armnetwork.ConfigurationTypeConnectivity)}, - NetworkManagerScopes: &armnetwork.ManagerPropertiesNetworkManagerScopes{ - ManagementGroups: []*string{ - to.Ptr("/Microsoft.Management/testmg")}, - Subscriptions: []*string{ - to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000")}, - }, - }, - }, nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.Manager = armnetwork.Manager{ - // Name: to.Ptr("TestNetworkManager"), - // Type: to.Ptr("Microsoft.Network/networkManagers"), - // ID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroup/rg1/providers/Microsoft.Network/networkManagers/TestNetworkManager"), - // Etag: to.Ptr("sadf-asdf-asdf-asdf"), - // Properties: &armnetwork.ManagerProperties{ - // Description: to.Ptr("My Test Network Manager"), - // NetworkManagerScopeAccesses: []*armnetwork.ConfigurationType{ - // to.Ptr(armnetwork.ConfigurationTypeConnectivity)}, - // NetworkManagerScopes: &armnetwork.ManagerPropertiesNetworkManagerScopes{ - // ManagementGroups: []*string{ - // to.Ptr("Microsoft.Management/managementGroups/testMg")}, - // Subscriptions: []*string{ - // to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000")}, - // }, - // ProvisioningState: to.Ptr(armnetwork.ProvisioningStateSucceeded), - // ResourceGUID: to.Ptr("00000000-0000-0000-0000-000000000000"), - // }, - // SystemData: &armnetwork.SystemData{ - // CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-01-11T18:52:27.000Z"); return t}()), - // CreatedBy: to.Ptr("b69a9388-9488-4534-b470-7ec6d41beef5"), - // CreatedByType: to.Ptr(armnetwork.CreatedByTypeUser), - // LastModifiedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-01-11T18:52:27.000Z"); return t}()), - // LastModifiedBy: to.Ptr("b69a9388-9488-4534-b470-7ec6d41beef5"), - // LastModifiedByType: to.Ptr(armnetwork.CreatedByTypeUser), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/4883fa5dbf6f2c9093fac8ce334547e9dfac68fa/specification/network/resource-manager/Microsoft.Network/stable/2024-03-01/examples/NetworkManagerDelete.json -func ExampleManagersClient_BeginDelete() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armnetwork.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewManagersClient().BeginDelete(ctx, "rg1", "testNetworkManager", &armnetwork.ManagersClientBeginDeleteOptions{Force: to.Ptr(false)}) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - _, err = poller.PollUntilDone(ctx, nil) - if err != nil { - log.Fatalf("failed to pull the result: %v", err) - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/4883fa5dbf6f2c9093fac8ce334547e9dfac68fa/specification/network/resource-manager/Microsoft.Network/stable/2024-03-01/examples/NetworkManagerPatch.json -func ExampleManagersClient_Patch() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armnetwork.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewManagersClient().Patch(ctx, "rg1", "testNetworkManager", armnetwork.PatchObject{ - Tags: map[string]*string{ - "tag1": to.Ptr("value1"), - "tag2": to.Ptr("value2"), - }, - }, nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.Manager = armnetwork.Manager{ - // Name: to.Ptr("testNetworkManager"), - // Type: to.Ptr("Microsoft.Network/networkManager"), - // ID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroup/rg1/providers/Microsoft.Network/networkManagers/testNetworkManager"), - // Location: to.Ptr("westus"), - // Tags: map[string]*string{ - // "tag1": to.Ptr("value1"), - // "tag2": to.Ptr("value2"), - // }, - // Etag: to.Ptr("W/\"00000000-0000-0000-0000-000000000000\""), - // Properties: &armnetwork.ManagerProperties{ - // Description: to.Ptr("My Test Network Manager"), - // NetworkManagerScopeAccesses: []*armnetwork.ConfigurationType{ - // to.Ptr(armnetwork.ConfigurationTypeConnectivity)}, - // NetworkManagerScopes: &armnetwork.ManagerPropertiesNetworkManagerScopes{ - // ManagementGroups: []*string{ - // }, - // Subscriptions: []*string{ - // to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000001")}, - // }, - // ProvisioningState: to.Ptr(armnetwork.ProvisioningStateSucceeded), - // ResourceGUID: to.Ptr("00000000-0000-0000-0000-000000000000"), - // }, - // SystemData: &armnetwork.SystemData{ - // CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-01-11T18:52:27.000Z"); return t}()), - // CreatedBy: to.Ptr("b69a9388-9488-4534-b470-7ec6d41beef5"), - // CreatedByType: to.Ptr(armnetwork.CreatedByTypeUser), - // LastModifiedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-01-11T18:52:27.000Z"); return t}()), - // LastModifiedBy: to.Ptr("b69a9388-9488-4534-b470-7ec6d41beef5"), - // LastModifiedByType: to.Ptr(armnetwork.CreatedByTypeUser), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/4883fa5dbf6f2c9093fac8ce334547e9dfac68fa/specification/network/resource-manager/Microsoft.Network/stable/2024-03-01/examples/NetworkManagerListAll.json -func ExampleManagersClient_NewListBySubscriptionPager() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armnetwork.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := clientFactory.NewManagersClient().NewListBySubscriptionPager(&armnetwork.ManagersClientListBySubscriptionOptions{Top: nil, - SkipToken: nil, - }) - for pager.More() { - page, err := pager.NextPage(ctx) - if err != nil { - log.Fatalf("failed to advance page: %v", err) - } - for _, v := range page.Value { - // You could use page here. We use blank identifier for just demo purposes. - _ = v - } - // If the HTTP response code is 200 as defined in example definition, your page structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // page.ManagerListResult = armnetwork.ManagerListResult{ - // Value: []*armnetwork.Manager{ - // { - // Name: to.Ptr("testNetworkManager"), - // Type: to.Ptr("Microsoft.Network/networkManagers"), - // ID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroup/rg1/providers/Microsoft.Network/networkManagers/testNetworkManager"), - // Etag: to.Ptr("sadf-asdf-asdf-asdf"), - // Properties: &armnetwork.ManagerProperties{ - // Description: to.Ptr("My Test Network Manager"), - // NetworkManagerScopeAccesses: []*armnetwork.ConfigurationType{ - // to.Ptr(armnetwork.ConfigurationTypeSecurityUser)}, - // NetworkManagerScopes: &armnetwork.ManagerPropertiesNetworkManagerScopes{ - // ManagementGroups: []*string{ - // }, - // Subscriptions: []*string{ - // to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000")}, - // }, - // ProvisioningState: to.Ptr(armnetwork.ProvisioningStateSucceeded), - // ResourceGUID: to.Ptr("00000000-0000-0000-0000-000000000000"), - // }, - // SystemData: &armnetwork.SystemData{ - // CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-01-11T18:52:27.000Z"); return t}()), - // CreatedBy: to.Ptr("b69a9388-9488-4534-b470-7ec6d41beef5"), - // CreatedByType: to.Ptr(armnetwork.CreatedByTypeUser), - // LastModifiedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-01-11T18:52:27.000Z"); return t}()), - // LastModifiedBy: to.Ptr("b69a9388-9488-4534-b470-7ec6d41beef5"), - // LastModifiedByType: to.Ptr(armnetwork.CreatedByTypeUser), - // }, - // }}, - // } - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/4883fa5dbf6f2c9093fac8ce334547e9dfac68fa/specification/network/resource-manager/Microsoft.Network/stable/2024-03-01/examples/NetworkManagerList.json -func ExampleManagersClient_NewListPager() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armnetwork.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := clientFactory.NewManagersClient().NewListPager("rg1", &armnetwork.ManagersClientListOptions{Top: nil, - SkipToken: nil, - }) - for pager.More() { - page, err := pager.NextPage(ctx) - if err != nil { - log.Fatalf("failed to advance page: %v", err) - } - for _, v := range page.Value { - // You could use page here. We use blank identifier for just demo purposes. - _ = v - } - // If the HTTP response code is 200 as defined in example definition, your page structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // page.ManagerListResult = armnetwork.ManagerListResult{ - // Value: []*armnetwork.Manager{ - // { - // Name: to.Ptr("testNetworkManager"), - // Type: to.Ptr("Microsoft.Network/networkManagers"), - // ID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroup/rg1/providers/Microsoft.Network/networkManagers/testNetworkManager"), - // Etag: to.Ptr("sadf-asdf-asdf-asdf"), - // Properties: &armnetwork.ManagerProperties{ - // Description: to.Ptr("My Test Network Manager"), - // NetworkManagerScopeAccesses: []*armnetwork.ConfigurationType{ - // to.Ptr(armnetwork.ConfigurationTypeConnectivity)}, - // NetworkManagerScopes: &armnetwork.ManagerPropertiesNetworkManagerScopes{ - // ManagementGroups: []*string{ - // }, - // Subscriptions: []*string{ - // to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000")}, - // }, - // ProvisioningState: to.Ptr(armnetwork.ProvisioningStateSucceeded), - // ResourceGUID: to.Ptr("00000000-0000-0000-0000-000000000000"), - // }, - // SystemData: &armnetwork.SystemData{ - // CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-01-11T18:52:27.000Z"); return t}()), - // CreatedBy: to.Ptr("b69a9388-9488-4534-b470-7ec6d41beef5"), - // CreatedByType: to.Ptr(armnetwork.CreatedByTypeUser), - // LastModifiedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-01-11T18:52:27.000Z"); return t}()), - // LastModifiedBy: to.Ptr("b69a9388-9488-4534-b470-7ec6d41beef5"), - // LastModifiedByType: to.Ptr(armnetwork.CreatedByTypeUser), - // }, - // }}, - // } - } -} diff --git a/sdk/resourcemanager/network/armnetwork/natgateways_client_example_test.go b/sdk/resourcemanager/network/armnetwork/natgateways_client_example_test.go deleted file mode 100644 index 36b6c18ff0c3..000000000000 --- a/sdk/resourcemanager/network/armnetwork/natgateways_client_example_test.go +++ /dev/null @@ -1,359 +0,0 @@ -//go:build go1.18 -// +build go1.18 - -// 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. -// DO NOT EDIT. - -package armnetwork_test - -import ( - "context" - "log" - - "github.com/Azure/azure-sdk-for-go/sdk/azcore/to" - "github.com/Azure/azure-sdk-for-go/sdk/azidentity" - "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/network/armnetwork/v6" -) - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/4883fa5dbf6f2c9093fac8ce334547e9dfac68fa/specification/network/resource-manager/Microsoft.Network/stable/2024-03-01/examples/NatGatewayDelete.json -func ExampleNatGatewaysClient_BeginDelete() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armnetwork.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewNatGatewaysClient().BeginDelete(ctx, "rg1", "test-natGateway", nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - _, err = poller.PollUntilDone(ctx, nil) - if err != nil { - log.Fatalf("failed to pull the result: %v", err) - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/4883fa5dbf6f2c9093fac8ce334547e9dfac68fa/specification/network/resource-manager/Microsoft.Network/stable/2024-03-01/examples/NatGatewayGet.json -func ExampleNatGatewaysClient_Get() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armnetwork.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewNatGatewaysClient().Get(ctx, "rg1", "test-natGateway", &armnetwork.NatGatewaysClientGetOptions{Expand: nil}) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.NatGateway = armnetwork.NatGateway{ - // Name: to.Ptr("test-natGateway"), - // Type: to.Ptr("Microsoft.Network/natGateways"), - // ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/natGateways/test-natGateway"), - // Location: to.Ptr("westus"), - // Properties: &armnetwork.NatGatewayPropertiesFormat{ - // IdleTimeoutInMinutes: to.Ptr[int32](5), - // ProvisioningState: to.Ptr(armnetwork.ProvisioningStateSucceeded), - // PublicIPAddresses: []*armnetwork.SubResource{ - // { - // ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/publicIPAddresses/PublicIpAddress1"), - // }}, - // PublicIPPrefixes: []*armnetwork.SubResource{ - // { - // ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/publicIPPrefixes/PublicIpPrefix1"), - // }}, - // Subnets: []*armnetwork.SubResource{ - // { - // ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/virtualNetworks/test-vnet/subnets/subnet1"), - // }}, - // }, - // SKU: &armnetwork.NatGatewaySKU{ - // Name: to.Ptr(armnetwork.NatGatewaySKUNameStandard), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/4883fa5dbf6f2c9093fac8ce334547e9dfac68fa/specification/network/resource-manager/Microsoft.Network/stable/2024-03-01/examples/NatGatewayCreateOrUpdate.json -func ExampleNatGatewaysClient_BeginCreateOrUpdate() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armnetwork.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewNatGatewaysClient().BeginCreateOrUpdate(ctx, "rg1", "test-natgateway", armnetwork.NatGateway{ - Location: to.Ptr("westus"), - Properties: &armnetwork.NatGatewayPropertiesFormat{ - PublicIPAddresses: []*armnetwork.SubResource{ - { - ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/publicIPAddresses/PublicIpAddress1"), - }}, - PublicIPPrefixes: []*armnetwork.SubResource{ - { - ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/publicIPPrefixes/PublicIpPrefix1"), - }}, - }, - SKU: &armnetwork.NatGatewaySKU{ - Name: to.Ptr(armnetwork.NatGatewaySKUNameStandard), - }, - }, nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - res, err := poller.PollUntilDone(ctx, nil) - if err != nil { - log.Fatalf("failed to pull the result: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.NatGateway = armnetwork.NatGateway{ - // Name: to.Ptr("test-natGateway"), - // Type: to.Ptr("Microsoft.Network/natGateways"), - // ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/natGateways/test-natGateway"), - // Location: to.Ptr("westus"), - // Properties: &armnetwork.NatGatewayPropertiesFormat{ - // IdleTimeoutInMinutes: to.Ptr[int32](5), - // ProvisioningState: to.Ptr(armnetwork.ProvisioningStateSucceeded), - // PublicIPAddresses: []*armnetwork.SubResource{ - // { - // ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/publicIPAddresses/PublicIpAddress1"), - // }}, - // PublicIPPrefixes: []*armnetwork.SubResource{ - // { - // ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/publicIPPrefixes/PublicIpPrefix1"), - // }}, - // Subnets: []*armnetwork.SubResource{ - // { - // ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/virtualNetworks/test-vnet/subnets/subnet1"), - // }}, - // }, - // SKU: &armnetwork.NatGatewaySKU{ - // Name: to.Ptr(armnetwork.NatGatewaySKUNameStandard), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/4883fa5dbf6f2c9093fac8ce334547e9dfac68fa/specification/network/resource-manager/Microsoft.Network/stable/2024-03-01/examples/NatGatewayUpdateTags.json -func ExampleNatGatewaysClient_UpdateTags() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armnetwork.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewNatGatewaysClient().UpdateTags(ctx, "rg1", "test-natGateway", armnetwork.TagsObject{ - Tags: map[string]*string{ - "tag1": to.Ptr("value1"), - "tag2": to.Ptr("value2"), - }, - }, nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.NatGateway = armnetwork.NatGateway{ - // Name: to.Ptr("test-natGateway"), - // Type: to.Ptr("Microsoft.Network/natGateways"), - // ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/natGateways/test-natGateway"), - // Location: to.Ptr("westus"), - // Tags: map[string]*string{ - // "tag1": to.Ptr("value1"), - // "tag2": to.Ptr("value2"), - // }, - // Properties: &armnetwork.NatGatewayPropertiesFormat{ - // IdleTimeoutInMinutes: to.Ptr[int32](5), - // ProvisioningState: to.Ptr(armnetwork.ProvisioningStateSucceeded), - // PublicIPAddresses: []*armnetwork.SubResource{ - // { - // ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/publicIPAddresses/PublicIpAddress1"), - // }}, - // PublicIPPrefixes: []*armnetwork.SubResource{ - // { - // ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/publicIPPrefixes/PublicIpPrefix1"), - // }}, - // Subnets: []*armnetwork.SubResource{ - // { - // ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/virtualNetworks/test-vnet/subnets/subnet1"), - // }}, - // }, - // SKU: &armnetwork.NatGatewaySKU{ - // Name: to.Ptr(armnetwork.NatGatewaySKUNameStandard), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/4883fa5dbf6f2c9093fac8ce334547e9dfac68fa/specification/network/resource-manager/Microsoft.Network/stable/2024-03-01/examples/NatGatewayListAll.json -func ExampleNatGatewaysClient_NewListAllPager() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armnetwork.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := clientFactory.NewNatGatewaysClient().NewListAllPager(nil) - for pager.More() { - page, err := pager.NextPage(ctx) - if err != nil { - log.Fatalf("failed to advance page: %v", err) - } - for _, v := range page.Value { - // You could use page here. We use blank identifier for just demo purposes. - _ = v - } - // If the HTTP response code is 200 as defined in example definition, your page structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // page.NatGatewayListResult = armnetwork.NatGatewayListResult{ - // Value: []*armnetwork.NatGateway{ - // { - // Name: to.Ptr("test-natGateway"), - // Type: to.Ptr("Microsoft.Network/natGateways"), - // ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/natGateways/test-natGateway"), - // Location: to.Ptr("westus"), - // Properties: &armnetwork.NatGatewayPropertiesFormat{ - // IdleTimeoutInMinutes: to.Ptr[int32](5), - // ProvisioningState: to.Ptr(armnetwork.ProvisioningStateSucceeded), - // PublicIPAddresses: []*armnetwork.SubResource{ - // { - // ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/publicIPAddresses/PublicIpAddress1"), - // }}, - // PublicIPPrefixes: []*armnetwork.SubResource{ - // { - // ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/publicIPPrefixes/PublicIpPrefix1"), - // }}, - // Subnets: []*armnetwork.SubResource{ - // { - // ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/virtualNetworks/test-vnet/subnets/subnet1"), - // }}, - // }, - // SKU: &armnetwork.NatGatewaySKU{ - // Name: to.Ptr(armnetwork.NatGatewaySKUNameStandard), - // }, - // }, - // { - // Name: to.Ptr("test-natGateway2"), - // Type: to.Ptr("Microsoft.Network/natGateways"), - // ID: to.Ptr("/subscriptions/subid/resourceGroups/rg2/providers/Microsoft.Network/natGatewayes/test-natGateway2"), - // Location: to.Ptr("westus"), - // Properties: &armnetwork.NatGatewayPropertiesFormat{ - // IdleTimeoutInMinutes: to.Ptr[int32](5), - // ProvisioningState: to.Ptr(armnetwork.ProvisioningStateSucceeded), - // PublicIPAddresses: []*armnetwork.SubResource{ - // { - // ID: to.Ptr("/subscriptions/subid/resourceGroups/rg2/providers/Microsoft.Network/publicIPAddresses/PublicIpAddress1"), - // }}, - // PublicIPPrefixes: []*armnetwork.SubResource{ - // { - // ID: to.Ptr("/subscriptions/subid/resourceGroups/rg2/providers/Microsoft.Network/publicIPPrefixes/PublicIpPrefix1"), - // }}, - // Subnets: []*armnetwork.SubResource{ - // { - // ID: to.Ptr("/subscriptions/subid/resourceGroups/rg2/providers/Microsoft.Network/virtualNetworks/test-vnet/subnets/subnet1"), - // }}, - // }, - // SKU: &armnetwork.NatGatewaySKU{ - // Name: to.Ptr(armnetwork.NatGatewaySKUNameStandard), - // }, - // }}, - // } - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/4883fa5dbf6f2c9093fac8ce334547e9dfac68fa/specification/network/resource-manager/Microsoft.Network/stable/2024-03-01/examples/NatGatewayList.json -func ExampleNatGatewaysClient_NewListPager() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armnetwork.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := clientFactory.NewNatGatewaysClient().NewListPager("rg1", nil) - for pager.More() { - page, err := pager.NextPage(ctx) - if err != nil { - log.Fatalf("failed to advance page: %v", err) - } - for _, v := range page.Value { - // You could use page here. We use blank identifier for just demo purposes. - _ = v - } - // If the HTTP response code is 200 as defined in example definition, your page structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // page.NatGatewayListResult = armnetwork.NatGatewayListResult{ - // Value: []*armnetwork.NatGateway{ - // { - // Name: to.Ptr("test-natGateway"), - // Type: to.Ptr("Microsoft.Network/natGateways"), - // ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/natGateway/test-natGateway"), - // Location: to.Ptr("westus"), - // Properties: &armnetwork.NatGatewayPropertiesFormat{ - // IdleTimeoutInMinutes: to.Ptr[int32](5), - // ProvisioningState: to.Ptr(armnetwork.ProvisioningStateSucceeded), - // PublicIPAddresses: []*armnetwork.SubResource{ - // { - // ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/publicIPAddresses/PublicIpAddress1"), - // }}, - // PublicIPPrefixes: []*armnetwork.SubResource{ - // { - // ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/publicIPPrefixes/PublicIpPrefix1"), - // }}, - // Subnets: []*armnetwork.SubResource{ - // { - // ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/virtualNetworks/test-vnet/subnets/subnet1"), - // }}, - // }, - // SKU: &armnetwork.NatGatewaySKU{ - // Name: to.Ptr(armnetwork.NatGatewaySKUNameStandard), - // }, - // }, - // { - // Name: to.Ptr("test-natGateway2"), - // Type: to.Ptr("Microsoft.Network/natGateways"), - // ID: to.Ptr("/subscriptions/subid/resourceGroups/rg2/providers/Microsoft.Network/natGateway/test-natGateway2"), - // Location: to.Ptr("westus"), - // Properties: &armnetwork.NatGatewayPropertiesFormat{ - // IdleTimeoutInMinutes: to.Ptr[int32](5), - // ProvisioningState: to.Ptr(armnetwork.ProvisioningStateSucceeded), - // PublicIPAddresses: []*armnetwork.SubResource{ - // { - // ID: to.Ptr("/subscriptions/subid/resourceGroups/rg2/providers/Microsoft.Network/publicIPAddresses/PublicIpAddress1"), - // }}, - // PublicIPPrefixes: []*armnetwork.SubResource{ - // { - // ID: to.Ptr("/subscriptions/subid/resourceGroups/rg2/providers/Microsoft.Network/publicIPPrefixes/PublicIpPrefix1"), - // }}, - // Subnets: []*armnetwork.SubResource{ - // { - // ID: to.Ptr("/subscriptions/subid/resourceGroups/rg2/providers/Microsoft.Network/virtualNetworks/test-vnet/subnets/subnet1"), - // }}, - // }, - // SKU: &armnetwork.NatGatewaySKU{ - // Name: to.Ptr(armnetwork.NatGatewaySKUNameStandard), - // }, - // }}, - // } - } -} diff --git a/sdk/resourcemanager/network/armnetwork/natrules_client_example_test.go b/sdk/resourcemanager/network/armnetwork/natrules_client_example_test.go deleted file mode 100644 index b99bed269e3c..000000000000 --- a/sdk/resourcemanager/network/armnetwork/natrules_client_example_test.go +++ /dev/null @@ -1,172 +0,0 @@ -//go:build go1.18 -// +build go1.18 - -// 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. -// DO NOT EDIT. - -package armnetwork_test - -import ( - "context" - "log" - - "github.com/Azure/azure-sdk-for-go/sdk/azcore/to" - "github.com/Azure/azure-sdk-for-go/sdk/azidentity" - "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/network/armnetwork/v6" -) - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/4883fa5dbf6f2c9093fac8ce334547e9dfac68fa/specification/network/resource-manager/Microsoft.Network/stable/2024-03-01/examples/NatRuleGet.json -func ExampleNatRulesClient_Get() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armnetwork.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewNatRulesClient().Get(ctx, "rg1", "gateway1", "natRule1", nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.VPNGatewayNatRule = armnetwork.VPNGatewayNatRule{ - // ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/vpnGateways/gateway1/natRules/natRule1"), - // Name: to.Ptr("natRule1"), - // Etag: to.Ptr("w/\\00000000-0000-0000-0000-000000000000\\"), - // Properties: &armnetwork.VPNGatewayNatRuleProperties{ - // Type: to.Ptr(armnetwork.VPNNatRuleTypeStatic), - // EgressVPNSiteLinkConnections: []*armnetwork.SubResource{ - // }, - // ExternalMappings: []*armnetwork.VPNNatRuleMapping{ - // }, - // IngressVPNSiteLinkConnections: []*armnetwork.SubResource{ - // }, - // InternalMappings: []*armnetwork.VPNNatRuleMapping{ - // { - // AddressSpace: to.Ptr("10.4.0.0/24"), - // }}, - // Mode: to.Ptr(armnetwork.VPNNatRuleModeEgressSnat), - // ProvisioningState: to.Ptr(armnetwork.ProvisioningStateSucceeded), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/4883fa5dbf6f2c9093fac8ce334547e9dfac68fa/specification/network/resource-manager/Microsoft.Network/stable/2024-03-01/examples/NatRulePut.json -func ExampleNatRulesClient_BeginCreateOrUpdate() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armnetwork.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewNatRulesClient().BeginCreateOrUpdate(ctx, "rg1", "gateway1", "natRule1", armnetwork.VPNGatewayNatRule{ - Properties: &armnetwork.VPNGatewayNatRuleProperties{ - Type: to.Ptr(armnetwork.VPNNatRuleTypeStatic), - ExternalMappings: []*armnetwork.VPNNatRuleMapping{ - { - AddressSpace: to.Ptr("192.168.21.0/24"), - }}, - InternalMappings: []*armnetwork.VPNNatRuleMapping{ - { - AddressSpace: to.Ptr("10.4.0.0/24"), - }}, - IPConfigurationID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/virtualNetworkGateways/cloudnet1-VNG/ipConfigurations/default"), - Mode: to.Ptr(armnetwork.VPNNatRuleModeEgressSnat), - }, - }, nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - res, err := poller.PollUntilDone(ctx, nil) - if err != nil { - log.Fatalf("failed to pull the result: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.VPNGatewayNatRule = armnetwork.VPNGatewayNatRule{ - // ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/vpnGateways/gateway1/natRules/natRule1"), - // Name: to.Ptr("natRule1"), - // Etag: to.Ptr("w/\\00000000-0000-0000-0000-000000000000\\"), - // Properties: &armnetwork.VPNGatewayNatRuleProperties{ - // Type: to.Ptr(armnetwork.VPNNatRuleTypeStatic), - // EgressVPNSiteLinkConnections: []*armnetwork.SubResource{ - // { - // ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/vpnGateways/gateway1/vpnConnections/vpnConnection1/vpnLinkConnections/vpnLinkConnection1"), - // }}, - // ExternalMappings: []*armnetwork.VPNNatRuleMapping{ - // { - // AddressSpace: to.Ptr("192.168.21.0/24"), - // }}, - // IngressVPNSiteLinkConnections: []*armnetwork.SubResource{ - // { - // ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/vpnGateways/gateway1/vpnConnections/vpnConnection1/vpnLinkConnections/vpnLinkConnection2"), - // }}, - // InternalMappings: []*armnetwork.VPNNatRuleMapping{ - // { - // AddressSpace: to.Ptr("10.4.0.0/24"), - // }}, - // IPConfigurationID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/virtualNetworkGateways/cloudnet1-VNG/ipConfigurations/default"), - // Mode: to.Ptr(armnetwork.VPNNatRuleModeEgressSnat), - // ProvisioningState: to.Ptr(armnetwork.ProvisioningStateSucceeded), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/4883fa5dbf6f2c9093fac8ce334547e9dfac68fa/specification/network/resource-manager/Microsoft.Network/stable/2024-03-01/examples/NatRuleDelete.json -func ExampleNatRulesClient_BeginDelete() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armnetwork.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewNatRulesClient().BeginDelete(ctx, "rg1", "gateway1", "natRule1", nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - _, err = poller.PollUntilDone(ctx, nil) - if err != nil { - log.Fatalf("failed to pull the result: %v", err) - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/4883fa5dbf6f2c9093fac8ce334547e9dfac68fa/specification/network/resource-manager/Microsoft.Network/stable/2024-03-01/examples/NatRuleList.json -func ExampleNatRulesClient_NewListByVPNGatewayPager() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armnetwork.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := clientFactory.NewNatRulesClient().NewListByVPNGatewayPager("rg1", "gateway1", nil) - for pager.More() { - page, err := pager.NextPage(ctx) - if err != nil { - log.Fatalf("failed to advance page: %v", err) - } - for _, v := range page.Value { - // You could use page here. We use blank identifier for just demo purposes. - _ = v - } - // If the HTTP response code is 200 as defined in example definition, your page structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // page.ListVPNGatewayNatRulesResult = armnetwork.ListVPNGatewayNatRulesResult{ - // } - } -} diff --git a/sdk/resourcemanager/network/armnetwork/operations_client_example_test.go b/sdk/resourcemanager/network/armnetwork/operations_client_example_test.go deleted file mode 100644 index b3dfcba313ec..000000000000 --- a/sdk/resourcemanager/network/armnetwork/operations_client_example_test.go +++ /dev/null @@ -1,166 +0,0 @@ -//go:build go1.18 -// +build go1.18 - -// 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. -// DO NOT EDIT. - -package armnetwork_test - -import ( - "context" - "log" - - "github.com/Azure/azure-sdk-for-go/sdk/azidentity" - "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/network/armnetwork/v6" -) - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/4883fa5dbf6f2c9093fac8ce334547e9dfac68fa/specification/network/resource-manager/Microsoft.Network/stable/2024-03-01/examples/OperationList.json -func ExampleOperationsClient_NewListPager() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armnetwork.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := clientFactory.NewOperationsClient().NewListPager(nil) - for pager.More() { - page, err := pager.NextPage(ctx) - if err != nil { - log.Fatalf("failed to advance page: %v", err) - } - for _, v := range page.Value { - // You could use page here. We use blank identifier for just demo purposes. - _ = v - } - // If the HTTP response code is 200 as defined in example definition, your page structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // page.OperationListResult = armnetwork.OperationListResult{ - // Value: []*armnetwork.Operation{ - // { - // Name: to.Ptr("Microsoft.Network/localnetworkgateways/read"), - // Display: &armnetwork.OperationDisplay{ - // Description: to.Ptr("Gets LocalNetworkGateway"), - // Operation: to.Ptr("Get LocalNetworkGateway"), - // Provider: to.Ptr("Microsoft Network"), - // Resource: to.Ptr("LocalNetworkGateway"), - // }, - // }, - // { - // Name: to.Ptr("Microsoft.Network/localnetworkgateways/write"), - // Display: &armnetwork.OperationDisplay{ - // Description: to.Ptr("Creates or updates an existing LocalNetworkGateway"), - // Operation: to.Ptr("Create or update LocalNetworkGateway"), - // Provider: to.Ptr("Microsoft Network"), - // Resource: to.Ptr("LocalNetworkGateway"), - // }, - // }, - // { - // Name: to.Ptr("Microsoft.Network/localnetworkgateways/delete"), - // Display: &armnetwork.OperationDisplay{ - // Description: to.Ptr("Deletes LocalNetworkGateway"), - // Operation: to.Ptr("Delete LocalNetworkGateway"), - // Provider: to.Ptr("Microsoft Network"), - // Resource: to.Ptr("LocalNetworkGateway"), - // }, - // }, - // { - // Name: to.Ptr("Microsoft.Network/networkInterfaces/providers/Microsoft.Insights/metricDefinitions/read"), - // Display: &armnetwork.OperationDisplay{ - // Description: to.Ptr("Gets available metrics for the Network Interface"), - // Operation: to.Ptr("Read Network Interface metric definitions"), - // Provider: to.Ptr("Microsoft Network"), - // Resource: to.Ptr("Network Interface metric definition"), - // }, - // Origin: to.Ptr("system"), - // Properties: &armnetwork.OperationPropertiesFormat{ - // ServiceSpecification: &armnetwork.OperationPropertiesFormatServiceSpecification{ - // MetricSpecifications: []*armnetwork.MetricSpecification{ - // { - // Name: to.Ptr("BytesSentRate"), - // AggregationType: to.Ptr("Total"), - // Availabilities: []*armnetwork.Availability{ - // { - // BlobDuration: to.Ptr("01:00:00"), - // Retention: to.Ptr("00:00:00"), - // TimeGrain: to.Ptr("00:01:00"), - // }, - // { - // BlobDuration: to.Ptr("1.00:00:00"), - // Retention: to.Ptr("00:00:00"), - // TimeGrain: to.Ptr("01:00:00"), - // }}, - // Dimensions: []*armnetwork.Dimension{ - // }, - // DisplayDescription: to.Ptr("Number of bytes the Network Interface sent"), - // DisplayName: to.Ptr("Bytes Sent"), - // EnableRegionalMdmAccount: to.Ptr(false), - // FillGapWithZero: to.Ptr(false), - // IsInternal: to.Ptr(false), - // MetricFilterPattern: to.Ptr("^__Ready__$"), - // Unit: to.Ptr("Count"), - // }, - // { - // Name: to.Ptr("BytesReceivedRate"), - // AggregationType: to.Ptr("Total"), - // Availabilities: []*armnetwork.Availability{ - // { - // BlobDuration: to.Ptr("01:00:00"), - // Retention: to.Ptr("00:00:00"), - // TimeGrain: to.Ptr("00:01:00"), - // }, - // { - // BlobDuration: to.Ptr("1.00:00:00"), - // Retention: to.Ptr("00:00:00"), - // TimeGrain: to.Ptr("01:00:00"), - // }}, - // Dimensions: []*armnetwork.Dimension{ - // }, - // DisplayDescription: to.Ptr("Number of bytes the Network Interface received"), - // DisplayName: to.Ptr("Bytes Received"), - // EnableRegionalMdmAccount: to.Ptr(false), - // FillGapWithZero: to.Ptr(false), - // IsInternal: to.Ptr(false), - // MetricFilterPattern: to.Ptr("^__Ready__$"), - // Unit: to.Ptr("Count"), - // }}, - // }, - // }, - // }, - // { - // Name: to.Ptr("Microsoft.Network/networksecuritygroups/providers/Microsoft.Insights/logDefinitions/read"), - // Display: &armnetwork.OperationDisplay{ - // Description: to.Ptr("Gets the events for network security group"), - // Operation: to.Ptr("Get Network Security Group Event Log Definitions"), - // Provider: to.Ptr("Microsoft Network"), - // Resource: to.Ptr("Network Security Groups Log Definitions"), - // }, - // Origin: to.Ptr("system"), - // Properties: &armnetwork.OperationPropertiesFormat{ - // ServiceSpecification: &armnetwork.OperationPropertiesFormatServiceSpecification{ - // LogSpecifications: []*armnetwork.LogSpecification{ - // { - // Name: to.Ptr("NetworkSecurityGroupEvent"), - // BlobDuration: to.Ptr("PT1H"), - // DisplayName: to.Ptr("Network Security Group Event"), - // }, - // { - // Name: to.Ptr("NetworkSecurityGroupRuleCounter"), - // BlobDuration: to.Ptr("PT1H"), - // DisplayName: to.Ptr("Network Security Group Rule Counter"), - // }, - // { - // Name: to.Ptr("NetworkSecurityGroupFlowEvent"), - // BlobDuration: to.Ptr("PT1H"), - // DisplayName: to.Ptr("Network Security Group Rule Flow Event"), - // }}, - // }, - // }, - // }}, - // } - } -} diff --git a/sdk/resourcemanager/network/armnetwork/p2svpngateways_client_example_test.go b/sdk/resourcemanager/network/armnetwork/p2svpngateways_client_example_test.go deleted file mode 100644 index 152cc65a83dd..000000000000 --- a/sdk/resourcemanager/network/armnetwork/p2svpngateways_client_example_test.go +++ /dev/null @@ -1,1079 +0,0 @@ -//go:build go1.18 -// +build go1.18 - -// 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. -// DO NOT EDIT. - -package armnetwork_test - -import ( - "context" - "log" - - "github.com/Azure/azure-sdk-for-go/sdk/azcore/to" - "github.com/Azure/azure-sdk-for-go/sdk/azidentity" - "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/network/armnetwork/v6" -) - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/4883fa5dbf6f2c9093fac8ce334547e9dfac68fa/specification/network/resource-manager/Microsoft.Network/stable/2024-03-01/examples/P2SVpnGatewayGet.json -func ExampleP2SVPNGatewaysClient_Get() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armnetwork.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewP2SVPNGatewaysClient().Get(ctx, "rg1", "p2sVpnGateway1", nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.P2SVPNGateway = armnetwork.P2SVPNGateway{ - // Name: to.Ptr("p2sVpnGateway1"), - // Type: to.Ptr("Microsoft.Network/p2sVpnGateways"), - // ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/P2SvpnGateways/p2sVpnGateway1"), - // Location: to.Ptr("West US"), - // Etag: to.Ptr("w/\\00000000-0000-0000-0000-000000000000\\"), - // Properties: &armnetwork.P2SVPNGatewayProperties{ - // CustomDNSServers: []*string{ - // to.Ptr("3.3.3.3")}, - // IsRoutingPreferenceInternet: to.Ptr(false), - // P2SConnectionConfigurations: []*armnetwork.P2SConnectionConfiguration{ - // { - // ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/p2sVpnGateways/p2sVpnGateway1/p2sConnectionConfigurations/P2SConnectionConfig1"), - // Name: to.Ptr("P2SConnectionConfig1"), - // Etag: to.Ptr("w/\\00000000-0000-0000-0000-000000000000\\"), - // Properties: &armnetwork.P2SConnectionConfigurationProperties{ - // ConfigurationPolicyGroupAssociations: []*armnetwork.SubResource{ - // { - // ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/vpnServerConfigurations/vpnServerConfiguration1/configurationPolicyGroups/policyGroup1"), - // }}, - // EnableInternetSecurity: to.Ptr(false), - // PreviousConfigurationPolicyGroupAssociations: []*armnetwork.VPNServerConfigurationPolicyGroup{ - // { - // ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/vpnServerConfigurations/vpnServerConfiguration1/vpnServerConfigurationPolicyGroups/policyGroup1"), - // Name: to.Ptr("policyGroup1"), - // Properties: &armnetwork.VPNServerConfigurationPolicyGroupProperties{ - // IsDefault: to.Ptr(true), - // PolicyMembers: []*armnetwork.VPNServerConfigurationPolicyGroupMember{ - // { - // Name: to.Ptr("policy1"), - // AttributeType: to.Ptr(armnetwork.VPNPolicyMemberAttributeTypeRadiusAzureGroupID), - // AttributeValue: to.Ptr("6ad1bd08"), - // }}, - // Priority: to.Ptr[int32](0), - // ProvisioningState: to.Ptr(armnetwork.ProvisioningStateSucceeded), - // }, - // }}, - // ProvisioningState: to.Ptr(armnetwork.ProvisioningStateSucceeded), - // RoutingConfiguration: &armnetwork.RoutingConfiguration{ - // AssociatedRouteTable: &armnetwork.SubResource{ - // ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/virtualHubs/virtualHub1/hubRouteTables/hubRouteTable1"), - // }, - // PropagatedRouteTables: &armnetwork.PropagatedRouteTable{ - // IDs: []*armnetwork.SubResource{ - // { - // ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/virtualHubs/virtualHub1/hubRouteTables/hubRouteTable1"), - // }, - // { - // ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/virtualHubs/virtualHub1/hubRouteTables/hubRouteTable2"), - // }, - // { - // ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/virtualHubs/virtualHub1/hubRouteTables/hubRouteTable3"), - // }}, - // Labels: []*string{ - // to.Ptr("label1"), - // to.Ptr("label2")}, - // }, - // VnetRoutes: &armnetwork.VnetRoute{ - // StaticRoutes: []*armnetwork.StaticRoute{ - // }, - // }, - // }, - // VPNClientAddressPool: &armnetwork.AddressSpace{ - // AddressPrefixes: []*string{ - // to.Ptr("101.3.0.0/16")}, - // }, - // }, - // }}, - // ProvisioningState: to.Ptr(armnetwork.ProvisioningStateSucceeded), - // VirtualHub: &armnetwork.SubResource{ - // ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/virtualHubs/virtualHub1"), - // }, - // VPNClientConnectionHealth: &armnetwork.VPNClientConnectionHealth{ - // AllocatedIPAddresses: []*string{ - // to.Ptr("1.1.1.1"), - // to.Ptr("2.2.2.2")}, - // TotalEgressBytesTransferred: to.Ptr[int64](3000), - // TotalIngressBytesTransferred: to.Ptr[int64](2000), - // VPNClientConnectionsCount: to.Ptr[int32](2), - // }, - // VPNGatewayScaleUnit: to.Ptr[int32](1), - // VPNServerConfiguration: &armnetwork.SubResource{ - // ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/vpnServerConfigurations/vpnServerConfiguration1"), - // }, - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/4883fa5dbf6f2c9093fac8ce334547e9dfac68fa/specification/network/resource-manager/Microsoft.Network/stable/2024-03-01/examples/P2SVpnGatewayPut.json -func ExampleP2SVPNGatewaysClient_BeginCreateOrUpdate() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armnetwork.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewP2SVPNGatewaysClient().BeginCreateOrUpdate(ctx, "rg1", "p2sVpnGateway1", armnetwork.P2SVPNGateway{ - Location: to.Ptr("West US"), - Tags: map[string]*string{ - "key1": to.Ptr("value1"), - }, - Properties: &armnetwork.P2SVPNGatewayProperties{ - CustomDNSServers: []*string{ - to.Ptr("1.1.1.1"), - to.Ptr("2.2.2.2")}, - IsRoutingPreferenceInternet: to.Ptr(false), - P2SConnectionConfigurations: []*armnetwork.P2SConnectionConfiguration{ - { - ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/p2sVpnGateways/p2sVpnGateway1/p2sConnectionConfigurations/P2SConnectionConfig1"), - Name: to.Ptr("P2SConnectionConfig1"), - Properties: &armnetwork.P2SConnectionConfigurationProperties{ - RoutingConfiguration: &armnetwork.RoutingConfiguration{ - AssociatedRouteTable: &armnetwork.SubResource{ - ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/virtualHubs/virtualHub1/hubRouteTables/hubRouteTable1"), - }, - PropagatedRouteTables: &armnetwork.PropagatedRouteTable{ - IDs: []*armnetwork.SubResource{ - { - ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/virtualHubs/virtualHub1/hubRouteTables/hubRouteTable1"), - }, - { - ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/virtualHubs/virtualHub1/hubRouteTables/hubRouteTable2"), - }, - { - ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/virtualHubs/virtualHub1/hubRouteTables/hubRouteTable3"), - }}, - Labels: []*string{ - to.Ptr("label1"), - to.Ptr("label2")}, - }, - VnetRoutes: &armnetwork.VnetRoute{ - StaticRoutes: []*armnetwork.StaticRoute{}, - }, - }, - VPNClientAddressPool: &armnetwork.AddressSpace{ - AddressPrefixes: []*string{ - to.Ptr("101.3.0.0/16")}, - }, - }, - }}, - VirtualHub: &armnetwork.SubResource{ - ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/virtualHubs/virtualHub1"), - }, - VPNGatewayScaleUnit: to.Ptr[int32](1), - VPNServerConfiguration: &armnetwork.SubResource{ - ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/vpnServerConfigurations/vpnServerConfiguration1"), - }, - }, - }, nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - res, err := poller.PollUntilDone(ctx, nil) - if err != nil { - log.Fatalf("failed to pull the result: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.P2SVPNGateway = armnetwork.P2SVPNGateway{ - // Name: to.Ptr("p2sVpnGateway1"), - // Type: to.Ptr("Microsoft.Network/p2sVpnGateways"), - // ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/P2SvpnGateways/p2sVpnGateway1"), - // Location: to.Ptr("West US"), - // Etag: to.Ptr("w/\\00000000-0000-0000-0000-000000000000\\"), - // Properties: &armnetwork.P2SVPNGatewayProperties{ - // CustomDNSServers: []*string{ - // to.Ptr("1.1.1.1"), - // to.Ptr("2.2.2.2")}, - // IsRoutingPreferenceInternet: to.Ptr(false), - // P2SConnectionConfigurations: []*armnetwork.P2SConnectionConfiguration{ - // { - // ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/p2sVpnGateways/p2sVpnGateway1/p2sConnectionConfigurations/P2SConnectionConfig1"), - // Name: to.Ptr("P2SConnectionConfig1"), - // Etag: to.Ptr("w/\\00000000-0000-0000-0000-000000000000\\"), - // Properties: &armnetwork.P2SConnectionConfigurationProperties{ - // ConfigurationPolicyGroupAssociations: []*armnetwork.SubResource{ - // { - // ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/vpnServerConfigurations/vpnServerConfiguration1/configurationPolicyGroups/policyGroup1"), - // }}, - // EnableInternetSecurity: to.Ptr(false), - // PreviousConfigurationPolicyGroupAssociations: []*armnetwork.VPNServerConfigurationPolicyGroup{ - // { - // ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/vpnServerConfigurations/vpnServerConfiguration1/vpnServerConfigurationPolicyGroups/policyGroup1"), - // Name: to.Ptr("policyGroup1"), - // Properties: &armnetwork.VPNServerConfigurationPolicyGroupProperties{ - // IsDefault: to.Ptr(true), - // PolicyMembers: []*armnetwork.VPNServerConfigurationPolicyGroupMember{ - // { - // Name: to.Ptr("policy1"), - // AttributeType: to.Ptr(armnetwork.VPNPolicyMemberAttributeTypeRadiusAzureGroupID), - // AttributeValue: to.Ptr("6ad1bd08"), - // }}, - // Priority: to.Ptr[int32](0), - // ProvisioningState: to.Ptr(armnetwork.ProvisioningStateSucceeded), - // }, - // }}, - // ProvisioningState: to.Ptr(armnetwork.ProvisioningStateSucceeded), - // RoutingConfiguration: &armnetwork.RoutingConfiguration{ - // AssociatedRouteTable: &armnetwork.SubResource{ - // ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/virtualHubs/virtualHub1/hubRouteTables/hubRouteTable1"), - // }, - // PropagatedRouteTables: &armnetwork.PropagatedRouteTable{ - // IDs: []*armnetwork.SubResource{ - // { - // ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/virtualHubs/virtualHub1/hubRouteTables/hubRouteTable1"), - // }, - // { - // ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/virtualHubs/virtualHub1/hubRouteTables/hubRouteTable2"), - // }, - // { - // ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/virtualHubs/virtualHub1/hubRouteTables/hubRouteTable3"), - // }}, - // Labels: []*string{ - // to.Ptr("label1"), - // to.Ptr("label2")}, - // }, - // VnetRoutes: &armnetwork.VnetRoute{ - // StaticRoutes: []*armnetwork.StaticRoute{ - // }, - // }, - // }, - // VPNClientAddressPool: &armnetwork.AddressSpace{ - // AddressPrefixes: []*string{ - // to.Ptr("101.3.0.0/16")}, - // }, - // }, - // }}, - // ProvisioningState: to.Ptr(armnetwork.ProvisioningStateSucceeded), - // VirtualHub: &armnetwork.SubResource{ - // ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/virtualHubs/virtualHub1"), - // }, - // VPNClientConnectionHealth: &armnetwork.VPNClientConnectionHealth{ - // AllocatedIPAddresses: []*string{ - // }, - // TotalEgressBytesTransferred: to.Ptr[int64](0), - // TotalIngressBytesTransferred: to.Ptr[int64](0), - // VPNClientConnectionsCount: to.Ptr[int32](0), - // }, - // VPNGatewayScaleUnit: to.Ptr[int32](1), - // VPNServerConfiguration: &armnetwork.SubResource{ - // ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/vpnServerConfigurations/vpnServerConfiguration1"), - // }, - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/4883fa5dbf6f2c9093fac8ce334547e9dfac68fa/specification/network/resource-manager/Microsoft.Network/stable/2024-03-01/examples/P2SVpnGatewayUpdateTags.json -func ExampleP2SVPNGatewaysClient_BeginUpdateTags() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armnetwork.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewP2SVPNGatewaysClient().BeginUpdateTags(ctx, "rg1", "p2sVpnGateway1", armnetwork.TagsObject{ - Tags: map[string]*string{ - "tag1": to.Ptr("value1"), - "tag2": to.Ptr("value2"), - }, - }, nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - res, err := poller.PollUntilDone(ctx, nil) - if err != nil { - log.Fatalf("failed to pull the result: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.P2SVPNGateway = armnetwork.P2SVPNGateway{ - // Name: to.Ptr("p2sVpnGateway1"), - // Type: to.Ptr("Microsoft.Network/p2sVpnGateways"), - // ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/P2SvpnGateways/p2sVpnGateway1"), - // Location: to.Ptr("West US"), - // Tags: map[string]*string{ - // "key1": to.Ptr("value1"), - // "key2": to.Ptr("value2"), - // }, - // Etag: to.Ptr("w/\\00000000-0000-0000-0000-000000000000\\"), - // Properties: &armnetwork.P2SVPNGatewayProperties{ - // CustomDNSServers: []*string{ - // to.Ptr("3.3.3.3")}, - // IsRoutingPreferenceInternet: to.Ptr(false), - // P2SConnectionConfigurations: []*armnetwork.P2SConnectionConfiguration{ - // { - // ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/p2sVpnGateways/p2sVpnGateway1/p2sConnectionConfigurations/P2SConnectionConfig1"), - // Name: to.Ptr("P2SConnectionConfig1"), - // Properties: &armnetwork.P2SConnectionConfigurationProperties{ - // ConfigurationPolicyGroupAssociations: []*armnetwork.SubResource{ - // { - // ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/vpnServerConfigurations/vpnServerConfiguration1/configurationPolicyGroups/policyGroup1"), - // }}, - // EnableInternetSecurity: to.Ptr(false), - // PreviousConfigurationPolicyGroupAssociations: []*armnetwork.VPNServerConfigurationPolicyGroup{ - // { - // ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/vpnServerConfigurations/vpnServerConfiguration1/vpnServerConfigurationPolicyGroups/policyGroup1"), - // Name: to.Ptr("policyGroup1"), - // Properties: &armnetwork.VPNServerConfigurationPolicyGroupProperties{ - // IsDefault: to.Ptr(true), - // PolicyMembers: []*armnetwork.VPNServerConfigurationPolicyGroupMember{ - // { - // Name: to.Ptr("policy1"), - // AttributeType: to.Ptr(armnetwork.VPNPolicyMemberAttributeTypeRadiusAzureGroupID), - // AttributeValue: to.Ptr("6ad1bd08"), - // }}, - // Priority: to.Ptr[int32](0), - // ProvisioningState: to.Ptr(armnetwork.ProvisioningStateSucceeded), - // }, - // }}, - // RoutingConfiguration: &armnetwork.RoutingConfiguration{ - // AssociatedRouteTable: &armnetwork.SubResource{ - // ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/virtualHubs/virtualHub1/hubRouteTables/hubRouteTable1"), - // }, - // PropagatedRouteTables: &armnetwork.PropagatedRouteTable{ - // IDs: []*armnetwork.SubResource{ - // { - // ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/virtualHubs/virtualHub1/hubRouteTables/hubRouteTable1"), - // }, - // { - // ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/virtualHubs/virtualHub1/hubRouteTables/hubRouteTable2"), - // }, - // { - // ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/virtualHubs/virtualHub1/hubRouteTables/hubRouteTable3"), - // }}, - // Labels: []*string{ - // to.Ptr("label1"), - // to.Ptr("label2")}, - // }, - // VnetRoutes: &armnetwork.VnetRoute{ - // StaticRoutes: []*armnetwork.StaticRoute{ - // }, - // }, - // }, - // VPNClientAddressPool: &armnetwork.AddressSpace{ - // AddressPrefixes: []*string{ - // to.Ptr("101.3.0.0/16")}, - // }, - // }, - // }}, - // ProvisioningState: to.Ptr(armnetwork.ProvisioningStateSucceeded), - // VirtualHub: &armnetwork.SubResource{ - // ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/virtualHubs/virtualHub1"), - // }, - // VPNClientConnectionHealth: &armnetwork.VPNClientConnectionHealth{ - // AllocatedIPAddresses: []*string{ - // to.Ptr("1.1.1.1"), - // to.Ptr("2.2.2.2")}, - // TotalEgressBytesTransferred: to.Ptr[int64](3000), - // TotalIngressBytesTransferred: to.Ptr[int64](2000), - // VPNClientConnectionsCount: to.Ptr[int32](2), - // }, - // VPNGatewayScaleUnit: to.Ptr[int32](1), - // VPNServerConfiguration: &armnetwork.SubResource{ - // ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/vpnServerConfigurations/vpnServerConfiguration1"), - // }, - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/4883fa5dbf6f2c9093fac8ce334547e9dfac68fa/specification/network/resource-manager/Microsoft.Network/stable/2024-03-01/examples/P2SVpnGatewayDelete.json -func ExampleP2SVPNGatewaysClient_BeginDelete() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armnetwork.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewP2SVPNGatewaysClient().BeginDelete(ctx, "rg1", "p2sVpnGateway1", nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - _, err = poller.PollUntilDone(ctx, nil) - if err != nil { - log.Fatalf("failed to pull the result: %v", err) - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/4883fa5dbf6f2c9093fac8ce334547e9dfac68fa/specification/network/resource-manager/Microsoft.Network/stable/2024-03-01/examples/P2SVpnGatewayListByResourceGroup.json -func ExampleP2SVPNGatewaysClient_NewListByResourceGroupPager() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armnetwork.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := clientFactory.NewP2SVPNGatewaysClient().NewListByResourceGroupPager("rg1", nil) - for pager.More() { - page, err := pager.NextPage(ctx) - if err != nil { - log.Fatalf("failed to advance page: %v", err) - } - for _, v := range page.Value { - // You could use page here. We use blank identifier for just demo purposes. - _ = v - } - // If the HTTP response code is 200 as defined in example definition, your page structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // page.ListP2SVPNGatewaysResult = armnetwork.ListP2SVPNGatewaysResult{ - // Value: []*armnetwork.P2SVPNGateway{ - // { - // Name: to.Ptr("p2sVpnGateway1"), - // Type: to.Ptr("Microsoft.Network/p2sVpnGateways"), - // ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/P2SvpnGateways/p2sVpnGateway1"), - // Location: to.Ptr("West US"), - // Etag: to.Ptr("w/\\00000000-0000-0000-0000-000000000000\\"), - // Properties: &armnetwork.P2SVPNGatewayProperties{ - // CustomDNSServers: []*string{ - // to.Ptr("3.3.3.3")}, - // IsRoutingPreferenceInternet: to.Ptr(false), - // P2SConnectionConfigurations: []*armnetwork.P2SConnectionConfiguration{ - // { - // ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/p2sVpnGateways/p2sVpnGateway1/p2sConnectionConfigurations/P2SConnectionConfig1"), - // Name: to.Ptr("P2SConnectionConfig1"), - // Properties: &armnetwork.P2SConnectionConfigurationProperties{ - // ConfigurationPolicyGroupAssociations: []*armnetwork.SubResource{ - // { - // ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/vpnServerConfigurations/vpnServerConfiguration1/configurationPolicyGroups/policyGroup1"), - // }}, - // EnableInternetSecurity: to.Ptr(false), - // PreviousConfigurationPolicyGroupAssociations: []*armnetwork.VPNServerConfigurationPolicyGroup{ - // { - // ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/vpnServerConfigurations/vpnServerConfiguration1/vpnServerConfigurationPolicyGroups/policyGroup1"), - // Name: to.Ptr("policyGroup1"), - // Properties: &armnetwork.VPNServerConfigurationPolicyGroupProperties{ - // IsDefault: to.Ptr(true), - // PolicyMembers: []*armnetwork.VPNServerConfigurationPolicyGroupMember{ - // { - // Name: to.Ptr("policy1"), - // AttributeType: to.Ptr(armnetwork.VPNPolicyMemberAttributeTypeRadiusAzureGroupID), - // AttributeValue: to.Ptr("6ad1bd08"), - // }}, - // Priority: to.Ptr[int32](0), - // ProvisioningState: to.Ptr(armnetwork.ProvisioningStateSucceeded), - // }, - // }}, - // RoutingConfiguration: &armnetwork.RoutingConfiguration{ - // AssociatedRouteTable: &armnetwork.SubResource{ - // ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/virtualHubs/virtualHub1/hubRouteTables/hubRouteTable1"), - // }, - // PropagatedRouteTables: &armnetwork.PropagatedRouteTable{ - // IDs: []*armnetwork.SubResource{ - // { - // ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/virtualHubs/virtualHub1/hubRouteTables/hubRouteTable1"), - // }, - // { - // ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/virtualHubs/virtualHub1/hubRouteTables/hubRouteTable2"), - // }, - // { - // ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/virtualHubs/virtualHub1/hubRouteTables/hubRouteTable3"), - // }}, - // Labels: []*string{ - // to.Ptr("label1"), - // to.Ptr("label2")}, - // }, - // VnetRoutes: &armnetwork.VnetRoute{ - // StaticRoutes: []*armnetwork.StaticRoute{ - // }, - // }, - // }, - // VPNClientAddressPool: &armnetwork.AddressSpace{ - // AddressPrefixes: []*string{ - // to.Ptr("101.3.0.0/16")}, - // }, - // }, - // }}, - // ProvisioningState: to.Ptr(armnetwork.ProvisioningStateSucceeded), - // VirtualHub: &armnetwork.SubResource{ - // ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/virtualHubs/virtualHub1"), - // }, - // VPNClientConnectionHealth: &armnetwork.VPNClientConnectionHealth{ - // AllocatedIPAddresses: []*string{ - // to.Ptr("1.1.1.1"), - // to.Ptr("2.2.2.2")}, - // TotalEgressBytesTransferred: to.Ptr[int64](3000), - // TotalIngressBytesTransferred: to.Ptr[int64](2000), - // VPNClientConnectionsCount: to.Ptr[int32](2), - // }, - // VPNGatewayScaleUnit: to.Ptr[int32](1), - // VPNServerConfiguration: &armnetwork.SubResource{ - // ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/vpnServerConfigurations/vpnServerConfiguration1"), - // }, - // }, - // }, - // { - // Name: to.Ptr("p2sVpnGateway2"), - // Type: to.Ptr("Microsoft.Network/p2sVpnGateways"), - // ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/P2SvpnGateways/p2sVpnGateway2"), - // Location: to.Ptr("West US"), - // Etag: to.Ptr("w/\\00000000-0000-0000-0000-000000000000\\"), - // Properties: &armnetwork.P2SVPNGatewayProperties{ - // CustomDNSServers: []*string{ - // to.Ptr("4.4.4.4")}, - // IsRoutingPreferenceInternet: to.Ptr(false), - // P2SConnectionConfigurations: []*armnetwork.P2SConnectionConfiguration{ - // { - // ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/p2sVpnGateways/p2sVpnGateway1/p2sConnectionConfigurations/P2SConnectionConfig1"), - // Name: to.Ptr("P2SConnectionConfig1"), - // Properties: &armnetwork.P2SConnectionConfigurationProperties{ - // ConfigurationPolicyGroupAssociations: []*armnetwork.SubResource{ - // { - // ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/vpnServerConfigurations/vpnServerConfiguration1/configurationPolicyGroups/policyGroup1"), - // }}, - // EnableInternetSecurity: to.Ptr(false), - // PreviousConfigurationPolicyGroupAssociations: []*armnetwork.VPNServerConfigurationPolicyGroup{ - // { - // ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/vpnServerConfigurations/vpnServerConfiguration1/vpnServerConfigurationPolicyGroups/policyGroup1"), - // Name: to.Ptr("policyGroup1"), - // Properties: &armnetwork.VPNServerConfigurationPolicyGroupProperties{ - // IsDefault: to.Ptr(true), - // PolicyMembers: []*armnetwork.VPNServerConfigurationPolicyGroupMember{ - // { - // Name: to.Ptr("policy1"), - // AttributeType: to.Ptr(armnetwork.VPNPolicyMemberAttributeTypeRadiusAzureGroupID), - // AttributeValue: to.Ptr("6ad1bd08"), - // }}, - // Priority: to.Ptr[int32](0), - // ProvisioningState: to.Ptr(armnetwork.ProvisioningStateSucceeded), - // }, - // }}, - // RoutingConfiguration: &armnetwork.RoutingConfiguration{ - // AssociatedRouteTable: &armnetwork.SubResource{ - // ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/virtualHubs/virtualHub2/hubRouteTables/hubRouteTable1"), - // }, - // PropagatedRouteTables: &armnetwork.PropagatedRouteTable{ - // IDs: []*armnetwork.SubResource{ - // { - // ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/virtualHubs/virtualHub2/hubRouteTables/hubRouteTable1"), - // }, - // { - // ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/virtualHubs/virtualHub2/hubRouteTables/hubRouteTable2"), - // }, - // { - // ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/virtualHubs/virtualHub2/hubRouteTables/hubRouteTable3"), - // }}, - // Labels: []*string{ - // to.Ptr("label1"), - // to.Ptr("label2")}, - // }, - // VnetRoutes: &armnetwork.VnetRoute{ - // StaticRoutes: []*armnetwork.StaticRoute{ - // }, - // }, - // }, - // VPNClientAddressPool: &armnetwork.AddressSpace{ - // AddressPrefixes: []*string{ - // to.Ptr("101.3.0.0/16")}, - // }, - // }, - // }}, - // ProvisioningState: to.Ptr(armnetwork.ProvisioningStateSucceeded), - // VirtualHub: &armnetwork.SubResource{ - // ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/virtualHubs/virtualHub2"), - // }, - // VPNClientConnectionHealth: &armnetwork.VPNClientConnectionHealth{ - // AllocatedIPAddresses: []*string{ - // to.Ptr("1.1.1.1"), - // to.Ptr("2.2.2.2")}, - // TotalEgressBytesTransferred: to.Ptr[int64](3000), - // TotalIngressBytesTransferred: to.Ptr[int64](2000), - // VPNClientConnectionsCount: to.Ptr[int32](2), - // }, - // VPNGatewayScaleUnit: to.Ptr[int32](1), - // VPNServerConfiguration: &armnetwork.SubResource{ - // ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/vpnServerConfigurations/vpnServerConfiguration1"), - // }, - // }, - // }}, - // } - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/4883fa5dbf6f2c9093fac8ce334547e9dfac68fa/specification/network/resource-manager/Microsoft.Network/stable/2024-03-01/examples/P2SVpnGatewayList.json -func ExampleP2SVPNGatewaysClient_NewListPager() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armnetwork.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := clientFactory.NewP2SVPNGatewaysClient().NewListPager(nil) - for pager.More() { - page, err := pager.NextPage(ctx) - if err != nil { - log.Fatalf("failed to advance page: %v", err) - } - for _, v := range page.Value { - // You could use page here. We use blank identifier for just demo purposes. - _ = v - } - // If the HTTP response code is 200 as defined in example definition, your page structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // page.ListP2SVPNGatewaysResult = armnetwork.ListP2SVPNGatewaysResult{ - // Value: []*armnetwork.P2SVPNGateway{ - // { - // Name: to.Ptr("p2sVpnGateway1"), - // Type: to.Ptr("Microsoft.Network/p2sVpnGateways"), - // ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/P2SvpnGateways/p2sVpnGateway1"), - // Location: to.Ptr("West US"), - // Etag: to.Ptr("w/\\00000000-0000-0000-0000-000000000000\\"), - // Properties: &armnetwork.P2SVPNGatewayProperties{ - // CustomDNSServers: []*string{ - // to.Ptr("3.3.3.3")}, - // IsRoutingPreferenceInternet: to.Ptr(false), - // P2SConnectionConfigurations: []*armnetwork.P2SConnectionConfiguration{ - // { - // ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/p2sVpnGateways/p2sVpnGateway1/p2sConnectionConfigurations/P2SConnectionConfig1"), - // Name: to.Ptr("P2SConnectionConfig1"), - // Etag: to.Ptr("w/\\00000000-0000-0000-0000-000000000000\\"), - // Properties: &armnetwork.P2SConnectionConfigurationProperties{ - // ConfigurationPolicyGroupAssociations: []*armnetwork.SubResource{ - // { - // ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/vpnServerConfigurations/vpnServerConfiguration1/configurationPolicyGroups/policyGroup1"), - // }}, - // EnableInternetSecurity: to.Ptr(true), - // PreviousConfigurationPolicyGroupAssociations: []*armnetwork.VPNServerConfigurationPolicyGroup{ - // { - // ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/vpnServerConfigurations/vpnServerConfiguration1/vpnServerConfigurationPolicyGroups/policyGroup1"), - // Name: to.Ptr("policyGroup1"), - // Properties: &armnetwork.VPNServerConfigurationPolicyGroupProperties{ - // IsDefault: to.Ptr(true), - // PolicyMembers: []*armnetwork.VPNServerConfigurationPolicyGroupMember{ - // { - // Name: to.Ptr("policy1"), - // AttributeType: to.Ptr(armnetwork.VPNPolicyMemberAttributeTypeRadiusAzureGroupID), - // AttributeValue: to.Ptr("6ad1bd08"), - // }}, - // Priority: to.Ptr[int32](0), - // ProvisioningState: to.Ptr(armnetwork.ProvisioningStateSucceeded), - // }, - // }}, - // ProvisioningState: to.Ptr(armnetwork.ProvisioningStateSucceeded), - // RoutingConfiguration: &armnetwork.RoutingConfiguration{ - // AssociatedRouteTable: &armnetwork.SubResource{ - // ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/virtualHubs/virtualHub1/hubRouteTables/hubRouteTable1"), - // }, - // PropagatedRouteTables: &armnetwork.PropagatedRouteTable{ - // IDs: []*armnetwork.SubResource{ - // { - // ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/virtualHubs/virtualHub1/hubRouteTables/hubRouteTable1"), - // }, - // { - // ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/virtualHubs/virtualHub1/hubRouteTables/hubRouteTable2"), - // }, - // { - // ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/virtualHubs/virtualHub1/hubRouteTables/hubRouteTable3"), - // }}, - // Labels: []*string{ - // to.Ptr("label1"), - // to.Ptr("label2")}, - // }, - // VnetRoutes: &armnetwork.VnetRoute{ - // StaticRoutes: []*armnetwork.StaticRoute{ - // }, - // }, - // }, - // VPNClientAddressPool: &armnetwork.AddressSpace{ - // AddressPrefixes: []*string{ - // to.Ptr("101.3.0.0/16")}, - // }, - // }, - // }}, - // ProvisioningState: to.Ptr(armnetwork.ProvisioningStateSucceeded), - // VirtualHub: &armnetwork.SubResource{ - // ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/virtualHubs/virtualHub1"), - // }, - // VPNClientConnectionHealth: &armnetwork.VPNClientConnectionHealth{ - // AllocatedIPAddresses: []*string{ - // to.Ptr("1.1.1.1"), - // to.Ptr("2.2.2.2")}, - // TotalEgressBytesTransferred: to.Ptr[int64](3000), - // TotalIngressBytesTransferred: to.Ptr[int64](2000), - // VPNClientConnectionsCount: to.Ptr[int32](2), - // }, - // VPNGatewayScaleUnit: to.Ptr[int32](1), - // VPNServerConfiguration: &armnetwork.SubResource{ - // ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/vpnServerConfigurations/vpnServerConfiguration1"), - // }, - // }, - // }, - // { - // Name: to.Ptr("p2sVpnGateway2"), - // Type: to.Ptr("Microsoft.Network/p2sVpnGateways"), - // ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/P2SvpnGateways/p2sVpnGateway2"), - // Location: to.Ptr("West US"), - // Etag: to.Ptr("w/\\00000000-0000-0000-0000-000000000000\\"), - // Properties: &armnetwork.P2SVPNGatewayProperties{ - // CustomDNSServers: []*string{ - // to.Ptr("4.4.4.4")}, - // IsRoutingPreferenceInternet: to.Ptr(false), - // P2SConnectionConfigurations: []*armnetwork.P2SConnectionConfiguration{ - // { - // ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/p2sVpnGateways/p2sVpnGateway1/p2sConnectionConfigurations/P2SConnectionConfig1"), - // Name: to.Ptr("P2SConnectionConfig1"), - // Etag: to.Ptr("w/\\00000000-0000-0000-0000-000000000000\\"), - // Properties: &armnetwork.P2SConnectionConfigurationProperties{ - // ConfigurationPolicyGroupAssociations: []*armnetwork.SubResource{ - // { - // ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/vpnServerConfigurations/vpnServerConfiguration1/configurationPolicyGroups/policyGroup1"), - // }}, - // EnableInternetSecurity: to.Ptr(true), - // PreviousConfigurationPolicyGroupAssociations: []*armnetwork.VPNServerConfigurationPolicyGroup{ - // { - // ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/vpnServerConfigurations/vpnServerConfiguration1/vpnServerConfigurationPolicyGroups/policyGroup1"), - // Name: to.Ptr("policyGroup1"), - // Properties: &armnetwork.VPNServerConfigurationPolicyGroupProperties{ - // IsDefault: to.Ptr(true), - // PolicyMembers: []*armnetwork.VPNServerConfigurationPolicyGroupMember{ - // { - // Name: to.Ptr("policy1"), - // AttributeType: to.Ptr(armnetwork.VPNPolicyMemberAttributeTypeRadiusAzureGroupID), - // AttributeValue: to.Ptr("6ad1bd08"), - // }}, - // Priority: to.Ptr[int32](0), - // ProvisioningState: to.Ptr(armnetwork.ProvisioningStateSucceeded), - // }, - // }}, - // ProvisioningState: to.Ptr(armnetwork.ProvisioningStateSucceeded), - // RoutingConfiguration: &armnetwork.RoutingConfiguration{ - // AssociatedRouteTable: &armnetwork.SubResource{ - // ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/virtualHubs/virtualHub2/hubRouteTables/hubRouteTable1"), - // }, - // PropagatedRouteTables: &armnetwork.PropagatedRouteTable{ - // IDs: []*armnetwork.SubResource{ - // { - // ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/virtualHubs/virtualHub2/hubRouteTables/hubRouteTable1"), - // }, - // { - // ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/virtualHubs/virtualHub2/hubRouteTables/hubRouteTable2"), - // }, - // { - // ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/virtualHubs/virtualHub2/hubRouteTables/hubRouteTable3"), - // }}, - // Labels: []*string{ - // to.Ptr("label1"), - // to.Ptr("label2")}, - // }, - // VnetRoutes: &armnetwork.VnetRoute{ - // StaticRoutes: []*armnetwork.StaticRoute{ - // }, - // }, - // }, - // VPNClientAddressPool: &armnetwork.AddressSpace{ - // AddressPrefixes: []*string{ - // to.Ptr("101.4.0.0/16")}, - // }, - // }, - // }}, - // ProvisioningState: to.Ptr(armnetwork.ProvisioningStateSucceeded), - // VirtualHub: &armnetwork.SubResource{ - // ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/virtualHubs/virtualHub2"), - // }, - // VPNClientConnectionHealth: &armnetwork.VPNClientConnectionHealth{ - // AllocatedIPAddresses: []*string{ - // to.Ptr("1.1.1.1"), - // to.Ptr("2.2.2.2")}, - // TotalEgressBytesTransferred: to.Ptr[int64](3000), - // TotalIngressBytesTransferred: to.Ptr[int64](2000), - // VPNClientConnectionsCount: to.Ptr[int32](2), - // }, - // VPNGatewayScaleUnit: to.Ptr[int32](1), - // VPNServerConfiguration: &armnetwork.SubResource{ - // ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/vpnServerConfigurations/vpnServerConfiguration1"), - // }, - // }, - // }}, - // } - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/4883fa5dbf6f2c9093fac8ce334547e9dfac68fa/specification/network/resource-manager/Microsoft.Network/stable/2024-03-01/examples/P2SVpnGatewayReset.json -func ExampleP2SVPNGatewaysClient_BeginReset() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armnetwork.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewP2SVPNGatewaysClient().BeginReset(ctx, "rg1", "p2sVpnGateway1", nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - res, err := poller.PollUntilDone(ctx, nil) - if err != nil { - log.Fatalf("failed to pull the result: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.P2SVPNGateway = armnetwork.P2SVPNGateway{ - // Name: to.Ptr("p2sVpnGateway1"), - // Type: to.Ptr("Microsoft.Network/p2sVpnGateways"), - // ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/P2SvpnGateways/p2sVpnGateway1"), - // Location: to.Ptr("West US"), - // Etag: to.Ptr("w/\\00000000-0000-0000-0000-000000000000\\"), - // Properties: &armnetwork.P2SVPNGatewayProperties{ - // CustomDNSServers: []*string{ - // to.Ptr("3.3.3.3")}, - // IsRoutingPreferenceInternet: to.Ptr(false), - // P2SConnectionConfigurations: []*armnetwork.P2SConnectionConfiguration{ - // { - // ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/p2sVpnGateways/p2sVpnGateway1/p2sConnectionConfigurations/P2SConnectionConfig1"), - // Name: to.Ptr("P2SConnectionConfig1"), - // Etag: to.Ptr("w/\\00000000-0000-0000-0000-000000000000\\"), - // Properties: &armnetwork.P2SConnectionConfigurationProperties{ - // ConfigurationPolicyGroupAssociations: []*armnetwork.SubResource{ - // { - // ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/vpnServerConfigurations/vpnServerConfiguration1/configurationPolicyGroups/policyGroup1"), - // }}, - // EnableInternetSecurity: to.Ptr(false), - // PreviousConfigurationPolicyGroupAssociations: []*armnetwork.VPNServerConfigurationPolicyGroup{ - // { - // ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/vpnServerConfigurations/vpnServerConfiguration1/vpnServerConfigurationPolicyGroups/policyGroup1"), - // Name: to.Ptr("policyGroup1"), - // Properties: &armnetwork.VPNServerConfigurationPolicyGroupProperties{ - // IsDefault: to.Ptr(true), - // PolicyMembers: []*armnetwork.VPNServerConfigurationPolicyGroupMember{ - // { - // Name: to.Ptr("policy1"), - // AttributeType: to.Ptr(armnetwork.VPNPolicyMemberAttributeTypeRadiusAzureGroupID), - // AttributeValue: to.Ptr("6ad1bd08"), - // }}, - // Priority: to.Ptr[int32](0), - // ProvisioningState: to.Ptr(armnetwork.ProvisioningStateSucceeded), - // }, - // }}, - // ProvisioningState: to.Ptr(armnetwork.ProvisioningStateSucceeded), - // VPNClientAddressPool: &armnetwork.AddressSpace{ - // AddressPrefixes: []*string{ - // to.Ptr("101.3.0.0/16")}, - // }, - // }, - // }}, - // ProvisioningState: to.Ptr(armnetwork.ProvisioningStateSucceeded), - // VirtualHub: &armnetwork.SubResource{ - // ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/virtualHubs/virtualHub1"), - // }, - // VPNClientConnectionHealth: &armnetwork.VPNClientConnectionHealth{ - // AllocatedIPAddresses: []*string{ - // to.Ptr("1.1.1.1"), - // to.Ptr("2.2.2.2")}, - // TotalEgressBytesTransferred: to.Ptr[int64](3000), - // TotalIngressBytesTransferred: to.Ptr[int64](2000), - // VPNClientConnectionsCount: to.Ptr[int32](2), - // }, - // VPNGatewayScaleUnit: to.Ptr[int32](1), - // VPNServerConfiguration: &armnetwork.SubResource{ - // ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/vpnServerConfigurations/vpnServerConfiguration1"), - // }, - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/4883fa5dbf6f2c9093fac8ce334547e9dfac68fa/specification/network/resource-manager/Microsoft.Network/stable/2024-03-01/examples/P2SVpnGatewayGenerateVpnProfile.json -func ExampleP2SVPNGatewaysClient_BeginGenerateVPNProfile() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armnetwork.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewP2SVPNGatewaysClient().BeginGenerateVPNProfile(ctx, "rg1", "p2sVpnGateway1", armnetwork.P2SVPNProfileParameters{ - AuthenticationMethod: to.Ptr(armnetwork.AuthenticationMethodEAPTLS), - }, nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - res, err := poller.PollUntilDone(ctx, nil) - if err != nil { - log.Fatalf("failed to pull the result: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.VPNProfileResponse = armnetwork.VPNProfileResponse{ - // ProfileURL: to.Ptr("aaaaaaaaaaaaaaaaaaaaaaaaaaa"), - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/4883fa5dbf6f2c9093fac8ce334547e9dfac68fa/specification/network/resource-manager/Microsoft.Network/stable/2024-03-01/examples/P2SVpnGatewayGetConnectionHealth.json -func ExampleP2SVPNGatewaysClient_BeginGetP2SVPNConnectionHealth() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armnetwork.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewP2SVPNGatewaysClient().BeginGetP2SVPNConnectionHealth(ctx, "rg1", "p2sVpnGateway1", nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - res, err := poller.PollUntilDone(ctx, nil) - if err != nil { - log.Fatalf("failed to pull the result: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.P2SVPNGateway = armnetwork.P2SVPNGateway{ - // Name: to.Ptr("p2sVpnGateway1"), - // Type: to.Ptr("Microsoft.Network/p2sVpnGateways"), - // ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/P2SvpnGateways/p2sVpnGateway1"), - // Location: to.Ptr("West US"), - // Etag: to.Ptr("w/\\00000000-0000-0000-0000-000000000000\\"), - // Properties: &armnetwork.P2SVPNGatewayProperties{ - // CustomDNSServers: []*string{ - // to.Ptr("3.3.3.3")}, - // IsRoutingPreferenceInternet: to.Ptr(false), - // P2SConnectionConfigurations: []*armnetwork.P2SConnectionConfiguration{ - // { - // ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/p2sVpnGateways/p2sVpnGateway1/p2sConnectionConfigurations/P2SConnectionConfig1"), - // Name: to.Ptr("P2SConnectionConfig1"), - // Etag: to.Ptr("w/\\00000000-0000-0000-0000-000000000000\\"), - // Properties: &armnetwork.P2SConnectionConfigurationProperties{ - // ConfigurationPolicyGroupAssociations: []*armnetwork.SubResource{ - // { - // ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/vpnServerConfigurations/vpnServerConfiguration1/configurationPolicyGroups/policyGroup1"), - // }}, - // EnableInternetSecurity: to.Ptr(false), - // PreviousConfigurationPolicyGroupAssociations: []*armnetwork.VPNServerConfigurationPolicyGroup{ - // { - // ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/vpnServerConfigurations/vpnServerConfiguration1/vpnServerConfigurationPolicyGroups/policyGroup1"), - // Name: to.Ptr("policyGroup1"), - // Properties: &armnetwork.VPNServerConfigurationPolicyGroupProperties{ - // IsDefault: to.Ptr(true), - // PolicyMembers: []*armnetwork.VPNServerConfigurationPolicyGroupMember{ - // { - // Name: to.Ptr("policy1"), - // AttributeType: to.Ptr(armnetwork.VPNPolicyMemberAttributeTypeRadiusAzureGroupID), - // AttributeValue: to.Ptr("6ad1bd08"), - // }}, - // Priority: to.Ptr[int32](0), - // ProvisioningState: to.Ptr(armnetwork.ProvisioningStateSucceeded), - // }, - // }}, - // ProvisioningState: to.Ptr(armnetwork.ProvisioningStateSucceeded), - // VPNClientAddressPool: &armnetwork.AddressSpace{ - // AddressPrefixes: []*string{ - // to.Ptr("101.3.0.0/16")}, - // }, - // }, - // }}, - // ProvisioningState: to.Ptr(armnetwork.ProvisioningStateSucceeded), - // VirtualHub: &armnetwork.SubResource{ - // ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/virtualHubs/virtualHub1"), - // }, - // VPNClientConnectionHealth: &armnetwork.VPNClientConnectionHealth{ - // AllocatedIPAddresses: []*string{ - // to.Ptr("1.1.1.1"), - // to.Ptr("2.2.2.2")}, - // TotalEgressBytesTransferred: to.Ptr[int64](3000), - // TotalIngressBytesTransferred: to.Ptr[int64](2000), - // VPNClientConnectionsCount: to.Ptr[int32](2), - // }, - // VPNGatewayScaleUnit: to.Ptr[int32](1), - // VPNServerConfiguration: &armnetwork.SubResource{ - // ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/vpnServerConfigurations/vpnServerConfiguration1"), - // }, - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/4883fa5dbf6f2c9093fac8ce334547e9dfac68fa/specification/network/resource-manager/Microsoft.Network/stable/2024-03-01/examples/P2SVpnGatewayGetConnectionHealthDetailed.json -func ExampleP2SVPNGatewaysClient_BeginGetP2SVPNConnectionHealthDetailed() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armnetwork.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewP2SVPNGatewaysClient().BeginGetP2SVPNConnectionHealthDetailed(ctx, "p2s-vpn-gateway-test", "p2svpngateway", armnetwork.P2SVPNConnectionHealthRequest{ - OutputBlobSasURL: to.Ptr("https://blobcortextesturl.blob.core.windows.net/folderforconfig/p2sconnectionhealths?sp=rw&se=2018-01-10T03%3A42%3A04Z&sv=2017-04-17&sig=WvXrT5bDmDFfgHs%2Brz%2BjAu123eRCNE9BO0eQYcPDT7pY%3D&sr=b"), - VPNUserNamesFilter: []*string{ - to.Ptr("vpnUser1"), - to.Ptr("vpnUser2")}, - }, nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - res, err := poller.PollUntilDone(ctx, nil) - if err != nil { - log.Fatalf("failed to pull the result: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.P2SVPNConnectionHealth = armnetwork.P2SVPNConnectionHealth{ - // SasURL: to.Ptr("aaaaaaaaaaaaaaaaaa"), - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/4883fa5dbf6f2c9093fac8ce334547e9dfac68fa/specification/network/resource-manager/Microsoft.Network/stable/2024-03-01/examples/P2sVpnGatewaysDisconnectP2sVpnConnections.json -func ExampleP2SVPNGatewaysClient_BeginDisconnectP2SVPNConnections() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armnetwork.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewP2SVPNGatewaysClient().BeginDisconnectP2SVPNConnections(ctx, "p2s-vpn-gateway-test", "p2svpngateway", armnetwork.P2SVPNConnectionRequest{ - VPNConnectionIDs: []*string{ - to.Ptr("vpnconnId1"), - to.Ptr("vpnconnId2")}, - }, nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - _, err = poller.PollUntilDone(ctx, nil) - if err != nil { - log.Fatalf("failed to pull the result: %v", err) - } -} diff --git a/sdk/resourcemanager/network/armnetwork/packetcaptures_client_example_test.go b/sdk/resourcemanager/network/armnetwork/packetcaptures_client_example_test.go deleted file mode 100644 index 74fbb2a56b52..000000000000 --- a/sdk/resourcemanager/network/armnetwork/packetcaptures_client_example_test.go +++ /dev/null @@ -1,246 +0,0 @@ -//go:build go1.18 -// +build go1.18 - -// 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. -// DO NOT EDIT. - -package armnetwork_test - -import ( - "context" - "log" - - "github.com/Azure/azure-sdk-for-go/sdk/azcore/to" - "github.com/Azure/azure-sdk-for-go/sdk/azidentity" - "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/network/armnetwork/v6" -) - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/4883fa5dbf6f2c9093fac8ce334547e9dfac68fa/specification/network/resource-manager/Microsoft.Network/stable/2024-03-01/examples/NetworkWatcherPacketCaptureCreate.json -func ExamplePacketCapturesClient_BeginCreate() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armnetwork.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewPacketCapturesClient().BeginCreate(ctx, "rg1", "nw1", "pc1", armnetwork.PacketCapture{ - Properties: &armnetwork.PacketCaptureParameters{ - BytesToCapturePerPacket: to.Ptr[int64](10000), - Filters: []*armnetwork.PacketCaptureFilter{ - { - LocalIPAddress: to.Ptr("10.0.0.4"), - LocalPort: to.Ptr("80"), - Protocol: to.Ptr(armnetwork.PcProtocolTCP), - }}, - StorageLocation: &armnetwork.PacketCaptureStorageLocation{ - FilePath: to.Ptr("D:\\capture\\pc1.cap"), - StorageID: to.Ptr("/subscriptions/subid/resourceGroups/rg2/providers/Microsoft.Storage/storageAccounts/pcstore"), - StoragePath: to.Ptr("https://mytestaccountname.blob.core.windows.net/capture/pc1.cap"), - }, - Target: to.Ptr("/subscriptions/subid/resourceGroups/rg2/providers/Microsoft.Compute/virtualMachines/vm1"), - TimeLimitInSeconds: to.Ptr[int32](100), - TotalBytesPerSession: to.Ptr[int64](100000), - }, - }, nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - _, err = poller.PollUntilDone(ctx, nil) - if err != nil { - log.Fatalf("failed to pull the result: %v", err) - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/4883fa5dbf6f2c9093fac8ce334547e9dfac68fa/specification/network/resource-manager/Microsoft.Network/stable/2024-03-01/examples/NetworkWatcherPacketCaptureGet.json -func ExamplePacketCapturesClient_Get() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armnetwork.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewPacketCapturesClient().Get(ctx, "rg1", "nw1", "pc1", nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.PacketCaptureResult = armnetwork.PacketCaptureResult{ - // Name: to.Ptr("pc1"), - // Etag: to.Ptr("W/\"00000000-0000-0000-0000-000000000000\""), - // ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/networkWatchers/nw1/packetCaptures/pc1"), - // Properties: &armnetwork.PacketCaptureResultProperties{ - // BytesToCapturePerPacket: to.Ptr[int64](10000), - // Filters: []*armnetwork.PacketCaptureFilter{ - // { - // LocalIPAddress: to.Ptr("10.0.0.4"), - // LocalPort: to.Ptr("80"), - // Protocol: to.Ptr(armnetwork.PcProtocolTCP), - // }}, - // StorageLocation: &armnetwork.PacketCaptureStorageLocation{ - // FilePath: to.Ptr("D:\\capture\\pc1.cap"), - // StorageID: to.Ptr("/subscriptions/subid/resourceGroups/rg2/providers/Microsoft.Storage/storageAccounts/pcstore"), - // StoragePath: to.Ptr("https://mytestaccountname.blob.core.windows.net/capture/pc1.cap"), - // }, - // Target: to.Ptr("/subscriptions/subid/resourceGroups/rg2/providers/Microsoft.Compute/virtualMachines/vm1"), - // TimeLimitInSeconds: to.Ptr[int32](100), - // TotalBytesPerSession: to.Ptr[int64](100000), - // ProvisioningState: to.Ptr(armnetwork.ProvisioningStateSucceeded), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/4883fa5dbf6f2c9093fac8ce334547e9dfac68fa/specification/network/resource-manager/Microsoft.Network/stable/2024-03-01/examples/NetworkWatcherPacketCaptureDelete.json -func ExamplePacketCapturesClient_BeginDelete() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armnetwork.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewPacketCapturesClient().BeginDelete(ctx, "rg1", "nw1", "pc1", nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - _, err = poller.PollUntilDone(ctx, nil) - if err != nil { - log.Fatalf("failed to pull the result: %v", err) - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/4883fa5dbf6f2c9093fac8ce334547e9dfac68fa/specification/network/resource-manager/Microsoft.Network/stable/2024-03-01/examples/NetworkWatcherPacketCaptureStop.json -func ExamplePacketCapturesClient_BeginStop() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armnetwork.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewPacketCapturesClient().BeginStop(ctx, "rg1", "nw1", "pc1", nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - _, err = poller.PollUntilDone(ctx, nil) - if err != nil { - log.Fatalf("failed to pull the result: %v", err) - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/4883fa5dbf6f2c9093fac8ce334547e9dfac68fa/specification/network/resource-manager/Microsoft.Network/stable/2024-03-01/examples/NetworkWatcherPacketCaptureQueryStatus.json -func ExamplePacketCapturesClient_BeginGetStatus() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armnetwork.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewPacketCapturesClient().BeginGetStatus(ctx, "rg1", "nw1", "pc1", nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - res, err := poller.PollUntilDone(ctx, nil) - if err != nil { - log.Fatalf("failed to pull the result: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.PacketCaptureQueryStatusResult = armnetwork.PacketCaptureQueryStatusResult{ - // Name: to.Ptr("pc1"), - // CaptureStartTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2016-09-07T12:35:24.000Z"); return t}()), - // ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/networkWatchers/nw1/packetCaptures/pc1"), - // PacketCaptureError: []*armnetwork.PcError{ - // }, - // PacketCaptureStatus: to.Ptr(armnetwork.PcStatusStopped), - // StopReason: to.Ptr("TimeExceeded"), - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/4883fa5dbf6f2c9093fac8ce334547e9dfac68fa/specification/network/resource-manager/Microsoft.Network/stable/2024-03-01/examples/NetworkWatcherPacketCapturesList.json -func ExamplePacketCapturesClient_NewListPager() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armnetwork.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := clientFactory.NewPacketCapturesClient().NewListPager("rg1", "nw1", nil) - for pager.More() { - page, err := pager.NextPage(ctx) - if err != nil { - log.Fatalf("failed to advance page: %v", err) - } - for _, v := range page.Value { - // You could use page here. We use blank identifier for just demo purposes. - _ = v - } - // If the HTTP response code is 200 as defined in example definition, your page structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // page.PacketCaptureListResult = armnetwork.PacketCaptureListResult{ - // Value: []*armnetwork.PacketCaptureResult{ - // { - // Name: to.Ptr("pc1"), - // Etag: to.Ptr("W/\"00000000-0000-0000-0000-000000000000\""), - // ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/networkWatchers/nw1/packetCaptures/pc1"), - // Properties: &armnetwork.PacketCaptureResultProperties{ - // BytesToCapturePerPacket: to.Ptr[int64](10000), - // Filters: []*armnetwork.PacketCaptureFilter{ - // { - // LocalIPAddress: to.Ptr("10.0.0.4"), - // LocalPort: to.Ptr("80"), - // Protocol: to.Ptr(armnetwork.PcProtocolTCP), - // }}, - // StorageLocation: &armnetwork.PacketCaptureStorageLocation{ - // FilePath: to.Ptr("D:\\capture\\pc1.cap"), - // StorageID: to.Ptr("/subscriptions/subid/resourceGroups/rg2/providers/Microsoft.Storage/storageAccounts/pcstore"), - // StoragePath: to.Ptr("https://mytestaccountname.blob.core.windows.net/capture/pc1.cap"), - // }, - // Target: to.Ptr("/subscriptions/subid/resourceGroups/rg2/providers/Microsoft.Compute/virtualMachines/vm1"), - // TimeLimitInSeconds: to.Ptr[int32](100), - // TotalBytesPerSession: to.Ptr[int64](100000), - // ProvisioningState: to.Ptr(armnetwork.ProvisioningStateSucceeded), - // }, - // }, - // { - // Name: to.Ptr("pc2"), - // Etag: to.Ptr("W/\"00000000-0000-0000-0000-000000000000\""), - // ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/networkWatchers/nw1/packetCaptures/pc2"), - // Properties: &armnetwork.PacketCaptureResultProperties{ - // BytesToCapturePerPacket: to.Ptr[int64](10000), - // Filters: []*armnetwork.PacketCaptureFilter{ - // }, - // StorageLocation: &armnetwork.PacketCaptureStorageLocation{ - // FilePath: to.Ptr("D:\\capture\\pc2.cap"), - // StorageID: to.Ptr("/subscriptions/subid/resourceGroups/rg2/providers/Microsoft.Storage/storageAccounts/pcstore"), - // StoragePath: to.Ptr("https://mytestaccountname.blob.core.windows.net/capture/pc2.cap"), - // }, - // Target: to.Ptr("/subscriptions/subid/resourceGroups/rg2/providers/Microsoft.Compute/virtualMachines/vm1"), - // TimeLimitInSeconds: to.Ptr[int32](100), - // TotalBytesPerSession: to.Ptr[int64](100000), - // ProvisioningState: to.Ptr(armnetwork.ProvisioningStateSucceeded), - // }, - // }}, - // } - } -} diff --git a/sdk/resourcemanager/network/armnetwork/peerexpressroutecircuitconnections_client_example_test.go b/sdk/resourcemanager/network/armnetwork/peerexpressroutecircuitconnections_client_example_test.go deleted file mode 100644 index f69024d223ab..000000000000 --- a/sdk/resourcemanager/network/armnetwork/peerexpressroutecircuitconnections_client_example_test.go +++ /dev/null @@ -1,120 +0,0 @@ -//go:build go1.18 -// +build go1.18 - -// 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. -// DO NOT EDIT. - -package armnetwork_test - -import ( - "context" - "log" - - "github.com/Azure/azure-sdk-for-go/sdk/azidentity" - "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/network/armnetwork/v6" -) - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/4883fa5dbf6f2c9093fac8ce334547e9dfac68fa/specification/network/resource-manager/Microsoft.Network/stable/2024-03-01/examples/PeerExpressRouteCircuitConnectionGet.json -func ExamplePeerExpressRouteCircuitConnectionsClient_Get() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armnetwork.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewPeerExpressRouteCircuitConnectionsClient().Get(ctx, "rg1", "ExpressRouteARMCircuitA", "AzurePrivatePeering", "60aee347-e889-4a42-8c1b-0aae8b1e4013", nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.PeerExpressRouteCircuitConnection = armnetwork.PeerExpressRouteCircuitConnection{ - // ID: to.Ptr("/subscriptions/subid1/resourceGroups/rg1/providers/Microsoft.Network/expressRouteCircuits/ExpressRouteARMCircuitA/peerings/AzurePrivatePeering/peerConnections/60aee347-e889-4a42-8c1b-0aae8b1e4013"), - // Name: to.Ptr("60aee347-e889-4a42-8c1b-0aae8b1e4013"), - // Etag: to.Ptr("W/\"6ffbbb06-da20-44ca-a34f-280c4653b1e9\""), - // Properties: &armnetwork.PeerExpressRouteCircuitConnectionPropertiesFormat{ - // AddressPrefix: to.Ptr("20.0.0.0/29"), - // AuthResourceGUID: to.Ptr(""), - // CircuitConnectionStatus: to.Ptr(armnetwork.CircuitConnectionStatusConnected), - // ConnectionName: to.Ptr("circuitConnectionWestusEastus"), - // ExpressRouteCircuitPeering: &armnetwork.SubResource{ - // ID: to.Ptr("/subscriptions/subid1/resourceGroups/rg1/providers/Microsoft.Network/expressRouteCircuits/ExpressRouteARMCircuitA/peerings/AzurePrivatePeering"), - // }, - // PeerExpressRouteCircuitPeering: &armnetwork.SubResource{ - // ID: to.Ptr("/subscriptions/subid1/resourceGroups/rg1/providers/Microsoft.Network/expressRouteCircuits/ExpressRouteARMCircuitB/peerings/AzurePrivatePeering"), - // }, - // ProvisioningState: to.Ptr(armnetwork.ProvisioningStateSucceeded), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/4883fa5dbf6f2c9093fac8ce334547e9dfac68fa/specification/network/resource-manager/Microsoft.Network/stable/2024-03-01/examples/PeerExpressRouteCircuitConnectionList.json -func ExamplePeerExpressRouteCircuitConnectionsClient_NewListPager() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armnetwork.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := clientFactory.NewPeerExpressRouteCircuitConnectionsClient().NewListPager("rg1", "ExpressRouteARMCircuitA", "AzurePrivatePeering", nil) - for pager.More() { - page, err := pager.NextPage(ctx) - if err != nil { - log.Fatalf("failed to advance page: %v", err) - } - for _, v := range page.Value { - // You could use page here. We use blank identifier for just demo purposes. - _ = v - } - // If the HTTP response code is 200 as defined in example definition, your page structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // page.PeerExpressRouteCircuitConnectionListResult = armnetwork.PeerExpressRouteCircuitConnectionListResult{ - // Value: []*armnetwork.PeerExpressRouteCircuitConnection{ - // { - // ID: to.Ptr("/subscriptions/subid1/resourceGroups/rg1/providers/Microsoft.Network/expressRouteCircuits/ExpressRouteARMCircuitA/peerings/AzurePrivatePeering/peerConnections/60aee347-e889-4a42-8c1b-0aae8b1e4013"), - // Name: to.Ptr("60aee347-e889-4a42-8c1b-0aae8b1e4013"), - // Etag: to.Ptr("W/\"6ffbbb06-da20-44ca-a34f-280c4653b1e9\""), - // Properties: &armnetwork.PeerExpressRouteCircuitConnectionPropertiesFormat{ - // AddressPrefix: to.Ptr("20.0.0.0/29"), - // AuthResourceGUID: to.Ptr(""), - // CircuitConnectionStatus: to.Ptr(armnetwork.CircuitConnectionStatusConnected), - // ConnectionName: to.Ptr("circuitConnectionWestusEastus"), - // ExpressRouteCircuitPeering: &armnetwork.SubResource{ - // ID: to.Ptr("/subscriptions/subid1/resourceGroups/rg1/providers/Microsoft.Network/expressRouteCircuits/ExpressRouteARMCircuitA/peerings/AzurePrivatePeering"), - // }, - // PeerExpressRouteCircuitPeering: &armnetwork.SubResource{ - // ID: to.Ptr("/subscriptions/subid1/resourceGroups/rg1/providers/Microsoft.Network/expressRouteCircuits/ExpressRouteARMCircuitB/peerings/AzurePrivatePeering"), - // }, - // ProvisioningState: to.Ptr(armnetwork.ProvisioningStateSucceeded), - // }, - // }, - // { - // ID: to.Ptr("/subscriptions/subid1/resourceGroups/rg1/providers/Microsoft.Network/expressRouteCircuits/ExpressRouteARMCircuitA/peerings/AzurePrivatePeering/peerConnections/c8b17193-8dd3-4f61-866d-8cdd2e2e268e"), - // Name: to.Ptr("c8b17193-8dd3-4f61-866d-8cdd2e2e268e"), - // Etag: to.Ptr("W/\"6ffbbb06-da20-44ca-a34f-280c4653b1e9\""), - // Properties: &armnetwork.PeerExpressRouteCircuitConnectionPropertiesFormat{ - // AddressPrefix: to.Ptr("30.0.0.0/29"), - // AuthResourceGUID: to.Ptr("64283012-d377-421d-8398-f6aeb2ac7ea0"), - // CircuitConnectionStatus: to.Ptr(armnetwork.CircuitConnectionStatusConnected), - // ConnectionName: to.Ptr("circuitConnectionCentralusEastus"), - // ExpressRouteCircuitPeering: &armnetwork.SubResource{ - // ID: to.Ptr("/subscriptions/subid1/resourceGroups/rg1/providers/Microsoft.Network/expressRouteCircuits/ExpressRouteARMCircuitA/peerings/AzurePrivatePeering"), - // }, - // PeerExpressRouteCircuitPeering: &armnetwork.SubResource{ - // ID: to.Ptr("/subscriptions/subid2/resourceGroups/rg1/providers/Microsoft.Network/expressRouteCircuits/ExpressRouteARMCircuitC/peerings/AzurePrivatePeering"), - // }, - // ProvisioningState: to.Ptr(armnetwork.ProvisioningStateSucceeded), - // }, - // }}, - // } - } -} diff --git a/sdk/resourcemanager/network/armnetwork/privatednszonegroups_client_example_test.go b/sdk/resourcemanager/network/armnetwork/privatednszonegroups_client_example_test.go deleted file mode 100644 index d97a9fc62038..000000000000 --- a/sdk/resourcemanager/network/armnetwork/privatednszonegroups_client_example_test.go +++ /dev/null @@ -1,253 +0,0 @@ -//go:build go1.18 -// +build go1.18 - -// 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. -// DO NOT EDIT. - -package armnetwork_test - -import ( - "context" - "log" - - "github.com/Azure/azure-sdk-for-go/sdk/azcore/to" - "github.com/Azure/azure-sdk-for-go/sdk/azidentity" - "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/network/armnetwork/v6" -) - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/4883fa5dbf6f2c9093fac8ce334547e9dfac68fa/specification/network/resource-manager/Microsoft.Network/stable/2024-03-01/examples/PrivateEndpointDnsZoneGroupDelete.json -func ExamplePrivateDNSZoneGroupsClient_BeginDelete() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armnetwork.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewPrivateDNSZoneGroupsClient().BeginDelete(ctx, "rg1", "testPe", "testPdnsgroup", nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - _, err = poller.PollUntilDone(ctx, nil) - if err != nil { - log.Fatalf("failed to pull the result: %v", err) - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/4883fa5dbf6f2c9093fac8ce334547e9dfac68fa/specification/network/resource-manager/Microsoft.Network/stable/2024-03-01/examples/PrivateEndpointDnsZoneGroupGet.json -func ExamplePrivateDNSZoneGroupsClient_Get() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armnetwork.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewPrivateDNSZoneGroupsClient().Get(ctx, "rg1", "testPe", "testPdnsgroup", nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.PrivateDNSZoneGroup = armnetwork.PrivateDNSZoneGroup{ - // ID: to.Ptr("/subscriptions/subId/resourceGroups/rg1/providers/Microsoft.Network/privateLinkServices/testPe/privateDnsZoneGroups/testPdnsgroup"), - // Name: to.Ptr("testPdnsgroup"), - // Properties: &armnetwork.PrivateDNSZoneGroupPropertiesFormat{ - // PrivateDNSZoneConfigs: []*armnetwork.PrivateDNSZoneConfig{ - // { - // Properties: &armnetwork.PrivateDNSZonePropertiesFormat{ - // PrivateDNSZoneID: to.Ptr("/subscriptions/subId/resourceGroups/rg1/providers/Microsoft.Network/privateDnsZones/zone1.com"), - // RecordSets: []*armnetwork.RecordSet{ - // { - // Fqdn: to.Ptr("abc.zone1.com"), - // IPAddresses: []*string{ - // to.Ptr("10.0.0.4")}, - // RecordSetName: to.Ptr("abc"), - // RecordType: to.Ptr("A"), - // }, - // { - // Fqdn: to.Ptr("abc2.zone1.com"), - // IPAddresses: []*string{ - // to.Ptr("10.0.0.5")}, - // RecordSetName: to.Ptr("abc2"), - // RecordType: to.Ptr("A"), - // }}, - // }, - // }, - // { - // Properties: &armnetwork.PrivateDNSZonePropertiesFormat{ - // PrivateDNSZoneID: to.Ptr("/subscriptions/subId/resourceGroups/rg1/providers/Microsoft.Network/privateDnsZones/zone2.com"), - // RecordSets: []*armnetwork.RecordSet{ - // { - // Fqdn: to.Ptr("abc.zone2.com"), - // IPAddresses: []*string{ - // to.Ptr("10.0.0.6")}, - // RecordSetName: to.Ptr("abc"), - // RecordType: to.Ptr("A"), - // }, - // { - // Fqdn: to.Ptr("abc2.zone2.com"), - // IPAddresses: []*string{ - // to.Ptr("10.0.0.7")}, - // RecordSetName: to.Ptr("abc2"), - // RecordType: to.Ptr("A"), - // }}, - // }, - // }}, - // ProvisioningState: to.Ptr(armnetwork.ProvisioningStateSucceeded), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/4883fa5dbf6f2c9093fac8ce334547e9dfac68fa/specification/network/resource-manager/Microsoft.Network/stable/2024-03-01/examples/PrivateEndpointDnsZoneGroupCreate.json -func ExamplePrivateDNSZoneGroupsClient_BeginCreateOrUpdate() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armnetwork.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewPrivateDNSZoneGroupsClient().BeginCreateOrUpdate(ctx, "rg1", "testPe", "testPdnsgroup", armnetwork.PrivateDNSZoneGroup{ - Properties: &armnetwork.PrivateDNSZoneGroupPropertiesFormat{ - PrivateDNSZoneConfigs: []*armnetwork.PrivateDNSZoneConfig{ - { - Properties: &armnetwork.PrivateDNSZonePropertiesFormat{ - PrivateDNSZoneID: to.Ptr("/subscriptions/subId/resourceGroups/rg1/providers/Microsoft.Network/privateDnsZones/zone1.com"), - }, - }}, - }, - }, nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - res, err := poller.PollUntilDone(ctx, nil) - if err != nil { - log.Fatalf("failed to pull the result: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.PrivateDNSZoneGroup = armnetwork.PrivateDNSZoneGroup{ - // ID: to.Ptr("/subscriptions/subId/resourceGroups/rg1/providers/Microsoft.Network/privateLinkServices/testPe/privateDnsZoneGroups/testPdnsgroup"), - // Name: to.Ptr("testPdnsgroup"), - // Properties: &armnetwork.PrivateDNSZoneGroupPropertiesFormat{ - // PrivateDNSZoneConfigs: []*armnetwork.PrivateDNSZoneConfig{ - // { - // Properties: &armnetwork.PrivateDNSZonePropertiesFormat{ - // PrivateDNSZoneID: to.Ptr("/subscriptions/subId/resourceGroups/rg1/providers/Microsoft.Network/privateDnsZones/zone1.com"), - // RecordSets: []*armnetwork.RecordSet{ - // { - // Fqdn: to.Ptr("abc.zone1.com"), - // IPAddresses: []*string{ - // to.Ptr("10.0.0.4")}, - // RecordSetName: to.Ptr("abc"), - // RecordType: to.Ptr("A"), - // }, - // { - // Fqdn: to.Ptr("abc2.zone1.com"), - // IPAddresses: []*string{ - // to.Ptr("10.0.0.5")}, - // RecordSetName: to.Ptr("abc2"), - // RecordType: to.Ptr("A"), - // }}, - // }, - // }}, - // ProvisioningState: to.Ptr(armnetwork.ProvisioningStateSucceeded), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/4883fa5dbf6f2c9093fac8ce334547e9dfac68fa/specification/network/resource-manager/Microsoft.Network/stable/2024-03-01/examples/PrivateEndpointDnsZoneGroupList.json -func ExamplePrivateDNSZoneGroupsClient_NewListPager() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armnetwork.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := clientFactory.NewPrivateDNSZoneGroupsClient().NewListPager("testPe", "rg1", nil) - for pager.More() { - page, err := pager.NextPage(ctx) - if err != nil { - log.Fatalf("failed to advance page: %v", err) - } - for _, v := range page.Value { - // You could use page here. We use blank identifier for just demo purposes. - _ = v - } - // If the HTTP response code is 200 as defined in example definition, your page structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // page.PrivateDNSZoneGroupListResult = armnetwork.PrivateDNSZoneGroupListResult{ - // Value: []*armnetwork.PrivateDNSZoneGroup{ - // { - // ID: to.Ptr("/subscriptions/subId/resourceGroups/rg1/providers/Microsoft.Network/privateLinkServices/testPe/privateDnsZoneGroups/testPdnsgroup1"), - // Name: to.Ptr("testPdnsgroup1"), - // Properties: &armnetwork.PrivateDNSZoneGroupPropertiesFormat{ - // PrivateDNSZoneConfigs: []*armnetwork.PrivateDNSZoneConfig{ - // { - // Properties: &armnetwork.PrivateDNSZonePropertiesFormat{ - // PrivateDNSZoneID: to.Ptr("/subscriptions/subId/resourceGroups/rg1/providers/Microsoft.Network/privateDnsZones/zone1.com"), - // RecordSets: []*armnetwork.RecordSet{ - // { - // Fqdn: to.Ptr("abc.zone1.com"), - // IPAddresses: []*string{ - // to.Ptr("10.0.0.4")}, - // RecordSetName: to.Ptr("abc"), - // RecordType: to.Ptr("A"), - // }, - // { - // Fqdn: to.Ptr("abc2.zone1.com"), - // IPAddresses: []*string{ - // to.Ptr("10.0.0.5")}, - // RecordSetName: to.Ptr("abc2"), - // RecordType: to.Ptr("A"), - // }}, - // }, - // }}, - // ProvisioningState: to.Ptr(armnetwork.ProvisioningStateSucceeded), - // }, - // }, - // { - // ID: to.Ptr("/subscriptions/subId/resourceGroups/rg1/providers/Microsoft.Network/privateLinkServices/testPe/privateDnsZoneGroups/testPdnsgroup2"), - // Name: to.Ptr("testPdnsgroup2"), - // Properties: &armnetwork.PrivateDNSZoneGroupPropertiesFormat{ - // PrivateDNSZoneConfigs: []*armnetwork.PrivateDNSZoneConfig{ - // { - // Properties: &armnetwork.PrivateDNSZonePropertiesFormat{ - // PrivateDNSZoneID: to.Ptr("/subscriptions/subId/resourceGroups/rg1/providers/Microsoft.Network/privateDnsZones/zone2.com"), - // RecordSets: []*armnetwork.RecordSet{ - // { - // Fqdn: to.Ptr("abc3.zone2.com"), - // IPAddresses: []*string{ - // to.Ptr("10.0.0.6")}, - // RecordSetName: to.Ptr("abc3"), - // RecordType: to.Ptr("A"), - // }, - // { - // Fqdn: to.Ptr("abc4.zone2.com"), - // IPAddresses: []*string{ - // to.Ptr("10.0.0.7")}, - // RecordSetName: to.Ptr("abc4"), - // RecordType: to.Ptr("A"), - // }}, - // }, - // }}, - // ProvisioningState: to.Ptr(armnetwork.ProvisioningStateSucceeded), - // }, - // }}, - // } - } -} diff --git a/sdk/resourcemanager/network/armnetwork/privateendpoints_client_example_test.go b/sdk/resourcemanager/network/armnetwork/privateendpoints_client_example_test.go deleted file mode 100644 index 6864655af7f5..000000000000 --- a/sdk/resourcemanager/network/armnetwork/privateendpoints_client_example_test.go +++ /dev/null @@ -1,941 +0,0 @@ -//go:build go1.18 -// +build go1.18 - -// 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. -// DO NOT EDIT. - -package armnetwork_test - -import ( - "context" - "log" - - "github.com/Azure/azure-sdk-for-go/sdk/azcore/to" - "github.com/Azure/azure-sdk-for-go/sdk/azidentity" - "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/network/armnetwork/v6" -) - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/4883fa5dbf6f2c9093fac8ce334547e9dfac68fa/specification/network/resource-manager/Microsoft.Network/stable/2024-03-01/examples/PrivateEndpointDelete.json -func ExamplePrivateEndpointsClient_BeginDelete() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armnetwork.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewPrivateEndpointsClient().BeginDelete(ctx, "rg1", "testPe", nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - _, err = poller.PollUntilDone(ctx, nil) - if err != nil { - log.Fatalf("failed to pull the result: %v", err) - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/4883fa5dbf6f2c9093fac8ce334547e9dfac68fa/specification/network/resource-manager/Microsoft.Network/stable/2024-03-01/examples/PrivateEndpointGet.json -func ExamplePrivateEndpointsClient_Get_getPrivateEndpoint() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armnetwork.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewPrivateEndpointsClient().Get(ctx, "rg1", "testPe", &armnetwork.PrivateEndpointsClientGetOptions{Expand: nil}) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.PrivateEndpoint = armnetwork.PrivateEndpoint{ - // Name: to.Ptr("testPe"), - // Type: to.Ptr("Microsoft.Network/privateEndpoints"), - // ID: to.Ptr("/subscriptions/subId/resourceGroups/rg1/providers/Microsoft.Network/privateEndpoints/testPe"), - // Location: to.Ptr("eastus"), - // Properties: &armnetwork.PrivateEndpointProperties{ - // ApplicationSecurityGroups: []*armnetwork.ApplicationSecurityGroup{ - // }, - // CustomDNSConfigs: []*armnetwork.CustomDNSConfigPropertiesFormat{ - // { - // Fqdn: to.Ptr("abc.cosmos.com"), - // IPAddresses: []*string{ - // to.Ptr("192.168.0.4")}, - // }, - // { - // Fqdn: to.Ptr("abc2.cosmos.com"), - // IPAddresses: []*string{ - // to.Ptr("192.168.0.5")}, - // }}, - // CustomNetworkInterfaceName: to.Ptr("testPeNic"), - // IPConfigurations: []*armnetwork.PrivateEndpointIPConfiguration{ - // { - // Name: to.Ptr("pestaticconfig"), - // Properties: &armnetwork.PrivateEndpointIPConfigurationProperties{ - // GroupID: to.Ptr("file"), - // MemberName: to.Ptr("file"), - // PrivateIPAddress: to.Ptr("192.168.0.6"), - // }, - // }, - // { - // Name: to.Ptr("pestaticconfig2"), - // Properties: &armnetwork.PrivateEndpointIPConfigurationProperties{ - // GroupID: to.Ptr("file"), - // MemberName: to.Ptr("file2"), - // PrivateIPAddress: to.Ptr("192.168.0.7"), - // }, - // }}, - // ManualPrivateLinkServiceConnections: []*armnetwork.PrivateLinkServiceConnection{ - // }, - // NetworkInterfaces: []*armnetwork.Interface{ - // { - // ID: to.Ptr("/subscriptions/subId/resourceGroups/rg1/provders/Microsoft.Network/networkInterfaces/testPe.nic.abcd1234"), - // }}, - // PrivateLinkServiceConnections: []*armnetwork.PrivateLinkServiceConnection{ - // { - // ID: to.Ptr("/subscriptions/subId/resourceGroups/rg1/providers/Microsoft.Network/privateEndpoints/testPe/privateLinkServiceConnections/plsconnection1"), - // Properties: &armnetwork.PrivateLinkServiceConnectionProperties{ - // GroupIDs: []*string{ - // to.Ptr("groupIdFromResource")}, - // PrivateLinkServiceConnectionState: &armnetwork.PrivateLinkServiceConnectionState{ - // Description: to.Ptr("Auto-approved"), - // ActionsRequired: to.Ptr("None"), - // Status: to.Ptr("Approved"), - // }, - // PrivateLinkServiceID: to.Ptr("/subscriptions/subId/resourceGroups/rg1/providers/Microsoft.Network/privateLinkServices/testPls"), - // RequestMessage: to.Ptr("Please approve my connection."), - // }, - // }}, - // ProvisioningState: to.Ptr(armnetwork.ProvisioningStateSucceeded), - // Subnet: &armnetwork.Subnet{ - // ID: to.Ptr("/subscriptions/subId/resourceGroups/rg1/providers/Microsoft.Network/virtualNetworks/myVnet/subnets/mySubnet"), - // }, - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/4883fa5dbf6f2c9093fac8ce334547e9dfac68fa/specification/network/resource-manager/Microsoft.Network/stable/2024-03-01/examples/PrivateEndpointGetWithASG.json -func ExamplePrivateEndpointsClient_Get_getPrivateEndpointWithApplicationSecurityGroups() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armnetwork.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewPrivateEndpointsClient().Get(ctx, "rg1", "testPe", &armnetwork.PrivateEndpointsClientGetOptions{Expand: nil}) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.PrivateEndpoint = armnetwork.PrivateEndpoint{ - // Name: to.Ptr("testPe"), - // Type: to.Ptr("Microsoft.Network/privateEndpoints"), - // ID: to.Ptr("/subscriptions/subId/resourceGroups/rg1/providers/Microsoft.Network/privateEndpoints/testPe"), - // Location: to.Ptr("eastus"), - // Properties: &armnetwork.PrivateEndpointProperties{ - // ApplicationSecurityGroups: []*armnetwork.ApplicationSecurityGroup{ - // { - // ID: to.Ptr("/subscriptions/subId/resourceGroups/rg1/provders/Microsoft.Network/applicationSecurityGroup/asg1"), - // }}, - // CustomDNSConfigs: []*armnetwork.CustomDNSConfigPropertiesFormat{ - // { - // Fqdn: to.Ptr("abc.cosmos.com"), - // IPAddresses: []*string{ - // to.Ptr("192.168.0.4")}, - // }, - // { - // Fqdn: to.Ptr("abc2.cosmos.com"), - // IPAddresses: []*string{ - // to.Ptr("192.168.0.5")}, - // }}, - // ManualPrivateLinkServiceConnections: []*armnetwork.PrivateLinkServiceConnection{ - // }, - // NetworkInterfaces: []*armnetwork.Interface{ - // { - // ID: to.Ptr("/subscriptions/subId/resourceGroups/rg1/provders/Microsoft.Network/networkInterfaces/testPe.nic.abcd1234"), - // }}, - // PrivateLinkServiceConnections: []*armnetwork.PrivateLinkServiceConnection{ - // { - // ID: to.Ptr("/subscriptions/subId/resourceGroups/rg1/providers/Microsoft.Network/privateEndpoints/testPe/privateLinkServiceConnections/plsconnection1"), - // Properties: &armnetwork.PrivateLinkServiceConnectionProperties{ - // GroupIDs: []*string{ - // to.Ptr("groupIdFromResource")}, - // PrivateLinkServiceConnectionState: &armnetwork.PrivateLinkServiceConnectionState{ - // Description: to.Ptr("Auto-approved"), - // ActionsRequired: to.Ptr("None"), - // Status: to.Ptr("Approved"), - // }, - // PrivateLinkServiceID: to.Ptr("/subscriptions/subId/resourceGroups/rg1/providers/Microsoft.Network/privateLinkServices/testPls"), - // RequestMessage: to.Ptr("Please approve my connection."), - // }, - // }}, - // ProvisioningState: to.Ptr(armnetwork.ProvisioningStateSucceeded), - // Subnet: &armnetwork.Subnet{ - // ID: to.Ptr("/subscriptions/subId/resourceGroups/rg1/providers/Microsoft.Network/virtualNetworks/myVnet/subnets/mySubnet"), - // }, - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/4883fa5dbf6f2c9093fac8ce334547e9dfac68fa/specification/network/resource-manager/Microsoft.Network/stable/2024-03-01/examples/PrivateEndpointGetForManualApproval.json -func ExamplePrivateEndpointsClient_Get_getPrivateEndpointWithManualApprovalConnection() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armnetwork.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewPrivateEndpointsClient().Get(ctx, "rg1", "testPe", &armnetwork.PrivateEndpointsClientGetOptions{Expand: nil}) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.PrivateEndpoint = armnetwork.PrivateEndpoint{ - // Name: to.Ptr("testPe"), - // Type: to.Ptr("Microsoft.Network/privateEndpoints"), - // ID: to.Ptr("/subscriptions/subId/resourceGroups/rg1/providers/Microsoft.Network/privateEndpoints/testPe"), - // Location: to.Ptr("eastus"), - // Properties: &armnetwork.PrivateEndpointProperties{ - // ApplicationSecurityGroups: []*armnetwork.ApplicationSecurityGroup{ - // }, - // CustomDNSConfigs: []*armnetwork.CustomDNSConfigPropertiesFormat{ - // { - // Fqdn: to.Ptr("abc.cosmos.com"), - // IPAddresses: []*string{ - // to.Ptr("192.168.0.4")}, - // }, - // { - // Fqdn: to.Ptr("abc2.cosmos.com"), - // IPAddresses: []*string{ - // to.Ptr("192.168.0.5")}, - // }}, - // CustomNetworkInterfaceName: to.Ptr("testPeNic"), - // IPConfigurations: []*armnetwork.PrivateEndpointIPConfiguration{ - // { - // Name: to.Ptr("pestaticconfig"), - // Properties: &armnetwork.PrivateEndpointIPConfigurationProperties{ - // GroupID: to.Ptr("file"), - // MemberName: to.Ptr("file"), - // PrivateIPAddress: to.Ptr("192.168.0.5"), - // }, - // }}, - // ManualPrivateLinkServiceConnections: []*armnetwork.PrivateLinkServiceConnection{ - // { - // ID: to.Ptr("/subscriptions/subId/resourceGroups/rg1/providers/Microsoft.Network/privateEndpoints/testPe/manualPrivateLinkServiceConnections/plsconnection1"), - // Properties: &armnetwork.PrivateLinkServiceConnectionProperties{ - // GroupIDs: []*string{ - // to.Ptr("groupIdFromResource")}, - // PrivateLinkServiceConnectionState: &armnetwork.PrivateLinkServiceConnectionState{ - // Description: to.Ptr("Awaiting approval"), - // ActionsRequired: to.Ptr("None"), - // Status: to.Ptr("Pending"), - // }, - // PrivateLinkServiceID: to.Ptr("/subscriptions/subId/resourceGroups/rg1/providers/Microsoft.Network/privateLinkServices/testPls"), - // RequestMessage: to.Ptr("Please manually approve my connection."), - // }, - // }}, - // NetworkInterfaces: []*armnetwork.Interface{ - // { - // ID: to.Ptr("/subscriptions/subId/resourceGroups/rg1/provders/Microsoft.Network/networkInterfaces/testPe.nic.abcd1234"), - // }}, - // PrivateLinkServiceConnections: []*armnetwork.PrivateLinkServiceConnection{ - // }, - // ProvisioningState: to.Ptr(armnetwork.ProvisioningStateSucceeded), - // Subnet: &armnetwork.Subnet{ - // ID: to.Ptr("/subscriptions/subId/resourceGroups/rg1/providers/Microsoft.Network/virtualNetworks/myVnet/subnets/mySubnet"), - // }, - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/4883fa5dbf6f2c9093fac8ce334547e9dfac68fa/specification/network/resource-manager/Microsoft.Network/stable/2024-03-01/examples/PrivateEndpointCreate.json -func ExamplePrivateEndpointsClient_BeginCreateOrUpdate_createPrivateEndpoint() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armnetwork.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewPrivateEndpointsClient().BeginCreateOrUpdate(ctx, "rg1", "testPe", armnetwork.PrivateEndpoint{ - Location: to.Ptr("eastus2euap"), - Properties: &armnetwork.PrivateEndpointProperties{ - CustomNetworkInterfaceName: to.Ptr("testPeNic"), - IPConfigurations: []*armnetwork.PrivateEndpointIPConfiguration{ - { - Name: to.Ptr("pestaticconfig"), - Properties: &armnetwork.PrivateEndpointIPConfigurationProperties{ - GroupID: to.Ptr("file"), - MemberName: to.Ptr("file"), - PrivateIPAddress: to.Ptr("192.168.0.6"), - }, - }}, - PrivateLinkServiceConnections: []*armnetwork.PrivateLinkServiceConnection{ - { - Properties: &armnetwork.PrivateLinkServiceConnectionProperties{ - GroupIDs: []*string{ - to.Ptr("groupIdFromResource")}, - PrivateLinkServiceID: to.Ptr("/subscriptions/subId/resourceGroups/rg1/providers/Microsoft.Network/privateLinkServices/testPls"), - RequestMessage: to.Ptr("Please approve my connection."), - }, - }}, - Subnet: &armnetwork.Subnet{ - ID: to.Ptr("/subscriptions/subId/resourceGroups/rg1/providers/Microsoft.Network/virtualNetworks/myVnet/subnets/mySubnet"), - }, - }, - }, nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - res, err := poller.PollUntilDone(ctx, nil) - if err != nil { - log.Fatalf("failed to pull the result: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.PrivateEndpoint = armnetwork.PrivateEndpoint{ - // Name: to.Ptr("testPe"), - // ID: to.Ptr("/subscriptions/subId/resourceGroups/rg1/providers/Microsoft.Network/privateEndpoints/testPe"), - // Location: to.Ptr("eastus2euap"), - // Properties: &armnetwork.PrivateEndpointProperties{ - // ApplicationSecurityGroups: []*armnetwork.ApplicationSecurityGroup{ - // }, - // CustomDNSConfigs: []*armnetwork.CustomDNSConfigPropertiesFormat{ - // { - // Fqdn: to.Ptr("abc.cosmos.com"), - // IPAddresses: []*string{ - // to.Ptr("192.168.0.4")}, - // }, - // { - // Fqdn: to.Ptr("abc2.cosmos.com"), - // IPAddresses: []*string{ - // to.Ptr("192.168.0.5")}, - // }}, - // CustomNetworkInterfaceName: to.Ptr("testPeNic"), - // IPConfigurations: []*armnetwork.PrivateEndpointIPConfiguration{ - // { - // Name: to.Ptr("pestaticconfig"), - // Properties: &armnetwork.PrivateEndpointIPConfigurationProperties{ - // GroupID: to.Ptr("file"), - // MemberName: to.Ptr("file"), - // PrivateIPAddress: to.Ptr("192.168.0.6"), - // }, - // }}, - // ManualPrivateLinkServiceConnections: []*armnetwork.PrivateLinkServiceConnection{ - // }, - // NetworkInterfaces: []*armnetwork.Interface{ - // { - // ID: to.Ptr("/subscriptions/subId/resourceGroups/rg1/provders/Microsoft.Network/networkInterfaces/testPe.nic.abcd1234"), - // }}, - // PrivateLinkServiceConnections: []*armnetwork.PrivateLinkServiceConnection{ - // { - // ID: to.Ptr("/subscriptions/subId/resourceGroups/rg1/providers/Microsoft.Network/privateEndpoints/testPe/privateLinkServiceConnections/plsconnection1"), - // Properties: &armnetwork.PrivateLinkServiceConnectionProperties{ - // GroupIDs: []*string{ - // to.Ptr("groupIdFromResource")}, - // PrivateLinkServiceConnectionState: &armnetwork.PrivateLinkServiceConnectionState{ - // Description: to.Ptr("Auto-approved"), - // ActionsRequired: to.Ptr("None"), - // Status: to.Ptr("Approved"), - // }, - // PrivateLinkServiceID: to.Ptr("/subscriptions/subId/resourceGroups/rg1/providers/Microsoft.Network/privateLinkServices/testPls"), - // RequestMessage: to.Ptr("Please approve my connection."), - // }, - // }}, - // ProvisioningState: to.Ptr(armnetwork.ProvisioningStateSucceeded), - // Subnet: &armnetwork.Subnet{ - // ID: to.Ptr("/subscriptions/subId/resourceGroups/rg1/providers/Microsoft.Network/virtualNetworks/myVnet/subnets/mySubnet"), - // }, - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/4883fa5dbf6f2c9093fac8ce334547e9dfac68fa/specification/network/resource-manager/Microsoft.Network/stable/2024-03-01/examples/PrivateEndpointCreateWithASG.json -func ExamplePrivateEndpointsClient_BeginCreateOrUpdate_createPrivateEndpointWithApplicationSecurityGroups() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armnetwork.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewPrivateEndpointsClient().BeginCreateOrUpdate(ctx, "rg1", "testPe", armnetwork.PrivateEndpoint{ - Location: to.Ptr("eastus2euap"), - Properties: &armnetwork.PrivateEndpointProperties{ - ApplicationSecurityGroups: []*armnetwork.ApplicationSecurityGroup{ - { - ID: to.Ptr("/subscriptions/subId/resourceGroups/rg1/provders/Microsoft.Network/applicationSecurityGroup/asg1"), - }}, - PrivateLinkServiceConnections: []*armnetwork.PrivateLinkServiceConnection{ - { - Properties: &armnetwork.PrivateLinkServiceConnectionProperties{ - GroupIDs: []*string{ - to.Ptr("groupIdFromResource")}, - PrivateLinkServiceID: to.Ptr("/subscriptions/subId/resourceGroups/rg1/providers/Microsoft.Network/privateLinkServices/testPls"), - RequestMessage: to.Ptr("Please approve my connection."), - }, - }}, - Subnet: &armnetwork.Subnet{ - ID: to.Ptr("/subscriptions/subId/resourceGroups/rg1/providers/Microsoft.Network/virtualNetworks/myVnet/subnets/mySubnet"), - }, - }, - }, nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - res, err := poller.PollUntilDone(ctx, nil) - if err != nil { - log.Fatalf("failed to pull the result: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.PrivateEndpoint = armnetwork.PrivateEndpoint{ - // Name: to.Ptr("testPe"), - // ID: to.Ptr("/subscriptions/subId/resourceGroups/rg1/providers/Microsoft.Network/privateEndpoints/testPe"), - // Location: to.Ptr("eastus2euap"), - // Properties: &armnetwork.PrivateEndpointProperties{ - // ApplicationSecurityGroups: []*armnetwork.ApplicationSecurityGroup{ - // { - // ID: to.Ptr("/subscriptions/subId/resourceGroups/rg1/provders/Microsoft.Network/applicationSecurityGroup/asg1"), - // }}, - // CustomDNSConfigs: []*armnetwork.CustomDNSConfigPropertiesFormat{ - // { - // Fqdn: to.Ptr("abc.cosmos.com"), - // IPAddresses: []*string{ - // to.Ptr("192.168.0.4")}, - // }, - // { - // Fqdn: to.Ptr("abc2.cosmos.com"), - // IPAddresses: []*string{ - // to.Ptr("192.168.0.5")}, - // }}, - // ManualPrivateLinkServiceConnections: []*armnetwork.PrivateLinkServiceConnection{ - // }, - // NetworkInterfaces: []*armnetwork.Interface{ - // { - // ID: to.Ptr("/subscriptions/subId/resourceGroups/rg1/provders/Microsoft.Network/networkInterfaces/testPe.nic.abcd1234"), - // }}, - // PrivateLinkServiceConnections: []*armnetwork.PrivateLinkServiceConnection{ - // { - // ID: to.Ptr("/subscriptions/subId/resourceGroups/rg1/providers/Microsoft.Network/privateEndpoints/testPe/privateLinkServiceConnections/plsconnection1"), - // Properties: &armnetwork.PrivateLinkServiceConnectionProperties{ - // GroupIDs: []*string{ - // to.Ptr("groupIdFromResource")}, - // PrivateLinkServiceConnectionState: &armnetwork.PrivateLinkServiceConnectionState{ - // Description: to.Ptr("Auto-approved"), - // ActionsRequired: to.Ptr("None"), - // Status: to.Ptr("Approved"), - // }, - // PrivateLinkServiceID: to.Ptr("/subscriptions/subId/resourceGroups/rg1/providers/Microsoft.Network/privateLinkServices/testPls"), - // RequestMessage: to.Ptr("Please approve my connection."), - // }, - // }}, - // ProvisioningState: to.Ptr(armnetwork.ProvisioningStateSucceeded), - // Subnet: &armnetwork.Subnet{ - // ID: to.Ptr("/subscriptions/subId/resourceGroups/rg1/providers/Microsoft.Network/virtualNetworks/myVnet/subnets/mySubnet"), - // }, - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/4883fa5dbf6f2c9093fac8ce334547e9dfac68fa/specification/network/resource-manager/Microsoft.Network/stable/2024-03-01/examples/PrivateEndpointCreateForManualApproval.json -func ExamplePrivateEndpointsClient_BeginCreateOrUpdate_createPrivateEndpointWithManualApprovalConnection() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armnetwork.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewPrivateEndpointsClient().BeginCreateOrUpdate(ctx, "rg1", "testPe", armnetwork.PrivateEndpoint{ - Location: to.Ptr("eastus"), - Properties: &armnetwork.PrivateEndpointProperties{ - CustomNetworkInterfaceName: to.Ptr("testPeNic"), - IPConfigurations: []*armnetwork.PrivateEndpointIPConfiguration{ - { - Name: to.Ptr("pestaticconfig"), - Properties: &armnetwork.PrivateEndpointIPConfigurationProperties{ - GroupID: to.Ptr("file"), - MemberName: to.Ptr("file"), - PrivateIPAddress: to.Ptr("192.168.0.5"), - }, - }}, - ManualPrivateLinkServiceConnections: []*armnetwork.PrivateLinkServiceConnection{ - { - Properties: &armnetwork.PrivateLinkServiceConnectionProperties{ - GroupIDs: []*string{ - to.Ptr("groupIdFromResource")}, - PrivateLinkServiceID: to.Ptr("/subscriptions/subId/resourceGroups/rg1/providers/Microsoft.Network/privateLinkServices/testPls"), - RequestMessage: to.Ptr("Please manually approve my connection."), - }, - }}, - Subnet: &armnetwork.Subnet{ - ID: to.Ptr("/subscriptions/subId/resourceGroups/rg1/providers/Microsoft.Network/virtualNetworks/myVnet/subnets/mySubnet"), - }, - }, - }, nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - res, err := poller.PollUntilDone(ctx, nil) - if err != nil { - log.Fatalf("failed to pull the result: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.PrivateEndpoint = armnetwork.PrivateEndpoint{ - // Name: to.Ptr("testPe"), - // ID: to.Ptr("/subscriptions/subId/resourceGroups/rg1/providers/Microsoft.Network/privateEndpoints/testPe"), - // Location: to.Ptr("eastus"), - // Properties: &armnetwork.PrivateEndpointProperties{ - // ApplicationSecurityGroups: []*armnetwork.ApplicationSecurityGroup{ - // }, - // CustomDNSConfigs: []*armnetwork.CustomDNSConfigPropertiesFormat{ - // { - // Fqdn: to.Ptr("abc.cosmos.com"), - // IPAddresses: []*string{ - // to.Ptr("192.168.0.4")}, - // }, - // { - // Fqdn: to.Ptr("abc2.cosmos.com"), - // IPAddresses: []*string{ - // to.Ptr("192.168.0.5")}, - // }}, - // CustomNetworkInterfaceName: to.Ptr("testPeNic"), - // IPConfigurations: []*armnetwork.PrivateEndpointIPConfiguration{ - // { - // Name: to.Ptr("pestaticconfig"), - // Properties: &armnetwork.PrivateEndpointIPConfigurationProperties{ - // GroupID: to.Ptr("file"), - // MemberName: to.Ptr("file"), - // PrivateIPAddress: to.Ptr("192.168.0.5"), - // }, - // }}, - // ManualPrivateLinkServiceConnections: []*armnetwork.PrivateLinkServiceConnection{ - // { - // ID: to.Ptr("/subscriptions/subId/resourceGroups/rg1/providers/Microsoft.Network/privateEndpoints/testPe/manualPrivateLinkServiceConnections/plsconnection1"), - // Properties: &armnetwork.PrivateLinkServiceConnectionProperties{ - // GroupIDs: []*string{ - // to.Ptr("groupIdFromResource")}, - // PrivateLinkServiceConnectionState: &armnetwork.PrivateLinkServiceConnectionState{ - // Description: to.Ptr("Awaiting approval"), - // ActionsRequired: to.Ptr("None"), - // Status: to.Ptr("Pending"), - // }, - // PrivateLinkServiceID: to.Ptr("/subscriptions/subId/resourceGroups/rg1/providers/Microsoft.Network/privateLinkServices/testPls"), - // RequestMessage: to.Ptr("Please manually approve my connection."), - // }, - // }}, - // NetworkInterfaces: []*armnetwork.Interface{ - // { - // ID: to.Ptr("/subscriptions/subId/resourceGroups/rg1/provders/Microsoft.Network/networkInterfaces/testPe.nic.abcd1234"), - // }}, - // PrivateLinkServiceConnections: []*armnetwork.PrivateLinkServiceConnection{ - // }, - // ProvisioningState: to.Ptr(armnetwork.ProvisioningStateSucceeded), - // Subnet: &armnetwork.Subnet{ - // ID: to.Ptr("/subscriptions/subId/resourceGroups/rg1/providers/Microsoft.Network/virtualNetworks/myVnet/subnets/mySubnet"), - // }, - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/4883fa5dbf6f2c9093fac8ce334547e9dfac68fa/specification/network/resource-manager/Microsoft.Network/stable/2024-03-01/examples/PrivateEndpointList.json -func ExamplePrivateEndpointsClient_NewListPager() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armnetwork.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := clientFactory.NewPrivateEndpointsClient().NewListPager("rg1", nil) - for pager.More() { - page, err := pager.NextPage(ctx) - if err != nil { - log.Fatalf("failed to advance page: %v", err) - } - for _, v := range page.Value { - // You could use page here. We use blank identifier for just demo purposes. - _ = v - } - // If the HTTP response code is 200 as defined in example definition, your page structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // page.PrivateEndpointListResult = armnetwork.PrivateEndpointListResult{ - // Value: []*armnetwork.PrivateEndpoint{ - // { - // Name: to.Ptr("pe1"), - // Type: to.Ptr("Microsoft.Network/privateEndpoints"), - // ID: to.Ptr("/subscriptions/subId/resourceGroups/rg1/providers/Microsoft.Network/privateEndpoints/pe1"), - // Location: to.Ptr("eastus"), - // Properties: &armnetwork.PrivateEndpointProperties{ - // ApplicationSecurityGroups: []*armnetwork.ApplicationSecurityGroup{ - // }, - // CustomDNSConfigs: []*armnetwork.CustomDNSConfigPropertiesFormat{ - // { - // Fqdn: to.Ptr("abc.cosmos.com"), - // IPAddresses: []*string{ - // to.Ptr("192.168.0.4")}, - // }, - // { - // Fqdn: to.Ptr("abc2.cosmos.com"), - // IPAddresses: []*string{ - // to.Ptr("192.168.0.5")}, - // }}, - // CustomNetworkInterfaceName: to.Ptr("testPeNic"), - // IPConfigurations: []*armnetwork.PrivateEndpointIPConfiguration{ - // { - // Name: to.Ptr("pestaticconfig"), - // Properties: &armnetwork.PrivateEndpointIPConfigurationProperties{ - // GroupID: to.Ptr("file"), - // MemberName: to.Ptr("file"), - // PrivateIPAddress: to.Ptr("192.168.0.10"), - // }, - // }, - // { - // Name: to.Ptr("pestaticconfig"), - // Properties: &armnetwork.PrivateEndpointIPConfigurationProperties{ - // GroupID: to.Ptr("file"), - // MemberName: to.Ptr("file2"), - // PrivateIPAddress: to.Ptr("192.168.0.11"), - // }, - // }}, - // ManualPrivateLinkServiceConnections: []*armnetwork.PrivateLinkServiceConnection{ - // }, - // NetworkInterfaces: []*armnetwork.Interface{ - // { - // ID: to.Ptr("/subscriptions/subId/resourceGroups/rg1/provders/Microsoft.Network/networkInterfaces/pe1.nic.abcd1234"), - // }}, - // PrivateLinkServiceConnections: []*armnetwork.PrivateLinkServiceConnection{ - // { - // ID: to.Ptr("/subscriptions/subId/resourceGroups/rg1/providers/Microsoft.Network/privateEndpoints/pe1/privateLinkServiceConnections/plsconnection1"), - // Properties: &armnetwork.PrivateLinkServiceConnectionProperties{ - // GroupIDs: []*string{ - // to.Ptr("groupIdFromResource")}, - // PrivateLinkServiceConnectionState: &armnetwork.PrivateLinkServiceConnectionState{ - // Description: to.Ptr("Auto-approved"), - // ActionsRequired: to.Ptr("None"), - // Status: to.Ptr("Approved"), - // }, - // PrivateLinkServiceID: to.Ptr("/subscriptions/subId/resourceGroups/rg1/providers/Microsoft.Network/privateLinkServices/testPls1"), - // RequestMessage: to.Ptr("Please approve my connection for pe1."), - // }, - // }}, - // ProvisioningState: to.Ptr(armnetwork.ProvisioningStateSucceeded), - // Subnet: &armnetwork.Subnet{ - // ID: to.Ptr("/subscriptions/subId/resourceGroups/rg1/providers/Microsoft.Network/virtualNetworks/myVnet/subnets/mySubnet"), - // }, - // }, - // }, - // { - // Name: to.Ptr("pe2"), - // Type: to.Ptr("Microsoft.Network/privateEndpoints"), - // ID: to.Ptr("/subscriptions/subId/resourceGroups/rg1/providers/Microsoft.Network/privateEndpoints/pe2"), - // Location: to.Ptr("eastus"), - // Properties: &armnetwork.PrivateEndpointProperties{ - // ApplicationSecurityGroups: []*armnetwork.ApplicationSecurityGroup{ - // }, - // CustomDNSConfigs: []*armnetwork.CustomDNSConfigPropertiesFormat{ - // { - // Fqdn: to.Ptr("abc3.cosmos1.com"), - // IPAddresses: []*string{ - // to.Ptr("192.168.0.6")}, - // }, - // { - // Fqdn: to.Ptr("abc4.cosmos1.com"), - // IPAddresses: []*string{ - // to.Ptr("192.168.0.7")}, - // }}, - // CustomNetworkInterfaceName: to.Ptr("testPeNic"), - // IPConfigurations: []*armnetwork.PrivateEndpointIPConfiguration{ - // { - // Name: to.Ptr("pestaticconfig3"), - // Properties: &armnetwork.PrivateEndpointIPConfigurationProperties{ - // GroupID: to.Ptr("file"), - // MemberName: to.Ptr("file"), - // PrivateIPAddress: to.Ptr("192.168.0.8"), - // }, - // }, - // { - // Name: to.Ptr("pestaticconfig4"), - // Properties: &armnetwork.PrivateEndpointIPConfigurationProperties{ - // GroupID: to.Ptr("file"), - // MemberName: to.Ptr("file2"), - // PrivateIPAddress: to.Ptr("192.168.0.9"), - // }, - // }}, - // ManualPrivateLinkServiceConnections: []*armnetwork.PrivateLinkServiceConnection{ - // { - // ID: to.Ptr("/subscriptions/subId/resourceGroups/rg1/providers/Microsoft.Network/privateEndpoints/pe2/privateLinkServiceConnections/plsconnection2"), - // Properties: &armnetwork.PrivateLinkServiceConnectionProperties{ - // GroupIDs: []*string{ - // to.Ptr("groupIdFromResource")}, - // PrivateLinkServiceConnectionState: &armnetwork.PrivateLinkServiceConnectionState{ - // Description: to.Ptr("Awaiting approval"), - // ActionsRequired: to.Ptr("None"), - // Status: to.Ptr("Pending"), - // }, - // PrivateLinkServiceID: to.Ptr("/subscriptions/subId/resourceGroups/rg1/providers/Microsoft.Network/privateLinkServices/testPls2"), - // RequestMessage: to.Ptr("Please manually approve my connection for pe2."), - // }, - // }}, - // NetworkInterfaces: []*armnetwork.Interface{ - // { - // ID: to.Ptr("/subscriptions/subId/resourceGroups/rg1/provders/Microsoft.Network/networkInterfaces/pe2.nic.zyxw9876"), - // }}, - // PrivateLinkServiceConnections: []*armnetwork.PrivateLinkServiceConnection{ - // }, - // ProvisioningState: to.Ptr(armnetwork.ProvisioningStateSucceeded), - // Subnet: &armnetwork.Subnet{ - // ID: to.Ptr("/subscriptions/subId/resourceGroups/rg1/providers/Microsoft.Network/virtualNetworks/myVnet/subnets/mySubnet2"), - // }, - // }, - // }}, - // } - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/4883fa5dbf6f2c9093fac8ce334547e9dfac68fa/specification/network/resource-manager/Microsoft.Network/stable/2024-03-01/examples/PrivateEndpointListAll.json -func ExamplePrivateEndpointsClient_NewListBySubscriptionPager() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armnetwork.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := clientFactory.NewPrivateEndpointsClient().NewListBySubscriptionPager(nil) - for pager.More() { - page, err := pager.NextPage(ctx) - if err != nil { - log.Fatalf("failed to advance page: %v", err) - } - for _, v := range page.Value { - // You could use page here. We use blank identifier for just demo purposes. - _ = v - } - // If the HTTP response code is 200 as defined in example definition, your page structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // page.PrivateEndpointListResult = armnetwork.PrivateEndpointListResult{ - // Value: []*armnetwork.PrivateEndpoint{ - // { - // Name: to.Ptr("pe1"), - // Type: to.Ptr("Microsoft.Network/privateEndpoints"), - // ID: to.Ptr("/subscriptions/subId/resourceGroups/rg1/providers/Microsoft.Network/privateEndpoints/pe1"), - // Location: to.Ptr("eastus"), - // Properties: &armnetwork.PrivateEndpointProperties{ - // ApplicationSecurityGroups: []*armnetwork.ApplicationSecurityGroup{ - // }, - // CustomDNSConfigs: []*armnetwork.CustomDNSConfigPropertiesFormat{ - // { - // Fqdn: to.Ptr("abc.cosmos.com"), - // IPAddresses: []*string{ - // to.Ptr("192.168.0.4")}, - // }, - // { - // Fqdn: to.Ptr("abc2.cosmos.com"), - // IPAddresses: []*string{ - // to.Ptr("192.168.0.5")}, - // }}, - // CustomNetworkInterfaceName: to.Ptr("testPeNic"), - // IPConfigurations: []*armnetwork.PrivateEndpointIPConfiguration{ - // { - // Name: to.Ptr("pestaticconfig1"), - // Properties: &armnetwork.PrivateEndpointIPConfigurationProperties{ - // GroupID: to.Ptr("file"), - // MemberName: to.Ptr("file"), - // PrivateIPAddress: to.Ptr("192.168.0.9"), - // }, - // }, - // { - // Name: to.Ptr("pestaticconfig2"), - // Properties: &armnetwork.PrivateEndpointIPConfigurationProperties{ - // GroupID: to.Ptr("file"), - // MemberName: to.Ptr("file2"), - // PrivateIPAddress: to.Ptr("192.168.0.10"), - // }, - // }}, - // NetworkInterfaces: []*armnetwork.Interface{ - // { - // ID: to.Ptr("/subscriptions/subId/resourceGroups/rg1/provders/Microsoft.Network/networkInterfaces/pe1.nic.abcd1234"), - // }}, - // PrivateLinkServiceConnections: []*armnetwork.PrivateLinkServiceConnection{ - // { - // ID: to.Ptr("/subscriptions/subId/resourceGroups/rg1/providers/Microsoft.Network/privateEndpoints/pe1/privateLinkServiceConnections/plsconnection1"), - // Properties: &armnetwork.PrivateLinkServiceConnectionProperties{ - // GroupIDs: []*string{ - // to.Ptr("groupIdFromResource")}, - // PrivateLinkServiceConnectionState: &armnetwork.PrivateLinkServiceConnectionState{ - // Description: to.Ptr("Auto-approved"), - // ActionsRequired: to.Ptr("None"), - // Status: to.Ptr("Approved"), - // }, - // PrivateLinkServiceID: to.Ptr("/subscriptions/subId/resourceGroups/rg1/providers/Microsoft.Network/privateLinkServices/testPls1"), - // RequestMessage: to.Ptr("Please approve my connection for pe1."), - // }, - // }}, - // ProvisioningState: to.Ptr(armnetwork.ProvisioningStateSucceeded), - // Subnet: &armnetwork.Subnet{ - // ID: to.Ptr("/subscriptions/subId/resourceGroups/rg1/providers/Microsoft.Network/virtualNetworks/myVnet/subnets/mySubnet"), - // }, - // }, - // }, - // { - // Name: to.Ptr("pe2"), - // Type: to.Ptr("Microsoft.Network/privateEndpoints"), - // ID: to.Ptr("/subscriptions/subId/resourceGroups/rg2/providers/Microsoft.Network/privateEndpoints/pe2"), - // Location: to.Ptr("eastus"), - // Properties: &armnetwork.PrivateEndpointProperties{ - // ApplicationSecurityGroups: []*armnetwork.ApplicationSecurityGroup{ - // }, - // CustomDNSConfigs: []*armnetwork.CustomDNSConfigPropertiesFormat{ - // { - // Fqdn: to.Ptr("abc3.cosmos1.com"), - // IPAddresses: []*string{ - // to.Ptr("192.168.0.5")}, - // }, - // { - // Fqdn: to.Ptr("abc4.cosmos1.com"), - // IPAddresses: []*string{ - // to.Ptr("192.168.0.6")}, - // }}, - // CustomNetworkInterfaceName: to.Ptr("testPeNic"), - // IPConfigurations: []*armnetwork.PrivateEndpointIPConfiguration{ - // { - // Name: to.Ptr("pestaticconfig3"), - // Properties: &armnetwork.PrivateEndpointIPConfigurationProperties{ - // GroupID: to.Ptr("file"), - // MemberName: to.Ptr("file"), - // PrivateIPAddress: to.Ptr("192.168.0.11"), - // }, - // }, - // { - // Name: to.Ptr("pestaticconfig4"), - // Properties: &armnetwork.PrivateEndpointIPConfigurationProperties{ - // GroupID: to.Ptr("file"), - // MemberName: to.Ptr("file2"), - // PrivateIPAddress: to.Ptr("192.168.0.12"), - // }, - // }}, - // ManualPrivateLinkServiceConnections: []*armnetwork.PrivateLinkServiceConnection{ - // { - // ID: to.Ptr("/subscriptions/subId/resourceGroups/rg2/providers/Microsoft.Network/privateEndpoints/pe2/privateLinkServiceConnections/plsconnection2"), - // Properties: &armnetwork.PrivateLinkServiceConnectionProperties{ - // GroupIDs: []*string{ - // to.Ptr("groupIdFromResource")}, - // PrivateLinkServiceConnectionState: &armnetwork.PrivateLinkServiceConnectionState{ - // Description: to.Ptr("Awaiting approval"), - // ActionsRequired: to.Ptr("None"), - // Status: to.Ptr("Pending"), - // }, - // PrivateLinkServiceID: to.Ptr("/subscriptions/subId/resourceGroups/rg2/providers/Microsoft.Network/privateLinkServices/testPls2"), - // RequestMessage: to.Ptr("Please manually approve my connection for pe2."), - // }, - // }}, - // NetworkInterfaces: []*armnetwork.Interface{ - // { - // ID: to.Ptr("/subscriptions/subId/resourceGroups/rg2/provders/Microsoft.Network/networkInterfaces/pe2.nic.zyxw9876"), - // }}, - // PrivateLinkServiceConnections: []*armnetwork.PrivateLinkServiceConnection{ - // }, - // ProvisioningState: to.Ptr(armnetwork.ProvisioningStateSucceeded), - // Subnet: &armnetwork.Subnet{ - // ID: to.Ptr("/subscriptions/subId/resourceGroups/rg2/providers/Microsoft.Network/virtualNetworks/myVnet/subnets/mySubnet2"), - // }, - // }, - // }, - // { - // Name: to.Ptr("pe3"), - // Type: to.Ptr("Microsoft.Network/privateEndpoints"), - // ID: to.Ptr("/subscriptions/subId/resourceGroups/rg3/providers/Microsoft.Network/privateEndpoints/pe3"), - // Location: to.Ptr("eastus"), - // Properties: &armnetwork.PrivateEndpointProperties{ - // ApplicationSecurityGroups: []*armnetwork.ApplicationSecurityGroup{ - // }, - // CustomDNSConfigs: []*armnetwork.CustomDNSConfigPropertiesFormat{ - // { - // Fqdn: to.Ptr("abc5.cosmos2.com"), - // IPAddresses: []*string{ - // to.Ptr("192.168.0.7")}, - // }, - // { - // Fqdn: to.Ptr("abc6.cosmos2.com"), - // IPAddresses: []*string{ - // to.Ptr("192.168.0.8")}, - // }}, - // CustomNetworkInterfaceName: to.Ptr("testPeNic"), - // IPConfigurations: []*armnetwork.PrivateEndpointIPConfiguration{ - // { - // Name: to.Ptr("pestaticconfig5"), - // Properties: &armnetwork.PrivateEndpointIPConfigurationProperties{ - // GroupID: to.Ptr("file"), - // MemberName: to.Ptr("file"), - // PrivateIPAddress: to.Ptr("192.168.0.13"), - // }, - // }, - // { - // Name: to.Ptr("pestaticconfig6"), - // Properties: &armnetwork.PrivateEndpointIPConfigurationProperties{ - // GroupID: to.Ptr("file"), - // MemberName: to.Ptr("file2"), - // PrivateIPAddress: to.Ptr("192.168.0.14"), - // }, - // }}, - // NetworkInterfaces: []*armnetwork.Interface{ - // { - // ID: to.Ptr("/subscriptions/subId/resourceGroups/rg3/provders/Microsoft.Network/networkInterfaces/pe3.nic.efgh5463"), - // }}, - // PrivateLinkServiceConnections: []*armnetwork.PrivateLinkServiceConnection{ - // { - // ID: to.Ptr("/subscriptions/subId/resourceGroups/rg3/providers/Microsoft.Network/privateEndpoints/testPe/privateLinkServiceConnections/plsconnection3"), - // Properties: &armnetwork.PrivateLinkServiceConnectionProperties{ - // GroupIDs: []*string{ - // to.Ptr("groupIdFromResource")}, - // PrivateLinkServiceConnectionState: &armnetwork.PrivateLinkServiceConnectionState{ - // Description: to.Ptr("Auto-approved"), - // ActionsRequired: to.Ptr("None"), - // Status: to.Ptr("Approved"), - // }, - // PrivateLinkServiceID: to.Ptr("/subscriptions/subId/resourceGroups/rg3/providers/Microsoft.Network/privateLinkServices/testPls3"), - // RequestMessage: to.Ptr("Please approve my connection for pe3."), - // }, - // }}, - // ProvisioningState: to.Ptr(armnetwork.ProvisioningStateSucceeded), - // Subnet: &armnetwork.Subnet{ - // ID: to.Ptr("/subscriptions/subId/resourceGroups/rg3/providers/Microsoft.Network/virtualNetworks/myVnet/subnets/mySubnet3"), - // }, - // }, - // }}, - // } - } -} diff --git a/sdk/resourcemanager/network/armnetwork/privatelinkservices_client_example_test.go b/sdk/resourcemanager/network/armnetwork/privatelinkservices_client_example_test.go deleted file mode 100644 index 19eba78eb284..000000000000 --- a/sdk/resourcemanager/network/armnetwork/privatelinkservices_client_example_test.go +++ /dev/null @@ -1,798 +0,0 @@ -//go:build go1.18 -// +build go1.18 - -// 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. -// DO NOT EDIT. - -package armnetwork_test - -import ( - "context" - "log" - - "github.com/Azure/azure-sdk-for-go/sdk/azcore/to" - "github.com/Azure/azure-sdk-for-go/sdk/azidentity" - "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/network/armnetwork/v6" -) - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/4883fa5dbf6f2c9093fac8ce334547e9dfac68fa/specification/network/resource-manager/Microsoft.Network/stable/2024-03-01/examples/PrivateLinkServiceDelete.json -func ExamplePrivateLinkServicesClient_BeginDelete() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armnetwork.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewPrivateLinkServicesClient().BeginDelete(ctx, "rg1", "testPls", nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - _, err = poller.PollUntilDone(ctx, nil) - if err != nil { - log.Fatalf("failed to pull the result: %v", err) - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/4883fa5dbf6f2c9093fac8ce334547e9dfac68fa/specification/network/resource-manager/Microsoft.Network/stable/2024-03-01/examples/PrivateLinkServiceGet.json -func ExamplePrivateLinkServicesClient_Get() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armnetwork.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewPrivateLinkServicesClient().Get(ctx, "rg1", "testPls", &armnetwork.PrivateLinkServicesClientGetOptions{Expand: nil}) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.PrivateLinkService = armnetwork.PrivateLinkService{ - // Name: to.Ptr("testPls"), - // Type: to.Ptr("Microsoft.Network/privateLinkServices"), - // ID: to.Ptr("/subscriptions/subId/resourceGroups/rg1/providers/Microsoft.Network/privateLinkServices/testPls"), - // Location: to.Ptr("eastus"), - // Properties: &armnetwork.PrivateLinkServiceProperties{ - // Alias: to.Ptr("ContosoService.{guid}.azure.privatelinkservice"), - // AutoApproval: &armnetwork.PrivateLinkServicePropertiesAutoApproval{ - // Subscriptions: []*string{ - // to.Ptr("subscription1"), - // to.Ptr("subscription2")}, - // }, - // Fqdns: []*string{ - // to.Ptr("fqdn1"), - // to.Ptr("fqdn2"), - // to.Ptr("fqdn3")}, - // IPConfigurations: []*armnetwork.PrivateLinkServiceIPConfiguration{ - // { - // ID: to.Ptr("/subscriptions/subId/resourceGroups/rg1/providers/Microsoft.Network/privateLinkServices/testPls/ipConfigurations/ipconfig1"), - // Name: to.Ptr("ipconfig1"), - // Properties: &armnetwork.PrivateLinkServiceIPConfigurationProperties{ - // PrivateIPAddress: to.Ptr("10.0.1.4"), - // PrivateIPAddressVersion: to.Ptr(armnetwork.IPVersionIPv4), - // PrivateIPAllocationMethod: to.Ptr(armnetwork.IPAllocationMethodStatic), - // Subnet: &armnetwork.Subnet{ - // ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/virtualNetworks/vnetlb/subnets/subnetlb"), - // }, - // }, - // }}, - // LoadBalancerFrontendIPConfigurations: []*armnetwork.FrontendIPConfiguration{ - // { - // ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/loadBalancers/lb/frontendIPConfigurations/fe-lb"), - // }}, - // NetworkInterfaces: []*armnetwork.Interface{ - // { - // ID: to.Ptr("/subscriptions/subId/resourceGroups/rg1/provders/Microsoft.Network/networkInterfaces/testPls.nic.abcd1234"), - // }}, - // PrivateEndpointConnections: []*armnetwork.PrivateEndpointConnection{ - // { - // ID: to.Ptr("/subscriptions/subId/resourceGroups/rg1/providers/Microsoft.Network/privateLinkServices/testPls/privateEndpointConnections/privateEndpointConnection"), - // Name: to.Ptr("privateEndpointConnection"), - // Properties: &armnetwork.PrivateEndpointConnectionProperties{ - // PrivateEndpoint: &armnetwork.PrivateEndpoint{ - // ID: to.Ptr("/subscriptions/subId/resourceGroups/rg1/providers/Microsoft.Network/privateEndpoints/testPe"), - // }, - // PrivateLinkServiceConnectionState: &armnetwork.PrivateLinkServiceConnectionState{ - // Description: to.Ptr("approved it for some reason."), - // Status: to.Ptr("Approved"), - // }, - // }, - // }}, - // ProvisioningState: to.Ptr(armnetwork.ProvisioningStateSucceeded), - // Visibility: &armnetwork.PrivateLinkServicePropertiesVisibility{ - // Subscriptions: []*string{ - // to.Ptr("subscription1"), - // to.Ptr("subscription2"), - // to.Ptr("subscription3")}, - // }, - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/4883fa5dbf6f2c9093fac8ce334547e9dfac68fa/specification/network/resource-manager/Microsoft.Network/stable/2024-03-01/examples/PrivateLinkServiceCreate.json -func ExamplePrivateLinkServicesClient_BeginCreateOrUpdate() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armnetwork.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewPrivateLinkServicesClient().BeginCreateOrUpdate(ctx, "rg1", "testPls", armnetwork.PrivateLinkService{ - Location: to.Ptr("eastus"), - Properties: &armnetwork.PrivateLinkServiceProperties{ - AutoApproval: &armnetwork.PrivateLinkServicePropertiesAutoApproval{ - Subscriptions: []*string{ - to.Ptr("subscription1"), - to.Ptr("subscription2")}, - }, - Fqdns: []*string{ - to.Ptr("fqdn1"), - to.Ptr("fqdn2"), - to.Ptr("fqdn3")}, - IPConfigurations: []*armnetwork.PrivateLinkServiceIPConfiguration{ - { - Name: to.Ptr("fe-lb"), - Properties: &armnetwork.PrivateLinkServiceIPConfigurationProperties{ - PrivateIPAddress: to.Ptr("10.0.1.4"), - PrivateIPAddressVersion: to.Ptr(armnetwork.IPVersionIPv4), - PrivateIPAllocationMethod: to.Ptr(armnetwork.IPAllocationMethodStatic), - Subnet: &armnetwork.Subnet{ - ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/virtualNetworks/vnetlb/subnets/subnetlb"), - }, - }, - }}, - LoadBalancerFrontendIPConfigurations: []*armnetwork.FrontendIPConfiguration{ - { - ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/loadBalancers/lb/frontendIPConfigurations/fe-lb"), - }}, - Visibility: &armnetwork.PrivateLinkServicePropertiesVisibility{ - Subscriptions: []*string{ - to.Ptr("subscription1"), - to.Ptr("subscription2"), - to.Ptr("subscription3")}, - }, - }, - }, nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - res, err := poller.PollUntilDone(ctx, nil) - if err != nil { - log.Fatalf("failed to pull the result: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.PrivateLinkService = armnetwork.PrivateLinkService{ - // Name: to.Ptr("testPls"), - // ID: to.Ptr("/subscriptions/subId/resourceGroups/rg1/providers/Microsoft.Network/privateLinkServices/testPls"), - // Location: to.Ptr("eastus"), - // Properties: &armnetwork.PrivateLinkServiceProperties{ - // Alias: to.Ptr("ContosoService.{guid}.azure.privatelinkservice"), - // AutoApproval: &armnetwork.PrivateLinkServicePropertiesAutoApproval{ - // Subscriptions: []*string{ - // to.Ptr("subscription1"), - // to.Ptr("subscription2")}, - // }, - // Fqdns: []*string{ - // to.Ptr("fqdn1"), - // to.Ptr("fqdn2"), - // to.Ptr("fqdn3")}, - // IPConfigurations: []*armnetwork.PrivateLinkServiceIPConfiguration{ - // { - // ID: to.Ptr("/subscriptions/subId/resourceGroups/rg1/providers/Microsoft.Network/privateLinkServices/testPls/ipConfigurations/ipconfig1"), - // Name: to.Ptr("ipconfig1"), - // Properties: &armnetwork.PrivateLinkServiceIPConfigurationProperties{ - // PrivateIPAddress: to.Ptr("10.0.1.4"), - // PrivateIPAddressVersion: to.Ptr(armnetwork.IPVersionIPv4), - // PrivateIPAllocationMethod: to.Ptr(armnetwork.IPAllocationMethodStatic), - // Subnet: &armnetwork.Subnet{ - // ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/virtualNetworks/vnetlb/subnets/subnetlb"), - // }, - // }, - // }}, - // LoadBalancerFrontendIPConfigurations: []*armnetwork.FrontendIPConfiguration{ - // { - // ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/loadBalancers/lb/frontendIPConfigurations/fe-lb"), - // }}, - // NetworkInterfaces: []*armnetwork.Interface{ - // { - // ID: to.Ptr("/subscriptions/subId/resourceGroups/rg1/provders/Microsoft.Network/networkInterfaces/testPls.nic.abcd1234"), - // }}, - // ProvisioningState: to.Ptr(armnetwork.ProvisioningStateSucceeded), - // Visibility: &armnetwork.PrivateLinkServicePropertiesVisibility{ - // Subscriptions: []*string{ - // to.Ptr("subscription1"), - // to.Ptr("subscription2"), - // to.Ptr("subscription3")}, - // }, - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/4883fa5dbf6f2c9093fac8ce334547e9dfac68fa/specification/network/resource-manager/Microsoft.Network/stable/2024-03-01/examples/PrivateLinkServiceList.json -func ExamplePrivateLinkServicesClient_NewListPager() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armnetwork.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := clientFactory.NewPrivateLinkServicesClient().NewListPager("rg1", nil) - for pager.More() { - page, err := pager.NextPage(ctx) - if err != nil { - log.Fatalf("failed to advance page: %v", err) - } - for _, v := range page.Value { - // You could use page here. We use blank identifier for just demo purposes. - _ = v - } - // If the HTTP response code is 200 as defined in example definition, your page structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // page.PrivateLinkServiceListResult = armnetwork.PrivateLinkServiceListResult{ - // Value: []*armnetwork.PrivateLinkService{ - // { - // Name: to.Ptr("testPls1"), - // Type: to.Ptr("Microsoft.Network/privateLinkServices"), - // ID: to.Ptr("/subscriptions/subId/resourceGroups/rg1/providers/Microsoft.Network/privateLinkServices/testPls1"), - // Location: to.Ptr("eastus"), - // Properties: &armnetwork.PrivateLinkServiceProperties{ - // Alias: to.Ptr("ContosoService.{guid}.azure.privatelinkservice"), - // AutoApproval: &armnetwork.PrivateLinkServicePropertiesAutoApproval{ - // Subscriptions: []*string{ - // to.Ptr("subscription1")}, - // }, - // Fqdns: []*string{ - // to.Ptr("fqdn1"), - // to.Ptr("fqdn2")}, - // IPConfigurations: []*armnetwork.PrivateLinkServiceIPConfiguration{ - // { - // ID: to.Ptr("/subscriptions/subId/resourceGroups/rg1/providers/Microsoft.Network/privateLinkServices/testPls1/ipConfigurations/ipconfig1"), - // Name: to.Ptr("ipconfig1"), - // Properties: &armnetwork.PrivateLinkServiceIPConfigurationProperties{ - // PrivateIPAddress: to.Ptr("10.0.1.4"), - // PrivateIPAddressVersion: to.Ptr(armnetwork.IPVersionIPv4), - // PrivateIPAllocationMethod: to.Ptr(armnetwork.IPAllocationMethodStatic), - // Subnet: &armnetwork.Subnet{ - // ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/virtualNetworks/vnetlb/subnets/subnetlb1"), - // }, - // }, - // }}, - // LoadBalancerFrontendIPConfigurations: []*armnetwork.FrontendIPConfiguration{ - // { - // ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/loadBalancers/lb/frontendIPConfigurations/fe-lb1"), - // }}, - // NetworkInterfaces: []*armnetwork.Interface{ - // { - // ID: to.Ptr("/subscriptions/subId/resourceGroups/rg1/provders/Microsoft.Network/networkInterfaces/testPls1.nic.abcd1234"), - // }}, - // PrivateEndpointConnections: []*armnetwork.PrivateEndpointConnection{ - // { - // ID: to.Ptr("/subscriptions/subId/resourceGroups/rg1/providers/Microsoft.Network/privateLinkServices/testPls1/privateEndpointConnections/pec1"), - // Name: to.Ptr("pec1"), - // Properties: &armnetwork.PrivateEndpointConnectionProperties{ - // PrivateEndpoint: &armnetwork.PrivateEndpoint{ - // ID: to.Ptr("/subscriptions/subId/resourceGroups/rg1/providers/Microsoft.Network/privateEndpoints/testPe1"), - // }, - // PrivateLinkServiceConnectionState: &armnetwork.PrivateLinkServiceConnectionState{ - // Description: to.Ptr("approved it for some reason."), - // Status: to.Ptr("Approved"), - // }, - // }, - // }}, - // ProvisioningState: to.Ptr(armnetwork.ProvisioningStateSucceeded), - // Visibility: &armnetwork.PrivateLinkServicePropertiesVisibility{ - // Subscriptions: []*string{ - // to.Ptr("subscription1")}, - // }, - // }, - // }, - // { - // Name: to.Ptr("testPls2"), - // Type: to.Ptr("Microsoft.Network/privateLinkServices"), - // ID: to.Ptr("/subscriptions/subId/resourceGroups/rg1/providers/Microsoft.Network/privateLinkServices/testPls2"), - // Location: to.Ptr("eastus"), - // Properties: &armnetwork.PrivateLinkServiceProperties{ - // Alias: to.Ptr("ContosoService.{guid}.azure.privatelinkservice"), - // AutoApproval: &armnetwork.PrivateLinkServicePropertiesAutoApproval{ - // Subscriptions: []*string{ - // to.Ptr("subscription1"), - // to.Ptr("subscription2")}, - // }, - // Fqdns: []*string{ - // to.Ptr("fqdn1"), - // to.Ptr("fqdn2"), - // to.Ptr("fqdn3")}, - // IPConfigurations: []*armnetwork.PrivateLinkServiceIPConfiguration{ - // { - // ID: to.Ptr("/subscriptions/subId/resourceGroups/rg1/providers/Microsoft.Network/privateLinkServices/testPls2/ipConfigurations/ipconfig2"), - // Name: to.Ptr("ipconfig2"), - // Properties: &armnetwork.PrivateLinkServiceIPConfigurationProperties{ - // PrivateIPAddress: to.Ptr("10.0.1.5"), - // PrivateIPAddressVersion: to.Ptr(armnetwork.IPVersionIPv4), - // PrivateIPAllocationMethod: to.Ptr(armnetwork.IPAllocationMethodStatic), - // Subnet: &armnetwork.Subnet{ - // ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/virtualNetworks/vnetlb/subnets/subnetlb2"), - // }, - // }, - // }}, - // LoadBalancerFrontendIPConfigurations: []*armnetwork.FrontendIPConfiguration{ - // { - // ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/loadBalancers/lb/frontendIPConfigurations/fe-lb2"), - // }}, - // NetworkInterfaces: []*armnetwork.Interface{ - // { - // ID: to.Ptr("/subscriptions/subId/resourceGroups/rg1/provders/Microsoft.Network/networkInterfaces/testPls2.nic.efgh5678"), - // }}, - // PrivateEndpointConnections: []*armnetwork.PrivateEndpointConnection{ - // { - // ID: to.Ptr("/subscriptions/subId/resourceGroups/rg1/providers/Microsoft.Network/privateLinkServices/testPls2/privateEndpointConnections/pec2"), - // Name: to.Ptr("pec2"), - // Properties: &armnetwork.PrivateEndpointConnectionProperties{ - // PrivateEndpoint: &armnetwork.PrivateEndpoint{ - // ID: to.Ptr("/subscriptions/subId/resourceGroups/rg1/providers/Microsoft.Network/privateEndpoints/testPe2"), - // }, - // PrivateLinkServiceConnectionState: &armnetwork.PrivateLinkServiceConnectionState{ - // Description: to.Ptr("approved it for some reason."), - // Status: to.Ptr("Approved"), - // }, - // }, - // }}, - // ProvisioningState: to.Ptr(armnetwork.ProvisioningStateSucceeded), - // Visibility: &armnetwork.PrivateLinkServicePropertiesVisibility{ - // Subscriptions: []*string{ - // to.Ptr("subscription1"), - // to.Ptr("subscription2"), - // to.Ptr("subscription3")}, - // }, - // }, - // }}, - // } - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/4883fa5dbf6f2c9093fac8ce334547e9dfac68fa/specification/network/resource-manager/Microsoft.Network/stable/2024-03-01/examples/PrivateLinkServiceListAll.json -func ExamplePrivateLinkServicesClient_NewListBySubscriptionPager() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armnetwork.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := clientFactory.NewPrivateLinkServicesClient().NewListBySubscriptionPager(nil) - for pager.More() { - page, err := pager.NextPage(ctx) - if err != nil { - log.Fatalf("failed to advance page: %v", err) - } - for _, v := range page.Value { - // You could use page here. We use blank identifier for just demo purposes. - _ = v - } - // If the HTTP response code is 200 as defined in example definition, your page structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // page.PrivateLinkServiceListResult = armnetwork.PrivateLinkServiceListResult{ - // Value: []*armnetwork.PrivateLinkService{ - // { - // Name: to.Ptr("testPls1"), - // Type: to.Ptr("Microsoft.Network/privateLinkServices"), - // ID: to.Ptr("/subscriptions/subId/resourceGroups/rg1/providers/Microsoft.Network/privateLinkServices/testPls1"), - // Location: to.Ptr("eastus"), - // Properties: &armnetwork.PrivateLinkServiceProperties{ - // Alias: to.Ptr("ContosoService.{guid}.azure.privatelinkservice"), - // AutoApproval: &armnetwork.PrivateLinkServicePropertiesAutoApproval{ - // Subscriptions: []*string{ - // to.Ptr("subscription1"), - // to.Ptr("subscription2")}, - // }, - // Fqdns: []*string{ - // to.Ptr("fqdn1"), - // to.Ptr("fqdn2"), - // to.Ptr("fqdn3")}, - // IPConfigurations: []*armnetwork.PrivateLinkServiceIPConfiguration{ - // { - // ID: to.Ptr("/subscriptions/subId/resourceGroups/rg1/providers/Microsoft.Network/privateLinkServices/testPls1/ipConfigurations/ipconfig1"), - // Name: to.Ptr("ipconfig1"), - // Properties: &armnetwork.PrivateLinkServiceIPConfigurationProperties{ - // PrivateIPAddress: to.Ptr("10.0.1.4"), - // PrivateIPAddressVersion: to.Ptr(armnetwork.IPVersionIPv4), - // PrivateIPAllocationMethod: to.Ptr(armnetwork.IPAllocationMethodStatic), - // Subnet: &armnetwork.Subnet{ - // ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/virtualNetworks/vnetlb/subnets/subnetlb1"), - // }, - // }, - // }}, - // LoadBalancerFrontendIPConfigurations: []*armnetwork.FrontendIPConfiguration{ - // { - // ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/loadBalancers/lb/frontendIPConfigurations/fe-lb1"), - // }}, - // NetworkInterfaces: []*armnetwork.Interface{ - // { - // ID: to.Ptr("/subscriptions/subId/resourceGroups/rg1/provders/Microsoft.Network/networkInterfaces/testPls1.nic.abcd1234"), - // }}, - // PrivateEndpointConnections: []*armnetwork.PrivateEndpointConnection{ - // { - // ID: to.Ptr("/subscriptions/subId/resourceGroups/rg1/providers/Microsoft.Network/privateLinkServices/testPls1/privateEndpointConnections/pec1"), - // Name: to.Ptr("pec1"), - // Properties: &armnetwork.PrivateEndpointConnectionProperties{ - // PrivateEndpoint: &armnetwork.PrivateEndpoint{ - // ID: to.Ptr("/subscriptions/subId/resourceGroups/rg1/providers/Microsoft.Network/privateEndpoints/testPe1"), - // }, - // PrivateLinkServiceConnectionState: &armnetwork.PrivateLinkServiceConnectionState{ - // Description: to.Ptr("approved it for some reason."), - // Status: to.Ptr("Approved"), - // }, - // }, - // }}, - // ProvisioningState: to.Ptr(armnetwork.ProvisioningStateSucceeded), - // Visibility: &armnetwork.PrivateLinkServicePropertiesVisibility{ - // Subscriptions: []*string{ - // to.Ptr("subscription1"), - // to.Ptr("subscription2"), - // to.Ptr("subscription3")}, - // }, - // }, - // }, - // { - // Name: to.Ptr("testPls2"), - // Type: to.Ptr("Microsoft.Network/privateLinkServices"), - // ID: to.Ptr("/subscriptions/subId/resourceGroups/rg2/providers/Microsoft.Network/privateLinkServices/testPls2"), - // Location: to.Ptr("eastus"), - // Properties: &armnetwork.PrivateLinkServiceProperties{ - // Alias: to.Ptr("ContosoService.{guid}.azure.privatelinkservice"), - // AutoApproval: &armnetwork.PrivateLinkServicePropertiesAutoApproval{ - // Subscriptions: []*string{ - // to.Ptr("subscription1"), - // to.Ptr("subscription2")}, - // }, - // Fqdns: []*string{ - // to.Ptr("fqdn1"), - // to.Ptr("fqdn2")}, - // IPConfigurations: []*armnetwork.PrivateLinkServiceIPConfiguration{ - // { - // ID: to.Ptr("/subscriptions/subId/resourceGroups/rg2/providers/Microsoft.Network/privateLinkServices/testPls2/ipConfigurations/ipconfig2"), - // Name: to.Ptr("ipconfig2"), - // Properties: &armnetwork.PrivateLinkServiceIPConfigurationProperties{ - // PrivateIPAddress: to.Ptr("10.0.1.5"), - // PrivateIPAddressVersion: to.Ptr(armnetwork.IPVersionIPv4), - // PrivateIPAllocationMethod: to.Ptr(armnetwork.IPAllocationMethodStatic), - // Subnet: &armnetwork.Subnet{ - // ID: to.Ptr("/subscriptions/subid/resourceGroups/rg2/providers/Microsoft.Network/virtualNetworks/vnetlb/subnets/subnetlb2"), - // }, - // }, - // }}, - // LoadBalancerFrontendIPConfigurations: []*armnetwork.FrontendIPConfiguration{ - // { - // ID: to.Ptr("/subscriptions/subid/resourceGroups/rg2/providers/Microsoft.Network/loadBalancers/lb/frontendIPConfigurations/fe-lb2"), - // }}, - // NetworkInterfaces: []*armnetwork.Interface{ - // { - // ID: to.Ptr("/subscriptions/subId/resourceGroups/rg2/provders/Microsoft.Network/networkInterfaces/testPls2.nic.efgh5678"), - // }}, - // PrivateEndpointConnections: []*armnetwork.PrivateEndpointConnection{ - // { - // ID: to.Ptr("/subscriptions/subId/resourceGroups/rg2/providers/Microsoft.Network/privateLinkServices/testPls2/privateEndpointConnections/pec2"), - // Name: to.Ptr("pec2"), - // Properties: &armnetwork.PrivateEndpointConnectionProperties{ - // PrivateEndpoint: &armnetwork.PrivateEndpoint{ - // ID: to.Ptr("/subscriptions/subId/resourceGroups/rg2/providers/Microsoft.Network/privateEndpoints/testPe2"), - // }, - // PrivateLinkServiceConnectionState: &armnetwork.PrivateLinkServiceConnectionState{ - // Description: to.Ptr("approved it for some reason."), - // Status: to.Ptr("Approved"), - // }, - // }, - // }}, - // ProvisioningState: to.Ptr(armnetwork.ProvisioningStateSucceeded), - // Visibility: &armnetwork.PrivateLinkServicePropertiesVisibility{ - // Subscriptions: []*string{ - // to.Ptr("subscription1"), - // to.Ptr("subscription2")}, - // }, - // }, - // }}, - // } - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/4883fa5dbf6f2c9093fac8ce334547e9dfac68fa/specification/network/resource-manager/Microsoft.Network/stable/2024-03-01/examples/PrivateLinkServiceGetPrivateEndpointConnection.json -func ExamplePrivateLinkServicesClient_GetPrivateEndpointConnection() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armnetwork.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewPrivateLinkServicesClient().GetPrivateEndpointConnection(ctx, "rg1", "testPls", "testPlePeConnection", &armnetwork.PrivateLinkServicesClientGetPrivateEndpointConnectionOptions{Expand: nil}) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.PrivateEndpointConnection = armnetwork.PrivateEndpointConnection{ - // ID: to.Ptr("/subscriptions/subId/resourceGroups/rg1/providers/Microsoft.Network/privateLinkServices/testPls/privateEndpointConnections/testPlePeConnection"), - // Name: to.Ptr("testPlePeConnection"), - // Properties: &armnetwork.PrivateEndpointConnectionProperties{ - // PrivateEndpoint: &armnetwork.PrivateEndpoint{ - // ID: to.Ptr("/subscriptions/subId/resourceGroups/rg1/providers/Microsoft.Network/privateEndpoints/testPe"), - // }, - // PrivateLinkServiceConnectionState: &armnetwork.PrivateLinkServiceConnectionState{ - // Description: to.Ptr("approved it for some reason."), - // Status: to.Ptr("Approved"), - // }, - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/4883fa5dbf6f2c9093fac8ce334547e9dfac68fa/specification/network/resource-manager/Microsoft.Network/stable/2024-03-01/examples/PrivateLinkServiceUpdatePrivateEndpointConnection.json -func ExamplePrivateLinkServicesClient_UpdatePrivateEndpointConnection() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armnetwork.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewPrivateLinkServicesClient().UpdatePrivateEndpointConnection(ctx, "rg1", "testPls", "testPlePeConnection", armnetwork.PrivateEndpointConnection{ - Name: to.Ptr("testPlePeConnection"), - Properties: &armnetwork.PrivateEndpointConnectionProperties{ - PrivateEndpoint: &armnetwork.PrivateEndpoint{ - ID: to.Ptr("/subscriptions/subId/resourceGroups/rg1/providers/Microsoft.Network/privateEndpoints/testPe"), - }, - PrivateLinkServiceConnectionState: &armnetwork.PrivateLinkServiceConnectionState{ - Description: to.Ptr("approved it for some reason."), - Status: to.Ptr("Approved"), - }, - }, - }, nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.PrivateEndpointConnection = armnetwork.PrivateEndpointConnection{ - // ID: to.Ptr("/subscriptions/subId/resourceGroups/rg1/providers/Microsoft.Network/privateLinkServices/testPls/privateEndpointConnections/testPlePeConnection"), - // Name: to.Ptr("testPlePeConnection"), - // Properties: &armnetwork.PrivateEndpointConnectionProperties{ - // PrivateEndpoint: &armnetwork.PrivateEndpoint{ - // ID: to.Ptr("/subscriptions/subId/resourceGroups/rg1/providers/Microsoft.Network/privateEndpoints/testPe"), - // }, - // PrivateLinkServiceConnectionState: &armnetwork.PrivateLinkServiceConnectionState{ - // Description: to.Ptr("approved it for some reason."), - // Status: to.Ptr("Approved"), - // }, - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/4883fa5dbf6f2c9093fac8ce334547e9dfac68fa/specification/network/resource-manager/Microsoft.Network/stable/2024-03-01/examples/PrivateLinkServiceDeletePrivateEndpointConnection.json -func ExamplePrivateLinkServicesClient_BeginDeletePrivateEndpointConnection() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armnetwork.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewPrivateLinkServicesClient().BeginDeletePrivateEndpointConnection(ctx, "rg1", "testPls", "testPlePeConnection", nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - _, err = poller.PollUntilDone(ctx, nil) - if err != nil { - log.Fatalf("failed to pull the result: %v", err) - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/4883fa5dbf6f2c9093fac8ce334547e9dfac68fa/specification/network/resource-manager/Microsoft.Network/stable/2024-03-01/examples/PrivateLinkServiceListPrivateEndpointConnection.json -func ExamplePrivateLinkServicesClient_NewListPrivateEndpointConnectionsPager() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armnetwork.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := clientFactory.NewPrivateLinkServicesClient().NewListPrivateEndpointConnectionsPager("rg1", "testPls", nil) - for pager.More() { - page, err := pager.NextPage(ctx) - if err != nil { - log.Fatalf("failed to advance page: %v", err) - } - for _, v := range page.Value { - // You could use page here. We use blank identifier for just demo purposes. - _ = v - } - // If the HTTP response code is 200 as defined in example definition, your page structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // page.PrivateEndpointConnectionListResult = armnetwork.PrivateEndpointConnectionListResult{ - // Value: []*armnetwork.PrivateEndpointConnection{ - // { - // ID: to.Ptr("/subscriptions/subId/resourceGroups/rg1/providers/Microsoft.Network/privateLinkServices/testPls/privateEndpointConnections/testPlePeConnection1"), - // Name: to.Ptr("testPlePeConnection1"), - // Properties: &armnetwork.PrivateEndpointConnectionProperties{ - // PrivateEndpoint: &armnetwork.PrivateEndpoint{ - // ID: to.Ptr("/subscriptions/subId/resourceGroups/rg1/providers/Microsoft.Network/privateEndpoints/testPe1"), - // }, - // PrivateLinkServiceConnectionState: &armnetwork.PrivateLinkServiceConnectionState{ - // Description: to.Ptr("approved it for some reason."), - // Status: to.Ptr("Approved"), - // }, - // }, - // }, - // { - // ID: to.Ptr("/subscriptions/subId/resourceGroups/rg1/providers/Microsoft.Network/privateLinkServices/testPls/privateEndpointConnections/testPlePeConnection2"), - // Name: to.Ptr("testPlePeConnection2"), - // Properties: &armnetwork.PrivateEndpointConnectionProperties{ - // PrivateEndpoint: &armnetwork.PrivateEndpoint{ - // ID: to.Ptr("/subscriptions/subId/resourceGroups/rg1/providers/Microsoft.Network/privateEndpoints/testPe2"), - // }, - // PrivateLinkServiceConnectionState: &armnetwork.PrivateLinkServiceConnectionState{ - // Description: to.Ptr("rejected by some reason."), - // Status: to.Ptr("Rejected"), - // }, - // }, - // }}, - // } - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/4883fa5dbf6f2c9093fac8ce334547e9dfac68fa/specification/network/resource-manager/Microsoft.Network/stable/2024-03-01/examples/CheckPrivateLinkServiceVisibility.json -func ExamplePrivateLinkServicesClient_BeginCheckPrivateLinkServiceVisibility() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armnetwork.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewPrivateLinkServicesClient().BeginCheckPrivateLinkServiceVisibility(ctx, "westus", armnetwork.CheckPrivateLinkServiceVisibilityRequest{ - PrivateLinkServiceAlias: to.Ptr("mypls.00000000-0000-0000-0000-000000000000.azure.privatelinkservice"), - }, nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - res, err := poller.PollUntilDone(ctx, nil) - if err != nil { - log.Fatalf("failed to pull the result: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.PrivateLinkServiceVisibility = armnetwork.PrivateLinkServiceVisibility{ - // Visible: to.Ptr(true), - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/4883fa5dbf6f2c9093fac8ce334547e9dfac68fa/specification/network/resource-manager/Microsoft.Network/stable/2024-03-01/examples/CheckPrivateLinkServiceVisibilityByResourceGroup.json -func ExamplePrivateLinkServicesClient_BeginCheckPrivateLinkServiceVisibilityByResourceGroup() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armnetwork.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewPrivateLinkServicesClient().BeginCheckPrivateLinkServiceVisibilityByResourceGroup(ctx, "westus", "rg1", armnetwork.CheckPrivateLinkServiceVisibilityRequest{ - PrivateLinkServiceAlias: to.Ptr("mypls.00000000-0000-0000-0000-000000000000.azure.privatelinkservice"), - }, nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - res, err := poller.PollUntilDone(ctx, nil) - if err != nil { - log.Fatalf("failed to pull the result: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.PrivateLinkServiceVisibility = armnetwork.PrivateLinkServiceVisibility{ - // Visible: to.Ptr(true), - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/4883fa5dbf6f2c9093fac8ce334547e9dfac68fa/specification/network/resource-manager/Microsoft.Network/stable/2024-03-01/examples/AutoApprovedPrivateLinkServicesGet.json -func ExamplePrivateLinkServicesClient_NewListAutoApprovedPrivateLinkServicesPager() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armnetwork.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := clientFactory.NewPrivateLinkServicesClient().NewListAutoApprovedPrivateLinkServicesPager("regionName", nil) - for pager.More() { - page, err := pager.NextPage(ctx) - if err != nil { - log.Fatalf("failed to advance page: %v", err) - } - for _, v := range page.Value { - // You could use page here. We use blank identifier for just demo purposes. - _ = v - } - // If the HTTP response code is 200 as defined in example definition, your page structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // page.AutoApprovedPrivateLinkServicesResult = armnetwork.AutoApprovedPrivateLinkServicesResult{ - // Value: []*armnetwork.AutoApprovedPrivateLinkService{ - // { - // PrivateLinkService: to.Ptr("/subscriptions/subId/resourceGroups/rg1/providers/Microsoft.Network/privateLinkServices/testPls1"), - // }, - // { - // PrivateLinkService: to.Ptr("/subscriptions/subId/resourceGroups/rg1/providers/Microsoft.Network/privateLinkServices/testPls2"), - // }, - // { - // PrivateLinkService: to.Ptr("/subscriptions/subId/resourceGroups/rg1/providers/Microsoft.Network/privateLinkServices/testPls3"), - // }}, - // } - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/4883fa5dbf6f2c9093fac8ce334547e9dfac68fa/specification/network/resource-manager/Microsoft.Network/stable/2024-03-01/examples/AutoApprovedPrivateLinkServicesResourceGroupGet.json -func ExamplePrivateLinkServicesClient_NewListAutoApprovedPrivateLinkServicesByResourceGroupPager() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armnetwork.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := clientFactory.NewPrivateLinkServicesClient().NewListAutoApprovedPrivateLinkServicesByResourceGroupPager("regionName", "rg1", nil) - for pager.More() { - page, err := pager.NextPage(ctx) - if err != nil { - log.Fatalf("failed to advance page: %v", err) - } - for _, v := range page.Value { - // You could use page here. We use blank identifier for just demo purposes. - _ = v - } - // If the HTTP response code is 200 as defined in example definition, your page structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // page.AutoApprovedPrivateLinkServicesResult = armnetwork.AutoApprovedPrivateLinkServicesResult{ - // Value: []*armnetwork.AutoApprovedPrivateLinkService{ - // { - // PrivateLinkService: to.Ptr("/subscriptions/subId/resourceGroups/rg1/providers/Microsoft.Network/privateLinkServices/testPls1"), - // }, - // { - // PrivateLinkService: to.Ptr("/subscriptions/subId/resourceGroups/rg1/providers/Microsoft.Network/privateLinkServices/testPls2"), - // }, - // { - // PrivateLinkService: to.Ptr("/subscriptions/subId/resourceGroups/rg1/providers/Microsoft.Network/privateLinkServices/testPls3"), - // }}, - // } - } -} diff --git a/sdk/resourcemanager/network/armnetwork/profiles_client_example_test.go b/sdk/resourcemanager/network/armnetwork/profiles_client_example_test.go deleted file mode 100644 index f4b3e7c90555..000000000000 --- a/sdk/resourcemanager/network/armnetwork/profiles_client_example_test.go +++ /dev/null @@ -1,684 +0,0 @@ -//go:build go1.18 -// +build go1.18 - -// 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. -// DO NOT EDIT. - -package armnetwork_test - -import ( - "context" - "log" - - "github.com/Azure/azure-sdk-for-go/sdk/azcore/to" - "github.com/Azure/azure-sdk-for-go/sdk/azidentity" - "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/network/armnetwork/v6" -) - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/4883fa5dbf6f2c9093fac8ce334547e9dfac68fa/specification/network/resource-manager/Microsoft.Network/stable/2024-03-01/examples/NetworkProfileDelete.json -func ExampleProfilesClient_BeginDelete() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armnetwork.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewProfilesClient().BeginDelete(ctx, "rg1", "networkProfile1", nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - _, err = poller.PollUntilDone(ctx, nil) - if err != nil { - log.Fatalf("failed to pull the result: %v", err) - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/4883fa5dbf6f2c9093fac8ce334547e9dfac68fa/specification/network/resource-manager/Microsoft.Network/stable/2024-03-01/examples/NetworkProfileGetConfigOnly.json -func ExampleProfilesClient_Get_getNetworkProfile() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armnetwork.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewProfilesClient().Get(ctx, "rg1", "networkProfile1", &armnetwork.ProfilesClientGetOptions{Expand: nil}) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.Profile = armnetwork.Profile{ - // Name: to.Ptr("networkProfile1"), - // Type: to.Ptr("Microsoft.Network/networkProfiles"), - // ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/networkProfiles/networkProfile1"), - // Location: to.Ptr("centraluseuap"), - // Etag: to.Ptr("W/\"4d705a71-752f-4e0a-8057-c02b125b1c08\""), - // Properties: &armnetwork.ProfilePropertiesFormat{ - // ContainerNetworkInterfaceConfigurations: []*armnetwork.ContainerNetworkInterfaceConfiguration{ - // { - // ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/networkProfiles/networkProfile1/containerNetworkInterfaceConfigurations/eth0"), - // Name: to.Ptr("eth0"), - // Type: to.Ptr("Microsoft.Network/networkProfiles/containerNetworkInterfaceConfigurations"), - // Etag: to.Ptr("W/\"4d705a71-752f-4e0a-8057-c02b125b1c08\""), - // Properties: &armnetwork.ContainerNetworkInterfaceConfigurationPropertiesFormat{ - // IPConfigurations: []*armnetwork.IPConfigurationProfile{ - // { - // ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/networkProfiles/networkProfile1/containerNetworkInterfaceConfigurations/eth0/ipConfigurations/ipconfigprofile1"), - // Name: to.Ptr("ipconfigprofile1"), - // Type: to.Ptr("Microsoft.Network/networkProfiles/containerNetworkInterfaceConfigurations/ipConfigurations"), - // Etag: to.Ptr("W/\"4d705a71-752f-4e0a-8057-c02b125b1c08\""), - // Properties: &armnetwork.IPConfigurationProfilePropertiesFormat{ - // ProvisioningState: to.Ptr(armnetwork.ProvisioningStateSucceeded), - // Subnet: &armnetwork.Subnet{ - // ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/virtualNetworks/networkProfileVnet/subnets/networkProfileSubnet1"), - // }, - // }, - // }, - // { - // ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/networkProfiles/networkProfile1/containerNetworkInterfaceConfigurations/eth0/ipConfigurations/ipconfigprofile2"), - // Name: to.Ptr("ipconfigprofile2"), - // Type: to.Ptr("Microsoft.Network/networkProfiles/containerNetworkInterfaceConfigurations/ipConfigurations"), - // Etag: to.Ptr("W/\"4d705a71-752f-4e0a-8057-c02b125b1c08\""), - // Properties: &armnetwork.IPConfigurationProfilePropertiesFormat{ - // ProvisioningState: to.Ptr(armnetwork.ProvisioningStateSucceeded), - // Subnet: &armnetwork.Subnet{ - // ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/virtualNetworks/networkProfileVnet/subnets/networkProfileSubnet1"), - // }, - // }, - // }}, - // ProvisioningState: to.Ptr(armnetwork.ProvisioningStateSucceeded), - // }, - // }, - // { - // ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/networkProfiles/networkProfile1/containerNetworkInterfaceConfigurations/eth1"), - // Name: to.Ptr("eth1"), - // Type: to.Ptr("Microsoft.Network/networkProfiles/containerNetworkInterfaceConfigurations"), - // Etag: to.Ptr("W/\"4d705a71-752f-4e0a-8057-c02b125b1c08\""), - // Properties: &armnetwork.ContainerNetworkInterfaceConfigurationPropertiesFormat{ - // IPConfigurations: []*armnetwork.IPConfigurationProfile{ - // { - // ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/networkProfiles/networkProfile1/containerNetworkInterfaceConfigurations/eth1/ipConfigurations/ipconfigprofile3"), - // Name: to.Ptr("ipconfigprofile3"), - // Type: to.Ptr("Microsoft.Network/networkProfiles/containerNetworkInterfaceConfigurations/ipConfigurations"), - // Etag: to.Ptr("W/\"4d705a71-752f-4e0a-8057-c02b125b1c08\""), - // Properties: &armnetwork.IPConfigurationProfilePropertiesFormat{ - // ProvisioningState: to.Ptr(armnetwork.ProvisioningStateSucceeded), - // Subnet: &armnetwork.Subnet{ - // ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/virtualNetworks/networkProfileVnet/subnets/networkProfileSubnet1"), - // }, - // }, - // }}, - // ProvisioningState: to.Ptr(armnetwork.ProvisioningStateSucceeded), - // }, - // }}, - // ContainerNetworkInterfaces: []*armnetwork.ContainerNetworkInterface{ - // }, - // ProvisioningState: to.Ptr(armnetwork.ProvisioningStateSucceeded), - // ResourceGUID: to.Ptr("1570d8b6-ab8a-4ad2-81d6-d2799b429cbf"), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/4883fa5dbf6f2c9093fac8ce334547e9dfac68fa/specification/network/resource-manager/Microsoft.Network/stable/2024-03-01/examples/NetworkProfileGetWithContainerNic.json -func ExampleProfilesClient_Get_getNetworkProfileWithContainerNetworkInterfaces() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armnetwork.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewProfilesClient().Get(ctx, "rg1", "networkProfile1", &armnetwork.ProfilesClientGetOptions{Expand: nil}) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.Profile = armnetwork.Profile{ - // Name: to.Ptr("networkProfile1"), - // Type: to.Ptr("Microsoft.Network/networkProfiles"), - // ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/networkProfiles/networkProfile1"), - // Location: to.Ptr("centraluseuap"), - // Etag: to.Ptr("W/\"de9b89d2-83b0-4da3-b488-6ea8b0557edd\""), - // Properties: &armnetwork.ProfilePropertiesFormat{ - // ContainerNetworkInterfaceConfigurations: []*armnetwork.ContainerNetworkInterfaceConfiguration{ - // { - // ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/networkProfiles/networkProfile1/containerNetworkInterfaceConfigurations/eth0"), - // Name: to.Ptr("eth0"), - // Type: to.Ptr("Microsoft.Network/networkProfiles/containerNetworkInterfaceConfigurations"), - // Etag: to.Ptr("W/\"de9b89d2-83b0-4da3-b488-6ea8b0557edd\""), - // Properties: &armnetwork.ContainerNetworkInterfaceConfigurationPropertiesFormat{ - // ContainerNetworkInterfaces: []*armnetwork.SubResource{ - // { - // ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/networkProfiles/networkProfile1/containerNetworkInterfaces/containerGroup1_eth0"), - // }, - // { - // ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/networkProfiles/networkProfile1/containerNetworkInterfaces/containerGroup2_eth0"), - // }, - // { - // ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/networkProfiles/networkProfile1/containerNetworkInterfaces/containerGroup3_eth0"), - // }}, - // IPConfigurations: []*armnetwork.IPConfigurationProfile{ - // { - // ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/networkProfiles/networkProfile1/containerNetworkInterfaceConfigurations/eth0/ipConfigurations/ipconfigprofile1"), - // Name: to.Ptr("ipconfigprofile1"), - // Type: to.Ptr("Microsoft.Network/networkProfiles/containerNetworkInterfaceConfigurations/ipConfigurations"), - // Etag: to.Ptr("W/\"de9b89d2-83b0-4da3-b488-6ea8b0557edd\""), - // Properties: &armnetwork.IPConfigurationProfilePropertiesFormat{ - // ProvisioningState: to.Ptr(armnetwork.ProvisioningStateSucceeded), - // Subnet: &armnetwork.Subnet{ - // ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/virtualNetworks/networkProfileVnet/subnets/networkProfileSubnet1"), - // }, - // }, - // }, - // { - // ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/networkProfiles/networkProfile1/containerNetworkInterfaceConfigurations/eth0/ipConfigurations/ipconfigprofile2"), - // Name: to.Ptr("ipconfigprofile2"), - // Type: to.Ptr("Microsoft.Network/networkProfiles/containerNetworkInterfaceConfigurations/ipConfigurations"), - // Etag: to.Ptr("W/\"de9b89d2-83b0-4da3-b488-6ea8b0557edd\""), - // Properties: &armnetwork.IPConfigurationProfilePropertiesFormat{ - // ProvisioningState: to.Ptr(armnetwork.ProvisioningStateSucceeded), - // Subnet: &armnetwork.Subnet{ - // ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/virtualNetworks/networkProfileVnet/subnets/networkProfileSubnet1"), - // }, - // }, - // }}, - // ProvisioningState: to.Ptr(armnetwork.ProvisioningStateSucceeded), - // }, - // }, - // { - // ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/networkProfiles/networkProfile1/containerNetworkInterfaceConfigurations/eth1"), - // Name: to.Ptr("eth1"), - // Type: to.Ptr("Microsoft.Network/networkProfiles/containerNetworkInterfaceConfigurations"), - // Etag: to.Ptr("W/\"de9b89d2-83b0-4da3-b488-6ea8b0557edd\""), - // Properties: &armnetwork.ContainerNetworkInterfaceConfigurationPropertiesFormat{ - // ContainerNetworkInterfaces: []*armnetwork.SubResource{ - // { - // ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/networkProfiles/networkProfile1/containerNetworkInterfaces/containerGroup1_eth1"), - // }, - // { - // ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/networkProfiles/networkProfile1/containerNetworkInterfaces/containerGroup2_eth1"), - // }, - // { - // ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/networkProfiles/networkProfile1/containerNetworkInterfaces/containerGroup3_eth1"), - // }}, - // IPConfigurations: []*armnetwork.IPConfigurationProfile{ - // { - // ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/networkProfiles/networkProfile1/containerNetworkInterfaceConfigurations/eth1/ipConfigurations/ipconfigprofile3"), - // Name: to.Ptr("ipconfigprofile3"), - // Type: to.Ptr("Microsoft.Network/networkProfiles/containerNetworkInterfaceConfigurations/ipConfigurations"), - // Etag: to.Ptr("W/\"de9b89d2-83b0-4da3-b488-6ea8b0557edd\""), - // Properties: &armnetwork.IPConfigurationProfilePropertiesFormat{ - // ProvisioningState: to.Ptr(armnetwork.ProvisioningStateSucceeded), - // Subnet: &armnetwork.Subnet{ - // ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/virtualNetworks/networkProfileVnet/subnets/networkProfileSubnet1"), - // }, - // }, - // }}, - // ProvisioningState: to.Ptr(armnetwork.ProvisioningStateSucceeded), - // }, - // }}, - // ContainerNetworkInterfaces: []*armnetwork.ContainerNetworkInterface{ - // { - // ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/networkProfiles/networkProfile1/containerNetworkInterfaces/containerGroup1_eth0"), - // Name: to.Ptr("containerGroup1_eth0"), - // Type: to.Ptr("Microsoft.Network/networkProfiles/containerNetworkInterfaces"), - // Etag: to.Ptr("W/\"de9b89d2-83b0-4da3-b488-6ea8b0557edd\""), - // Properties: &armnetwork.ContainerNetworkInterfacePropertiesFormat{ - // Container: &armnetwork.Container{ - // ID: to.Ptr("/subscriptions/subid/resourceGroups/networkProfilesDemo/providers/Microsoft.ContainerInstance/containerGroups/containerGroup1"), - // }, - // ContainerNetworkInterfaceConfiguration: &armnetwork.ContainerNetworkInterfaceConfiguration{ - // ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/networkProfiles/networkProfile1/containerNetworkInterfaceConfigurations/eth0"), - // }, - // IPConfigurations: []*armnetwork.ContainerNetworkInterfaceIPConfiguration{ - // }, - // ProvisioningState: to.Ptr(armnetwork.ProvisioningStateSucceeded), - // }, - // }, - // { - // ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/networkProfiles/networkProfile1/containerNetworkInterfaces/containerGroup1_eth1"), - // Name: to.Ptr("containerGroup1_eth1"), - // Type: to.Ptr("Microsoft.Network/networkProfiles/containerNetworkInterfaces"), - // Etag: to.Ptr("W/\"de9b89d2-83b0-4da3-b488-6ea8b0557edd\""), - // Properties: &armnetwork.ContainerNetworkInterfacePropertiesFormat{ - // Container: &armnetwork.Container{ - // ID: to.Ptr("/subscriptions/subid/resourceGroups/networkProfilesDemo/providers/Microsoft.ContainerInstance/containerGroups/containerGroup1"), - // }, - // ContainerNetworkInterfaceConfiguration: &armnetwork.ContainerNetworkInterfaceConfiguration{ - // ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/networkProfiles/networkProfile1/containerNetworkInterfaceConfigurations/eth1"), - // }, - // IPConfigurations: []*armnetwork.ContainerNetworkInterfaceIPConfiguration{ - // }, - // ProvisioningState: to.Ptr(armnetwork.ProvisioningStateSucceeded), - // }, - // }, - // { - // ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/networkProfiles/networkProfile1/containerNetworkInterfaces/containerGroup2_eth0"), - // Name: to.Ptr("containerGroup2_eth0"), - // Type: to.Ptr("Microsoft.Network/networkProfiles/containerNetworkInterfaces"), - // Etag: to.Ptr("W/\"de9b89d2-83b0-4da3-b488-6ea8b0557edd\""), - // Properties: &armnetwork.ContainerNetworkInterfacePropertiesFormat{ - // Container: &armnetwork.Container{ - // ID: to.Ptr("/subscriptions/subid/resourceGroups/networkProfilesDemo/providers/Microsoft.ContainerInstance/containerGroups/containerGroup2"), - // }, - // ContainerNetworkInterfaceConfiguration: &armnetwork.ContainerNetworkInterfaceConfiguration{ - // ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/networkProfiles/networkProfile1/containerNetworkInterfaceConfigurations/eth0"), - // }, - // IPConfigurations: []*armnetwork.ContainerNetworkInterfaceIPConfiguration{ - // }, - // ProvisioningState: to.Ptr(armnetwork.ProvisioningStateSucceeded), - // }, - // }, - // { - // ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/networkProfiles/networkProfile1/containerNetworkInterfaces/containerGroup2_eth1"), - // Name: to.Ptr("containerGroup2_eth1"), - // Type: to.Ptr("Microsoft.Network/networkProfiles/containerNetworkInterfaces"), - // Etag: to.Ptr("W/\"de9b89d2-83b0-4da3-b488-6ea8b0557edd\""), - // Properties: &armnetwork.ContainerNetworkInterfacePropertiesFormat{ - // Container: &armnetwork.Container{ - // ID: to.Ptr("/subscriptions/subid/resourceGroups/networkProfilesDemo/providers/Microsoft.ContainerInstance/containerGroups/containerGroup2"), - // }, - // ContainerNetworkInterfaceConfiguration: &armnetwork.ContainerNetworkInterfaceConfiguration{ - // ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/networkProfiles/networkProfile1/containerNetworkInterfaceConfigurations/eth1"), - // }, - // IPConfigurations: []*armnetwork.ContainerNetworkInterfaceIPConfiguration{ - // }, - // ProvisioningState: to.Ptr(armnetwork.ProvisioningStateSucceeded), - // }, - // }, - // { - // ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/networkProfiles/networkProfile1/containerNetworkInterfaces/containerGroup3_eth0"), - // Name: to.Ptr("containerGroup3_eth0"), - // Type: to.Ptr("Microsoft.Network/networkProfiles/containerNetworkInterfaces"), - // Etag: to.Ptr("W/\"de9b89d2-83b0-4da3-b488-6ea8b0557edd\""), - // Properties: &armnetwork.ContainerNetworkInterfacePropertiesFormat{ - // Container: &armnetwork.Container{ - // ID: to.Ptr("/subscriptions/subid/resourceGroups/networkProfilesDemo/providers/Microsoft.ContainerInstance/containerGroups/containerGroup3"), - // }, - // ContainerNetworkInterfaceConfiguration: &armnetwork.ContainerNetworkInterfaceConfiguration{ - // ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/networkProfiles/networkProfile1/containerNetworkInterfaceConfigurations/eth0"), - // }, - // IPConfigurations: []*armnetwork.ContainerNetworkInterfaceIPConfiguration{ - // }, - // ProvisioningState: to.Ptr(armnetwork.ProvisioningStateSucceeded), - // }, - // }, - // { - // ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/networkProfiles/networkProfile1/containerNetworkInterfaces/containerGroup3_eth1"), - // Name: to.Ptr("containerGroup3_eth1"), - // Type: to.Ptr("Microsoft.Network/networkProfiles/containerNetworkInterfaces"), - // Etag: to.Ptr("W/\"de9b89d2-83b0-4da3-b488-6ea8b0557edd\""), - // Properties: &armnetwork.ContainerNetworkInterfacePropertiesFormat{ - // Container: &armnetwork.Container{ - // ID: to.Ptr("/subscriptions/subid/resourceGroups/networkProfilesDemo/providers/Microsoft.ContainerInstance/containerGroups/containerGroup3"), - // }, - // ContainerNetworkInterfaceConfiguration: &armnetwork.ContainerNetworkInterfaceConfiguration{ - // ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/networkProfiles/networkProfile1/containerNetworkInterfaceConfigurations/eth1"), - // }, - // IPConfigurations: []*armnetwork.ContainerNetworkInterfaceIPConfiguration{ - // }, - // ProvisioningState: to.Ptr(armnetwork.ProvisioningStateSucceeded), - // }, - // }}, - // ProvisioningState: to.Ptr(armnetwork.ProvisioningStateSucceeded), - // ResourceGUID: to.Ptr("1570d8b6-ab8a-4ad2-81d6-d2799b429cbf"), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/4883fa5dbf6f2c9093fac8ce334547e9dfac68fa/specification/network/resource-manager/Microsoft.Network/stable/2024-03-01/examples/NetworkProfileCreateConfigOnly.json -func ExampleProfilesClient_CreateOrUpdate() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armnetwork.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewProfilesClient().CreateOrUpdate(ctx, "rg1", "networkProfile1", armnetwork.Profile{ - Location: to.Ptr("westus"), - Properties: &armnetwork.ProfilePropertiesFormat{ - ContainerNetworkInterfaceConfigurations: []*armnetwork.ContainerNetworkInterfaceConfiguration{ - { - Name: to.Ptr("eth1"), - Properties: &armnetwork.ContainerNetworkInterfaceConfigurationPropertiesFormat{ - IPConfigurations: []*armnetwork.IPConfigurationProfile{ - { - Name: to.Ptr("ipconfig1"), - Properties: &armnetwork.IPConfigurationProfilePropertiesFormat{ - Subnet: &armnetwork.Subnet{ - ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/virtualNetworks/networkProfileVnet/subnets/networkProfileSubnet1"), - }, - }, - }}, - }, - }}, - }, - }, nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.Profile = armnetwork.Profile{ - // Name: to.Ptr("networkProfile1"), - // Type: to.Ptr("Microsoft.Network/networkProfiles"), - // ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/networkProfiles/networkProfile1"), - // Location: to.Ptr("westus"), - // Etag: to.Ptr("W/\"4d705a71-752f-4e0a-8057-c02b125b1c08\""), - // Properties: &armnetwork.ProfilePropertiesFormat{ - // ContainerNetworkInterfaceConfigurations: []*armnetwork.ContainerNetworkInterfaceConfiguration{ - // { - // ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/networkProfiles/networkProfile1/containerNetworkInterfaceConfigurations/eth1"), - // Name: to.Ptr("eth1"), - // Type: to.Ptr("Microsoft.Network/networkProfiles/containerNetworkInterfaceConfigurations"), - // Etag: to.Ptr("W/\"4d705a71-752f-4e0a-8057-c02b125b1c08\""), - // Properties: &armnetwork.ContainerNetworkInterfaceConfigurationPropertiesFormat{ - // IPConfigurations: []*armnetwork.IPConfigurationProfile{ - // { - // ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/networkProfiles/networkProfile1/containerNetworkInterfaceConfigurations/eth1/ipConfigurations/ipconfig1"), - // Name: to.Ptr("ipconfig1"), - // Type: to.Ptr("Microsoft.Network/networkProfiles/containerNetworkInterfaceConfigurations/ipConfigurations"), - // Etag: to.Ptr("W/\"4d705a71-752f-4e0a-8057-c02b125b1c08\""), - // Properties: &armnetwork.IPConfigurationProfilePropertiesFormat{ - // ProvisioningState: to.Ptr(armnetwork.ProvisioningStateSucceeded), - // Subnet: &armnetwork.Subnet{ - // ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/virtualNetworks/networkProfileVnet/subnets/networkProfileSubnet1"), - // }, - // }, - // }}, - // ProvisioningState: to.Ptr(armnetwork.ProvisioningStateSucceeded), - // }, - // }}, - // ContainerNetworkInterfaces: []*armnetwork.ContainerNetworkInterface{ - // }, - // ProvisioningState: to.Ptr(armnetwork.ProvisioningStateSucceeded), - // ResourceGUID: to.Ptr("1570d8b6-ab8a-4ad2-81d6-d2799b429cbf"), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/4883fa5dbf6f2c9093fac8ce334547e9dfac68fa/specification/network/resource-manager/Microsoft.Network/stable/2024-03-01/examples/NetworkProfileUpdateTags.json -func ExampleProfilesClient_UpdateTags() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armnetwork.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewProfilesClient().UpdateTags(ctx, "rg1", "test-np", armnetwork.TagsObject{ - Tags: map[string]*string{ - "tag1": to.Ptr("value1"), - "tag2": to.Ptr("value2"), - }, - }, nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.Profile = armnetwork.Profile{ - // Name: to.Ptr("test-np"), - // Type: to.Ptr("Microsoft.Network/networkProfiles"), - // ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/networkInterfaces/test-np"), - // Location: to.Ptr("centraluseuap"), - // Tags: map[string]*string{ - // "tag1": to.Ptr("value1"), - // "tag2": to.Ptr("value2"), - // }, - // Properties: &armnetwork.ProfilePropertiesFormat{ - // ContainerNetworkInterfaceConfigurations: []*armnetwork.ContainerNetworkInterfaceConfiguration{ - // { - // ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/networkProfiles/networkProfile1/containerNetworkInterfaceConfigurations/eth0"), - // Name: to.Ptr("eth0"), - // Type: to.Ptr("Microsoft.Network/networkProfiles/containerNetworkInterfaceConfigurations"), - // Etag: to.Ptr("W/\"4d705a71-752f-4e0a-8057-c02b125b1c08\""), - // Properties: &armnetwork.ContainerNetworkInterfaceConfigurationPropertiesFormat{ - // IPConfigurations: []*armnetwork.IPConfigurationProfile{ - // { - // ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/networkProfiles/networkProfile1/containerNetworkInterfaceConfigurations/eth0/ipConfigurations/ipconfigprofile1"), - // Name: to.Ptr("ipconfigprofile1"), - // Type: to.Ptr("Microsoft.Network/networkProfiles/containerNetworkInterfaceConfigurations/ipConfigurations"), - // Etag: to.Ptr("W/\"4d705a71-752f-4e0a-8057-c02b125b1c08\""), - // Properties: &armnetwork.IPConfigurationProfilePropertiesFormat{ - // ProvisioningState: to.Ptr(armnetwork.ProvisioningStateSucceeded), - // Subnet: &armnetwork.Subnet{ - // ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/virtualNetworks/networkProfileVnet/subnets/networkProfileSubnet1"), - // }, - // }, - // }}, - // ProvisioningState: to.Ptr(armnetwork.ProvisioningStateSucceeded), - // }, - // }}, - // ContainerNetworkInterfaces: []*armnetwork.ContainerNetworkInterface{ - // }, - // ProvisioningState: to.Ptr(armnetwork.ProvisioningStateSucceeded), - // ResourceGUID: to.Ptr("1570d8b6-ab8a-4ad2-81d6-d2799b429cbf"), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/4883fa5dbf6f2c9093fac8ce334547e9dfac68fa/specification/network/resource-manager/Microsoft.Network/stable/2024-03-01/examples/NetworkProfileListAll.json -func ExampleProfilesClient_NewListAllPager() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armnetwork.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := clientFactory.NewProfilesClient().NewListAllPager(nil) - for pager.More() { - page, err := pager.NextPage(ctx) - if err != nil { - log.Fatalf("failed to advance page: %v", err) - } - for _, v := range page.Value { - // You could use page here. We use blank identifier for just demo purposes. - _ = v - } - // If the HTTP response code is 200 as defined in example definition, your page structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // page.ProfileListResult = armnetwork.ProfileListResult{ - // Value: []*armnetwork.Profile{ - // { - // Name: to.Ptr("networkProfile1"), - // Type: to.Ptr("Microsoft.Network/networkProfiles"), - // ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/networkProfiles/networkProfile1"), - // Location: to.Ptr("centraluseuap"), - // Properties: &armnetwork.ProfilePropertiesFormat{ - // ContainerNetworkInterfaceConfigurations: []*armnetwork.ContainerNetworkInterfaceConfiguration{ - // { - // ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/networkProfiles/networkProfile1/containerNetworkInterfaceConfigurations/eth0"), - // Name: to.Ptr("eth0"), - // Type: to.Ptr("Microsoft.Network/networkProfiles/containerNetworkInterfaceConfigurations"), - // Etag: to.Ptr("W/\"4d705a71-752f-4e0a-8057-c02b125b1c08\""), - // Properties: &armnetwork.ContainerNetworkInterfaceConfigurationPropertiesFormat{ - // IPConfigurations: []*armnetwork.IPConfigurationProfile{ - // { - // ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/networkProfiles/networkProfile1/containerNetworkInterfaceConfigurations/eth0/ipConfigurations/ipconfigprofile1"), - // Name: to.Ptr("ipconfigprofile1"), - // Type: to.Ptr("Microsoft.Network/networkProfiles/containerNetworkInterfaceConfigurations/ipConfigurations"), - // Etag: to.Ptr("W/\"4d705a71-752f-4e0a-8057-c02b125b1c08\""), - // Properties: &armnetwork.IPConfigurationProfilePropertiesFormat{ - // ProvisioningState: to.Ptr(armnetwork.ProvisioningStateSucceeded), - // Subnet: &armnetwork.Subnet{ - // ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/virtualNetworks/networkProfileVnet/subnets/networkProfileSubnet1"), - // }, - // }, - // }}, - // ProvisioningState: to.Ptr(armnetwork.ProvisioningStateSucceeded), - // }, - // }}, - // ContainerNetworkInterfaces: []*armnetwork.ContainerNetworkInterface{ - // }, - // ProvisioningState: to.Ptr(armnetwork.ProvisioningStateSucceeded), - // ResourceGUID: to.Ptr("1570d8b6-ab8a-4ad2-81d6-d2799b429cbf"), - // }, - // }, - // { - // Name: to.Ptr("networkProfile2"), - // Type: to.Ptr("Microsoft.Network/networkProfiles"), - // ID: to.Ptr("/subscriptions/subid/resourceGroups/rg2/providers/Microsoft.Network/networkProfiles/networkProfile2"), - // Location: to.Ptr("centraluseuap"), - // Properties: &armnetwork.ProfilePropertiesFormat{ - // ContainerNetworkInterfaceConfigurations: []*armnetwork.ContainerNetworkInterfaceConfiguration{ - // { - // ID: to.Ptr("/subscriptions/subid/resourceGroups/rg2/providers/Microsoft.Network/networkProfiles/networkProfile1/containerNetworkInterfaceConfigurations/eth1"), - // Name: to.Ptr("eth1"), - // Type: to.Ptr("Microsoft.Network/networkProfiles/containerNetworkInterfaceConfigurations"), - // Etag: to.Ptr("W/\"4d705a71-752f-4e0a-8057-c02b125b1c08\""), - // Properties: &armnetwork.ContainerNetworkInterfaceConfigurationPropertiesFormat{ - // IPConfigurations: []*armnetwork.IPConfigurationProfile{ - // { - // ID: to.Ptr("/subscriptions/subid/resourceGroups/rg2/providers/Microsoft.Network/networkProfiles/networkProfile1/containerNetworkInterfaceConfigurations/eth1/ipConfigurations/ipconfigprofile3"), - // Name: to.Ptr("ipconfigprofile3"), - // Type: to.Ptr("Microsoft.Network/networkProfiles/containerNetworkInterfaceConfigurations/ipConfigurations"), - // Etag: to.Ptr("W/\"4d705a71-752f-4e0a-8057-c02b125b1c08\""), - // Properties: &armnetwork.IPConfigurationProfilePropertiesFormat{ - // ProvisioningState: to.Ptr(armnetwork.ProvisioningStateSucceeded), - // Subnet: &armnetwork.Subnet{ - // ID: to.Ptr("/subscriptions/subid/resourceGroups/rg2/providers/Microsoft.Network/virtualNetworks/networkProfileVnet/subnets/networkProfileSubnet1"), - // }, - // }, - // }}, - // ProvisioningState: to.Ptr(armnetwork.ProvisioningStateSucceeded), - // }, - // }}, - // ContainerNetworkInterfaces: []*armnetwork.ContainerNetworkInterface{ - // }, - // }, - // }}, - // } - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/4883fa5dbf6f2c9093fac8ce334547e9dfac68fa/specification/network/resource-manager/Microsoft.Network/stable/2024-03-01/examples/NetworkProfileList.json -func ExampleProfilesClient_NewListPager() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armnetwork.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := clientFactory.NewProfilesClient().NewListPager("rg1", nil) - for pager.More() { - page, err := pager.NextPage(ctx) - if err != nil { - log.Fatalf("failed to advance page: %v", err) - } - for _, v := range page.Value { - // You could use page here. We use blank identifier for just demo purposes. - _ = v - } - // If the HTTP response code is 200 as defined in example definition, your page structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // page.ProfileListResult = armnetwork.ProfileListResult{ - // Value: []*armnetwork.Profile{ - // { - // Name: to.Ptr("networkProfile1"), - // Type: to.Ptr("Microsoft.Network/networkProfiles"), - // ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/networkProfiles/networkProfile1"), - // Location: to.Ptr("centraluseuap"), - // Properties: &armnetwork.ProfilePropertiesFormat{ - // ContainerNetworkInterfaceConfigurations: []*armnetwork.ContainerNetworkInterfaceConfiguration{ - // { - // ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/networkProfiles/networkProfile1/containerNetworkInterfaceConfigurations/eth0"), - // Name: to.Ptr("eth0"), - // Type: to.Ptr("Microsoft.Network/networkProfiles/containerNetworkInterfaceConfigurations"), - // Etag: to.Ptr("W/\"4d705a71-752f-4e0a-8057-c02b125b1c08\""), - // Properties: &armnetwork.ContainerNetworkInterfaceConfigurationPropertiesFormat{ - // IPConfigurations: []*armnetwork.IPConfigurationProfile{ - // { - // ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/networkProfiles/networkProfile1/containerNetworkInterfaceConfigurations/eth0/ipConfigurations/ipconfigprofile1"), - // Name: to.Ptr("ipconfigprofile1"), - // Type: to.Ptr("Microsoft.Network/networkProfiles/containerNetworkInterfaceConfigurations/ipConfigurations"), - // Etag: to.Ptr("W/\"4d705a71-752f-4e0a-8057-c02b125b1c08\""), - // Properties: &armnetwork.IPConfigurationProfilePropertiesFormat{ - // ProvisioningState: to.Ptr(armnetwork.ProvisioningStateSucceeded), - // Subnet: &armnetwork.Subnet{ - // ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/virtualNetworks/networkProfileVnet/subnets/networkProfileSubnet1"), - // }, - // }, - // }, - // { - // ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/networkProfiles/networkProfile1/containerNetworkInterfaceConfigurations/eth0/ipConfigurations/ipconfigprofile2"), - // Name: to.Ptr("ipconfigprofile2"), - // Type: to.Ptr("Microsoft.Network/networkProfiles/containerNetworkInterfaceConfigurations/ipConfigurations"), - // Etag: to.Ptr("W/\"4d705a71-752f-4e0a-8057-c02b125b1c08\""), - // Properties: &armnetwork.IPConfigurationProfilePropertiesFormat{ - // ProvisioningState: to.Ptr(armnetwork.ProvisioningStateSucceeded), - // Subnet: &armnetwork.Subnet{ - // ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/virtualNetworks/networkProfileVnet/subnets/networkProfileSubnet1"), - // }, - // }, - // }}, - // ProvisioningState: to.Ptr(armnetwork.ProvisioningStateSucceeded), - // }, - // }}, - // ContainerNetworkInterfaces: []*armnetwork.ContainerNetworkInterface{ - // }, - // ProvisioningState: to.Ptr(armnetwork.ProvisioningStateSucceeded), - // ResourceGUID: to.Ptr("1570d8b6-ab8a-4ad2-81d6-d2799b429cbf"), - // }, - // }, - // { - // Name: to.Ptr("networkProfile2"), - // Type: to.Ptr("Microsoft.Network/networkProfiles"), - // ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/networkProfiles/networkProfile2"), - // Location: to.Ptr("centraluseuap"), - // Properties: &armnetwork.ProfilePropertiesFormat{ - // ContainerNetworkInterfaceConfigurations: []*armnetwork.ContainerNetworkInterfaceConfiguration{ - // { - // ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/networkProfiles/networkProfile1/containerNetworkInterfaceConfigurations/eth1"), - // Name: to.Ptr("eth1"), - // Type: to.Ptr("Microsoft.Network/networkProfiles/containerNetworkInterfaceConfigurations"), - // Etag: to.Ptr("W/\"4d705a71-752f-4e0a-8057-c02b125b1c08\""), - // Properties: &armnetwork.ContainerNetworkInterfaceConfigurationPropertiesFormat{ - // IPConfigurations: []*armnetwork.IPConfigurationProfile{ - // { - // ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/networkProfiles/networkProfile1/containerNetworkInterfaceConfigurations/eth1/ipConfigurations/ipconfigprofile3"), - // Name: to.Ptr("ipconfigprofile3"), - // Type: to.Ptr("Microsoft.Network/networkProfiles/containerNetworkInterfaceConfigurations/ipConfigurations"), - // Etag: to.Ptr("W/\"4d705a71-752f-4e0a-8057-c02b125b1c08\""), - // Properties: &armnetwork.IPConfigurationProfilePropertiesFormat{ - // ProvisioningState: to.Ptr(armnetwork.ProvisioningStateSucceeded), - // Subnet: &armnetwork.Subnet{ - // ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/virtualNetworks/networkProfileVnet/subnets/networkProfileSubnet1"), - // }, - // }, - // }}, - // ProvisioningState: to.Ptr(armnetwork.ProvisioningStateSucceeded), - // }, - // }}, - // ContainerNetworkInterfaces: []*armnetwork.ContainerNetworkInterface{ - // }, - // }, - // }}, - // } - } -} diff --git a/sdk/resourcemanager/network/armnetwork/publicipaddresses_client_example_test.go b/sdk/resourcemanager/network/armnetwork/publicipaddresses_client_example_test.go deleted file mode 100644 index 579ad00e9f84..000000000000 --- a/sdk/resourcemanager/network/armnetwork/publicipaddresses_client_example_test.go +++ /dev/null @@ -1,863 +0,0 @@ -//go:build go1.18 -// +build go1.18 - -// 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. -// DO NOT EDIT. - -package armnetwork_test - -import ( - "context" - "log" - - "github.com/Azure/azure-sdk-for-go/sdk/azcore/to" - "github.com/Azure/azure-sdk-for-go/sdk/azidentity" - "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/network/armnetwork/v6" -) - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/4883fa5dbf6f2c9093fac8ce334547e9dfac68fa/specification/network/resource-manager/Microsoft.Network/stable/2024-03-01/examples/CloudServicePublicIpListAll.json -func ExamplePublicIPAddressesClient_NewListCloudServicePublicIPAddressesPager() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armnetwork.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := clientFactory.NewPublicIPAddressesClient().NewListCloudServicePublicIPAddressesPager("cs-tester", "cs1", nil) - for pager.More() { - page, err := pager.NextPage(ctx) - if err != nil { - log.Fatalf("failed to advance page: %v", err) - } - for _, v := range page.Value { - // You could use page here. We use blank identifier for just demo purposes. - _ = v - } - // If the HTTP response code is 200 as defined in example definition, your page structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // page.PublicIPAddressListResult = armnetwork.PublicIPAddressListResult{ - // Value: []*armnetwork.PublicIPAddress{ - // { - // Name: to.Ptr("pub1"), - // ID: to.Ptr("/subscriptions/subid/resourceGroups/cs-tester/providers/Microsoft.Compute/cloudServices/cs1/roleInstances/Test_VM_0/networkInterfaces/nic1/ipConfigurations/ip1/publicIPAddresses/pub1"), - // Properties: &armnetwork.PublicIPAddressPropertiesFormat{ - // DNSSettings: &armnetwork.PublicIPAddressDNSSettings{ - // DomainNameLabel: to.Ptr("vm1.testvmssacc"), - // Fqdn: to.Ptr("vm1.testvmssacc.southeastasia.cloudapp.azure.com"), - // }, - // IdleTimeoutInMinutes: to.Ptr[int32](10), - // IPAddress: to.Ptr("13.67.119.72"), - // IPConfiguration: &armnetwork.IPConfiguration{ - // ID: to.Ptr("/subscriptions/subid/resourceGroups/cs-tester/providers/Microsoft.Compute/cloudServices/cs1/roleInstances/Test_VM_0/networkInterfaces/nic1/ipConfigurations/ip1"), - // }, - // ProvisioningState: to.Ptr(armnetwork.ProvisioningStateSucceeded), - // PublicIPAddressVersion: to.Ptr(armnetwork.IPVersionIPv4), - // PublicIPAllocationMethod: to.Ptr(armnetwork.IPAllocationMethodDynamic), - // }, - // }, - // { - // Name: to.Ptr("pub1"), - // ID: to.Ptr("/subscriptions/subid/resourceGroups/cs-tester/providers/Microsoft.Compute/cloudServices/cs1/roleInstances/Test_VM_3/networkInterfaces/nic1/ipConfigurations/ip1/publicIPAddresses/pub1"), - // Properties: &armnetwork.PublicIPAddressPropertiesFormat{ - // DNSSettings: &armnetwork.PublicIPAddressDNSSettings{ - // DomainNameLabel: to.Ptr("vm3.testvmssacc"), - // Fqdn: to.Ptr("vm3.testvmssacc.southeastasia.cloudapp.azure.com"), - // }, - // IdleTimeoutInMinutes: to.Ptr[int32](10), - // IPAddress: to.Ptr("13.67.118.216"), - // IPConfiguration: &armnetwork.IPConfiguration{ - // ID: to.Ptr("/subscriptions/subid/resourceGroups/cs-tester/providers/Microsoft.Compute/cloudServices/cs1/roleInstances/Test_VM_3/networkInterfaces/nic1/ipConfigurations/ip1"), - // }, - // ProvisioningState: to.Ptr(armnetwork.ProvisioningStateSucceeded), - // PublicIPAddressVersion: to.Ptr(armnetwork.IPVersionIPv4), - // PublicIPAllocationMethod: to.Ptr(armnetwork.IPAllocationMethodDynamic), - // }, - // }}, - // } - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/4883fa5dbf6f2c9093fac8ce334547e9dfac68fa/specification/network/resource-manager/Microsoft.Network/stable/2024-03-01/examples/CloudServiceRoleInstancePublicIpList.json -func ExamplePublicIPAddressesClient_NewListCloudServiceRoleInstancePublicIPAddressesPager() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armnetwork.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := clientFactory.NewPublicIPAddressesClient().NewListCloudServiceRoleInstancePublicIPAddressesPager("cs-tester", "cs1", "Test_VM_0", "nic1", "ip1", nil) - for pager.More() { - page, err := pager.NextPage(ctx) - if err != nil { - log.Fatalf("failed to advance page: %v", err) - } - for _, v := range page.Value { - // You could use page here. We use blank identifier for just demo purposes. - _ = v - } - // If the HTTP response code is 200 as defined in example definition, your page structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // page.PublicIPAddressListResult = armnetwork.PublicIPAddressListResult{ - // Value: []*armnetwork.PublicIPAddress{ - // { - // Name: to.Ptr("pub1"), - // ID: to.Ptr("/subscriptions/subid/resourceGroups/cs-tester/providers/Microsoft.Compute/cloudServices/cs1/roleInstances/Test_VM_0/networkInterfaces/nic1/ipConfigurations/ip1/publicIPAddresses/pub1"), - // Properties: &armnetwork.PublicIPAddressPropertiesFormat{ - // DNSSettings: &armnetwork.PublicIPAddressDNSSettings{ - // DomainNameLabel: to.Ptr("vm1.testvmssacc"), - // Fqdn: to.Ptr("vm1.testvmssacc.southeastasia.cloudapp.azure.com"), - // }, - // IdleTimeoutInMinutes: to.Ptr[int32](10), - // IPAddress: to.Ptr("13.67.119.72"), - // IPConfiguration: &armnetwork.IPConfiguration{ - // ID: to.Ptr("/subscriptions/subid/resourceGroups/cs-tester/providers/Microsoft.Compute/cloudServices/cs1/roleInstances/Test_VM_0/networkInterfaces/nic1/ipConfigurations/ip1"), - // }, - // ProvisioningState: to.Ptr(armnetwork.ProvisioningStateSucceeded), - // PublicIPAddressVersion: to.Ptr(armnetwork.IPVersionIPv4), - // PublicIPAllocationMethod: to.Ptr(armnetwork.IPAllocationMethodDynamic), - // }, - // }}, - // } - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/4883fa5dbf6f2c9093fac8ce334547e9dfac68fa/specification/network/resource-manager/Microsoft.Network/stable/2024-03-01/examples/CloudServicePublicIpGet.json -func ExamplePublicIPAddressesClient_GetCloudServicePublicIPAddress() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armnetwork.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewPublicIPAddressesClient().GetCloudServicePublicIPAddress(ctx, "cs-tester", "cs1", "Test_VM_0", "nic1", "ip1", "pub1", &armnetwork.PublicIPAddressesClientGetCloudServicePublicIPAddressOptions{Expand: nil}) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.PublicIPAddress = armnetwork.PublicIPAddress{ - // Name: to.Ptr("pub1"), - // ID: to.Ptr("/subscriptions/subid/resourceGroups/cs-tester/providers/Microsoft.Compute/cloudServices/cs1/roleInstances/Test_VM_0/networkInterfaces/nic1/ipConfigurations/ip1/publicIPAddresses/pub1"), - // Properties: &armnetwork.PublicIPAddressPropertiesFormat{ - // DNSSettings: &armnetwork.PublicIPAddressDNSSettings{ - // DomainNameLabel: to.Ptr("vm1.testvmssacc"), - // Fqdn: to.Ptr("vm1.testvmssacc.southeastasia.cloudapp.azure.com"), - // }, - // IdleTimeoutInMinutes: to.Ptr[int32](10), - // IPAddress: to.Ptr("13.67.119.72"), - // IPConfiguration: &armnetwork.IPConfiguration{ - // ID: to.Ptr("/subscriptions/subid/resourceGroups/cs-tester/providers/Microsoft.Compute/cloudServices/cs1/roleInstances/Test_VM_0/networkInterfaces/nic1/ipConfigurations/ip1"), - // }, - // ProvisioningState: to.Ptr(armnetwork.ProvisioningStateSucceeded), - // PublicIPAddressVersion: to.Ptr(armnetwork.IPVersionIPv4), - // PublicIPAllocationMethod: to.Ptr(armnetwork.IPAllocationMethodDynamic), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/4883fa5dbf6f2c9093fac8ce334547e9dfac68fa/specification/network/resource-manager/Microsoft.Network/stable/2024-03-01/examples/PublicIpAddressDelete.json -func ExamplePublicIPAddressesClient_BeginDelete() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armnetwork.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewPublicIPAddressesClient().BeginDelete(ctx, "rg1", "test-ip", nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - _, err = poller.PollUntilDone(ctx, nil) - if err != nil { - log.Fatalf("failed to pull the result: %v", err) - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/4883fa5dbf6f2c9093fac8ce334547e9dfac68fa/specification/network/resource-manager/Microsoft.Network/stable/2024-03-01/examples/PublicIpAddressGet.json -func ExamplePublicIPAddressesClient_Get() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armnetwork.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewPublicIPAddressesClient().Get(ctx, "rg1", "testDNS-ip", &armnetwork.PublicIPAddressesClientGetOptions{Expand: nil}) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.PublicIPAddress = armnetwork.PublicIPAddress{ - // Name: to.Ptr("testDNS-ip"), - // Type: to.Ptr("Microsoft.Network/publicIPAddresses"), - // ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/publicIPAddresses/testDNS-ip"), - // Location: to.Ptr("westus"), - // Properties: &armnetwork.PublicIPAddressPropertiesFormat{ - // DdosSettings: &armnetwork.DdosSettings{ - // DdosProtectionPlan: &armnetwork.SubResource{ - // ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/ddosProtectionPlans/test-plan"), - // }, - // ProtectionMode: to.Ptr(armnetwork.DdosSettingsProtectionModeEnabled), - // }, - // IdleTimeoutInMinutes: to.Ptr[int32](4), - // IPConfiguration: &armnetwork.IPConfiguration{ - // ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/networkInterfaces/testDNS649/ipConfigurations/ipconfig1"), - // }, - // IPTags: []*armnetwork.IPTag{ - // { - // IPTagType: to.Ptr("FirstPartyUsage"), - // Tag: to.Ptr("SQL"), - // }, - // { - // IPTagType: to.Ptr("FirstPartyUsage"), - // Tag: to.Ptr("Storage"), - // }}, - // ProvisioningState: to.Ptr(armnetwork.ProvisioningStateSucceeded), - // PublicIPAddressVersion: to.Ptr(armnetwork.IPVersionIPv4), - // PublicIPAllocationMethod: to.Ptr(armnetwork.IPAllocationMethodDynamic), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/4883fa5dbf6f2c9093fac8ce334547e9dfac68fa/specification/network/resource-manager/Microsoft.Network/stable/2024-03-01/examples/PublicIpAddressCreateDns.json -func ExamplePublicIPAddressesClient_BeginCreateOrUpdate_createPublicIpAddressDns() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armnetwork.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewPublicIPAddressesClient().BeginCreateOrUpdate(ctx, "rg1", "test-ip", armnetwork.PublicIPAddress{ - Location: to.Ptr("eastus"), - Properties: &armnetwork.PublicIPAddressPropertiesFormat{ - DNSSettings: &armnetwork.PublicIPAddressDNSSettings{ - DomainNameLabel: to.Ptr("dnslbl"), - }, - }, - }, nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - res, err := poller.PollUntilDone(ctx, nil) - if err != nil { - log.Fatalf("failed to pull the result: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.PublicIPAddress = armnetwork.PublicIPAddress{ - // Name: to.Ptr("testDNS-ip"), - // Type: to.Ptr("Microsoft.Network/publicIPAddresses"), - // ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/publicIPAddresses/test-ip"), - // Location: to.Ptr("eastus"), - // Properties: &armnetwork.PublicIPAddressPropertiesFormat{ - // DNSSettings: &armnetwork.PublicIPAddressDNSSettings{ - // DomainNameLabel: to.Ptr("dnslbl"), - // Fqdn: to.Ptr("dnslbl.westus.cloudapp.azure.com"), - // }, - // IdleTimeoutInMinutes: to.Ptr[int32](4), - // IPConfiguration: &armnetwork.IPConfiguration{ - // ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/networkInterfaces/testDNS649/ipConfigurations/ipconfig1"), - // }, - // ProvisioningState: to.Ptr(armnetwork.ProvisioningStateSucceeded), - // PublicIPAddressVersion: to.Ptr(armnetwork.IPVersionIPv4), - // PublicIPAllocationMethod: to.Ptr(armnetwork.IPAllocationMethodDynamic), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/4883fa5dbf6f2c9093fac8ce334547e9dfac68fa/specification/network/resource-manager/Microsoft.Network/stable/2024-03-01/examples/PublicIpAddressCreateDnsWithDomainNameLabelScope.json -func ExamplePublicIPAddressesClient_BeginCreateOrUpdate_createPublicIpAddressDnsWithDomainNameLabelScope() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armnetwork.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewPublicIPAddressesClient().BeginCreateOrUpdate(ctx, "rg1", "test-ip", armnetwork.PublicIPAddress{ - Location: to.Ptr("eastus"), - Properties: &armnetwork.PublicIPAddressPropertiesFormat{ - DNSSettings: &armnetwork.PublicIPAddressDNSSettings{ - DomainNameLabel: to.Ptr("dnslbl"), - DomainNameLabelScope: to.Ptr(armnetwork.PublicIPAddressDNSSettingsDomainNameLabelScopeTenantReuse), - }, - }, - }, nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - res, err := poller.PollUntilDone(ctx, nil) - if err != nil { - log.Fatalf("failed to pull the result: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.PublicIPAddress = armnetwork.PublicIPAddress{ - // Name: to.Ptr("testDNS-ip"), - // Type: to.Ptr("Microsoft.Network/publicIPAddresses"), - // ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/publicIPAddresses/test-ip"), - // Location: to.Ptr("eastus"), - // Properties: &armnetwork.PublicIPAddressPropertiesFormat{ - // DNSSettings: &armnetwork.PublicIPAddressDNSSettings{ - // DomainNameLabel: to.Ptr("dnslbl"), - // DomainNameLabelScope: to.Ptr(armnetwork.PublicIPAddressDNSSettingsDomainNameLabelScopeTenantReuse), - // Fqdn: to.Ptr("dnslbl.hxdwgjcdfgbhgebs.eastus.sysgen.cloudapp.azure.com"), - // }, - // IdleTimeoutInMinutes: to.Ptr[int32](4), - // IPConfiguration: &armnetwork.IPConfiguration{ - // ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/networkInterfaces/testDNS649/ipConfigurations/ipconfig1"), - // }, - // ProvisioningState: to.Ptr(armnetwork.ProvisioningStateSucceeded), - // PublicIPAddressVersion: to.Ptr(armnetwork.IPVersionIPv4), - // PublicIPAllocationMethod: to.Ptr(armnetwork.IPAllocationMethodDynamic), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/4883fa5dbf6f2c9093fac8ce334547e9dfac68fa/specification/network/resource-manager/Microsoft.Network/stable/2024-03-01/examples/PublicIpAddressCreateCustomizedValues.json -func ExamplePublicIPAddressesClient_BeginCreateOrUpdate_createPublicIpAddressAllocationMethod() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armnetwork.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewPublicIPAddressesClient().BeginCreateOrUpdate(ctx, "rg1", "test-ip", armnetwork.PublicIPAddress{ - Location: to.Ptr("eastus"), - Properties: &armnetwork.PublicIPAddressPropertiesFormat{ - IdleTimeoutInMinutes: to.Ptr[int32](10), - PublicIPAddressVersion: to.Ptr(armnetwork.IPVersionIPv4), - PublicIPAllocationMethod: to.Ptr(armnetwork.IPAllocationMethodStatic), - }, - SKU: &armnetwork.PublicIPAddressSKU{ - Name: to.Ptr(armnetwork.PublicIPAddressSKUNameStandard), - Tier: to.Ptr(armnetwork.PublicIPAddressSKUTierGlobal), - }, - }, nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - res, err := poller.PollUntilDone(ctx, nil) - if err != nil { - log.Fatalf("failed to pull the result: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.PublicIPAddress = armnetwork.PublicIPAddress{ - // Name: to.Ptr("testDNS-ip"), - // Type: to.Ptr("Microsoft.Network/publicIPAddresses"), - // ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/publicIPAddresses/test-ip"), - // Location: to.Ptr("eastus"), - // Properties: &armnetwork.PublicIPAddressPropertiesFormat{ - // DdosSettings: &armnetwork.DdosSettings{ - // ProtectionMode: to.Ptr(armnetwork.DdosSettingsProtectionModeVirtualNetworkInherited), - // }, - // IdleTimeoutInMinutes: to.Ptr[int32](10), - // IPConfiguration: &armnetwork.IPConfiguration{ - // ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/networkInterfaces/testDNS649/ipConfigurations/ipconfig1"), - // }, - // ProvisioningState: to.Ptr(armnetwork.ProvisioningStateSucceeded), - // PublicIPAddressVersion: to.Ptr(armnetwork.IPVersionIPv4), - // PublicIPAllocationMethod: to.Ptr(armnetwork.IPAllocationMethodStatic), - // }, - // SKU: &armnetwork.PublicIPAddressSKU{ - // Name: to.Ptr(armnetwork.PublicIPAddressSKUNameStandard), - // Tier: to.Ptr(armnetwork.PublicIPAddressSKUTierGlobal), - // }, - // Zones: []*string{ - // to.Ptr("1")}, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/4883fa5dbf6f2c9093fac8ce334547e9dfac68fa/specification/network/resource-manager/Microsoft.Network/stable/2024-03-01/examples/PublicIpAddressCreateDefaults.json -func ExamplePublicIPAddressesClient_BeginCreateOrUpdate_createPublicIpAddressDefaults() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armnetwork.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewPublicIPAddressesClient().BeginCreateOrUpdate(ctx, "rg1", "test-ip", armnetwork.PublicIPAddress{ - Location: to.Ptr("eastus"), - }, nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - res, err := poller.PollUntilDone(ctx, nil) - if err != nil { - log.Fatalf("failed to pull the result: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.PublicIPAddress = armnetwork.PublicIPAddress{ - // Name: to.Ptr("testDNS-ip"), - // Type: to.Ptr("Microsoft.Network/publicIPAddresses"), - // ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/publicIPAddresses/test-ip"), - // Location: to.Ptr("eastus"), - // Properties: &armnetwork.PublicIPAddressPropertiesFormat{ - // IdleTimeoutInMinutes: to.Ptr[int32](4), - // IPConfiguration: &armnetwork.IPConfiguration{ - // ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/networkInterfaces/testDNS649/ipConfigurations/ipconfig1"), - // }, - // ProvisioningState: to.Ptr(armnetwork.ProvisioningStateSucceeded), - // PublicIPAddressVersion: to.Ptr(armnetwork.IPVersionIPv4), - // PublicIPAllocationMethod: to.Ptr(armnetwork.IPAllocationMethodDynamic), - // }, - // SKU: &armnetwork.PublicIPAddressSKU{ - // Name: to.Ptr(armnetwork.PublicIPAddressSKUNameBasic), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/4883fa5dbf6f2c9093fac8ce334547e9dfac68fa/specification/network/resource-manager/Microsoft.Network/stable/2024-03-01/examples/PublicIpAddressUpdateTags.json -func ExamplePublicIPAddressesClient_UpdateTags() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armnetwork.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewPublicIPAddressesClient().UpdateTags(ctx, "rg1", "test-ip", armnetwork.TagsObject{ - Tags: map[string]*string{ - "tag1": to.Ptr("value1"), - "tag2": to.Ptr("value2"), - }, - }, nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.PublicIPAddress = armnetwork.PublicIPAddress{ - // Name: to.Ptr("testDNS-ip"), - // Type: to.Ptr("Microsoft.Network/publicIPAddresses"), - // ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/publicIPAddresses/test-ip"), - // Location: to.Ptr("westus"), - // Tags: map[string]*string{ - // "tag1": to.Ptr("value1"), - // "tag2": to.Ptr("value2"), - // }, - // Properties: &armnetwork.PublicIPAddressPropertiesFormat{ - // DdosSettings: &armnetwork.DdosSettings{ - // ProtectionMode: to.Ptr(armnetwork.DdosSettingsProtectionModeVirtualNetworkInherited), - // }, - // IdleTimeoutInMinutes: to.Ptr[int32](10), - // IPConfiguration: &armnetwork.IPConfiguration{ - // ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/networkInterfaces/testDNS649/ipConfigurations/ipconfig1"), - // }, - // ProvisioningState: to.Ptr(armnetwork.ProvisioningStateSucceeded), - // PublicIPAddressVersion: to.Ptr(armnetwork.IPVersionIPv4), - // PublicIPAllocationMethod: to.Ptr(armnetwork.IPAllocationMethodStatic), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/4883fa5dbf6f2c9093fac8ce334547e9dfac68fa/specification/network/resource-manager/Microsoft.Network/stable/2024-03-01/examples/PublicIpAddressListAll.json -func ExamplePublicIPAddressesClient_NewListAllPager() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armnetwork.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := clientFactory.NewPublicIPAddressesClient().NewListAllPager(nil) - for pager.More() { - page, err := pager.NextPage(ctx) - if err != nil { - log.Fatalf("failed to advance page: %v", err) - } - for _, v := range page.Value { - // You could use page here. We use blank identifier for just demo purposes. - _ = v - } - // If the HTTP response code is 200 as defined in example definition, your page structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // page.PublicIPAddressListResult = armnetwork.PublicIPAddressListResult{ - // Value: []*armnetwork.PublicIPAddress{ - // { - // Name: to.Ptr("testDNS-ip"), - // Type: to.Ptr("Microsoft.Network/publicIPAddresses"), - // ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/publicIPAddresses/testDNS-ip"), - // Location: to.Ptr("westus"), - // Properties: &armnetwork.PublicIPAddressPropertiesFormat{ - // DdosSettings: &armnetwork.DdosSettings{ - // ProtectionMode: to.Ptr(armnetwork.DdosSettingsProtectionModeVirtualNetworkInherited), - // }, - // IdleTimeoutInMinutes: to.Ptr[int32](4), - // IPConfiguration: &armnetwork.IPConfiguration{ - // ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/networkInterfaces/testDNS649/ipConfigurations/ipconfig1"), - // }, - // ProvisioningState: to.Ptr(armnetwork.ProvisioningStateSucceeded), - // PublicIPAddressVersion: to.Ptr(armnetwork.IPVersionIPv4), - // PublicIPAllocationMethod: to.Ptr(armnetwork.IPAllocationMethodDynamic), - // }, - // }, - // { - // Name: to.Ptr("ip01"), - // Type: to.Ptr("Microsoft.Network/publicIPAddresses"), - // ID: to.Ptr("/subscriptions/subid/resourceGroups/rg2/providers/Microsoft.Network/publicIPAddresses/ip01"), - // Location: to.Ptr("westus"), - // Properties: &armnetwork.PublicIPAddressPropertiesFormat{ - // DdosSettings: &armnetwork.DdosSettings{ - // ProtectionMode: to.Ptr(armnetwork.DdosSettingsProtectionModeVirtualNetworkInherited), - // }, - // DNSSettings: &armnetwork.PublicIPAddressDNSSettings{ - // DomainNameLabel: to.Ptr("testlbl"), - // Fqdn: to.Ptr("testlbl.westus.cloudapp.azure.com"), - // }, - // IdleTimeoutInMinutes: to.Ptr[int32](4), - // IPAddress: to.Ptr("40.85.154.247"), - // IPConfiguration: &armnetwork.IPConfiguration{ - // ID: to.Ptr("/subscriptions/subid/resourceGroups/rg2/providers/Microsoft.Network/loadBalancers/testLb/frontendIPConfigurations/LoadBalancerFrontEnd"), - // }, - // ProvisioningState: to.Ptr(armnetwork.ProvisioningStateSucceeded), - // PublicIPAddressVersion: to.Ptr(armnetwork.IPVersionIPv4), - // PublicIPAllocationMethod: to.Ptr(armnetwork.IPAllocationMethodDynamic), - // }, - // }, - // { - // Name: to.Ptr("ip02"), - // Type: to.Ptr("Microsoft.Network/publicIPAddresses"), - // ID: to.Ptr("/subscriptions/subid/resourceGroups/rg2/providers/Microsoft.Network/publicIPAddresses/ip02"), - // Location: to.Ptr("westus"), - // Properties: &armnetwork.PublicIPAddressPropertiesFormat{ - // DdosSettings: &armnetwork.DdosSettings{ - // ProtectionMode: to.Ptr(armnetwork.DdosSettingsProtectionModeVirtualNetworkInherited), - // }, - // DNSSettings: &armnetwork.PublicIPAddressDNSSettings{ - // DomainNameLabel: to.Ptr("testlbl"), - // DomainNameLabelScope: to.Ptr(armnetwork.PublicIPAddressDNSSettingsDomainNameLabelScopeTenantReuse), - // Fqdn: to.Ptr("testlbl.hxdwgjcdfgbhgebs.eastus.sysgen.cloudapp.azure.com"), - // }, - // IdleTimeoutInMinutes: to.Ptr[int32](4), - // IPAddress: to.Ptr("40.85.154.248"), - // IPConfiguration: &armnetwork.IPConfiguration{ - // ID: to.Ptr("/subscriptions/subid/resourceGroups/rg2/providers/Microsoft.Network/loadBalancers/testLb/frontendIPConfigurations/LoadBalancerFrontEnd"), - // }, - // ProvisioningState: to.Ptr(armnetwork.ProvisioningStateSucceeded), - // PublicIPAddressVersion: to.Ptr(armnetwork.IPVersionIPv4), - // PublicIPAllocationMethod: to.Ptr(armnetwork.IPAllocationMethodDynamic), - // }, - // }}, - // } - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/4883fa5dbf6f2c9093fac8ce334547e9dfac68fa/specification/network/resource-manager/Microsoft.Network/stable/2024-03-01/examples/PublicIpAddressList.json -func ExamplePublicIPAddressesClient_NewListPager() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armnetwork.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := clientFactory.NewPublicIPAddressesClient().NewListPager("rg1", nil) - for pager.More() { - page, err := pager.NextPage(ctx) - if err != nil { - log.Fatalf("failed to advance page: %v", err) - } - for _, v := range page.Value { - // You could use page here. We use blank identifier for just demo purposes. - _ = v - } - // If the HTTP response code is 200 as defined in example definition, your page structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // page.PublicIPAddressListResult = armnetwork.PublicIPAddressListResult{ - // Value: []*armnetwork.PublicIPAddress{ - // { - // Name: to.Ptr("testDNS-ip"), - // Type: to.Ptr("Microsoft.Network/publicIPAddresses"), - // ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/publicIPAddresses/testDNS-ip"), - // Location: to.Ptr("westus"), - // Properties: &armnetwork.PublicIPAddressPropertiesFormat{ - // DdosSettings: &armnetwork.DdosSettings{ - // ProtectionMode: to.Ptr(armnetwork.DdosSettingsProtectionModeVirtualNetworkInherited), - // }, - // IdleTimeoutInMinutes: to.Ptr[int32](4), - // IPConfiguration: &armnetwork.IPConfiguration{ - // ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/networkInterfaces/testDNS649/ipConfigurations/ipconfig1"), - // }, - // IPTags: []*armnetwork.IPTag{ - // { - // IPTagType: to.Ptr("FirstPartyUsage"), - // Tag: to.Ptr("SQL"), - // }, - // { - // IPTagType: to.Ptr("FirstPartyUsage"), - // Tag: to.Ptr("Storage"), - // }}, - // ProvisioningState: to.Ptr(armnetwork.ProvisioningStateSucceeded), - // PublicIPAddressVersion: to.Ptr(armnetwork.IPVersionIPv4), - // PublicIPAllocationMethod: to.Ptr(armnetwork.IPAllocationMethodDynamic), - // }, - // }, - // { - // Name: to.Ptr("ip03"), - // Type: to.Ptr("Microsoft.Network/publicIPAddresses"), - // ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/publicIPAddresses/ip03"), - // Location: to.Ptr("westus"), - // Properties: &armnetwork.PublicIPAddressPropertiesFormat{ - // DdosSettings: &armnetwork.DdosSettings{ - // ProtectionMode: to.Ptr(armnetwork.DdosSettingsProtectionModeVirtualNetworkInherited), - // }, - // DNSSettings: &armnetwork.PublicIPAddressDNSSettings{ - // DomainNameLabel: to.Ptr("testlbl"), - // Fqdn: to.Ptr("testlbl.westus.cloudapp.azure.com"), - // }, - // IdleTimeoutInMinutes: to.Ptr[int32](4), - // IPAddress: to.Ptr("40.85.154.247"), - // IPConfiguration: &armnetwork.IPConfiguration{ - // ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/loadBalancers/testLb/frontendIPConfigurations/LoadBalancerFrontEnd"), - // }, - // ProvisioningState: to.Ptr(armnetwork.ProvisioningStateSucceeded), - // PublicIPAddressVersion: to.Ptr(armnetwork.IPVersionIPv4), - // PublicIPAllocationMethod: to.Ptr(armnetwork.IPAllocationMethodDynamic), - // }, - // }, - // { - // Name: to.Ptr("ip04"), - // Type: to.Ptr("Microsoft.Network/publicIPAddresses"), - // ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/publicIPAddresses/ip04"), - // Location: to.Ptr("westus"), - // Properties: &armnetwork.PublicIPAddressPropertiesFormat{ - // DdosSettings: &armnetwork.DdosSettings{ - // ProtectionMode: to.Ptr(armnetwork.DdosSettingsProtectionModeVirtualNetworkInherited), - // }, - // DNSSettings: &armnetwork.PublicIPAddressDNSSettings{ - // DomainNameLabel: to.Ptr("testlbl"), - // DomainNameLabelScope: to.Ptr(armnetwork.PublicIPAddressDNSSettingsDomainNameLabelScopeTenantReuse), - // Fqdn: to.Ptr("testlbl.hxdwgjcdfgbhgebs.eastus.sysgen.cloudapp.azure.com"), - // }, - // IdleTimeoutInMinutes: to.Ptr[int32](4), - // IPAddress: to.Ptr("40.85.154.248"), - // IPConfiguration: &armnetwork.IPConfiguration{ - // ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/loadBalancers/testLb/frontendIPConfigurations/LoadBalancerFrontEnd"), - // }, - // ProvisioningState: to.Ptr(armnetwork.ProvisioningStateSucceeded), - // PublicIPAddressVersion: to.Ptr(armnetwork.IPVersionIPv4), - // PublicIPAllocationMethod: to.Ptr(armnetwork.IPAllocationMethodDynamic), - // }, - // }}, - // } - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/4883fa5dbf6f2c9093fac8ce334547e9dfac68fa/specification/network/resource-manager/Microsoft.Network/stable/2024-03-01/examples/PublicIpAddressGetDdosProtectionStatus.json -func ExamplePublicIPAddressesClient_BeginDdosProtectionStatus() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armnetwork.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewPublicIPAddressesClient().BeginDdosProtectionStatus(ctx, "rg1", "test-pip", nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - res, err := poller.PollUntilDone(ctx, nil) - if err != nil { - log.Fatalf("failed to pull the result: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.PublicIPDdosProtectionStatusResult = armnetwork.PublicIPDdosProtectionStatusResult{ - // DdosProtectionPlanID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/ddosProtectionPlans/test-plan"), - // IsWorkloadProtected: to.Ptr(armnetwork.IsWorkloadProtectedTrue), - // PublicIPAddress: to.Ptr("10.0.1.5"), - // PublicIPAddressID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/publicIPAddresses/test-pip"), - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/4883fa5dbf6f2c9093fac8ce334547e9dfac68fa/specification/network/resource-manager/Microsoft.Network/stable/2024-03-01/examples/VmssPublicIpListAll.json -func ExamplePublicIPAddressesClient_NewListVirtualMachineScaleSetPublicIPAddressesPager() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armnetwork.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := clientFactory.NewPublicIPAddressesClient().NewListVirtualMachineScaleSetPublicIPAddressesPager("vmss-tester", "vmss1", nil) - for pager.More() { - page, err := pager.NextPage(ctx) - if err != nil { - log.Fatalf("failed to advance page: %v", err) - } - for _, v := range page.Value { - // You could use page here. We use blank identifier for just demo purposes. - _ = v - } - // If the HTTP response code is 200 as defined in example definition, your page structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // page.PublicIPAddressListResult = armnetwork.PublicIPAddressListResult{ - // Value: []*armnetwork.PublicIPAddress{ - // { - // Name: to.Ptr("pub1"), - // ID: to.Ptr("/subscriptions/subid/resourceGroups/vmss-tester/providers/Microsoft.Compute/virtualMachineScaleSets/vmss1/virtualMachines/1/networkInterfaces/nic1/ipConfigurations/ip1/publicIPAddresses/pub1"), - // Properties: &armnetwork.PublicIPAddressPropertiesFormat{ - // DNSSettings: &armnetwork.PublicIPAddressDNSSettings{ - // DomainNameLabel: to.Ptr("vm1.testvmssacc"), - // Fqdn: to.Ptr("vm1.testvmssacc.southeastasia.cloudapp.azure.com"), - // }, - // IdleTimeoutInMinutes: to.Ptr[int32](10), - // IPAddress: to.Ptr("13.67.119.72"), - // IPConfiguration: &armnetwork.IPConfiguration{ - // ID: to.Ptr("/subscriptions/subid/resourceGroups/vmss-tester/providers/Microsoft.Compute/virtualMachineScaleSets/vmss1/virtualMachines/1/networkInterfaces/nic1/ipConfigurations/ip1"), - // }, - // ProvisioningState: to.Ptr(armnetwork.ProvisioningStateSucceeded), - // PublicIPAddressVersion: to.Ptr(armnetwork.IPVersionIPv4), - // PublicIPAllocationMethod: to.Ptr(armnetwork.IPAllocationMethodDynamic), - // }, - // }, - // { - // Name: to.Ptr("pub1"), - // ID: to.Ptr("/subscriptions/subid/resourceGroups/vmss-tester/providers/Microsoft.Compute/virtualMachineScaleSets/vmss1/virtualMachines/3/networkInterfaces/nic1/ipConfigurations/ip1/publicIPAddresses/pub1"), - // Properties: &armnetwork.PublicIPAddressPropertiesFormat{ - // DNSSettings: &armnetwork.PublicIPAddressDNSSettings{ - // DomainNameLabel: to.Ptr("vm3.testvmssacc"), - // Fqdn: to.Ptr("vm3.testvmssacc.southeastasia.cloudapp.azure.com"), - // }, - // IdleTimeoutInMinutes: to.Ptr[int32](10), - // IPAddress: to.Ptr("13.67.118.216"), - // IPConfiguration: &armnetwork.IPConfiguration{ - // ID: to.Ptr("/subscriptions/subid/resourceGroups/vmss-tester/providers/Microsoft.Compute/virtualMachineScaleSets/vmss1/virtualMachines/3/networkInterfaces/nic1/ipConfigurations/ip1"), - // }, - // ProvisioningState: to.Ptr(armnetwork.ProvisioningStateSucceeded), - // PublicIPAddressVersion: to.Ptr(armnetwork.IPVersionIPv4), - // PublicIPAllocationMethod: to.Ptr(armnetwork.IPAllocationMethodDynamic), - // }, - // }}, - // } - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/4883fa5dbf6f2c9093fac8ce334547e9dfac68fa/specification/network/resource-manager/Microsoft.Network/stable/2024-03-01/examples/VmssVmPublicIpList.json -func ExamplePublicIPAddressesClient_NewListVirtualMachineScaleSetVMPublicIPAddressesPager() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armnetwork.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := clientFactory.NewPublicIPAddressesClient().NewListVirtualMachineScaleSetVMPublicIPAddressesPager("vmss-tester", "vmss1", "1", "nic1", "ip1", nil) - for pager.More() { - page, err := pager.NextPage(ctx) - if err != nil { - log.Fatalf("failed to advance page: %v", err) - } - for _, v := range page.Value { - // You could use page here. We use blank identifier for just demo purposes. - _ = v - } - // If the HTTP response code is 200 as defined in example definition, your page structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // page.PublicIPAddressListResult = armnetwork.PublicIPAddressListResult{ - // Value: []*armnetwork.PublicIPAddress{ - // { - // Name: to.Ptr("pub1"), - // ID: to.Ptr("/subscriptions/subid/resourceGroups/vmss-tester/providers/Microsoft.Compute/virtualMachineScaleSets/vmss1/virtualMachines/1/networkInterfaces/nic1/ipConfigurations/ip1/publicIPAddresses/pub1"), - // Properties: &armnetwork.PublicIPAddressPropertiesFormat{ - // DNSSettings: &armnetwork.PublicIPAddressDNSSettings{ - // DomainNameLabel: to.Ptr("vm1.testvmssacc"), - // Fqdn: to.Ptr("vm1.testvmssacc.southeastasia.cloudapp.azure.com"), - // }, - // IdleTimeoutInMinutes: to.Ptr[int32](10), - // IPAddress: to.Ptr("13.67.119.72"), - // IPConfiguration: &armnetwork.IPConfiguration{ - // ID: to.Ptr("/subscriptions/subid/resourceGroups/vmss-tester/providers/Microsoft.Compute/virtualMachineScaleSets/vmss1/virtualMachines/1/networkInterfaces/nic1/ipConfigurations/ip1"), - // }, - // ProvisioningState: to.Ptr(armnetwork.ProvisioningStateSucceeded), - // PublicIPAddressVersion: to.Ptr(armnetwork.IPVersionIPv4), - // PublicIPAllocationMethod: to.Ptr(armnetwork.IPAllocationMethodDynamic), - // }, - // }}, - // } - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/4883fa5dbf6f2c9093fac8ce334547e9dfac68fa/specification/network/resource-manager/Microsoft.Network/stable/2024-03-01/examples/VmssPublicIpGet.json -func ExamplePublicIPAddressesClient_GetVirtualMachineScaleSetPublicIPAddress() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armnetwork.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewPublicIPAddressesClient().GetVirtualMachineScaleSetPublicIPAddress(ctx, "vmss-tester", "vmss1", "1", "nic1", "ip1", "pub1", &armnetwork.PublicIPAddressesClientGetVirtualMachineScaleSetPublicIPAddressOptions{Expand: nil}) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.PublicIPAddress = armnetwork.PublicIPAddress{ - // Name: to.Ptr("pub1"), - // ID: to.Ptr("/subscriptions/subid/resourceGroups/vmss-tester/providers/Microsoft.Compute/virtualMachineScaleSets/vmss1/virtualMachines/1/networkInterfaces/nic1/ipConfigurations/ip1/publicIPAddresses/pub1"), - // Properties: &armnetwork.PublicIPAddressPropertiesFormat{ - // DNSSettings: &armnetwork.PublicIPAddressDNSSettings{ - // DomainNameLabel: to.Ptr("vm1.testvmssacc"), - // Fqdn: to.Ptr("vm1.testvmssacc.southeastasia.cloudapp.azure.com"), - // }, - // IdleTimeoutInMinutes: to.Ptr[int32](10), - // IPAddress: to.Ptr("13.67.119.72"), - // IPConfiguration: &armnetwork.IPConfiguration{ - // ID: to.Ptr("/subscriptions/subid/resourceGroups/vmss-tester/providers/Microsoft.Compute/virtualMachineScaleSets/vmss1/virtualMachines/1/networkInterfaces/nic1/ipConfigurations/ip1"), - // }, - // ProvisioningState: to.Ptr(armnetwork.ProvisioningStateSucceeded), - // PublicIPAddressVersion: to.Ptr(armnetwork.IPVersionIPv4), - // PublicIPAllocationMethod: to.Ptr(armnetwork.IPAllocationMethodDynamic), - // }, - // } -} diff --git a/sdk/resourcemanager/network/armnetwork/publicipprefixes_client_example_test.go b/sdk/resourcemanager/network/armnetwork/publicipprefixes_client_example_test.go deleted file mode 100644 index 6ddf8a71d2cd..000000000000 --- a/sdk/resourcemanager/network/armnetwork/publicipprefixes_client_example_test.go +++ /dev/null @@ -1,399 +0,0 @@ -//go:build go1.18 -// +build go1.18 - -// 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. -// DO NOT EDIT. - -package armnetwork_test - -import ( - "context" - "log" - - "github.com/Azure/azure-sdk-for-go/sdk/azcore/to" - "github.com/Azure/azure-sdk-for-go/sdk/azidentity" - "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/network/armnetwork/v6" -) - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/4883fa5dbf6f2c9093fac8ce334547e9dfac68fa/specification/network/resource-manager/Microsoft.Network/stable/2024-03-01/examples/PublicIpPrefixDelete.json -func ExamplePublicIPPrefixesClient_BeginDelete() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armnetwork.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewPublicIPPrefixesClient().BeginDelete(ctx, "rg1", "test-ipprefix", nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - _, err = poller.PollUntilDone(ctx, nil) - if err != nil { - log.Fatalf("failed to pull the result: %v", err) - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/4883fa5dbf6f2c9093fac8ce334547e9dfac68fa/specification/network/resource-manager/Microsoft.Network/stable/2024-03-01/examples/PublicIpPrefixGet.json -func ExamplePublicIPPrefixesClient_Get() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armnetwork.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewPublicIPPrefixesClient().Get(ctx, "rg1", "test-ipprefix", &armnetwork.PublicIPPrefixesClientGetOptions{Expand: nil}) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.PublicIPPrefix = armnetwork.PublicIPPrefix{ - // Name: to.Ptr("test-ipprefix"), - // Type: to.Ptr("Microsoft.Network/publicIPPrefixes"), - // ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/publicIPPrefixes/test-ipprefix"), - // Location: to.Ptr("westus"), - // Etag: to.Ptr("W/\"00000000-0000-0000-0000-00000000\""), - // Properties: &armnetwork.PublicIPPrefixPropertiesFormat{ - // IPPrefix: to.Ptr("192.168.254.2/30"), - // IPTags: []*armnetwork.IPTag{ - // }, - // PrefixLength: to.Ptr[int32](30), - // ProvisioningState: to.Ptr(armnetwork.ProvisioningStateSucceeded), - // PublicIPAddressVersion: to.Ptr(armnetwork.IPVersionIPv4), - // PublicIPAddresses: []*armnetwork.ReferencedPublicIPAddress{ - // { - // ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/publicIPAddresses/PublicIpAddress1"), - // }}, - // ResourceGUID: to.Ptr("00000000-0000-0000-0000-00000000"), - // }, - // SKU: &armnetwork.PublicIPPrefixSKU{ - // Name: to.Ptr(armnetwork.PublicIPPrefixSKUNameStandard), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/4883fa5dbf6f2c9093fac8ce334547e9dfac68fa/specification/network/resource-manager/Microsoft.Network/stable/2024-03-01/examples/PublicIpPrefixCreateCustomizedValues.json -func ExamplePublicIPPrefixesClient_BeginCreateOrUpdate_createPublicIpPrefixAllocationMethod() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armnetwork.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewPublicIPPrefixesClient().BeginCreateOrUpdate(ctx, "rg1", "test-ipprefix", armnetwork.PublicIPPrefix{ - Location: to.Ptr("westus"), - Properties: &armnetwork.PublicIPPrefixPropertiesFormat{ - PrefixLength: to.Ptr[int32](30), - PublicIPAddressVersion: to.Ptr(armnetwork.IPVersionIPv4), - }, - SKU: &armnetwork.PublicIPPrefixSKU{ - Name: to.Ptr(armnetwork.PublicIPPrefixSKUNameStandard), - Tier: to.Ptr(armnetwork.PublicIPPrefixSKUTierRegional), - }, - }, nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - res, err := poller.PollUntilDone(ctx, nil) - if err != nil { - log.Fatalf("failed to pull the result: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.PublicIPPrefix = armnetwork.PublicIPPrefix{ - // Name: to.Ptr("test-ipprefix"), - // Type: to.Ptr("Microsoft.Network/publicIPPrefixes"), - // ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/publicIPPrefixes/test-ipprefix"), - // Location: to.Ptr("westus"), - // Etag: to.Ptr("W/\"00000000-0000-0000-0000-00000000\""), - // Properties: &armnetwork.PublicIPPrefixPropertiesFormat{ - // IPPrefix: to.Ptr("192.168.254.2/30"), - // IPTags: []*armnetwork.IPTag{ - // }, - // PrefixLength: to.Ptr[int32](30), - // ProvisioningState: to.Ptr(armnetwork.ProvisioningStateSucceeded), - // PublicIPAddressVersion: to.Ptr(armnetwork.IPVersionIPv4), - // ResourceGUID: to.Ptr("00000000-0000-0000-0000-00000000"), - // }, - // SKU: &armnetwork.PublicIPPrefixSKU{ - // Name: to.Ptr(armnetwork.PublicIPPrefixSKUNameStandard), - // Tier: to.Ptr(armnetwork.PublicIPPrefixSKUTierRegional), - // }, - // Zones: []*string{ - // to.Ptr("1")}, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/4883fa5dbf6f2c9093fac8ce334547e9dfac68fa/specification/network/resource-manager/Microsoft.Network/stable/2024-03-01/examples/PublicIpPrefixCreateDefaults.json -func ExamplePublicIPPrefixesClient_BeginCreateOrUpdate_createPublicIpPrefixDefaults() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armnetwork.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewPublicIPPrefixesClient().BeginCreateOrUpdate(ctx, "rg1", "test-ipprefix", armnetwork.PublicIPPrefix{ - Location: to.Ptr("westus"), - Properties: &armnetwork.PublicIPPrefixPropertiesFormat{ - PrefixLength: to.Ptr[int32](30), - }, - SKU: &armnetwork.PublicIPPrefixSKU{ - Name: to.Ptr(armnetwork.PublicIPPrefixSKUNameStandard), - }, - }, nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - res, err := poller.PollUntilDone(ctx, nil) - if err != nil { - log.Fatalf("failed to pull the result: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.PublicIPPrefix = armnetwork.PublicIPPrefix{ - // Name: to.Ptr("test-ipprefix"), - // Type: to.Ptr("Microsoft.Network/publicIPPrefixes"), - // ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/publicIPPrefixes/test-ipprefix"), - // Location: to.Ptr("westus"), - // Etag: to.Ptr("W/\"00000000-0000-0000-0000-00000000\""), - // Properties: &armnetwork.PublicIPPrefixPropertiesFormat{ - // IPPrefix: to.Ptr("192.168.254.2/30"), - // IPTags: []*armnetwork.IPTag{ - // }, - // PrefixLength: to.Ptr[int32](30), - // ProvisioningState: to.Ptr(armnetwork.ProvisioningStateSucceeded), - // PublicIPAddressVersion: to.Ptr(armnetwork.IPVersionIPv4), - // ResourceGUID: to.Ptr("00000000-0000-0000-0000-00000000"), - // }, - // SKU: &armnetwork.PublicIPPrefixSKU{ - // Name: to.Ptr(armnetwork.PublicIPPrefixSKUNameStandard), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/4883fa5dbf6f2c9093fac8ce334547e9dfac68fa/specification/network/resource-manager/Microsoft.Network/stable/2024-03-01/examples/PublicIpPrefixUpdateTags.json -func ExamplePublicIPPrefixesClient_UpdateTags() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armnetwork.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewPublicIPPrefixesClient().UpdateTags(ctx, "rg1", "test-ipprefix", armnetwork.TagsObject{ - Tags: map[string]*string{ - "tag1": to.Ptr("value1"), - "tag2": to.Ptr("value2"), - }, - }, nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.PublicIPPrefix = armnetwork.PublicIPPrefix{ - // Name: to.Ptr("test-ipprefix"), - // Type: to.Ptr("Microsoft.Network/publicIPPrefixes"), - // ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/publicIPPrefixes/test-ipprefix"), - // Location: to.Ptr("westus"), - // Tags: map[string]*string{ - // "tag1": to.Ptr("value1"), - // "tag2": to.Ptr("value2"), - // }, - // Etag: to.Ptr("W/\"00000000-0000-0000-0000-00000000\""), - // Properties: &armnetwork.PublicIPPrefixPropertiesFormat{ - // IPPrefix: to.Ptr("40.85.154.247/30"), - // IPTags: []*armnetwork.IPTag{ - // }, - // PrefixLength: to.Ptr[int32](30), - // ProvisioningState: to.Ptr(armnetwork.ProvisioningStateSucceeded), - // PublicIPAddressVersion: to.Ptr(armnetwork.IPVersionIPv4), - // ResourceGUID: to.Ptr("00000000-0000-0000-0000-00000000"), - // }, - // SKU: &armnetwork.PublicIPPrefixSKU{ - // Name: to.Ptr(armnetwork.PublicIPPrefixSKUNameStandard), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/4883fa5dbf6f2c9093fac8ce334547e9dfac68fa/specification/network/resource-manager/Microsoft.Network/stable/2024-03-01/examples/PublicIpPrefixListAll.json -func ExamplePublicIPPrefixesClient_NewListAllPager() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armnetwork.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := clientFactory.NewPublicIPPrefixesClient().NewListAllPager(nil) - for pager.More() { - page, err := pager.NextPage(ctx) - if err != nil { - log.Fatalf("failed to advance page: %v", err) - } - for _, v := range page.Value { - // You could use page here. We use blank identifier for just demo purposes. - _ = v - } - // If the HTTP response code is 200 as defined in example definition, your page structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // page.PublicIPPrefixListResult = armnetwork.PublicIPPrefixListResult{ - // Value: []*armnetwork.PublicIPPrefix{ - // { - // Name: to.Ptr("test-ipprefix"), - // Type: to.Ptr("Microsoft.Network/publicIPPrefixes"), - // ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/publicIPPrefixes/test-ipprefix"), - // Location: to.Ptr("westus"), - // Etag: to.Ptr("W/\"00000000-0000-0000-0000-00000000\""), - // Properties: &armnetwork.PublicIPPrefixPropertiesFormat{ - // IPPrefix: to.Ptr("41.85.154.247/30"), - // IPTags: []*armnetwork.IPTag{ - // }, - // PrefixLength: to.Ptr[int32](30), - // ProvisioningState: to.Ptr(armnetwork.ProvisioningStateSucceeded), - // PublicIPAddressVersion: to.Ptr(armnetwork.IPVersionIPv4), - // PublicIPAddresses: []*armnetwork.ReferencedPublicIPAddress{ - // { - // ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/publicIPAddresses/PublicIpAddress1"), - // }}, - // ResourceGUID: to.Ptr("00000000-0000-0000-0000-00000000"), - // }, - // SKU: &armnetwork.PublicIPPrefixSKU{ - // Name: to.Ptr(armnetwork.PublicIPPrefixSKUNameStandard), - // }, - // }, - // { - // Name: to.Ptr("ipprefix01"), - // Type: to.Ptr("Microsoft.Network/publicIPPrefixes"), - // ID: to.Ptr("/subscriptions/subid/resourceGroups/rg2/providers/Microsoft.Network/publicIPPrefixes/ipprefix01"), - // Location: to.Ptr("westus"), - // Etag: to.Ptr("W/\"00000000-0000-0000-0000-00000000\""), - // Properties: &armnetwork.PublicIPPrefixPropertiesFormat{ - // IPPrefix: to.Ptr("40.85.154.247/30"), - // IPTags: []*armnetwork.IPTag{ - // }, - // PrefixLength: to.Ptr[int32](30), - // ProvisioningState: to.Ptr(armnetwork.ProvisioningStateSucceeded), - // PublicIPAddressVersion: to.Ptr(armnetwork.IPVersionIPv4), - // ResourceGUID: to.Ptr("00000000-0000-0000-0000-00000000"), - // }, - // SKU: &armnetwork.PublicIPPrefixSKU{ - // Name: to.Ptr(armnetwork.PublicIPPrefixSKUNameStandard), - // }, - // }, - // { - // Name: to.Ptr("pfx"), - // Type: to.Ptr("Microsoft.Network/publicIPPrefixes"), - // ID: to.Ptr("/subscriptions/subid/resourceGroups/rg3/providers/Microsoft.Network/publicIPPrefixes/pfx"), - // Location: to.Ptr("westus"), - // Etag: to.Ptr("W/\"00000000-0000-0000-0000-00000000\""), - // Properties: &armnetwork.PublicIPPrefixPropertiesFormat{ - // IPPrefix: to.Ptr("25.101.84.16/30"), - // IPTags: []*armnetwork.IPTag{ - // }, - // LoadBalancerFrontendIPConfiguration: &armnetwork.SubResource{ - // ID: to.Ptr("/subscriptions/subid/resourceGroups/rg3/providers/Microsoft.Network/loadBalancers/lb-pfx/frontendIPConfigurations/ipconfig1"), - // }, - // PrefixLength: to.Ptr[int32](30), - // ProvisioningState: to.Ptr(armnetwork.ProvisioningStateSucceeded), - // PublicIPAddressVersion: to.Ptr(armnetwork.IPVersionIPv4), - // ResourceGUID: to.Ptr("00000000-0000-0000-0000-00000000"), - // }, - // SKU: &armnetwork.PublicIPPrefixSKU{ - // Name: to.Ptr(armnetwork.PublicIPPrefixSKUNameStandard), - // }, - // }}, - // } - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/4883fa5dbf6f2c9093fac8ce334547e9dfac68fa/specification/network/resource-manager/Microsoft.Network/stable/2024-03-01/examples/PublicIpPrefixList.json -func ExamplePublicIPPrefixesClient_NewListPager() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armnetwork.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := clientFactory.NewPublicIPPrefixesClient().NewListPager("rg1", nil) - for pager.More() { - page, err := pager.NextPage(ctx) - if err != nil { - log.Fatalf("failed to advance page: %v", err) - } - for _, v := range page.Value { - // You could use page here. We use blank identifier for just demo purposes. - _ = v - } - // If the HTTP response code is 200 as defined in example definition, your page structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // page.PublicIPPrefixListResult = armnetwork.PublicIPPrefixListResult{ - // Value: []*armnetwork.PublicIPPrefix{ - // { - // Name: to.Ptr("test-ipprefix"), - // Type: to.Ptr("Microsoft.Network/publicIPPrefixes"), - // ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/publicIPPrefixes/test-ipprefix"), - // Location: to.Ptr("westus"), - // Etag: to.Ptr("W/\"00000000-0000-0000-0000-00000000\""), - // Properties: &armnetwork.PublicIPPrefixPropertiesFormat{ - // IPPrefix: to.Ptr("40.85.154.2/30"), - // IPTags: []*armnetwork.IPTag{ - // { - // IPTagType: to.Ptr("FirstPartyUsage"), - // Tag: to.Ptr("SQL"), - // }}, - // PrefixLength: to.Ptr[int32](30), - // ProvisioningState: to.Ptr(armnetwork.ProvisioningStateSucceeded), - // PublicIPAddressVersion: to.Ptr(armnetwork.IPVersionIPv4), - // ResourceGUID: to.Ptr("00000000-0000-0000-0000-00000000"), - // }, - // SKU: &armnetwork.PublicIPPrefixSKU{ - // Name: to.Ptr(armnetwork.PublicIPPrefixSKUNameStandard), - // }, - // }, - // { - // Name: to.Ptr("ipprefix03"), - // Type: to.Ptr("Microsoft.Network/publicIPPrefixes"), - // ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/publicIPPrefixes/ipprefix03"), - // Location: to.Ptr("westus"), - // Etag: to.Ptr("W/\"00000000-0000-0000-0000-00000000\""), - // Properties: &armnetwork.PublicIPPrefixPropertiesFormat{ - // IPPrefix: to.Ptr("40.85.153.2/31"), - // IPTags: []*armnetwork.IPTag{ - // }, - // PrefixLength: to.Ptr[int32](31), - // ProvisioningState: to.Ptr(armnetwork.ProvisioningStateSucceeded), - // PublicIPAddressVersion: to.Ptr(armnetwork.IPVersionIPv4), - // ResourceGUID: to.Ptr("00000000-0000-0000-0000-00000000"), - // }, - // SKU: &armnetwork.PublicIPPrefixSKU{ - // Name: to.Ptr(armnetwork.PublicIPPrefixSKUNameStandard), - // }, - // }}, - // } - } -} diff --git a/sdk/resourcemanager/network/armnetwork/resourcenavigationlinks_client_example_test.go b/sdk/resourcemanager/network/armnetwork/resourcenavigationlinks_client_example_test.go deleted file mode 100644 index 1c591df914e2..000000000000 --- a/sdk/resourcemanager/network/armnetwork/resourcenavigationlinks_client_example_test.go +++ /dev/null @@ -1,52 +0,0 @@ -//go:build go1.18 -// +build go1.18 - -// 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. -// DO NOT EDIT. - -package armnetwork_test - -import ( - "context" - "log" - - "github.com/Azure/azure-sdk-for-go/sdk/azidentity" - "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/network/armnetwork/v6" -) - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/4883fa5dbf6f2c9093fac8ce334547e9dfac68fa/specification/network/resource-manager/Microsoft.Network/stable/2024-03-01/examples/VirtualNetworkGetResourceNavigationLinks.json -func ExampleResourceNavigationLinksClient_List() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armnetwork.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewResourceNavigationLinksClient().List(ctx, "rg1", "vnet", "subnet", nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.ResourceNavigationLinksListResult = armnetwork.ResourceNavigationLinksListResult{ - // Value: []*armnetwork.ResourceNavigationLink{ - // { - // ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/virtualNetworks/vnet/subnets/subnet/resourceNavigationLinks/redisCache_redis-tester"), - // Name: to.Ptr("redisCache_redis-tester"), - // Type: to.Ptr("Microsoft.Network/virtualNetworks/subnets/resourceNavigationLinks"), - // Etag: to.Ptr("W/\"00000000-0000-0000-0000-000000000000\""), - // Properties: &armnetwork.ResourceNavigationLinkFormat{ - // Link: to.Ptr("/subscriptions/subid/resourceGroups/another-rg/providers/Microsoft.Cache/Redis/redis-tester"), - // LinkedResourceType: to.Ptr("Microsoft.Cache/redis"), - // ProvisioningState: to.Ptr(armnetwork.ProvisioningStateSucceeded), - // }, - // }}, - // } -} diff --git a/sdk/resourcemanager/network/armnetwork/routefilterrules_client_example_test.go b/sdk/resourcemanager/network/armnetwork/routefilterrules_client_example_test.go deleted file mode 100644 index 178707abaf03..000000000000 --- a/sdk/resourcemanager/network/armnetwork/routefilterrules_client_example_test.go +++ /dev/null @@ -1,159 +0,0 @@ -//go:build go1.18 -// +build go1.18 - -// 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. -// DO NOT EDIT. - -package armnetwork_test - -import ( - "context" - "log" - - "github.com/Azure/azure-sdk-for-go/sdk/azcore/to" - "github.com/Azure/azure-sdk-for-go/sdk/azidentity" - "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/network/armnetwork/v6" -) - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/4883fa5dbf6f2c9093fac8ce334547e9dfac68fa/specification/network/resource-manager/Microsoft.Network/stable/2024-03-01/examples/RouteFilterRuleDelete.json -func ExampleRouteFilterRulesClient_BeginDelete() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armnetwork.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewRouteFilterRulesClient().BeginDelete(ctx, "rg1", "filterName", "ruleName", nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - _, err = poller.PollUntilDone(ctx, nil) - if err != nil { - log.Fatalf("failed to pull the result: %v", err) - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/4883fa5dbf6f2c9093fac8ce334547e9dfac68fa/specification/network/resource-manager/Microsoft.Network/stable/2024-03-01/examples/RouteFilterRuleGet.json -func ExampleRouteFilterRulesClient_Get() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armnetwork.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewRouteFilterRulesClient().Get(ctx, "rg1", "filterName", "filterName", nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.RouteFilterRule = armnetwork.RouteFilterRule{ - // ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/routeFilters/filterName/routeFilterRules/ruleName"), - // Name: to.Ptr("ruleName"), - // Etag: to.Ptr("w/\\00000000-0000-0000-0000-000000000000\\"), - // Properties: &armnetwork.RouteFilterRulePropertiesFormat{ - // Access: to.Ptr(armnetwork.AccessAllow), - // Communities: []*string{ - // to.Ptr("12076:5030"), - // to.Ptr("12076:5040")}, - // ProvisioningState: to.Ptr(armnetwork.ProvisioningStateSucceeded), - // RouteFilterRuleType: to.Ptr(armnetwork.RouteFilterRuleTypeCommunity), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/4883fa5dbf6f2c9093fac8ce334547e9dfac68fa/specification/network/resource-manager/Microsoft.Network/stable/2024-03-01/examples/RouteFilterRuleCreate.json -func ExampleRouteFilterRulesClient_BeginCreateOrUpdate() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armnetwork.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewRouteFilterRulesClient().BeginCreateOrUpdate(ctx, "rg1", "filterName", "ruleName", armnetwork.RouteFilterRule{ - Properties: &armnetwork.RouteFilterRulePropertiesFormat{ - Access: to.Ptr(armnetwork.AccessAllow), - Communities: []*string{ - to.Ptr("12076:5030"), - to.Ptr("12076:5040")}, - RouteFilterRuleType: to.Ptr(armnetwork.RouteFilterRuleTypeCommunity), - }, - }, nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - res, err := poller.PollUntilDone(ctx, nil) - if err != nil { - log.Fatalf("failed to pull the result: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.RouteFilterRule = armnetwork.RouteFilterRule{ - // ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/routeFilters/filterName/routeFilterRules/ruleName"), - // Name: to.Ptr("ruleName"), - // Etag: to.Ptr("w/\\00000000-0000-0000-0000-000000000000\\"), - // Properties: &armnetwork.RouteFilterRulePropertiesFormat{ - // Access: to.Ptr(armnetwork.AccessAllow), - // Communities: []*string{ - // to.Ptr("12076:5030"), - // to.Ptr("12076:5040")}, - // ProvisioningState: to.Ptr(armnetwork.ProvisioningStateSucceeded), - // RouteFilterRuleType: to.Ptr(armnetwork.RouteFilterRuleTypeCommunity), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/4883fa5dbf6f2c9093fac8ce334547e9dfac68fa/specification/network/resource-manager/Microsoft.Network/stable/2024-03-01/examples/RouteFilterRuleListByRouteFilter.json -func ExampleRouteFilterRulesClient_NewListByRouteFilterPager() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armnetwork.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := clientFactory.NewRouteFilterRulesClient().NewListByRouteFilterPager("rg1", "filterName", nil) - for pager.More() { - page, err := pager.NextPage(ctx) - if err != nil { - log.Fatalf("failed to advance page: %v", err) - } - for _, v := range page.Value { - // You could use page here. We use blank identifier for just demo purposes. - _ = v - } - // If the HTTP response code is 200 as defined in example definition, your page structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // page.RouteFilterRuleListResult = armnetwork.RouteFilterRuleListResult{ - // Value: []*armnetwork.RouteFilterRule{ - // { - // ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/routeFilters/filterName/routeFilterRules/ruleName"), - // Name: to.Ptr("ruleName"), - // Etag: to.Ptr("w/\\00000000-0000-0000-0000-000000000000\\"), - // Properties: &armnetwork.RouteFilterRulePropertiesFormat{ - // Access: to.Ptr(armnetwork.AccessAllow), - // Communities: []*string{ - // to.Ptr("12076:5030"), - // to.Ptr("12076:5040")}, - // ProvisioningState: to.Ptr(armnetwork.ProvisioningStateSucceeded), - // RouteFilterRuleType: to.Ptr(armnetwork.RouteFilterRuleTypeCommunity), - // }, - // }}, - // } - } -} diff --git a/sdk/resourcemanager/network/armnetwork/routefilters_client_example_test.go b/sdk/resourcemanager/network/armnetwork/routefilters_client_example_test.go deleted file mode 100644 index 344ee3c5c778..000000000000 --- a/sdk/resourcemanager/network/armnetwork/routefilters_client_example_test.go +++ /dev/null @@ -1,326 +0,0 @@ -//go:build go1.18 -// +build go1.18 - -// 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. -// DO NOT EDIT. - -package armnetwork_test - -import ( - "context" - "log" - - "github.com/Azure/azure-sdk-for-go/sdk/azcore/to" - "github.com/Azure/azure-sdk-for-go/sdk/azidentity" - "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/network/armnetwork/v6" -) - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/4883fa5dbf6f2c9093fac8ce334547e9dfac68fa/specification/network/resource-manager/Microsoft.Network/stable/2024-03-01/examples/RouteFilterDelete.json -func ExampleRouteFiltersClient_BeginDelete() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armnetwork.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewRouteFiltersClient().BeginDelete(ctx, "rg1", "filterName", nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - _, err = poller.PollUntilDone(ctx, nil) - if err != nil { - log.Fatalf("failed to pull the result: %v", err) - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/4883fa5dbf6f2c9093fac8ce334547e9dfac68fa/specification/network/resource-manager/Microsoft.Network/stable/2024-03-01/examples/RouteFilterGet.json -func ExampleRouteFiltersClient_Get() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armnetwork.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewRouteFiltersClient().Get(ctx, "rg1", "filterName", &armnetwork.RouteFiltersClientGetOptions{Expand: nil}) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.RouteFilter = armnetwork.RouteFilter{ - // Name: to.Ptr("filterName"), - // Type: to.Ptr("Microsoft.Network/routeFilters"), - // ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/routeFilters/filterName"), - // Location: to.Ptr("West US"), - // Tags: map[string]*string{ - // "key1": to.Ptr("value1"), - // }, - // Etag: to.Ptr("w/\\00000000-0000-0000-0000-000000000000\\"), - // Properties: &armnetwork.RouteFilterPropertiesFormat{ - // Peerings: []*armnetwork.ExpressRouteCircuitPeering{ - // }, - // ProvisioningState: to.Ptr(armnetwork.ProvisioningStateSucceeded), - // Rules: []*armnetwork.RouteFilterRule{ - // { - // ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/routeFilters/filterName/routeFilterRules/ruleName"), - // Name: to.Ptr("ruleName"), - // Etag: to.Ptr("w/\\00000000-0000-0000-0000-000000000000\\"), - // Properties: &armnetwork.RouteFilterRulePropertiesFormat{ - // Access: to.Ptr(armnetwork.AccessAllow), - // Communities: []*string{ - // to.Ptr("12076:5030"), - // to.Ptr("12076:5040")}, - // ProvisioningState: to.Ptr(armnetwork.ProvisioningStateSucceeded), - // RouteFilterRuleType: to.Ptr(armnetwork.RouteFilterRuleTypeCommunity), - // }, - // }}, - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/4883fa5dbf6f2c9093fac8ce334547e9dfac68fa/specification/network/resource-manager/Microsoft.Network/stable/2024-03-01/examples/RouteFilterCreate.json -func ExampleRouteFiltersClient_BeginCreateOrUpdate() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armnetwork.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewRouteFiltersClient().BeginCreateOrUpdate(ctx, "rg1", "filterName", armnetwork.RouteFilter{ - Location: to.Ptr("West US"), - Tags: map[string]*string{ - "key1": to.Ptr("value1"), - }, - Properties: &armnetwork.RouteFilterPropertiesFormat{ - Rules: []*armnetwork.RouteFilterRule{ - { - Name: to.Ptr("ruleName"), - Properties: &armnetwork.RouteFilterRulePropertiesFormat{ - Access: to.Ptr(armnetwork.AccessAllow), - Communities: []*string{ - to.Ptr("12076:5030"), - to.Ptr("12076:5040")}, - RouteFilterRuleType: to.Ptr(armnetwork.RouteFilterRuleTypeCommunity), - }, - }}, - }, - }, nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - res, err := poller.PollUntilDone(ctx, nil) - if err != nil { - log.Fatalf("failed to pull the result: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.RouteFilter = armnetwork.RouteFilter{ - // Name: to.Ptr("filterName"), - // Type: to.Ptr("Microsoft.Network/routeFilters"), - // ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/routeFilters/filterName"), - // Location: to.Ptr("West US"), - // Tags: map[string]*string{ - // "key1": to.Ptr("value1"), - // }, - // Etag: to.Ptr("w/\\00000000-0000-0000-0000-000000000000\\"), - // Properties: &armnetwork.RouteFilterPropertiesFormat{ - // Peerings: []*armnetwork.ExpressRouteCircuitPeering{ - // }, - // ProvisioningState: to.Ptr(armnetwork.ProvisioningStateSucceeded), - // Rules: []*armnetwork.RouteFilterRule{ - // { - // ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/routeFilters/filterName/routeFilterRules/ruleName"), - // Name: to.Ptr("ruleName"), - // Etag: to.Ptr("w/\\00000000-0000-0000-0000-000000000000\\"), - // Properties: &armnetwork.RouteFilterRulePropertiesFormat{ - // Access: to.Ptr(armnetwork.AccessAllow), - // Communities: []*string{ - // to.Ptr("12076:5030"), - // to.Ptr("12076:5040")}, - // ProvisioningState: to.Ptr(armnetwork.ProvisioningStateSucceeded), - // RouteFilterRuleType: to.Ptr(armnetwork.RouteFilterRuleTypeCommunity), - // }, - // }}, - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/4883fa5dbf6f2c9093fac8ce334547e9dfac68fa/specification/network/resource-manager/Microsoft.Network/stable/2024-03-01/examples/RouteFilterUpdateTags.json -func ExampleRouteFiltersClient_UpdateTags() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armnetwork.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewRouteFiltersClient().UpdateTags(ctx, "rg1", "filterName", armnetwork.TagsObject{ - Tags: map[string]*string{ - "key1": to.Ptr("value1"), - }, - }, nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.RouteFilter = armnetwork.RouteFilter{ - // Name: to.Ptr("filterName"), - // Type: to.Ptr("Microsoft.Network/routeFilters"), - // ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/routeFilters/filterName"), - // Location: to.Ptr("West US"), - // Tags: map[string]*string{ - // "key1": to.Ptr("value1"), - // }, - // Etag: to.Ptr("w/\\00000000-0000-0000-0000-000000000000\\"), - // Properties: &armnetwork.RouteFilterPropertiesFormat{ - // Peerings: []*armnetwork.ExpressRouteCircuitPeering{ - // }, - // ProvisioningState: to.Ptr(armnetwork.ProvisioningStateSucceeded), - // Rules: []*armnetwork.RouteFilterRule{ - // { - // ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/routeFilters/filterName/routeFilterRules/ruleName"), - // Name: to.Ptr("ruleName"), - // Etag: to.Ptr("w/\\00000000-0000-0000-0000-000000000000\\"), - // Properties: &armnetwork.RouteFilterRulePropertiesFormat{ - // Access: to.Ptr(armnetwork.AccessAllow), - // Communities: []*string{ - // to.Ptr("12076:5030")}, - // ProvisioningState: to.Ptr(armnetwork.ProvisioningStateSucceeded), - // RouteFilterRuleType: to.Ptr(armnetwork.RouteFilterRuleTypeCommunity), - // }, - // }}, - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/4883fa5dbf6f2c9093fac8ce334547e9dfac68fa/specification/network/resource-manager/Microsoft.Network/stable/2024-03-01/examples/RouteFilterListByResourceGroup.json -func ExampleRouteFiltersClient_NewListByResourceGroupPager() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armnetwork.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := clientFactory.NewRouteFiltersClient().NewListByResourceGroupPager("rg1", nil) - for pager.More() { - page, err := pager.NextPage(ctx) - if err != nil { - log.Fatalf("failed to advance page: %v", err) - } - for _, v := range page.Value { - // You could use page here. We use blank identifier for just demo purposes. - _ = v - } - // If the HTTP response code is 200 as defined in example definition, your page structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // page.RouteFilterListResult = armnetwork.RouteFilterListResult{ - // Value: []*armnetwork.RouteFilter{ - // { - // Name: to.Ptr("filterName"), - // Type: to.Ptr("Microsoft.Network/routeFilters"), - // ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/routeFilters/filterName"), - // Location: to.Ptr("West US"), - // Tags: map[string]*string{ - // "key1": to.Ptr("value1"), - // }, - // Etag: to.Ptr("w/\\00000000-0000-0000-0000-000000000000\\"), - // Properties: &armnetwork.RouteFilterPropertiesFormat{ - // Peerings: []*armnetwork.ExpressRouteCircuitPeering{ - // }, - // ProvisioningState: to.Ptr(armnetwork.ProvisioningStateSucceeded), - // Rules: []*armnetwork.RouteFilterRule{ - // { - // ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/routeFilters/filterName/routeFilterRules/ruleName"), - // Name: to.Ptr("ruleName"), - // Etag: to.Ptr("w/\\00000000-0000-0000-0000-000000000000\\"), - // Properties: &armnetwork.RouteFilterRulePropertiesFormat{ - // Access: to.Ptr(armnetwork.AccessAllow), - // Communities: []*string{ - // to.Ptr("12076:5030"), - // to.Ptr("12076:5040")}, - // ProvisioningState: to.Ptr(armnetwork.ProvisioningStateSucceeded), - // RouteFilterRuleType: to.Ptr(armnetwork.RouteFilterRuleTypeCommunity), - // }, - // }}, - // }, - // }}, - // } - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/4883fa5dbf6f2c9093fac8ce334547e9dfac68fa/specification/network/resource-manager/Microsoft.Network/stable/2024-03-01/examples/RouteFilterList.json -func ExampleRouteFiltersClient_NewListPager() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armnetwork.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := clientFactory.NewRouteFiltersClient().NewListPager(nil) - for pager.More() { - page, err := pager.NextPage(ctx) - if err != nil { - log.Fatalf("failed to advance page: %v", err) - } - for _, v := range page.Value { - // You could use page here. We use blank identifier for just demo purposes. - _ = v - } - // If the HTTP response code is 200 as defined in example definition, your page structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // page.RouteFilterListResult = armnetwork.RouteFilterListResult{ - // Value: []*armnetwork.RouteFilter{ - // { - // Name: to.Ptr("filterName"), - // Type: to.Ptr("Microsoft.Network/routeFilters"), - // ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/routeFilters/filterName"), - // Location: to.Ptr("West US"), - // Tags: map[string]*string{ - // "key1": to.Ptr("value1"), - // }, - // Etag: to.Ptr("w/\\00000000-0000-0000-0000-000000000000\\"), - // Properties: &armnetwork.RouteFilterPropertiesFormat{ - // Peerings: []*armnetwork.ExpressRouteCircuitPeering{ - // }, - // ProvisioningState: to.Ptr(armnetwork.ProvisioningStateSucceeded), - // Rules: []*armnetwork.RouteFilterRule{ - // { - // ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/routeFilters/filterName/routeFilterRules/ruleName"), - // Name: to.Ptr("ruleName"), - // Etag: to.Ptr("w/\\00000000-0000-0000-0000-000000000000\\"), - // Properties: &armnetwork.RouteFilterRulePropertiesFormat{ - // Access: to.Ptr(armnetwork.AccessAllow), - // Communities: []*string{ - // to.Ptr("12076:5030"), - // to.Ptr("12076:5040")}, - // ProvisioningState: to.Ptr(armnetwork.ProvisioningStateSucceeded), - // RouteFilterRuleType: to.Ptr(armnetwork.RouteFilterRuleTypeCommunity), - // }, - // }}, - // }, - // }}, - // } - } -} diff --git a/sdk/resourcemanager/network/armnetwork/routemaps_client_example_test.go b/sdk/resourcemanager/network/armnetwork/routemaps_client_example_test.go deleted file mode 100644 index 7f5dcfee9110..000000000000 --- a/sdk/resourcemanager/network/armnetwork/routemaps_client_example_test.go +++ /dev/null @@ -1,265 +0,0 @@ -//go:build go1.18 -// +build go1.18 - -// 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. -// DO NOT EDIT. - -package armnetwork_test - -import ( - "context" - "log" - - "github.com/Azure/azure-sdk-for-go/sdk/azcore/to" - "github.com/Azure/azure-sdk-for-go/sdk/azidentity" - "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/network/armnetwork/v6" -) - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/4883fa5dbf6f2c9093fac8ce334547e9dfac68fa/specification/network/resource-manager/Microsoft.Network/stable/2024-03-01/examples/RouteMapGet.json -func ExampleRouteMapsClient_Get() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armnetwork.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewRouteMapsClient().Get(ctx, "rg1", "virtualHub1", "routeMap1", nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.RouteMap = armnetwork.RouteMap{ - // ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/virtualHubs/virtualHub1/routeMaps/routeMap1"), - // Name: to.Ptr("routeMap1"), - // Type: to.Ptr("Microsoft.Network/virtualHubs/routeMaps"), - // Etag: to.Ptr("W/\"e203e953-7ba7-4302-a246-aa2ec03f6edf\""), - // Properties: &armnetwork.RouteMapProperties{ - // AssociatedInboundConnections: []*string{ - // to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/expressRouteGateways/exrGateway1/expressRouteConnections/exrConn1")}, - // AssociatedOutboundConnections: []*string{ - // }, - // ProvisioningState: to.Ptr(armnetwork.ProvisioningStateSucceeded), - // Rules: []*armnetwork.RouteMapRule{ - // { - // Name: to.Ptr("rule1"), - // Actions: []*armnetwork.Action{ - // { - // Type: to.Ptr(armnetwork.RouteMapActionTypeAdd), - // Parameters: []*armnetwork.Parameter{ - // { - // AsPath: []*string{ - // to.Ptr("22334")}, - // Community: []*string{ - // }, - // RoutePrefix: []*string{ - // }, - // }}, - // }}, - // MatchCriteria: []*armnetwork.Criterion{ - // { - // AsPath: []*string{ - // }, - // Community: []*string{ - // }, - // MatchCondition: to.Ptr(armnetwork.RouteMapMatchConditionContains), - // RoutePrefix: []*string{ - // to.Ptr("10.0.0.0/8")}, - // }}, - // NextStepIfMatched: to.Ptr(armnetwork.NextStepContinue), - // }}, - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/4883fa5dbf6f2c9093fac8ce334547e9dfac68fa/specification/network/resource-manager/Microsoft.Network/stable/2024-03-01/examples/RouteMapPut.json -func ExampleRouteMapsClient_BeginCreateOrUpdate() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armnetwork.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewRouteMapsClient().BeginCreateOrUpdate(ctx, "rg1", "virtualHub1", "routeMap1", armnetwork.RouteMap{ - Properties: &armnetwork.RouteMapProperties{ - AssociatedInboundConnections: []*string{ - to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/expressRouteGateways/exrGateway1/expressRouteConnections/exrConn1")}, - AssociatedOutboundConnections: []*string{}, - Rules: []*armnetwork.RouteMapRule{ - { - Name: to.Ptr("rule1"), - Actions: []*armnetwork.Action{ - { - Type: to.Ptr(armnetwork.RouteMapActionTypeAdd), - Parameters: []*armnetwork.Parameter{ - { - AsPath: []*string{ - to.Ptr("22334")}, - Community: []*string{}, - RoutePrefix: []*string{}, - }}, - }}, - MatchCriteria: []*armnetwork.Criterion{ - { - AsPath: []*string{}, - Community: []*string{}, - MatchCondition: to.Ptr(armnetwork.RouteMapMatchConditionContains), - RoutePrefix: []*string{ - to.Ptr("10.0.0.0/8")}, - }}, - NextStepIfMatched: to.Ptr(armnetwork.NextStepContinue), - }}, - }, - }, nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - res, err := poller.PollUntilDone(ctx, nil) - if err != nil { - log.Fatalf("failed to pull the result: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.RouteMap = armnetwork.RouteMap{ - // ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/virtualHubs/virtualHub1/routeMaps/routeMap1"), - // Name: to.Ptr("routeMap1"), - // Type: to.Ptr("Microsoft.Network/virtualHubs/routeMaps"), - // Etag: to.Ptr("W/\\00000000-0000-0000-0000-000000000000\\"), - // Properties: &armnetwork.RouteMapProperties{ - // AssociatedInboundConnections: []*string{ - // to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/expressRouteGateways/exrGateway1/expressRouteConnections/exrConn1")}, - // AssociatedOutboundConnections: []*string{ - // }, - // ProvisioningState: to.Ptr(armnetwork.ProvisioningStateSucceeded), - // Rules: []*armnetwork.RouteMapRule{ - // { - // Name: to.Ptr("rule1"), - // Actions: []*armnetwork.Action{ - // { - // Type: to.Ptr(armnetwork.RouteMapActionTypeAdd), - // Parameters: []*armnetwork.Parameter{ - // { - // AsPath: []*string{ - // to.Ptr("22334")}, - // Community: []*string{ - // }, - // RoutePrefix: []*string{ - // }, - // }}, - // }}, - // MatchCriteria: []*armnetwork.Criterion{ - // { - // AsPath: []*string{ - // }, - // Community: []*string{ - // }, - // MatchCondition: to.Ptr(armnetwork.RouteMapMatchConditionContains), - // RoutePrefix: []*string{ - // to.Ptr("10.0.0.0/8")}, - // }}, - // NextStepIfMatched: to.Ptr(armnetwork.NextStepContinue), - // }}, - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/4883fa5dbf6f2c9093fac8ce334547e9dfac68fa/specification/network/resource-manager/Microsoft.Network/stable/2024-03-01/examples/RouteMapDelete.json -func ExampleRouteMapsClient_BeginDelete() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armnetwork.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewRouteMapsClient().BeginDelete(ctx, "rg1", "virtualHub1", "routeMap1", nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - _, err = poller.PollUntilDone(ctx, nil) - if err != nil { - log.Fatalf("failed to pull the result: %v", err) - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/4883fa5dbf6f2c9093fac8ce334547e9dfac68fa/specification/network/resource-manager/Microsoft.Network/stable/2024-03-01/examples/RouteMapList.json -func ExampleRouteMapsClient_NewListPager() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armnetwork.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := clientFactory.NewRouteMapsClient().NewListPager("rg1", "virtualHub1", nil) - for pager.More() { - page, err := pager.NextPage(ctx) - if err != nil { - log.Fatalf("failed to advance page: %v", err) - } - for _, v := range page.Value { - // You could use page here. We use blank identifier for just demo purposes. - _ = v - } - // If the HTTP response code is 200 as defined in example definition, your page structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // page.ListRouteMapsResult = armnetwork.ListRouteMapsResult{ - // Value: []*armnetwork.RouteMap{ - // { - // ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/virtualHubs/virtualHub1/routeMaps/routeMap1"), - // Name: to.Ptr("routeMap1"), - // Type: to.Ptr("Microsoft.Network/virtualHubs/routeMaps"), - // Etag: to.Ptr("W/\\00000000-0000-0000-0000-000000000000\\"), - // Properties: &armnetwork.RouteMapProperties{ - // AssociatedInboundConnections: []*string{ - // to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/expressRouteGateways/exrGateway1/expressRouteConnections/exrConn1")}, - // AssociatedOutboundConnections: []*string{ - // }, - // ProvisioningState: to.Ptr(armnetwork.ProvisioningStateSucceeded), - // Rules: []*armnetwork.RouteMapRule{ - // { - // Name: to.Ptr("rule1"), - // Actions: []*armnetwork.Action{ - // { - // Type: to.Ptr(armnetwork.RouteMapActionTypeAdd), - // Parameters: []*armnetwork.Parameter{ - // { - // AsPath: []*string{ - // to.Ptr("22334")}, - // Community: []*string{ - // }, - // RoutePrefix: []*string{ - // }, - // }}, - // }}, - // MatchCriteria: []*armnetwork.Criterion{ - // { - // AsPath: []*string{ - // }, - // Community: []*string{ - // }, - // MatchCondition: to.Ptr(armnetwork.RouteMapMatchConditionContains), - // RoutePrefix: []*string{ - // to.Ptr("10.0.0.0/8")}, - // }}, - // NextStepIfMatched: to.Ptr(armnetwork.NextStepContinue), - // }}, - // }, - // }}, - // } - } -} diff --git a/sdk/resourcemanager/network/armnetwork/routes_client_example_test.go b/sdk/resourcemanager/network/armnetwork/routes_client_example_test.go deleted file mode 100644 index 109b0a0453bc..000000000000 --- a/sdk/resourcemanager/network/armnetwork/routes_client_example_test.go +++ /dev/null @@ -1,153 +0,0 @@ -//go:build go1.18 -// +build go1.18 - -// 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. -// DO NOT EDIT. - -package armnetwork_test - -import ( - "context" - "log" - - "github.com/Azure/azure-sdk-for-go/sdk/azcore/to" - "github.com/Azure/azure-sdk-for-go/sdk/azidentity" - "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/network/armnetwork/v6" -) - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/4883fa5dbf6f2c9093fac8ce334547e9dfac68fa/specification/network/resource-manager/Microsoft.Network/stable/2024-03-01/examples/RouteTableRouteDelete.json -func ExampleRoutesClient_BeginDelete() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armnetwork.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewRoutesClient().BeginDelete(ctx, "rg1", "testrt", "route1", nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - _, err = poller.PollUntilDone(ctx, nil) - if err != nil { - log.Fatalf("failed to pull the result: %v", err) - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/4883fa5dbf6f2c9093fac8ce334547e9dfac68fa/specification/network/resource-manager/Microsoft.Network/stable/2024-03-01/examples/RouteTableRouteGet.json -func ExampleRoutesClient_Get() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armnetwork.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewRoutesClient().Get(ctx, "rg1", "testrt", "route1", nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.Route = armnetwork.Route{ - // ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/routeTables/testrt/routes/route1"), - // Name: to.Ptr("route1"), - // Properties: &armnetwork.RoutePropertiesFormat{ - // AddressPrefix: to.Ptr("10.0.3.0/24"), - // NextHopType: to.Ptr(armnetwork.RouteNextHopTypeInternet), - // ProvisioningState: to.Ptr(armnetwork.ProvisioningStateSucceeded), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/4883fa5dbf6f2c9093fac8ce334547e9dfac68fa/specification/network/resource-manager/Microsoft.Network/stable/2024-03-01/examples/RouteTableRouteCreate.json -func ExampleRoutesClient_BeginCreateOrUpdate() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armnetwork.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewRoutesClient().BeginCreateOrUpdate(ctx, "rg1", "testrt", "route1", armnetwork.Route{ - Properties: &armnetwork.RoutePropertiesFormat{ - AddressPrefix: to.Ptr("10.0.3.0/24"), - NextHopType: to.Ptr(armnetwork.RouteNextHopTypeVirtualNetworkGateway), - }, - }, nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - res, err := poller.PollUntilDone(ctx, nil) - if err != nil { - log.Fatalf("failed to pull the result: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.Route = armnetwork.Route{ - // ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/routeTables/testrt/routes/route1"), - // Name: to.Ptr("route1"), - // Properties: &armnetwork.RoutePropertiesFormat{ - // AddressPrefix: to.Ptr("10.0.3.0/24"), - // NextHopType: to.Ptr(armnetwork.RouteNextHopTypeVirtualNetworkGateway), - // ProvisioningState: to.Ptr(armnetwork.ProvisioningStateSucceeded), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/4883fa5dbf6f2c9093fac8ce334547e9dfac68fa/specification/network/resource-manager/Microsoft.Network/stable/2024-03-01/examples/RouteTableRouteList.json -func ExampleRoutesClient_NewListPager() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armnetwork.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := clientFactory.NewRoutesClient().NewListPager("rg1", "testrt", nil) - for pager.More() { - page, err := pager.NextPage(ctx) - if err != nil { - log.Fatalf("failed to advance page: %v", err) - } - for _, v := range page.Value { - // You could use page here. We use blank identifier for just demo purposes. - _ = v - } - // If the HTTP response code is 200 as defined in example definition, your page structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // page.RouteListResult = armnetwork.RouteListResult{ - // Value: []*armnetwork.Route{ - // { - // ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/routeTables/testrt/routes/route1"), - // Name: to.Ptr("route1"), - // Properties: &armnetwork.RoutePropertiesFormat{ - // AddressPrefix: to.Ptr("10.0.3.0/24"), - // NextHopType: to.Ptr(armnetwork.RouteNextHopTypeInternet), - // ProvisioningState: to.Ptr(armnetwork.ProvisioningStateSucceeded), - // }, - // }, - // { - // ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/routeTables/testrt/routes/route2"), - // Name: to.Ptr("route2"), - // Properties: &armnetwork.RoutePropertiesFormat{ - // AddressPrefix: to.Ptr("10.0.2.0/24"), - // NextHopType: to.Ptr(armnetwork.RouteNextHopTypeVirtualNetworkGateway), - // ProvisioningState: to.Ptr(armnetwork.ProvisioningStateSucceeded), - // }, - // }}, - // } - } -} diff --git a/sdk/resourcemanager/network/armnetwork/routetables_client_example_test.go b/sdk/resourcemanager/network/armnetwork/routetables_client_example_test.go deleted file mode 100644 index 64a41cbd5baf..000000000000 --- a/sdk/resourcemanager/network/armnetwork/routetables_client_example_test.go +++ /dev/null @@ -1,333 +0,0 @@ -//go:build go1.18 -// +build go1.18 - -// 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. -// DO NOT EDIT. - -package armnetwork_test - -import ( - "context" - "log" - - "github.com/Azure/azure-sdk-for-go/sdk/azcore/to" - "github.com/Azure/azure-sdk-for-go/sdk/azidentity" - "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/network/armnetwork/v6" -) - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/4883fa5dbf6f2c9093fac8ce334547e9dfac68fa/specification/network/resource-manager/Microsoft.Network/stable/2024-03-01/examples/RouteTableDelete.json -func ExampleRouteTablesClient_BeginDelete() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armnetwork.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewRouteTablesClient().BeginDelete(ctx, "rg1", "testrt", nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - _, err = poller.PollUntilDone(ctx, nil) - if err != nil { - log.Fatalf("failed to pull the result: %v", err) - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/4883fa5dbf6f2c9093fac8ce334547e9dfac68fa/specification/network/resource-manager/Microsoft.Network/stable/2024-03-01/examples/RouteTableGet.json -func ExampleRouteTablesClient_Get() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armnetwork.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewRouteTablesClient().Get(ctx, "rg1", "testrt", &armnetwork.RouteTablesClientGetOptions{Expand: nil}) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.RouteTable = armnetwork.RouteTable{ - // Name: to.Ptr("testrt"), - // Type: to.Ptr("Microsoft.Network/routeTables"), - // ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/routeTables/testrt"), - // Location: to.Ptr("westus"), - // Properties: &armnetwork.RouteTablePropertiesFormat{ - // DisableBgpRoutePropagation: to.Ptr(false), - // ProvisioningState: to.Ptr(armnetwork.ProvisioningStateSucceeded), - // Routes: []*armnetwork.Route{ - // { - // ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/routeTables/testrt/routes/route1"), - // Name: to.Ptr("route1"), - // Properties: &armnetwork.RoutePropertiesFormat{ - // AddressPrefix: to.Ptr("10.0.3.0/24"), - // NextHopType: to.Ptr(armnetwork.RouteNextHopTypeVirtualNetworkGateway), - // ProvisioningState: to.Ptr(armnetwork.ProvisioningStateSucceeded), - // }, - // }}, - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/4883fa5dbf6f2c9093fac8ce334547e9dfac68fa/specification/network/resource-manager/Microsoft.Network/stable/2024-03-01/examples/RouteTableCreate.json -func ExampleRouteTablesClient_BeginCreateOrUpdate_createRouteTable() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armnetwork.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewRouteTablesClient().BeginCreateOrUpdate(ctx, "rg1", "testrt", armnetwork.RouteTable{ - Location: to.Ptr("westus"), - }, nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - res, err := poller.PollUntilDone(ctx, nil) - if err != nil { - log.Fatalf("failed to pull the result: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.RouteTable = armnetwork.RouteTable{ - // Name: to.Ptr("testrt"), - // Type: to.Ptr("Microsoft.Network/routeTables"), - // ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/routeTables/testrt"), - // Location: to.Ptr("westus"), - // Properties: &armnetwork.RouteTablePropertiesFormat{ - // DisableBgpRoutePropagation: to.Ptr(true), - // ProvisioningState: to.Ptr(armnetwork.ProvisioningStateSucceeded), - // Routes: []*armnetwork.Route{ - // }, - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/4883fa5dbf6f2c9093fac8ce334547e9dfac68fa/specification/network/resource-manager/Microsoft.Network/stable/2024-03-01/examples/RouteTableCreateWithRoute.json -func ExampleRouteTablesClient_BeginCreateOrUpdate_createRouteTableWithRoute() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armnetwork.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewRouteTablesClient().BeginCreateOrUpdate(ctx, "rg1", "testrt", armnetwork.RouteTable{ - Location: to.Ptr("westus"), - Properties: &armnetwork.RouteTablePropertiesFormat{ - DisableBgpRoutePropagation: to.Ptr(true), - Routes: []*armnetwork.Route{ - { - Name: to.Ptr("route1"), - Properties: &armnetwork.RoutePropertiesFormat{ - AddressPrefix: to.Ptr("10.0.3.0/24"), - NextHopType: to.Ptr(armnetwork.RouteNextHopTypeVirtualNetworkGateway), - }, - }}, - }, - }, nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - res, err := poller.PollUntilDone(ctx, nil) - if err != nil { - log.Fatalf("failed to pull the result: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.RouteTable = armnetwork.RouteTable{ - // Name: to.Ptr("testrt"), - // Type: to.Ptr("Microsoft.Network/routeTables"), - // ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/routeTables/testrt"), - // Location: to.Ptr("westus"), - // Properties: &armnetwork.RouteTablePropertiesFormat{ - // DisableBgpRoutePropagation: to.Ptr(true), - // ProvisioningState: to.Ptr(armnetwork.ProvisioningStateSucceeded), - // Routes: []*armnetwork.Route{ - // { - // ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/routeTables/testrt/routes/route1"), - // Name: to.Ptr("route1"), - // Properties: &armnetwork.RoutePropertiesFormat{ - // AddressPrefix: to.Ptr("10.0.3.0/24"), - // NextHopType: to.Ptr(armnetwork.RouteNextHopTypeVirtualNetworkGateway), - // ProvisioningState: to.Ptr(armnetwork.ProvisioningStateSucceeded), - // }, - // }}, - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/4883fa5dbf6f2c9093fac8ce334547e9dfac68fa/specification/network/resource-manager/Microsoft.Network/stable/2024-03-01/examples/RouteTableUpdateTags.json -func ExampleRouteTablesClient_UpdateTags() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armnetwork.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewRouteTablesClient().UpdateTags(ctx, "rg1", "testrt", armnetwork.TagsObject{ - Tags: map[string]*string{ - "tag1": to.Ptr("value1"), - "tag2": to.Ptr("value2"), - }, - }, nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.RouteTable = armnetwork.RouteTable{ - // Name: to.Ptr("testrt"), - // Type: to.Ptr("Microsoft.Network/routeTables"), - // ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/routeTables/testrt"), - // Location: to.Ptr("westus"), - // Tags: map[string]*string{ - // "tag1": to.Ptr("value1"), - // "tag2": to.Ptr("value2"), - // }, - // Properties: &armnetwork.RouteTablePropertiesFormat{ - // ProvisioningState: to.Ptr(armnetwork.ProvisioningStateSucceeded), - // Routes: []*armnetwork.Route{ - // }, - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/4883fa5dbf6f2c9093fac8ce334547e9dfac68fa/specification/network/resource-manager/Microsoft.Network/stable/2024-03-01/examples/RouteTableList.json -func ExampleRouteTablesClient_NewListPager() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armnetwork.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := clientFactory.NewRouteTablesClient().NewListPager("rg1", nil) - for pager.More() { - page, err := pager.NextPage(ctx) - if err != nil { - log.Fatalf("failed to advance page: %v", err) - } - for _, v := range page.Value { - // You could use page here. We use blank identifier for just demo purposes. - _ = v - } - // If the HTTP response code is 200 as defined in example definition, your page structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // page.RouteTableListResult = armnetwork.RouteTableListResult{ - // Value: []*armnetwork.RouteTable{ - // { - // Name: to.Ptr("testrt"), - // Type: to.Ptr("Microsoft.Network/routeTables"), - // ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/routeTables/testrt"), - // Location: to.Ptr("westus"), - // Properties: &armnetwork.RouteTablePropertiesFormat{ - // DisableBgpRoutePropagation: to.Ptr(true), - // ProvisioningState: to.Ptr(armnetwork.ProvisioningStateSucceeded), - // Routes: []*armnetwork.Route{ - // { - // ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/routeTables/testrt/routes/route1"), - // Name: to.Ptr("route1"), - // Properties: &armnetwork.RoutePropertiesFormat{ - // AddressPrefix: to.Ptr("10.0.3.0/24"), - // NextHopType: to.Ptr(armnetwork.RouteNextHopTypeVirtualNetworkGateway), - // ProvisioningState: to.Ptr(armnetwork.ProvisioningStateSucceeded), - // }, - // }}, - // }, - // }, - // { - // Name: to.Ptr("testrt2"), - // Type: to.Ptr("Microsoft.Network/routeTables"), - // ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/routeTables/testrt2"), - // Location: to.Ptr("westus"), - // Properties: &armnetwork.RouteTablePropertiesFormat{ - // DisableBgpRoutePropagation: to.Ptr(true), - // ProvisioningState: to.Ptr(armnetwork.ProvisioningStateSucceeded), - // Routes: []*armnetwork.Route{ - // }, - // }, - // }}, - // } - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/4883fa5dbf6f2c9093fac8ce334547e9dfac68fa/specification/network/resource-manager/Microsoft.Network/stable/2024-03-01/examples/RouteTableListAll.json -func ExampleRouteTablesClient_NewListAllPager() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armnetwork.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := clientFactory.NewRouteTablesClient().NewListAllPager(nil) - for pager.More() { - page, err := pager.NextPage(ctx) - if err != nil { - log.Fatalf("failed to advance page: %v", err) - } - for _, v := range page.Value { - // You could use page here. We use blank identifier for just demo purposes. - _ = v - } - // If the HTTP response code is 200 as defined in example definition, your page structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // page.RouteTableListResult = armnetwork.RouteTableListResult{ - // Value: []*armnetwork.RouteTable{ - // { - // Name: to.Ptr("testrt"), - // Type: to.Ptr("Microsoft.Network/routeTables"), - // ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/routeTables/testrt"), - // Location: to.Ptr("westus"), - // Properties: &armnetwork.RouteTablePropertiesFormat{ - // ProvisioningState: to.Ptr(armnetwork.ProvisioningStateSucceeded), - // Routes: []*armnetwork.Route{ - // { - // ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/routeTables/testrt/routes/route1"), - // Name: to.Ptr("route1"), - // Properties: &armnetwork.RoutePropertiesFormat{ - // AddressPrefix: to.Ptr("10.0.3.0/24"), - // NextHopType: to.Ptr(armnetwork.RouteNextHopTypeVirtualNetworkGateway), - // ProvisioningState: to.Ptr(armnetwork.ProvisioningStateSucceeded), - // }, - // }}, - // }, - // }, - // { - // Name: to.Ptr("testrt3"), - // Type: to.Ptr("Microsoft.Network/routeTables"), - // ID: to.Ptr("/subscriptions/subid/resourceGroups/rg2/providers/Microsoft.Network/routeTables/testrt3"), - // Location: to.Ptr("westus"), - // Properties: &armnetwork.RouteTablePropertiesFormat{ - // ProvisioningState: to.Ptr(armnetwork.ProvisioningStateSucceeded), - // Routes: []*armnetwork.Route{ - // }, - // }, - // }}, - // } - } -} diff --git a/sdk/resourcemanager/network/armnetwork/routingintent_client_example_test.go b/sdk/resourcemanager/network/armnetwork/routingintent_client_example_test.go deleted file mode 100644 index 52f6a816f7ab..000000000000 --- a/sdk/resourcemanager/network/armnetwork/routingintent_client_example_test.go +++ /dev/null @@ -1,194 +0,0 @@ -//go:build go1.18 -// +build go1.18 - -// 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. -// DO NOT EDIT. - -package armnetwork_test - -import ( - "context" - "log" - - "github.com/Azure/azure-sdk-for-go/sdk/azcore/to" - "github.com/Azure/azure-sdk-for-go/sdk/azidentity" - "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/network/armnetwork/v6" -) - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/4883fa5dbf6f2c9093fac8ce334547e9dfac68fa/specification/network/resource-manager/Microsoft.Network/stable/2024-03-01/examples/RoutingIntentPut.json -func ExampleRoutingIntentClient_BeginCreateOrUpdate() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armnetwork.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewRoutingIntentClient().BeginCreateOrUpdate(ctx, "rg1", "virtualHub1", "Intent1", armnetwork.RoutingIntent{ - Properties: &armnetwork.RoutingIntentProperties{ - RoutingPolicies: []*armnetwork.RoutingPolicy{ - { - Name: to.Ptr("InternetTraffic"), - Destinations: []*string{ - to.Ptr("Internet")}, - NextHop: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/azureFirewalls/azfw1"), - }, - { - Name: to.Ptr("PrivateTrafficPolicy"), - Destinations: []*string{ - to.Ptr("PrivateTraffic")}, - NextHop: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/azureFirewalls/azfw1"), - }}, - }, - }, nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - res, err := poller.PollUntilDone(ctx, nil) - if err != nil { - log.Fatalf("failed to pull the result: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.RoutingIntent = armnetwork.RoutingIntent{ - // ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/virtualHubs/virtualHub1/routingIntent/Intent1"), - // Name: to.Ptr("Intent1"), - // Type: to.Ptr("Microsoft.Network/virtualHubs/routingIntent"), - // Etag: to.Ptr("w/\\00000000-0000-0000-0000-000000000000\\"), - // Properties: &armnetwork.RoutingIntentProperties{ - // ProvisioningState: to.Ptr(armnetwork.ProvisioningStateSucceeded), - // RoutingPolicies: []*armnetwork.RoutingPolicy{ - // { - // Name: to.Ptr("InternetTraffic"), - // Destinations: []*string{ - // to.Ptr("Internet")}, - // NextHop: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/azureFirewalls/azfw1"), - // }, - // { - // Name: to.Ptr("PrivateTrafficPolicy"), - // Destinations: []*string{ - // to.Ptr("PrivateTraffic")}, - // NextHop: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/azureFirewalls/azfw1"), - // }}, - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/4883fa5dbf6f2c9093fac8ce334547e9dfac68fa/specification/network/resource-manager/Microsoft.Network/stable/2024-03-01/examples/RoutingIntentGet.json -func ExampleRoutingIntentClient_Get() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armnetwork.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewRoutingIntentClient().Get(ctx, "rg1", "virtualHub1", "Intent1", nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.RoutingIntent = armnetwork.RoutingIntent{ - // ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/virtualHubs/virtualHub1/routingIntent/Intent1"), - // Name: to.Ptr("Intent1"), - // Type: to.Ptr("Microsoft.Network/virtualHubs/routingIntent"), - // Etag: to.Ptr("w/\\00000000-0000-0000-0000-000000000000\\"), - // Properties: &armnetwork.RoutingIntentProperties{ - // ProvisioningState: to.Ptr(armnetwork.ProvisioningStateSucceeded), - // RoutingPolicies: []*armnetwork.RoutingPolicy{ - // { - // Name: to.Ptr("InternetTraffic"), - // Destinations: []*string{ - // to.Ptr("Internet")}, - // NextHop: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/azureFirewalls/azfw1"), - // }, - // { - // Name: to.Ptr("PrivateTrafficPolicy"), - // Destinations: []*string{ - // to.Ptr("PrivateTraffic")}, - // NextHop: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/azureFirewalls/azfw1"), - // }}, - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/4883fa5dbf6f2c9093fac8ce334547e9dfac68fa/specification/network/resource-manager/Microsoft.Network/stable/2024-03-01/examples/RoutingIntentDelete.json -func ExampleRoutingIntentClient_BeginDelete() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armnetwork.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewRoutingIntentClient().BeginDelete(ctx, "rg1", "virtualHub1", "Intent1", nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - _, err = poller.PollUntilDone(ctx, nil) - if err != nil { - log.Fatalf("failed to pull the result: %v", err) - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/4883fa5dbf6f2c9093fac8ce334547e9dfac68fa/specification/network/resource-manager/Microsoft.Network/stable/2024-03-01/examples/RoutingIntentList.json -func ExampleRoutingIntentClient_NewListPager() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armnetwork.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := clientFactory.NewRoutingIntentClient().NewListPager("rg1", "virtualHub1", nil) - for pager.More() { - page, err := pager.NextPage(ctx) - if err != nil { - log.Fatalf("failed to advance page: %v", err) - } - for _, v := range page.Value { - // You could use page here. We use blank identifier for just demo purposes. - _ = v - } - // If the HTTP response code is 200 as defined in example definition, your page structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // page.ListRoutingIntentResult = armnetwork.ListRoutingIntentResult{ - // Value: []*armnetwork.RoutingIntent{ - // { - // ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/virtualHubs/virtualHub1/routingIntent/Intent1"), - // Name: to.Ptr("Intent1"), - // Type: to.Ptr("Microsoft.Network/virtualHubs/routingIntent"), - // Etag: to.Ptr("w/\\00000000-0000-0000-0000-000000000000\\"), - // Properties: &armnetwork.RoutingIntentProperties{ - // ProvisioningState: to.Ptr(armnetwork.ProvisioningStateSucceeded), - // RoutingPolicies: []*armnetwork.RoutingPolicy{ - // { - // Name: to.Ptr("InternetTraffic"), - // Destinations: []*string{ - // to.Ptr("Internet")}, - // NextHop: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/azureFirewalls/azfw1"), - // }, - // { - // Name: to.Ptr("PrivateTrafficPolicy"), - // Destinations: []*string{ - // to.Ptr("PrivateTraffic")}, - // NextHop: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/azureFirewalls/azfw1"), - // }}, - // }, - // }}, - // } - } -} diff --git a/sdk/resourcemanager/network/armnetwork/routingrulecollections_client_example_test.go b/sdk/resourcemanager/network/armnetwork/routingrulecollections_client_example_test.go deleted file mode 100644 index d97d2148b688..000000000000 --- a/sdk/resourcemanager/network/armnetwork/routingrulecollections_client_example_test.go +++ /dev/null @@ -1,187 +0,0 @@ -//go:build go1.18 -// +build go1.18 - -// 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. -// DO NOT EDIT. - -package armnetwork_test - -import ( - "context" - "log" - - "github.com/Azure/azure-sdk-for-go/sdk/azcore/to" - "github.com/Azure/azure-sdk-for-go/sdk/azidentity" - "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/network/armnetwork/v6" -) - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/4883fa5dbf6f2c9093fac8ce334547e9dfac68fa/specification/network/resource-manager/Microsoft.Network/stable/2024-03-01/examples/NetworkManagerRoutingRuleCollectionList.json -func ExampleRoutingRuleCollectionsClient_NewListPager() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armnetwork.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := clientFactory.NewRoutingRuleCollectionsClient().NewListPager("rg1", "testNetworkManager", "myTestRoutingConfig", &armnetwork.RoutingRuleCollectionsClientListOptions{Top: nil, - SkipToken: nil, - }) - for pager.More() { - page, err := pager.NextPage(ctx) - if err != nil { - log.Fatalf("failed to advance page: %v", err) - } - for _, v := range page.Value { - // You could use page here. We use blank identifier for just demo purposes. - _ = v - } - // If the HTTP response code is 200 as defined in example definition, your page structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // page.RoutingRuleCollectionListResult = armnetwork.RoutingRuleCollectionListResult{ - // Value: []*armnetwork.RoutingRuleCollection{ - // { - // Name: to.Ptr("testRuleCollection"), - // Type: to.Ptr("Microsoft.Network/networkManagers/routingConfigurations/ruleCollections"), - // ID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/rg1/providers/Microsoft.Network/networkManagers/testNetworkManager/routingConfigurations/myTestRoutingConfig/ruleCollections/testRuleCollection"), - // Properties: &armnetwork.RoutingRuleCollectionPropertiesFormat{ - // Description: to.Ptr("A sample rule collection"), - // AppliesTo: []*armnetwork.ManagerRoutingGroupItem{ - // { - // NetworkGroupID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/rg1/providers/Microsoft.Network/networkManagers/testNetworkManager/networkGroups/testGroup"), - // }}, - // DisableBgpRoutePropagation: to.Ptr(armnetwork.DisableBgpRoutePropagationFalse), - // ProvisioningState: to.Ptr(armnetwork.ProvisioningStateSucceeded), - // ResourceGUID: to.Ptr("00000000-0000-0000-0000-000000000000"), - // }, - // SystemData: &armnetwork.SystemData{ - // CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-01-11T18:52:27.000Z"); return t}()), - // CreatedBy: to.Ptr("b69a9388-9488-4534-b470-7ec6d41beef5"), - // CreatedByType: to.Ptr(armnetwork.CreatedByTypeUser), - // LastModifiedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-01-11T18:52:27.000Z"); return t}()), - // LastModifiedBy: to.Ptr("b69a9388-9488-4534-b470-7ec6d41beef5"), - // LastModifiedByType: to.Ptr(armnetwork.CreatedByTypeUser), - // }, - // }}, - // } - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/4883fa5dbf6f2c9093fac8ce334547e9dfac68fa/specification/network/resource-manager/Microsoft.Network/stable/2024-03-01/examples/NetworkManagerRoutingRuleCollectionGet.json -func ExampleRoutingRuleCollectionsClient_Get() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armnetwork.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewRoutingRuleCollectionsClient().Get(ctx, "rg1", "testNetworkManager", "myTestRoutingConfig", "testRuleCollection", nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.RoutingRuleCollection = armnetwork.RoutingRuleCollection{ - // Name: to.Ptr("testRuleCollection"), - // Type: to.Ptr("Microsoft.Network/networkManagers/routingConfigurations/ruleCollections"), - // ID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/rg1/providers/Microsoft.Network/networkManagers/testNetworkManager/routingConfigurations/myTestRoutingConfig/ruleCollections/testRuleCollection"), - // Properties: &armnetwork.RoutingRuleCollectionPropertiesFormat{ - // Description: to.Ptr("A sample rule collection"), - // AppliesTo: []*armnetwork.ManagerRoutingGroupItem{ - // { - // NetworkGroupID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/rg1/providers/Microsoft.Network/networkManagers/testNetworkManager/networkGroups/testGroup"), - // }}, - // DisableBgpRoutePropagation: to.Ptr(armnetwork.DisableBgpRoutePropagationFalse), - // ProvisioningState: to.Ptr(armnetwork.ProvisioningStateSucceeded), - // ResourceGUID: to.Ptr("00000000-0000-0000-0000-000000000000"), - // }, - // SystemData: &armnetwork.SystemData{ - // CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-01-11T18:52:27.000Z"); return t}()), - // CreatedBy: to.Ptr("b69a9388-9488-4534-b470-7ec6d41beef5"), - // CreatedByType: to.Ptr(armnetwork.CreatedByTypeUser), - // LastModifiedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-01-11T18:52:27.000Z"); return t}()), - // LastModifiedBy: to.Ptr("b69a9388-9488-4534-b470-7ec6d41beef5"), - // LastModifiedByType: to.Ptr(armnetwork.CreatedByTypeUser), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/4883fa5dbf6f2c9093fac8ce334547e9dfac68fa/specification/network/resource-manager/Microsoft.Network/stable/2024-03-01/examples/NetworkManagerRoutingRuleCollectionPut.json -func ExampleRoutingRuleCollectionsClient_CreateOrUpdate() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armnetwork.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewRoutingRuleCollectionsClient().CreateOrUpdate(ctx, "rg1", "testNetworkManager", "myTestRoutingConfig", "testRuleCollection", armnetwork.RoutingRuleCollection{ - Properties: &armnetwork.RoutingRuleCollectionPropertiesFormat{ - Description: to.Ptr("A sample policy"), - AppliesTo: []*armnetwork.ManagerRoutingGroupItem{ - { - NetworkGroupID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/rg1/providers/Microsoft.Network/networkManagers/testNetworkManager/networkGroups/testGroup"), - }}, - }, - }, nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.RoutingRuleCollection = armnetwork.RoutingRuleCollection{ - // Name: to.Ptr("myTestRoutingConfig"), - // Type: to.Ptr("Microsoft.Network/networkManagers/routingConfigurations/ruleCollections"), - // ID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/rg1/providers/Microsoft.Network/networkManager/testNetworkManager/routingConfigurations/myTestRoutingConfig/ruleCollections/testRuleCollection"), - // Properties: &armnetwork.RoutingRuleCollectionPropertiesFormat{ - // Description: to.Ptr("A sample policy"), - // AppliesTo: []*armnetwork.ManagerRoutingGroupItem{ - // { - // NetworkGroupID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/rg1/providers/Microsoft.Network/networkManagers/testNetworkManager/networkGroups/testGroup"), - // }}, - // DisableBgpRoutePropagation: to.Ptr(armnetwork.DisableBgpRoutePropagationFalse), - // ProvisioningState: to.Ptr(armnetwork.ProvisioningStateSucceeded), - // ResourceGUID: to.Ptr("00000000-0000-0000-0000-000000000000"), - // }, - // SystemData: &armnetwork.SystemData{ - // CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-01-11T18:52:27.000Z"); return t}()), - // CreatedBy: to.Ptr("b69a9388-9488-4534-b470-7ec6d41beef5"), - // CreatedByType: to.Ptr(armnetwork.CreatedByTypeUser), - // LastModifiedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-01-11T18:52:27.000Z"); return t}()), - // LastModifiedBy: to.Ptr("b69a9388-9488-4534-b470-7ec6d41beef5"), - // LastModifiedByType: to.Ptr(armnetwork.CreatedByTypeUser), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/4883fa5dbf6f2c9093fac8ce334547e9dfac68fa/specification/network/resource-manager/Microsoft.Network/stable/2024-03-01/examples/NetworkManagerRoutingRuleCollectionDelete.json -func ExampleRoutingRuleCollectionsClient_BeginDelete() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armnetwork.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewRoutingRuleCollectionsClient().BeginDelete(ctx, "rg1", "testNetworkManager", "myTestRoutingConfig", "testRuleCollection", &armnetwork.RoutingRuleCollectionsClientBeginDeleteOptions{Force: nil}) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - _, err = poller.PollUntilDone(ctx, nil) - if err != nil { - log.Fatalf("failed to pull the result: %v", err) - } -} diff --git a/sdk/resourcemanager/network/armnetwork/routingrules_client_example_test.go b/sdk/resourcemanager/network/armnetwork/routingrules_client_example_test.go deleted file mode 100644 index 165a972ba4be..000000000000 --- a/sdk/resourcemanager/network/armnetwork/routingrules_client_example_test.go +++ /dev/null @@ -1,199 +0,0 @@ -//go:build go1.18 -// +build go1.18 - -// 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. -// DO NOT EDIT. - -package armnetwork_test - -import ( - "context" - "log" - - "github.com/Azure/azure-sdk-for-go/sdk/azcore/to" - "github.com/Azure/azure-sdk-for-go/sdk/azidentity" - "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/network/armnetwork/v6" -) - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/4883fa5dbf6f2c9093fac8ce334547e9dfac68fa/specification/network/resource-manager/Microsoft.Network/stable/2024-03-01/examples/NetworkManagerRoutingRuleList.json -func ExampleRoutingRulesClient_NewListPager() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armnetwork.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := clientFactory.NewRoutingRulesClient().NewListPager("rg1", "testNetworkManager", "myTestRoutingConfig", "testRuleCollection", &armnetwork.RoutingRulesClientListOptions{Top: nil, - SkipToken: nil, - }) - for pager.More() { - page, err := pager.NextPage(ctx) - if err != nil { - log.Fatalf("failed to advance page: %v", err) - } - for _, v := range page.Value { - // You could use page here. We use blank identifier for just demo purposes. - _ = v - } - // If the HTTP response code is 200 as defined in example definition, your page structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // page.RoutingRuleListResult = armnetwork.RoutingRuleListResult{ - // Value: []*armnetwork.RoutingRule{ - // { - // Name: to.Ptr("SampleRoutingRule"), - // Type: to.Ptr("Microsoft.Network/networkManagers/routingConfigurations/ruleCollections/rules"), - // ID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/rg1/providers/Microsoft.Network/networkmanagers/testNetworkManager/routingConfigurations/myTestRoutingConfig/ruleCollections/testRuleCollection/rules/SampleAdminRule"), - // Properties: &armnetwork.RoutingRulePropertiesFormat{ - // Description: to.Ptr("This is Sample Admin Rule"), - // Destination: &armnetwork.RoutingRuleRouteDestination{ - // Type: to.Ptr(armnetwork.RoutingRuleDestinationTypeAddressPrefix), - // DestinationAddress: to.Ptr("10.0.0.0/16"), - // }, - // NextHop: &armnetwork.RoutingRuleNextHop{ - // NextHopAddress: to.Ptr(""), - // NextHopType: to.Ptr(armnetwork.RoutingRuleNextHopTypeVirtualNetworkGateway), - // }, - // ProvisioningState: to.Ptr(armnetwork.ProvisioningStateSucceeded), - // ResourceGUID: to.Ptr("00000000-0000-0000-0000-000000000000"), - // }, - // SystemData: &armnetwork.SystemData{ - // CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-01-11T18:52:27.000Z"); return t}()), - // CreatedBy: to.Ptr("b69a9388-9488-4534-b470-7ec6d41beef5"), - // CreatedByType: to.Ptr(armnetwork.CreatedByTypeUser), - // LastModifiedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-01-11T18:52:27.000Z"); return t}()), - // LastModifiedBy: to.Ptr("b69a9388-9488-4534-b470-7ec6d41beef5"), - // LastModifiedByType: to.Ptr(armnetwork.CreatedByTypeUser), - // }, - // }}, - // } - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/4883fa5dbf6f2c9093fac8ce334547e9dfac68fa/specification/network/resource-manager/Microsoft.Network/stable/2024-03-01/examples/NetworkManagerRoutingRuleGet.json -func ExampleRoutingRulesClient_Get() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armnetwork.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewRoutingRulesClient().Get(ctx, "rg1", "testNetworkManager", "myTestSecurityConfig", "testRuleCollection", "SampleRoutingRule", nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.RoutingRule = armnetwork.RoutingRule{ - // Name: to.Ptr("SampleRoutingRule"), - // Type: to.Ptr("Microsoft.Network/networkManagers/routingConfigurations/ruleCollections/rules"), - // ID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/rg1/providers/Microsoft.Network/networkManagers/testNetworkManager/routingConfigurations/myTestSecurityConfig/ruleCollections/testRuleCollection/rules/SampleRoutingRule"), - // Properties: &armnetwork.RoutingRulePropertiesFormat{ - // Description: to.Ptr("This is a routing rule"), - // Destination: &armnetwork.RoutingRuleRouteDestination{ - // Type: to.Ptr(armnetwork.RoutingRuleDestinationTypeAddressPrefix), - // DestinationAddress: to.Ptr("10.0.0.0/16"), - // }, - // NextHop: &armnetwork.RoutingRuleNextHop{ - // NextHopAddress: to.Ptr(""), - // NextHopType: to.Ptr(armnetwork.RoutingRuleNextHopTypeVirtualNetworkGateway), - // }, - // ProvisioningState: to.Ptr(armnetwork.ProvisioningStateSucceeded), - // ResourceGUID: to.Ptr("00000000-0000-0000-0000-000000000000"), - // }, - // SystemData: &armnetwork.SystemData{ - // CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-01-11T18:52:27.000Z"); return t}()), - // CreatedBy: to.Ptr("b69a9388-9488-4534-b470-7ec6d41beef5"), - // CreatedByType: to.Ptr(armnetwork.CreatedByTypeUser), - // LastModifiedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-01-11T18:52:27.000Z"); return t}()), - // LastModifiedBy: to.Ptr("b69a9388-9488-4534-b470-7ec6d41beef5"), - // LastModifiedByType: to.Ptr(armnetwork.CreatedByTypeUser), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/4883fa5dbf6f2c9093fac8ce334547e9dfac68fa/specification/network/resource-manager/Microsoft.Network/stable/2024-03-01/examples/NetworkManagerRoutingRulePut.json -func ExampleRoutingRulesClient_CreateOrUpdate_createADefaultRoutingRule() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armnetwork.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewRoutingRulesClient().CreateOrUpdate(ctx, "rg1", "testNetworkManager", "myTestRoutingConfig", "testRuleCollection", "SampleRoutingRule", armnetwork.RoutingRule{ - Properties: &armnetwork.RoutingRulePropertiesFormat{ - Description: to.Ptr("This is Sample Routing Rule"), - Destination: &armnetwork.RoutingRuleRouteDestination{ - Type: to.Ptr(armnetwork.RoutingRuleDestinationTypeAddressPrefix), - DestinationAddress: to.Ptr("10.0.0.0/16"), - }, - NextHop: &armnetwork.RoutingRuleNextHop{ - NextHopType: to.Ptr(armnetwork.RoutingRuleNextHopTypeVirtualNetworkGateway), - }, - }, - }, nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.RoutingRule = armnetwork.RoutingRule{ - // Name: to.Ptr("SampleRoutingRule"), - // Type: to.Ptr("Microsoft.Network/networkManagers/routingConfigurations/ruleCollections/rules"), - // ID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/rg1/providers/Microsoft.Network/networkManagers/testNetworkManager/routingConfigurations/myTestRoutingConfig/ruleCollections/testRuleCollection/rules/SampleRoutingRule"), - // Properties: &armnetwork.RoutingRulePropertiesFormat{ - // Description: to.Ptr("This is Sample Routing Rule"), - // Destination: &armnetwork.RoutingRuleRouteDestination{ - // Type: to.Ptr(armnetwork.RoutingRuleDestinationTypeAddressPrefix), - // DestinationAddress: to.Ptr("10.0.0.0/16"), - // }, - // NextHop: &armnetwork.RoutingRuleNextHop{ - // NextHopAddress: to.Ptr(""), - // NextHopType: to.Ptr(armnetwork.RoutingRuleNextHopTypeVirtualNetworkGateway), - // }, - // ProvisioningState: to.Ptr(armnetwork.ProvisioningStateSucceeded), - // ResourceGUID: to.Ptr("00000000-0000-0000-0000-000000000000"), - // }, - // SystemData: &armnetwork.SystemData{ - // CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-01-11T18:52:27.000Z"); return t}()), - // CreatedBy: to.Ptr("b69a9388-9488-4534-b470-7ec6d41beef5"), - // CreatedByType: to.Ptr(armnetwork.CreatedByTypeUser), - // LastModifiedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-01-11T18:52:27.000Z"); return t}()), - // LastModifiedBy: to.Ptr("b69a9388-9488-4534-b470-7ec6d41beef5"), - // LastModifiedByType: to.Ptr(armnetwork.CreatedByTypeUser), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/4883fa5dbf6f2c9093fac8ce334547e9dfac68fa/specification/network/resource-manager/Microsoft.Network/stable/2024-03-01/examples/NetworkManagerRoutingRuleDelete.json -func ExampleRoutingRulesClient_BeginDelete() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armnetwork.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewRoutingRulesClient().BeginDelete(ctx, "rg1", "testNetworkManager", "myTestRoutingConfig", "testRuleCollection", "sampleRule", &armnetwork.RoutingRulesClientBeginDeleteOptions{Force: to.Ptr(false)}) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - _, err = poller.PollUntilDone(ctx, nil) - if err != nil { - log.Fatalf("failed to pull the result: %v", err) - } -} diff --git a/sdk/resourcemanager/network/armnetwork/scopeconnections_client_example_test.go b/sdk/resourcemanager/network/armnetwork/scopeconnections_client_example_test.go deleted file mode 100644 index 93acaaaf2b51..000000000000 --- a/sdk/resourcemanager/network/armnetwork/scopeconnections_client_example_test.go +++ /dev/null @@ -1,169 +0,0 @@ -//go:build go1.18 -// +build go1.18 - -// 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. -// DO NOT EDIT. - -package armnetwork_test - -import ( - "context" - "log" - - "github.com/Azure/azure-sdk-for-go/sdk/azcore/to" - "github.com/Azure/azure-sdk-for-go/sdk/azidentity" - "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/network/armnetwork/v6" -) - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/4883fa5dbf6f2c9093fac8ce334547e9dfac68fa/specification/network/resource-manager/Microsoft.Network/stable/2024-03-01/examples/NetworkManagerScopeConnectionPut.json -func ExampleScopeConnectionsClient_CreateOrUpdate() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armnetwork.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewScopeConnectionsClient().CreateOrUpdate(ctx, "rg1", "testNetworkManager", "TestScopeConnection", armnetwork.ScopeConnection{ - Properties: &armnetwork.ScopeConnectionProperties{ - Description: to.Ptr("This is a scope connection to a cross tenant subscription."), - ResourceID: to.Ptr("subscriptions/f0dc2b34-dfad-40e4-83e0-2309fed8d00b"), - TenantID: to.Ptr("6babcaad-604b-40ac-a9d7-9fd97c0b779f"), - }, - }, nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.ScopeConnection = armnetwork.ScopeConnection{ - // Name: to.Ptr("TestScopeConnection"), - // Type: to.Ptr("Microsoft.Network/networkManagers/scopeConnections"), - // ID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroup/rg1/providers/Microsoft.Network/networkManagers/testNetworkManager/scopeConnections/TestScopeConnection"), - // Properties: &armnetwork.ScopeConnectionProperties{ - // Description: to.Ptr("This is a scope connection to a cross tenant subscription."), - // ConnectionState: to.Ptr(armnetwork.ScopeConnectionStatePending), - // ResourceID: to.Ptr("subscriptions/00000000-0000-0000-0000-000000000000"), - // TenantID: to.Ptr("00000000-0000-0000-0000-000000000000"), - // }, - // SystemData: &armnetwork.SystemData{ - // CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-01-11T18:52:27.000Z"); return t}()), - // CreatedBy: to.Ptr("b69a9388-9488-4534-b470-7ec6d41beef5"), - // CreatedByType: to.Ptr(armnetwork.CreatedByTypeUser), - // LastModifiedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-01-11T18:52:27.000Z"); return t}()), - // LastModifiedBy: to.Ptr("b69a9388-9488-4534-b470-7ec6d41beef5"), - // LastModifiedByType: to.Ptr(armnetwork.CreatedByTypeUser), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/4883fa5dbf6f2c9093fac8ce334547e9dfac68fa/specification/network/resource-manager/Microsoft.Network/stable/2024-03-01/examples/NetworkManagerScopeConnectionGet.json -func ExampleScopeConnectionsClient_Get() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armnetwork.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewScopeConnectionsClient().Get(ctx, "rg1", "testNetworkManager", "TestScopeConnection", nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.ScopeConnection = armnetwork.ScopeConnection{ - // Name: to.Ptr("TestScopeConnection"), - // Type: to.Ptr("Microsoft.Network/networkManagers/scopeConnections"), - // ID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroup/rg1/providers/Microsoft.Network/networkManagers/testNetworkManager/scopeConnections/TestScopeConnection"), - // Properties: &armnetwork.ScopeConnectionProperties{ - // Description: to.Ptr("This is a scope connection to a cross tenant subscription."), - // ConnectionState: to.Ptr(armnetwork.ScopeConnectionStatePending), - // ResourceID: to.Ptr("subscriptions/00000000-0000-0000-0000-000000000000"), - // TenantID: to.Ptr("00000000-0000-0000-0000-000000000000"), - // }, - // SystemData: &armnetwork.SystemData{ - // CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-01-11T18:52:27.000Z"); return t}()), - // CreatedBy: to.Ptr("b69a9388-9488-4534-b470-7ec6d41beef5"), - // CreatedByType: to.Ptr(armnetwork.CreatedByTypeUser), - // LastModifiedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-01-11T18:52:27.000Z"); return t}()), - // LastModifiedBy: to.Ptr("b69a9388-9488-4534-b470-7ec6d41beef5"), - // LastModifiedByType: to.Ptr(armnetwork.CreatedByTypeUser), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/4883fa5dbf6f2c9093fac8ce334547e9dfac68fa/specification/network/resource-manager/Microsoft.Network/stable/2024-03-01/examples/NetworkManagerScopeConnectionDelete.json -func ExampleScopeConnectionsClient_Delete() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armnetwork.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - _, err = clientFactory.NewScopeConnectionsClient().Delete(ctx, "rg1", "testNetworkManager", "TestScopeConnection", nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/4883fa5dbf6f2c9093fac8ce334547e9dfac68fa/specification/network/resource-manager/Microsoft.Network/stable/2024-03-01/examples/NetworkManagerScopeConnectionList.json -func ExampleScopeConnectionsClient_NewListPager() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armnetwork.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := clientFactory.NewScopeConnectionsClient().NewListPager("rg1", "testNetworkManager", &armnetwork.ScopeConnectionsClientListOptions{Top: nil, - SkipToken: nil, - }) - for pager.More() { - page, err := pager.NextPage(ctx) - if err != nil { - log.Fatalf("failed to advance page: %v", err) - } - for _, v := range page.Value { - // You could use page here. We use blank identifier for just demo purposes. - _ = v - } - // If the HTTP response code is 200 as defined in example definition, your page structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // page.ScopeConnectionListResult = armnetwork.ScopeConnectionListResult{ - // Value: []*armnetwork.ScopeConnection{ - // { - // Name: to.Ptr("TestScopeConnection"), - // Type: to.Ptr("Microsoft.Network/networkManagers/scopeConnections"), - // ID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroup/rg1/providers/Microsoft.Network/networkManagers/testNetworkManager/scopeConnections/TestScopeConnection"), - // Properties: &armnetwork.ScopeConnectionProperties{ - // Description: to.Ptr("This is a scope connection to a cross tenant subscription."), - // ConnectionState: to.Ptr(armnetwork.ScopeConnectionStatePending), - // ResourceID: to.Ptr("subscriptions/00000000-0000-0000-0000-000000000000"), - // TenantID: to.Ptr("00000000-0000-0000-0000-000000000000"), - // }, - // SystemData: &armnetwork.SystemData{ - // CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-01-11T18:52:27.000Z"); return t}()), - // CreatedBy: to.Ptr("b69a9388-9488-4534-b470-7ec6d41beef5"), - // CreatedByType: to.Ptr(armnetwork.CreatedByTypeUser), - // LastModifiedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-01-11T18:52:27.000Z"); return t}()), - // LastModifiedBy: to.Ptr("b69a9388-9488-4534-b470-7ec6d41beef5"), - // LastModifiedByType: to.Ptr(armnetwork.CreatedByTypeUser), - // }, - // }}, - // } - } -} diff --git a/sdk/resourcemanager/network/armnetwork/securityadminconfigurations_client_example_test.go b/sdk/resourcemanager/network/armnetwork/securityadminconfigurations_client_example_test.go deleted file mode 100644 index 6ed7e44c15e2..000000000000 --- a/sdk/resourcemanager/network/armnetwork/securityadminconfigurations_client_example_test.go +++ /dev/null @@ -1,176 +0,0 @@ -//go:build go1.18 -// +build go1.18 - -// 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. -// DO NOT EDIT. - -package armnetwork_test - -import ( - "context" - "log" - - "github.com/Azure/azure-sdk-for-go/sdk/azcore/to" - "github.com/Azure/azure-sdk-for-go/sdk/azidentity" - "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/network/armnetwork/v6" -) - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/4883fa5dbf6f2c9093fac8ce334547e9dfac68fa/specification/network/resource-manager/Microsoft.Network/stable/2024-03-01/examples/NetworkManagerSecurityAdminConfigurationList.json -func ExampleSecurityAdminConfigurationsClient_NewListPager() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armnetwork.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := clientFactory.NewSecurityAdminConfigurationsClient().NewListPager("rg1", "testNetworkManager", &armnetwork.SecurityAdminConfigurationsClientListOptions{Top: nil, - SkipToken: nil, - }) - for pager.More() { - page, err := pager.NextPage(ctx) - if err != nil { - log.Fatalf("failed to advance page: %v", err) - } - for _, v := range page.Value { - // You could use page here. We use blank identifier for just demo purposes. - _ = v - } - // If the HTTP response code is 200 as defined in example definition, your page structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // page.SecurityAdminConfigurationListResult = armnetwork.SecurityAdminConfigurationListResult{ - // Value: []*armnetwork.SecurityAdminConfiguration{ - // { - // Name: to.Ptr("myTestSecurityConfig"), - // Type: to.Ptr("Microsoft.Network/networkManagers/securityAdminConfigurations"), - // ID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/rg1/providers/Microsoft.Network/networkManagers/testNetworkManager/securityAdminConfigurations/myTestSecurityConfig"), - // Properties: &armnetwork.SecurityAdminConfigurationPropertiesFormat{ - // Description: to.Ptr("A sample policy"), - // ApplyOnNetworkIntentPolicyBasedServices: []*armnetwork.NetworkIntentPolicyBasedService{ - // to.Ptr(armnetwork.NetworkIntentPolicyBasedServiceNone)}, - // ProvisioningState: to.Ptr(armnetwork.ProvisioningStateSucceeded), - // ResourceGUID: to.Ptr("00000000-0000-0000-0000-000000000000"), - // }, - // SystemData: &armnetwork.SystemData{ - // CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-01-11T18:52:27.000Z"); return t}()), - // CreatedBy: to.Ptr("b69a9388-9488-4534-b470-7ec6d41beef5"), - // CreatedByType: to.Ptr(armnetwork.CreatedByTypeUser), - // LastModifiedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-01-11T18:52:27.000Z"); return t}()), - // LastModifiedBy: to.Ptr("b69a9388-9488-4534-b470-7ec6d41beef5"), - // LastModifiedByType: to.Ptr(armnetwork.CreatedByTypeUser), - // }, - // }}, - // } - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/4883fa5dbf6f2c9093fac8ce334547e9dfac68fa/specification/network/resource-manager/Microsoft.Network/stable/2024-03-01/examples/NetworkManagerSecurityAdminConfigurationGet.json -func ExampleSecurityAdminConfigurationsClient_Get() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armnetwork.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewSecurityAdminConfigurationsClient().Get(ctx, "rg1", "testNetworkManager", "myTestSecurityConfig", nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.SecurityAdminConfiguration = armnetwork.SecurityAdminConfiguration{ - // Name: to.Ptr("myTestSecurityConfig"), - // Type: to.Ptr("Microsoft.Network/networkManagers/securityAdminConfigurations"), - // ID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/rg1/providers/Microsoft.Network/networkManagers/testNetworkManager/securityAdminConfigurations/myTestSecurityConfig"), - // Properties: &armnetwork.SecurityAdminConfigurationPropertiesFormat{ - // Description: to.Ptr("A sample policy"), - // ApplyOnNetworkIntentPolicyBasedServices: []*armnetwork.NetworkIntentPolicyBasedService{ - // to.Ptr(armnetwork.NetworkIntentPolicyBasedServiceNone)}, - // ProvisioningState: to.Ptr(armnetwork.ProvisioningStateSucceeded), - // ResourceGUID: to.Ptr("00000000-0000-0000-0000-000000000000"), - // }, - // SystemData: &armnetwork.SystemData{ - // CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-01-11T18:52:27.000Z"); return t}()), - // CreatedBy: to.Ptr("b69a9388-9488-4534-b470-7ec6d41beef5"), - // CreatedByType: to.Ptr(armnetwork.CreatedByTypeUser), - // LastModifiedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-01-11T18:52:27.000Z"); return t}()), - // LastModifiedBy: to.Ptr("b69a9388-9488-4534-b470-7ec6d41beef5"), - // LastModifiedByType: to.Ptr(armnetwork.CreatedByTypeUser), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/4883fa5dbf6f2c9093fac8ce334547e9dfac68fa/specification/network/resource-manager/Microsoft.Network/stable/2024-03-01/examples/NetworkManagerSecurityAdminConfigurationPut.json -func ExampleSecurityAdminConfigurationsClient_CreateOrUpdate() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armnetwork.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewSecurityAdminConfigurationsClient().CreateOrUpdate(ctx, "rg1", "testNetworkManager", "myTestSecurityConfig", armnetwork.SecurityAdminConfiguration{ - Properties: &armnetwork.SecurityAdminConfigurationPropertiesFormat{ - Description: to.Ptr("A sample policy"), - ApplyOnNetworkIntentPolicyBasedServices: []*armnetwork.NetworkIntentPolicyBasedService{ - to.Ptr(armnetwork.NetworkIntentPolicyBasedServiceNone)}, - }, - }, nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.SecurityAdminConfiguration = armnetwork.SecurityAdminConfiguration{ - // Name: to.Ptr("myTestSecurityConfig"), - // Type: to.Ptr("Microsoft.Network/networkManagers/securityAdminConfigurations"), - // ID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/rg1/providers/Microsoft.Network/networkManager/testNetworkManager/securityAdminConfigurations/myTestSecurityConfig"), - // Properties: &armnetwork.SecurityAdminConfigurationPropertiesFormat{ - // Description: to.Ptr("A sample policy"), - // ApplyOnNetworkIntentPolicyBasedServices: []*armnetwork.NetworkIntentPolicyBasedService{ - // to.Ptr(armnetwork.NetworkIntentPolicyBasedServiceNone)}, - // ProvisioningState: to.Ptr(armnetwork.ProvisioningStateSucceeded), - // ResourceGUID: to.Ptr("00000000-0000-0000-0000-000000000000"), - // }, - // SystemData: &armnetwork.SystemData{ - // CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-01-11T18:52:27.000Z"); return t}()), - // CreatedBy: to.Ptr("b69a9388-9488-4534-b470-7ec6d41beef5"), - // CreatedByType: to.Ptr(armnetwork.CreatedByTypeUser), - // LastModifiedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-01-11T18:52:27.000Z"); return t}()), - // LastModifiedBy: to.Ptr("b69a9388-9488-4534-b470-7ec6d41beef5"), - // LastModifiedByType: to.Ptr(armnetwork.CreatedByTypeUser), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/4883fa5dbf6f2c9093fac8ce334547e9dfac68fa/specification/network/resource-manager/Microsoft.Network/stable/2024-03-01/examples/NetworkManagerSecurityAdminConfigurationDelete.json -func ExampleSecurityAdminConfigurationsClient_BeginDelete() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armnetwork.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewSecurityAdminConfigurationsClient().BeginDelete(ctx, "rg1", "testNetworkManager", "myTestSecurityConfig", &armnetwork.SecurityAdminConfigurationsClientBeginDeleteOptions{Force: to.Ptr(false)}) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - _, err = poller.PollUntilDone(ctx, nil) - if err != nil { - log.Fatalf("failed to pull the result: %v", err) - } -} diff --git a/sdk/resourcemanager/network/armnetwork/securitygroups_client_example_test.go b/sdk/resourcemanager/network/armnetwork/securitygroups_client_example_test.go deleted file mode 100644 index fc5463a9d87d..000000000000 --- a/sdk/resourcemanager/network/armnetwork/securitygroups_client_example_test.go +++ /dev/null @@ -1,1106 +0,0 @@ -//go:build go1.18 -// +build go1.18 - -// 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. -// DO NOT EDIT. - -package armnetwork_test - -import ( - "context" - "log" - - "github.com/Azure/azure-sdk-for-go/sdk/azcore/to" - "github.com/Azure/azure-sdk-for-go/sdk/azidentity" - "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/network/armnetwork/v6" -) - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/4883fa5dbf6f2c9093fac8ce334547e9dfac68fa/specification/network/resource-manager/Microsoft.Network/stable/2024-03-01/examples/NetworkSecurityGroupDelete.json -func ExampleSecurityGroupsClient_BeginDelete() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armnetwork.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewSecurityGroupsClient().BeginDelete(ctx, "rg1", "testnsg", nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - _, err = poller.PollUntilDone(ctx, nil) - if err != nil { - log.Fatalf("failed to pull the result: %v", err) - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/4883fa5dbf6f2c9093fac8ce334547e9dfac68fa/specification/network/resource-manager/Microsoft.Network/stable/2024-03-01/examples/NetworkSecurityGroupGet.json -func ExampleSecurityGroupsClient_Get() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armnetwork.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewSecurityGroupsClient().Get(ctx, "rg1", "testnsg", &armnetwork.SecurityGroupsClientGetOptions{Expand: nil}) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.SecurityGroup = armnetwork.SecurityGroup{ - // Name: to.Ptr("testnsg"), - // Type: to.Ptr("Microsoft.Network/networkSecurityGroups"), - // ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/networkSecurityGroups/testnsg"), - // Location: to.Ptr("westus"), - // Properties: &armnetwork.SecurityGroupPropertiesFormat{ - // DefaultSecurityRules: []*armnetwork.SecurityRule{ - // { - // ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/networkSecurityGroups/testnsg/defaultSecurityRules/AllowVnetInBound"), - // Name: to.Ptr("AllowVnetInBound"), - // Properties: &armnetwork.SecurityRulePropertiesFormat{ - // Description: to.Ptr("Allow inbound traffic from all VMs in VNET"), - // Access: to.Ptr(armnetwork.SecurityRuleAccessAllow), - // DestinationAddressPrefix: to.Ptr("VirtualNetwork"), - // DestinationPortRange: to.Ptr("*"), - // Direction: to.Ptr(armnetwork.SecurityRuleDirectionInbound), - // Priority: to.Ptr[int32](65000), - // ProvisioningState: to.Ptr(armnetwork.ProvisioningStateSucceeded), - // SourceAddressPrefix: to.Ptr("VirtualNetwork"), - // SourcePortRange: to.Ptr("*"), - // Protocol: to.Ptr(armnetwork.SecurityRuleProtocolAsterisk), - // }, - // }, - // { - // ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/networkSecurityGroups/testnsg/defaultSecurityRules/AllowAzureLoadBalancerInBound"), - // Name: to.Ptr("AllowAzureLoadBalancerInBound"), - // Properties: &armnetwork.SecurityRulePropertiesFormat{ - // Description: to.Ptr("Allow inbound traffic from azure load balancer"), - // Access: to.Ptr(armnetwork.SecurityRuleAccessAllow), - // DestinationAddressPrefix: to.Ptr("*"), - // DestinationPortRange: to.Ptr("*"), - // Direction: to.Ptr(armnetwork.SecurityRuleDirectionInbound), - // Priority: to.Ptr[int32](65001), - // ProvisioningState: to.Ptr(armnetwork.ProvisioningStateSucceeded), - // SourceAddressPrefix: to.Ptr("AzureLoadBalancer"), - // SourcePortRange: to.Ptr("*"), - // Protocol: to.Ptr(armnetwork.SecurityRuleProtocolAsterisk), - // }, - // }, - // { - // ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/networkSecurityGroups/testnsg/defaultSecurityRules/DenyAllInBound"), - // Name: to.Ptr("DenyAllInBound"), - // Properties: &armnetwork.SecurityRulePropertiesFormat{ - // Description: to.Ptr("Deny all inbound traffic"), - // Access: to.Ptr(armnetwork.SecurityRuleAccessDeny), - // DestinationAddressPrefix: to.Ptr("*"), - // DestinationPortRange: to.Ptr("*"), - // Direction: to.Ptr(armnetwork.SecurityRuleDirectionInbound), - // Priority: to.Ptr[int32](65500), - // ProvisioningState: to.Ptr(armnetwork.ProvisioningStateSucceeded), - // SourceAddressPrefix: to.Ptr("*"), - // SourcePortRange: to.Ptr("*"), - // Protocol: to.Ptr(armnetwork.SecurityRuleProtocolAsterisk), - // }, - // }, - // { - // ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/networkSecurityGroups/testnsg/defaultSecurityRules/AllowVnetOutBound"), - // Name: to.Ptr("AllowVnetOutBound"), - // Properties: &armnetwork.SecurityRulePropertiesFormat{ - // Description: to.Ptr("Allow outbound traffic from all VMs to all VMs in VNET"), - // Access: to.Ptr(armnetwork.SecurityRuleAccessAllow), - // DestinationAddressPrefix: to.Ptr("VirtualNetwork"), - // DestinationPortRange: to.Ptr("*"), - // Direction: to.Ptr(armnetwork.SecurityRuleDirectionOutbound), - // Priority: to.Ptr[int32](65000), - // ProvisioningState: to.Ptr(armnetwork.ProvisioningStateSucceeded), - // SourceAddressPrefix: to.Ptr("VirtualNetwork"), - // SourcePortRange: to.Ptr("*"), - // Protocol: to.Ptr(armnetwork.SecurityRuleProtocolAsterisk), - // }, - // }, - // { - // ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/networkSecurityGroups/testnsg/defaultSecurityRules/AllowInternetOutBound"), - // Name: to.Ptr("AllowInternetOutBound"), - // Properties: &armnetwork.SecurityRulePropertiesFormat{ - // Description: to.Ptr("Allow outbound traffic from all VMs to Internet"), - // Access: to.Ptr(armnetwork.SecurityRuleAccessAllow), - // DestinationAddressPrefix: to.Ptr("Internet"), - // DestinationPortRange: to.Ptr("*"), - // Direction: to.Ptr(armnetwork.SecurityRuleDirectionOutbound), - // Priority: to.Ptr[int32](65001), - // ProvisioningState: to.Ptr(armnetwork.ProvisioningStateSucceeded), - // SourceAddressPrefix: to.Ptr("*"), - // SourcePortRange: to.Ptr("*"), - // Protocol: to.Ptr(armnetwork.SecurityRuleProtocolAsterisk), - // }, - // }, - // { - // ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/networkSecurityGroups/testnsg/defaultSecurityRules/DenyAllOutBound"), - // Name: to.Ptr("DenyAllOutBound"), - // Properties: &armnetwork.SecurityRulePropertiesFormat{ - // Description: to.Ptr("Deny all outbound traffic"), - // Access: to.Ptr(armnetwork.SecurityRuleAccessDeny), - // DestinationAddressPrefix: to.Ptr("*"), - // DestinationPortRange: to.Ptr("*"), - // Direction: to.Ptr(armnetwork.SecurityRuleDirectionOutbound), - // Priority: to.Ptr[int32](65500), - // ProvisioningState: to.Ptr(armnetwork.ProvisioningStateSucceeded), - // SourceAddressPrefix: to.Ptr("*"), - // SourcePortRange: to.Ptr("*"), - // Protocol: to.Ptr(armnetwork.SecurityRuleProtocolAsterisk), - // }, - // }}, - // ProvisioningState: to.Ptr(armnetwork.ProvisioningStateSucceeded), - // SecurityRules: []*armnetwork.SecurityRule{ - // { - // ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/networkSecurityGroups/testnsg/securityRules/rule1"), - // Name: to.Ptr("rule1"), - // Properties: &armnetwork.SecurityRulePropertiesFormat{ - // Access: to.Ptr(armnetwork.SecurityRuleAccessAllow), - // DestinationAddressPrefix: to.Ptr("*"), - // DestinationPortRange: to.Ptr("80"), - // Direction: to.Ptr(armnetwork.SecurityRuleDirectionInbound), - // Priority: to.Ptr[int32](130), - // ProvisioningState: to.Ptr(armnetwork.ProvisioningStateSucceeded), - // SourceAddressPrefix: to.Ptr("*"), - // SourcePortRange: to.Ptr("*"), - // Protocol: to.Ptr(armnetwork.SecurityRuleProtocolAsterisk), - // }, - // }}, - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/4883fa5dbf6f2c9093fac8ce334547e9dfac68fa/specification/network/resource-manager/Microsoft.Network/stable/2024-03-01/examples/NetworkSecurityGroupCreate.json -func ExampleSecurityGroupsClient_BeginCreateOrUpdate_createNetworkSecurityGroup() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armnetwork.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewSecurityGroupsClient().BeginCreateOrUpdate(ctx, "rg1", "testnsg", armnetwork.SecurityGroup{ - Location: to.Ptr("eastus"), - }, nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - res, err := poller.PollUntilDone(ctx, nil) - if err != nil { - log.Fatalf("failed to pull the result: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.SecurityGroup = armnetwork.SecurityGroup{ - // Name: to.Ptr("testnsg"), - // Type: to.Ptr("Microsoft.Network/networkSecurityGroups"), - // ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/networkSecurityGroups/testnsg"), - // Location: to.Ptr("eastus"), - // Properties: &armnetwork.SecurityGroupPropertiesFormat{ - // DefaultSecurityRules: []*armnetwork.SecurityRule{ - // { - // ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/networkSecurityGroups/testnsg/defaultSecurityRules/AllowVnetInBound"), - // Name: to.Ptr("AllowVnetInBound"), - // Properties: &armnetwork.SecurityRulePropertiesFormat{ - // Description: to.Ptr("Allow inbound traffic from all VMs in VNET"), - // Access: to.Ptr(armnetwork.SecurityRuleAccessAllow), - // DestinationAddressPrefix: to.Ptr("VirtualNetwork"), - // DestinationPortRange: to.Ptr("*"), - // Direction: to.Ptr(armnetwork.SecurityRuleDirectionInbound), - // Priority: to.Ptr[int32](65000), - // ProvisioningState: to.Ptr(armnetwork.ProvisioningStateSucceeded), - // SourceAddressPrefix: to.Ptr("VirtualNetwork"), - // SourcePortRange: to.Ptr("*"), - // Protocol: to.Ptr(armnetwork.SecurityRuleProtocolAsterisk), - // }, - // }, - // { - // ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/networkSecurityGroups/testnsg/defaultSecurityRules/AllowAzureLoadBalancerInBound"), - // Name: to.Ptr("AllowAzureLoadBalancerInBound"), - // Properties: &armnetwork.SecurityRulePropertiesFormat{ - // Description: to.Ptr("Allow inbound traffic from azure load balancer"), - // Access: to.Ptr(armnetwork.SecurityRuleAccessAllow), - // DestinationAddressPrefix: to.Ptr("*"), - // DestinationPortRange: to.Ptr("*"), - // Direction: to.Ptr(armnetwork.SecurityRuleDirectionInbound), - // Priority: to.Ptr[int32](65001), - // ProvisioningState: to.Ptr(armnetwork.ProvisioningStateSucceeded), - // SourceAddressPrefix: to.Ptr("AzureLoadBalancer"), - // SourcePortRange: to.Ptr("*"), - // Protocol: to.Ptr(armnetwork.SecurityRuleProtocolAsterisk), - // }, - // }, - // { - // ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/networkSecurityGroups/testnsg/defaultSecurityRules/DenyAllInBound"), - // Name: to.Ptr("DenyAllInBound"), - // Properties: &armnetwork.SecurityRulePropertiesFormat{ - // Description: to.Ptr("Deny all inbound traffic"), - // Access: to.Ptr(armnetwork.SecurityRuleAccessDeny), - // DestinationAddressPrefix: to.Ptr("*"), - // DestinationPortRange: to.Ptr("*"), - // Direction: to.Ptr(armnetwork.SecurityRuleDirectionInbound), - // Priority: to.Ptr[int32](65500), - // ProvisioningState: to.Ptr(armnetwork.ProvisioningStateSucceeded), - // SourceAddressPrefix: to.Ptr("*"), - // SourcePortRange: to.Ptr("*"), - // Protocol: to.Ptr(armnetwork.SecurityRuleProtocolAsterisk), - // }, - // }, - // { - // ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/networkSecurityGroups/testnsg/defaultSecurityRules/AllowVnetOutBound"), - // Name: to.Ptr("AllowVnetOutBound"), - // Properties: &armnetwork.SecurityRulePropertiesFormat{ - // Description: to.Ptr("Allow outbound traffic from all VMs to all VMs in VNET"), - // Access: to.Ptr(armnetwork.SecurityRuleAccessAllow), - // DestinationAddressPrefix: to.Ptr("VirtualNetwork"), - // DestinationPortRange: to.Ptr("*"), - // Direction: to.Ptr(armnetwork.SecurityRuleDirectionOutbound), - // Priority: to.Ptr[int32](65000), - // ProvisioningState: to.Ptr(armnetwork.ProvisioningStateSucceeded), - // SourceAddressPrefix: to.Ptr("VirtualNetwork"), - // SourcePortRange: to.Ptr("*"), - // Protocol: to.Ptr(armnetwork.SecurityRuleProtocolAsterisk), - // }, - // }, - // { - // ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/networkSecurityGroups/testnsg/defaultSecurityRules/AllowInternetOutBound"), - // Name: to.Ptr("AllowInternetOutBound"), - // Properties: &armnetwork.SecurityRulePropertiesFormat{ - // Description: to.Ptr("Allow outbound traffic from all VMs to Internet"), - // Access: to.Ptr(armnetwork.SecurityRuleAccessAllow), - // DestinationAddressPrefix: to.Ptr("Internet"), - // DestinationPortRange: to.Ptr("*"), - // Direction: to.Ptr(armnetwork.SecurityRuleDirectionOutbound), - // Priority: to.Ptr[int32](65001), - // ProvisioningState: to.Ptr(armnetwork.ProvisioningStateSucceeded), - // SourceAddressPrefix: to.Ptr("*"), - // SourcePortRange: to.Ptr("*"), - // Protocol: to.Ptr(armnetwork.SecurityRuleProtocolAsterisk), - // }, - // }, - // { - // ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/networkSecurityGroups/testnsg/defaultSecurityRules/DenyAllOutBound"), - // Name: to.Ptr("DenyAllOutBound"), - // Properties: &armnetwork.SecurityRulePropertiesFormat{ - // Description: to.Ptr("Deny all outbound traffic"), - // Access: to.Ptr(armnetwork.SecurityRuleAccessDeny), - // DestinationAddressPrefix: to.Ptr("*"), - // DestinationPortRange: to.Ptr("*"), - // Direction: to.Ptr(armnetwork.SecurityRuleDirectionOutbound), - // Priority: to.Ptr[int32](65500), - // ProvisioningState: to.Ptr(armnetwork.ProvisioningStateSucceeded), - // SourceAddressPrefix: to.Ptr("*"), - // SourcePortRange: to.Ptr("*"), - // Protocol: to.Ptr(armnetwork.SecurityRuleProtocolAsterisk), - // }, - // }}, - // FlushConnection: to.Ptr(false), - // ProvisioningState: to.Ptr(armnetwork.ProvisioningStateSucceeded), - // SecurityRules: []*armnetwork.SecurityRule{ - // }, - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/4883fa5dbf6f2c9093fac8ce334547e9dfac68fa/specification/network/resource-manager/Microsoft.Network/stable/2024-03-01/examples/NetworkSecurityGroupCreateWithRule.json -func ExampleSecurityGroupsClient_BeginCreateOrUpdate_createNetworkSecurityGroupWithRule() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armnetwork.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewSecurityGroupsClient().BeginCreateOrUpdate(ctx, "rg1", "testnsg", armnetwork.SecurityGroup{ - Location: to.Ptr("eastus"), - Properties: &armnetwork.SecurityGroupPropertiesFormat{ - SecurityRules: []*armnetwork.SecurityRule{ - { - Name: to.Ptr("rule1"), - Properties: &armnetwork.SecurityRulePropertiesFormat{ - Access: to.Ptr(armnetwork.SecurityRuleAccessAllow), - DestinationAddressPrefix: to.Ptr("*"), - DestinationPortRange: to.Ptr("80"), - Direction: to.Ptr(armnetwork.SecurityRuleDirectionInbound), - Priority: to.Ptr[int32](130), - SourceAddressPrefix: to.Ptr("*"), - SourcePortRange: to.Ptr("*"), - Protocol: to.Ptr(armnetwork.SecurityRuleProtocolAsterisk), - }, - }}, - }, - }, nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - res, err := poller.PollUntilDone(ctx, nil) - if err != nil { - log.Fatalf("failed to pull the result: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.SecurityGroup = armnetwork.SecurityGroup{ - // Name: to.Ptr("testnsg"), - // Type: to.Ptr("Microsoft.Network/networkSecurityGroups"), - // ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/networkSecurityGroups/testnsg"), - // Location: to.Ptr("eastus"), - // Properties: &armnetwork.SecurityGroupPropertiesFormat{ - // DefaultSecurityRules: []*armnetwork.SecurityRule{ - // { - // ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/networkSecurityGroups/testnsg/defaultSecurityRules/AllowVnetInBound"), - // Name: to.Ptr("AllowVnetInBound"), - // Properties: &armnetwork.SecurityRulePropertiesFormat{ - // Description: to.Ptr("Allow inbound traffic from all VMs in VNET"), - // Access: to.Ptr(armnetwork.SecurityRuleAccessAllow), - // DestinationAddressPrefix: to.Ptr("VirtualNetwork"), - // DestinationPortRange: to.Ptr("*"), - // Direction: to.Ptr(armnetwork.SecurityRuleDirectionInbound), - // Priority: to.Ptr[int32](65000), - // ProvisioningState: to.Ptr(armnetwork.ProvisioningStateSucceeded), - // SourceAddressPrefix: to.Ptr("VirtualNetwork"), - // SourcePortRange: to.Ptr("*"), - // Protocol: to.Ptr(armnetwork.SecurityRuleProtocolAsterisk), - // }, - // }, - // { - // ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/networkSecurityGroups/testnsg/defaultSecurityRules/AllowAzureLoadBalancerInBound"), - // Name: to.Ptr("AllowAzureLoadBalancerInBound"), - // Properties: &armnetwork.SecurityRulePropertiesFormat{ - // Description: to.Ptr("Allow inbound traffic from azure load balancer"), - // Access: to.Ptr(armnetwork.SecurityRuleAccessAllow), - // DestinationAddressPrefix: to.Ptr("*"), - // DestinationPortRange: to.Ptr("*"), - // Direction: to.Ptr(armnetwork.SecurityRuleDirectionInbound), - // Priority: to.Ptr[int32](65001), - // ProvisioningState: to.Ptr(armnetwork.ProvisioningStateSucceeded), - // SourceAddressPrefix: to.Ptr("AzureLoadBalancer"), - // SourcePortRange: to.Ptr("*"), - // Protocol: to.Ptr(armnetwork.SecurityRuleProtocolAsterisk), - // }, - // }, - // { - // ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/networkSecurityGroups/testnsg/defaultSecurityRules/DenyAllInBound"), - // Name: to.Ptr("DenyAllInBound"), - // Properties: &armnetwork.SecurityRulePropertiesFormat{ - // Description: to.Ptr("Deny all inbound traffic"), - // Access: to.Ptr(armnetwork.SecurityRuleAccessDeny), - // DestinationAddressPrefix: to.Ptr("*"), - // DestinationPortRange: to.Ptr("*"), - // Direction: to.Ptr(armnetwork.SecurityRuleDirectionInbound), - // Priority: to.Ptr[int32](65500), - // ProvisioningState: to.Ptr(armnetwork.ProvisioningStateSucceeded), - // SourceAddressPrefix: to.Ptr("*"), - // SourcePortRange: to.Ptr("*"), - // Protocol: to.Ptr(armnetwork.SecurityRuleProtocolAsterisk), - // }, - // }, - // { - // ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/networkSecurityGroups/testnsg/defaultSecurityRules/AllowVnetOutBound"), - // Name: to.Ptr("AllowVnetOutBound"), - // Properties: &armnetwork.SecurityRulePropertiesFormat{ - // Description: to.Ptr("Allow outbound traffic from all VMs to all VMs in VNET"), - // Access: to.Ptr(armnetwork.SecurityRuleAccessAllow), - // DestinationAddressPrefix: to.Ptr("VirtualNetwork"), - // DestinationPortRange: to.Ptr("*"), - // Direction: to.Ptr(armnetwork.SecurityRuleDirectionOutbound), - // Priority: to.Ptr[int32](65000), - // ProvisioningState: to.Ptr(armnetwork.ProvisioningStateSucceeded), - // SourceAddressPrefix: to.Ptr("VirtualNetwork"), - // SourcePortRange: to.Ptr("*"), - // Protocol: to.Ptr(armnetwork.SecurityRuleProtocolAsterisk), - // }, - // }, - // { - // ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/networkSecurityGroups/testnsg/defaultSecurityRules/AllowInternetOutBound"), - // Name: to.Ptr("AllowInternetOutBound"), - // Properties: &armnetwork.SecurityRulePropertiesFormat{ - // Description: to.Ptr("Allow outbound traffic from all VMs to Internet"), - // Access: to.Ptr(armnetwork.SecurityRuleAccessAllow), - // DestinationAddressPrefix: to.Ptr("Internet"), - // DestinationPortRange: to.Ptr("*"), - // Direction: to.Ptr(armnetwork.SecurityRuleDirectionOutbound), - // Priority: to.Ptr[int32](65001), - // ProvisioningState: to.Ptr(armnetwork.ProvisioningStateSucceeded), - // SourceAddressPrefix: to.Ptr("*"), - // SourcePortRange: to.Ptr("*"), - // Protocol: to.Ptr(armnetwork.SecurityRuleProtocolAsterisk), - // }, - // }, - // { - // ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/networkSecurityGroups/testnsg/defaultSecurityRules/DenyAllOutBound"), - // Name: to.Ptr("DenyAllOutBound"), - // Properties: &armnetwork.SecurityRulePropertiesFormat{ - // Description: to.Ptr("Deny all outbound traffic"), - // Access: to.Ptr(armnetwork.SecurityRuleAccessDeny), - // DestinationAddressPrefix: to.Ptr("*"), - // DestinationPortRange: to.Ptr("*"), - // Direction: to.Ptr(armnetwork.SecurityRuleDirectionOutbound), - // Priority: to.Ptr[int32](65500), - // ProvisioningState: to.Ptr(armnetwork.ProvisioningStateSucceeded), - // SourceAddressPrefix: to.Ptr("*"), - // SourcePortRange: to.Ptr("*"), - // Protocol: to.Ptr(armnetwork.SecurityRuleProtocolAsterisk), - // }, - // }}, - // ProvisioningState: to.Ptr(armnetwork.ProvisioningStateSucceeded), - // SecurityRules: []*armnetwork.SecurityRule{ - // { - // ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/networkSecurityGroups/testnsg/securityRules/rule1"), - // Name: to.Ptr("rule1"), - // Properties: &armnetwork.SecurityRulePropertiesFormat{ - // Access: to.Ptr(armnetwork.SecurityRuleAccessAllow), - // DestinationAddressPrefix: to.Ptr("*"), - // DestinationPortRange: to.Ptr("80"), - // Direction: to.Ptr(armnetwork.SecurityRuleDirectionInbound), - // Priority: to.Ptr[int32](130), - // ProvisioningState: to.Ptr(armnetwork.ProvisioningStateSucceeded), - // SourceAddressPrefix: to.Ptr("*"), - // SourcePortRange: to.Ptr("*"), - // Protocol: to.Ptr(armnetwork.SecurityRuleProtocolAsterisk), - // }, - // }}, - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/4883fa5dbf6f2c9093fac8ce334547e9dfac68fa/specification/network/resource-manager/Microsoft.Network/stable/2024-03-01/examples/NetworkSecurityGroupUpdateTags.json -func ExampleSecurityGroupsClient_UpdateTags() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armnetwork.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewSecurityGroupsClient().UpdateTags(ctx, "rg1", "testnsg", armnetwork.TagsObject{ - Tags: map[string]*string{ - "tag1": to.Ptr("value1"), - "tag2": to.Ptr("value2"), - }, - }, nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.SecurityGroup = armnetwork.SecurityGroup{ - // Name: to.Ptr("testnsg"), - // Type: to.Ptr("Microsoft.Network/networkSecurityGroups"), - // ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/networkSecurityGroups/testnsg"), - // Location: to.Ptr("westus"), - // Tags: map[string]*string{ - // "tag1": to.Ptr("value1"), - // "tag2": to.Ptr("value2"), - // }, - // Properties: &armnetwork.SecurityGroupPropertiesFormat{ - // DefaultSecurityRules: []*armnetwork.SecurityRule{ - // { - // ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/networkSecurityGroups/testnsg/defaultSecurityRules/AllowVnetInBound"), - // Name: to.Ptr("AllowVnetInBound"), - // Properties: &armnetwork.SecurityRulePropertiesFormat{ - // Description: to.Ptr("Allow inbound traffic from all VMs in VNET"), - // Access: to.Ptr(armnetwork.SecurityRuleAccessAllow), - // DestinationAddressPrefix: to.Ptr("VirtualNetwork"), - // DestinationPortRange: to.Ptr("*"), - // Direction: to.Ptr(armnetwork.SecurityRuleDirectionInbound), - // Priority: to.Ptr[int32](65000), - // ProvisioningState: to.Ptr(armnetwork.ProvisioningStateSucceeded), - // SourceAddressPrefix: to.Ptr("VirtualNetwork"), - // SourcePortRange: to.Ptr("*"), - // Protocol: to.Ptr(armnetwork.SecurityRuleProtocolAsterisk), - // }, - // }, - // { - // ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/networkSecurityGroups/testnsg/defaultSecurityRules/AllowAzureLoadBalancerInBound"), - // Name: to.Ptr("AllowAzureLoadBalancerInBound"), - // Properties: &armnetwork.SecurityRulePropertiesFormat{ - // Description: to.Ptr("Allow inbound traffic from azure load balancer"), - // Access: to.Ptr(armnetwork.SecurityRuleAccessAllow), - // DestinationAddressPrefix: to.Ptr("*"), - // DestinationPortRange: to.Ptr("*"), - // Direction: to.Ptr(armnetwork.SecurityRuleDirectionInbound), - // Priority: to.Ptr[int32](65001), - // ProvisioningState: to.Ptr(armnetwork.ProvisioningStateSucceeded), - // SourceAddressPrefix: to.Ptr("AzureLoadBalancer"), - // SourcePortRange: to.Ptr("*"), - // Protocol: to.Ptr(armnetwork.SecurityRuleProtocolAsterisk), - // }, - // }, - // { - // ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/networkSecurityGroups/testnsg/defaultSecurityRules/DenyAllInBound"), - // Name: to.Ptr("DenyAllInBound"), - // Properties: &armnetwork.SecurityRulePropertiesFormat{ - // Description: to.Ptr("Deny all inbound traffic"), - // Access: to.Ptr(armnetwork.SecurityRuleAccessDeny), - // DestinationAddressPrefix: to.Ptr("*"), - // DestinationPortRange: to.Ptr("*"), - // Direction: to.Ptr(armnetwork.SecurityRuleDirectionInbound), - // Priority: to.Ptr[int32](65500), - // ProvisioningState: to.Ptr(armnetwork.ProvisioningStateSucceeded), - // SourceAddressPrefix: to.Ptr("*"), - // SourcePortRange: to.Ptr("*"), - // Protocol: to.Ptr(armnetwork.SecurityRuleProtocolAsterisk), - // }, - // }, - // { - // ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/networkSecurityGroups/testnsg/defaultSecurityRules/AllowVnetOutBound"), - // Name: to.Ptr("AllowVnetOutBound"), - // Properties: &armnetwork.SecurityRulePropertiesFormat{ - // Description: to.Ptr("Allow outbound traffic from all VMs to all VMs in VNET"), - // Access: to.Ptr(armnetwork.SecurityRuleAccessAllow), - // DestinationAddressPrefix: to.Ptr("VirtualNetwork"), - // DestinationPortRange: to.Ptr("*"), - // Direction: to.Ptr(armnetwork.SecurityRuleDirectionOutbound), - // Priority: to.Ptr[int32](65000), - // ProvisioningState: to.Ptr(armnetwork.ProvisioningStateSucceeded), - // SourceAddressPrefix: to.Ptr("VirtualNetwork"), - // SourcePortRange: to.Ptr("*"), - // Protocol: to.Ptr(armnetwork.SecurityRuleProtocolAsterisk), - // }, - // }, - // { - // ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/networkSecurityGroups/testnsg/defaultSecurityRules/AllowInternetOutBound"), - // Name: to.Ptr("AllowInternetOutBound"), - // Properties: &armnetwork.SecurityRulePropertiesFormat{ - // Description: to.Ptr("Allow outbound traffic from all VMs to Internet"), - // Access: to.Ptr(armnetwork.SecurityRuleAccessAllow), - // DestinationAddressPrefix: to.Ptr("Internet"), - // DestinationPortRange: to.Ptr("*"), - // Direction: to.Ptr(armnetwork.SecurityRuleDirectionOutbound), - // Priority: to.Ptr[int32](65001), - // ProvisioningState: to.Ptr(armnetwork.ProvisioningStateSucceeded), - // SourceAddressPrefix: to.Ptr("*"), - // SourcePortRange: to.Ptr("*"), - // Protocol: to.Ptr(armnetwork.SecurityRuleProtocolAsterisk), - // }, - // }, - // { - // ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/networkSecurityGroups/testnsg/defaultSecurityRules/DenyAllOutBound"), - // Name: to.Ptr("DenyAllOutBound"), - // Properties: &armnetwork.SecurityRulePropertiesFormat{ - // Description: to.Ptr("Deny all outbound traffic"), - // Access: to.Ptr(armnetwork.SecurityRuleAccessDeny), - // DestinationAddressPrefix: to.Ptr("*"), - // DestinationPortRange: to.Ptr("*"), - // Direction: to.Ptr(armnetwork.SecurityRuleDirectionOutbound), - // Priority: to.Ptr[int32](65500), - // ProvisioningState: to.Ptr(armnetwork.ProvisioningStateSucceeded), - // SourceAddressPrefix: to.Ptr("*"), - // SourcePortRange: to.Ptr("*"), - // Protocol: to.Ptr(armnetwork.SecurityRuleProtocolAsterisk), - // }, - // }}, - // ProvisioningState: to.Ptr(armnetwork.ProvisioningStateSucceeded), - // SecurityRules: []*armnetwork.SecurityRule{ - // }, - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/4883fa5dbf6f2c9093fac8ce334547e9dfac68fa/specification/network/resource-manager/Microsoft.Network/stable/2024-03-01/examples/NetworkSecurityGroupListAll.json -func ExampleSecurityGroupsClient_NewListAllPager() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armnetwork.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := clientFactory.NewSecurityGroupsClient().NewListAllPager(nil) - for pager.More() { - page, err := pager.NextPage(ctx) - if err != nil { - log.Fatalf("failed to advance page: %v", err) - } - for _, v := range page.Value { - // You could use page here. We use blank identifier for just demo purposes. - _ = v - } - // If the HTTP response code is 200 as defined in example definition, your page structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // page.SecurityGroupListResult = armnetwork.SecurityGroupListResult{ - // Value: []*armnetwork.SecurityGroup{ - // { - // Name: to.Ptr("nsg1"), - // Type: to.Ptr("Microsoft.Network/networkSecurityGroups"), - // ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/networkSecurityGroups/nsg1"), - // Location: to.Ptr("westus"), - // Properties: &armnetwork.SecurityGroupPropertiesFormat{ - // DefaultSecurityRules: []*armnetwork.SecurityRule{ - // { - // ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/networkSecurityGroups/nsg1/defaultSecurityRules/AllowVnetInBound"), - // Name: to.Ptr("AllowVnetInBound"), - // Properties: &armnetwork.SecurityRulePropertiesFormat{ - // Description: to.Ptr("Allow inbound traffic from all VMs in VNET"), - // Access: to.Ptr(armnetwork.SecurityRuleAccessAllow), - // DestinationAddressPrefix: to.Ptr("VirtualNetwork"), - // DestinationPortRange: to.Ptr("*"), - // Direction: to.Ptr(armnetwork.SecurityRuleDirectionInbound), - // Priority: to.Ptr[int32](65000), - // ProvisioningState: to.Ptr(armnetwork.ProvisioningStateSucceeded), - // SourceAddressPrefix: to.Ptr("VirtualNetwork"), - // SourcePortRange: to.Ptr("*"), - // Protocol: to.Ptr(armnetwork.SecurityRuleProtocolAsterisk), - // }, - // }, - // { - // ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/networkSecurityGroups/nsg1/defaultSecurityRules/AllowAzureLoadBalancerInBound"), - // Name: to.Ptr("AllowAzureLoadBalancerInBound"), - // Properties: &armnetwork.SecurityRulePropertiesFormat{ - // Description: to.Ptr("Allow inbound traffic from azure load balancer"), - // Access: to.Ptr(armnetwork.SecurityRuleAccessAllow), - // DestinationAddressPrefix: to.Ptr("*"), - // DestinationPortRange: to.Ptr("*"), - // Direction: to.Ptr(armnetwork.SecurityRuleDirectionInbound), - // Priority: to.Ptr[int32](65001), - // ProvisioningState: to.Ptr(armnetwork.ProvisioningStateSucceeded), - // SourceAddressPrefix: to.Ptr("AzureLoadBalancer"), - // SourcePortRange: to.Ptr("*"), - // Protocol: to.Ptr(armnetwork.SecurityRuleProtocolAsterisk), - // }, - // }, - // { - // ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/networkSecurityGroups/nsg1/defaultSecurityRules/DenyAllInBound"), - // Name: to.Ptr("DenyAllInBound"), - // Properties: &armnetwork.SecurityRulePropertiesFormat{ - // Description: to.Ptr("Deny all inbound traffic"), - // Access: to.Ptr(armnetwork.SecurityRuleAccessDeny), - // DestinationAddressPrefix: to.Ptr("*"), - // DestinationPortRange: to.Ptr("*"), - // Direction: to.Ptr(armnetwork.SecurityRuleDirectionInbound), - // Priority: to.Ptr[int32](65500), - // ProvisioningState: to.Ptr(armnetwork.ProvisioningStateSucceeded), - // SourceAddressPrefix: to.Ptr("*"), - // SourcePortRange: to.Ptr("*"), - // Protocol: to.Ptr(armnetwork.SecurityRuleProtocolAsterisk), - // }, - // }, - // { - // ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/networkSecurityGroups/nsg1/defaultSecurityRules/AllowVnetOutBound"), - // Name: to.Ptr("AllowVnetOutBound"), - // Properties: &armnetwork.SecurityRulePropertiesFormat{ - // Description: to.Ptr("Allow outbound traffic from all VMs to all VMs in VNET"), - // Access: to.Ptr(armnetwork.SecurityRuleAccessAllow), - // DestinationAddressPrefix: to.Ptr("VirtualNetwork"), - // DestinationPortRange: to.Ptr("*"), - // Direction: to.Ptr(armnetwork.SecurityRuleDirectionOutbound), - // Priority: to.Ptr[int32](65000), - // ProvisioningState: to.Ptr(armnetwork.ProvisioningStateSucceeded), - // SourceAddressPrefix: to.Ptr("VirtualNetwork"), - // SourcePortRange: to.Ptr("*"), - // Protocol: to.Ptr(armnetwork.SecurityRuleProtocolAsterisk), - // }, - // }, - // { - // ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/networkSecurityGroups/nsg1/defaultSecurityRules/AllowInternetOutBound"), - // Name: to.Ptr("AllowInternetOutBound"), - // Properties: &armnetwork.SecurityRulePropertiesFormat{ - // Description: to.Ptr("Allow outbound traffic from all VMs to Internet"), - // Access: to.Ptr(armnetwork.SecurityRuleAccessAllow), - // DestinationAddressPrefix: to.Ptr("Internet"), - // DestinationPortRange: to.Ptr("*"), - // Direction: to.Ptr(armnetwork.SecurityRuleDirectionOutbound), - // Priority: to.Ptr[int32](65001), - // ProvisioningState: to.Ptr(armnetwork.ProvisioningStateSucceeded), - // SourceAddressPrefix: to.Ptr("*"), - // SourcePortRange: to.Ptr("*"), - // Protocol: to.Ptr(armnetwork.SecurityRuleProtocolAsterisk), - // }, - // }, - // { - // ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/networkSecurityGroups/nsg1/defaultSecurityRules/DenyAllOutBound"), - // Name: to.Ptr("DenyAllOutBound"), - // Properties: &armnetwork.SecurityRulePropertiesFormat{ - // Description: to.Ptr("Deny all outbound traffic"), - // Access: to.Ptr(armnetwork.SecurityRuleAccessDeny), - // DestinationAddressPrefix: to.Ptr("*"), - // DestinationPortRange: to.Ptr("*"), - // Direction: to.Ptr(armnetwork.SecurityRuleDirectionOutbound), - // Priority: to.Ptr[int32](65500), - // ProvisioningState: to.Ptr(armnetwork.ProvisioningStateSucceeded), - // SourceAddressPrefix: to.Ptr("*"), - // SourcePortRange: to.Ptr("*"), - // Protocol: to.Ptr(armnetwork.SecurityRuleProtocolAsterisk), - // }, - // }}, - // ProvisioningState: to.Ptr(armnetwork.ProvisioningStateSucceeded), - // SecurityRules: []*armnetwork.SecurityRule{ - // }, - // }, - // }, - // { - // Name: to.Ptr("nsg3"), - // Type: to.Ptr("Microsoft.Network/networkSecurityGroups"), - // ID: to.Ptr("/subscriptions/subid/resourceGroups/rg2/providers/Microsoft.Network/networkSecurityGroups/nsg3"), - // Location: to.Ptr("westus"), - // Properties: &armnetwork.SecurityGroupPropertiesFormat{ - // DefaultSecurityRules: []*armnetwork.SecurityRule{ - // { - // ID: to.Ptr("/subscriptions/subid/resourceGroups/rg2/providers/Microsoft.Network/networkSecurityGroups/nsg3/defaultSecurityRules/AllowVnetInBound"), - // Name: to.Ptr("AllowVnetInBound"), - // Properties: &armnetwork.SecurityRulePropertiesFormat{ - // Description: to.Ptr("Allow inbound traffic from all VMs in VNET"), - // Access: to.Ptr(armnetwork.SecurityRuleAccessAllow), - // DestinationAddressPrefix: to.Ptr("VirtualNetwork"), - // DestinationPortRange: to.Ptr("*"), - // Direction: to.Ptr(armnetwork.SecurityRuleDirectionInbound), - // Priority: to.Ptr[int32](65000), - // ProvisioningState: to.Ptr(armnetwork.ProvisioningStateSucceeded), - // SourceAddressPrefix: to.Ptr("VirtualNetwork"), - // SourcePortRange: to.Ptr("*"), - // Protocol: to.Ptr(armnetwork.SecurityRuleProtocolAsterisk), - // }, - // }, - // { - // ID: to.Ptr("/subscriptions/subid/resourceGroups/rg2/providers/Microsoft.Network/networkSecurityGroups/nsg3/defaultSecurityRules/AllowAzureLoadBalancerInBound"), - // Name: to.Ptr("AllowAzureLoadBalancerInBound"), - // Properties: &armnetwork.SecurityRulePropertiesFormat{ - // Description: to.Ptr("Allow inbound traffic from azure load balancer"), - // Access: to.Ptr(armnetwork.SecurityRuleAccessAllow), - // DestinationAddressPrefix: to.Ptr("*"), - // DestinationPortRange: to.Ptr("*"), - // Direction: to.Ptr(armnetwork.SecurityRuleDirectionInbound), - // Priority: to.Ptr[int32](65001), - // ProvisioningState: to.Ptr(armnetwork.ProvisioningStateSucceeded), - // SourceAddressPrefix: to.Ptr("AzureLoadBalancer"), - // SourcePortRange: to.Ptr("*"), - // Protocol: to.Ptr(armnetwork.SecurityRuleProtocolAsterisk), - // }, - // }, - // { - // ID: to.Ptr("/subscriptions/subid/resourceGroups/rg2/providers/Microsoft.Network/networkSecurityGroups/nsg3/defaultSecurityRules/DenyAllInBound"), - // Name: to.Ptr("DenyAllInBound"), - // Properties: &armnetwork.SecurityRulePropertiesFormat{ - // Description: to.Ptr("Deny all inbound traffic"), - // Access: to.Ptr(armnetwork.SecurityRuleAccessDeny), - // DestinationAddressPrefix: to.Ptr("*"), - // DestinationPortRange: to.Ptr("*"), - // Direction: to.Ptr(armnetwork.SecurityRuleDirectionInbound), - // Priority: to.Ptr[int32](65500), - // ProvisioningState: to.Ptr(armnetwork.ProvisioningStateSucceeded), - // SourceAddressPrefix: to.Ptr("*"), - // SourcePortRange: to.Ptr("*"), - // Protocol: to.Ptr(armnetwork.SecurityRuleProtocolAsterisk), - // }, - // }, - // { - // ID: to.Ptr("/subscriptions/subid/resourceGroups/rg2/providers/Microsoft.Network/networkSecurityGroups/nsg3/defaultSecurityRules/AllowVnetOutBound"), - // Name: to.Ptr("AllowVnetOutBound"), - // Properties: &armnetwork.SecurityRulePropertiesFormat{ - // Description: to.Ptr("Allow outbound traffic from all VMs to all VMs in VNET"), - // Access: to.Ptr(armnetwork.SecurityRuleAccessAllow), - // DestinationAddressPrefix: to.Ptr("VirtualNetwork"), - // DestinationPortRange: to.Ptr("*"), - // Direction: to.Ptr(armnetwork.SecurityRuleDirectionOutbound), - // Priority: to.Ptr[int32](65000), - // ProvisioningState: to.Ptr(armnetwork.ProvisioningStateSucceeded), - // SourceAddressPrefix: to.Ptr("VirtualNetwork"), - // SourcePortRange: to.Ptr("*"), - // Protocol: to.Ptr(armnetwork.SecurityRuleProtocolAsterisk), - // }, - // }, - // { - // ID: to.Ptr("/subscriptions/subid/resourceGroups/rg2/providers/Microsoft.Network/networkSecurityGroups/nsg3/defaultSecurityRules/AllowInternetOutBound"), - // Name: to.Ptr("AllowInternetOutBound"), - // Properties: &armnetwork.SecurityRulePropertiesFormat{ - // Description: to.Ptr("Allow outbound traffic from all VMs to Internet"), - // Access: to.Ptr(armnetwork.SecurityRuleAccessAllow), - // DestinationAddressPrefix: to.Ptr("Internet"), - // DestinationPortRange: to.Ptr("*"), - // Direction: to.Ptr(armnetwork.SecurityRuleDirectionOutbound), - // Priority: to.Ptr[int32](65001), - // ProvisioningState: to.Ptr(armnetwork.ProvisioningStateSucceeded), - // SourceAddressPrefix: to.Ptr("*"), - // SourcePortRange: to.Ptr("*"), - // Protocol: to.Ptr(armnetwork.SecurityRuleProtocolAsterisk), - // }, - // }, - // { - // ID: to.Ptr("/subscriptions/subid/resourceGroups/rg2/providers/Microsoft.Network/networkSecurityGroups/nsg3/defaultSecurityRules/DenyAllOutBound"), - // Name: to.Ptr("DenyAllOutBound"), - // Properties: &armnetwork.SecurityRulePropertiesFormat{ - // Description: to.Ptr("Deny all outbound traffic"), - // Access: to.Ptr(armnetwork.SecurityRuleAccessDeny), - // DestinationAddressPrefix: to.Ptr("*"), - // DestinationPortRange: to.Ptr("*"), - // Direction: to.Ptr(armnetwork.SecurityRuleDirectionOutbound), - // Priority: to.Ptr[int32](65500), - // ProvisioningState: to.Ptr(armnetwork.ProvisioningStateSucceeded), - // SourceAddressPrefix: to.Ptr("*"), - // SourcePortRange: to.Ptr("*"), - // Protocol: to.Ptr(armnetwork.SecurityRuleProtocolAsterisk), - // }, - // }}, - // ProvisioningState: to.Ptr(armnetwork.ProvisioningStateSucceeded), - // SecurityRules: []*armnetwork.SecurityRule{ - // }, - // }, - // }}, - // } - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/4883fa5dbf6f2c9093fac8ce334547e9dfac68fa/specification/network/resource-manager/Microsoft.Network/stable/2024-03-01/examples/NetworkSecurityGroupList.json -func ExampleSecurityGroupsClient_NewListPager() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armnetwork.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := clientFactory.NewSecurityGroupsClient().NewListPager("rg1", nil) - for pager.More() { - page, err := pager.NextPage(ctx) - if err != nil { - log.Fatalf("failed to advance page: %v", err) - } - for _, v := range page.Value { - // You could use page here. We use blank identifier for just demo purposes. - _ = v - } - // If the HTTP response code is 200 as defined in example definition, your page structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // page.SecurityGroupListResult = armnetwork.SecurityGroupListResult{ - // Value: []*armnetwork.SecurityGroup{ - // { - // Name: to.Ptr("nsg1"), - // Type: to.Ptr("Microsoft.Network/networkSecurityGroups"), - // ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/networkSecurityGroups/nsg1"), - // Location: to.Ptr("westus"), - // Properties: &armnetwork.SecurityGroupPropertiesFormat{ - // DefaultSecurityRules: []*armnetwork.SecurityRule{ - // { - // ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/networkSecurityGroups/nsg1/defaultSecurityRules/AllowVnetInBound"), - // Name: to.Ptr("AllowVnetInBound"), - // Properties: &armnetwork.SecurityRulePropertiesFormat{ - // Description: to.Ptr("Allow inbound traffic from all VMs in VNET"), - // Access: to.Ptr(armnetwork.SecurityRuleAccessAllow), - // DestinationAddressPrefix: to.Ptr("VirtualNetwork"), - // DestinationPortRange: to.Ptr("*"), - // Direction: to.Ptr(armnetwork.SecurityRuleDirectionInbound), - // Priority: to.Ptr[int32](65000), - // ProvisioningState: to.Ptr(armnetwork.ProvisioningStateSucceeded), - // SourceAddressPrefix: to.Ptr("VirtualNetwork"), - // SourcePortRange: to.Ptr("*"), - // Protocol: to.Ptr(armnetwork.SecurityRuleProtocolAsterisk), - // }, - // }, - // { - // ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/networkSecurityGroups/nsg1/defaultSecurityRules/AllowAzureLoadBalancerInBound"), - // Name: to.Ptr("AllowAzureLoadBalancerInBound"), - // Properties: &armnetwork.SecurityRulePropertiesFormat{ - // Description: to.Ptr("Allow inbound traffic from azure load balancer"), - // Access: to.Ptr(armnetwork.SecurityRuleAccessAllow), - // DestinationAddressPrefix: to.Ptr("*"), - // DestinationPortRange: to.Ptr("*"), - // Direction: to.Ptr(armnetwork.SecurityRuleDirectionInbound), - // Priority: to.Ptr[int32](65001), - // ProvisioningState: to.Ptr(armnetwork.ProvisioningStateSucceeded), - // SourceAddressPrefix: to.Ptr("AzureLoadBalancer"), - // SourcePortRange: to.Ptr("*"), - // Protocol: to.Ptr(armnetwork.SecurityRuleProtocolAsterisk), - // }, - // }, - // { - // ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/networkSecurityGroups/nsg1/defaultSecurityRules/DenyAllInBound"), - // Name: to.Ptr("DenyAllInBound"), - // Properties: &armnetwork.SecurityRulePropertiesFormat{ - // Description: to.Ptr("Deny all inbound traffic"), - // Access: to.Ptr(armnetwork.SecurityRuleAccessDeny), - // DestinationAddressPrefix: to.Ptr("*"), - // DestinationPortRange: to.Ptr("*"), - // Direction: to.Ptr(armnetwork.SecurityRuleDirectionInbound), - // Priority: to.Ptr[int32](65500), - // ProvisioningState: to.Ptr(armnetwork.ProvisioningStateSucceeded), - // SourceAddressPrefix: to.Ptr("*"), - // SourcePortRange: to.Ptr("*"), - // Protocol: to.Ptr(armnetwork.SecurityRuleProtocolAsterisk), - // }, - // }, - // { - // ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/networkSecurityGroups/nsg1/defaultSecurityRules/AllowVnetOutBound"), - // Name: to.Ptr("AllowVnetOutBound"), - // Properties: &armnetwork.SecurityRulePropertiesFormat{ - // Description: to.Ptr("Allow outbound traffic from all VMs to all VMs in VNET"), - // Access: to.Ptr(armnetwork.SecurityRuleAccessAllow), - // DestinationAddressPrefix: to.Ptr("VirtualNetwork"), - // DestinationPortRange: to.Ptr("*"), - // Direction: to.Ptr(armnetwork.SecurityRuleDirectionOutbound), - // Priority: to.Ptr[int32](65000), - // ProvisioningState: to.Ptr(armnetwork.ProvisioningStateSucceeded), - // SourceAddressPrefix: to.Ptr("VirtualNetwork"), - // SourcePortRange: to.Ptr("*"), - // Protocol: to.Ptr(armnetwork.SecurityRuleProtocolAsterisk), - // }, - // }, - // { - // ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/networkSecurityGroups/nsg1/defaultSecurityRules/AllowInternetOutBound"), - // Name: to.Ptr("AllowInternetOutBound"), - // Properties: &armnetwork.SecurityRulePropertiesFormat{ - // Description: to.Ptr("Allow outbound traffic from all VMs to Internet"), - // Access: to.Ptr(armnetwork.SecurityRuleAccessAllow), - // DestinationAddressPrefix: to.Ptr("Internet"), - // DestinationPortRange: to.Ptr("*"), - // Direction: to.Ptr(armnetwork.SecurityRuleDirectionOutbound), - // Priority: to.Ptr[int32](65001), - // ProvisioningState: to.Ptr(armnetwork.ProvisioningStateSucceeded), - // SourceAddressPrefix: to.Ptr("*"), - // SourcePortRange: to.Ptr("*"), - // Protocol: to.Ptr(armnetwork.SecurityRuleProtocolAsterisk), - // }, - // }, - // { - // ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/networkSecurityGroups/nsg1/defaultSecurityRules/DenyAllOutBound"), - // Name: to.Ptr("DenyAllOutBound"), - // Properties: &armnetwork.SecurityRulePropertiesFormat{ - // Description: to.Ptr("Deny all outbound traffic"), - // Access: to.Ptr(armnetwork.SecurityRuleAccessDeny), - // DestinationAddressPrefix: to.Ptr("*"), - // DestinationPortRange: to.Ptr("*"), - // Direction: to.Ptr(armnetwork.SecurityRuleDirectionOutbound), - // Priority: to.Ptr[int32](65500), - // ProvisioningState: to.Ptr(armnetwork.ProvisioningStateSucceeded), - // SourceAddressPrefix: to.Ptr("*"), - // SourcePortRange: to.Ptr("*"), - // Protocol: to.Ptr(armnetwork.SecurityRuleProtocolAsterisk), - // }, - // }}, - // ProvisioningState: to.Ptr(armnetwork.ProvisioningStateSucceeded), - // SecurityRules: []*armnetwork.SecurityRule{ - // }, - // }, - // }, - // { - // Name: to.Ptr("nsg3"), - // Type: to.Ptr("Microsoft.Network/networkSecurityGroups"), - // ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/networkSecurityGroups/nsg3"), - // Location: to.Ptr("westus"), - // Properties: &armnetwork.SecurityGroupPropertiesFormat{ - // DefaultSecurityRules: []*armnetwork.SecurityRule{ - // { - // ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/networkSecurityGroups/nsg3/defaultSecurityRules/AllowVnetInBound"), - // Name: to.Ptr("AllowVnetInBound"), - // Properties: &armnetwork.SecurityRulePropertiesFormat{ - // Description: to.Ptr("Allow inbound traffic from all VMs in VNET"), - // Access: to.Ptr(armnetwork.SecurityRuleAccessAllow), - // DestinationAddressPrefix: to.Ptr("VirtualNetwork"), - // DestinationPortRange: to.Ptr("*"), - // Direction: to.Ptr(armnetwork.SecurityRuleDirectionInbound), - // Priority: to.Ptr[int32](65000), - // ProvisioningState: to.Ptr(armnetwork.ProvisioningStateSucceeded), - // SourceAddressPrefix: to.Ptr("VirtualNetwork"), - // SourcePortRange: to.Ptr("*"), - // Protocol: to.Ptr(armnetwork.SecurityRuleProtocolAsterisk), - // }, - // }, - // { - // ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/networkSecurityGroups/nsg3/defaultSecurityRules/AllowAzureLoadBalancerInBound"), - // Name: to.Ptr("AllowAzureLoadBalancerInBound"), - // Properties: &armnetwork.SecurityRulePropertiesFormat{ - // Description: to.Ptr("Allow inbound traffic from azure load balancer"), - // Access: to.Ptr(armnetwork.SecurityRuleAccessAllow), - // DestinationAddressPrefix: to.Ptr("*"), - // DestinationPortRange: to.Ptr("*"), - // Direction: to.Ptr(armnetwork.SecurityRuleDirectionInbound), - // Priority: to.Ptr[int32](65001), - // ProvisioningState: to.Ptr(armnetwork.ProvisioningStateSucceeded), - // SourceAddressPrefix: to.Ptr("AzureLoadBalancer"), - // SourcePortRange: to.Ptr("*"), - // Protocol: to.Ptr(armnetwork.SecurityRuleProtocolAsterisk), - // }, - // }, - // { - // ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/networkSecurityGroups/nsg3/defaultSecurityRules/DenyAllInBound"), - // Name: to.Ptr("DenyAllInBound"), - // Properties: &armnetwork.SecurityRulePropertiesFormat{ - // Description: to.Ptr("Deny all inbound traffic"), - // Access: to.Ptr(armnetwork.SecurityRuleAccessDeny), - // DestinationAddressPrefix: to.Ptr("*"), - // DestinationPortRange: to.Ptr("*"), - // Direction: to.Ptr(armnetwork.SecurityRuleDirectionInbound), - // Priority: to.Ptr[int32](65500), - // ProvisioningState: to.Ptr(armnetwork.ProvisioningStateSucceeded), - // SourceAddressPrefix: to.Ptr("*"), - // SourcePortRange: to.Ptr("*"), - // Protocol: to.Ptr(armnetwork.SecurityRuleProtocolAsterisk), - // }, - // }, - // { - // ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/networkSecurityGroups/nsg3/defaultSecurityRules/AllowVnetOutBound"), - // Name: to.Ptr("AllowVnetOutBound"), - // Properties: &armnetwork.SecurityRulePropertiesFormat{ - // Description: to.Ptr("Allow outbound traffic from all VMs to all VMs in VNET"), - // Access: to.Ptr(armnetwork.SecurityRuleAccessAllow), - // DestinationAddressPrefix: to.Ptr("VirtualNetwork"), - // DestinationPortRange: to.Ptr("*"), - // Direction: to.Ptr(armnetwork.SecurityRuleDirectionOutbound), - // Priority: to.Ptr[int32](65000), - // ProvisioningState: to.Ptr(armnetwork.ProvisioningStateSucceeded), - // SourceAddressPrefix: to.Ptr("VirtualNetwork"), - // SourcePortRange: to.Ptr("*"), - // Protocol: to.Ptr(armnetwork.SecurityRuleProtocolAsterisk), - // }, - // }, - // { - // ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/networkSecurityGroups/nsg3/defaultSecurityRules/AllowInternetOutBound"), - // Name: to.Ptr("AllowInternetOutBound"), - // Properties: &armnetwork.SecurityRulePropertiesFormat{ - // Description: to.Ptr("Allow outbound traffic from all VMs to Internet"), - // Access: to.Ptr(armnetwork.SecurityRuleAccessAllow), - // DestinationAddressPrefix: to.Ptr("Internet"), - // DestinationPortRange: to.Ptr("*"), - // Direction: to.Ptr(armnetwork.SecurityRuleDirectionOutbound), - // Priority: to.Ptr[int32](65001), - // ProvisioningState: to.Ptr(armnetwork.ProvisioningStateSucceeded), - // SourceAddressPrefix: to.Ptr("*"), - // SourcePortRange: to.Ptr("*"), - // Protocol: to.Ptr(armnetwork.SecurityRuleProtocolAsterisk), - // }, - // }, - // { - // ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/networkSecurityGroups/nsg3/defaultSecurityRules/DenyAllOutBound"), - // Name: to.Ptr("DenyAllOutBound"), - // Properties: &armnetwork.SecurityRulePropertiesFormat{ - // Description: to.Ptr("Deny all outbound traffic"), - // Access: to.Ptr(armnetwork.SecurityRuleAccessDeny), - // DestinationAddressPrefix: to.Ptr("*"), - // DestinationPortRange: to.Ptr("*"), - // Direction: to.Ptr(armnetwork.SecurityRuleDirectionOutbound), - // Priority: to.Ptr[int32](65500), - // ProvisioningState: to.Ptr(armnetwork.ProvisioningStateSucceeded), - // SourceAddressPrefix: to.Ptr("*"), - // SourcePortRange: to.Ptr("*"), - // Protocol: to.Ptr(armnetwork.SecurityRuleProtocolAsterisk), - // }, - // }}, - // ProvisioningState: to.Ptr(armnetwork.ProvisioningStateSucceeded), - // SecurityRules: []*armnetwork.SecurityRule{ - // }, - // }, - // }}, - // } - } -} diff --git a/sdk/resourcemanager/network/armnetwork/securitypartnerproviders_client_example_test.go b/sdk/resourcemanager/network/armnetwork/securitypartnerproviders_client_example_test.go deleted file mode 100644 index c857dc8204e0..000000000000 --- a/sdk/resourcemanager/network/armnetwork/securitypartnerproviders_client_example_test.go +++ /dev/null @@ -1,261 +0,0 @@ -//go:build go1.18 -// +build go1.18 - -// 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. -// DO NOT EDIT. - -package armnetwork_test - -import ( - "context" - "log" - - "github.com/Azure/azure-sdk-for-go/sdk/azcore/to" - "github.com/Azure/azure-sdk-for-go/sdk/azidentity" - "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/network/armnetwork/v6" -) - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/4883fa5dbf6f2c9093fac8ce334547e9dfac68fa/specification/network/resource-manager/Microsoft.Network/stable/2024-03-01/examples/SecurityPartnerProviderDelete.json -func ExampleSecurityPartnerProvidersClient_BeginDelete() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armnetwork.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewSecurityPartnerProvidersClient().BeginDelete(ctx, "rg1", "securityPartnerProvider", nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - _, err = poller.PollUntilDone(ctx, nil) - if err != nil { - log.Fatalf("failed to pull the result: %v", err) - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/4883fa5dbf6f2c9093fac8ce334547e9dfac68fa/specification/network/resource-manager/Microsoft.Network/stable/2024-03-01/examples/SecurityPartnerProviderGet.json -func ExampleSecurityPartnerProvidersClient_Get() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armnetwork.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewSecurityPartnerProvidersClient().Get(ctx, "rg1", "securityPartnerProvider", nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.SecurityPartnerProvider = armnetwork.SecurityPartnerProvider{ - // Name: to.Ptr("securityPartnerProvider"), - // Type: to.Ptr("Microsoft.Network/securityPartnerProviders"), - // ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/securityPartnerProviders/securityPartnerProvider"), - // Location: to.Ptr("West US"), - // Tags: map[string]*string{ - // "key1": to.Ptr("value1"), - // }, - // Etag: to.Ptr("w/\\00000000-0000-0000-0000-000000000000\\"), - // Properties: &armnetwork.SecurityPartnerProviderPropertiesFormat{ - // ConnectionStatus: to.Ptr(armnetwork.SecurityPartnerProviderConnectionStatusUnknown), - // ProvisioningState: to.Ptr(armnetwork.ProvisioningStateSucceeded), - // SecurityProviderName: to.Ptr(armnetwork.SecurityProviderNameZScaler), - // VirtualHub: &armnetwork.SubResource{ - // ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/virtualHubs/hub1"), - // }, - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/4883fa5dbf6f2c9093fac8ce334547e9dfac68fa/specification/network/resource-manager/Microsoft.Network/stable/2024-03-01/examples/SecurityPartnerProviderPut.json -func ExampleSecurityPartnerProvidersClient_BeginCreateOrUpdate() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armnetwork.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewSecurityPartnerProvidersClient().BeginCreateOrUpdate(ctx, "rg1", "securityPartnerProvider", armnetwork.SecurityPartnerProvider{ - Location: to.Ptr("West US"), - Tags: map[string]*string{ - "key1": to.Ptr("value1"), - }, - Properties: &armnetwork.SecurityPartnerProviderPropertiesFormat{ - SecurityProviderName: to.Ptr(armnetwork.SecurityProviderNameZScaler), - VirtualHub: &armnetwork.SubResource{ - ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/virtualHubs/hub1"), - }, - }, - }, nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - res, err := poller.PollUntilDone(ctx, nil) - if err != nil { - log.Fatalf("failed to pull the result: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.SecurityPartnerProvider = armnetwork.SecurityPartnerProvider{ - // Name: to.Ptr("securityPartnerProvider"), - // Type: to.Ptr("Microsoft.Network/securityPartnerProviders"), - // ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/securityPartnerProviders/securityPartnerProvider"), - // Location: to.Ptr("West US"), - // Tags: map[string]*string{ - // "key1": to.Ptr("value1"), - // }, - // Etag: to.Ptr("w/\\00000000-0000-0000-0000-000000000000\\"), - // Properties: &armnetwork.SecurityPartnerProviderPropertiesFormat{ - // ProvisioningState: to.Ptr(armnetwork.ProvisioningStateSucceeded), - // SecurityProviderName: to.Ptr(armnetwork.SecurityProviderNameZScaler), - // VirtualHub: &armnetwork.SubResource{ - // ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/virtualHubs/hub1"), - // }, - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/4883fa5dbf6f2c9093fac8ce334547e9dfac68fa/specification/network/resource-manager/Microsoft.Network/stable/2024-03-01/examples/SecurityPartnerProviderUpdateTags.json -func ExampleSecurityPartnerProvidersClient_UpdateTags() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armnetwork.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewSecurityPartnerProvidersClient().UpdateTags(ctx, "rg1", "securityPartnerProvider", armnetwork.TagsObject{ - Tags: map[string]*string{ - "tag1": to.Ptr("value1"), - "tag2": to.Ptr("value2"), - }, - }, nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.SecurityPartnerProvider = armnetwork.SecurityPartnerProvider{ - // Name: to.Ptr("fw1"), - // Type: to.Ptr("Microsoft.Network/securityPartnerProviders"), - // ID: to.Ptr("/subscriptions/subid/resourceGroups/azfwtest/providers/Microsoft.Network/securityPartnerProviders/securityPartnerProvider"), - // Location: to.Ptr("brazilsouth"), - // Tags: map[string]*string{ - // "tag1": to.Ptr("value1"), - // "tag2": to.Ptr("value2"), - // }, - // Properties: &armnetwork.SecurityPartnerProviderPropertiesFormat{ - // ProvisioningState: to.Ptr(armnetwork.ProvisioningStateSucceeded), - // SecurityProviderName: to.Ptr(armnetwork.SecurityProviderNameZScaler), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/4883fa5dbf6f2c9093fac8ce334547e9dfac68fa/specification/network/resource-manager/Microsoft.Network/stable/2024-03-01/examples/SecurityPartnerProviderListByResourceGroup.json -func ExampleSecurityPartnerProvidersClient_NewListByResourceGroupPager() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armnetwork.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := clientFactory.NewSecurityPartnerProvidersClient().NewListByResourceGroupPager("rg1", nil) - for pager.More() { - page, err := pager.NextPage(ctx) - if err != nil { - log.Fatalf("failed to advance page: %v", err) - } - for _, v := range page.Value { - // You could use page here. We use blank identifier for just demo purposes. - _ = v - } - // If the HTTP response code is 200 as defined in example definition, your page structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // page.SecurityPartnerProviderListResult = armnetwork.SecurityPartnerProviderListResult{ - // Value: []*armnetwork.SecurityPartnerProvider{ - // { - // Name: to.Ptr("securityPartnerProvider"), - // Type: to.Ptr("Microsoft.Network/securityPartnerProviders"), - // ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/securityPartnerProviders/securityPartnerProvider"), - // Location: to.Ptr("West US"), - // Tags: map[string]*string{ - // "key1": to.Ptr("value1"), - // }, - // Etag: to.Ptr("w/\\00000000-0000-0000-0000-000000000000\\"), - // Properties: &armnetwork.SecurityPartnerProviderPropertiesFormat{ - // ConnectionStatus: to.Ptr(armnetwork.SecurityPartnerProviderConnectionStatusUnknown), - // ProvisioningState: to.Ptr(armnetwork.ProvisioningStateSucceeded), - // SecurityProviderName: to.Ptr(armnetwork.SecurityProviderNameZScaler), - // VirtualHub: &armnetwork.SubResource{ - // ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/virtualHubs/hub1"), - // }, - // }, - // }}, - // } - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/4883fa5dbf6f2c9093fac8ce334547e9dfac68fa/specification/network/resource-manager/Microsoft.Network/stable/2024-03-01/examples/SecurityPartnerProviderListBySubscription.json -func ExampleSecurityPartnerProvidersClient_NewListPager() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armnetwork.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := clientFactory.NewSecurityPartnerProvidersClient().NewListPager(nil) - for pager.More() { - page, err := pager.NextPage(ctx) - if err != nil { - log.Fatalf("failed to advance page: %v", err) - } - for _, v := range page.Value { - // You could use page here. We use blank identifier for just demo purposes. - _ = v - } - // If the HTTP response code is 200 as defined in example definition, your page structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // page.SecurityPartnerProviderListResult = armnetwork.SecurityPartnerProviderListResult{ - // Value: []*armnetwork.SecurityPartnerProvider{ - // { - // Name: to.Ptr("securityPartnerProvider"), - // Type: to.Ptr("Microsoft.Network/securityPartnerProviders"), - // ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/securityPartnerProviders/securityPartnerProvider"), - // Location: to.Ptr("West US"), - // Tags: map[string]*string{ - // "key1": to.Ptr("value1"), - // }, - // Etag: to.Ptr("w/\\00000000-0000-0000-0000-000000000000\\"), - // Properties: &armnetwork.SecurityPartnerProviderPropertiesFormat{ - // ConnectionStatus: to.Ptr(armnetwork.SecurityPartnerProviderConnectionStatusUnknown), - // ProvisioningState: to.Ptr(armnetwork.ProvisioningStateSucceeded), - // SecurityProviderName: to.Ptr(armnetwork.SecurityProviderNameZScaler), - // VirtualHub: &armnetwork.SubResource{ - // ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/virtualHubs/hub1"), - // }, - // }, - // }}, - // } - } -} diff --git a/sdk/resourcemanager/network/armnetwork/securityrules_client_example_test.go b/sdk/resourcemanager/network/armnetwork/securityrules_client_example_test.go deleted file mode 100644 index 8eee7ed570c2..000000000000 --- a/sdk/resourcemanager/network/armnetwork/securityrules_client_example_test.go +++ /dev/null @@ -1,168 +0,0 @@ -//go:build go1.18 -// +build go1.18 - -// 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. -// DO NOT EDIT. - -package armnetwork_test - -import ( - "context" - "log" - - "github.com/Azure/azure-sdk-for-go/sdk/azcore/to" - "github.com/Azure/azure-sdk-for-go/sdk/azidentity" - "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/network/armnetwork/v6" -) - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/4883fa5dbf6f2c9093fac8ce334547e9dfac68fa/specification/network/resource-manager/Microsoft.Network/stable/2024-03-01/examples/NetworkSecurityGroupRuleDelete.json -func ExampleSecurityRulesClient_BeginDelete() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armnetwork.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewSecurityRulesClient().BeginDelete(ctx, "rg1", "testnsg", "rule1", nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - _, err = poller.PollUntilDone(ctx, nil) - if err != nil { - log.Fatalf("failed to pull the result: %v", err) - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/4883fa5dbf6f2c9093fac8ce334547e9dfac68fa/specification/network/resource-manager/Microsoft.Network/stable/2024-03-01/examples/NetworkSecurityGroupRuleGet.json -func ExampleSecurityRulesClient_Get() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armnetwork.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewSecurityRulesClient().Get(ctx, "rg1", "testnsg", "rule1", nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.SecurityRule = armnetwork.SecurityRule{ - // ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/networkSecurityGroups/testnsg/securityRules/rule1"), - // Name: to.Ptr("rule1"), - // Properties: &armnetwork.SecurityRulePropertiesFormat{ - // Access: to.Ptr(armnetwork.SecurityRuleAccessAllow), - // DestinationAddressPrefix: to.Ptr("*"), - // DestinationPortRange: to.Ptr("80"), - // Direction: to.Ptr(armnetwork.SecurityRuleDirectionInbound), - // Priority: to.Ptr[int32](130), - // ProvisioningState: to.Ptr(armnetwork.ProvisioningStateSucceeded), - // SourceAddressPrefix: to.Ptr("*"), - // SourcePortRange: to.Ptr("*"), - // Protocol: to.Ptr(armnetwork.SecurityRuleProtocolAsterisk), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/4883fa5dbf6f2c9093fac8ce334547e9dfac68fa/specification/network/resource-manager/Microsoft.Network/stable/2024-03-01/examples/NetworkSecurityGroupRuleCreate.json -func ExampleSecurityRulesClient_BeginCreateOrUpdate() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armnetwork.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewSecurityRulesClient().BeginCreateOrUpdate(ctx, "rg1", "testnsg", "rule1", armnetwork.SecurityRule{ - Properties: &armnetwork.SecurityRulePropertiesFormat{ - Access: to.Ptr(armnetwork.SecurityRuleAccessDeny), - DestinationAddressPrefix: to.Ptr("11.0.0.0/8"), - DestinationPortRange: to.Ptr("8080"), - Direction: to.Ptr(armnetwork.SecurityRuleDirectionOutbound), - Priority: to.Ptr[int32](100), - SourceAddressPrefix: to.Ptr("10.0.0.0/8"), - SourcePortRange: to.Ptr("*"), - Protocol: to.Ptr(armnetwork.SecurityRuleProtocolAsterisk), - }, - }, nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - res, err := poller.PollUntilDone(ctx, nil) - if err != nil { - log.Fatalf("failed to pull the result: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.SecurityRule = armnetwork.SecurityRule{ - // ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/networkSecurityGroups/testnsg/securityRules/rule1"), - // Name: to.Ptr("rule1"), - // Properties: &armnetwork.SecurityRulePropertiesFormat{ - // Access: to.Ptr(armnetwork.SecurityRuleAccessDeny), - // DestinationAddressPrefix: to.Ptr("11.0.0.0/8"), - // DestinationPortRange: to.Ptr("8080"), - // Direction: to.Ptr(armnetwork.SecurityRuleDirectionOutbound), - // Priority: to.Ptr[int32](100), - // ProvisioningState: to.Ptr(armnetwork.ProvisioningStateSucceeded), - // SourceAddressPrefix: to.Ptr("10.0.0.0/8"), - // SourcePortRange: to.Ptr("*"), - // Protocol: to.Ptr(armnetwork.SecurityRuleProtocolAsterisk), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/4883fa5dbf6f2c9093fac8ce334547e9dfac68fa/specification/network/resource-manager/Microsoft.Network/stable/2024-03-01/examples/NetworkSecurityGroupRuleList.json -func ExampleSecurityRulesClient_NewListPager() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armnetwork.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := clientFactory.NewSecurityRulesClient().NewListPager("rg1", "testnsg", nil) - for pager.More() { - page, err := pager.NextPage(ctx) - if err != nil { - log.Fatalf("failed to advance page: %v", err) - } - for _, v := range page.Value { - // You could use page here. We use blank identifier for just demo purposes. - _ = v - } - // If the HTTP response code is 200 as defined in example definition, your page structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // page.SecurityRuleListResult = armnetwork.SecurityRuleListResult{ - // Value: []*armnetwork.SecurityRule{ - // { - // ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/networkSecurityGroups/testnsg/securityRules/rule1"), - // Name: to.Ptr("rule1"), - // Properties: &armnetwork.SecurityRulePropertiesFormat{ - // Access: to.Ptr(armnetwork.SecurityRuleAccessAllow), - // DestinationAddressPrefix: to.Ptr("*"), - // DestinationPortRange: to.Ptr("80"), - // Direction: to.Ptr(armnetwork.SecurityRuleDirectionInbound), - // Priority: to.Ptr[int32](130), - // ProvisioningState: to.Ptr(armnetwork.ProvisioningStateSucceeded), - // SourceAddressPrefix: to.Ptr("*"), - // SourcePortRange: to.Ptr("*"), - // Protocol: to.Ptr(armnetwork.SecurityRuleProtocolAsterisk), - // }, - // }}, - // } - } -} diff --git a/sdk/resourcemanager/network/armnetwork/securityuserconfigurations_client_example_test.go b/sdk/resourcemanager/network/armnetwork/securityuserconfigurations_client_example_test.go deleted file mode 100644 index f932c18d38dd..000000000000 --- a/sdk/resourcemanager/network/armnetwork/securityuserconfigurations_client_example_test.go +++ /dev/null @@ -1,168 +0,0 @@ -//go:build go1.18 -// +build go1.18 - -// 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. -// DO NOT EDIT. - -package armnetwork_test - -import ( - "context" - "log" - - "github.com/Azure/azure-sdk-for-go/sdk/azcore/to" - "github.com/Azure/azure-sdk-for-go/sdk/azidentity" - "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/network/armnetwork/v6" -) - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/4883fa5dbf6f2c9093fac8ce334547e9dfac68fa/specification/network/resource-manager/Microsoft.Network/stable/2024-03-01/examples/NetworkManagerSecurityUserConfigurationList.json -func ExampleSecurityUserConfigurationsClient_NewListPager() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armnetwork.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := clientFactory.NewSecurityUserConfigurationsClient().NewListPager("rg1", "testNetworkManager", &armnetwork.SecurityUserConfigurationsClientListOptions{Top: nil, - SkipToken: nil, - }) - for pager.More() { - page, err := pager.NextPage(ctx) - if err != nil { - log.Fatalf("failed to advance page: %v", err) - } - for _, v := range page.Value { - // You could use page here. We use blank identifier for just demo purposes. - _ = v - } - // If the HTTP response code is 200 as defined in example definition, your page structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // page.SecurityUserConfigurationListResult = armnetwork.SecurityUserConfigurationListResult{ - // Value: []*armnetwork.SecurityUserConfiguration{ - // { - // Name: to.Ptr("myTestSecurityConfig"), - // Type: to.Ptr("Microsoft.Network/networkManagers/securityUserConfigurations"), - // ID: to.Ptr("/subscriptions/subId/resourceGroups/rg1/providers/Microsoft.Network/networkManagers/testNetworkManager/securityUserConfigurations/myTestSecurityConfig"), - // Properties: &armnetwork.SecurityUserConfigurationPropertiesFormat{ - // Description: to.Ptr("A sample policy"), - // ProvisioningState: to.Ptr(armnetwork.ProvisioningStateSucceeded), - // ResourceGUID: to.Ptr("f506e3ca-4d68-41f1-9099-b50bc2c1b198"), - // }, - // SystemData: &armnetwork.SystemData{ - // CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-01-11T18:52:27.000Z"); return t}()), - // CreatedBy: to.Ptr("b69a9388-9488-4534-b470-7ec6d41beef5"), - // CreatedByType: to.Ptr(armnetwork.CreatedByTypeUser), - // LastModifiedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-01-11T18:52:27.000Z"); return t}()), - // LastModifiedBy: to.Ptr("b69a9388-9488-4534-b470-7ec6d41beef5"), - // LastModifiedByType: to.Ptr(armnetwork.CreatedByTypeUser), - // }, - // }}, - // } - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/4883fa5dbf6f2c9093fac8ce334547e9dfac68fa/specification/network/resource-manager/Microsoft.Network/stable/2024-03-01/examples/NetworkManagerSecurityUserConfigurationGet.json -func ExampleSecurityUserConfigurationsClient_Get() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armnetwork.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewSecurityUserConfigurationsClient().Get(ctx, "rg1", "testNetworkManager", "myTestSecurityConfig", nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.SecurityUserConfiguration = armnetwork.SecurityUserConfiguration{ - // Name: to.Ptr("myTestSecurityConfig"), - // Type: to.Ptr("Microsoft.Network/networkManagers/securityUserConfigurations"), - // ID: to.Ptr("/subscriptions/subId/resourceGroups/rg1/providers/Microsoft.Network/networkManagers/testNetworkManager/securityUserConfigurations/myTestSecurityConfig"), - // Properties: &armnetwork.SecurityUserConfigurationPropertiesFormat{ - // Description: to.Ptr("A sample policy"), - // ProvisioningState: to.Ptr(armnetwork.ProvisioningStateSucceeded), - // ResourceGUID: to.Ptr("f506e3ca-4d68-41f1-9099-b50bc2c1b198"), - // }, - // SystemData: &armnetwork.SystemData{ - // CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-01-11T18:52:27.000Z"); return t}()), - // CreatedBy: to.Ptr("b69a9388-9488-4534-b470-7ec6d41beef5"), - // CreatedByType: to.Ptr(armnetwork.CreatedByTypeUser), - // LastModifiedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-01-11T18:52:27.000Z"); return t}()), - // LastModifiedBy: to.Ptr("b69a9388-9488-4534-b470-7ec6d41beef5"), - // LastModifiedByType: to.Ptr(armnetwork.CreatedByTypeUser), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/4883fa5dbf6f2c9093fac8ce334547e9dfac68fa/specification/network/resource-manager/Microsoft.Network/stable/2024-03-01/examples/NetworkManagerSecurityUserConfigurationPut.json -func ExampleSecurityUserConfigurationsClient_CreateOrUpdate() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armnetwork.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewSecurityUserConfigurationsClient().CreateOrUpdate(ctx, "rg1", "testNetworkManager", "myTestSecurityConfig", armnetwork.SecurityUserConfiguration{ - Properties: &armnetwork.SecurityUserConfigurationPropertiesFormat{ - Description: to.Ptr("A sample policy"), - }, - }, nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.SecurityUserConfiguration = armnetwork.SecurityUserConfiguration{ - // Name: to.Ptr("myTestSecurityConfig"), - // Type: to.Ptr("Microsoft.Network/networkManagers/securityConfigurations"), - // ID: to.Ptr("/subscriptions/subId/resourceGroups/rg1/providers/Microsoft.Network/networkManager/testNetworkManager/securityConfigurations/myTestSecurityConfig"), - // Properties: &armnetwork.SecurityUserConfigurationPropertiesFormat{ - // Description: to.Ptr("A sample policy"), - // ProvisioningState: to.Ptr(armnetwork.ProvisioningStateSucceeded), - // ResourceGUID: to.Ptr("e74045ed-c817-48df-adb2-a06753ad4fff"), - // }, - // SystemData: &armnetwork.SystemData{ - // CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-01-11T18:52:27.000Z"); return t}()), - // CreatedBy: to.Ptr("b69a9388-9488-4534-b470-7ec6d41beef5"), - // CreatedByType: to.Ptr(armnetwork.CreatedByTypeUser), - // LastModifiedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-01-11T18:52:27.000Z"); return t}()), - // LastModifiedBy: to.Ptr("b69a9388-9488-4534-b470-7ec6d41beef5"), - // LastModifiedByType: to.Ptr(armnetwork.CreatedByTypeUser), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/4883fa5dbf6f2c9093fac8ce334547e9dfac68fa/specification/network/resource-manager/Microsoft.Network/stable/2024-03-01/examples/NetworkManagerSecurityUserConfigurationDelete.json -func ExampleSecurityUserConfigurationsClient_BeginDelete() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armnetwork.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewSecurityUserConfigurationsClient().BeginDelete(ctx, "rg1", "testNetworkManager", "myTestSecurityConfig", &armnetwork.SecurityUserConfigurationsClientBeginDeleteOptions{Force: to.Ptr(false)}) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - _, err = poller.PollUntilDone(ctx, nil) - if err != nil { - log.Fatalf("failed to pull the result: %v", err) - } -} diff --git a/sdk/resourcemanager/network/armnetwork/securityuserrulecollections_client_example_test.go b/sdk/resourcemanager/network/armnetwork/securityuserrulecollections_client_example_test.go deleted file mode 100644 index e4cd891332bb..000000000000 --- a/sdk/resourcemanager/network/armnetwork/securityuserrulecollections_client_example_test.go +++ /dev/null @@ -1,184 +0,0 @@ -//go:build go1.18 -// +build go1.18 - -// 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. -// DO NOT EDIT. - -package armnetwork_test - -import ( - "context" - "log" - - "github.com/Azure/azure-sdk-for-go/sdk/azcore/to" - "github.com/Azure/azure-sdk-for-go/sdk/azidentity" - "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/network/armnetwork/v6" -) - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/4883fa5dbf6f2c9093fac8ce334547e9dfac68fa/specification/network/resource-manager/Microsoft.Network/stable/2024-03-01/examples/NetworkManagerSecurityUserRuleCollectionList.json -func ExampleSecurityUserRuleCollectionsClient_NewListPager() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armnetwork.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := clientFactory.NewSecurityUserRuleCollectionsClient().NewListPager("rg1", "testNetworkManager", "myTestSecurityConfig", &armnetwork.SecurityUserRuleCollectionsClientListOptions{Top: nil, - SkipToken: nil, - }) - for pager.More() { - page, err := pager.NextPage(ctx) - if err != nil { - log.Fatalf("failed to advance page: %v", err) - } - for _, v := range page.Value { - // You could use page here. We use blank identifier for just demo purposes. - _ = v - } - // If the HTTP response code is 200 as defined in example definition, your page structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // page.SecurityUserRuleCollectionListResult = armnetwork.SecurityUserRuleCollectionListResult{ - // Value: []*armnetwork.SecurityUserRuleCollection{ - // { - // Name: to.Ptr("testRuleCollection"), - // Type: to.Ptr("Microsoft.Network/networkManagers/securityUserConfigurations/ruleCollections"), - // ID: to.Ptr("/subscriptions/subId/resourceGroups/rg1/providers/Microsoft.Network/networkManagers/testNetworkManager/securityUserConfigurations/myTestSecurityConfig/ruleCollections/testRuleCollection"), - // Properties: &armnetwork.SecurityUserRuleCollectionPropertiesFormat{ - // Description: to.Ptr("A sample rule collection"), - // AppliesToGroups: []*armnetwork.SecurityUserGroupItem{ - // { - // NetworkGroupID: to.Ptr("/subscriptions/subId/resourceGroups/rg1/providers/Microsoft.Network/networkManagers/testNetworkManager/networkGroups/testGroup"), - // }}, - // ProvisioningState: to.Ptr(armnetwork.ProvisioningStateSucceeded), - // ResourceGUID: to.Ptr("4224a5e7-d273-43d4-9bb0-b38e9b937ded"), - // }, - // SystemData: &armnetwork.SystemData{ - // CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-01-11T18:52:27.000Z"); return t}()), - // CreatedBy: to.Ptr("b69a9388-9488-4534-b470-7ec6d41beef5"), - // CreatedByType: to.Ptr(armnetwork.CreatedByTypeUser), - // LastModifiedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-01-11T18:52:27.000Z"); return t}()), - // LastModifiedBy: to.Ptr("b69a9388-9488-4534-b470-7ec6d41beef5"), - // LastModifiedByType: to.Ptr(armnetwork.CreatedByTypeUser), - // }, - // }}, - // } - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/4883fa5dbf6f2c9093fac8ce334547e9dfac68fa/specification/network/resource-manager/Microsoft.Network/stable/2024-03-01/examples/NetworkManagerSecurityUserRuleCollectionGet.json -func ExampleSecurityUserRuleCollectionsClient_Get() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armnetwork.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewSecurityUserRuleCollectionsClient().Get(ctx, "rg1", "testNetworkManager", "myTestSecurityConfig", "testRuleCollection", nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.SecurityUserRuleCollection = armnetwork.SecurityUserRuleCollection{ - // Name: to.Ptr("testRuleCollection"), - // Type: to.Ptr("Microsoft.Network/networkManagers/securityUserConfigurations/ruleCollections"), - // ID: to.Ptr("/subscriptions/subId/resourceGroups/rg1/providers/Microsoft.Network/networkManagers/testNetworkManager/securityUserConfigurations/myTestSecurityConfig/ruleCollections/testRuleCollection"), - // Properties: &armnetwork.SecurityUserRuleCollectionPropertiesFormat{ - // Description: to.Ptr("A sample rule collection"), - // AppliesToGroups: []*armnetwork.SecurityUserGroupItem{ - // { - // NetworkGroupID: to.Ptr("/subscriptions/subId/resourceGroups/rg1/providers/Microsoft.Network/networkManagers/testNetworkManager/networkGroups/testGroup"), - // }}, - // ProvisioningState: to.Ptr(armnetwork.ProvisioningStateSucceeded), - // ResourceGUID: to.Ptr("4224a5e7-d273-43d4-9bb0-b38e9b937ded"), - // }, - // SystemData: &armnetwork.SystemData{ - // CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-01-11T18:52:27.000Z"); return t}()), - // CreatedBy: to.Ptr("b69a9388-9488-4534-b470-7ec6d41beef5"), - // CreatedByType: to.Ptr(armnetwork.CreatedByTypeUser), - // LastModifiedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-01-11T18:52:27.000Z"); return t}()), - // LastModifiedBy: to.Ptr("b69a9388-9488-4534-b470-7ec6d41beef5"), - // LastModifiedByType: to.Ptr(armnetwork.CreatedByTypeUser), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/4883fa5dbf6f2c9093fac8ce334547e9dfac68fa/specification/network/resource-manager/Microsoft.Network/stable/2024-03-01/examples/NetworkManagerSecurityUserRuleCollectionPut.json -func ExampleSecurityUserRuleCollectionsClient_CreateOrUpdate() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armnetwork.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewSecurityUserRuleCollectionsClient().CreateOrUpdate(ctx, "rg1", "testNetworkManager", "myTestSecurityConfig", "testRuleCollection", armnetwork.SecurityUserRuleCollection{ - Properties: &armnetwork.SecurityUserRuleCollectionPropertiesFormat{ - Description: to.Ptr("A sample policy"), - AppliesToGroups: []*armnetwork.SecurityUserGroupItem{ - { - NetworkGroupID: to.Ptr("/subscriptions/subId/resourceGroups/rg1/providers/Microsoft.Network/networkManagers/testNetworkManager/networkGroups/testGroup"), - }}, - }, - }, nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.SecurityUserRuleCollection = armnetwork.SecurityUserRuleCollection{ - // Name: to.Ptr("myTestSecurityConfig"), - // Type: to.Ptr("Microsoft.Network/networkManagers/securityUserConfigurations/ruleCollections"), - // ID: to.Ptr("/subscriptions/subId/resourceGroups/rg1/providers/Microsoft.Network/networkManager/testNetworkManager/securityUserConfigurations/myTestSecurityConfig/ruleCollections/testRuleCollection"), - // Properties: &armnetwork.SecurityUserRuleCollectionPropertiesFormat{ - // Description: to.Ptr("A sample policy"), - // AppliesToGroups: []*armnetwork.SecurityUserGroupItem{ - // { - // NetworkGroupID: to.Ptr("/subscriptions/subId/resourceGroups/rg1/providers/Microsoft.Network/networkManagers/testNetworkManager/networkGroups/testGroup"), - // }}, - // ProvisioningState: to.Ptr(armnetwork.ProvisioningStateSucceeded), - // ResourceGUID: to.Ptr("4224a5e7-d273-43d4-9bb0-b38e9b937ded"), - // }, - // SystemData: &armnetwork.SystemData{ - // CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-01-11T18:52:27.000Z"); return t}()), - // CreatedBy: to.Ptr("b69a9388-9488-4534-b470-7ec6d41beef5"), - // CreatedByType: to.Ptr(armnetwork.CreatedByTypeUser), - // LastModifiedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-01-11T18:52:27.000Z"); return t}()), - // LastModifiedBy: to.Ptr("b69a9388-9488-4534-b470-7ec6d41beef5"), - // LastModifiedByType: to.Ptr(armnetwork.CreatedByTypeUser), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/4883fa5dbf6f2c9093fac8ce334547e9dfac68fa/specification/network/resource-manager/Microsoft.Network/stable/2024-03-01/examples/NetworkManagerSecurityUserRuleCollectionDelete.json -func ExampleSecurityUserRuleCollectionsClient_BeginDelete() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armnetwork.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewSecurityUserRuleCollectionsClient().BeginDelete(ctx, "rg1", "testNetworkManager", "myTestSecurityConfig", "testRuleCollection", &armnetwork.SecurityUserRuleCollectionsClientBeginDeleteOptions{Force: to.Ptr(false)}) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - _, err = poller.PollUntilDone(ctx, nil) - if err != nil { - log.Fatalf("failed to pull the result: %v", err) - } -} diff --git a/sdk/resourcemanager/network/armnetwork/securityuserrules_client_example_test.go b/sdk/resourcemanager/network/armnetwork/securityuserrules_client_example_test.go deleted file mode 100644 index 130882dee156..000000000000 --- a/sdk/resourcemanager/network/armnetwork/securityuserrules_client_example_test.go +++ /dev/null @@ -1,232 +0,0 @@ -//go:build go1.18 -// +build go1.18 - -// 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. -// DO NOT EDIT. - -package armnetwork_test - -import ( - "context" - "log" - - "github.com/Azure/azure-sdk-for-go/sdk/azcore/to" - "github.com/Azure/azure-sdk-for-go/sdk/azidentity" - "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/network/armnetwork/v6" -) - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/4883fa5dbf6f2c9093fac8ce334547e9dfac68fa/specification/network/resource-manager/Microsoft.Network/stable/2024-03-01/examples/NetworkManagerSecurityUserRuleList.json -func ExampleSecurityUserRulesClient_NewListPager() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armnetwork.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := clientFactory.NewSecurityUserRulesClient().NewListPager("rg1", "testNetworkManager", "myTestSecurityConfig", "testRuleCollection", &armnetwork.SecurityUserRulesClientListOptions{Top: nil, - SkipToken: nil, - }) - for pager.More() { - page, err := pager.NextPage(ctx) - if err != nil { - log.Fatalf("failed to advance page: %v", err) - } - for _, v := range page.Value { - // You could use page here. We use blank identifier for just demo purposes. - _ = v - } - // If the HTTP response code is 200 as defined in example definition, your page structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // page.SecurityUserRuleListResult = armnetwork.SecurityUserRuleListResult{ - // Value: []*armnetwork.SecurityUserRule{ - // { - // Name: to.Ptr("SampleUserRule"), - // Type: to.Ptr("Microsoft.Network/networkManagers/securityConfigurations/ruleCollections/rules"), - // ID: to.Ptr("/subscriptions/subId/resourceGroups/rg1/providers/Microsoft.Network/networkmanagers/testNetworkManager/securityUserConfigurations/myTestSecurityConfig/ruleCollections/testRuleCollection/rules/SampleUserRule"), - // Properties: &armnetwork.SecurityUserRulePropertiesFormat{ - // Description: to.Ptr("Sample User Rule"), - // DestinationPortRanges: []*string{ - // to.Ptr("22")}, - // Destinations: []*armnetwork.AddressPrefixItem{ - // { - // AddressPrefix: to.Ptr("*"), - // AddressPrefixType: to.Ptr(armnetwork.AddressPrefixTypeIPPrefix), - // }}, - // Direction: to.Ptr(armnetwork.SecurityConfigurationRuleDirectionInbound), - // ProvisioningState: to.Ptr(armnetwork.ProvisioningStateSucceeded), - // ResourceGUID: to.Ptr("f930553b-f78d-48c5-9445-6cf86b85e615"), - // SourcePortRanges: []*string{ - // to.Ptr("0-65535")}, - // Sources: []*armnetwork.AddressPrefixItem{ - // { - // AddressPrefix: to.Ptr("*"), - // AddressPrefixType: to.Ptr(armnetwork.AddressPrefixTypeIPPrefix), - // }}, - // Protocol: to.Ptr(armnetwork.SecurityConfigurationRuleProtocolTCP), - // }, - // SystemData: &armnetwork.SystemData{ - // CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-01-11T18:52:27.000Z"); return t}()), - // CreatedBy: to.Ptr("b69a9388-9488-4534-b470-7ec6d41beef5"), - // CreatedByType: to.Ptr(armnetwork.CreatedByTypeUser), - // LastModifiedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-01-11T18:52:27.000Z"); return t}()), - // LastModifiedBy: to.Ptr("b69a9388-9488-4534-b470-7ec6d41beef5"), - // LastModifiedByType: to.Ptr(armnetwork.CreatedByTypeUser), - // }, - // }}, - // } - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/4883fa5dbf6f2c9093fac8ce334547e9dfac68fa/specification/network/resource-manager/Microsoft.Network/stable/2024-03-01/examples/NetworkManagerSecurityUserRuleGet.json -func ExampleSecurityUserRulesClient_Get() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armnetwork.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewSecurityUserRulesClient().Get(ctx, "rg1", "testNetworkManager", "myTestSecurityConfig", "testRuleCollection", "SampleUserRule", nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.SecurityUserRule = armnetwork.SecurityUserRule{ - // Name: to.Ptr("SampleUserRule"), - // Type: to.Ptr("Microsoft.Network/networkManagers/SecurityUserConfigurations/ruleCollections/rules"), - // ID: to.Ptr("/subscriptions/subId/resourceGroups/rg1/providers/Microsoft.Network/networkManagers/testNetworkManager/SecurityUserConfigurations/myTestSecurityConfig/ruleCollections/testRuleCollection/rules/SampleUserRule"), - // Properties: &armnetwork.SecurityUserRulePropertiesFormat{ - // Description: to.Ptr("Sample User Rule"), - // DestinationPortRanges: []*string{ - // to.Ptr("22")}, - // Destinations: []*armnetwork.AddressPrefixItem{ - // { - // AddressPrefix: to.Ptr("*"), - // AddressPrefixType: to.Ptr(armnetwork.AddressPrefixTypeIPPrefix), - // }}, - // Direction: to.Ptr(armnetwork.SecurityConfigurationRuleDirectionInbound), - // ProvisioningState: to.Ptr(armnetwork.ProvisioningStateSucceeded), - // ResourceGUID: to.Ptr("f930553b-f78d-48c5-9445-6cf86b85e615"), - // SourcePortRanges: []*string{ - // to.Ptr("0-65535")}, - // Sources: []*armnetwork.AddressPrefixItem{ - // { - // AddressPrefix: to.Ptr("*"), - // AddressPrefixType: to.Ptr(armnetwork.AddressPrefixTypeIPPrefix), - // }}, - // Protocol: to.Ptr(armnetwork.SecurityConfigurationRuleProtocolTCP), - // }, - // SystemData: &armnetwork.SystemData{ - // CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-01-11T18:52:27.000Z"); return t}()), - // CreatedBy: to.Ptr("b69a9388-9488-4534-b470-7ec6d41beef5"), - // CreatedByType: to.Ptr(armnetwork.CreatedByTypeUser), - // LastModifiedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-01-11T18:52:27.000Z"); return t}()), - // LastModifiedBy: to.Ptr("b69a9388-9488-4534-b470-7ec6d41beef5"), - // LastModifiedByType: to.Ptr(armnetwork.CreatedByTypeUser), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/4883fa5dbf6f2c9093fac8ce334547e9dfac68fa/specification/network/resource-manager/Microsoft.Network/stable/2024-03-01/examples/NetworkManagerSecurityUserRulePut.json -func ExampleSecurityUserRulesClient_CreateOrUpdate() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armnetwork.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewSecurityUserRulesClient().CreateOrUpdate(ctx, "rg1", "testNetworkManager", "myTestSecurityConfig", "testRuleCollection", "SampleUserRule", armnetwork.SecurityUserRule{ - Properties: &armnetwork.SecurityUserRulePropertiesFormat{ - Description: to.Ptr("Sample User Rule"), - DestinationPortRanges: []*string{ - to.Ptr("22")}, - Destinations: []*armnetwork.AddressPrefixItem{ - { - AddressPrefix: to.Ptr("*"), - AddressPrefixType: to.Ptr(armnetwork.AddressPrefixTypeIPPrefix), - }}, - Direction: to.Ptr(armnetwork.SecurityConfigurationRuleDirectionInbound), - SourcePortRanges: []*string{ - to.Ptr("0-65535")}, - Sources: []*armnetwork.AddressPrefixItem{ - { - AddressPrefix: to.Ptr("*"), - AddressPrefixType: to.Ptr(armnetwork.AddressPrefixTypeIPPrefix), - }}, - Protocol: to.Ptr(armnetwork.SecurityConfigurationRuleProtocolTCP), - }, - }, nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.SecurityUserRule = armnetwork.SecurityUserRule{ - // Name: to.Ptr("SampleUserRule"), - // Type: to.Ptr("Microsoft.Network/networkManagers/SecurityUserConfigurations/ruleCollections/rules"), - // ID: to.Ptr("/subscriptions/subId/resourceGroups/rg1/providers/Microsoft.Network/networkManagers/testNetworkManager/SecurityUserConfigurations/Policy1/ruleCollections/testRuleCollection/rules/SampleUserRule"), - // Properties: &armnetwork.SecurityUserRulePropertiesFormat{ - // Description: to.Ptr("Sample User Rule"), - // DestinationPortRanges: []*string{ - // to.Ptr("22")}, - // Destinations: []*armnetwork.AddressPrefixItem{ - // { - // AddressPrefix: to.Ptr("*"), - // AddressPrefixType: to.Ptr(armnetwork.AddressPrefixTypeIPPrefix), - // }}, - // Direction: to.Ptr(armnetwork.SecurityConfigurationRuleDirectionInbound), - // ProvisioningState: to.Ptr(armnetwork.ProvisioningStateSucceeded), - // ResourceGUID: to.Ptr("f930553b-f78d-48c5-9445-6cf86b85e615"), - // SourcePortRanges: []*string{ - // to.Ptr("0-65535")}, - // Sources: []*armnetwork.AddressPrefixItem{ - // { - // AddressPrefix: to.Ptr("*"), - // AddressPrefixType: to.Ptr(armnetwork.AddressPrefixTypeIPPrefix), - // }}, - // Protocol: to.Ptr(armnetwork.SecurityConfigurationRuleProtocolTCP), - // }, - // SystemData: &armnetwork.SystemData{ - // CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-01-11T18:52:27.000Z"); return t}()), - // CreatedBy: to.Ptr("b69a9388-9488-4534-b470-7ec6d41beef5"), - // CreatedByType: to.Ptr(armnetwork.CreatedByTypeUser), - // LastModifiedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-01-11T18:52:27.000Z"); return t}()), - // LastModifiedBy: to.Ptr("b69a9388-9488-4534-b470-7ec6d41beef5"), - // LastModifiedByType: to.Ptr(armnetwork.CreatedByTypeUser), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/4883fa5dbf6f2c9093fac8ce334547e9dfac68fa/specification/network/resource-manager/Microsoft.Network/stable/2024-03-01/examples/NetworkManagerSecurityUserRuleDelete.json -func ExampleSecurityUserRulesClient_BeginDelete() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armnetwork.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewSecurityUserRulesClient().BeginDelete(ctx, "rg1", "testNetworkManager", "myTestSecurityConfig", "testRuleCollection", "SampleUserRule", &armnetwork.SecurityUserRulesClientBeginDeleteOptions{Force: to.Ptr(false)}) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - _, err = poller.PollUntilDone(ctx, nil) - if err != nil { - log.Fatalf("failed to pull the result: %v", err) - } -} diff --git a/sdk/resourcemanager/network/armnetwork/serviceassociationlinks_client_example_test.go b/sdk/resourcemanager/network/armnetwork/serviceassociationlinks_client_example_test.go deleted file mode 100644 index b0ab0e474e65..000000000000 --- a/sdk/resourcemanager/network/armnetwork/serviceassociationlinks_client_example_test.go +++ /dev/null @@ -1,54 +0,0 @@ -//go:build go1.18 -// +build go1.18 - -// 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. -// DO NOT EDIT. - -package armnetwork_test - -import ( - "context" - "log" - - "github.com/Azure/azure-sdk-for-go/sdk/azidentity" - "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/network/armnetwork/v6" -) - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/4883fa5dbf6f2c9093fac8ce334547e9dfac68fa/specification/network/resource-manager/Microsoft.Network/stable/2024-03-01/examples/VirtualNetworkGetServiceAssociationLinks.json -func ExampleServiceAssociationLinksClient_List() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armnetwork.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewServiceAssociationLinksClient().List(ctx, "rg1", "vnet", "subnet", nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.ServiceAssociationLinksListResult = armnetwork.ServiceAssociationLinksListResult{ - // Value: []*armnetwork.ServiceAssociationLink{ - // { - // ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/virtualNetworks/vnet/subnets/subnet/serviceAssociationLinks/acisal"), - // Name: to.Ptr("acisal"), - // Type: to.Ptr("Microsoft.Network/virtualNetworks/subnets/serviceAssociationLinks"), - // Etag: to.Ptr("W/\"00000000-0000-0000-0000-000000000000\""), - // Properties: &armnetwork.ServiceAssociationLinkPropertiesFormat{ - // AllowDelete: to.Ptr(true), - // LinkedResourceType: to.Ptr("Microsoft.ContainerInstance/containerGroups"), - // Locations: []*string{ - // to.Ptr("westus")}, - // ProvisioningState: to.Ptr(armnetwork.ProvisioningStateSucceeded), - // }, - // }}, - // } -} diff --git a/sdk/resourcemanager/network/armnetwork/serviceendpointpolicies_client_example_test.go b/sdk/resourcemanager/network/armnetwork/serviceendpointpolicies_client_example_test.go deleted file mode 100644 index c9148e7d7636..000000000000 --- a/sdk/resourcemanager/network/armnetwork/serviceendpointpolicies_client_example_test.go +++ /dev/null @@ -1,397 +0,0 @@ -//go:build go1.18 -// +build go1.18 - -// 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. -// DO NOT EDIT. - -package armnetwork_test - -import ( - "context" - "log" - - "github.com/Azure/azure-sdk-for-go/sdk/azcore/to" - "github.com/Azure/azure-sdk-for-go/sdk/azidentity" - "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/network/armnetwork/v6" -) - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/4883fa5dbf6f2c9093fac8ce334547e9dfac68fa/specification/network/resource-manager/Microsoft.Network/stable/2024-03-01/examples/ServiceEndpointPolicyDelete.json -func ExampleServiceEndpointPoliciesClient_BeginDelete() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armnetwork.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewServiceEndpointPoliciesClient().BeginDelete(ctx, "rg1", "serviceEndpointPolicy1", nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - _, err = poller.PollUntilDone(ctx, nil) - if err != nil { - log.Fatalf("failed to pull the result: %v", err) - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/4883fa5dbf6f2c9093fac8ce334547e9dfac68fa/specification/network/resource-manager/Microsoft.Network/stable/2024-03-01/examples/ServiceEndpointPolicyGet.json -func ExampleServiceEndpointPoliciesClient_Get() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armnetwork.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewServiceEndpointPoliciesClient().Get(ctx, "rg1", "testServiceEndpointPolicy", &armnetwork.ServiceEndpointPoliciesClientGetOptions{Expand: nil}) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.ServiceEndpointPolicy = armnetwork.ServiceEndpointPolicy{ - // Name: to.Ptr("testServiceEndpointPolicy"), - // Type: to.Ptr("Microsoft.Network/serviceEndpointPolicies"), - // ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/serviceEndpointPolicies/testServiceEndpointPolicy"), - // Location: to.Ptr("westus"), - // Properties: &armnetwork.ServiceEndpointPolicyPropertiesFormat{ - // ProvisioningState: to.Ptr(armnetwork.ProvisioningStateSucceeded), - // ResourceGUID: to.Ptr("6A7C139D-8B8D-499B-B7CB-4F3F02A8A44F"), - // ServiceEndpointPolicyDefinitions: []*armnetwork.ServiceEndpointPolicyDefinition{ - // { - // ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/serviceEndpointPolicies/testServiceEndpointPolicy/serviceEndpointPolicyDefinitions/StorageServiceEndpointPolicyDefinition"), - // Name: to.Ptr("StorageServiceEndpointPolicyDefinition"), - // Properties: &armnetwork.ServiceEndpointPolicyDefinitionPropertiesFormat{ - // Description: to.Ptr("Storage Service EndpointPolicy Definition"), - // Service: to.Ptr("Microsoft.Storage"), - // ServiceResources: []*string{ - // to.Ptr("/subscriptions/subid1"), - // to.Ptr("/subscriptions/subid1/resourceGroups/storageRg"), - // to.Ptr("/subscriptions/subid1/resourceGroups/storageRg/providers/Microsoft.Storage/storageAccounts/stAccount")}, - // }, - // }}, - // Subnets: []*armnetwork.Subnet{ - // }, - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/4883fa5dbf6f2c9093fac8ce334547e9dfac68fa/specification/network/resource-manager/Microsoft.Network/stable/2024-03-01/examples/ServiceEndpointPolicyCreate.json -func ExampleServiceEndpointPoliciesClient_BeginCreateOrUpdate_createServiceEndpointPolicy() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armnetwork.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewServiceEndpointPoliciesClient().BeginCreateOrUpdate(ctx, "rg1", "testPolicy", armnetwork.ServiceEndpointPolicy{ - Location: to.Ptr("westus"), - }, nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - res, err := poller.PollUntilDone(ctx, nil) - if err != nil { - log.Fatalf("failed to pull the result: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.ServiceEndpointPolicy = armnetwork.ServiceEndpointPolicy{ - // Name: to.Ptr("testnsg"), - // Type: to.Ptr("Microsoft.Network/ServiceEndpointPolicies"), - // ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/ServiceEndpointPolicies/testpolicy"), - // Location: to.Ptr("westus"), - // Properties: &armnetwork.ServiceEndpointPolicyPropertiesFormat{ - // ProvisioningState: to.Ptr(armnetwork.ProvisioningStateSucceeded), - // ResourceGUID: to.Ptr("6A7C139D-8B8D-499B-B7CB-4F3F02A8A44F"), - // ServiceEndpointPolicyDefinitions: []*armnetwork.ServiceEndpointPolicyDefinition{ - // }, - // Subnets: []*armnetwork.Subnet{ - // }, - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/4883fa5dbf6f2c9093fac8ce334547e9dfac68fa/specification/network/resource-manager/Microsoft.Network/stable/2024-03-01/examples/ServiceEndpointPolicyCreateWithDefinition.json -func ExampleServiceEndpointPoliciesClient_BeginCreateOrUpdate_createServiceEndpointPolicyWithDefinition() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armnetwork.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewServiceEndpointPoliciesClient().BeginCreateOrUpdate(ctx, "rg1", "testPolicy", armnetwork.ServiceEndpointPolicy{ - Location: to.Ptr("westus"), - Properties: &armnetwork.ServiceEndpointPolicyPropertiesFormat{ - ServiceEndpointPolicyDefinitions: []*armnetwork.ServiceEndpointPolicyDefinition{ - { - Name: to.Ptr("StorageServiceEndpointPolicyDefinition"), - Properties: &armnetwork.ServiceEndpointPolicyDefinitionPropertiesFormat{ - Description: to.Ptr("Storage Service EndpointPolicy Definition"), - Service: to.Ptr("Microsoft.Storage"), - ServiceResources: []*string{ - to.Ptr("/subscriptions/subid1"), - to.Ptr("/subscriptions/subid1/resourceGroups/storageRg"), - to.Ptr("/subscriptions/subid1/resourceGroups/storageRg/providers/Microsoft.Storage/storageAccounts/stAccount")}, - }, - }}, - }, - }, nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - res, err := poller.PollUntilDone(ctx, nil) - if err != nil { - log.Fatalf("failed to pull the result: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.ServiceEndpointPolicy = armnetwork.ServiceEndpointPolicy{ - // Name: to.Ptr("testnsg"), - // Type: to.Ptr("Microsoft.Network/ServiceEndpointPolicies"), - // ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/ServiceEndpointPolicies/testpolicy"), - // Location: to.Ptr("westus"), - // Properties: &armnetwork.ServiceEndpointPolicyPropertiesFormat{ - // ProvisioningState: to.Ptr(armnetwork.ProvisioningStateSucceeded), - // ResourceGUID: to.Ptr("6A7C139D-8B8D-499B-B7CB-4F3F02A8A44F"), - // ServiceEndpointPolicyDefinitions: []*armnetwork.ServiceEndpointPolicyDefinition{ - // { - // ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/serviceEndpointPolicies/testServiceEndpointPolicy/serviceEndpointPolicyDefinitions/StorageServiceEndpointPolicyDefinition"), - // Name: to.Ptr("StorageServiceEndpointPolicyDefinition"), - // Properties: &armnetwork.ServiceEndpointPolicyDefinitionPropertiesFormat{ - // Description: to.Ptr("Storage Service EndpointPolicy Definition"), - // Service: to.Ptr("Microsoft.Storage"), - // ServiceResources: []*string{ - // to.Ptr("/subscriptions/subid1"), - // to.Ptr("/subscriptions/subid1/resourceGroups/storageRg"), - // to.Ptr("/subscriptions/subid1/resourceGroups/storageRg/providers/Microsoft.Storage/storageAccounts/stAccount")}, - // }, - // }}, - // Subnets: []*armnetwork.Subnet{ - // }, - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/4883fa5dbf6f2c9093fac8ce334547e9dfac68fa/specification/network/resource-manager/Microsoft.Network/stable/2024-03-01/examples/ServiceEndpointPolicyUpdateTags.json -func ExampleServiceEndpointPoliciesClient_UpdateTags() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armnetwork.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewServiceEndpointPoliciesClient().UpdateTags(ctx, "rg1", "testServiceEndpointPolicy", armnetwork.TagsObject{ - Tags: map[string]*string{ - "tag1": to.Ptr("value1"), - "tag2": to.Ptr("value2"), - }, - }, nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.ServiceEndpointPolicy = armnetwork.ServiceEndpointPolicy{ - // Name: to.Ptr("testServiceEndpointPolicy"), - // Type: to.Ptr("Microsoft.Network/serviceEndpointPolicies"), - // ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/serviceEndpointPolicies/testServiceEndpointPolicy"), - // Location: to.Ptr("westus"), - // Tags: map[string]*string{ - // "tag1": to.Ptr("value1"), - // "tag2": to.Ptr("value2"), - // }, - // Properties: &armnetwork.ServiceEndpointPolicyPropertiesFormat{ - // ProvisioningState: to.Ptr(armnetwork.ProvisioningStateSucceeded), - // ResourceGUID: to.Ptr("00000000-0000-0000-0000-000000000000"), - // ServiceEndpointPolicyDefinitions: []*armnetwork.ServiceEndpointPolicyDefinition{ - // { - // Name: to.Ptr("StorageServiceEndpointPolicyDefinition"), - // Properties: &armnetwork.ServiceEndpointPolicyDefinitionPropertiesFormat{ - // Description: to.Ptr("Storage Service EndpointPolicy Definition"), - // Service: to.Ptr("Microsoft.Storage"), - // ServiceResources: []*string{ - // to.Ptr("/subscriptions/subid1"), - // to.Ptr("/subscriptions/subid1/resourceGroups/storageRg"), - // to.Ptr("/subscriptions/subid1/resourceGroups/storageRg/providers/Microsoft.Storage/storageAccounts/stAccount")}, - // }, - // }}, - // Subnets: []*armnetwork.Subnet{ - // }, - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/4883fa5dbf6f2c9093fac8ce334547e9dfac68fa/specification/network/resource-manager/Microsoft.Network/stable/2024-03-01/examples/ServiceEndpointPolicyListAll.json -func ExampleServiceEndpointPoliciesClient_NewListPager() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armnetwork.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := clientFactory.NewServiceEndpointPoliciesClient().NewListPager(nil) - for pager.More() { - page, err := pager.NextPage(ctx) - if err != nil { - log.Fatalf("failed to advance page: %v", err) - } - for _, v := range page.Value { - // You could use page here. We use blank identifier for just demo purposes. - _ = v - } - // If the HTTP response code is 200 as defined in example definition, your page structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // page.ServiceEndpointPolicyListResult = armnetwork.ServiceEndpointPolicyListResult{ - // Value: []*armnetwork.ServiceEndpointPolicy{ - // { - // Name: to.Ptr("testPolicy"), - // Type: to.Ptr("Microsoft.Network/serviceEndpointPolicies"), - // ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/serviceEndpointPolicies/testPolicy"), - // Location: to.Ptr("westus"), - // Properties: &armnetwork.ServiceEndpointPolicyPropertiesFormat{ - // ProvisioningState: to.Ptr(armnetwork.ProvisioningStateSucceeded), - // ResourceGUID: to.Ptr("6A7C139D-8B8D-499B-B7CB-4F3F02A8A44F"), - // ServiceEndpointPolicyDefinitions: []*armnetwork.ServiceEndpointPolicyDefinition{ - // { - // ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/serviceEndpointPolicies/testPolicy/serviceEndpointPolicyDefinitions/StorageServiceEndpointPolicyDefinition1"), - // Name: to.Ptr("StorageServiceEndpointPolicyDefinition1"), - // Properties: &armnetwork.ServiceEndpointPolicyDefinitionPropertiesFormat{ - // Description: to.Ptr("Storage Service EndpointPolicy Definition"), - // Service: to.Ptr("Microsoft.Storage"), - // ServiceResources: []*string{ - // to.Ptr("/subscriptions/subid1"), - // to.Ptr("/subscriptions/subid1/resourceGroups/storageRg"), - // to.Ptr("/subscriptions/subid1/resourceGroups/storageRg/providers/Microsoft.Storage/storageAccounts/stAccount")}, - // }, - // }}, - // Subnets: []*armnetwork.Subnet{ - // }, - // }, - // }, - // { - // Name: to.Ptr("testPolicy1"), - // Type: to.Ptr("Microsoft.Network/serviceEndpointPolicies"), - // ID: to.Ptr("/subscriptions/subid/resourceGroups/rg2/providers/Microsoft.Network/serviceEndpointPolicies/testPolicy2"), - // Location: to.Ptr("westus"), - // Properties: &armnetwork.ServiceEndpointPolicyPropertiesFormat{ - // ProvisioningState: to.Ptr(armnetwork.ProvisioningStateSucceeded), - // ResourceGUID: to.Ptr("6A7C139D-8B8D-499B-B7CB-4F3F02A8A44F"), - // ServiceEndpointPolicyDefinitions: []*armnetwork.ServiceEndpointPolicyDefinition{ - // { - // ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/serviceEndpointPolicies/testPolicy1/serviceEndpointPolicyDefinitions/StorageServiceEndpointPolicyDefinition2"), - // Name: to.Ptr("StorageServiceEndpointPolicyDefinition2"), - // Properties: &armnetwork.ServiceEndpointPolicyDefinitionPropertiesFormat{ - // Description: to.Ptr("Storage Service EndpointPolicy Definition"), - // Service: to.Ptr("Microsoft.Storage"), - // ServiceResources: []*string{ - // to.Ptr("/subscriptions/subid1"), - // to.Ptr("/subscriptions/subid1/resourceGroups/storageRg"), - // to.Ptr("/subscriptions/subid1/resourceGroups/storageRg/providers/Microsoft.Storage/storageAccounts/stAccount")}, - // }, - // }}, - // Subnets: []*armnetwork.Subnet{ - // }, - // }, - // }}, - // } - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/4883fa5dbf6f2c9093fac8ce334547e9dfac68fa/specification/network/resource-manager/Microsoft.Network/stable/2024-03-01/examples/ServiceEndpointPolicyList.json -func ExampleServiceEndpointPoliciesClient_NewListByResourceGroupPager() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armnetwork.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := clientFactory.NewServiceEndpointPoliciesClient().NewListByResourceGroupPager("rg1", nil) - for pager.More() { - page, err := pager.NextPage(ctx) - if err != nil { - log.Fatalf("failed to advance page: %v", err) - } - for _, v := range page.Value { - // You could use page here. We use blank identifier for just demo purposes. - _ = v - } - // If the HTTP response code is 200 as defined in example definition, your page structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // page.ServiceEndpointPolicyListResult = armnetwork.ServiceEndpointPolicyListResult{ - // Value: []*armnetwork.ServiceEndpointPolicy{ - // { - // Name: to.Ptr("testServiceEndpointPolicy"), - // ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/serviceEndpointPolicies/testServiceEndpointPolicy"), - // Location: to.Ptr("westus"), - // Properties: &armnetwork.ServiceEndpointPolicyPropertiesFormat{ - // ProvisioningState: to.Ptr(armnetwork.ProvisioningStateSucceeded), - // ResourceGUID: to.Ptr("6A7C139D-8B8D-499B-B7CB-4F3F02A8A44F"), - // ServiceEndpointPolicyDefinitions: []*armnetwork.ServiceEndpointPolicyDefinition{ - // { - // ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/serviceEndpointPolicies/testServiceEndpointPolicy/serviceEndpointPolicyDefinitions/StorageServiceEndpointPolicyDefinition"), - // Name: to.Ptr("StorageServiceEndpointPolicyDefinition"), - // Properties: &armnetwork.ServiceEndpointPolicyDefinitionPropertiesFormat{ - // Description: to.Ptr("Storage Service EndpointPolicy Definition"), - // Service: to.Ptr("Microsoft.Storage"), - // ServiceResources: []*string{ - // to.Ptr("/subscriptions/subid1"), - // to.Ptr("/subscriptions/subid1resourceGroups/storageRg"), - // to.Ptr("/subscriptions/subid1/resourceGroups/storageRg/providers/Microsoft.Storage/storageAccounts/stAccount")}, - // }, - // }}, - // Subnets: []*armnetwork.Subnet{ - // }, - // }, - // }, - // { - // Name: to.Ptr("testServiceEndpointPolicy1"), - // ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/serviceEndpointPolicies/testServiceEndpointPolicy1"), - // Location: to.Ptr("westus"), - // Properties: &armnetwork.ServiceEndpointPolicyPropertiesFormat{ - // ProvisioningState: to.Ptr(armnetwork.ProvisioningStateSucceeded), - // ResourceGUID: to.Ptr("6A7C139D-8B8D-499B-B7CB-4F3F02A8A44F"), - // ServiceEndpointPolicyDefinitions: []*armnetwork.ServiceEndpointPolicyDefinition{ - // { - // ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/serviceEndpointPolicies/testServiceEndpointPolicy1/serviceEndpointPolicyDefinitions/StorageServiceEndpointPolicyDefinition1"), - // Name: to.Ptr("StorageServiceEndpointPolicyDefinition1"), - // Properties: &armnetwork.ServiceEndpointPolicyDefinitionPropertiesFormat{ - // Description: to.Ptr("Storage Service EndpointPolicy Definition"), - // Service: to.Ptr("Microsoft.Storage"), - // ServiceResources: []*string{ - // to.Ptr("/subscriptions/subid1"), - // to.Ptr("/subscriptions/subid1/resourceGroups/storageRg"), - // to.Ptr("/subscriptions/subid1/resourceGroups/storageRg/providers/Microsoft.Storage/storageAccounts/stAccount")}, - // }, - // }}, - // Subnets: []*armnetwork.Subnet{ - // }, - // }, - // }}, - // } - } -} diff --git a/sdk/resourcemanager/network/armnetwork/serviceendpointpolicydefinitions_client_example_test.go b/sdk/resourcemanager/network/armnetwork/serviceendpointpolicydefinitions_client_example_test.go deleted file mode 100644 index 407e06e8f05a..000000000000 --- a/sdk/resourcemanager/network/armnetwork/serviceendpointpolicydefinitions_client_example_test.go +++ /dev/null @@ -1,157 +0,0 @@ -//go:build go1.18 -// +build go1.18 - -// 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. -// DO NOT EDIT. - -package armnetwork_test - -import ( - "context" - "log" - - "github.com/Azure/azure-sdk-for-go/sdk/azcore/to" - "github.com/Azure/azure-sdk-for-go/sdk/azidentity" - "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/network/armnetwork/v6" -) - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/4883fa5dbf6f2c9093fac8ce334547e9dfac68fa/specification/network/resource-manager/Microsoft.Network/stable/2024-03-01/examples/ServiceEndpointPolicyDefinitionDelete.json -func ExampleServiceEndpointPolicyDefinitionsClient_BeginDelete() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armnetwork.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewServiceEndpointPolicyDefinitionsClient().BeginDelete(ctx, "rg1", "testPolicy", "testDefinition", nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - _, err = poller.PollUntilDone(ctx, nil) - if err != nil { - log.Fatalf("failed to pull the result: %v", err) - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/4883fa5dbf6f2c9093fac8ce334547e9dfac68fa/specification/network/resource-manager/Microsoft.Network/stable/2024-03-01/examples/ServiceEndpointPolicyDefinitionGet.json -func ExampleServiceEndpointPolicyDefinitionsClient_Get() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armnetwork.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewServiceEndpointPolicyDefinitionsClient().Get(ctx, "rg1", "testPolicy", "testDefinition", nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.ServiceEndpointPolicyDefinition = armnetwork.ServiceEndpointPolicyDefinition{ - // ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/serviceEndpointPolicies/testPolicy/serviceEndpointPolicyDefinitions/testDefinition"), - // Name: to.Ptr("testDefinition"), - // Properties: &armnetwork.ServiceEndpointPolicyDefinitionPropertiesFormat{ - // Description: to.Ptr("Storage Service EndpointPolicy Definition"), - // Service: to.Ptr("Microsoft.Storage"), - // ServiceResources: []*string{ - // to.Ptr("/subscriptions/subid1"), - // to.Ptr("/subscriptions/subid1/resourceGroups/storageRg"), - // to.Ptr("/subscriptions/subid1/resourceGroups/storageRg/providers/Microsoft.Storage/storageAccounts/stAccount")}, - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/4883fa5dbf6f2c9093fac8ce334547e9dfac68fa/specification/network/resource-manager/Microsoft.Network/stable/2024-03-01/examples/ServiceEndpointPolicyDefinitionCreate.json -func ExampleServiceEndpointPolicyDefinitionsClient_BeginCreateOrUpdate() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armnetwork.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewServiceEndpointPolicyDefinitionsClient().BeginCreateOrUpdate(ctx, "rg1", "testPolicy", "testDefinition", armnetwork.ServiceEndpointPolicyDefinition{ - Properties: &armnetwork.ServiceEndpointPolicyDefinitionPropertiesFormat{ - Description: to.Ptr("Storage Service EndpointPolicy Definition"), - Service: to.Ptr("Microsoft.Storage"), - ServiceResources: []*string{ - to.Ptr("/subscriptions/subid1"), - to.Ptr("/subscriptions/subid1/resourceGroups/storageRg"), - to.Ptr("/subscriptions/subid1/resourceGroups/storageRg/providers/Microsoft.Storage/storageAccounts/stAccount")}, - }, - }, nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - res, err := poller.PollUntilDone(ctx, nil) - if err != nil { - log.Fatalf("failed to pull the result: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.ServiceEndpointPolicyDefinition = armnetwork.ServiceEndpointPolicyDefinition{ - // ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/serviceEndpointPolicies/testPolicy/serviceEndpointPolicyDefinitions/testDefinition"), - // Name: to.Ptr("testDefinition"), - // Properties: &armnetwork.ServiceEndpointPolicyDefinitionPropertiesFormat{ - // Description: to.Ptr("Storage Service EndpointPolicy Definition"), - // Service: to.Ptr("Microsoft.Storage"), - // ServiceResources: []*string{ - // to.Ptr("/subscriptions/subid1"), - // to.Ptr("/subscriptions/subid1/resourceGroups/storageRg"), - // to.Ptr("/subscriptions/subid1/resourceGroups/storageRg/providers/Microsoft.Storage/storageAccounts/stAccount")}, - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/4883fa5dbf6f2c9093fac8ce334547e9dfac68fa/specification/network/resource-manager/Microsoft.Network/stable/2024-03-01/examples/ServiceEndpointPolicyDefinitionList.json -func ExampleServiceEndpointPolicyDefinitionsClient_NewListByResourceGroupPager() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armnetwork.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := clientFactory.NewServiceEndpointPolicyDefinitionsClient().NewListByResourceGroupPager("rg1", "testPolicy", nil) - for pager.More() { - page, err := pager.NextPage(ctx) - if err != nil { - log.Fatalf("failed to advance page: %v", err) - } - for _, v := range page.Value { - // You could use page here. We use blank identifier for just demo purposes. - _ = v - } - // If the HTTP response code is 200 as defined in example definition, your page structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // page.ServiceEndpointPolicyDefinitionListResult = armnetwork.ServiceEndpointPolicyDefinitionListResult{ - // Value: []*armnetwork.ServiceEndpointPolicyDefinition{ - // { - // ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/serviceEndpointPolicies/testPolicy/serviceEndpointPolicyDefinitions/testDef"), - // Name: to.Ptr("testDef"), - // Properties: &armnetwork.ServiceEndpointPolicyDefinitionPropertiesFormat{ - // Description: to.Ptr("Storage Service EndpointPolicy Definition"), - // Service: to.Ptr("Microsoft.Storage"), - // ServiceResources: []*string{ - // to.Ptr("/subscriptions/subid1"), - // to.Ptr("/subscriptions/subid1/resourceGroups/storageRg"), - // to.Ptr("/subscriptions/subid1/resourceGroups/storageRg/providers/Microsoft.Storage/storageAccounts/stAccount")}, - // }, - // }}, - // } - } -} diff --git a/sdk/resourcemanager/network/armnetwork/servicetaginformation_client_example_test.go b/sdk/resourcemanager/network/armnetwork/servicetaginformation_client_example_test.go deleted file mode 100644 index 32a4298a6105..000000000000 --- a/sdk/resourcemanager/network/armnetwork/servicetaginformation_client_example_test.go +++ /dev/null @@ -1,169 +0,0 @@ -//go:build go1.18 -// +build go1.18 - -// 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. -// DO NOT EDIT. - -package armnetwork_test - -import ( - "context" - "log" - - "github.com/Azure/azure-sdk-for-go/sdk/azcore/to" - "github.com/Azure/azure-sdk-for-go/sdk/azidentity" - "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/network/armnetwork/v6" -) - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/4883fa5dbf6f2c9093fac8ce334547e9dfac68fa/specification/network/resource-manager/Microsoft.Network/stable/2024-03-01/examples/ServiceTagInformationListResult.json -func ExampleServiceTagInformationClient_NewListPager_getListOfServiceTags() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armnetwork.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := clientFactory.NewServiceTagInformationClient().NewListPager("westeurope", &armnetwork.ServiceTagInformationClientListOptions{NoAddressPrefixes: nil, - TagName: nil, - }) - for pager.More() { - page, err := pager.NextPage(ctx) - if err != nil { - log.Fatalf("failed to advance page: %v", err) - } - for _, v := range page.Value { - // You could use page here. We use blank identifier for just demo purposes. - _ = v - } - // If the HTTP response code is 200 as defined in example definition, your page structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // page.ServiceTagInformationListResult = armnetwork.ServiceTagInformationListResult{ - // Value: []*armnetwork.ServiceTagInformation{ - // { - // Name: to.Ptr("ApiManagement"), - // ID: to.Ptr("ApiManagement"), - // Properties: &armnetwork.ServiceTagInformationPropertiesFormat{ - // AddressPrefixes: []*string{ - // to.Ptr("13.64.39.16/32"), - // to.Ptr("40.74.146.80/31"), - // to.Ptr("40.74.147.32/28")}, - // ChangeNumber: to.Ptr("7"), - // Region: to.Ptr(""), - // SystemService: to.Ptr("AzureApiManagement"), - // }, - // }, - // { - // Name: to.Ptr("ApiManagement.AustraliaCentral"), - // ID: to.Ptr("ApiManagement.AustraliaCentral"), - // Properties: &armnetwork.ServiceTagInformationPropertiesFormat{ - // AddressPrefixes: []*string{ - // to.Ptr("20.36.106.68/31"), - // to.Ptr("20.36.107.176/28")}, - // ChangeNumber: to.Ptr("2"), - // Region: to.Ptr("australiacentral"), - // SystemService: to.Ptr("AzureApiManagement"), - // }, - // }}, - // } - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/4883fa5dbf6f2c9093fac8ce334547e9dfac68fa/specification/network/resource-manager/Microsoft.Network/stable/2024-03-01/examples/ServiceTagInformationListResultWithNoAddressPrefixes.json -func ExampleServiceTagInformationClient_NewListPager_getListOfServiceTagsWithNoAddressPrefixes() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armnetwork.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := clientFactory.NewServiceTagInformationClient().NewListPager("westeurope", &armnetwork.ServiceTagInformationClientListOptions{NoAddressPrefixes: to.Ptr(true), - TagName: nil, - }) - for pager.More() { - page, err := pager.NextPage(ctx) - if err != nil { - log.Fatalf("failed to advance page: %v", err) - } - for _, v := range page.Value { - // You could use page here. We use blank identifier for just demo purposes. - _ = v - } - // If the HTTP response code is 200 as defined in example definition, your page structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // page.ServiceTagInformationListResult = armnetwork.ServiceTagInformationListResult{ - // Value: []*armnetwork.ServiceTagInformation{ - // { - // Name: to.Ptr("ApiManagement"), - // ID: to.Ptr("ApiManagement"), - // Properties: &armnetwork.ServiceTagInformationPropertiesFormat{ - // AddressPrefixes: []*string{ - // }, - // ChangeNumber: to.Ptr("7"), - // Region: to.Ptr(""), - // SystemService: to.Ptr("AzureApiManagement"), - // }, - // }, - // { - // Name: to.Ptr("ApiManagement.AustraliaCentral"), - // ID: to.Ptr("ApiManagement.AustraliaCentral"), - // Properties: &armnetwork.ServiceTagInformationPropertiesFormat{ - // AddressPrefixes: []*string{ - // }, - // ChangeNumber: to.Ptr("2"), - // Region: to.Ptr("australiacentral"), - // SystemService: to.Ptr("AzureApiManagement"), - // }, - // }}, - // } - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/4883fa5dbf6f2c9093fac8ce334547e9dfac68fa/specification/network/resource-manager/Microsoft.Network/stable/2024-03-01/examples/ServiceTagInformationListResultWithTagname.json -func ExampleServiceTagInformationClient_NewListPager_getListOfServiceTagsWithTagName() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armnetwork.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := clientFactory.NewServiceTagInformationClient().NewListPager("westeurope", &armnetwork.ServiceTagInformationClientListOptions{NoAddressPrefixes: nil, - TagName: to.Ptr("ApiManagement"), - }) - for pager.More() { - page, err := pager.NextPage(ctx) - if err != nil { - log.Fatalf("failed to advance page: %v", err) - } - for _, v := range page.Value { - // You could use page here. We use blank identifier for just demo purposes. - _ = v - } - // If the HTTP response code is 200 as defined in example definition, your page structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // page.ServiceTagInformationListResult = armnetwork.ServiceTagInformationListResult{ - // Value: []*armnetwork.ServiceTagInformation{ - // { - // Name: to.Ptr("ApiManagement"), - // ID: to.Ptr("ApiManagement"), - // Properties: &armnetwork.ServiceTagInformationPropertiesFormat{ - // AddressPrefixes: []*string{ - // to.Ptr("13.64.39.16/32"), - // to.Ptr("40.74.146.80/31"), - // to.Ptr("40.74.147.32/28")}, - // ChangeNumber: to.Ptr("7"), - // Region: to.Ptr(""), - // SystemService: to.Ptr("AzureApiManagement"), - // }, - // }}, - // } - } -} diff --git a/sdk/resourcemanager/network/armnetwork/servicetags_client_example_test.go b/sdk/resourcemanager/network/armnetwork/servicetags_client_example_test.go deleted file mode 100644 index 8e658e33e469..000000000000 --- a/sdk/resourcemanager/network/armnetwork/servicetags_client_example_test.go +++ /dev/null @@ -1,109 +0,0 @@ -//go:build go1.18 -// +build go1.18 - -// 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. -// DO NOT EDIT. - -package armnetwork_test - -import ( - "context" - "log" - - "github.com/Azure/azure-sdk-for-go/sdk/azidentity" - "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/network/armnetwork/v6" -) - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/4883fa5dbf6f2c9093fac8ce334547e9dfac68fa/specification/network/resource-manager/Microsoft.Network/stable/2024-03-01/examples/ServiceTagsList.json -func ExampleServiceTagsClient_List() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armnetwork.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewServiceTagsClient().List(ctx, "westcentralus", nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.ServiceTagsListResult = armnetwork.ServiceTagsListResult{ - // Name: to.Ptr("public"), - // Type: to.Ptr("Microsoft.Network/serviceTags"), - // ChangeNumber: to.Ptr("63"), - // Cloud: to.Ptr("Public"), - // ID: to.Ptr("/subscriptions/subId/providers/Microsoft.Network/serviceTags/public"), - // Values: []*armnetwork.ServiceTagInformation{ - // { - // Name: to.Ptr("ApiManagement"), - // ID: to.Ptr("ApiManagement"), - // Properties: &armnetwork.ServiceTagInformationPropertiesFormat{ - // AddressPrefixes: []*string{ - // to.Ptr("13.64.39.16/32"), - // to.Ptr("40.74.146.80/31"), - // to.Ptr("40.74.147.32/28")}, - // ChangeNumber: to.Ptr("7"), - // Region: to.Ptr(""), - // SystemService: to.Ptr("AzureApiManagement"), - // }, - // }, - // { - // Name: to.Ptr("ApiManagement.AustraliaCentral"), - // ID: to.Ptr("ApiManagement.AustraliaCentral"), - // Properties: &armnetwork.ServiceTagInformationPropertiesFormat{ - // AddressPrefixes: []*string{ - // to.Ptr("20.36.106.68/31"), - // to.Ptr("20.36.107.176/28")}, - // ChangeNumber: to.Ptr("2"), - // Region: to.Ptr("australiacentral"), - // SystemService: to.Ptr("AzureApiManagement"), - // }, - // }, - // { - // Name: to.Ptr("AppService"), - // ID: to.Ptr("AppService"), - // Properties: &armnetwork.ServiceTagInformationPropertiesFormat{ - // AddressPrefixes: []*string{ - // to.Ptr("13.64.73.110/32"), - // to.Ptr("191.235.208.12/32"), - // to.Ptr("191.235.215.184/32")}, - // ChangeNumber: to.Ptr("13"), - // Region: to.Ptr(""), - // SystemService: to.Ptr("AzureAppService"), - // }, - // }, - // { - // Name: to.Ptr("ServiceBus"), - // ID: to.Ptr("ServiceBus"), - // Properties: &armnetwork.ServiceTagInformationPropertiesFormat{ - // AddressPrefixes: []*string{ - // to.Ptr("23.98.82.96/29"), - // to.Ptr("40.68.127.68/32"), - // to.Ptr("40.70.146.64/29")}, - // ChangeNumber: to.Ptr("10"), - // Region: to.Ptr(""), - // SystemService: to.Ptr("AzureServiceBus"), - // }, - // }, - // { - // Name: to.Ptr("ServiceBus.EastUS2"), - // ID: to.Ptr("ServiceBus.EastUS2"), - // Properties: &armnetwork.ServiceTagInformationPropertiesFormat{ - // AddressPrefixes: []*string{ - // to.Ptr("13.68.110.36/32"), - // to.Ptr("40.70.146.64/29")}, - // ChangeNumber: to.Ptr("1"), - // Region: to.Ptr("eastus2"), - // SystemService: to.Ptr("AzureServiceBus"), - // }, - // }}, - // } -} diff --git a/sdk/resourcemanager/network/armnetwork/staticmembers_client_example_test.go b/sdk/resourcemanager/network/armnetwork/staticmembers_client_example_test.go deleted file mode 100644 index df1343505679..000000000000 --- a/sdk/resourcemanager/network/armnetwork/staticmembers_client_example_test.go +++ /dev/null @@ -1,162 +0,0 @@ -//go:build go1.18 -// +build go1.18 - -// 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. -// DO NOT EDIT. - -package armnetwork_test - -import ( - "context" - "log" - - "github.com/Azure/azure-sdk-for-go/sdk/azcore/to" - "github.com/Azure/azure-sdk-for-go/sdk/azidentity" - "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/network/armnetwork/v6" -) - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/4883fa5dbf6f2c9093fac8ce334547e9dfac68fa/specification/network/resource-manager/Microsoft.Network/stable/2024-03-01/examples/NetworkManagerStaticMemberGet.json -func ExampleStaticMembersClient_Get() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armnetwork.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewStaticMembersClient().Get(ctx, "rg1", "testNetworkManager", "testNetworkGroup", "testStaticMember", nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.StaticMember = armnetwork.StaticMember{ - // Name: to.Ptr("testStaticMember"), - // Type: to.Ptr("Microsoft.Network/networkManagers/networkGroups/staticMembers"), - // ID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroup/rg1/providers/Microsoft.Network/networkManagers/testNetworkManager/networkGroups/testNetworkGroup/staticMembers/testStaticMember"), - // Properties: &armnetwork.StaticMemberProperties{ - // ResourceID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroup/rg1/providers/Microsoft.Network/virtualnetworks/vnet1"), - // }, - // SystemData: &armnetwork.SystemData{ - // CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-01-11T18:52:27.000Z"); return t}()), - // CreatedBy: to.Ptr("b69a9388-9488-4534-b470-7ec6d41beef5"), - // CreatedByType: to.Ptr(armnetwork.CreatedByTypeUser), - // LastModifiedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-01-11T18:52:27.000Z"); return t}()), - // LastModifiedBy: to.Ptr("b69a9388-9488-4534-b470-7ec6d41beef5"), - // LastModifiedByType: to.Ptr(armnetwork.CreatedByTypeUser), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/4883fa5dbf6f2c9093fac8ce334547e9dfac68fa/specification/network/resource-manager/Microsoft.Network/stable/2024-03-01/examples/NetworkManagerStaticMemberPut.json -func ExampleStaticMembersClient_CreateOrUpdate() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armnetwork.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewStaticMembersClient().CreateOrUpdate(ctx, "rg1", "testNetworkManager", "testNetworkGroup", "testStaticMember", armnetwork.StaticMember{ - Properties: &armnetwork.StaticMemberProperties{ - ResourceID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroup/rg1/providers/Microsoft.Network/virtualnetworks/vnet1"), - }, - }, nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.StaticMember = armnetwork.StaticMember{ - // Name: to.Ptr("testStaticMember"), - // Type: to.Ptr("Microsoft.Network/networkManagers/networkGroups/staticMembers"), - // ID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroup/rg1/providers/Microsoft.Network/networkManagers/testNetworkManager/networkGroups/testNetworkGroup/staticMembers/testStaticMember"), - // Properties: &armnetwork.StaticMemberProperties{ - // ProvisioningState: to.Ptr(armnetwork.ProvisioningStateSucceeded), - // Region: to.Ptr("useast2"), - // ResourceID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroup/rg1/providers/Microsoft.Network/virtualnetworks/vnet1"), - // }, - // SystemData: &armnetwork.SystemData{ - // CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-01-11T18:52:27.000Z"); return t}()), - // CreatedBy: to.Ptr("b69a9388-9488-4534-b470-7ec6d41beef5"), - // CreatedByType: to.Ptr(armnetwork.CreatedByTypeUser), - // LastModifiedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-01-11T18:52:27.000Z"); return t}()), - // LastModifiedBy: to.Ptr("b69a9388-9488-4534-b470-7ec6d41beef5"), - // LastModifiedByType: to.Ptr(armnetwork.CreatedByTypeUser), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/4883fa5dbf6f2c9093fac8ce334547e9dfac68fa/specification/network/resource-manager/Microsoft.Network/stable/2024-03-01/examples/NetworkManagerStaticMemberDelete.json -func ExampleStaticMembersClient_Delete() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armnetwork.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - _, err = clientFactory.NewStaticMembersClient().Delete(ctx, "SampleRG", "TestNM", "testNetworkGroup", "testStaticMember", nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/4883fa5dbf6f2c9093fac8ce334547e9dfac68fa/specification/network/resource-manager/Microsoft.Network/stable/2024-03-01/examples/NetworkManagerStaticMemberList.json -func ExampleStaticMembersClient_NewListPager() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armnetwork.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := clientFactory.NewStaticMembersClient().NewListPager("rg1", "testNetworkManager", "testNetworkGroup", &armnetwork.StaticMembersClientListOptions{Top: nil, - SkipToken: nil, - }) - for pager.More() { - page, err := pager.NextPage(ctx) - if err != nil { - log.Fatalf("failed to advance page: %v", err) - } - for _, v := range page.Value { - // You could use page here. We use blank identifier for just demo purposes. - _ = v - } - // If the HTTP response code is 200 as defined in example definition, your page structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // page.StaticMemberListResult = armnetwork.StaticMemberListResult{ - // Value: []*armnetwork.StaticMember{ - // { - // Name: to.Ptr("testStaticMember"), - // Type: to.Ptr("Microsoft.Network/networkManagers/networkGroups/staticMembers"), - // ID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroup/rg1/providers/Microsoft.Network/networkManagers/testNetworkManager/networkGroups/testNetworkGroup/staticMembers/testStaticMember"), - // Properties: &armnetwork.StaticMemberProperties{ - // ProvisioningState: to.Ptr(armnetwork.ProvisioningStateSucceeded), - // Region: to.Ptr("useast2"), - // ResourceID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroup/rg1/providers/Microsoft.Network/virtualnetworks/vnet1"), - // }, - // SystemData: &armnetwork.SystemData{ - // CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-01-11T18:52:27.000Z"); return t}()), - // CreatedBy: to.Ptr("b69a9388-9488-4534-b470-7ec6d41beef5"), - // CreatedByType: to.Ptr(armnetwork.CreatedByTypeUser), - // LastModifiedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-01-11T18:52:27.000Z"); return t}()), - // LastModifiedBy: to.Ptr("b69a9388-9488-4534-b470-7ec6d41beef5"), - // LastModifiedByType: to.Ptr(armnetwork.CreatedByTypeUser), - // }, - // }}, - // } - } -} diff --git a/sdk/resourcemanager/network/armnetwork/subnets_client_example_test.go b/sdk/resourcemanager/network/armnetwork/subnets_client_example_test.go deleted file mode 100644 index 83182121cf5b..000000000000 --- a/sdk/resourcemanager/network/armnetwork/subnets_client_example_test.go +++ /dev/null @@ -1,452 +0,0 @@ -//go:build go1.18 -// +build go1.18 - -// 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. -// DO NOT EDIT. - -package armnetwork_test - -import ( - "context" - "log" - - "github.com/Azure/azure-sdk-for-go/sdk/azcore/to" - "github.com/Azure/azure-sdk-for-go/sdk/azidentity" - "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/network/armnetwork/v6" -) - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/4883fa5dbf6f2c9093fac8ce334547e9dfac68fa/specification/network/resource-manager/Microsoft.Network/stable/2024-03-01/examples/SubnetDelete.json -func ExampleSubnetsClient_BeginDelete() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armnetwork.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewSubnetsClient().BeginDelete(ctx, "subnet-test", "vnetname", "subnet1", nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - _, err = poller.PollUntilDone(ctx, nil) - if err != nil { - log.Fatalf("failed to pull the result: %v", err) - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/4883fa5dbf6f2c9093fac8ce334547e9dfac68fa/specification/network/resource-manager/Microsoft.Network/stable/2024-03-01/examples/SubnetGet.json -func ExampleSubnetsClient_Get_getSubnet() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armnetwork.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewSubnetsClient().Get(ctx, "subnet-test", "vnetname", "subnet1", &armnetwork.SubnetsClientGetOptions{Expand: nil}) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.Subnet = armnetwork.Subnet{ - // ID: to.Ptr("/subscriptions/subid/resourceGroups/subnet-test/providers/Microsoft.Network/virtualNetworks/vnetname/subnets/subnet1"), - // Name: to.Ptr("subnet1"), - // Properties: &armnetwork.SubnetPropertiesFormat{ - // AddressPrefix: to.Ptr("10.0.0.0/16"), - // ProvisioningState: to.Ptr(armnetwork.ProvisioningStateSucceeded), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/4883fa5dbf6f2c9093fac8ce334547e9dfac68fa/specification/network/resource-manager/Microsoft.Network/stable/2024-03-01/examples/SubnetGetWithDelegation.json -func ExampleSubnetsClient_Get_getSubnetWithADelegation() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armnetwork.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewSubnetsClient().Get(ctx, "subnet-test", "vnetname", "subnet1", &armnetwork.SubnetsClientGetOptions{Expand: nil}) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.Subnet = armnetwork.Subnet{ - // ID: to.Ptr("/subscriptions/subId/resourceGroups/subnet-test/providers/Microsoft.Network/virtualNetworks/vnetname/subnets/subnet1"), - // Name: to.Ptr("subnet1"), - // Properties: &armnetwork.SubnetPropertiesFormat{ - // AddressPrefix: to.Ptr("10.0.0.0/16"), - // Delegations: []*armnetwork.Delegation{ - // { - // ID: to.Ptr("/subscriptions/subId/resourceGroups/rg1/providers/Microsoft.Network/virtualNetworks/test-vnet/subnets/subnet1/delegations/myDelegation"), - // Name: to.Ptr("myDelegation"), - // Properties: &armnetwork.ServiceDelegationPropertiesFormat{ - // Actions: []*string{ - // }, - // ProvisioningState: to.Ptr(armnetwork.ProvisioningStateSucceeded), - // ServiceName: to.Ptr("Microsoft.Provider/resourceType"), - // }, - // }}, - // ProvisioningState: to.Ptr(armnetwork.ProvisioningStateSucceeded), - // Purpose: to.Ptr(""), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/4883fa5dbf6f2c9093fac8ce334547e9dfac68fa/specification/network/resource-manager/Microsoft.Network/stable/2024-03-01/examples/SubnetGetWithSharingScope.json -func ExampleSubnetsClient_Get_getSubnetWithSharingScope() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armnetwork.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewSubnetsClient().Get(ctx, "subnet-test", "vnetname", "subnet1", &armnetwork.SubnetsClientGetOptions{Expand: nil}) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.Subnet = armnetwork.Subnet{ - // ID: to.Ptr("/subscriptions/subid/resourceGroups/subnet-test/providers/Microsoft.Network/virtualNetworks/vnetname/subnets/subnet1"), - // Name: to.Ptr("subnet1"), - // Properties: &armnetwork.SubnetPropertiesFormat{ - // AddressPrefix: to.Ptr("10.0.0.0/16"), - // DefaultOutboundAccess: to.Ptr(false), - // ProvisioningState: to.Ptr(armnetwork.ProvisioningStateSucceeded), - // SharingScope: to.Ptr(armnetwork.SharingScopeTenant), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/4883fa5dbf6f2c9093fac8ce334547e9dfac68fa/specification/network/resource-manager/Microsoft.Network/stable/2024-03-01/examples/SubnetCreate.json -func ExampleSubnetsClient_BeginCreateOrUpdate_createSubnet() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armnetwork.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewSubnetsClient().BeginCreateOrUpdate(ctx, "subnet-test", "vnetname", "subnet1", armnetwork.Subnet{ - Properties: &armnetwork.SubnetPropertiesFormat{ - AddressPrefix: to.Ptr("10.0.0.0/16"), - }, - }, nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - res, err := poller.PollUntilDone(ctx, nil) - if err != nil { - log.Fatalf("failed to pull the result: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.Subnet = armnetwork.Subnet{ - // ID: to.Ptr("/subscriptions/subid/resourceGroups/subnet-test/providers/Microsoft.Network/virtualNetworks/vnetname/subnets/subnet1"), - // Name: to.Ptr("subnet1"), - // Properties: &armnetwork.SubnetPropertiesFormat{ - // AddressPrefix: to.Ptr("10.0.0.0/16"), - // ProvisioningState: to.Ptr(armnetwork.ProvisioningStateSucceeded), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/4883fa5dbf6f2c9093fac8ce334547e9dfac68fa/specification/network/resource-manager/Microsoft.Network/stable/2024-03-01/examples/SubnetCreateWithDelegation.json -func ExampleSubnetsClient_BeginCreateOrUpdate_createSubnetWithADelegation() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armnetwork.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewSubnetsClient().BeginCreateOrUpdate(ctx, "subnet-test", "vnetname", "subnet1", armnetwork.Subnet{ - Properties: &armnetwork.SubnetPropertiesFormat{ - AddressPrefix: to.Ptr("10.0.0.0/16"), - }, - }, nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - res, err := poller.PollUntilDone(ctx, nil) - if err != nil { - log.Fatalf("failed to pull the result: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.Subnet = armnetwork.Subnet{ - // ID: to.Ptr("/subscriptions/subId/resourceGroups/subnet-test/providers/Microsoft.Network/virtualNetworks/vnetname/subnets/subnet1"), - // Name: to.Ptr("subnet1"), - // Properties: &armnetwork.SubnetPropertiesFormat{ - // AddressPrefix: to.Ptr("10.0.0.0/16"), - // Delegations: []*armnetwork.Delegation{ - // { - // ID: to.Ptr("/subscriptions/subId/resourceGroups/subnet-test/providers/Microsoft.Network/virtualNetworks/vnetname/subnets/subnet1/delegations/myDelegation"), - // Name: to.Ptr("myDelegation"), - // Properties: &armnetwork.ServiceDelegationPropertiesFormat{ - // Actions: []*string{ - // }, - // ProvisioningState: to.Ptr(armnetwork.ProvisioningStateSucceeded), - // ServiceName: to.Ptr("Microsoft.Provider/resourceType"), - // }, - // }}, - // ProvisioningState: to.Ptr(armnetwork.ProvisioningStateSucceeded), - // Purpose: to.Ptr(""), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/4883fa5dbf6f2c9093fac8ce334547e9dfac68fa/specification/network/resource-manager/Microsoft.Network/stable/2024-03-01/examples/SubnetCreateServiceEndpoint.json -func ExampleSubnetsClient_BeginCreateOrUpdate_createSubnetWithServiceEndpoints() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armnetwork.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewSubnetsClient().BeginCreateOrUpdate(ctx, "subnet-test", "vnetname", "subnet1", armnetwork.Subnet{ - Properties: &armnetwork.SubnetPropertiesFormat{ - AddressPrefix: to.Ptr("10.0.0.0/16"), - ServiceEndpoints: []*armnetwork.ServiceEndpointPropertiesFormat{ - { - Service: to.Ptr("Microsoft.Storage"), - }}, - }, - }, nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - res, err := poller.PollUntilDone(ctx, nil) - if err != nil { - log.Fatalf("failed to pull the result: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.Subnet = armnetwork.Subnet{ - // ID: to.Ptr("/subscriptions/subid/resourceGroups/subnet-test/providers/Microsoft.Network/virtualNetworks/vnetname/subnets/subnet1"), - // Name: to.Ptr("subnet1"), - // Properties: &armnetwork.SubnetPropertiesFormat{ - // AddressPrefix: to.Ptr("10.0.0.0/16"), - // ProvisioningState: to.Ptr(armnetwork.ProvisioningStateSucceeded), - // ServiceEndpoints: []*armnetwork.ServiceEndpointPropertiesFormat{ - // { - // Locations: []*string{ - // to.Ptr("eastus2(stage)"), - // to.Ptr("usnorth(stage)")}, - // ProvisioningState: to.Ptr(armnetwork.ProvisioningStateSucceeded), - // Service: to.Ptr("Microsoft.Storage"), - // }}, - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/4883fa5dbf6f2c9093fac8ce334547e9dfac68fa/specification/network/resource-manager/Microsoft.Network/stable/2024-03-01/examples/SubnetCreateServiceEndpointNetworkIdentifier.json -func ExampleSubnetsClient_BeginCreateOrUpdate_createSubnetWithServiceEndpointsWithNetworkIdentifier() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armnetwork.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewSubnetsClient().BeginCreateOrUpdate(ctx, "subnet-test", "vnetname", "subnet1", armnetwork.Subnet{ - Properties: &armnetwork.SubnetPropertiesFormat{ - AddressPrefix: to.Ptr("10.0.0.0/16"), - ServiceEndpoints: []*armnetwork.ServiceEndpointPropertiesFormat{ - { - NetworkIdentifier: &armnetwork.SubResource{ - ID: to.Ptr("/subscriptions/subid/resourceGroups/subnet-test/providers/Microsoft.Network/publicIPAddresses/test-ip"), - }, - Service: to.Ptr("Microsoft.Storage"), - }}, - }, - }, nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - res, err := poller.PollUntilDone(ctx, nil) - if err != nil { - log.Fatalf("failed to pull the result: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.Subnet = armnetwork.Subnet{ - // ID: to.Ptr("/subscriptions/subid/resourceGroups/subnet-test/providers/Microsoft.Network/virtualNetworks/vnetname/subnets/subnet1"), - // Name: to.Ptr("subnet1"), - // Properties: &armnetwork.SubnetPropertiesFormat{ - // AddressPrefix: to.Ptr("10.0.0.0/16"), - // ProvisioningState: to.Ptr(armnetwork.ProvisioningStateSucceeded), - // ServiceEndpoints: []*armnetwork.ServiceEndpointPropertiesFormat{ - // { - // Locations: []*string{ - // to.Ptr("eastus2(stage)"), - // to.Ptr("usnorth(stage)")}, - // NetworkIdentifier: &armnetwork.SubResource{ - // ID: to.Ptr("/subscriptions/subid/resourceGroups/subnet-test/providers/Microsoft.Network/publicIPAddresses/test-ip"), - // }, - // ProvisioningState: to.Ptr(armnetwork.ProvisioningStateSucceeded), - // Service: to.Ptr("Microsoft.Storage"), - // }}, - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/4883fa5dbf6f2c9093fac8ce334547e9dfac68fa/specification/network/resource-manager/Microsoft.Network/stable/2024-03-01/examples/SubnetCreateWithSharingScope.json -func ExampleSubnetsClient_BeginCreateOrUpdate_createSubnetWithSharingScope() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armnetwork.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewSubnetsClient().BeginCreateOrUpdate(ctx, "subnet-test", "vnetname", "subnet1", armnetwork.Subnet{ - Properties: &armnetwork.SubnetPropertiesFormat{ - AddressPrefix: to.Ptr("10.0.0.0/16"), - }, - }, nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - res, err := poller.PollUntilDone(ctx, nil) - if err != nil { - log.Fatalf("failed to pull the result: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.Subnet = armnetwork.Subnet{ - // ID: to.Ptr("/subscriptions/subid/resourceGroups/subnet-test/providers/Microsoft.Network/virtualNetworks/vnetname/subnets/subnet1"), - // Name: to.Ptr("subnet1"), - // Properties: &armnetwork.SubnetPropertiesFormat{ - // AddressPrefix: to.Ptr("10.0.0.0/16"), - // DefaultOutboundAccess: to.Ptr(false), - // ProvisioningState: to.Ptr(armnetwork.ProvisioningStateSucceeded), - // SharingScope: to.Ptr(armnetwork.SharingScopeTenant), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/4883fa5dbf6f2c9093fac8ce334547e9dfac68fa/specification/network/resource-manager/Microsoft.Network/stable/2024-03-01/examples/SubnetPrepareNetworkPolicies.json -func ExampleSubnetsClient_BeginPrepareNetworkPolicies() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armnetwork.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewSubnetsClient().BeginPrepareNetworkPolicies(ctx, "rg1", "test-vnet", "subnet1", armnetwork.PrepareNetworkPoliciesRequest{ - ServiceName: to.Ptr("Microsoft.Sql/managedInstances"), - }, nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - _, err = poller.PollUntilDone(ctx, nil) - if err != nil { - log.Fatalf("failed to pull the result: %v", err) - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/4883fa5dbf6f2c9093fac8ce334547e9dfac68fa/specification/network/resource-manager/Microsoft.Network/stable/2024-03-01/examples/SubnetUnprepareNetworkPolicies.json -func ExampleSubnetsClient_BeginUnprepareNetworkPolicies() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armnetwork.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewSubnetsClient().BeginUnprepareNetworkPolicies(ctx, "rg1", "test-vnet", "subnet1", armnetwork.UnprepareNetworkPoliciesRequest{ - ServiceName: to.Ptr("Microsoft.Sql/managedInstances"), - }, nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - _, err = poller.PollUntilDone(ctx, nil) - if err != nil { - log.Fatalf("failed to pull the result: %v", err) - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/4883fa5dbf6f2c9093fac8ce334547e9dfac68fa/specification/network/resource-manager/Microsoft.Network/stable/2024-03-01/examples/SubnetList.json -func ExampleSubnetsClient_NewListPager() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armnetwork.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := clientFactory.NewSubnetsClient().NewListPager("subnet-test", "vnetname", nil) - for pager.More() { - page, err := pager.NextPage(ctx) - if err != nil { - log.Fatalf("failed to advance page: %v", err) - } - for _, v := range page.Value { - // You could use page here. We use blank identifier for just demo purposes. - _ = v - } - // If the HTTP response code is 200 as defined in example definition, your page structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // page.SubnetListResult = armnetwork.SubnetListResult{ - // Value: []*armnetwork.Subnet{ - // { - // ID: to.Ptr("/subscriptions/subid/resourceGroups/subnet-test/providers/Microsoft.Network/virtualNetworks/vnetname/subnets/subnet1"), - // Name: to.Ptr("subnet1"), - // Properties: &armnetwork.SubnetPropertiesFormat{ - // AddressPrefix: to.Ptr("10.0.0.0/16"), - // ProvisioningState: to.Ptr(armnetwork.ProvisioningStateSucceeded), - // }, - // }, - // { - // ID: to.Ptr("/subscriptions/subid/resourceGroups/subnet-test/providers/Microsoft.Network/virtualNetworks/vnetname/subnets/subnet2"), - // Name: to.Ptr("subnet2"), - // Properties: &armnetwork.SubnetPropertiesFormat{ - // AddressPrefix: to.Ptr("10.0.0.0/16"), - // ProvisioningState: to.Ptr(armnetwork.ProvisioningStateSucceeded), - // }, - // }}, - // } - } -} diff --git a/sdk/resourcemanager/network/armnetwork/subscriptionnetworkmanagerconnections_client_example_test.go b/sdk/resourcemanager/network/armnetwork/subscriptionnetworkmanagerconnections_client_example_test.go deleted file mode 100644 index e377db069cd0..000000000000 --- a/sdk/resourcemanager/network/armnetwork/subscriptionnetworkmanagerconnections_client_example_test.go +++ /dev/null @@ -1,164 +0,0 @@ -//go:build go1.18 -// +build go1.18 - -// 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. -// DO NOT EDIT. - -package armnetwork_test - -import ( - "context" - "log" - - "github.com/Azure/azure-sdk-for-go/sdk/azcore/to" - "github.com/Azure/azure-sdk-for-go/sdk/azidentity" - "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/network/armnetwork/v6" -) - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/4883fa5dbf6f2c9093fac8ce334547e9dfac68fa/specification/network/resource-manager/Microsoft.Network/stable/2024-03-01/examples/NetworkManagerConnectionSubscriptionPut.json -func ExampleSubscriptionNetworkManagerConnectionsClient_CreateOrUpdate() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armnetwork.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewSubscriptionNetworkManagerConnectionsClient().CreateOrUpdate(ctx, "TestNMConnection", armnetwork.ManagerConnection{ - Properties: &armnetwork.ManagerConnectionProperties{ - NetworkManagerID: to.Ptr("/subscriptions/subscriptionC/resourceGroup/rg1/providers/Microsoft.Network/networkManagers/testNetworkManager"), - }, - }, nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.ManagerConnection = armnetwork.ManagerConnection{ - // Name: to.Ptr("TestNMConnection"), - // Type: to.Ptr("Microsoft.Network/networkManagerConnections"), - // ID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.Network/networkManagerConnections/TestNMConnection"), - // Properties: &armnetwork.ManagerConnectionProperties{ - // Description: to.Ptr("This is a network manager connection to testNetworkManager."), - // ConnectionState: to.Ptr(armnetwork.ScopeConnectionStatePending), - // NetworkManagerID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroup/rg1/providers/Microsoft.Network/networkManagers/testNetworkManager"), - // }, - // SystemData: &armnetwork.SystemData{ - // CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-01-11T18:52:27.000Z"); return t}()), - // CreatedBy: to.Ptr("b69a9388-9488-4534-b470-7ec6d41beef5"), - // CreatedByType: to.Ptr(armnetwork.CreatedByTypeUser), - // LastModifiedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-01-11T18:52:27.000Z"); return t}()), - // LastModifiedBy: to.Ptr("b69a9388-9488-4534-b470-7ec6d41beef5"), - // LastModifiedByType: to.Ptr(armnetwork.CreatedByTypeUser), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/4883fa5dbf6f2c9093fac8ce334547e9dfac68fa/specification/network/resource-manager/Microsoft.Network/stable/2024-03-01/examples/NetworkManagerConnectionSubscriptionGet.json -func ExampleSubscriptionNetworkManagerConnectionsClient_Get() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armnetwork.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewSubscriptionNetworkManagerConnectionsClient().Get(ctx, "TestNMConnection", nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.ManagerConnection = armnetwork.ManagerConnection{ - // Name: to.Ptr("TestNMConnection"), - // Type: to.Ptr("Microsoft.Network/networkManagerConnections"), - // ID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.Network/networkManagerConnections/TestNMConnection"), - // Properties: &armnetwork.ManagerConnectionProperties{ - // Description: to.Ptr("This is a network manager connection to testNetworkManager."), - // ConnectionState: to.Ptr(armnetwork.ScopeConnectionStatePending), - // NetworkManagerID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroup/rg1/providers/Microsoft.Network/networkManagers/testNetworkManager"), - // }, - // SystemData: &armnetwork.SystemData{ - // CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-01-11T18:52:27.000Z"); return t}()), - // CreatedBy: to.Ptr("b69a9388-9488-4534-b470-7ec6d41beef5"), - // CreatedByType: to.Ptr(armnetwork.CreatedByTypeUser), - // LastModifiedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-01-11T18:52:27.000Z"); return t}()), - // LastModifiedBy: to.Ptr("b69a9388-9488-4534-b470-7ec6d41beef5"), - // LastModifiedByType: to.Ptr(armnetwork.CreatedByTypeUser), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/4883fa5dbf6f2c9093fac8ce334547e9dfac68fa/specification/network/resource-manager/Microsoft.Network/stable/2024-03-01/examples/NetworkManagerConnectionSubscriptionDelete.json -func ExampleSubscriptionNetworkManagerConnectionsClient_Delete() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armnetwork.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - _, err = clientFactory.NewSubscriptionNetworkManagerConnectionsClient().Delete(ctx, "TestNMConnection", nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/4883fa5dbf6f2c9093fac8ce334547e9dfac68fa/specification/network/resource-manager/Microsoft.Network/stable/2024-03-01/examples/NetworkManagerConnectionSubscriptionList.json -func ExampleSubscriptionNetworkManagerConnectionsClient_NewListPager() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armnetwork.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := clientFactory.NewSubscriptionNetworkManagerConnectionsClient().NewListPager(&armnetwork.SubscriptionNetworkManagerConnectionsClientListOptions{Top: nil, - SkipToken: nil, - }) - for pager.More() { - page, err := pager.NextPage(ctx) - if err != nil { - log.Fatalf("failed to advance page: %v", err) - } - for _, v := range page.Value { - // You could use page here. We use blank identifier for just demo purposes. - _ = v - } - // If the HTTP response code is 200 as defined in example definition, your page structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // page.ManagerConnectionListResult = armnetwork.ManagerConnectionListResult{ - // Value: []*armnetwork.ManagerConnection{ - // { - // Name: to.Ptr("TestNMConnection"), - // Type: to.Ptr("Microsoft.Network/networkManagerConnections"), - // ID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.Network/networkManagerConnections/TestNMConnection"), - // Properties: &armnetwork.ManagerConnectionProperties{ - // Description: to.Ptr("This is a network manager connection to testNetworkManager."), - // ConnectionState: to.Ptr(armnetwork.ScopeConnectionStatePending), - // NetworkManagerID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroup/rg1/providers/Microsoft.Network/networkManagers/testNetworkManager"), - // }, - // SystemData: &armnetwork.SystemData{ - // CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-01-11T18:52:27.000Z"); return t}()), - // CreatedBy: to.Ptr("b69a9388-9488-4534-b470-7ec6d41beef5"), - // CreatedByType: to.Ptr(armnetwork.CreatedByTypeUser), - // LastModifiedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-01-11T18:52:27.000Z"); return t}()), - // LastModifiedBy: to.Ptr("b69a9388-9488-4534-b470-7ec6d41beef5"), - // LastModifiedByType: to.Ptr(armnetwork.CreatedByTypeUser), - // }, - // }}, - // } - } -} diff --git a/sdk/resourcemanager/network/armnetwork/usages_client_example_test.go b/sdk/resourcemanager/network/armnetwork/usages_client_example_test.go deleted file mode 100644 index 094ce0e4cc97..000000000000 --- a/sdk/resourcemanager/network/armnetwork/usages_client_example_test.go +++ /dev/null @@ -1,644 +0,0 @@ -//go:build go1.18 -// +build go1.18 - -// 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. -// DO NOT EDIT. - -package armnetwork_test - -import ( - "context" - "log" - - "github.com/Azure/azure-sdk-for-go/sdk/azidentity" - "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/network/armnetwork/v6" -) - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/4883fa5dbf6f2c9093fac8ce334547e9dfac68fa/specification/network/resource-manager/Microsoft.Network/stable/2024-03-01/examples/UsageList.json -func ExampleUsagesClient_NewListPager_listUsages() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armnetwork.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := clientFactory.NewUsagesClient().NewListPager("westus", nil) - for pager.More() { - page, err := pager.NextPage(ctx) - if err != nil { - log.Fatalf("failed to advance page: %v", err) - } - for _, v := range page.Value { - // You could use page here. We use blank identifier for just demo purposes. - _ = v - } - // If the HTTP response code is 200 as defined in example definition, your page structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // page.UsagesListResult = armnetwork.UsagesListResult{ - // Value: []*armnetwork.Usage{ - // { - // Name: &armnetwork.UsageName{ - // LocalizedValue: to.Ptr("Virtual Networks"), - // Value: to.Ptr("VirtualNetworks"), - // }, - // CurrentValue: to.Ptr[int64](8), - // ID: to.Ptr("/subscriptions/subid/providers/Microsoft.Network/locations/westus/usages/VirtualNetworks"), - // Limit: to.Ptr[int64](50), - // Unit: to.Ptr(armnetwork.UsageUnitCount), - // }, - // { - // Name: &armnetwork.UsageName{ - // LocalizedValue: to.Ptr("Static Public IP Addresses"), - // Value: to.Ptr("StaticPublicIPAddresses"), - // }, - // CurrentValue: to.Ptr[int64](3), - // ID: to.Ptr("/subscriptions/subid/providers/Microsoft.Network/locations/westus/usages/StaticPublicIPAddresses"), - // Limit: to.Ptr[int64](20), - // Unit: to.Ptr(armnetwork.UsageUnitCount), - // }, - // { - // Name: &armnetwork.UsageName{ - // LocalizedValue: to.Ptr("Network Security Groups"), - // Value: to.Ptr("NetworkSecurityGroups"), - // }, - // CurrentValue: to.Ptr[int64](1), - // ID: to.Ptr("/subscriptions/subid/providers/Microsoft.Network/locations/westus/usages/NetworkSecurityGroups"), - // Limit: to.Ptr[int64](100), - // Unit: to.Ptr(armnetwork.UsageUnitCount), - // }, - // { - // Name: &armnetwork.UsageName{ - // LocalizedValue: to.Ptr("Public IP Addresses"), - // Value: to.Ptr("PublicIPAddresses"), - // }, - // CurrentValue: to.Ptr[int64](8), - // ID: to.Ptr("/subscriptions/subid/providers/Microsoft.Network/locations/westus/usages/PublicIPAddresses"), - // Limit: to.Ptr[int64](60), - // Unit: to.Ptr(armnetwork.UsageUnitCount), - // }, - // { - // Name: &armnetwork.UsageName{ - // LocalizedValue: to.Ptr("Network Interfaces"), - // Value: to.Ptr("NetworkInterfaces"), - // }, - // CurrentValue: to.Ptr[int64](2), - // ID: to.Ptr("/subscriptions/subid/providers/Microsoft.Network/locations/westus/usages/NetworkInterfaces"), - // Limit: to.Ptr[int64](350), - // Unit: to.Ptr(armnetwork.UsageUnitCount), - // }, - // { - // Name: &armnetwork.UsageName{ - // LocalizedValue: to.Ptr("Load Balancers"), - // Value: to.Ptr("LoadBalancers"), - // }, - // CurrentValue: to.Ptr[int64](2), - // ID: to.Ptr("/subscriptions/subid/providers/Microsoft.Network/locations/westus/usages/LoadBalancers"), - // Limit: to.Ptr[int64](100), - // Unit: to.Ptr(armnetwork.UsageUnitCount), - // }, - // { - // Name: &armnetwork.UsageName{ - // LocalizedValue: to.Ptr("Application Gateways"), - // Value: to.Ptr("ApplicationGateways"), - // }, - // CurrentValue: to.Ptr[int64](1), - // ID: to.Ptr("/subscriptions/subid/providers/Microsoft.Network/locations/westus/usages/ApplicationGateways"), - // Limit: to.Ptr[int64](50), - // Unit: to.Ptr(armnetwork.UsageUnitCount), - // }, - // { - // Name: &armnetwork.UsageName{ - // LocalizedValue: to.Ptr("Route Tables"), - // Value: to.Ptr("RouteTables"), - // }, - // CurrentValue: to.Ptr[int64](0), - // ID: to.Ptr("/subscriptions/subid/providers/Microsoft.Network/locations/westus/usages/RouteTables"), - // Limit: to.Ptr[int64](100), - // Unit: to.Ptr(armnetwork.UsageUnitCount), - // }, - // { - // Name: &armnetwork.UsageName{ - // LocalizedValue: to.Ptr("Route Filters"), - // Value: to.Ptr("RouteFilters"), - // }, - // CurrentValue: to.Ptr[int64](0), - // ID: to.Ptr("/subscriptions/subid/providers/Microsoft.Network/locations/westus/usages/RouteFilters"), - // Limit: to.Ptr[int64](1000), - // Unit: to.Ptr(armnetwork.UsageUnitCount), - // }, - // { - // Name: &armnetwork.UsageName{ - // LocalizedValue: to.Ptr("Network Watchers"), - // Value: to.Ptr("NetworkWatchers"), - // }, - // CurrentValue: to.Ptr[int64](0), - // ID: to.Ptr("/subscriptions/subid/providers/Microsoft.Network/locations/westus/usages/NetworkWatchers"), - // Limit: to.Ptr[int64](1), - // Unit: to.Ptr(armnetwork.UsageUnitCount), - // }, - // { - // Name: &armnetwork.UsageName{ - // LocalizedValue: to.Ptr("Packet Captures"), - // Value: to.Ptr("PacketCaptures"), - // }, - // CurrentValue: to.Ptr[int64](0), - // ID: to.Ptr("/subscriptions/subid/providers/Microsoft.Network/locations/westus/usages/PacketCaptures"), - // Limit: to.Ptr[int64](10), - // Unit: to.Ptr(armnetwork.UsageUnitCount), - // }, - // { - // Name: &armnetwork.UsageName{ - // LocalizedValue: to.Ptr("DNS servers per Virtual Network"), - // Value: to.Ptr("DnsServersPerVirtualNetwork"), - // }, - // CurrentValue: to.Ptr[int64](0), - // ID: to.Ptr("/subscriptions/subid/providers/Microsoft.Network/locations/westus/usages/DnsServersPerVirtualNetwork"), - // Limit: to.Ptr[int64](9), - // Unit: to.Ptr(armnetwork.UsageUnitCount), - // }, - // { - // Name: &armnetwork.UsageName{ - // LocalizedValue: to.Ptr("Subnets per Virtual Network"), - // Value: to.Ptr("SubnetsPerVirtualNetwork"), - // }, - // CurrentValue: to.Ptr[int64](0), - // ID: to.Ptr("/subscriptions/subid/providers/Microsoft.Network/locations/westus/usages/SubnetsPerVirtualNetwork"), - // Limit: to.Ptr[int64](1000), - // Unit: to.Ptr(armnetwork.UsageUnitCount), - // }, - // { - // Name: &armnetwork.UsageName{ - // LocalizedValue: to.Ptr("IP Configurations per Virtual Network"), - // Value: to.Ptr("IPConfigurationsPerVirtualNetwork"), - // }, - // CurrentValue: to.Ptr[int64](0), - // ID: to.Ptr("/subscriptions/subid/providers/Microsoft.Network/locations/westus/usages/IPConfigurationsPerVirtualNetwork"), - // Limit: to.Ptr[int64](4096), - // Unit: to.Ptr(armnetwork.UsageUnitCount), - // }, - // { - // Name: &armnetwork.UsageName{ - // LocalizedValue: to.Ptr("Peerings per Virtual Network"), - // Value: to.Ptr("PeeringsPerVirtualNetwork"), - // }, - // CurrentValue: to.Ptr[int64](0), - // ID: to.Ptr("/subscriptions/subid/providers/Microsoft.Network/locations/westus/usages/PeeringsPerVirtualNetwork"), - // Limit: to.Ptr[int64](10), - // Unit: to.Ptr(armnetwork.UsageUnitCount), - // }, - // { - // Name: &armnetwork.UsageName{ - // LocalizedValue: to.Ptr("Security rules per Network Security Group"), - // Value: to.Ptr("SecurityRulesPerNetworkSecurityGroup"), - // }, - // CurrentValue: to.Ptr[int64](0), - // ID: to.Ptr("/subscriptions/subid/providers/Microsoft.Network/locations/westus/usages/SecurityRulesPerNetworkSecurityGroup"), - // Limit: to.Ptr[int64](200), - // Unit: to.Ptr(armnetwork.UsageUnitCount), - // }, - // { - // Name: &armnetwork.UsageName{ - // LocalizedValue: to.Ptr("Security rules addresses or ports per Network Security Group"), - // Value: to.Ptr("SecurityRuleAddressesOrPortsPerNetworkSecurityGroup"), - // }, - // CurrentValue: to.Ptr[int64](0), - // ID: to.Ptr("/subscriptions/subid/providers/Microsoft.Network/locations/westus/usages/SecurityRuleAddressesOrPortsPerNetworkSecurityGroup"), - // Limit: to.Ptr[int64](2000), - // Unit: to.Ptr(armnetwork.UsageUnitCount), - // }, - // { - // Name: &armnetwork.UsageName{ - // LocalizedValue: to.Ptr("Inbound Rules per Load Balancer"), - // Value: to.Ptr("InboundRulesPerLoadBalancer"), - // }, - // CurrentValue: to.Ptr[int64](0), - // ID: to.Ptr("/subscriptions/subid/providers/Microsoft.Network/locations/westus/usages/InboundRulesPerLoadBalancer"), - // Limit: to.Ptr[int64](150), - // Unit: to.Ptr(armnetwork.UsageUnitCount), - // }, - // { - // Name: &armnetwork.UsageName{ - // LocalizedValue: to.Ptr("Frontend IP Configurations per Load Balancer"), - // Value: to.Ptr("FrontendIPConfigurationPerLoadBalancer"), - // }, - // CurrentValue: to.Ptr[int64](0), - // ID: to.Ptr("/subscriptions/subid/providers/Microsoft.Network/locations/westus/usages/FrontendIPConfigurationPerLoadBalancer"), - // Limit: to.Ptr[int64](10), - // Unit: to.Ptr(armnetwork.UsageUnitCount), - // }, - // { - // Name: &armnetwork.UsageName{ - // LocalizedValue: to.Ptr("Outbound Rules per Load Balancer"), - // Value: to.Ptr("outboundRulesPerLoadBalancer"), - // }, - // CurrentValue: to.Ptr[int64](0), - // ID: to.Ptr("/subscriptions/subid/providers/Microsoft.Network/locations/westus/usages/outboundRulesPerLoadBalancer"), - // Limit: to.Ptr[int64](5), - // Unit: to.Ptr(armnetwork.UsageUnitCount), - // }, - // { - // Name: &armnetwork.UsageName{ - // LocalizedValue: to.Ptr("Routes per Route Table"), - // Value: to.Ptr("RoutesPerRouteTable"), - // }, - // CurrentValue: to.Ptr[int64](0), - // ID: to.Ptr("/subscriptions/subid/providers/Microsoft.Network/locations/westus/usages/RoutesPerRouteTable"), - // Limit: to.Ptr[int64](100), - // Unit: to.Ptr(armnetwork.UsageUnitCount), - // }, - // { - // Name: &armnetwork.UsageName{ - // LocalizedValue: to.Ptr("Secondary IP Configurations per Network Interface"), - // Value: to.Ptr("SecondaryIPConfigurationsPerNetworkInterface"), - // }, - // CurrentValue: to.Ptr[int64](0), - // ID: to.Ptr("/subscriptions/subid/providers/Microsoft.Network/locations/westus/usages/SecondaryIPConfigurationsPerNetworkInterface"), - // Limit: to.Ptr[int64](256), - // Unit: to.Ptr(armnetwork.UsageUnitCount), - // }, - // { - // Name: &armnetwork.UsageName{ - // LocalizedValue: to.Ptr("Inbound rules per Network Interface"), - // Value: to.Ptr("InboundRulesPerNetworkInterface"), - // }, - // CurrentValue: to.Ptr[int64](0), - // ID: to.Ptr("/subscriptions/subid/providers/Microsoft.Network/locations/westus/usages/InboundRulesPerNetworkInterface"), - // Limit: to.Ptr[int64](500), - // Unit: to.Ptr(armnetwork.UsageUnitCount), - // }, - // { - // Name: &armnetwork.UsageName{ - // LocalizedValue: to.Ptr("Route filter rules per Route Filter"), - // Value: to.Ptr("RouteFilterRulesPerRouteFilter"), - // }, - // CurrentValue: to.Ptr[int64](0), - // ID: to.Ptr("/subscriptions/subid/providers/Microsoft.Network/locations/westus/usages/RouteFilterRulesPerRouteFilter"), - // Limit: to.Ptr[int64](1), - // Unit: to.Ptr(armnetwork.UsageUnitCount), - // }, - // { - // Name: &armnetwork.UsageName{ - // LocalizedValue: to.Ptr("Route filters per Express route BGP Peering"), - // Value: to.Ptr("RouteFiltersPerExpressRouteBgpPeering"), - // }, - // CurrentValue: to.Ptr[int64](0), - // ID: to.Ptr("/subscriptions/subid/providers/Microsoft.Network/locations/westus/usages/RouteFiltersPerExpressRouteBgpPeering"), - // Limit: to.Ptr[int64](1), - // Unit: to.Ptr(armnetwork.UsageUnitCount), - // }}, - // } - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/4883fa5dbf6f2c9093fac8ce334547e9dfac68fa/specification/network/resource-manager/Microsoft.Network/stable/2024-03-01/examples/UsageListSpacedLocation.json -func ExampleUsagesClient_NewListPager_listUsagesSpacedLocation() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armnetwork.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := clientFactory.NewUsagesClient().NewListPager("West US", nil) - for pager.More() { - page, err := pager.NextPage(ctx) - if err != nil { - log.Fatalf("failed to advance page: %v", err) - } - for _, v := range page.Value { - // You could use page here. We use blank identifier for just demo purposes. - _ = v - } - // If the HTTP response code is 200 as defined in example definition, your page structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // page.UsagesListResult = armnetwork.UsagesListResult{ - // Value: []*armnetwork.Usage{ - // { - // Name: &armnetwork.UsageName{ - // LocalizedValue: to.Ptr("Virtual Networks"), - // Value: to.Ptr("VirtualNetworks"), - // }, - // CurrentValue: to.Ptr[int64](12), - // ID: to.Ptr("/subscriptions/subid/providers/Microsoft.Network/locations/West US/usages/VirtualNetworks"), - // Limit: to.Ptr[int64](50), - // Unit: to.Ptr(armnetwork.UsageUnitCount), - // }, - // { - // Name: &armnetwork.UsageName{ - // LocalizedValue: to.Ptr("Static Public IP Addresses"), - // Value: to.Ptr("StaticPublicIPAddresses"), - // }, - // CurrentValue: to.Ptr[int64](1), - // ID: to.Ptr("/subscriptions/subid/providers/Microsoft.Network/locations/West US/usages/StaticPublicIPAddresses"), - // Limit: to.Ptr[int64](20), - // Unit: to.Ptr(armnetwork.UsageUnitCount), - // }, - // { - // Name: &armnetwork.UsageName{ - // LocalizedValue: to.Ptr("Network Security Groups"), - // Value: to.Ptr("NetworkSecurityGroups"), - // }, - // CurrentValue: to.Ptr[int64](3), - // ID: to.Ptr("/subscriptions/subid/providers/Microsoft.Network/locations/West US/usages/NetworkSecurityGroups"), - // Limit: to.Ptr[int64](100), - // Unit: to.Ptr(armnetwork.UsageUnitCount), - // }, - // { - // Name: &armnetwork.UsageName{ - // LocalizedValue: to.Ptr("Public IP Addresses"), - // Value: to.Ptr("PublicIPAddresses"), - // }, - // CurrentValue: to.Ptr[int64](12), - // ID: to.Ptr("/subscriptions/subid/providers/Microsoft.Network/locations/West US/usages/PublicIPAddresses"), - // Limit: to.Ptr[int64](60), - // Unit: to.Ptr(armnetwork.UsageUnitCount), - // }, - // { - // Name: &armnetwork.UsageName{ - // LocalizedValue: to.Ptr("Public Ip Prefixes"), - // Value: to.Ptr("PublicIpPrefixes"), - // }, - // CurrentValue: to.Ptr[int64](0), - // ID: to.Ptr("/subscriptions/subid/providers/Microsoft.Network/locations/West US/usages/PublicIpPrefixes"), - // Limit: to.Ptr[int64](2147483647), - // Unit: to.Ptr(armnetwork.UsageUnitCount), - // }, - // { - // Name: &armnetwork.UsageName{ - // LocalizedValue: to.Ptr("Network Interfaces"), - // Value: to.Ptr("NetworkInterfaces"), - // }, - // CurrentValue: to.Ptr[int64](2), - // ID: to.Ptr("/subscriptions/subid/providers/Microsoft.Network/locations/West US/usages/NetworkInterfaces"), - // Limit: to.Ptr[int64](24000), - // Unit: to.Ptr(armnetwork.UsageUnitCount), - // }, - // { - // Name: &armnetwork.UsageName{ - // LocalizedValue: to.Ptr("Load Balancers"), - // Value: to.Ptr("LoadBalancers"), - // }, - // CurrentValue: to.Ptr[int64](0), - // ID: to.Ptr("/subscriptions/subid/providers/Microsoft.Network/locations/West US/usages/LoadBalancers"), - // Limit: to.Ptr[int64](100), - // Unit: to.Ptr(armnetwork.UsageUnitCount), - // }, - // { - // Name: &armnetwork.UsageName{ - // LocalizedValue: to.Ptr("Application Gateways"), - // Value: to.Ptr("ApplicationGateways"), - // }, - // CurrentValue: to.Ptr[int64](3), - // ID: to.Ptr("/subscriptions/subid/providers/Microsoft.Network/locations/West US/usages/ApplicationGateways"), - // Limit: to.Ptr[int64](50), - // Unit: to.Ptr(armnetwork.UsageUnitCount), - // }, - // { - // Name: &armnetwork.UsageName{ - // LocalizedValue: to.Ptr("Route Tables"), - // Value: to.Ptr("RouteTables"), - // }, - // CurrentValue: to.Ptr[int64](5), - // ID: to.Ptr("/subscriptions/subid/providers/Microsoft.Network/locations/West US/usages/RouteTables"), - // Limit: to.Ptr[int64](100), - // Unit: to.Ptr(armnetwork.UsageUnitCount), - // }, - // { - // Name: &armnetwork.UsageName{ - // LocalizedValue: to.Ptr("Route Filters"), - // Value: to.Ptr("RouteFilters"), - // }, - // CurrentValue: to.Ptr[int64](0), - // ID: to.Ptr("/subscriptions/subid/providers/Microsoft.Network/locations/West US/usages/RouteFilters"), - // Limit: to.Ptr[int64](1000), - // Unit: to.Ptr(armnetwork.UsageUnitCount), - // }, - // { - // Name: &armnetwork.UsageName{ - // LocalizedValue: to.Ptr("Network Watchers"), - // Value: to.Ptr("NetworkWatchers"), - // }, - // CurrentValue: to.Ptr[int64](0), - // ID: to.Ptr("/subscriptions/subid/providers/Microsoft.Network/locations/West US/usages/NetworkWatchers"), - // Limit: to.Ptr[int64](1), - // Unit: to.Ptr(armnetwork.UsageUnitCount), - // }, - // { - // Name: &armnetwork.UsageName{ - // LocalizedValue: to.Ptr("Packet Captures"), - // Value: to.Ptr("PacketCaptures"), - // }, - // CurrentValue: to.Ptr[int64](0), - // ID: to.Ptr("/subscriptions/subid/providers/Microsoft.Network/locations/West US/usages/PacketCaptures"), - // Limit: to.Ptr[int64](100), - // Unit: to.Ptr(armnetwork.UsageUnitCount), - // }, - // { - // Name: &armnetwork.UsageName{ - // LocalizedValue: to.Ptr("Application Security Groups."), - // Value: to.Ptr("ApplicationSecurityGroups"), - // }, - // CurrentValue: to.Ptr[int64](0), - // ID: to.Ptr("/subscriptions/subid/providers/Microsoft.Network/locations/West US/usages/ApplicationSecurityGroups"), - // Limit: to.Ptr[int64](500), - // Unit: to.Ptr(armnetwork.UsageUnitCount), - // }, - // { - // Name: &armnetwork.UsageName{ - // LocalizedValue: to.Ptr("DDoS Protection Plans."), - // Value: to.Ptr("DdosProtectionPlans"), - // }, - // CurrentValue: to.Ptr[int64](0), - // ID: to.Ptr("/subscriptions/subid/providers/Microsoft.Network/locations/West US/usages/DdosProtectionPlans"), - // Limit: to.Ptr[int64](1), - // Unit: to.Ptr(armnetwork.UsageUnitCount), - // }, - // { - // Name: &armnetwork.UsageName{ - // LocalizedValue: to.Ptr("Service Endpoint Policies"), - // Value: to.Ptr("ServiceEndpointPolicies"), - // }, - // CurrentValue: to.Ptr[int64](0), - // ID: to.Ptr("/subscriptions/subid/providers/Microsoft.Network/locations/West US/usages/ServiceEndpointPolicies"), - // Limit: to.Ptr[int64](200), - // Unit: to.Ptr(armnetwork.UsageUnitCount), - // }, - // { - // Name: &armnetwork.UsageName{ - // LocalizedValue: to.Ptr("Network Intent Policies"), - // Value: to.Ptr("NetworkIntentPolicies"), - // }, - // CurrentValue: to.Ptr[int64](0), - // ID: to.Ptr("/subscriptions/subid/providers/Microsoft.Network/locations/West US/usages/NetworkIntentPolicies"), - // Limit: to.Ptr[int64](200), - // Unit: to.Ptr(armnetwork.UsageUnitCount), - // }, - // { - // Name: &armnetwork.UsageName{ - // LocalizedValue: to.Ptr("DNS servers per Virtual Network"), - // Value: to.Ptr("DnsServersPerVirtualNetwork"), - // }, - // CurrentValue: to.Ptr[int64](0), - // ID: to.Ptr("/subscriptions/subid/providers/Microsoft.Network/locations/West US/usages/DnsServersPerVirtualNetwork"), - // Limit: to.Ptr[int64](9), - // Unit: to.Ptr(armnetwork.UsageUnitCount), - // }, - // { - // Name: &armnetwork.UsageName{ - // LocalizedValue: to.Ptr("Subnets per Virtual Network"), - // Value: to.Ptr("SubnetsPerVirtualNetwork"), - // }, - // CurrentValue: to.Ptr[int64](0), - // ID: to.Ptr("/subscriptions/subid/providers/Microsoft.Network/locations/West US/usages/SubnetsPerVirtualNetwork"), - // Limit: to.Ptr[int64](1000), - // Unit: to.Ptr(armnetwork.UsageUnitCount), - // }, - // { - // Name: &armnetwork.UsageName{ - // LocalizedValue: to.Ptr("IP Configurations per Virtual Network"), - // Value: to.Ptr("IPConfigurationsPerVirtualNetwork"), - // }, - // CurrentValue: to.Ptr[int64](0), - // ID: to.Ptr("/subscriptions/subid/providers/Microsoft.Network/locations/West US/usages/IPConfigurationsPerVirtualNetwork"), - // Limit: to.Ptr[int64](16384), - // Unit: to.Ptr(armnetwork.UsageUnitCount), - // }, - // { - // Name: &armnetwork.UsageName{ - // LocalizedValue: to.Ptr("Peerings per Virtual Network"), - // Value: to.Ptr("PeeringsPerVirtualNetwork"), - // }, - // CurrentValue: to.Ptr[int64](0), - // ID: to.Ptr("/subscriptions/subid/providers/Microsoft.Network/locations/West US/usages/PeeringsPerVirtualNetwork"), - // Limit: to.Ptr[int64](50), - // Unit: to.Ptr(armnetwork.UsageUnitCount), - // }, - // { - // Name: &armnetwork.UsageName{ - // LocalizedValue: to.Ptr("Security rules per Network Security Group"), - // Value: to.Ptr("SecurityRulesPerNetworkSecurityGroup"), - // }, - // CurrentValue: to.Ptr[int64](0), - // ID: to.Ptr("/subscriptions/subid/providers/Microsoft.Network/locations/West US/usages/SecurityRulesPerNetworkSecurityGroup"), - // Limit: to.Ptr[int64](1000), - // Unit: to.Ptr(armnetwork.UsageUnitCount), - // }, - // { - // Name: &armnetwork.UsageName{ - // LocalizedValue: to.Ptr("Security rules per Network Intent Policy"), - // Value: to.Ptr("SecurityRulesPerNetworkIntentPolicy"), - // }, - // CurrentValue: to.Ptr[int64](0), - // ID: to.Ptr("/subscriptions/subid/providers/Microsoft.Network/locations/West US/usages/SecurityRulesPerNetworkIntentPolicy"), - // Limit: to.Ptr[int64](100), - // Unit: to.Ptr(armnetwork.UsageUnitCount), - // }, - // { - // Name: &armnetwork.UsageName{ - // LocalizedValue: to.Ptr("Routes per Network Intent Policy"), - // Value: to.Ptr("RoutesPerNetworkIntentPolicy"), - // }, - // CurrentValue: to.Ptr[int64](0), - // ID: to.Ptr("/subscriptions/subid/providers/Microsoft.Network/locations/West US/usages/RoutesPerNetworkIntentPolicy"), - // Limit: to.Ptr[int64](100), - // Unit: to.Ptr(armnetwork.UsageUnitCount), - // }, - // { - // Name: &armnetwork.UsageName{ - // LocalizedValue: to.Ptr("Security rules addresses or ports per Network Security Group"), - // Value: to.Ptr("SecurityRuleAddressesOrPortsPerNetworkSecurityGroup"), - // }, - // CurrentValue: to.Ptr[int64](0), - // ID: to.Ptr("/subscriptions/subid/providers/Microsoft.Network/locations/West US/usages/SecurityRuleAddressesOrPortsPerNetworkSecurityGroup"), - // Limit: to.Ptr[int64](2000), - // Unit: to.Ptr(armnetwork.UsageUnitCount), - // }, - // { - // Name: &armnetwork.UsageName{ - // LocalizedValue: to.Ptr("Inbound Rules per Load Balancer"), - // Value: to.Ptr("InboundRulesPerLoadBalancer"), - // }, - // CurrentValue: to.Ptr[int64](0), - // ID: to.Ptr("/subscriptions/subid/providers/Microsoft.Network/locations/West US/usages/InboundRulesPerLoadBalancer"), - // Limit: to.Ptr[int64](150), - // Unit: to.Ptr(armnetwork.UsageUnitCount), - // }, - // { - // Name: &armnetwork.UsageName{ - // LocalizedValue: to.Ptr("Frontend IP Configurations per Load Balancer"), - // Value: to.Ptr("FrontendIPConfigurationPerLoadBalancer"), - // }, - // CurrentValue: to.Ptr[int64](0), - // ID: to.Ptr("/subscriptions/subid/providers/Microsoft.Network/locations/West US/usages/FrontendIPConfigurationPerLoadBalancer"), - // Limit: to.Ptr[int64](10), - // Unit: to.Ptr(armnetwork.UsageUnitCount), - // }, - // { - // Name: &armnetwork.UsageName{ - // LocalizedValue: to.Ptr("Outbound Rules per Load Balancer"), - // Value: to.Ptr("OutboundRulesPerLoadBalancer"), - // }, - // CurrentValue: to.Ptr[int64](0), - // ID: to.Ptr("/subscriptions/subid/providers/Microsoft.Network/locations/West US/usages/OutboundRulesPerLoadBalancer"), - // Limit: to.Ptr[int64](5), - // Unit: to.Ptr(armnetwork.UsageUnitCount), - // }, - // { - // Name: &armnetwork.UsageName{ - // LocalizedValue: to.Ptr("Routes per Route Table"), - // Value: to.Ptr("RoutesPerRouteTable"), - // }, - // CurrentValue: to.Ptr[int64](0), - // ID: to.Ptr("/subscriptions/subid/providers/Microsoft.Network/locations/West US/usages/RoutesPerRouteTable"), - // Limit: to.Ptr[int64](400), - // Unit: to.Ptr(armnetwork.UsageUnitCount), - // }, - // { - // Name: &armnetwork.UsageName{ - // LocalizedValue: to.Ptr("Secondary IP Configurations per Network Interface"), - // Value: to.Ptr("SecondaryIPConfigurationsPerNetworkInterface"), - // }, - // CurrentValue: to.Ptr[int64](0), - // ID: to.Ptr("/subscriptions/subid/providers/Microsoft.Network/locations/West US/usages/SecondaryIPConfigurationsPerNetworkInterface"), - // Limit: to.Ptr[int64](256), - // Unit: to.Ptr(armnetwork.UsageUnitCount), - // }, - // { - // Name: &armnetwork.UsageName{ - // LocalizedValue: to.Ptr("Inbound rules per Network Interface"), - // Value: to.Ptr("InboundRulesPerNetworkInterface"), - // }, - // CurrentValue: to.Ptr[int64](0), - // ID: to.Ptr("/subscriptions/subid/providers/Microsoft.Network/locations/West US/usages/InboundRulesPerNetworkInterface"), - // Limit: to.Ptr[int64](500), - // Unit: to.Ptr(armnetwork.UsageUnitCount), - // }, - // { - // Name: &armnetwork.UsageName{ - // LocalizedValue: to.Ptr("Route filter rules per Route Filter"), - // Value: to.Ptr("RouteFilterRulesPerRouteFilter"), - // }, - // CurrentValue: to.Ptr[int64](0), - // ID: to.Ptr("/subscriptions/subid/providers/Microsoft.Network/locations/West US/usages/RouteFilterRulesPerRouteFilter"), - // Limit: to.Ptr[int64](1), - // Unit: to.Ptr(armnetwork.UsageUnitCount), - // }, - // { - // Name: &armnetwork.UsageName{ - // LocalizedValue: to.Ptr("Route filters per Express route BGP Peering"), - // Value: to.Ptr("RouteFiltersPerExpressRouteBgpPeering"), - // }, - // CurrentValue: to.Ptr[int64](0), - // ID: to.Ptr("/subscriptions/subid/providers/Microsoft.Network/locations/West US/usages/RouteFiltersPerExpressRouteBgpPeering"), - // Limit: to.Ptr[int64](1), - // Unit: to.Ptr(armnetwork.UsageUnitCount), - // }}, - // } - } -} diff --git a/sdk/resourcemanager/network/armnetwork/vipswap_client_example_test.go b/sdk/resourcemanager/network/armnetwork/vipswap_client_example_test.go deleted file mode 100644 index 7a14f4aa5d23..000000000000 --- a/sdk/resourcemanager/network/armnetwork/vipswap_client_example_test.go +++ /dev/null @@ -1,103 +0,0 @@ -//go:build go1.18 -// +build go1.18 - -// 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. -// DO NOT EDIT. - -package armnetwork_test - -import ( - "context" - "log" - - "github.com/Azure/azure-sdk-for-go/sdk/azcore/to" - "github.com/Azure/azure-sdk-for-go/sdk/azidentity" - "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/network/armnetwork/v6" -) - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/4883fa5dbf6f2c9093fac8ce334547e9dfac68fa/specification/network/resource-manager/Microsoft.Network/stable/2024-03-01/examples/CloudServiceSwapGet.json -func ExampleVipSwapClient_Get() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armnetwork.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewVipSwapClient().Get(ctx, "rg1", "testCloudService", nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.SwapResource = armnetwork.SwapResource{ - // Name: to.Ptr("swap"), - // Type: to.Ptr("Microsoft.Network/cloudServiceSlots"), - // ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Compute/cloudServices/testCloudService/providers/Microsoft.Network/cloudServiceSlots/swap"), - // Properties: &armnetwork.SwapResourceProperties{ - // SlotType: to.Ptr(armnetwork.SlotTypeStaging), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/4883fa5dbf6f2c9093fac8ce334547e9dfac68fa/specification/network/resource-manager/Microsoft.Network/stable/2024-03-01/examples/CloudServiceSwapPut.json -func ExampleVipSwapClient_BeginCreate() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armnetwork.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewVipSwapClient().BeginCreate(ctx, "rg1", "testCloudService", armnetwork.SwapResource{ - Properties: &armnetwork.SwapResourceProperties{ - SlotType: to.Ptr(armnetwork.SlotTypeProduction), - }, - }, nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - _, err = poller.PollUntilDone(ctx, nil) - if err != nil { - log.Fatalf("failed to pull the result: %v", err) - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/4883fa5dbf6f2c9093fac8ce334547e9dfac68fa/specification/network/resource-manager/Microsoft.Network/stable/2024-03-01/examples/CloudServiceSwapList.json -func ExampleVipSwapClient_List() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armnetwork.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewVipSwapClient().List(ctx, "rg1", "testCloudService", nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.SwapResourceListResult = armnetwork.SwapResourceListResult{ - // Value: []*armnetwork.SwapResource{ - // { - // Name: to.Ptr("swap"), - // Type: to.Ptr("Microsoft.Network/cloudServiceSlots"), - // ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Compute/cloudServices/testCloudService/providers/Microsoft.Network/cloudServiceSlots/swap"), - // Properties: &armnetwork.SwapResourceProperties{ - // SlotType: to.Ptr(armnetwork.SlotTypeStaging), - // }, - // }}, - // } -} diff --git a/sdk/resourcemanager/network/armnetwork/virtualapplianceconnections_client_example_test.go b/sdk/resourcemanager/network/armnetwork/virtualapplianceconnections_client_example_test.go deleted file mode 100644 index 1a51f273f053..000000000000 --- a/sdk/resourcemanager/network/armnetwork/virtualapplianceconnections_client_example_test.go +++ /dev/null @@ -1,237 +0,0 @@ -//go:build go1.18 -// +build go1.18 - -// 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. -// DO NOT EDIT. - -package armnetwork_test - -import ( - "context" - "log" - - "github.com/Azure/azure-sdk-for-go/sdk/azcore/to" - "github.com/Azure/azure-sdk-for-go/sdk/azidentity" - "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/network/armnetwork/v6" -) - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/4883fa5dbf6f2c9093fac8ce334547e9dfac68fa/specification/network/resource-manager/Microsoft.Network/stable/2024-03-01/examples/NetworkVirtualApplianceConnectionPut.json -func ExampleVirtualApplianceConnectionsClient_BeginCreateOrUpdate() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armnetwork.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewVirtualApplianceConnectionsClient().BeginCreateOrUpdate(ctx, "rg1", "nva1", "connection1", armnetwork.VirtualApplianceConnection{ - Properties: &armnetwork.VirtualApplianceConnectionProperties{ - Name: to.Ptr("connection1"), - Asn: to.Ptr[int64](64512), - BgpPeerAddress: []*string{ - to.Ptr("169.254.16.13"), - to.Ptr("169.254.16.14")}, - EnableInternetSecurity: to.Ptr(false), - RoutingConfiguration: &armnetwork.RoutingConfiguration{ - AssociatedRouteTable: &armnetwork.SubResource{ - ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/virtualHubs/virtualHub1/hubRouteTables/hubRouteTable1"), - }, - InboundRouteMap: &armnetwork.SubResource{ - ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/virtualHubs/virtualHub1/routeMaps/routeMap1"), - }, - OutboundRouteMap: &armnetwork.SubResource{ - ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/virtualHubs/virtualHub1/routeMaps/routeMap2"), - }, - PropagatedRouteTables: &armnetwork.PropagatedRouteTable{ - IDs: []*armnetwork.SubResource{ - { - ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/virtualHubs/virtualHub1/hubRouteTables/hubRouteTable1"), - }}, - Labels: []*string{ - to.Ptr("label1")}, - }, - }, - TunnelIdentifier: to.Ptr[int64](0), - }, - }, nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - res, err := poller.PollUntilDone(ctx, nil) - if err != nil { - log.Fatalf("failed to pull the result: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.VirtualApplianceConnection = armnetwork.VirtualApplianceConnection{ - // ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/networkVirtualAppliances/nva1/networkVirtualApplianceConnections/connection1"), - // Name: to.Ptr("connection1"), - // Properties: &armnetwork.VirtualApplianceConnectionProperties{ - // Name: to.Ptr("connection1"), - // Asn: to.Ptr[int64](64512), - // BgpPeerAddress: []*string{ - // to.Ptr("169.254.16.13"), - // to.Ptr("169.254.16.14")}, - // ProvisioningState: to.Ptr(armnetwork.ProvisioningStateSucceeded), - // RoutingConfiguration: &armnetwork.RoutingConfiguration{ - // AssociatedRouteTable: &armnetwork.SubResource{ - // ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/virtualHubs/virtualHub1/hubRouteTables/hubRouteTable1"), - // }, - // InboundRouteMap: &armnetwork.SubResource{ - // ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/virtualHubs/virtualHub1/routeMaps/routeMap1"), - // }, - // OutboundRouteMap: &armnetwork.SubResource{ - // ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/virtualHubs/virtualHub1/routeMaps/routeMap2"), - // }, - // PropagatedRouteTables: &armnetwork.PropagatedRouteTable{ - // IDs: []*armnetwork.SubResource{ - // { - // ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/virtualHubs/virtualHub1/hubRouteTables/hubRouteTable1"), - // }}, - // Labels: []*string{ - // to.Ptr("label1")}, - // }, - // }, - // TunnelIdentifier: to.Ptr[int64](0), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/4883fa5dbf6f2c9093fac8ce334547e9dfac68fa/specification/network/resource-manager/Microsoft.Network/stable/2024-03-01/examples/NetworkVirtualApplianceConnectionGet.json -func ExampleVirtualApplianceConnectionsClient_Get() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armnetwork.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewVirtualApplianceConnectionsClient().Get(ctx, "rg1", "nva1", "connection1", nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.VirtualApplianceConnection = armnetwork.VirtualApplianceConnection{ - // ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/NetworkVirtualAppliances/nva1/NetworkVirtualApplianceConnections/connection1"), - // Name: to.Ptr("connection1"), - // Properties: &armnetwork.VirtualApplianceConnectionProperties{ - // Name: to.Ptr("connection1"), - // Asn: to.Ptr[int64](64512), - // BgpPeerAddress: []*string{ - // to.Ptr("169.254.16.13"), - // to.Ptr("169.254.16.14")}, - // ProvisioningState: to.Ptr(armnetwork.ProvisioningStateSucceeded), - // RoutingConfiguration: &armnetwork.RoutingConfiguration{ - // AssociatedRouteTable: &armnetwork.SubResource{ - // ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/virtualHubs/virtualHub1/hubRouteTables/hubRouteTable1"), - // }, - // InboundRouteMap: &armnetwork.SubResource{ - // ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/virtualHubs/virtualHub1/routeMaps/routeMap1"), - // }, - // OutboundRouteMap: &armnetwork.SubResource{ - // ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/virtualHubs/virtualHub1/routeMaps/routeMap2"), - // }, - // PropagatedRouteTables: &armnetwork.PropagatedRouteTable{ - // IDs: []*armnetwork.SubResource{ - // { - // ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/virtualHubs/virtualHub1/hubRouteTables/hubRouteTable1"), - // }}, - // Labels: []*string{ - // to.Ptr("label1")}, - // }, - // }, - // TunnelIdentifier: to.Ptr[int64](0), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/4883fa5dbf6f2c9093fac8ce334547e9dfac68fa/specification/network/resource-manager/Microsoft.Network/stable/2024-03-01/examples/NetworkVirtualApplianceConnectionDelete.json -func ExampleVirtualApplianceConnectionsClient_BeginDelete() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armnetwork.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewVirtualApplianceConnectionsClient().BeginDelete(ctx, "rg1", "nva1", "connection1", nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - _, err = poller.PollUntilDone(ctx, nil) - if err != nil { - log.Fatalf("failed to pull the result: %v", err) - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/4883fa5dbf6f2c9093fac8ce334547e9dfac68fa/specification/network/resource-manager/Microsoft.Network/stable/2024-03-01/examples/NetworkVirtualApplianceConnectionList.json -func ExampleVirtualApplianceConnectionsClient_NewListPager() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armnetwork.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := clientFactory.NewVirtualApplianceConnectionsClient().NewListPager("rg1", "nva1", nil) - for pager.More() { - page, err := pager.NextPage(ctx) - if err != nil { - log.Fatalf("failed to advance page: %v", err) - } - for _, v := range page.Value { - // You could use page here. We use blank identifier for just demo purposes. - _ = v - } - // If the HTTP response code is 200 as defined in example definition, your page structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // page.VirtualApplianceConnectionList = armnetwork.VirtualApplianceConnectionList{ - // Value: []*armnetwork.VirtualApplianceConnection{ - // { - // ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/NetworkVirtualAppliances/nva1/NetworkVirtualApplianceConnections/connection1"), - // Name: to.Ptr("connection1"), - // Properties: &armnetwork.VirtualApplianceConnectionProperties{ - // Name: to.Ptr("connection1"), - // Asn: to.Ptr[int64](64512), - // BgpPeerAddress: []*string{ - // to.Ptr("169.254.16.13"), - // to.Ptr("169.254.16.14")}, - // ProvisioningState: to.Ptr(armnetwork.ProvisioningStateSucceeded), - // RoutingConfiguration: &armnetwork.RoutingConfiguration{ - // AssociatedRouteTable: &armnetwork.SubResource{ - // ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/virtualHubs/virtualHub1/hubRouteTables/hubRouteTable1"), - // }, - // InboundRouteMap: &armnetwork.SubResource{ - // ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/virtualHubs/virtualHub1/routeMaps/routeMap1"), - // }, - // OutboundRouteMap: &armnetwork.SubResource{ - // ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/virtualHubs/virtualHub1/routeMaps/routeMap2"), - // }, - // PropagatedRouteTables: &armnetwork.PropagatedRouteTable{ - // IDs: []*armnetwork.SubResource{ - // { - // ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/virtualHubs/virtualHub1/hubRouteTables/hubRouteTable1"), - // }}, - // Labels: []*string{ - // to.Ptr("label1")}, - // }, - // }, - // TunnelIdentifier: to.Ptr[int64](0), - // }, - // }}, - // } - } -} diff --git a/sdk/resourcemanager/network/armnetwork/virtualappliances_client_example_test.go b/sdk/resourcemanager/network/armnetwork/virtualappliances_client_example_test.go deleted file mode 100644 index 099938946a0c..000000000000 --- a/sdk/resourcemanager/network/armnetwork/virtualappliances_client_example_test.go +++ /dev/null @@ -1,916 +0,0 @@ -//go:build go1.18 -// +build go1.18 - -// 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. -// DO NOT EDIT. - -package armnetwork_test - -import ( - "context" - "log" - - "github.com/Azure/azure-sdk-for-go/sdk/azcore/to" - "github.com/Azure/azure-sdk-for-go/sdk/azidentity" - "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/network/armnetwork/v6" -) - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/4883fa5dbf6f2c9093fac8ce334547e9dfac68fa/specification/network/resource-manager/Microsoft.Network/stable/2024-03-01/examples/NetworkVirtualApplianceDelete.json -func ExampleVirtualAppliancesClient_BeginDelete() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armnetwork.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewVirtualAppliancesClient().BeginDelete(ctx, "rg1", "nva", nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - _, err = poller.PollUntilDone(ctx, nil) - if err != nil { - log.Fatalf("failed to pull the result: %v", err) - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/4883fa5dbf6f2c9093fac8ce334547e9dfac68fa/specification/network/resource-manager/Microsoft.Network/stable/2024-03-01/examples/NetworkVirtualApplianceGet.json -func ExampleVirtualAppliancesClient_Get() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armnetwork.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewVirtualAppliancesClient().Get(ctx, "rg1", "nva", &armnetwork.VirtualAppliancesClientGetOptions{Expand: nil}) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.VirtualAppliance = armnetwork.VirtualAppliance{ - // Name: to.Ptr("nva"), - // Type: to.Ptr("Microsoft.Network/networkVirtualAppliances"), - // ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/networkVirtualAppliances/nva"), - // Location: to.Ptr("West US"), - // Tags: map[string]*string{ - // "key1": to.Ptr("value1"), - // }, - // Etag: to.Ptr("w/\\00000000-0000-0000-0000-000000000000\\"), - // Identity: &armnetwork.ManagedServiceIdentity{ - // Type: to.Ptr(armnetwork.ResourceIdentityTypeUserAssigned), - // UserAssignedIdentities: map[string]*armnetwork.Components1Jq1T4ISchemasManagedserviceidentityPropertiesUserassignedidentitiesAdditionalproperties{ - // "/subscriptions/subid/resourcegroups/rg1/providers/Microsoft.ManagedIdentity/userAssignedIdentities/identity1": &armnetwork.Components1Jq1T4ISchemasManagedserviceidentityPropertiesUserassignedidentitiesAdditionalproperties{ - // }, - // }, - // }, - // Properties: &armnetwork.VirtualAppliancePropertiesFormat{ - // AdditionalNics: []*armnetwork.VirtualApplianceAdditionalNicProperties{ - // { - // Name: to.Ptr("exrsdwan"), - // HasPublicIP: to.Ptr(true), - // }}, - // AddressPrefix: to.Ptr("192.168.1.0/16"), - // BootStrapConfigurationBlobs: []*string{ - // to.Ptr("https://csrncvhdstorage1.blob.core.windows.net/csrncvhdstoragecont/csrbootstrapconfig")}, - // CloudInitConfigurationBlobs: []*string{ - // to.Ptr("https://csrncvhdstorage1.blob.core.windows.net/csrncvhdstoragecont/csrcloudinitconfig")}, - // InboundSecurityRules: []*armnetwork.SubResource{ - // { - // ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/networkVirtualAppliances/nva/InboundSecurityRules/rule1"), - // }}, - // InternetIngressPublicIPs: []*armnetwork.InternetIngressPublicIPsProperties{ - // { - // ID: to.Ptr("/subscriptions/{{subscriptionId}}/resourceGroups/{{rg}}/providers/Microsoft.Network/publicIPAddresses/slbip"), - // }}, - // NetworkProfile: &armnetwork.VirtualAppliancePropertiesFormatNetworkProfile{ - // NetworkInterfaceConfigurations: []*armnetwork.VirtualApplianceNetworkInterfaceConfiguration{ - // { - // NicType: to.Ptr(armnetwork.NicTypeInRequestPublicNic), - // Properties: &armnetwork.VirtualApplianceNetworkInterfaceConfigurationProperties{ - // IPConfigurations: []*armnetwork.VirtualApplianceIPConfiguration{ - // { - // Name: to.Ptr("publicnicipconfig"), - // Properties: &armnetwork.VirtualApplianceIPConfigurationProperties{ - // Primary: to.Ptr(true), - // }, - // }, - // { - // Name: to.Ptr("publicnicipconfig-2"), - // Properties: &armnetwork.VirtualApplianceIPConfigurationProperties{ - // Primary: to.Ptr(false), - // }, - // }}, - // }, - // }, - // { - // NicType: to.Ptr(armnetwork.NicTypeInRequestPrivateNic), - // Properties: &armnetwork.VirtualApplianceNetworkInterfaceConfigurationProperties{ - // IPConfigurations: []*armnetwork.VirtualApplianceIPConfiguration{ - // { - // Name: to.Ptr("privatenicipconfig"), - // Properties: &armnetwork.VirtualApplianceIPConfigurationProperties{ - // Primary: to.Ptr(true), - // }, - // }, - // { - // Name: to.Ptr("privatenicipconfig-2"), - // Properties: &armnetwork.VirtualApplianceIPConfigurationProperties{ - // Primary: to.Ptr(false), - // }, - // }}, - // }, - // }}, - // }, - // NvaSKU: &armnetwork.VirtualApplianceSKUProperties{ - // BundledScaleUnit: to.Ptr("1"), - // MarketPlaceVersion: to.Ptr("12.1"), - // Vendor: to.Ptr("Cisco SDWAN"), - // }, - // ProvisioningState: to.Ptr(armnetwork.ProvisioningStateSucceeded), - // VirtualApplianceAsn: to.Ptr[int64](10000), - // VirtualApplianceConnections: []*armnetwork.SubResource{ - // { - // ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/networkVirtualAppliances/nva/networkVirtualApplianceConnections/connection1"), - // }}, - // VirtualApplianceNics: []*armnetwork.VirtualApplianceNicProperties{ - // { - // Name: to.Ptr("publicnicipconfig"), - // InstanceName: to.Ptr("nva_0"), - // NicType: to.Ptr(armnetwork.NicTypeInResponsePublicNic), - // PrivateIPAddress: to.Ptr("192.168.12.1"), - // PublicIPAddress: to.Ptr("40.30.2.2"), - // }, - // { - // Name: to.Ptr("publicnicipconfig-2"), - // InstanceName: to.Ptr("nva_0"), - // NicType: to.Ptr(armnetwork.NicTypeInResponsePublicNic), - // PrivateIPAddress: to.Ptr("192.168.12.2"), - // PublicIPAddress: to.Ptr("40.30.2.3"), - // }, - // { - // Name: to.Ptr("privatenicipconfig"), - // InstanceName: to.Ptr("nva_0"), - // NicType: to.Ptr(armnetwork.NicTypeInResponsePrivateNic), - // PrivateIPAddress: to.Ptr("192.168.12.3"), - // PublicIPAddress: to.Ptr(""), - // }, - // { - // Name: to.Ptr("privatenicipconfig-2"), - // InstanceName: to.Ptr("nva_0"), - // NicType: to.Ptr(armnetwork.NicTypeInResponsePrivateNic), - // PrivateIPAddress: to.Ptr("192.168.12.4"), - // PublicIPAddress: to.Ptr(""), - // }, - // { - // Name: to.Ptr("exrsdwan"), - // InstanceName: to.Ptr("nva_0"), - // NicType: to.Ptr(armnetwork.NicTypeInResponseAdditionalNic), - // PrivateIPAddress: to.Ptr("10.1.113.4"), - // PublicIPAddress: to.Ptr("4.231.25.19"), - // }}, - // VirtualApplianceSites: []*armnetwork.SubResource{ - // { - // ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/networtkVirtualAppliances/nva/virtualApplianceSites/site1"), - // }}, - // VirtualHub: &armnetwork.SubResource{ - // ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/virtualHubs/hub1"), - // }, - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/4883fa5dbf6f2c9093fac8ce334547e9dfac68fa/specification/network/resource-manager/Microsoft.Network/stable/2024-03-01/examples/NetworkVirtualApplianceUpdateTags.json -func ExampleVirtualAppliancesClient_UpdateTags() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armnetwork.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewVirtualAppliancesClient().UpdateTags(ctx, "rg1", "nva", armnetwork.TagsObject{ - Tags: map[string]*string{ - "key1": to.Ptr("value1"), - "key2": to.Ptr("value2"), - }, - }, nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.VirtualAppliance = armnetwork.VirtualAppliance{ - // Name: to.Ptr("nva"), - // Type: to.Ptr("Microsoft.Network/networkVirtualAppliances"), - // ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/networkVirtualAppliances/nva"), - // Location: to.Ptr("West US"), - // Tags: map[string]*string{ - // "key1": to.Ptr("value1"), - // "key2": to.Ptr("value2"), - // }, - // Etag: to.Ptr("w/\\00000000-0000-0000-0000-000000000000\\"), - // Identity: &armnetwork.ManagedServiceIdentity{ - // Type: to.Ptr(armnetwork.ResourceIdentityTypeUserAssigned), - // UserAssignedIdentities: map[string]*armnetwork.Components1Jq1T4ISchemasManagedserviceidentityPropertiesUserassignedidentitiesAdditionalproperties{ - // "/subscriptions/subid/resourcegroups/rg1/providers/Microsoft.ManagedIdentity/userAssignedIdentities/identity1": &armnetwork.Components1Jq1T4ISchemasManagedserviceidentityPropertiesUserassignedidentitiesAdditionalproperties{ - // }, - // }, - // }, - // Properties: &armnetwork.VirtualAppliancePropertiesFormat{ - // AddressPrefix: to.Ptr("192.168.1.0/16"), - // BootStrapConfigurationBlobs: []*string{ - // to.Ptr("https://csrncvhdstorage1.blob.core.windows.net/csrncvhdstoragecont/csrbootstrapconfig")}, - // CloudInitConfigurationBlobs: []*string{ - // to.Ptr("https://csrncvhdstorage1.blob.core.windows.net/csrncvhdstoragecont/csrcloudinitconfig")}, - // NvaSKU: &armnetwork.VirtualApplianceSKUProperties{ - // BundledScaleUnit: to.Ptr("1"), - // MarketPlaceVersion: to.Ptr("12.1"), - // Vendor: to.Ptr("Cisco SDWAN"), - // }, - // ProvisioningState: to.Ptr(armnetwork.ProvisioningStateSucceeded), - // VirtualApplianceAsn: to.Ptr[int64](10000), - // VirtualApplianceNics: []*armnetwork.VirtualApplianceNicProperties{ - // { - // Name: to.Ptr("managementNic"), - // PrivateIPAddress: to.Ptr("192.168.12.1"), - // PublicIPAddress: to.Ptr("40.30.2.2"), - // }, - // { - // Name: to.Ptr("privateNic-1"), - // PrivateIPAddress: to.Ptr("192.168.12.2"), - // }}, - // VirtualApplianceSites: []*armnetwork.SubResource{ - // { - // ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/networtkVirtualAppliances/nva/virtualApplianceSites/site1"), - // }}, - // VirtualHub: &armnetwork.SubResource{ - // ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/virtualHubs/hub1"), - // }, - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/4883fa5dbf6f2c9093fac8ce334547e9dfac68fa/specification/network/resource-manager/Microsoft.Network/stable/2024-03-01/examples/NetworkVirtualAppliancePut.json -func ExampleVirtualAppliancesClient_BeginCreateOrUpdate_createNetworkVirtualAppliance() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armnetwork.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewVirtualAppliancesClient().BeginCreateOrUpdate(ctx, "rg1", "nva", armnetwork.VirtualAppliance{ - Location: to.Ptr("West US"), - Tags: map[string]*string{ - "key1": to.Ptr("value1"), - }, - Identity: &armnetwork.ManagedServiceIdentity{ - Type: to.Ptr(armnetwork.ResourceIdentityTypeUserAssigned), - UserAssignedIdentities: map[string]*armnetwork.Components1Jq1T4ISchemasManagedserviceidentityPropertiesUserassignedidentitiesAdditionalproperties{ - "/subscriptions/subid/resourcegroups/rg1/providers/Microsoft.ManagedIdentity/userAssignedIdentities/identity1": {}, - }, - }, - Properties: &armnetwork.VirtualAppliancePropertiesFormat{ - AdditionalNics: []*armnetwork.VirtualApplianceAdditionalNicProperties{ - { - Name: to.Ptr("exrsdwan"), - HasPublicIP: to.Ptr(true), - }}, - BootStrapConfigurationBlobs: []*string{ - to.Ptr("https://csrncvhdstorage1.blob.core.windows.net/csrncvhdstoragecont/csrbootstrapconfig")}, - CloudInitConfigurationBlobs: []*string{ - to.Ptr("https://csrncvhdstorage1.blob.core.windows.net/csrncvhdstoragecont/csrcloudinitconfig")}, - InternetIngressPublicIPs: []*armnetwork.InternetIngressPublicIPsProperties{ - { - ID: to.Ptr("/subscriptions/{{subscriptionId}}/resourceGroups/{{rg}}/providers/Microsoft.Network/publicIPAddresses/slbip"), - }}, - NetworkProfile: &armnetwork.VirtualAppliancePropertiesFormatNetworkProfile{ - NetworkInterfaceConfigurations: []*armnetwork.VirtualApplianceNetworkInterfaceConfiguration{ - { - NicType: to.Ptr(armnetwork.NicTypeInRequestPublicNic), - Properties: &armnetwork.VirtualApplianceNetworkInterfaceConfigurationProperties{ - IPConfigurations: []*armnetwork.VirtualApplianceIPConfiguration{ - { - Name: to.Ptr("publicnicipconfig"), - Properties: &armnetwork.VirtualApplianceIPConfigurationProperties{ - Primary: to.Ptr(true), - }, - }, - { - Name: to.Ptr("publicnicipconfig-2"), - Properties: &armnetwork.VirtualApplianceIPConfigurationProperties{ - Primary: to.Ptr(false), - }, - }}, - }, - }, - { - NicType: to.Ptr(armnetwork.NicTypeInRequestPrivateNic), - Properties: &armnetwork.VirtualApplianceNetworkInterfaceConfigurationProperties{ - IPConfigurations: []*armnetwork.VirtualApplianceIPConfiguration{ - { - Name: to.Ptr("privatenicipconfig"), - Properties: &armnetwork.VirtualApplianceIPConfigurationProperties{ - Primary: to.Ptr(true), - }, - }, - { - Name: to.Ptr("privatenicipconfig-2"), - Properties: &armnetwork.VirtualApplianceIPConfigurationProperties{ - Primary: to.Ptr(false), - }, - }}, - }, - }}, - }, - NvaSKU: &armnetwork.VirtualApplianceSKUProperties{ - BundledScaleUnit: to.Ptr("1"), - MarketPlaceVersion: to.Ptr("12.1"), - Vendor: to.Ptr("Cisco SDWAN"), - }, - VirtualApplianceAsn: to.Ptr[int64](10000), - VirtualHub: &armnetwork.SubResource{ - ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/virtualHubs/hub1"), - }, - }, - }, nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - res, err := poller.PollUntilDone(ctx, nil) - if err != nil { - log.Fatalf("failed to pull the result: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.VirtualAppliance = armnetwork.VirtualAppliance{ - // Name: to.Ptr("nva"), - // Type: to.Ptr("Microsoft.Network/networkVirtualAppliances"), - // ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/networkVirtualAppliances/nva"), - // Location: to.Ptr("West US"), - // Tags: map[string]*string{ - // "key1": to.Ptr("value1"), - // }, - // Etag: to.Ptr("w/\\00000000-0000-0000-0000-000000000000\\"), - // Identity: &armnetwork.ManagedServiceIdentity{ - // Type: to.Ptr(armnetwork.ResourceIdentityTypeUserAssigned), - // UserAssignedIdentities: map[string]*armnetwork.Components1Jq1T4ISchemasManagedserviceidentityPropertiesUserassignedidentitiesAdditionalproperties{ - // "/subscriptions/subid/resourcegroups/rg1/providers/Microsoft.ManagedIdentity/userAssignedIdentities/identity1": &armnetwork.Components1Jq1T4ISchemasManagedserviceidentityPropertiesUserassignedidentitiesAdditionalproperties{ - // }, - // }, - // }, - // Properties: &armnetwork.VirtualAppliancePropertiesFormat{ - // AdditionalNics: []*armnetwork.VirtualApplianceAdditionalNicProperties{ - // { - // Name: to.Ptr("exrsdwan"), - // HasPublicIP: to.Ptr(true), - // }}, - // AddressPrefix: to.Ptr("192.168.1.0/16"), - // BootStrapConfigurationBlobs: []*string{ - // to.Ptr("https://csrncvhdstorage1.blob.core.windows.net/csrncvhdstoragecont/csrbootstrapconfig")}, - // CloudInitConfigurationBlobs: []*string{ - // to.Ptr("https://csrncvhdstorage1.blob.core.windows.net/csrncvhdstoragecont/csrcloudinitconfig")}, - // InboundSecurityRules: []*armnetwork.SubResource{ - // { - // ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/networkVirtualAppliances/nva/InboundSecurityRules/rule1"), - // }}, - // InternetIngressPublicIPs: []*armnetwork.InternetIngressPublicIPsProperties{ - // { - // ID: to.Ptr("/subscriptions/{{subscriptionId}}/resourceGroups/{{rg}}/providers/Microsoft.Network/publicIPAddresses/slbip"), - // }}, - // NetworkProfile: &armnetwork.VirtualAppliancePropertiesFormatNetworkProfile{ - // NetworkInterfaceConfigurations: []*armnetwork.VirtualApplianceNetworkInterfaceConfiguration{ - // { - // NicType: to.Ptr(armnetwork.NicTypeInRequestPublicNic), - // Properties: &armnetwork.VirtualApplianceNetworkInterfaceConfigurationProperties{ - // IPConfigurations: []*armnetwork.VirtualApplianceIPConfiguration{ - // { - // Name: to.Ptr("publicnicipconfig"), - // Properties: &armnetwork.VirtualApplianceIPConfigurationProperties{ - // Primary: to.Ptr(true), - // }, - // }, - // { - // Name: to.Ptr("publicnicipconfig-2"), - // Properties: &armnetwork.VirtualApplianceIPConfigurationProperties{ - // Primary: to.Ptr(false), - // }, - // }}, - // }, - // }, - // { - // NicType: to.Ptr(armnetwork.NicTypeInRequestPrivateNic), - // Properties: &armnetwork.VirtualApplianceNetworkInterfaceConfigurationProperties{ - // IPConfigurations: []*armnetwork.VirtualApplianceIPConfiguration{ - // { - // Name: to.Ptr("privatenicipconfig"), - // Properties: &armnetwork.VirtualApplianceIPConfigurationProperties{ - // Primary: to.Ptr(true), - // }, - // }, - // { - // Name: to.Ptr("privatenicipconfig-2"), - // Properties: &armnetwork.VirtualApplianceIPConfigurationProperties{ - // Primary: to.Ptr(false), - // }, - // }}, - // }, - // }}, - // }, - // NvaSKU: &armnetwork.VirtualApplianceSKUProperties{ - // BundledScaleUnit: to.Ptr("1"), - // MarketPlaceVersion: to.Ptr("12.1"), - // Vendor: to.Ptr("Cisco SDWAN"), - // }, - // ProvisioningState: to.Ptr(armnetwork.ProvisioningStateSucceeded), - // VirtualApplianceAsn: to.Ptr[int64](10000), - // VirtualApplianceNics: []*armnetwork.VirtualApplianceNicProperties{ - // { - // Name: to.Ptr("publicnicipconfig"), - // InstanceName: to.Ptr("nva_0"), - // NicType: to.Ptr(armnetwork.NicTypeInResponsePublicNic), - // PrivateIPAddress: to.Ptr("192.168.12.1"), - // PublicIPAddress: to.Ptr("40.30.2.2"), - // }, - // { - // Name: to.Ptr("publicnicipconfig-2"), - // InstanceName: to.Ptr("nva_0"), - // NicType: to.Ptr(armnetwork.NicTypeInResponsePublicNic), - // PrivateIPAddress: to.Ptr("192.168.12.2"), - // PublicIPAddress: to.Ptr("40.30.2.3"), - // }, - // { - // Name: to.Ptr("privatenicipconfig"), - // InstanceName: to.Ptr("nva_0"), - // NicType: to.Ptr(armnetwork.NicTypeInResponsePrivateNic), - // PrivateIPAddress: to.Ptr("192.168.12.3"), - // PublicIPAddress: to.Ptr(""), - // }, - // { - // Name: to.Ptr("privatenicipconfig-2"), - // InstanceName: to.Ptr("nva_0"), - // NicType: to.Ptr(armnetwork.NicTypeInResponsePrivateNic), - // PrivateIPAddress: to.Ptr("192.168.12.4"), - // PublicIPAddress: to.Ptr(""), - // }, - // { - // Name: to.Ptr("exrsdwan"), - // InstanceName: to.Ptr("nva_0"), - // NicType: to.Ptr(armnetwork.NicTypeInResponseAdditionalNic), - // PrivateIPAddress: to.Ptr("10.1.113.4"), - // PublicIPAddress: to.Ptr("4.231.25.19"), - // }}, - // VirtualApplianceSites: []*armnetwork.SubResource{ - // { - // ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/networtkVirtualAppliances/nva/virtualApplianceSites/site1"), - // }}, - // VirtualHub: &armnetwork.SubResource{ - // ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/virtualHubs/hub1"), - // }, - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/4883fa5dbf6f2c9093fac8ce334547e9dfac68fa/specification/network/resource-manager/Microsoft.Network/stable/2024-03-01/examples/NetworkVirtualApplianceSaaSPut.json -func ExampleVirtualAppliancesClient_BeginCreateOrUpdate_createSaaSNetworkVirtualAppliance() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armnetwork.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewVirtualAppliancesClient().BeginCreateOrUpdate(ctx, "rg1", "nva", armnetwork.VirtualAppliance{ - Location: to.Ptr("West US"), - Tags: map[string]*string{ - "key1": to.Ptr("value1"), - }, - Properties: &armnetwork.VirtualAppliancePropertiesFormat{ - Delegation: &armnetwork.DelegationProperties{ - ServiceName: to.Ptr("PaloAltoNetworks.Cloudngfw/firewalls"), - }, - VirtualHub: &armnetwork.SubResource{ - ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/virtualHubs/hub1"), - }, - }, - }, nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - res, err := poller.PollUntilDone(ctx, nil) - if err != nil { - log.Fatalf("failed to pull the result: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.VirtualAppliance = armnetwork.VirtualAppliance{ - // Name: to.Ptr("nva"), - // Type: to.Ptr("Microsoft.Network/networkVirtualAppliances"), - // ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/networkVirtualAppliances/nva"), - // Location: to.Ptr("West US"), - // Tags: map[string]*string{ - // "key1": to.Ptr("value1"), - // }, - // Etag: to.Ptr("w/\\00000000-0000-0000-0000-000000000000\\"), - // Properties: &armnetwork.VirtualAppliancePropertiesFormat{ - // Delegation: &armnetwork.DelegationProperties{ - // ProvisioningState: to.Ptr(armnetwork.ProvisioningStateSucceeded), - // ServiceName: to.Ptr("PaloAltoNetworks.Cloudngfw/firewalls"), - // }, - // DeploymentType: to.Ptr("PartnerManaged"), - // PartnerManagedResource: &armnetwork.PartnerManagedResourceProperties{ - // ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Lifter/firewalls/paloAltoFirewall"), - // InternalLoadBalancerID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/loadBalancers/trustILB"), - // StandardLoadBalancerID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/loadBalancers/trustSLB"), - // }, - // ProvisioningState: to.Ptr(armnetwork.ProvisioningStateSucceeded), - // VirtualHub: &armnetwork.SubResource{ - // ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/virtualHubs/hub1"), - // }, - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/4883fa5dbf6f2c9093fac8ce334547e9dfac68fa/specification/network/resource-manager/Microsoft.Network/stable/2024-03-01/examples/NetworkVirtualApplianceEmptyRestart.json -func ExampleVirtualAppliancesClient_BeginRestart_restartAllNetworkVirtualApplianceVMsInVmScaleSet() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armnetwork.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewVirtualAppliancesClient().BeginRestart(ctx, "rg1", "nva", &armnetwork.VirtualAppliancesClientBeginRestartOptions{NetworkVirtualApplianceInstanceIDs: nil}) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - res, err := poller.PollUntilDone(ctx, nil) - if err != nil { - log.Fatalf("failed to pull the result: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.VirtualApplianceInstanceIDs = armnetwork.VirtualApplianceInstanceIDs{ - // InstanceIDs: []*string{ - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/4883fa5dbf6f2c9093fac8ce334547e9dfac68fa/specification/network/resource-manager/Microsoft.Network/stable/2024-03-01/examples/NetworkVirtualApplianceSpecificRestart.json -func ExampleVirtualAppliancesClient_BeginRestart_restartSpecificNetworkVirtualApplianceVMsInVmScaleSet() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armnetwork.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewVirtualAppliancesClient().BeginRestart(ctx, "rg1", "nva", &armnetwork.VirtualAppliancesClientBeginRestartOptions{NetworkVirtualApplianceInstanceIDs: nil}) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - res, err := poller.PollUntilDone(ctx, nil) - if err != nil { - log.Fatalf("failed to pull the result: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.VirtualApplianceInstanceIDs = armnetwork.VirtualApplianceInstanceIDs{ - // InstanceIDs: []*string{ - // to.Ptr("0"), - // to.Ptr("1")}, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/4883fa5dbf6f2c9093fac8ce334547e9dfac68fa/specification/network/resource-manager/Microsoft.Network/stable/2024-03-01/examples/NetworkVirtualApplianceListByResourceGroup.json -func ExampleVirtualAppliancesClient_NewListByResourceGroupPager() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armnetwork.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := clientFactory.NewVirtualAppliancesClient().NewListByResourceGroupPager("rg1", nil) - for pager.More() { - page, err := pager.NextPage(ctx) - if err != nil { - log.Fatalf("failed to advance page: %v", err) - } - for _, v := range page.Value { - // You could use page here. We use blank identifier for just demo purposes. - _ = v - } - // If the HTTP response code is 200 as defined in example definition, your page structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // page.VirtualApplianceListResult = armnetwork.VirtualApplianceListResult{ - // Value: []*armnetwork.VirtualAppliance{ - // { - // Name: to.Ptr("nva"), - // Type: to.Ptr("Microsoft.Network/networkVirtualAppliances"), - // ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/networkVirtualAppliances/nva"), - // Location: to.Ptr("West US"), - // Tags: map[string]*string{ - // "key1": to.Ptr("value1"), - // }, - // Etag: to.Ptr("w/\\00000000-0000-0000-0000-000000000000\\"), - // Identity: &armnetwork.ManagedServiceIdentity{ - // Type: to.Ptr(armnetwork.ResourceIdentityTypeUserAssigned), - // UserAssignedIdentities: map[string]*armnetwork.Components1Jq1T4ISchemasManagedserviceidentityPropertiesUserassignedidentitiesAdditionalproperties{ - // "/subscriptions/subid/resourcegroups/rg1/providers/Microsoft.ManagedIdentity/userAssignedIdentities/identity1": &armnetwork.Components1Jq1T4ISchemasManagedserviceidentityPropertiesUserassignedidentitiesAdditionalproperties{ - // }, - // }, - // }, - // Properties: &armnetwork.VirtualAppliancePropertiesFormat{ - // AdditionalNics: []*armnetwork.VirtualApplianceAdditionalNicProperties{ - // { - // Name: to.Ptr("exrsdwan"), - // HasPublicIP: to.Ptr(true), - // }}, - // AddressPrefix: to.Ptr("192.168.1.0/16"), - // BootStrapConfigurationBlobs: []*string{ - // to.Ptr("https://csrncvhdstorage1.blob.core.windows.net/csrncvhdstoragecont/csrbootstrapconfig")}, - // CloudInitConfigurationBlobs: []*string{ - // to.Ptr("https://csrncvhdstorage1.blob.core.windows.net/csrncvhdstoragecont/csrcloudinitconfig")}, - // InboundSecurityRules: []*armnetwork.SubResource{ - // { - // ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/networkVirtualAppliances/nva/InboundSecurityRules/rule1"), - // }}, - // InternetIngressPublicIPs: []*armnetwork.InternetIngressPublicIPsProperties{ - // { - // ID: to.Ptr("/subscriptions/{{subscriptionId}}/resourceGroups/{{rg}}/providers/Microsoft.Network/publicIPAddresses/slbip"), - // }}, - // NetworkProfile: &armnetwork.VirtualAppliancePropertiesFormatNetworkProfile{ - // NetworkInterfaceConfigurations: []*armnetwork.VirtualApplianceNetworkInterfaceConfiguration{ - // { - // NicType: to.Ptr(armnetwork.NicTypeInRequestPublicNic), - // Properties: &armnetwork.VirtualApplianceNetworkInterfaceConfigurationProperties{ - // IPConfigurations: []*armnetwork.VirtualApplianceIPConfiguration{ - // { - // Name: to.Ptr("publicnicipconfig"), - // Properties: &armnetwork.VirtualApplianceIPConfigurationProperties{ - // Primary: to.Ptr(true), - // }, - // }, - // { - // Name: to.Ptr("publicnicipconfig-2"), - // Properties: &armnetwork.VirtualApplianceIPConfigurationProperties{ - // Primary: to.Ptr(false), - // }, - // }}, - // }, - // }, - // { - // NicType: to.Ptr(armnetwork.NicTypeInRequestPrivateNic), - // Properties: &armnetwork.VirtualApplianceNetworkInterfaceConfigurationProperties{ - // IPConfigurations: []*armnetwork.VirtualApplianceIPConfiguration{ - // { - // Name: to.Ptr("privatenicipconfig"), - // Properties: &armnetwork.VirtualApplianceIPConfigurationProperties{ - // Primary: to.Ptr(true), - // }, - // }, - // { - // Name: to.Ptr("privatenicipconfig-2"), - // Properties: &armnetwork.VirtualApplianceIPConfigurationProperties{ - // Primary: to.Ptr(false), - // }, - // }}, - // }, - // }}, - // }, - // NvaSKU: &armnetwork.VirtualApplianceSKUProperties{ - // BundledScaleUnit: to.Ptr("1"), - // MarketPlaceVersion: to.Ptr("12.1"), - // Vendor: to.Ptr("Cisco SDWAN"), - // }, - // ProvisioningState: to.Ptr(armnetwork.ProvisioningStateSucceeded), - // VirtualApplianceAsn: to.Ptr[int64](10000), - // VirtualApplianceNics: []*armnetwork.VirtualApplianceNicProperties{ - // { - // Name: to.Ptr("publicnicipconfig"), - // InstanceName: to.Ptr("nva_0"), - // NicType: to.Ptr(armnetwork.NicTypeInResponsePublicNic), - // PrivateIPAddress: to.Ptr("192.168.12.1"), - // PublicIPAddress: to.Ptr("40.30.2.2"), - // }, - // { - // Name: to.Ptr("publicnicipconfig-2"), - // InstanceName: to.Ptr("nva_0"), - // NicType: to.Ptr(armnetwork.NicTypeInResponsePublicNic), - // PrivateIPAddress: to.Ptr("192.168.12.2"), - // PublicIPAddress: to.Ptr("40.30.2.3"), - // }, - // { - // Name: to.Ptr("privatenicipconfig"), - // InstanceName: to.Ptr("nva_0"), - // NicType: to.Ptr(armnetwork.NicTypeInResponsePrivateNic), - // PrivateIPAddress: to.Ptr("192.168.12.3"), - // PublicIPAddress: to.Ptr(""), - // }, - // { - // Name: to.Ptr("privatenicipconfig-2"), - // InstanceName: to.Ptr("nva_0"), - // NicType: to.Ptr(armnetwork.NicTypeInResponsePrivateNic), - // PrivateIPAddress: to.Ptr("192.168.12.4"), - // PublicIPAddress: to.Ptr(""), - // }, - // { - // Name: to.Ptr("exrsdwan"), - // InstanceName: to.Ptr("nva_0"), - // NicType: to.Ptr(armnetwork.NicTypeInResponseAdditionalNic), - // PrivateIPAddress: to.Ptr("10.1.113.4"), - // PublicIPAddress: to.Ptr("4.231.25.19"), - // }}, - // VirtualApplianceSites: []*armnetwork.SubResource{ - // { - // ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/networtkVirtualAppliances/nva/virtualApplianceSites/site1"), - // }}, - // VirtualHub: &armnetwork.SubResource{ - // ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/virtualHubs/hub1"), - // }, - // }, - // }}, - // } - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/4883fa5dbf6f2c9093fac8ce334547e9dfac68fa/specification/network/resource-manager/Microsoft.Network/stable/2024-03-01/examples/NetworkVirtualApplianceListBySubscription.json -func ExampleVirtualAppliancesClient_NewListPager() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armnetwork.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := clientFactory.NewVirtualAppliancesClient().NewListPager(nil) - for pager.More() { - page, err := pager.NextPage(ctx) - if err != nil { - log.Fatalf("failed to advance page: %v", err) - } - for _, v := range page.Value { - // You could use page here. We use blank identifier for just demo purposes. - _ = v - } - // If the HTTP response code is 200 as defined in example definition, your page structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // page.VirtualApplianceListResult = armnetwork.VirtualApplianceListResult{ - // Value: []*armnetwork.VirtualAppliance{ - // { - // Name: to.Ptr("nva"), - // Type: to.Ptr("Microsoft.Network/networkVirtualAppliances"), - // ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/networkVirtualAppliances/nva"), - // Location: to.Ptr("West US"), - // Tags: map[string]*string{ - // "key1": to.Ptr("value1"), - // }, - // Etag: to.Ptr("w/\\00000000-0000-0000-0000-000000000000\\"), - // Identity: &armnetwork.ManagedServiceIdentity{ - // Type: to.Ptr(armnetwork.ResourceIdentityTypeUserAssigned), - // UserAssignedIdentities: map[string]*armnetwork.Components1Jq1T4ISchemasManagedserviceidentityPropertiesUserassignedidentitiesAdditionalproperties{ - // "/subscriptions/subid/resourcegroups/rg1/providers/Microsoft.ManagedIdentity/userAssignedIdentities/identity1": &armnetwork.Components1Jq1T4ISchemasManagedserviceidentityPropertiesUserassignedidentitiesAdditionalproperties{ - // }, - // }, - // }, - // Properties: &armnetwork.VirtualAppliancePropertiesFormat{ - // AdditionalNics: []*armnetwork.VirtualApplianceAdditionalNicProperties{ - // { - // Name: to.Ptr("exrsdwan"), - // HasPublicIP: to.Ptr(true), - // }}, - // AddressPrefix: to.Ptr("192.168.1.0/16"), - // BootStrapConfigurationBlobs: []*string{ - // to.Ptr("https://csrncvhdstorage1.blob.core.windows.net/csrncvhdstoragecont/csrbootstrapconfig")}, - // CloudInitConfigurationBlobs: []*string{ - // to.Ptr("https://csrncvhdstorage1.blob.core.windows.net/csrncvhdstoragecont/csrcloudinitconfig")}, - // InboundSecurityRules: []*armnetwork.SubResource{ - // { - // ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/networkVirtualAppliances/nva/InboundSecurityRules/rule1"), - // }}, - // InternetIngressPublicIPs: []*armnetwork.InternetIngressPublicIPsProperties{ - // { - // ID: to.Ptr("/subscriptions/{{subscriptionId}}/resourceGroups/{{rg}}/providers/Microsoft.Network/publicIPAddresses/slbip"), - // }}, - // NetworkProfile: &armnetwork.VirtualAppliancePropertiesFormatNetworkProfile{ - // NetworkInterfaceConfigurations: []*armnetwork.VirtualApplianceNetworkInterfaceConfiguration{ - // { - // NicType: to.Ptr(armnetwork.NicTypeInRequestPublicNic), - // Properties: &armnetwork.VirtualApplianceNetworkInterfaceConfigurationProperties{ - // IPConfigurations: []*armnetwork.VirtualApplianceIPConfiguration{ - // { - // Name: to.Ptr("publicnicipconfig"), - // Properties: &armnetwork.VirtualApplianceIPConfigurationProperties{ - // Primary: to.Ptr(true), - // }, - // }, - // { - // Name: to.Ptr("publicnicipconfig-2"), - // Properties: &armnetwork.VirtualApplianceIPConfigurationProperties{ - // Primary: to.Ptr(false), - // }, - // }}, - // }, - // }, - // { - // NicType: to.Ptr(armnetwork.NicTypeInRequestPrivateNic), - // Properties: &armnetwork.VirtualApplianceNetworkInterfaceConfigurationProperties{ - // IPConfigurations: []*armnetwork.VirtualApplianceIPConfiguration{ - // { - // Name: to.Ptr("privatenicipconfig"), - // Properties: &armnetwork.VirtualApplianceIPConfigurationProperties{ - // Primary: to.Ptr(true), - // }, - // }, - // { - // Name: to.Ptr("privatenicipconfig-2"), - // Properties: &armnetwork.VirtualApplianceIPConfigurationProperties{ - // Primary: to.Ptr(false), - // }, - // }}, - // }, - // }}, - // }, - // NvaSKU: &armnetwork.VirtualApplianceSKUProperties{ - // BundledScaleUnit: to.Ptr("1"), - // MarketPlaceVersion: to.Ptr("12.1"), - // Vendor: to.Ptr("Cisco SDWAN"), - // }, - // ProvisioningState: to.Ptr(armnetwork.ProvisioningStateSucceeded), - // VirtualApplianceAsn: to.Ptr[int64](10000), - // VirtualApplianceNics: []*armnetwork.VirtualApplianceNicProperties{ - // { - // Name: to.Ptr("publicnicipconfig"), - // InstanceName: to.Ptr("nva_0"), - // NicType: to.Ptr(armnetwork.NicTypeInResponsePublicNic), - // PrivateIPAddress: to.Ptr("192.168.12.1"), - // PublicIPAddress: to.Ptr("40.30.2.2"), - // }, - // { - // Name: to.Ptr("publicnicipconfig-2"), - // InstanceName: to.Ptr("nva_0"), - // NicType: to.Ptr(armnetwork.NicTypeInResponsePublicNic), - // PrivateIPAddress: to.Ptr("192.168.12.2"), - // PublicIPAddress: to.Ptr("40.30.2.3"), - // }, - // { - // Name: to.Ptr("privatenicipconfig"), - // InstanceName: to.Ptr("nva_0"), - // NicType: to.Ptr(armnetwork.NicTypeInResponsePrivateNic), - // PrivateIPAddress: to.Ptr("192.168.12.3"), - // PublicIPAddress: to.Ptr(""), - // }, - // { - // Name: to.Ptr("privatenicipconfig-2"), - // InstanceName: to.Ptr("nva_0"), - // NicType: to.Ptr(armnetwork.NicTypeInResponsePrivateNic), - // PrivateIPAddress: to.Ptr("192.168.12.4"), - // PublicIPAddress: to.Ptr(""), - // }, - // { - // Name: to.Ptr("exrsdwan"), - // InstanceName: to.Ptr("nva_0"), - // NicType: to.Ptr(armnetwork.NicTypeInResponseAdditionalNic), - // PrivateIPAddress: to.Ptr("10.1.113.4"), - // PublicIPAddress: to.Ptr("4.231.25.19"), - // }}, - // VirtualApplianceSites: []*armnetwork.SubResource{ - // { - // ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/networtkVirtualAppliances/nva/virtualApplianceSites/site1"), - // }}, - // VirtualHub: &armnetwork.SubResource{ - // ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/virtualHubs/hub1"), - // }, - // }, - // }}, - // } - } -} diff --git a/sdk/resourcemanager/network/armnetwork/virtualappliancesites_client_example_test.go b/sdk/resourcemanager/network/armnetwork/virtualappliancesites_client_example_test.go deleted file mode 100644 index 0b06b32c9ba1..000000000000 --- a/sdk/resourcemanager/network/armnetwork/virtualappliancesites_client_example_test.go +++ /dev/null @@ -1,171 +0,0 @@ -//go:build go1.18 -// +build go1.18 - -// 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. -// DO NOT EDIT. - -package armnetwork_test - -import ( - "context" - "log" - - "github.com/Azure/azure-sdk-for-go/sdk/azcore/to" - "github.com/Azure/azure-sdk-for-go/sdk/azidentity" - "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/network/armnetwork/v6" -) - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/4883fa5dbf6f2c9093fac8ce334547e9dfac68fa/specification/network/resource-manager/Microsoft.Network/stable/2024-03-01/examples/NetworkVirtualApplianceSiteDelete.json -func ExampleVirtualApplianceSitesClient_BeginDelete() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armnetwork.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewVirtualApplianceSitesClient().BeginDelete(ctx, "rg1", "nva", "site1", nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - _, err = poller.PollUntilDone(ctx, nil) - if err != nil { - log.Fatalf("failed to pull the result: %v", err) - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/4883fa5dbf6f2c9093fac8ce334547e9dfac68fa/specification/network/resource-manager/Microsoft.Network/stable/2024-03-01/examples/NetworkVirtualApplianceSiteGet.json -func ExampleVirtualApplianceSitesClient_Get() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armnetwork.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewVirtualApplianceSitesClient().Get(ctx, "rg1", "nva", "site1", nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.VirtualApplianceSite = armnetwork.VirtualApplianceSite{ - // ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/networkVirtualAppliances/nva/virtualApplianceSites/site1"), - // Name: to.Ptr("site1"), - // Etag: to.Ptr("W/\"72090554-7e3b-43f2-80ad-99a9020dcb11\""), - // Properties: &armnetwork.VirtualApplianceSiteProperties{ - // AddressPrefix: to.Ptr("192.168.1.0/24"), - // O365Policy: &armnetwork.Office365PolicyProperties{ - // BreakOutCategories: &armnetwork.BreakOutCategoryPolicies{ - // Default: to.Ptr(true), - // Allow: to.Ptr(true), - // Optimize: to.Ptr(true), - // }, - // }, - // ProvisioningState: to.Ptr(armnetwork.ProvisioningStateSucceeded), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/4883fa5dbf6f2c9093fac8ce334547e9dfac68fa/specification/network/resource-manager/Microsoft.Network/stable/2024-03-01/examples/NetworkVirtualApplianceSitePut.json -func ExampleVirtualApplianceSitesClient_BeginCreateOrUpdate() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armnetwork.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewVirtualApplianceSitesClient().BeginCreateOrUpdate(ctx, "rg1", "nva", "site1", armnetwork.VirtualApplianceSite{ - Properties: &armnetwork.VirtualApplianceSiteProperties{ - AddressPrefix: to.Ptr("192.168.1.0/24"), - O365Policy: &armnetwork.Office365PolicyProperties{ - BreakOutCategories: &armnetwork.BreakOutCategoryPolicies{ - Default: to.Ptr(true), - Allow: to.Ptr(true), - Optimize: to.Ptr(true), - }, - }, - }, - }, nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - res, err := poller.PollUntilDone(ctx, nil) - if err != nil { - log.Fatalf("failed to pull the result: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.VirtualApplianceSite = armnetwork.VirtualApplianceSite{ - // ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/networkVirtualAppliances/nva/virtualApplianceSites/site1"), - // Name: to.Ptr("site1"), - // Etag: to.Ptr("W/\"72090554-7e3b-43f2-80ad-99a9020dcb11\""), - // Properties: &armnetwork.VirtualApplianceSiteProperties{ - // AddressPrefix: to.Ptr("192.168.1.0/24"), - // O365Policy: &armnetwork.Office365PolicyProperties{ - // BreakOutCategories: &armnetwork.BreakOutCategoryPolicies{ - // Default: to.Ptr(true), - // Allow: to.Ptr(true), - // Optimize: to.Ptr(true), - // }, - // }, - // ProvisioningState: to.Ptr(armnetwork.ProvisioningStateSucceeded), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/4883fa5dbf6f2c9093fac8ce334547e9dfac68fa/specification/network/resource-manager/Microsoft.Network/stable/2024-03-01/examples/NetworkVirtualApplianceSiteList.json -func ExampleVirtualApplianceSitesClient_NewListPager() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armnetwork.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := clientFactory.NewVirtualApplianceSitesClient().NewListPager("rg1", "nva", nil) - for pager.More() { - page, err := pager.NextPage(ctx) - if err != nil { - log.Fatalf("failed to advance page: %v", err) - } - for _, v := range page.Value { - // You could use page here. We use blank identifier for just demo purposes. - _ = v - } - // If the HTTP response code is 200 as defined in example definition, your page structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // page.VirtualApplianceSiteListResult = armnetwork.VirtualApplianceSiteListResult{ - // Value: []*armnetwork.VirtualApplianceSite{ - // { - // ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/networkVirtualAppliances/nva/virtualApplianceSites/site1"), - // Name: to.Ptr("site1"), - // Etag: to.Ptr("W/\"72090554-7e3b-43f2-80ad-99a9020dcb11\""), - // Properties: &armnetwork.VirtualApplianceSiteProperties{ - // AddressPrefix: to.Ptr("192.168.1.0/24"), - // O365Policy: &armnetwork.Office365PolicyProperties{ - // BreakOutCategories: &armnetwork.BreakOutCategoryPolicies{ - // Default: to.Ptr(true), - // Allow: to.Ptr(true), - // Optimize: to.Ptr(true), - // }, - // }, - // ProvisioningState: to.Ptr(armnetwork.ProvisioningStateSucceeded), - // }, - // }}, - // } - } -} diff --git a/sdk/resourcemanager/network/armnetwork/virtualapplianceskus_client_example_test.go b/sdk/resourcemanager/network/armnetwork/virtualapplianceskus_client_example_test.go deleted file mode 100644 index 6679447dfaf5..000000000000 --- a/sdk/resourcemanager/network/armnetwork/virtualapplianceskus_client_example_test.go +++ /dev/null @@ -1,106 +0,0 @@ -//go:build go1.18 -// +build go1.18 - -// 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. -// DO NOT EDIT. - -package armnetwork_test - -import ( - "context" - "log" - - "github.com/Azure/azure-sdk-for-go/sdk/azidentity" - "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/network/armnetwork/v6" -) - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/4883fa5dbf6f2c9093fac8ce334547e9dfac68fa/specification/network/resource-manager/Microsoft.Network/stable/2024-03-01/examples/NetworkVirtualApplianceSkuList.json -func ExampleVirtualApplianceSKUsClient_NewListPager() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armnetwork.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := clientFactory.NewVirtualApplianceSKUsClient().NewListPager(nil) - for pager.More() { - page, err := pager.NextPage(ctx) - if err != nil { - log.Fatalf("failed to advance page: %v", err) - } - for _, v := range page.Value { - // You could use page here. We use blank identifier for just demo purposes. - _ = v - } - // If the HTTP response code is 200 as defined in example definition, your page structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // page.VirtualApplianceSKUListResult = armnetwork.VirtualApplianceSKUListResult{ - // Value: []*armnetwork.VirtualApplianceSKU{ - // { - // Name: to.Ptr("ciscoSdwan"), - // Type: to.Ptr("Microsoft.Network/networkVirtualApplianceSkus"), - // ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/networkVirtualApplianceSkus/ciscoSdwan"), - // Etag: to.Ptr("w/\\00000000-0000-0000-0000-000000000000\\"), - // Properties: &armnetwork.VirtualApplianceSKUPropertiesFormat{ - // AvailableScaleUnits: []*armnetwork.VirtualApplianceSKUInstances{ - // { - // InstanceCount: to.Ptr[int32](2), - // ScaleUnit: to.Ptr("1"), - // }, - // { - // InstanceCount: to.Ptr[int32](2), - // ScaleUnit: to.Ptr("2"), - // }}, - // AvailableVersions: []*string{ - // to.Ptr("11.12")}, - // Vendor: to.Ptr("Cisco"), - // }, - // }}, - // } - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/4883fa5dbf6f2c9093fac8ce334547e9dfac68fa/specification/network/resource-manager/Microsoft.Network/stable/2024-03-01/examples/NetworkVirtualApplianceSkuGet.json -func ExampleVirtualApplianceSKUsClient_Get() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armnetwork.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewVirtualApplianceSKUsClient().Get(ctx, "ciscoSdwan", nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.VirtualApplianceSKU = armnetwork.VirtualApplianceSKU{ - // Name: to.Ptr("ciscoSdwan"), - // Type: to.Ptr("Microsoft.Network/networkVirtualApplianceSkus"), - // ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/networkVirtualApplianceSkus/ciscoSdwan"), - // Etag: to.Ptr("w/\\00000000-0000-0000-0000-000000000000\\"), - // Properties: &armnetwork.VirtualApplianceSKUPropertiesFormat{ - // AvailableScaleUnits: []*armnetwork.VirtualApplianceSKUInstances{ - // { - // InstanceCount: to.Ptr[int32](2), - // ScaleUnit: to.Ptr("1"), - // }, - // { - // InstanceCount: to.Ptr[int32](2), - // ScaleUnit: to.Ptr("2"), - // }}, - // AvailableVersions: []*string{ - // to.Ptr("11.12")}, - // Vendor: to.Ptr("Cisco"), - // }, - // } -} diff --git a/sdk/resourcemanager/network/armnetwork/virtualhubbgpconnection_client_example_test.go b/sdk/resourcemanager/network/armnetwork/virtualhubbgpconnection_client_example_test.go deleted file mode 100644 index c136d9dbaeae..000000000000 --- a/sdk/resourcemanager/network/armnetwork/virtualhubbgpconnection_client_example_test.go +++ /dev/null @@ -1,120 +0,0 @@ -//go:build go1.18 -// +build go1.18 - -// 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. -// DO NOT EDIT. - -package armnetwork_test - -import ( - "context" - "log" - - "github.com/Azure/azure-sdk-for-go/sdk/azcore/to" - "github.com/Azure/azure-sdk-for-go/sdk/azidentity" - "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/network/armnetwork/v6" -) - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/4883fa5dbf6f2c9093fac8ce334547e9dfac68fa/specification/network/resource-manager/Microsoft.Network/stable/2024-03-01/examples/VirtualHubBgpConnectionGet.json -func ExampleVirtualHubBgpConnectionClient_Get() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armnetwork.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewVirtualHubBgpConnectionClient().Get(ctx, "rg1", "hub1", "conn1", nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.BgpConnection = armnetwork.BgpConnection{ - // ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/virtualHubs/hub1/bgpConnections/conn1"), - // Name: to.Ptr("conn1"), - // Etag: to.Ptr("W/\"72090554-7e3b-43f2-80ad-99a9020dcb11\""), - // Properties: &armnetwork.BgpConnectionProperties{ - // ConnectionState: to.Ptr(armnetwork.HubBgpConnectionStatusConnected), - // HubVirtualNetworkConnection: &armnetwork.SubResource{ - // ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/virtualHubs/hub1/hubVirtualNetworkConnections/hubVnetConn1"), - // }, - // PeerAsn: to.Ptr[int64](20000), - // PeerIP: to.Ptr("192.168.1.5"), - // ProvisioningState: to.Ptr(armnetwork.ProvisioningStateSucceeded), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/4883fa5dbf6f2c9093fac8ce334547e9dfac68fa/specification/network/resource-manager/Microsoft.Network/stable/2024-03-01/examples/VirtualHubBgpConnectionPut.json -func ExampleVirtualHubBgpConnectionClient_BeginCreateOrUpdate() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armnetwork.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewVirtualHubBgpConnectionClient().BeginCreateOrUpdate(ctx, "rg1", "hub1", "conn1", armnetwork.BgpConnection{ - Properties: &armnetwork.BgpConnectionProperties{ - HubVirtualNetworkConnection: &armnetwork.SubResource{ - ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/virtualHubs/hub1/hubVirtualNetworkConnections/hubVnetConn1"), - }, - PeerAsn: to.Ptr[int64](20000), - PeerIP: to.Ptr("192.168.1.5"), - }, - }, nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - res, err := poller.PollUntilDone(ctx, nil) - if err != nil { - log.Fatalf("failed to pull the result: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.BgpConnection = armnetwork.BgpConnection{ - // ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/virtualHubs/hub1/bgpConnections/conn1"), - // Name: to.Ptr("conn1"), - // Etag: to.Ptr("W/\"72090554-7e3b-43f2-80ad-99a9020dcb11\""), - // Properties: &armnetwork.BgpConnectionProperties{ - // ConnectionState: to.Ptr(armnetwork.HubBgpConnectionStatusConnected), - // HubVirtualNetworkConnection: &armnetwork.SubResource{ - // ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/virtualHubs/hub1/hubVirtualNetworkConnections/hubVnetConn1"), - // }, - // PeerAsn: to.Ptr[int64](20000), - // PeerIP: to.Ptr("192.168.1.5"), - // ProvisioningState: to.Ptr(armnetwork.ProvisioningStateSucceeded), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/4883fa5dbf6f2c9093fac8ce334547e9dfac68fa/specification/network/resource-manager/Microsoft.Network/stable/2024-03-01/examples/VirtualHubBgpConnectionDelete.json -func ExampleVirtualHubBgpConnectionClient_BeginDelete() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armnetwork.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewVirtualHubBgpConnectionClient().BeginDelete(ctx, "rg1", "hub1", "conn1", nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - _, err = poller.PollUntilDone(ctx, nil) - if err != nil { - log.Fatalf("failed to pull the result: %v", err) - } -} diff --git a/sdk/resourcemanager/network/armnetwork/virtualhubbgpconnections_client_example_test.go b/sdk/resourcemanager/network/armnetwork/virtualhubbgpconnections_client_example_test.go deleted file mode 100644 index 5d2abda06a4d..000000000000 --- a/sdk/resourcemanager/network/armnetwork/virtualhubbgpconnections_client_example_test.go +++ /dev/null @@ -1,206 +0,0 @@ -//go:build go1.18 -// +build go1.18 - -// 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. -// DO NOT EDIT. - -package armnetwork_test - -import ( - "context" - "log" - - "github.com/Azure/azure-sdk-for-go/sdk/azidentity" - "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/network/armnetwork/v6" -) - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/4883fa5dbf6f2c9093fac8ce334547e9dfac68fa/specification/network/resource-manager/Microsoft.Network/stable/2024-03-01/examples/VirtualHubBgpConnectionList.json -func ExampleVirtualHubBgpConnectionsClient_NewListPager() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armnetwork.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := clientFactory.NewVirtualHubBgpConnectionsClient().NewListPager("rg1", "hub1", nil) - for pager.More() { - page, err := pager.NextPage(ctx) - if err != nil { - log.Fatalf("failed to advance page: %v", err) - } - for _, v := range page.Value { - // You could use page here. We use blank identifier for just demo purposes. - _ = v - } - // If the HTTP response code is 200 as defined in example definition, your page structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // page.ListVirtualHubBgpConnectionResults = armnetwork.ListVirtualHubBgpConnectionResults{ - // Value: []*armnetwork.BgpConnection{ - // { - // ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/virtualHubs/hub1/bgpConnections/conn1"), - // Name: to.Ptr("conn1"), - // Etag: to.Ptr("W/\"72090554-7e3b-43f2-80ad-99a9020dcb11\""), - // Properties: &armnetwork.BgpConnectionProperties{ - // ConnectionState: to.Ptr(armnetwork.HubBgpConnectionStatusConnected), - // HubVirtualNetworkConnection: &armnetwork.SubResource{ - // ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/virtualHubs/hub1/hubVirtualNetworkConnections/hubVnetConn1"), - // }, - // PeerAsn: to.Ptr[int64](20000), - // PeerIP: to.Ptr("192.168.1.5"), - // ProvisioningState: to.Ptr(armnetwork.ProvisioningStateSucceeded), - // }, - // }}, - // } - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/4883fa5dbf6f2c9093fac8ce334547e9dfac68fa/specification/network/resource-manager/Microsoft.Network/stable/2024-03-01/examples/VirtualRouterPeerListLearnedRoute.json -func ExampleVirtualHubBgpConnectionsClient_BeginListLearnedRoutes() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armnetwork.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewVirtualHubBgpConnectionsClient().BeginListLearnedRoutes(ctx, "rg1", "virtualRouter1", "peer1", nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - res, err := poller.PollUntilDone(ctx, nil) - if err != nil { - log.Fatalf("failed to pull the result: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.Value = map[string][]*armnetwork.PeerRoute{ - // "RouteServiceRole_IN_0": []*armnetwork.PeerRoute{ - // { - // AsPath: to.Ptr("65002-65001"), - // LocalAddress: to.Ptr("10.85.3.4"), - // Network: to.Ptr("10.101.0.0/16"), - // NextHop: to.Ptr("10.85.4.4"), - // Origin: to.Ptr("EBgp"), - // SourcePeer: to.Ptr("10.85.4.4"), - // Weight: to.Ptr[int32](32768), - // }, - // { - // AsPath: to.Ptr("65002-65001"), - // LocalAddress: to.Ptr("10.85.3.5"), - // Network: to.Ptr("10.101.0.0/16"), - // NextHop: to.Ptr("10.85.4.4"), - // Origin: to.Ptr("EBgp"), - // SourcePeer: to.Ptr("10.85.4.4"), - // Weight: to.Ptr[int32](32768), - // }}, - // "RouteServiceRole_IN_1": []*armnetwork.PeerRoute{ - // { - // AsPath: to.Ptr("65002-65001"), - // LocalAddress: to.Ptr("10.85.3.4"), - // Network: to.Ptr("10.101.0.0/16"), - // NextHop: to.Ptr("10.85.4.4"), - // Origin: to.Ptr("EBgp"), - // SourcePeer: to.Ptr("10.85.4.4"), - // Weight: to.Ptr[int32](32768), - // }, - // { - // AsPath: to.Ptr("65002-65001"), - // LocalAddress: to.Ptr("10.85.3.5"), - // Network: to.Ptr("10.101.0.0/16"), - // NextHop: to.Ptr("10.85.4.4"), - // Origin: to.Ptr("EBgp"), - // SourcePeer: to.Ptr("10.85.4.4"), - // Weight: to.Ptr[int32](32768), - // }}, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/4883fa5dbf6f2c9093fac8ce334547e9dfac68fa/specification/network/resource-manager/Microsoft.Network/stable/2024-03-01/examples/VirtualRouterPeerListAdvertisedRoute.json -func ExampleVirtualHubBgpConnectionsClient_BeginListAdvertisedRoutes() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armnetwork.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewVirtualHubBgpConnectionsClient().BeginListAdvertisedRoutes(ctx, "rg1", "virtualRouter1", "peer1", nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - res, err := poller.PollUntilDone(ctx, nil) - if err != nil { - log.Fatalf("failed to pull the result: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.Value = map[string][]*armnetwork.PeerRoute{ - // "RouteServiceRole_IN_0": []*armnetwork.PeerRoute{ - // { - // AsPath: to.Ptr("65515"), - // LocalAddress: to.Ptr("10.85.3.4"), - // Network: to.Ptr("10.45.0.0/16"), - // NextHop: to.Ptr("10.85.3.4"), - // Origin: to.Ptr("Igp"), - // SourcePeer: to.Ptr("10.85.3.4"), - // Weight: to.Ptr[int32](0), - // }, - // { - // AsPath: to.Ptr("65515"), - // LocalAddress: to.Ptr("10.85.3.4"), - // Network: to.Ptr("10.85.0.0/16"), - // NextHop: to.Ptr("10.85.3.4"), - // Origin: to.Ptr("Igp"), - // SourcePeer: to.Ptr("10.85.3.4"), - // Weight: to.Ptr[int32](0), - // }, - // { - // AsPath: to.Ptr("65515"), - // LocalAddress: to.Ptr("10.85.3.4"), - // Network: to.Ptr("10.100.0.0/16"), - // NextHop: to.Ptr("10.85.3.4"), - // Origin: to.Ptr("Igp"), - // SourcePeer: to.Ptr("10.85.3.4"), - // Weight: to.Ptr[int32](0), - // }}, - // "RouteServiceRole_IN_1": []*armnetwork.PeerRoute{ - // { - // AsPath: to.Ptr("65515"), - // LocalAddress: to.Ptr("10.85.3.4"), - // Network: to.Ptr("10.45.0.0/16"), - // NextHop: to.Ptr("10.85.3.4"), - // Origin: to.Ptr("Igp"), - // SourcePeer: to.Ptr("10.85.3.4"), - // Weight: to.Ptr[int32](0), - // }, - // { - // AsPath: to.Ptr("65515"), - // LocalAddress: to.Ptr("10.85.3.4"), - // Network: to.Ptr("10.85.0.0/16"), - // NextHop: to.Ptr("10.85.3.4"), - // Origin: to.Ptr("Igp"), - // SourcePeer: to.Ptr("10.85.3.4"), - // Weight: to.Ptr[int32](0), - // }, - // { - // AsPath: to.Ptr("65515"), - // LocalAddress: to.Ptr("10.85.3.4"), - // Network: to.Ptr("10.100.0.0/16"), - // NextHop: to.Ptr("10.85.3.4"), - // Origin: to.Ptr("Igp"), - // SourcePeer: to.Ptr("10.85.3.4"), - // Weight: to.Ptr[int32](0), - // }}, - // } -} diff --git a/sdk/resourcemanager/network/armnetwork/virtualhubipconfiguration_client_example_test.go b/sdk/resourcemanager/network/armnetwork/virtualhubipconfiguration_client_example_test.go deleted file mode 100644 index 705ab00daa25..000000000000 --- a/sdk/resourcemanager/network/armnetwork/virtualhubipconfiguration_client_example_test.go +++ /dev/null @@ -1,154 +0,0 @@ -//go:build go1.18 -// +build go1.18 - -// 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. -// DO NOT EDIT. - -package armnetwork_test - -import ( - "context" - "log" - - "github.com/Azure/azure-sdk-for-go/sdk/azcore/to" - "github.com/Azure/azure-sdk-for-go/sdk/azidentity" - "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/network/armnetwork/v6" -) - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/4883fa5dbf6f2c9093fac8ce334547e9dfac68fa/specification/network/resource-manager/Microsoft.Network/stable/2024-03-01/examples/VirtualHubIpConfigurationGet.json -func ExampleVirtualHubIPConfigurationClient_Get() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armnetwork.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewVirtualHubIPConfigurationClient().Get(ctx, "rg1", "hub1", "ipconfig1", nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.HubIPConfiguration = armnetwork.HubIPConfiguration{ - // ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/virtualHubs/hub1/ipConfigurations/ipconfig1"), - // Name: to.Ptr("ipconfig1"), - // Type: to.Ptr("Microsoft.Network/virtualHubs/ipConfigurations"), - // Etag: to.Ptr("w/\\00000000-0000-0000-0000-000000000000\\"), - // Properties: &armnetwork.HubIPConfigurationPropertiesFormat{ - // ProvisioningState: to.Ptr(armnetwork.ProvisioningStateSucceeded), - // Subnet: &armnetwork.Subnet{ - // ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/virtualNetworks/vnet1/subnets/subnet1"), - // }, - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/4883fa5dbf6f2c9093fac8ce334547e9dfac68fa/specification/network/resource-manager/Microsoft.Network/stable/2024-03-01/examples/VirtualHubIpConfigurationPut.json -func ExampleVirtualHubIPConfigurationClient_BeginCreateOrUpdate() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armnetwork.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewVirtualHubIPConfigurationClient().BeginCreateOrUpdate(ctx, "rg1", "hub1", "ipconfig1", armnetwork.HubIPConfiguration{ - Properties: &armnetwork.HubIPConfigurationPropertiesFormat{ - Subnet: &armnetwork.Subnet{ - ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/virtualNetworks/vnet1/subnets/subnet1"), - }, - }, - }, nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - res, err := poller.PollUntilDone(ctx, nil) - if err != nil { - log.Fatalf("failed to pull the result: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.HubIPConfiguration = armnetwork.HubIPConfiguration{ - // ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/virtualHubs/hub1/ipConfigurations/ipconfig1"), - // Name: to.Ptr("ipconfig1"), - // Type: to.Ptr("Microsoft.Network/virtualHubs/ipConfigurations"), - // Etag: to.Ptr("w/\\00000000-0000-0000-0000-000000000000\\"), - // Properties: &armnetwork.HubIPConfigurationPropertiesFormat{ - // ProvisioningState: to.Ptr(armnetwork.ProvisioningStateSucceeded), - // Subnet: &armnetwork.Subnet{ - // ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/virtualNetworks/vnet1/subnets/subnet1"), - // }, - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/4883fa5dbf6f2c9093fac8ce334547e9dfac68fa/specification/network/resource-manager/Microsoft.Network/stable/2024-03-01/examples/VirtualHubIpConfigurationDelete.json -func ExampleVirtualHubIPConfigurationClient_BeginDelete() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armnetwork.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewVirtualHubIPConfigurationClient().BeginDelete(ctx, "rg1", "hub1", "ipconfig1", nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - _, err = poller.PollUntilDone(ctx, nil) - if err != nil { - log.Fatalf("failed to pull the result: %v", err) - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/4883fa5dbf6f2c9093fac8ce334547e9dfac68fa/specification/network/resource-manager/Microsoft.Network/stable/2024-03-01/examples/VirtualHubIpConfigurationList.json -func ExampleVirtualHubIPConfigurationClient_NewListPager() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armnetwork.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := clientFactory.NewVirtualHubIPConfigurationClient().NewListPager("rg1", "hub1", nil) - for pager.More() { - page, err := pager.NextPage(ctx) - if err != nil { - log.Fatalf("failed to advance page: %v", err) - } - for _, v := range page.Value { - // You could use page here. We use blank identifier for just demo purposes. - _ = v - } - // If the HTTP response code is 200 as defined in example definition, your page structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // page.ListVirtualHubIPConfigurationResults = armnetwork.ListVirtualHubIPConfigurationResults{ - // Value: []*armnetwork.HubIPConfiguration{ - // { - // ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/virtualHubs/hub1/ipConfigurations/ipconfig1"), - // Name: to.Ptr("ipconfig1"), - // Type: to.Ptr("Microsoft.Network/virtualHubs/ipConfigurations"), - // Etag: to.Ptr("w/\\00000000-0000-0000-0000-000000000000\\"), - // Properties: &armnetwork.HubIPConfigurationPropertiesFormat{ - // ProvisioningState: to.Ptr(armnetwork.ProvisioningStateSucceeded), - // Subnet: &armnetwork.Subnet{ - // ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/virtualNetworks/vnet1/subnets/subnet1"), - // }, - // }, - // }}, - // } - } -} diff --git a/sdk/resourcemanager/network/armnetwork/virtualhubroutetablev2s_client_example_test.go b/sdk/resourcemanager/network/armnetwork/virtualhubroutetablev2s_client_example_test.go deleted file mode 100644 index f71c7a106144..000000000000 --- a/sdk/resourcemanager/network/armnetwork/virtualhubroutetablev2s_client_example_test.go +++ /dev/null @@ -1,190 +0,0 @@ -//go:build go1.18 -// +build go1.18 - -// 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. -// DO NOT EDIT. - -package armnetwork_test - -import ( - "context" - "log" - - "github.com/Azure/azure-sdk-for-go/sdk/azcore/to" - "github.com/Azure/azure-sdk-for-go/sdk/azidentity" - "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/network/armnetwork/v6" -) - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/4883fa5dbf6f2c9093fac8ce334547e9dfac68fa/specification/network/resource-manager/Microsoft.Network/stable/2024-03-01/examples/VirtualHubRouteTableV2Get.json -func ExampleVirtualHubRouteTableV2SClient_Get() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armnetwork.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewVirtualHubRouteTableV2SClient().Get(ctx, "rg1", "virtualHub1", "virtualHubRouteTable1a", nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.VirtualHubRouteTableV2 = armnetwork.VirtualHubRouteTableV2{ - // ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/virtualHubs/virtualHub1/routeTables/virtualHubRouteTable1a"), - // Name: to.Ptr("virtualHubRouteTable1a"), - // Etag: to.Ptr("w/\\00000000-0000-0000-0000-000000000000\\"), - // Properties: &armnetwork.VirtualHubRouteTableV2Properties{ - // AttachedConnections: []*string{ - // to.Ptr("All_Vnets")}, - // ProvisioningState: to.Ptr(armnetwork.ProvisioningStateSucceeded), - // Routes: []*armnetwork.VirtualHubRouteV2{ - // { - // DestinationType: to.Ptr("CIDR"), - // Destinations: []*string{ - // to.Ptr("20.10.0.0/16"), - // to.Ptr("20.20.0.0/16")}, - // NextHopType: to.Ptr("IPAddress"), - // NextHops: []*string{ - // to.Ptr("10.0.0.68")}, - // }, - // { - // DestinationType: to.Ptr("CIDR"), - // Destinations: []*string{ - // to.Ptr("0.0.0.0/0")}, - // NextHopType: to.Ptr("IPAddress"), - // NextHops: []*string{ - // to.Ptr("10.0.0.68")}, - // }}, - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/4883fa5dbf6f2c9093fac8ce334547e9dfac68fa/specification/network/resource-manager/Microsoft.Network/stable/2024-03-01/examples/VirtualHubRouteTableV2Put.json -func ExampleVirtualHubRouteTableV2SClient_BeginCreateOrUpdate() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armnetwork.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewVirtualHubRouteTableV2SClient().BeginCreateOrUpdate(ctx, "rg1", "virtualHub1", "virtualHubRouteTable1a", armnetwork.VirtualHubRouteTableV2{ - Properties: &armnetwork.VirtualHubRouteTableV2Properties{ - AttachedConnections: []*string{ - to.Ptr("All_Vnets")}, - Routes: []*armnetwork.VirtualHubRouteV2{ - { - DestinationType: to.Ptr("CIDR"), - Destinations: []*string{ - to.Ptr("20.10.0.0/16"), - to.Ptr("20.20.0.0/16")}, - NextHopType: to.Ptr("IPAddress"), - NextHops: []*string{ - to.Ptr("10.0.0.68")}, - }, - { - DestinationType: to.Ptr("CIDR"), - Destinations: []*string{ - to.Ptr("0.0.0.0/0")}, - NextHopType: to.Ptr("IPAddress"), - NextHops: []*string{ - to.Ptr("10.0.0.68")}, - }}, - }, - }, nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - res, err := poller.PollUntilDone(ctx, nil) - if err != nil { - log.Fatalf("failed to pull the result: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.VirtualHubRouteTableV2 = armnetwork.VirtualHubRouteTableV2{ - // ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/virtualHubs/virtualHub1/routeTables/virtualHubRouteTable1a"), - // Name: to.Ptr("virtualHubRouteTable1a"), - // Etag: to.Ptr("w/\\00000000-0000-0000-0000-000000000000\\"), - // Properties: &armnetwork.VirtualHubRouteTableV2Properties{ - // AttachedConnections: []*string{ - // to.Ptr("All_Vnets")}, - // ProvisioningState: to.Ptr(armnetwork.ProvisioningStateSucceeded), - // Routes: []*armnetwork.VirtualHubRouteV2{ - // { - // DestinationType: to.Ptr("CIDR"), - // Destinations: []*string{ - // to.Ptr("20.10.0.0/16"), - // to.Ptr("20.20.0.0/16")}, - // NextHopType: to.Ptr("IPAddress"), - // NextHops: []*string{ - // to.Ptr("10.0.0.68")}, - // }, - // { - // DestinationType: to.Ptr("CIDR"), - // Destinations: []*string{ - // to.Ptr("0.0.0.0/0")}, - // NextHopType: to.Ptr("IPAddress"), - // NextHops: []*string{ - // to.Ptr("10.0.0.68")}, - // }}, - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/4883fa5dbf6f2c9093fac8ce334547e9dfac68fa/specification/network/resource-manager/Microsoft.Network/stable/2024-03-01/examples/VirtualHubRouteTableV2Delete.json -func ExampleVirtualHubRouteTableV2SClient_BeginDelete() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armnetwork.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewVirtualHubRouteTableV2SClient().BeginDelete(ctx, "rg1", "virtualHub1", "virtualHubRouteTable1a", nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - _, err = poller.PollUntilDone(ctx, nil) - if err != nil { - log.Fatalf("failed to pull the result: %v", err) - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/4883fa5dbf6f2c9093fac8ce334547e9dfac68fa/specification/network/resource-manager/Microsoft.Network/stable/2024-03-01/examples/VirtualHubRouteTableV2List.json -func ExampleVirtualHubRouteTableV2SClient_NewListPager() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armnetwork.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := clientFactory.NewVirtualHubRouteTableV2SClient().NewListPager("rg1", "virtualHub1", nil) - for pager.More() { - page, err := pager.NextPage(ctx) - if err != nil { - log.Fatalf("failed to advance page: %v", err) - } - for _, v := range page.Value { - // You could use page here. We use blank identifier for just demo purposes. - _ = v - } - // If the HTTP response code is 200 as defined in example definition, your page structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // page.ListVirtualHubRouteTableV2SResult = armnetwork.ListVirtualHubRouteTableV2SResult{ - // } - } -} diff --git a/sdk/resourcemanager/network/armnetwork/virtualhubs_client_example_test.go b/sdk/resourcemanager/network/armnetwork/virtualhubs_client_example_test.go deleted file mode 100644 index ac8567cf15a0..000000000000 --- a/sdk/resourcemanager/network/armnetwork/virtualhubs_client_example_test.go +++ /dev/null @@ -1,627 +0,0 @@ -//go:build go1.18 -// +build go1.18 - -// 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. -// DO NOT EDIT. - -package armnetwork_test - -import ( - "context" - "log" - - "github.com/Azure/azure-sdk-for-go/sdk/azcore/to" - "github.com/Azure/azure-sdk-for-go/sdk/azidentity" - "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/network/armnetwork/v6" -) - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/4883fa5dbf6f2c9093fac8ce334547e9dfac68fa/specification/network/resource-manager/Microsoft.Network/stable/2024-03-01/examples/VirtualHubGet.json -func ExampleVirtualHubsClient_Get() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armnetwork.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewVirtualHubsClient().Get(ctx, "rg1", "virtualHub1", nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.VirtualHub = armnetwork.VirtualHub{ - // Name: to.Ptr("virtualHub1"), - // Type: to.Ptr("Microsoft.Network/virtualHubs"), - // ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/virtualHubs/virtualHub1"), - // Location: to.Ptr("West US"), - // Etag: to.Ptr("w/\\00000000-0000-0000-0000-000000000000\\"), - // Properties: &armnetwork.VirtualHubProperties{ - // AddressPrefix: to.Ptr("10.10.1.0/24"), - // AllowBranchToBranchTraffic: to.Ptr(false), - // HubRoutingPreference: to.Ptr(armnetwork.HubRoutingPreferenceExpressRoute), - // PreferredRoutingGateway: to.Ptr(armnetwork.PreferredRoutingGatewayExpressRoute), - // ProvisioningState: to.Ptr(armnetwork.ProvisioningStateSucceeded), - // RoutingState: to.Ptr(armnetwork.RoutingStateProvisioned), - // SKU: to.Ptr("Basic"), - // VirtualHubRouteTableV2S: []*armnetwork.VirtualHubRouteTableV2{ - // }, - // VirtualRouterAsn: to.Ptr[int64](65515), - // VirtualRouterAutoScaleConfiguration: &armnetwork.VirtualRouterAutoScaleConfiguration{ - // MinCapacity: to.Ptr[int32](2), - // }, - // VirtualRouterIPs: []*string{ - // to.Ptr("10.10.1.12"), - // to.Ptr("10.10.1.13")}, - // VirtualWan: &armnetwork.SubResource{ - // ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/virtualWans/virtualWan1"), - // }, - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/4883fa5dbf6f2c9093fac8ce334547e9dfac68fa/specification/network/resource-manager/Microsoft.Network/stable/2024-03-01/examples/VirtualHubPut.json -func ExampleVirtualHubsClient_BeginCreateOrUpdate() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armnetwork.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewVirtualHubsClient().BeginCreateOrUpdate(ctx, "rg1", "virtualHub2", armnetwork.VirtualHub{ - Location: to.Ptr("West US"), - Tags: map[string]*string{ - "key1": to.Ptr("value1"), - }, - Properties: &armnetwork.VirtualHubProperties{ - AddressPrefix: to.Ptr("10.168.0.0/24"), - SKU: to.Ptr("Basic"), - VirtualWan: &armnetwork.SubResource{ - ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/virtualWans/virtualWan1"), - }, - }, - }, nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - res, err := poller.PollUntilDone(ctx, nil) - if err != nil { - log.Fatalf("failed to pull the result: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.VirtualHub = armnetwork.VirtualHub{ - // Name: to.Ptr("virtualHub2"), - // Type: to.Ptr("Microsoft.Network/virtualHubs"), - // ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/virtualHubs/virtualHub2"), - // Location: to.Ptr("West US"), - // Etag: to.Ptr("w/\\00000000-0000-0000-0000-000000000000\\"), - // Properties: &armnetwork.VirtualHubProperties{ - // AddressPrefix: to.Ptr("10.168.0.0/24"), - // AllowBranchToBranchTraffic: to.Ptr(false), - // HubRoutingPreference: to.Ptr(armnetwork.HubRoutingPreferenceExpressRoute), - // PreferredRoutingGateway: to.Ptr(armnetwork.PreferredRoutingGatewayExpressRoute), - // ProvisioningState: to.Ptr(armnetwork.ProvisioningStateSucceeded), - // RoutingState: to.Ptr(armnetwork.RoutingStateProvisioned), - // SKU: to.Ptr("Basic"), - // VirtualHubRouteTableV2S: []*armnetwork.VirtualHubRouteTableV2{ - // }, - // VirtualRouterAsn: to.Ptr[int64](65515), - // VirtualRouterAutoScaleConfiguration: &armnetwork.VirtualRouterAutoScaleConfiguration{ - // MinCapacity: to.Ptr[int32](2), - // }, - // VirtualRouterIPs: []*string{ - // to.Ptr("10.10.1.12"), - // to.Ptr("10.10.1.13")}, - // VirtualWan: &armnetwork.SubResource{ - // ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/virtualWans/virtualWan1"), - // }, - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/4883fa5dbf6f2c9093fac8ce334547e9dfac68fa/specification/network/resource-manager/Microsoft.Network/stable/2024-03-01/examples/VirtualHubUpdateTags.json -func ExampleVirtualHubsClient_UpdateTags() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armnetwork.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewVirtualHubsClient().UpdateTags(ctx, "rg1", "virtualHub2", armnetwork.TagsObject{ - Tags: map[string]*string{ - "key1": to.Ptr("value1"), - "key2": to.Ptr("value2"), - }, - }, nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.VirtualHub = armnetwork.VirtualHub{ - // Name: to.Ptr("virtualHub2"), - // Type: to.Ptr("Microsoft.Network/virtualHubs"), - // ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/virtualHubs/virtualHub2"), - // Location: to.Ptr("West US"), - // Tags: map[string]*string{ - // "key1": to.Ptr("value1"), - // "key2": to.Ptr("value2"), - // }, - // Etag: to.Ptr("w/\\00000000-0000-0000-0000-000000000000\\"), - // Properties: &armnetwork.VirtualHubProperties{ - // AddressPrefix: to.Ptr("10.168.0.0/24"), - // AllowBranchToBranchTraffic: to.Ptr(false), - // HubRoutingPreference: to.Ptr(armnetwork.HubRoutingPreferenceExpressRoute), - // ProvisioningState: to.Ptr(armnetwork.ProvisioningStateSucceeded), - // SKU: to.Ptr("Basic"), - // VirtualHubRouteTableV2S: []*armnetwork.VirtualHubRouteTableV2{ - // }, - // VirtualRouterAsn: to.Ptr[int64](65515), - // VirtualRouterAutoScaleConfiguration: &armnetwork.VirtualRouterAutoScaleConfiguration{ - // MinCapacity: to.Ptr[int32](2), - // }, - // VirtualRouterIPs: []*string{ - // to.Ptr("10.10.1.12"), - // to.Ptr("10.10.1.13")}, - // VirtualWan: &armnetwork.SubResource{ - // ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/virtualWans/virtualWan1"), - // }, - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/4883fa5dbf6f2c9093fac8ce334547e9dfac68fa/specification/network/resource-manager/Microsoft.Network/stable/2024-03-01/examples/VirtualHubDelete.json -func ExampleVirtualHubsClient_BeginDelete() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armnetwork.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewVirtualHubsClient().BeginDelete(ctx, "rg1", "virtualHub1", nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - _, err = poller.PollUntilDone(ctx, nil) - if err != nil { - log.Fatalf("failed to pull the result: %v", err) - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/4883fa5dbf6f2c9093fac8ce334547e9dfac68fa/specification/network/resource-manager/Microsoft.Network/stable/2024-03-01/examples/VirtualHubListByResourceGroup.json -func ExampleVirtualHubsClient_NewListByResourceGroupPager() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armnetwork.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := clientFactory.NewVirtualHubsClient().NewListByResourceGroupPager("rg1", nil) - for pager.More() { - page, err := pager.NextPage(ctx) - if err != nil { - log.Fatalf("failed to advance page: %v", err) - } - for _, v := range page.Value { - // You could use page here. We use blank identifier for just demo purposes. - _ = v - } - // If the HTTP response code is 200 as defined in example definition, your page structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // page.ListVirtualHubsResult = armnetwork.ListVirtualHubsResult{ - // Value: []*armnetwork.VirtualHub{ - // { - // Name: to.Ptr("virtualHub1"), - // Type: to.Ptr("Microsoft.Network/virtualHubs"), - // ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/virtualHubs/virtualHub1"), - // Location: to.Ptr("West US"), - // Etag: to.Ptr("w/\\00000000-0000-0000-0000-000000000000\\"), - // Properties: &armnetwork.VirtualHubProperties{ - // AddressPrefix: to.Ptr("10.10.1.0/24"), - // AllowBranchToBranchTraffic: to.Ptr(false), - // HubRoutingPreference: to.Ptr(armnetwork.HubRoutingPreferenceExpressRoute), - // PreferredRoutingGateway: to.Ptr(armnetwork.PreferredRoutingGatewayExpressRoute), - // ProvisioningState: to.Ptr(armnetwork.ProvisioningStateSucceeded), - // RoutingState: to.Ptr(armnetwork.RoutingStateProvisioned), - // SKU: to.Ptr("Basic"), - // VirtualHubRouteTableV2S: []*armnetwork.VirtualHubRouteTableV2{ - // { - // ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/virtualHubs/virtualHub2/routeTables/virtualHubRouteTable2"), - // Name: to.Ptr("rt2a"), - // Etag: to.Ptr("w/\\00000000-0000-0000-0000-000000000000\\"), - // Properties: &armnetwork.VirtualHubRouteTableV2Properties{ - // AttachedConnections: []*string{ - // to.Ptr("All_Vnets")}, - // ProvisioningState: to.Ptr(armnetwork.ProvisioningStateSucceeded), - // Routes: []*armnetwork.VirtualHubRouteV2{ - // { - // DestinationType: to.Ptr("CIDR"), - // Destinations: []*string{ - // to.Ptr("20.10.0.0/16"), - // to.Ptr("20.20.0.0/16")}, - // NextHopType: to.Ptr("IPAddress"), - // NextHops: []*string{ - // to.Ptr("10.0.0.68")}, - // }, - // { - // DestinationType: to.Ptr("CIDR"), - // Destinations: []*string{ - // to.Ptr("0.0.0.0/0")}, - // NextHopType: to.Ptr("IPAddress"), - // NextHops: []*string{ - // to.Ptr("10.0.0.68")}, - // }}, - // }, - // }}, - // VirtualRouterAsn: to.Ptr[int64](65515), - // VirtualRouterAutoScaleConfiguration: &armnetwork.VirtualRouterAutoScaleConfiguration{ - // MinCapacity: to.Ptr[int32](2), - // }, - // VirtualRouterIPs: []*string{ - // to.Ptr("10.10.1.12"), - // to.Ptr("10.10.1.13")}, - // VirtualWan: &armnetwork.SubResource{ - // ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/virtualWans/virtualWan1"), - // }, - // }, - // }, - // { - // Name: to.Ptr("virtualHub2"), - // Type: to.Ptr("Microsoft.Network/virtualHubs"), - // ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/virtualHubs/virtualHub2"), - // Location: to.Ptr("East US"), - // Etag: to.Ptr("w/\\00000000-0000-0000-0000-000000000000\\"), - // Properties: &armnetwork.VirtualHubProperties{ - // AddressPrefix: to.Ptr("210.10.1.0/24"), - // AllowBranchToBranchTraffic: to.Ptr(false), - // HubRoutingPreference: to.Ptr(armnetwork.HubRoutingPreferenceExpressRoute), - // PreferredRoutingGateway: to.Ptr(armnetwork.PreferredRoutingGatewayExpressRoute), - // ProvisioningState: to.Ptr(armnetwork.ProvisioningStateSucceeded), - // RoutingState: to.Ptr(armnetwork.RoutingStateProvisioned), - // SKU: to.Ptr("Basic"), - // VirtualHubRouteTableV2S: []*armnetwork.VirtualHubRouteTableV2{ - // { - // ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/virtualHubs/virtualHub2/routeTables/virtualHubRouteTable2"), - // Name: to.Ptr("rt2a"), - // Etag: to.Ptr("w/\\00000000-0000-0000-0000-000000000000\\"), - // Properties: &armnetwork.VirtualHubRouteTableV2Properties{ - // AttachedConnections: []*string{ - // to.Ptr("All_Vnets")}, - // ProvisioningState: to.Ptr(armnetwork.ProvisioningStateSucceeded), - // Routes: []*armnetwork.VirtualHubRouteV2{ - // { - // DestinationType: to.Ptr("CIDR"), - // Destinations: []*string{ - // to.Ptr("20.10.0.0/16"), - // to.Ptr("20.20.0.0/16")}, - // NextHopType: to.Ptr("IPAddress"), - // NextHops: []*string{ - // to.Ptr("10.0.0.68")}, - // }, - // { - // DestinationType: to.Ptr("CIDR"), - // Destinations: []*string{ - // to.Ptr("0.0.0.0/0")}, - // NextHopType: to.Ptr("IPAddress"), - // NextHops: []*string{ - // to.Ptr("10.0.0.68")}, - // }}, - // }, - // }}, - // VirtualRouterAsn: to.Ptr[int64](65515), - // VirtualRouterAutoScaleConfiguration: &armnetwork.VirtualRouterAutoScaleConfiguration{ - // MinCapacity: to.Ptr[int32](2), - // }, - // VirtualRouterIPs: []*string{ - // to.Ptr("10.10.1.12"), - // to.Ptr("10.10.1.13")}, - // VirtualWan: &armnetwork.SubResource{ - // ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/virtualWans/virtualWan1"), - // }, - // }, - // }}, - // } - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/4883fa5dbf6f2c9093fac8ce334547e9dfac68fa/specification/network/resource-manager/Microsoft.Network/stable/2024-03-01/examples/VirtualHubList.json -func ExampleVirtualHubsClient_NewListPager() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armnetwork.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := clientFactory.NewVirtualHubsClient().NewListPager(nil) - for pager.More() { - page, err := pager.NextPage(ctx) - if err != nil { - log.Fatalf("failed to advance page: %v", err) - } - for _, v := range page.Value { - // You could use page here. We use blank identifier for just demo purposes. - _ = v - } - // If the HTTP response code is 200 as defined in example definition, your page structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // page.ListVirtualHubsResult = armnetwork.ListVirtualHubsResult{ - // Value: []*armnetwork.VirtualHub{ - // { - // Name: to.Ptr("virtualHub1"), - // Type: to.Ptr("Microsoft.Network/virtualHubs"), - // ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/virtualHubs/virtualHub1"), - // Location: to.Ptr("West US"), - // Etag: to.Ptr("w/\\00000000-0000-0000-0000-000000000000\\"), - // Properties: &armnetwork.VirtualHubProperties{ - // AddressPrefix: to.Ptr("10.10.1.0/24"), - // AllowBranchToBranchTraffic: to.Ptr(false), - // HubRoutingPreference: to.Ptr(armnetwork.HubRoutingPreferenceExpressRoute), - // PreferredRoutingGateway: to.Ptr(armnetwork.PreferredRoutingGatewayExpressRoute), - // ProvisioningState: to.Ptr(armnetwork.ProvisioningStateSucceeded), - // RoutingState: to.Ptr(armnetwork.RoutingStateProvisioned), - // SKU: to.Ptr("Basic"), - // VirtualHubRouteTableV2S: []*armnetwork.VirtualHubRouteTableV2{ - // { - // ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/virtualHubs/virtualHub1/routeTables/virtualHubRouteTable1"), - // Name: to.Ptr("rt2a"), - // Etag: to.Ptr("w/\\00000000-0000-0000-0000-000000000000\\"), - // Properties: &armnetwork.VirtualHubRouteTableV2Properties{ - // AttachedConnections: []*string{ - // to.Ptr("All_Vnets")}, - // ProvisioningState: to.Ptr(armnetwork.ProvisioningStateSucceeded), - // Routes: []*armnetwork.VirtualHubRouteV2{ - // { - // DestinationType: to.Ptr("CIDR"), - // Destinations: []*string{ - // to.Ptr("20.10.0.0/16"), - // to.Ptr("20.20.0.0/16")}, - // NextHopType: to.Ptr("IPAddress"), - // NextHops: []*string{ - // to.Ptr("10.0.0.68")}, - // }, - // { - // DestinationType: to.Ptr("CIDR"), - // Destinations: []*string{ - // to.Ptr("0.0.0.0/0")}, - // NextHopType: to.Ptr("IPAddress"), - // NextHops: []*string{ - // to.Ptr("10.0.0.68")}, - // }}, - // }, - // }}, - // VirtualRouterAsn: to.Ptr[int64](65515), - // VirtualRouterAutoScaleConfiguration: &armnetwork.VirtualRouterAutoScaleConfiguration{ - // MinCapacity: to.Ptr[int32](2), - // }, - // VirtualRouterIPs: []*string{ - // to.Ptr("10.10.1.12"), - // to.Ptr("10.10.1.13")}, - // VirtualWan: &armnetwork.SubResource{ - // ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/virtualWans/virtualWan1"), - // }, - // }, - // }, - // { - // Name: to.Ptr("virtualHub2"), - // Type: to.Ptr("Microsoft.Network/virtualHubs"), - // ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/virtualHubs/virtualHub2"), - // Location: to.Ptr("East US"), - // Etag: to.Ptr("w/\\00000000-0000-0000-0000-000000000000\\"), - // Properties: &armnetwork.VirtualHubProperties{ - // AddressPrefix: to.Ptr("210.10.1.0/24"), - // AllowBranchToBranchTraffic: to.Ptr(false), - // HubRoutingPreference: to.Ptr(armnetwork.HubRoutingPreferenceExpressRoute), - // PreferredRoutingGateway: to.Ptr(armnetwork.PreferredRoutingGatewayExpressRoute), - // ProvisioningState: to.Ptr(armnetwork.ProvisioningStateSucceeded), - // RoutingState: to.Ptr(armnetwork.RoutingStateProvisioned), - // SKU: to.Ptr("Basic"), - // VirtualHubRouteTableV2S: []*armnetwork.VirtualHubRouteTableV2{ - // { - // ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/virtualHubs/virtualHub2/routeTables/virtualHubRouteTable2"), - // Name: to.Ptr("rt2a"), - // Etag: to.Ptr("w/\\00000000-0000-0000-0000-000000000000\\"), - // Properties: &armnetwork.VirtualHubRouteTableV2Properties{ - // AttachedConnections: []*string{ - // to.Ptr("All_Vnets")}, - // ProvisioningState: to.Ptr(armnetwork.ProvisioningStateSucceeded), - // Routes: []*armnetwork.VirtualHubRouteV2{ - // { - // DestinationType: to.Ptr("CIDR"), - // Destinations: []*string{ - // to.Ptr("20.10.0.0/16"), - // to.Ptr("20.20.0.0/16")}, - // NextHopType: to.Ptr("IPAddress"), - // NextHops: []*string{ - // to.Ptr("10.0.0.68")}, - // }, - // { - // DestinationType: to.Ptr("CIDR"), - // Destinations: []*string{ - // to.Ptr("0.0.0.0/0")}, - // NextHopType: to.Ptr("IPAddress"), - // NextHops: []*string{ - // to.Ptr("10.0.0.68")}, - // }}, - // }, - // }}, - // VirtualRouterAsn: to.Ptr[int64](65515), - // VirtualRouterAutoScaleConfiguration: &armnetwork.VirtualRouterAutoScaleConfiguration{ - // MinCapacity: to.Ptr[int32](2), - // }, - // VirtualRouterIPs: []*string{ - // to.Ptr("10.10.1.12"), - // to.Ptr("10.10.1.13")}, - // VirtualWan: &armnetwork.SubResource{ - // ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/virtualWans/virtualWan1"), - // }, - // }, - // }}, - // } - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/4883fa5dbf6f2c9093fac8ce334547e9dfac68fa/specification/network/resource-manager/Microsoft.Network/stable/2024-03-01/examples/EffectiveRoutesListForConnection.json -func ExampleVirtualHubsClient_BeginGetEffectiveVirtualHubRoutes_effectiveRoutesForAConnectionResource() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armnetwork.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewVirtualHubsClient().BeginGetEffectiveVirtualHubRoutes(ctx, "rg1", "virtualHub1", &armnetwork.VirtualHubsClientBeginGetEffectiveVirtualHubRoutesOptions{EffectiveRoutesParameters: &armnetwork.EffectiveRoutesParameters{ - ResourceID: to.Ptr("/subscriptions/subid/resourceGroups/resourceGroupName/providers/Microsoft.Network/expressRouteGateways/expressRouteGatewayName/expressRouteConnections/connectionName"), - VirtualWanResourceType: to.Ptr("ExpressRouteConnection"), - }, - }) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - res, err := poller.PollUntilDone(ctx, nil) - if err != nil { - log.Fatalf("failed to pull the result: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.VirtualHubEffectiveRouteList = armnetwork.VirtualHubEffectiveRouteList{ - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/4883fa5dbf6f2c9093fac8ce334547e9dfac68fa/specification/network/resource-manager/Microsoft.Network/stable/2024-03-01/examples/EffectiveRoutesListForRouteTable.json -func ExampleVirtualHubsClient_BeginGetEffectiveVirtualHubRoutes_effectiveRoutesForARouteTableResource() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armnetwork.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewVirtualHubsClient().BeginGetEffectiveVirtualHubRoutes(ctx, "rg1", "virtualHub1", &armnetwork.VirtualHubsClientBeginGetEffectiveVirtualHubRoutesOptions{EffectiveRoutesParameters: &armnetwork.EffectiveRoutesParameters{ - ResourceID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/virtualHubs/virtualHub1/hubRouteTables/hubRouteTable1"), - VirtualWanResourceType: to.Ptr("RouteTable"), - }, - }) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - res, err := poller.PollUntilDone(ctx, nil) - if err != nil { - log.Fatalf("failed to pull the result: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.VirtualHubEffectiveRouteList = armnetwork.VirtualHubEffectiveRouteList{ - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/4883fa5dbf6f2c9093fac8ce334547e9dfac68fa/specification/network/resource-manager/Microsoft.Network/stable/2024-03-01/examples/EffectiveRoutesListForVirtualHub.json -func ExampleVirtualHubsClient_BeginGetEffectiveVirtualHubRoutes_effectiveRoutesForTheVirtualHub() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armnetwork.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewVirtualHubsClient().BeginGetEffectiveVirtualHubRoutes(ctx, "rg1", "virtualHub1", &armnetwork.VirtualHubsClientBeginGetEffectiveVirtualHubRoutesOptions{EffectiveRoutesParameters: nil}) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - res, err := poller.PollUntilDone(ctx, nil) - if err != nil { - log.Fatalf("failed to pull the result: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.VirtualHubEffectiveRouteList = armnetwork.VirtualHubEffectiveRouteList{ - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/4883fa5dbf6f2c9093fac8ce334547e9dfac68fa/specification/network/resource-manager/Microsoft.Network/stable/2024-03-01/examples/GetInboundRoutes.json -func ExampleVirtualHubsClient_BeginGetInboundRoutes() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armnetwork.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewVirtualHubsClient().BeginGetInboundRoutes(ctx, "rg1", "virtualHub1", armnetwork.GetInboundRoutesParameters{ - ConnectionType: to.Ptr("ExpressRouteConnection"), - ResourceURI: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/expressRouteGateways/exrGw1/expressRouteConnections/exrConn1"), - }, nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - res, err := poller.PollUntilDone(ctx, nil) - if err != nil { - log.Fatalf("failed to pull the result: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.EffectiveRouteMapRouteList = armnetwork.EffectiveRouteMapRouteList{ - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/4883fa5dbf6f2c9093fac8ce334547e9dfac68fa/specification/network/resource-manager/Microsoft.Network/stable/2024-03-01/examples/GetOutboundRoutes.json -func ExampleVirtualHubsClient_BeginGetOutboundRoutes() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armnetwork.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewVirtualHubsClient().BeginGetOutboundRoutes(ctx, "rg1", "virtualHub1", armnetwork.GetOutboundRoutesParameters{ - ConnectionType: to.Ptr("ExpressRouteConnection"), - ResourceURI: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/expressRouteGateways/exrGw1/expressRouteConnections/exrConn1"), - }, nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - res, err := poller.PollUntilDone(ctx, nil) - if err != nil { - log.Fatalf("failed to pull the result: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.EffectiveRouteMapRouteList = armnetwork.EffectiveRouteMapRouteList{ - // } -} diff --git a/sdk/resourcemanager/network/armnetwork/virtualnetworkgatewayconnections_client_example_test.go b/sdk/resourcemanager/network/armnetwork/virtualnetworkgatewayconnections_client_example_test.go deleted file mode 100644 index b717997b1d08..000000000000 --- a/sdk/resourcemanager/network/armnetwork/virtualnetworkgatewayconnections_client_example_test.go +++ /dev/null @@ -1,689 +0,0 @@ -//go:build go1.18 -// +build go1.18 - -// 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. -// DO NOT EDIT. - -package armnetwork_test - -import ( - "context" - "log" - - "github.com/Azure/azure-sdk-for-go/sdk/azcore/to" - "github.com/Azure/azure-sdk-for-go/sdk/azidentity" - "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/network/armnetwork/v6" -) - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/4883fa5dbf6f2c9093fac8ce334547e9dfac68fa/specification/network/resource-manager/Microsoft.Network/stable/2024-03-01/examples/VirtualNetworkGatewayConnectionCreate.json -func ExampleVirtualNetworkGatewayConnectionsClient_BeginCreateOrUpdate() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armnetwork.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewVirtualNetworkGatewayConnectionsClient().BeginCreateOrUpdate(ctx, "rg1", "connS2S", armnetwork.VirtualNetworkGatewayConnection{ - Location: to.Ptr("centralus"), - Properties: &armnetwork.VirtualNetworkGatewayConnectionPropertiesFormat{ - ConnectionMode: to.Ptr(armnetwork.VirtualNetworkGatewayConnectionModeDefault), - ConnectionProtocol: to.Ptr(armnetwork.VirtualNetworkGatewayConnectionProtocolIKEv2), - ConnectionType: to.Ptr(armnetwork.VirtualNetworkGatewayConnectionTypeIPsec), - DpdTimeoutSeconds: to.Ptr[int32](30), - EgressNatRules: []*armnetwork.SubResource{ - { - ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/virtualNetworkGateways/vpngw/natRules/natRule2"), - }}, - EnableBgp: to.Ptr(false), - GatewayCustomBgpIPAddresses: []*armnetwork.GatewayCustomBgpIPAddressIPConfiguration{ - { - CustomBgpIPAddress: to.Ptr("169.254.21.1"), - IPConfigurationID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/virtualNetworkGateways/vpngw/ipConfigurations/default"), - }, - { - CustomBgpIPAddress: to.Ptr("169.254.21.3"), - IPConfigurationID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/virtualNetworkGateways/vpngw/ipConfigurations/ActiveActive"), - }}, - IngressNatRules: []*armnetwork.SubResource{ - { - ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/virtualNetworkGateways/vpngw/natRules/natRule1"), - }}, - IPSecPolicies: []*armnetwork.IPSecPolicy{}, - LocalNetworkGateway2: &armnetwork.LocalNetworkGateway{ - ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/localNetworkGateways/localgw"), - Location: to.Ptr("centralus"), - Tags: map[string]*string{}, - Properties: &armnetwork.LocalNetworkGatewayPropertiesFormat{ - GatewayIPAddress: to.Ptr("x.x.x.x"), - LocalNetworkAddressSpace: &armnetwork.AddressSpace{ - AddressPrefixes: []*string{ - to.Ptr("10.1.0.0/16")}, - }, - }, - }, - RoutingWeight: to.Ptr[int32](0), - SharedKey: to.Ptr("Abc123"), - TrafficSelectorPolicies: []*armnetwork.TrafficSelectorPolicy{}, - UsePolicyBasedTrafficSelectors: to.Ptr(false), - VirtualNetworkGateway1: &armnetwork.VirtualNetworkGateway{ - ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/virtualNetworkGateways/vpngw"), - Location: to.Ptr("centralus"), - Tags: map[string]*string{}, - Properties: &armnetwork.VirtualNetworkGatewayPropertiesFormat{ - Active: to.Ptr(false), - BgpSettings: &armnetwork.BgpSettings{ - Asn: to.Ptr[int64](65514), - BgpPeeringAddress: to.Ptr("10.0.1.30"), - PeerWeight: to.Ptr[int32](0), - }, - EnableBgp: to.Ptr(false), - GatewayType: to.Ptr(armnetwork.VirtualNetworkGatewayTypeVPN), - IPConfigurations: []*armnetwork.VirtualNetworkGatewayIPConfiguration{ - { - ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/virtualNetworkGateways/vpngw/ipConfigurations/gwipconfig1"), - Name: to.Ptr("gwipconfig1"), - Properties: &armnetwork.VirtualNetworkGatewayIPConfigurationPropertiesFormat{ - PrivateIPAllocationMethod: to.Ptr(armnetwork.IPAllocationMethodDynamic), - PublicIPAddress: &armnetwork.SubResource{ - ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/publicIPAddresses/gwpip"), - }, - Subnet: &armnetwork.SubResource{ - ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/virtualNetworks/vnet1/subnets/GatewaySubnet"), - }, - }, - }}, - SKU: &armnetwork.VirtualNetworkGatewaySKU{ - Name: to.Ptr(armnetwork.VirtualNetworkGatewaySKUNameVPNGw1), - Tier: to.Ptr(armnetwork.VirtualNetworkGatewaySKUTierVPNGw1), - }, - VPNType: to.Ptr(armnetwork.VPNTypeRouteBased), - }, - }, - }, - }, nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - res, err := poller.PollUntilDone(ctx, nil) - if err != nil { - log.Fatalf("failed to pull the result: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.VirtualNetworkGatewayConnection = armnetwork.VirtualNetworkGatewayConnection{ - // Name: to.Ptr("connS2S"), - // Type: to.Ptr("Microsoft.Network/connections"), - // ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/connections/connS2S"), - // Location: to.Ptr("centralus"), - // Etag: to.Ptr("W/\"00000000-0000-0000-0000-000000000000\""), - // Properties: &armnetwork.VirtualNetworkGatewayConnectionPropertiesFormat{ - // ConnectionMode: to.Ptr(armnetwork.VirtualNetworkGatewayConnectionModeDefault), - // ConnectionProtocol: to.Ptr(armnetwork.VirtualNetworkGatewayConnectionProtocolIKEv2), - // ConnectionType: to.Ptr(armnetwork.VirtualNetworkGatewayConnectionTypeIPsec), - // DpdTimeoutSeconds: to.Ptr[int32](30), - // EgressBytesTransferred: to.Ptr[int64](0), - // EgressNatRules: []*armnetwork.SubResource{ - // { - // ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/virtualNetworkGateways/vpngw/natRules/natRule2"), - // }}, - // EnableBgp: to.Ptr(false), - // GatewayCustomBgpIPAddresses: []*armnetwork.GatewayCustomBgpIPAddressIPConfiguration{ - // { - // CustomBgpIPAddress: to.Ptr("169.254.21.1"), - // IPConfigurationID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/virtualNetworkGateways/vpngw/ipConfigurations/default"), - // }, - // { - // CustomBgpIPAddress: to.Ptr("169.254.21.3"), - // IPConfigurationID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/virtualNetworkGateways/vpngw/ipConfigurations/ActiveActive"), - // }}, - // IngressBytesTransferred: to.Ptr[int64](0), - // IngressNatRules: []*armnetwork.SubResource{ - // { - // ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/virtualNetworkGateways/vpngw/natRules/natRule1"), - // }}, - // IPSecPolicies: []*armnetwork.IPSecPolicy{ - // }, - // LocalNetworkGateway2: &armnetwork.LocalNetworkGateway{ - // ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/localNetworkGateways/localgw"), - // Properties: &armnetwork.LocalNetworkGatewayPropertiesFormat{ - // }, - // }, - // ProvisioningState: to.Ptr(armnetwork.ProvisioningStateSucceeded), - // ResourceGUID: to.Ptr("00000000-0000-0000-0000-000000000000"), - // RoutingWeight: to.Ptr[int32](0), - // SharedKey: to.Ptr("Abc123"), - // UseLocalAzureIPAddress: to.Ptr(false), - // UsePolicyBasedTrafficSelectors: to.Ptr(false), - // VirtualNetworkGateway1: &armnetwork.VirtualNetworkGateway{ - // ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/virtualNetworkGateways/vpngw"), - // Properties: &armnetwork.VirtualNetworkGatewayPropertiesFormat{ - // }, - // }, - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/4883fa5dbf6f2c9093fac8ce334547e9dfac68fa/specification/network/resource-manager/Microsoft.Network/stable/2024-03-01/examples/VirtualNetworkGatewayConnectionGet.json -func ExampleVirtualNetworkGatewayConnectionsClient_Get() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armnetwork.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewVirtualNetworkGatewayConnectionsClient().Get(ctx, "rg1", "connS2S", nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.VirtualNetworkGatewayConnection = armnetwork.VirtualNetworkGatewayConnection{ - // Name: to.Ptr("connS2S"), - // Type: to.Ptr("Microsoft.Network/connections"), - // ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/connections/connS2S"), - // Location: to.Ptr("centralus"), - // Etag: to.Ptr("W/\"00000000-0000-0000-0000-000000000000\""), - // Properties: &armnetwork.VirtualNetworkGatewayConnectionPropertiesFormat{ - // ConnectionMode: to.Ptr(armnetwork.VirtualNetworkGatewayConnectionModeDefault), - // ConnectionProtocol: to.Ptr(armnetwork.VirtualNetworkGatewayConnectionProtocolIKEv2), - // ConnectionStatus: to.Ptr(armnetwork.VirtualNetworkGatewayConnectionStatusConnecting), - // ConnectionType: to.Ptr(armnetwork.VirtualNetworkGatewayConnectionTypeIPsec), - // DpdTimeoutSeconds: to.Ptr[int32](30), - // EgressBytesTransferred: to.Ptr[int64](0), - // EgressNatRules: []*armnetwork.SubResource{ - // { - // ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/virtualNetworkGateways/vpngw/natRules/natRule2"), - // }}, - // EnableBgp: to.Ptr(false), - // GatewayCustomBgpIPAddresses: []*armnetwork.GatewayCustomBgpIPAddressIPConfiguration{ - // { - // CustomBgpIPAddress: to.Ptr("169.254.21.1"), - // IPConfigurationID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/virtualNetworkGateways/vpngw/ipConfigurations/default"), - // }, - // { - // CustomBgpIPAddress: to.Ptr("169.254.21.3"), - // IPConfigurationID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/virtualNetworkGateways/vpngw/ipConfigurations/ActiveActive"), - // }}, - // IngressBytesTransferred: to.Ptr[int64](0), - // IngressNatRules: []*armnetwork.SubResource{ - // { - // ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/virtualNetworkGateways/vpngw/natRules/natRule1"), - // }}, - // IPSecPolicies: []*armnetwork.IPSecPolicy{ - // }, - // LocalNetworkGateway2: &armnetwork.LocalNetworkGateway{ - // ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/localNetworkGateways/localgw"), - // Properties: &armnetwork.LocalNetworkGatewayPropertiesFormat{ - // }, - // }, - // ProvisioningState: to.Ptr(armnetwork.ProvisioningStateSucceeded), - // ResourceGUID: to.Ptr("00000000-0000-0000-0000-000000000000"), - // RoutingWeight: to.Ptr[int32](0), - // SharedKey: to.Ptr("Abc123"), - // TrafficSelectorPolicies: []*armnetwork.TrafficSelectorPolicy{ - // }, - // UseLocalAzureIPAddress: to.Ptr(false), - // UsePolicyBasedTrafficSelectors: to.Ptr(false), - // VirtualNetworkGateway1: &armnetwork.VirtualNetworkGateway{ - // ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/virtualNetworkGateways/vpngw"), - // Properties: &armnetwork.VirtualNetworkGatewayPropertiesFormat{ - // }, - // }, - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/4883fa5dbf6f2c9093fac8ce334547e9dfac68fa/specification/network/resource-manager/Microsoft.Network/stable/2024-03-01/examples/VirtualNetworkGatewayConnectionDelete.json -func ExampleVirtualNetworkGatewayConnectionsClient_BeginDelete() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armnetwork.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewVirtualNetworkGatewayConnectionsClient().BeginDelete(ctx, "rg1", "conn1", nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - _, err = poller.PollUntilDone(ctx, nil) - if err != nil { - log.Fatalf("failed to pull the result: %v", err) - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/4883fa5dbf6f2c9093fac8ce334547e9dfac68fa/specification/network/resource-manager/Microsoft.Network/stable/2024-03-01/examples/VirtualNetworkGatewayConnectionUpdateTags.json -func ExampleVirtualNetworkGatewayConnectionsClient_BeginUpdateTags() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armnetwork.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewVirtualNetworkGatewayConnectionsClient().BeginUpdateTags(ctx, "rg1", "test", armnetwork.TagsObject{ - Tags: map[string]*string{ - "tag1": to.Ptr("value1"), - "tag2": to.Ptr("value2"), - }, - }, nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - res, err := poller.PollUntilDone(ctx, nil) - if err != nil { - log.Fatalf("failed to pull the result: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.VirtualNetworkGatewayConnection = armnetwork.VirtualNetworkGatewayConnection{ - // Name: to.Ptr("test"), - // Type: to.Ptr("Microsoft.Network/connections"), - // ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/connections/test"), - // Location: to.Ptr("westus"), - // Tags: map[string]*string{ - // "tag1": to.Ptr("value1"), - // "tag2": to.Ptr("value2"), - // }, - // Properties: &armnetwork.VirtualNetworkGatewayConnectionPropertiesFormat{ - // ConnectionStatus: to.Ptr(armnetwork.VirtualNetworkGatewayConnectionStatusUnknown), - // ConnectionType: to.Ptr(armnetwork.VirtualNetworkGatewayConnectionTypeIPsec), - // EgressBytesTransferred: to.Ptr[int64](0), - // EgressNatRules: []*armnetwork.SubResource{ - // { - // ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/virtualNetworkGateways/vpngw/natRules/natRule2"), - // }}, - // EnableBgp: to.Ptr(false), - // GatewayCustomBgpIPAddresses: []*armnetwork.GatewayCustomBgpIPAddressIPConfiguration{ - // { - // CustomBgpIPAddress: to.Ptr("169.254.21.1"), - // IPConfigurationID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/virtualNetworkGateways/vpngw/ipConfigurations/default"), - // }, - // { - // CustomBgpIPAddress: to.Ptr("169.254.21.3"), - // IPConfigurationID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/virtualNetworkGateways/vpngw/ipConfigurations/ActiveActive"), - // }}, - // IngressBytesTransferred: to.Ptr[int64](0), - // IngressNatRules: []*armnetwork.SubResource{ - // { - // ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/virtualNetworkGateways/vpngw/natRules/natRule1"), - // }}, - // IPSecPolicies: []*armnetwork.IPSecPolicy{ - // }, - // LocalNetworkGateway2: &armnetwork.LocalNetworkGateway{ - // ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/localNetworkGateways/lgw"), - // Properties: &armnetwork.LocalNetworkGatewayPropertiesFormat{ - // }, - // }, - // ProvisioningState: to.Ptr(armnetwork.ProvisioningStateSucceeded), - // ResourceGUID: to.Ptr("00000000-0000-0000-0000-000000000000"), - // RoutingWeight: to.Ptr[int32](0), - // SharedKey: to.Ptr("temp1234"), - // TrafficSelectorPolicies: []*armnetwork.TrafficSelectorPolicy{ - // }, - // UsePolicyBasedTrafficSelectors: to.Ptr(false), - // VirtualNetworkGateway1: &armnetwork.VirtualNetworkGateway{ - // ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/virtualNetworkGateways/vpngw"), - // Properties: &armnetwork.VirtualNetworkGatewayPropertiesFormat{ - // }, - // }, - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/4883fa5dbf6f2c9093fac8ce334547e9dfac68fa/specification/network/resource-manager/Microsoft.Network/stable/2024-03-01/examples/VirtualNetworkGatewayConnectionSetSharedKey.json -func ExampleVirtualNetworkGatewayConnectionsClient_BeginSetSharedKey() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armnetwork.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewVirtualNetworkGatewayConnectionsClient().BeginSetSharedKey(ctx, "rg1", "connS2S", armnetwork.ConnectionSharedKey{ - Value: to.Ptr("AzureAbc123"), - }, nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - res, err := poller.PollUntilDone(ctx, nil) - if err != nil { - log.Fatalf("failed to pull the result: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.ConnectionSharedKey = armnetwork.ConnectionSharedKey{ - // ID: to.Ptr(""), - // Value: to.Ptr("AzureAbc123"), - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/4883fa5dbf6f2c9093fac8ce334547e9dfac68fa/specification/network/resource-manager/Microsoft.Network/stable/2024-03-01/examples/VirtualNetworkGatewayConnectionGetSharedKey.json -func ExampleVirtualNetworkGatewayConnectionsClient_GetSharedKey() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armnetwork.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewVirtualNetworkGatewayConnectionsClient().GetSharedKey(ctx, "rg1", "connS2S", nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.ConnectionSharedKey = armnetwork.ConnectionSharedKey{ - // ID: to.Ptr(""), - // Value: to.Ptr("AzureAbc123"), - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/4883fa5dbf6f2c9093fac8ce334547e9dfac68fa/specification/network/resource-manager/Microsoft.Network/stable/2024-03-01/examples/VirtualNetworkGatewayConnectionsList.json -func ExampleVirtualNetworkGatewayConnectionsClient_NewListPager() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armnetwork.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := clientFactory.NewVirtualNetworkGatewayConnectionsClient().NewListPager("rg1", nil) - for pager.More() { - page, err := pager.NextPage(ctx) - if err != nil { - log.Fatalf("failed to advance page: %v", err) - } - for _, v := range page.Value { - // You could use page here. We use blank identifier for just demo purposes. - _ = v - } - // If the HTTP response code is 200 as defined in example definition, your page structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // page.VirtualNetworkGatewayConnectionListResult = armnetwork.VirtualNetworkGatewayConnectionListResult{ - // Value: []*armnetwork.VirtualNetworkGatewayConnection{ - // { - // Name: to.Ptr("conn1"), - // Type: to.Ptr("Microsoft.Network/connections"), - // ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/connections/conn1"), - // Location: to.Ptr("centralus"), - // Etag: to.Ptr("W/\"00000000-0000-0000-0000-000000000000\""), - // Properties: &armnetwork.VirtualNetworkGatewayConnectionPropertiesFormat{ - // ConnectionMode: to.Ptr(armnetwork.VirtualNetworkGatewayConnectionModeDefault), - // ConnectionProtocol: to.Ptr(armnetwork.VirtualNetworkGatewayConnectionProtocolIKEv1), - // ConnectionType: to.Ptr(armnetwork.VirtualNetworkGatewayConnectionTypeIPsec), - // DpdTimeoutSeconds: to.Ptr[int32](30), - // EgressBytesTransferred: to.Ptr[int64](0), - // EgressNatRules: []*armnetwork.SubResource{ - // { - // ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/virtualNetworkGateways/vpngw1/natRules/natRule2"), - // }}, - // EnableBgp: to.Ptr(false), - // GatewayCustomBgpIPAddresses: []*armnetwork.GatewayCustomBgpIPAddressIPConfiguration{ - // { - // CustomBgpIPAddress: to.Ptr("169.254.21.1"), - // IPConfigurationID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/virtualNetworkGateways/vpngw/ipConfigurations/default"), - // }, - // { - // CustomBgpIPAddress: to.Ptr("169.254.21.3"), - // IPConfigurationID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/virtualNetworkGateways/vpngw/ipConfigurations/ActiveActive"), - // }}, - // IngressBytesTransferred: to.Ptr[int64](0), - // IngressNatRules: []*armnetwork.SubResource{ - // { - // ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/virtualNetworkGateways/vpngw1/natRules/natRule1"), - // }}, - // IPSecPolicies: []*armnetwork.IPSecPolicy{ - // }, - // LocalNetworkGateway2: &armnetwork.LocalNetworkGateway{ - // ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/localNetworkGateways/localgw1"), - // Properties: &armnetwork.LocalNetworkGatewayPropertiesFormat{ - // }, - // }, - // ProvisioningState: to.Ptr(armnetwork.ProvisioningStateSucceeded), - // ResourceGUID: to.Ptr("00000000-0000-0000-0000-000000000000"), - // RoutingWeight: to.Ptr[int32](0), - // TrafficSelectorPolicies: []*armnetwork.TrafficSelectorPolicy{ - // }, - // UseLocalAzureIPAddress: to.Ptr(false), - // UsePolicyBasedTrafficSelectors: to.Ptr(false), - // VirtualNetworkGateway1: &armnetwork.VirtualNetworkGateway{ - // ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/virtualNetworkGateways/vpngw1"), - // Properties: &armnetwork.VirtualNetworkGatewayPropertiesFormat{ - // }, - // }, - // }, - // }, - // { - // Name: to.Ptr("conn2"), - // Type: to.Ptr("Microsoft.Network/connections"), - // ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/connections/conn2"), - // Location: to.Ptr("eastus"), - // Etag: to.Ptr("W/\"00000000-0000-0000-0000-000000000000\""), - // Properties: &armnetwork.VirtualNetworkGatewayConnectionPropertiesFormat{ - // ConnectionMode: to.Ptr(armnetwork.VirtualNetworkGatewayConnectionModeDefault), - // ConnectionProtocol: to.Ptr(armnetwork.VirtualNetworkGatewayConnectionProtocolIKEv2), - // ConnectionType: to.Ptr(armnetwork.VirtualNetworkGatewayConnectionTypeIPsec), - // DpdTimeoutSeconds: to.Ptr[int32](20), - // EgressBytesTransferred: to.Ptr[int64](0), - // EgressNatRules: []*armnetwork.SubResource{ - // { - // ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/virtualNetworkGateways/vpngw2/natRules/natRule2"), - // }}, - // EnableBgp: to.Ptr(false), - // GatewayCustomBgpIPAddresses: []*armnetwork.GatewayCustomBgpIPAddressIPConfiguration{ - // { - // CustomBgpIPAddress: to.Ptr("169.254.21.4"), - // IPConfigurationID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/virtualNetworkGateways/vpngw2/ipConfigurations/default"), - // }, - // { - // CustomBgpIPAddress: to.Ptr("169.254.21.6"), - // IPConfigurationID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/virtualNetworkGateways/vpngw2/ipConfigurations/ActiveActive"), - // }}, - // IngressBytesTransferred: to.Ptr[int64](0), - // IngressNatRules: []*armnetwork.SubResource{ - // { - // ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/virtualNetworkGateways/vpngw2/natRules/natRule1"), - // }}, - // IPSecPolicies: []*armnetwork.IPSecPolicy{ - // }, - // LocalNetworkGateway2: &armnetwork.LocalNetworkGateway{ - // ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/localNetworkGateways/localgw2"), - // Properties: &armnetwork.LocalNetworkGatewayPropertiesFormat{ - // }, - // }, - // ProvisioningState: to.Ptr(armnetwork.ProvisioningStateSucceeded), - // ResourceGUID: to.Ptr("00000000-0000-0000-0000-000000000000"), - // RoutingWeight: to.Ptr[int32](0), - // TrafficSelectorPolicies: []*armnetwork.TrafficSelectorPolicy{ - // }, - // UseLocalAzureIPAddress: to.Ptr(true), - // UsePolicyBasedTrafficSelectors: to.Ptr(false), - // VirtualNetworkGateway1: &armnetwork.VirtualNetworkGateway{ - // ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/virtualNetworkGateways/vpngw2"), - // Properties: &armnetwork.VirtualNetworkGatewayPropertiesFormat{ - // }, - // }, - // }, - // }}, - // } - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/4883fa5dbf6f2c9093fac8ce334547e9dfac68fa/specification/network/resource-manager/Microsoft.Network/stable/2024-03-01/examples/VirtualNetworkGatewayConnectionResetSharedKey.json -func ExampleVirtualNetworkGatewayConnectionsClient_BeginResetSharedKey() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armnetwork.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewVirtualNetworkGatewayConnectionsClient().BeginResetSharedKey(ctx, "rg1", "conn1", armnetwork.ConnectionResetSharedKey{ - KeyLength: to.Ptr[int32](128), - }, nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - res, err := poller.PollUntilDone(ctx, nil) - if err != nil { - log.Fatalf("failed to pull the result: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.ConnectionResetSharedKey = armnetwork.ConnectionResetSharedKey{ - // KeyLength: to.Ptr[int32](128), - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/4883fa5dbf6f2c9093fac8ce334547e9dfac68fa/specification/network/resource-manager/Microsoft.Network/stable/2024-03-01/examples/VirtualNetworkGatewayConnectionStartPacketCaptureFilterData.json -func ExampleVirtualNetworkGatewayConnectionsClient_BeginStartPacketCapture_startPacketCaptureOnVirtualNetworkGatewayConnectionWithFilter() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armnetwork.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewVirtualNetworkGatewayConnectionsClient().BeginStartPacketCapture(ctx, "rg1", "vpngwcn1", &armnetwork.VirtualNetworkGatewayConnectionsClientBeginStartPacketCaptureOptions{Parameters: &armnetwork.VPNPacketCaptureStartParameters{ - FilterData: to.Ptr("{'TracingFlags': 11,'MaxPacketBufferSize': 120,'MaxFileSize': 200,'Filters': [{'SourceSubnets': ['20.1.1.0/24'],'DestinationSubnets': ['10.1.1.0/24'],'SourcePort': [500],'DestinationPort': [4500],'Protocol': 6,'TcpFlags': 16,'CaptureSingleDirectionTrafficOnly': true}]}"), - }, - }) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - res, err := poller.PollUntilDone(ctx, nil) - if err != nil { - log.Fatalf("failed to pull the result: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.Value = "\"{\"Status\":\"Successful\",\"Data\":null}\"" -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/4883fa5dbf6f2c9093fac8ce334547e9dfac68fa/specification/network/resource-manager/Microsoft.Network/stable/2024-03-01/examples/VirtualNetworkGatewayConnectionStartPacketCapture.json -func ExampleVirtualNetworkGatewayConnectionsClient_BeginStartPacketCapture_startPacketCaptureOnVirtualNetworkGatewayConnectionWithoutFilter() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armnetwork.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewVirtualNetworkGatewayConnectionsClient().BeginStartPacketCapture(ctx, "rg1", "vpngwcn1", &armnetwork.VirtualNetworkGatewayConnectionsClientBeginStartPacketCaptureOptions{Parameters: nil}) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - res, err := poller.PollUntilDone(ctx, nil) - if err != nil { - log.Fatalf("failed to pull the result: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.Value = "\"{\"Status\":\"Successful\",\"Data\":null}\"" -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/4883fa5dbf6f2c9093fac8ce334547e9dfac68fa/specification/network/resource-manager/Microsoft.Network/stable/2024-03-01/examples/VirtualNetworkGatewayConnectionStopPacketCapture.json -func ExampleVirtualNetworkGatewayConnectionsClient_BeginStopPacketCapture() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armnetwork.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewVirtualNetworkGatewayConnectionsClient().BeginStopPacketCapture(ctx, "rg1", "vpngwcn1", armnetwork.VPNPacketCaptureStopParameters{ - SasURL: to.Ptr("https://teststorage.blob.core.windows.net/?sv=2018-03-28&ss=bfqt&srt=sco&sp=rwdlacup&se=2019-09-13T07:44:05Z&st=2019-09-06T23:44:05Z&spr=https&sig=V1h9D1riltvZMI69d6ihENnFo%2FrCvTqGgjO2lf%2FVBhE%3D"), - }, nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - res, err := poller.PollUntilDone(ctx, nil) - if err != nil { - log.Fatalf("failed to pull the result: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.Value = "\"{\"Status\":\"Successful\",\"Data\":null}\"" -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/4883fa5dbf6f2c9093fac8ce334547e9dfac68fa/specification/network/resource-manager/Microsoft.Network/stable/2024-03-01/examples/VirtualNetworkGatewayConnectionGetIkeSas.json -func ExampleVirtualNetworkGatewayConnectionsClient_BeginGetIkeSas() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armnetwork.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewVirtualNetworkGatewayConnectionsClient().BeginGetIkeSas(ctx, "rg1", "vpngwcn1", nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - res, err := poller.PollUntilDone(ctx, nil) - if err != nil { - log.Fatalf("failed to pull the result: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.Value = "\"{\"Status\":\"Successful\",\"Data\":null}\"" -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/4883fa5dbf6f2c9093fac8ce334547e9dfac68fa/specification/network/resource-manager/Microsoft.Network/stable/2024-03-01/examples/VirtualNetworkGatewayConnectionReset.json -func ExampleVirtualNetworkGatewayConnectionsClient_BeginResetConnection() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armnetwork.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewVirtualNetworkGatewayConnectionsClient().BeginResetConnection(ctx, "rg1", "conn1", nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - _, err = poller.PollUntilDone(ctx, nil) - if err != nil { - log.Fatalf("failed to pull the result: %v", err) - } -} diff --git a/sdk/resourcemanager/network/armnetwork/virtualnetworkgatewaynatrules_client_example_test.go b/sdk/resourcemanager/network/armnetwork/virtualnetworkgatewaynatrules_client_example_test.go deleted file mode 100644 index 92c7b9b8f900..000000000000 --- a/sdk/resourcemanager/network/armnetwork/virtualnetworkgatewaynatrules_client_example_test.go +++ /dev/null @@ -1,169 +0,0 @@ -//go:build go1.18 -// +build go1.18 - -// 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. -// DO NOT EDIT. - -package armnetwork_test - -import ( - "context" - "log" - - "github.com/Azure/azure-sdk-for-go/sdk/azcore/to" - "github.com/Azure/azure-sdk-for-go/sdk/azidentity" - "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/network/armnetwork/v6" -) - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/4883fa5dbf6f2c9093fac8ce334547e9dfac68fa/specification/network/resource-manager/Microsoft.Network/stable/2024-03-01/examples/VirtualNetworkGatewayNatRuleGet.json -func ExampleVirtualNetworkGatewayNatRulesClient_Get() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armnetwork.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewVirtualNetworkGatewayNatRulesClient().Get(ctx, "rg1", "gateway1", "natRule1", nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.VirtualNetworkGatewayNatRule = armnetwork.VirtualNetworkGatewayNatRule{ - // ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/virtualNetworkGateways/gateway1/natRules/natRule1"), - // Name: to.Ptr("natRule1"), - // Etag: to.Ptr("w/\\00000000-0000-0000-0000-000000000000\\"), - // Properties: &armnetwork.VirtualNetworkGatewayNatRuleProperties{ - // Type: to.Ptr(armnetwork.VPNNatRuleTypeStatic), - // ExternalMappings: []*armnetwork.VPNNatRuleMapping{ - // { - // AddressSpace: to.Ptr("50.4.0.0/24"), - // PortRange: to.Ptr("200-200"), - // }}, - // InternalMappings: []*armnetwork.VPNNatRuleMapping{ - // { - // AddressSpace: to.Ptr("10.4.0.0/24"), - // PortRange: to.Ptr("100-100"), - // }}, - // IPConfigurationID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/virtualNetworkGateways/gateway1/ipConfigurations/default"), - // Mode: to.Ptr(armnetwork.VPNNatRuleModeEgressSnat), - // ProvisioningState: to.Ptr(armnetwork.ProvisioningStateSucceeded), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/4883fa5dbf6f2c9093fac8ce334547e9dfac68fa/specification/network/resource-manager/Microsoft.Network/stable/2024-03-01/examples/VirtualNetworkGatewayNatRulePut.json -func ExampleVirtualNetworkGatewayNatRulesClient_BeginCreateOrUpdate() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armnetwork.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewVirtualNetworkGatewayNatRulesClient().BeginCreateOrUpdate(ctx, "rg1", "gateway1", "natRule1", armnetwork.VirtualNetworkGatewayNatRule{ - Properties: &armnetwork.VirtualNetworkGatewayNatRuleProperties{ - Type: to.Ptr(armnetwork.VPNNatRuleTypeStatic), - ExternalMappings: []*armnetwork.VPNNatRuleMapping{ - { - AddressSpace: to.Ptr("192.168.21.0/24"), - PortRange: to.Ptr("300-400"), - }}, - InternalMappings: []*armnetwork.VPNNatRuleMapping{ - { - AddressSpace: to.Ptr("10.4.0.0/24"), - PortRange: to.Ptr("200-300"), - }}, - IPConfigurationID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/virtualNetworkGateways/gateway1/ipConfigurations/default"), - Mode: to.Ptr(armnetwork.VPNNatRuleModeEgressSnat), - }, - }, nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - res, err := poller.PollUntilDone(ctx, nil) - if err != nil { - log.Fatalf("failed to pull the result: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.VirtualNetworkGatewayNatRule = armnetwork.VirtualNetworkGatewayNatRule{ - // ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/virtualNetworkGateways/gateway1/natRules/natRule1"), - // Name: to.Ptr("natRule1"), - // Etag: to.Ptr("w/\\00000000-0000-0000-0000-000000000000\\"), - // Properties: &armnetwork.VirtualNetworkGatewayNatRuleProperties{ - // Type: to.Ptr(armnetwork.VPNNatRuleTypeStatic), - // ExternalMappings: []*armnetwork.VPNNatRuleMapping{ - // { - // AddressSpace: to.Ptr("192.168.21.0/24"), - // PortRange: to.Ptr("300-400"), - // }}, - // InternalMappings: []*armnetwork.VPNNatRuleMapping{ - // { - // AddressSpace: to.Ptr("10.4.0.0/24"), - // PortRange: to.Ptr("200-300"), - // }}, - // IPConfigurationID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/virtualNetworkGateways/gateway1/ipConfigurations/default"), - // Mode: to.Ptr(armnetwork.VPNNatRuleModeEgressSnat), - // ProvisioningState: to.Ptr(armnetwork.ProvisioningStateSucceeded), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/4883fa5dbf6f2c9093fac8ce334547e9dfac68fa/specification/network/resource-manager/Microsoft.Network/stable/2024-03-01/examples/VirtualNetworkGatewayNatRuleDelete.json -func ExampleVirtualNetworkGatewayNatRulesClient_BeginDelete() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armnetwork.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewVirtualNetworkGatewayNatRulesClient().BeginDelete(ctx, "rg1", "gateway1", "natRule1", nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - _, err = poller.PollUntilDone(ctx, nil) - if err != nil { - log.Fatalf("failed to pull the result: %v", err) - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/4883fa5dbf6f2c9093fac8ce334547e9dfac68fa/specification/network/resource-manager/Microsoft.Network/stable/2024-03-01/examples/VirtualNetworkGatewayNatRuleList.json -func ExampleVirtualNetworkGatewayNatRulesClient_NewListByVirtualNetworkGatewayPager() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armnetwork.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := clientFactory.NewVirtualNetworkGatewayNatRulesClient().NewListByVirtualNetworkGatewayPager("rg1", "gateway1", nil) - for pager.More() { - page, err := pager.NextPage(ctx) - if err != nil { - log.Fatalf("failed to advance page: %v", err) - } - for _, v := range page.Value { - // You could use page here. We use blank identifier for just demo purposes. - _ = v - } - // If the HTTP response code is 200 as defined in example definition, your page structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // page.ListVirtualNetworkGatewayNatRulesResult = armnetwork.ListVirtualNetworkGatewayNatRulesResult{ - // } - } -} diff --git a/sdk/resourcemanager/network/armnetwork/virtualnetworkgateways_client_example_test.go b/sdk/resourcemanager/network/armnetwork/virtualnetworkgateways_client_example_test.go deleted file mode 100644 index 08465e953366..000000000000 --- a/sdk/resourcemanager/network/armnetwork/virtualnetworkgateways_client_example_test.go +++ /dev/null @@ -1,1587 +0,0 @@ -//go:build go1.18 -// +build go1.18 - -// 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. -// DO NOT EDIT. - -package armnetwork_test - -import ( - "context" - "log" - - "github.com/Azure/azure-sdk-for-go/sdk/azcore/to" - "github.com/Azure/azure-sdk-for-go/sdk/azidentity" - "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/network/armnetwork/v6" -) - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/4883fa5dbf6f2c9093fac8ce334547e9dfac68fa/specification/network/resource-manager/Microsoft.Network/stable/2024-03-01/examples/VirtualNetworkGatewayUpdate.json -func ExampleVirtualNetworkGatewaysClient_BeginCreateOrUpdate_updateVirtualNetworkGateway() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armnetwork.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewVirtualNetworkGatewaysClient().BeginCreateOrUpdate(ctx, "rg1", "vpngw", armnetwork.VirtualNetworkGateway{ - Location: to.Ptr("centralus"), - Properties: &armnetwork.VirtualNetworkGatewayPropertiesFormat{ - Active: to.Ptr(false), - AllowRemoteVnetTraffic: to.Ptr(false), - AllowVirtualWanTraffic: to.Ptr(false), - BgpSettings: &armnetwork.BgpSettings{ - Asn: to.Ptr[int64](65515), - BgpPeeringAddress: to.Ptr("10.0.1.30"), - PeerWeight: to.Ptr[int32](0), - }, - CustomRoutes: &armnetwork.AddressSpace{ - AddressPrefixes: []*string{ - to.Ptr("101.168.0.6/32")}, - }, - DisableIPSecReplayProtection: to.Ptr(false), - EnableBgp: to.Ptr(false), - EnableBgpRouteTranslationForNat: to.Ptr(false), - EnableDNSForwarding: to.Ptr(true), - GatewayType: to.Ptr(armnetwork.VirtualNetworkGatewayTypeVPN), - IPConfigurations: []*armnetwork.VirtualNetworkGatewayIPConfiguration{ - { - Name: to.Ptr("gwipconfig1"), - Properties: &armnetwork.VirtualNetworkGatewayIPConfigurationPropertiesFormat{ - PrivateIPAllocationMethod: to.Ptr(armnetwork.IPAllocationMethodDynamic), - PublicIPAddress: &armnetwork.SubResource{ - ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/publicIPAddresses/gwpip"), - }, - Subnet: &armnetwork.SubResource{ - ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/virtualNetworks/vnet1/subnets/GatewaySubnet"), - }, - }, - }}, - NatRules: []*armnetwork.VirtualNetworkGatewayNatRule{ - { - ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/virtualNetworkGateways/vpngw/natRules/natRule1"), - Name: to.Ptr("natRule1"), - Properties: &armnetwork.VirtualNetworkGatewayNatRuleProperties{ - Type: to.Ptr(armnetwork.VPNNatRuleTypeStatic), - ExternalMappings: []*armnetwork.VPNNatRuleMapping{ - { - AddressSpace: to.Ptr("50.0.0.0/24"), - }}, - InternalMappings: []*armnetwork.VPNNatRuleMapping{ - { - AddressSpace: to.Ptr("10.10.0.0/24"), - }}, - IPConfigurationID: to.Ptr(""), - Mode: to.Ptr(armnetwork.VPNNatRuleModeEgressSnat), - }, - }, - { - ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/virtualNetworkGateways/vpngw/natRules/natRule2"), - Name: to.Ptr("natRule2"), - Properties: &armnetwork.VirtualNetworkGatewayNatRuleProperties{ - Type: to.Ptr(armnetwork.VPNNatRuleTypeStatic), - ExternalMappings: []*armnetwork.VPNNatRuleMapping{ - { - AddressSpace: to.Ptr("30.0.0.0/24"), - }}, - InternalMappings: []*armnetwork.VPNNatRuleMapping{ - { - AddressSpace: to.Ptr("20.10.0.0/24"), - }}, - IPConfigurationID: to.Ptr(""), - Mode: to.Ptr(armnetwork.VPNNatRuleModeIngressSnat), - }, - }}, - SKU: &armnetwork.VirtualNetworkGatewaySKU{ - Name: to.Ptr(armnetwork.VirtualNetworkGatewaySKUNameVPNGw1), - Tier: to.Ptr(armnetwork.VirtualNetworkGatewaySKUTierVPNGw1), - }, - VPNClientConfiguration: &armnetwork.VPNClientConfiguration{ - RadiusServers: []*armnetwork.RadiusServer{ - { - RadiusServerAddress: to.Ptr("10.2.0.0"), - RadiusServerScore: to.Ptr[int64](20), - RadiusServerSecret: to.Ptr("radiusServerSecret"), - }}, - VPNClientProtocols: []*armnetwork.VPNClientProtocol{ - to.Ptr(armnetwork.VPNClientProtocolOpenVPN)}, - VPNClientRevokedCertificates: []*armnetwork.VPNClientRevokedCertificate{}, - VPNClientRootCertificates: []*armnetwork.VPNClientRootCertificate{}, - }, - VPNType: to.Ptr(armnetwork.VPNTypeRouteBased), - }, - }, nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - res, err := poller.PollUntilDone(ctx, nil) - if err != nil { - log.Fatalf("failed to pull the result: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.VirtualNetworkGateway = armnetwork.VirtualNetworkGateway{ - // Name: to.Ptr("vpngw"), - // Type: to.Ptr("Microsoft.Network/virtualNetworkGateways"), - // ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/virtualNetworkGateways/vpngw"), - // Location: to.Ptr("centralus"), - // Etag: to.Ptr("W/\"00000000-0000-0000-0000-000000000000\""), - // Properties: &armnetwork.VirtualNetworkGatewayPropertiesFormat{ - // Active: to.Ptr(false), - // AllowRemoteVnetTraffic: to.Ptr(false), - // AllowVirtualWanTraffic: to.Ptr(false), - // BgpSettings: &armnetwork.BgpSettings{ - // Asn: to.Ptr[int64](65515), - // BgpPeeringAddress: to.Ptr("10.0.1.30"), - // BgpPeeringAddresses: []*armnetwork.IPConfigurationBgpPeeringAddress{ - // { - // CustomBgpIPAddresses: []*string{ - // to.Ptr("169.254.21.10")}, - // DefaultBgpIPAddresses: []*string{ - // to.Ptr("10.3.1.254")}, - // IPConfigurationID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/virtualNetworkGateways/vpngw/ipConfigurations/gwipconfig1"), - // TunnelIPAddresses: []*string{ - // to.Ptr("52.161.10.135")}, - // }}, - // PeerWeight: to.Ptr[int32](0), - // }, - // CustomRoutes: &armnetwork.AddressSpace{ - // AddressPrefixes: []*string{ - // to.Ptr("101.168.0.6/32")}, - // }, - // DisableIPSecReplayProtection: to.Ptr(false), - // EnableBgp: to.Ptr(false), - // EnableBgpRouteTranslationForNat: to.Ptr(false), - // EnableDNSForwarding: to.Ptr(true), - // GatewayType: to.Ptr(armnetwork.VirtualNetworkGatewayTypeVPN), - // InboundDNSForwardingEndpoint: to.Ptr("10.0.1.14"), - // IPConfigurations: []*armnetwork.VirtualNetworkGatewayIPConfiguration{ - // { - // ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/virtualNetworkGateways/vpngw/ipConfigurations/gwipconfig1"), - // Name: to.Ptr("gwipconfig1"), - // Etag: to.Ptr("W/\"00000000-0000-0000-0000-000000000000\""), - // Properties: &armnetwork.VirtualNetworkGatewayIPConfigurationPropertiesFormat{ - // PrivateIPAllocationMethod: to.Ptr(armnetwork.IPAllocationMethodDynamic), - // ProvisioningState: to.Ptr(armnetwork.ProvisioningStateSucceeded), - // PublicIPAddress: &armnetwork.SubResource{ - // ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/publicIPAddresses/gwpip"), - // }, - // Subnet: &armnetwork.SubResource{ - // ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/virtualNetworks/vnet1/subnets/GatewaySubnet"), - // }, - // }, - // }}, - // NatRules: []*armnetwork.VirtualNetworkGatewayNatRule{ - // { - // ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/virtualNetworkGateways/vpngw/natRules/natRule1"), - // Name: to.Ptr("natRule1"), - // Properties: &armnetwork.VirtualNetworkGatewayNatRuleProperties{ - // Type: to.Ptr(armnetwork.VPNNatRuleTypeStatic), - // ExternalMappings: []*armnetwork.VPNNatRuleMapping{ - // { - // AddressSpace: to.Ptr("50.0.0.0/24"), - // }}, - // InternalMappings: []*armnetwork.VPNNatRuleMapping{ - // { - // AddressSpace: to.Ptr("10.10.0.0/24"), - // }}, - // IPConfigurationID: to.Ptr(""), - // Mode: to.Ptr(armnetwork.VPNNatRuleModeEgressSnat), - // }, - // }, - // { - // ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/virtualNetworkGateways/vpngw/natRules/natRule2"), - // Name: to.Ptr("natRule2"), - // Properties: &armnetwork.VirtualNetworkGatewayNatRuleProperties{ - // Type: to.Ptr(armnetwork.VPNNatRuleTypeStatic), - // ExternalMappings: []*armnetwork.VPNNatRuleMapping{ - // { - // AddressSpace: to.Ptr("30.0.0.0/24"), - // }}, - // InternalMappings: []*armnetwork.VPNNatRuleMapping{ - // { - // AddressSpace: to.Ptr("20.10.0.0/24"), - // }}, - // IPConfigurationID: to.Ptr(""), - // Mode: to.Ptr(armnetwork.VPNNatRuleModeIngressSnat), - // }, - // }}, - // ProvisioningState: to.Ptr(armnetwork.ProvisioningStateSucceeded), - // ResourceGUID: to.Ptr("00000000-0000-0000-0000-000000000000"), - // SKU: &armnetwork.VirtualNetworkGatewaySKU{ - // Name: to.Ptr(armnetwork.VirtualNetworkGatewaySKUNameVPNGw1), - // Capacity: to.Ptr[int32](0), - // Tier: to.Ptr(armnetwork.VirtualNetworkGatewaySKUTierVPNGw1), - // }, - // VPNClientConfiguration: &armnetwork.VPNClientConfiguration{ - // RadiusServers: []*armnetwork.RadiusServer{ - // { - // RadiusServerAddress: to.Ptr("10.2.0.0"), - // RadiusServerScore: to.Ptr[int64](20), - // }}, - // VPNClientProtocols: []*armnetwork.VPNClientProtocol{ - // to.Ptr(armnetwork.VPNClientProtocolOpenVPN)}, - // VPNClientRevokedCertificates: []*armnetwork.VPNClientRevokedCertificate{ - // }, - // VPNClientRootCertificates: []*armnetwork.VPNClientRootCertificate{ - // }, - // }, - // VPNGatewayGeneration: to.Ptr(armnetwork.VPNGatewayGenerationNone), - // VPNType: to.Ptr(armnetwork.VPNTypeRouteBased), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/4883fa5dbf6f2c9093fac8ce334547e9dfac68fa/specification/network/resource-manager/Microsoft.Network/stable/2024-03-01/examples/VirtualNetworkScalableGatewayUpdate.json -func ExampleVirtualNetworkGatewaysClient_BeginCreateOrUpdate_updateVirtualNetworkScalableGateway() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armnetwork.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewVirtualNetworkGatewaysClient().BeginCreateOrUpdate(ctx, "rg1", "ergw", armnetwork.VirtualNetworkGateway{ - Location: to.Ptr("centralus"), - Properties: &armnetwork.VirtualNetworkGatewayPropertiesFormat{ - Active: to.Ptr(false), - AllowRemoteVnetTraffic: to.Ptr(false), - AllowVirtualWanTraffic: to.Ptr(false), - DisableIPSecReplayProtection: to.Ptr(false), - EnableBgp: to.Ptr(false), - EnableBgpRouteTranslationForNat: to.Ptr(false), - GatewayType: to.Ptr(armnetwork.VirtualNetworkGatewayTypeExpressRoute), - IPConfigurations: []*armnetwork.VirtualNetworkGatewayIPConfiguration{ - { - Name: to.Ptr("gwipconfig1"), - Properties: &armnetwork.VirtualNetworkGatewayIPConfigurationPropertiesFormat{ - PrivateIPAllocationMethod: to.Ptr(armnetwork.IPAllocationMethodStatic), - PublicIPAddress: &armnetwork.SubResource{ - ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/publicIPAddresses/gwpip"), - }, - Subnet: &armnetwork.SubResource{ - ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/virtualNetworks/vnet1/subnets/GatewaySubnet"), - }, - }, - }}, - NatRules: []*armnetwork.VirtualNetworkGatewayNatRule{ - { - ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/virtualNetworkGateways/ergw/natRules/natRule1"), - Name: to.Ptr("natRule1"), - Properties: &armnetwork.VirtualNetworkGatewayNatRuleProperties{ - Type: to.Ptr(armnetwork.VPNNatRuleTypeStatic), - ExternalMappings: []*armnetwork.VPNNatRuleMapping{ - { - AddressSpace: to.Ptr("50.0.0.0/24"), - }}, - InternalMappings: []*armnetwork.VPNNatRuleMapping{ - { - AddressSpace: to.Ptr("10.10.0.0/24"), - }}, - IPConfigurationID: to.Ptr(""), - Mode: to.Ptr(armnetwork.VPNNatRuleModeEgressSnat), - }, - }, - { - ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/virtualNetworkGateways/ergw/natRules/natRule2"), - Name: to.Ptr("natRule2"), - Properties: &armnetwork.VirtualNetworkGatewayNatRuleProperties{ - Type: to.Ptr(armnetwork.VPNNatRuleTypeStatic), - ExternalMappings: []*armnetwork.VPNNatRuleMapping{ - { - AddressSpace: to.Ptr("30.0.0.0/24"), - }}, - InternalMappings: []*armnetwork.VPNNatRuleMapping{ - { - AddressSpace: to.Ptr("20.10.0.0/24"), - }}, - IPConfigurationID: to.Ptr(""), - Mode: to.Ptr(armnetwork.VPNNatRuleModeIngressSnat), - }, - }}, - SKU: &armnetwork.VirtualNetworkGatewaySKU{ - Name: to.Ptr(armnetwork.VirtualNetworkGatewaySKUNameErGwScale), - Tier: to.Ptr(armnetwork.VirtualNetworkGatewaySKUTierErGwScale), - }, - VPNType: to.Ptr(armnetwork.VPNTypePolicyBased), - }, - }, nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - res, err := poller.PollUntilDone(ctx, nil) - if err != nil { - log.Fatalf("failed to pull the result: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.VirtualNetworkGateway = armnetwork.VirtualNetworkGateway{ - // Name: to.Ptr("ergw"), - // Type: to.Ptr("Microsoft.Network/virtualNetworkGateways"), - // ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/virtualNetworkGateways/ergw"), - // Location: to.Ptr("centralus"), - // Etag: to.Ptr("W/\"00000000-0000-0000-0000-000000000000\""), - // Properties: &armnetwork.VirtualNetworkGatewayPropertiesFormat{ - // Active: to.Ptr(false), - // AllowRemoteVnetTraffic: to.Ptr(false), - // AllowVirtualWanTraffic: to.Ptr(false), - // AutoScaleConfiguration: &armnetwork.VirtualNetworkGatewayAutoScaleConfiguration{ - // Bounds: &armnetwork.VirtualNetworkGatewayAutoScaleBounds{ - // Max: to.Ptr[int32](3), - // Min: to.Ptr[int32](2), - // }, - // }, - // DisableIPSecReplayProtection: to.Ptr(false), - // EnableBgp: to.Ptr(false), - // EnableBgpRouteTranslationForNat: to.Ptr(false), - // GatewayType: to.Ptr(armnetwork.VirtualNetworkGatewayTypeExpressRoute), - // IPConfigurations: []*armnetwork.VirtualNetworkGatewayIPConfiguration{ - // { - // ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/virtualNetworkGateways/ergw/ipConfigurations/default"), - // Name: to.Ptr("gwipconfig1"), - // Etag: to.Ptr("W/\"00000000-0000-0000-0000-000000000000\""), - // Properties: &armnetwork.VirtualNetworkGatewayIPConfigurationPropertiesFormat{ - // PrivateIPAllocationMethod: to.Ptr(armnetwork.IPAllocationMethodDynamic), - // ProvisioningState: to.Ptr(armnetwork.ProvisioningStateSucceeded), - // PublicIPAddress: &armnetwork.SubResource{ - // ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/publicIPAddresses/gwpip"), - // }, - // Subnet: &armnetwork.SubResource{ - // ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/virtualNetworks/vnet1/subnets/GatewaySubnet"), - // }, - // }, - // }}, - // NatRules: []*armnetwork.VirtualNetworkGatewayNatRule{ - // { - // ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/virtualNetworkGateways/ergw/natRules/natRule1"), - // Name: to.Ptr("natRule1"), - // Properties: &armnetwork.VirtualNetworkGatewayNatRuleProperties{ - // Type: to.Ptr(armnetwork.VPNNatRuleTypeStatic), - // ExternalMappings: []*armnetwork.VPNNatRuleMapping{ - // { - // AddressSpace: to.Ptr("50.0.0.0/24"), - // }}, - // InternalMappings: []*armnetwork.VPNNatRuleMapping{ - // { - // AddressSpace: to.Ptr("10.10.0.0/24"), - // }}, - // IPConfigurationID: to.Ptr(""), - // Mode: to.Ptr(armnetwork.VPNNatRuleModeEgressSnat), - // }, - // }, - // { - // ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/virtualNetworkGateways/ergw/natRules/natRule2"), - // Name: to.Ptr("natRule2"), - // Properties: &armnetwork.VirtualNetworkGatewayNatRuleProperties{ - // Type: to.Ptr(armnetwork.VPNNatRuleTypeStatic), - // ExternalMappings: []*armnetwork.VPNNatRuleMapping{ - // { - // AddressSpace: to.Ptr("30.0.0.0/24"), - // }}, - // InternalMappings: []*armnetwork.VPNNatRuleMapping{ - // { - // AddressSpace: to.Ptr("20.10.0.0/24"), - // }}, - // IPConfigurationID: to.Ptr(""), - // Mode: to.Ptr(armnetwork.VPNNatRuleModeIngressSnat), - // }, - // }}, - // ProvisioningState: to.Ptr(armnetwork.ProvisioningStateSucceeded), - // ResourceGUID: to.Ptr("00000000-0000-0000-0000-000000000000"), - // SKU: &armnetwork.VirtualNetworkGatewaySKU{ - // Name: to.Ptr(armnetwork.VirtualNetworkGatewaySKUNameErGwScale), - // Capacity: to.Ptr[int32](0), - // Tier: to.Ptr(armnetwork.VirtualNetworkGatewaySKUTierErGwScale), - // }, - // VPNGatewayGeneration: to.Ptr(armnetwork.VPNGatewayGenerationNone), - // VPNType: to.Ptr(armnetwork.VPNTypePolicyBased), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/4883fa5dbf6f2c9093fac8ce334547e9dfac68fa/specification/network/resource-manager/Microsoft.Network/stable/2024-03-01/examples/VirtualNetworkGatewayGet.json -func ExampleVirtualNetworkGatewaysClient_Get_getVirtualNetworkGateway() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armnetwork.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewVirtualNetworkGatewaysClient().Get(ctx, "rg1", "vpngw", nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.VirtualNetworkGateway = armnetwork.VirtualNetworkGateway{ - // Name: to.Ptr("vpngw"), - // Type: to.Ptr("Microsoft.Network/virtualNetworkGateways"), - // ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/virtualNetworkGateways/vpngw"), - // Location: to.Ptr("centralus"), - // Etag: to.Ptr("W/\"00000000-0000-0000-0000-000000000000\""), - // Properties: &armnetwork.VirtualNetworkGatewayPropertiesFormat{ - // Active: to.Ptr(false), - // AllowRemoteVnetTraffic: to.Ptr(false), - // AllowVirtualWanTraffic: to.Ptr(false), - // BgpSettings: &armnetwork.BgpSettings{ - // Asn: to.Ptr[int64](65514), - // BgpPeeringAddress: to.Ptr("10.0.1.30"), - // BgpPeeringAddresses: []*armnetwork.IPConfigurationBgpPeeringAddress{ - // { - // CustomBgpIPAddresses: []*string{ - // to.Ptr("169.254.21.10")}, - // DefaultBgpIPAddresses: []*string{ - // to.Ptr("10.3.1.254")}, - // IPConfigurationID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/virtualNetworkGateways/vpngw/ipConfigurations/gwipconfig1"), - // TunnelIPAddresses: []*string{ - // to.Ptr("52.161.10.135")}, - // }}, - // PeerWeight: to.Ptr[int32](0), - // }, - // CustomRoutes: &armnetwork.AddressSpace{ - // AddressPrefixes: []*string{ - // to.Ptr("101.168.0.6/32")}, - // }, - // DisableIPSecReplayProtection: to.Ptr(false), - // EnableBgp: to.Ptr(false), - // EnableBgpRouteTranslationForNat: to.Ptr(false), - // EnablePrivateIPAddress: to.Ptr(false), - // GatewayType: to.Ptr(armnetwork.VirtualNetworkGatewayTypeVPN), - // IPConfigurations: []*armnetwork.VirtualNetworkGatewayIPConfiguration{ - // { - // ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/virtualNetworkGateways/vpngw/ipConfigurations/gwipconfig1"), - // Name: to.Ptr("gwipconfig1"), - // Etag: to.Ptr("W/\"00000000-0000-0000-0000-000000000000\""), - // Properties: &armnetwork.VirtualNetworkGatewayIPConfigurationPropertiesFormat{ - // PrivateIPAllocationMethod: to.Ptr(armnetwork.IPAllocationMethodDynamic), - // ProvisioningState: to.Ptr(armnetwork.ProvisioningStateSucceeded), - // PublicIPAddress: &armnetwork.SubResource{ - // ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/publicIPAddresses/gwpip"), - // }, - // Subnet: &armnetwork.SubResource{ - // ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/virtualNetworks/vnet1/subnets/GatewaySubnet"), - // }, - // }, - // }}, - // NatRules: []*armnetwork.VirtualNetworkGatewayNatRule{ - // { - // ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/virtualNetworkGateways/vpngw/natRules/natRule1"), - // Name: to.Ptr("natRule1"), - // Etag: to.Ptr("W/\"00ae2b69-88e7-4b3a-b66a-cfa2244e0801\""), - // Properties: &armnetwork.VirtualNetworkGatewayNatRuleProperties{ - // Type: to.Ptr(armnetwork.VPNNatRuleTypeStatic), - // ExternalMappings: []*armnetwork.VPNNatRuleMapping{ - // { - // AddressSpace: to.Ptr("50.0.0.0/24"), - // }}, - // InternalMappings: []*armnetwork.VPNNatRuleMapping{ - // { - // AddressSpace: to.Ptr("10.10.0.0/24"), - // }}, - // Mode: to.Ptr(armnetwork.VPNNatRuleModeEgressSnat), - // ProvisioningState: to.Ptr(armnetwork.ProvisioningStateSucceeded), - // }, - // }, - // { - // ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/virtualNetworkGateways/vpngw/natRules/natRule2"), - // Name: to.Ptr("natRule2"), - // Etag: to.Ptr("W/\"00ae2b69-88e7-4b3a-b66a-cfa2244e0801\""), - // Properties: &armnetwork.VirtualNetworkGatewayNatRuleProperties{ - // Type: to.Ptr(armnetwork.VPNNatRuleTypeStatic), - // ExternalMappings: []*armnetwork.VPNNatRuleMapping{ - // { - // AddressSpace: to.Ptr("30.0.0.0/24"), - // }}, - // InternalMappings: []*armnetwork.VPNNatRuleMapping{ - // { - // AddressSpace: to.Ptr("20.10.0.0/24"), - // }}, - // Mode: to.Ptr(armnetwork.VPNNatRuleModeIngressSnat), - // ProvisioningState: to.Ptr(armnetwork.ProvisioningStateSucceeded), - // }, - // }}, - // ProvisioningState: to.Ptr(armnetwork.ProvisioningStateSucceeded), - // ResourceGUID: to.Ptr("00000000-0000-0000-0000-000000000000"), - // SKU: &armnetwork.VirtualNetworkGatewaySKU{ - // Name: to.Ptr(armnetwork.VirtualNetworkGatewaySKUNameVPNGw1), - // Capacity: to.Ptr[int32](0), - // Tier: to.Ptr(armnetwork.VirtualNetworkGatewaySKUTierVPNGw1), - // }, - // VPNClientConfiguration: &armnetwork.VPNClientConfiguration{ - // RadiusServers: []*armnetwork.RadiusServer{ - // { - // RadiusServerAddress: to.Ptr("10.1.0.0"), - // RadiusServerScore: to.Ptr[int64](20), - // }}, - // VPNClientProtocols: []*armnetwork.VPNClientProtocol{ - // to.Ptr(armnetwork.VPNClientProtocolOpenVPN)}, - // VPNClientRevokedCertificates: []*armnetwork.VPNClientRevokedCertificate{ - // }, - // VPNClientRootCertificates: []*armnetwork.VPNClientRootCertificate{ - // }, - // }, - // VPNGatewayGeneration: to.Ptr(armnetwork.VPNGatewayGenerationNone), - // VPNType: to.Ptr(armnetwork.VPNTypeRouteBased), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/4883fa5dbf6f2c9093fac8ce334547e9dfac68fa/specification/network/resource-manager/Microsoft.Network/stable/2024-03-01/examples/VirtualNetworkScalableGatewayGet.json -func ExampleVirtualNetworkGatewaysClient_Get_getVirtualNetworkScalableGateway() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armnetwork.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewVirtualNetworkGatewaysClient().Get(ctx, "rg1", "ergw", nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.VirtualNetworkGateway = armnetwork.VirtualNetworkGateway{ - // Name: to.Ptr("ergw"), - // Type: to.Ptr("Microsoft.Network/virtualNetworkGateways"), - // ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/virtualNetworkGateways/ergw"), - // Location: to.Ptr("centralus"), - // Etag: to.Ptr("W/\"00000000-0000-0000-0000-000000000000\""), - // Properties: &armnetwork.VirtualNetworkGatewayPropertiesFormat{ - // Active: to.Ptr(false), - // AllowRemoteVnetTraffic: to.Ptr(false), - // AllowVirtualWanTraffic: to.Ptr(false), - // AutoScaleConfiguration: &armnetwork.VirtualNetworkGatewayAutoScaleConfiguration{ - // Bounds: &armnetwork.VirtualNetworkGatewayAutoScaleBounds{ - // Max: to.Ptr[int32](3), - // Min: to.Ptr[int32](2), - // }, - // }, - // DisableIPSecReplayProtection: to.Ptr(false), - // EnableBgp: to.Ptr(false), - // EnableBgpRouteTranslationForNat: to.Ptr(false), - // EnablePrivateIPAddress: to.Ptr(false), - // GatewayType: to.Ptr(armnetwork.VirtualNetworkGatewayTypeExpressRoute), - // IPConfigurations: []*armnetwork.VirtualNetworkGatewayIPConfiguration{ - // { - // ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/virtualNetworkGateways/ergw/ipConfigurations/default"), - // Name: to.Ptr("gwipconfig1"), - // Etag: to.Ptr("W/\"00000000-0000-0000-0000-000000000000\""), - // Properties: &armnetwork.VirtualNetworkGatewayIPConfigurationPropertiesFormat{ - // PrivateIPAllocationMethod: to.Ptr(armnetwork.IPAllocationMethodStatic), - // ProvisioningState: to.Ptr(armnetwork.ProvisioningStateSucceeded), - // PublicIPAddress: &armnetwork.SubResource{ - // ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/publicIPAddresses/gwpip"), - // }, - // Subnet: &armnetwork.SubResource{ - // ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/virtualNetworks/vnet1/subnets/GatewaySubnet"), - // }, - // }, - // }}, - // NatRules: []*armnetwork.VirtualNetworkGatewayNatRule{ - // { - // ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/virtualNetworkGateways/ergw/natRules/natRule1"), - // Name: to.Ptr("natRule1"), - // Etag: to.Ptr("W/\"00ae2b69-88e7-4b3a-b66a-cfa2244e0801\""), - // Properties: &armnetwork.VirtualNetworkGatewayNatRuleProperties{ - // Type: to.Ptr(armnetwork.VPNNatRuleTypeStatic), - // ExternalMappings: []*armnetwork.VPNNatRuleMapping{ - // { - // AddressSpace: to.Ptr("50.0.0.0/24"), - // }}, - // InternalMappings: []*armnetwork.VPNNatRuleMapping{ - // { - // AddressSpace: to.Ptr("10.10.0.0/24"), - // }}, - // Mode: to.Ptr(armnetwork.VPNNatRuleModeEgressSnat), - // ProvisioningState: to.Ptr(armnetwork.ProvisioningStateSucceeded), - // }, - // }, - // { - // ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/virtualNetworkGateways/ergw/natRules/natRule2"), - // Name: to.Ptr("natRule2"), - // Etag: to.Ptr("W/\"00ae2b69-88e7-4b3a-b66a-cfa2244e0801\""), - // Properties: &armnetwork.VirtualNetworkGatewayNatRuleProperties{ - // Type: to.Ptr(armnetwork.VPNNatRuleTypeStatic), - // ExternalMappings: []*armnetwork.VPNNatRuleMapping{ - // { - // AddressSpace: to.Ptr("30.0.0.0/24"), - // }}, - // InternalMappings: []*armnetwork.VPNNatRuleMapping{ - // { - // AddressSpace: to.Ptr("20.10.0.0/24"), - // }}, - // Mode: to.Ptr(armnetwork.VPNNatRuleModeIngressSnat), - // ProvisioningState: to.Ptr(armnetwork.ProvisioningStateSucceeded), - // }, - // }}, - // ProvisioningState: to.Ptr(armnetwork.ProvisioningStateSucceeded), - // ResourceGUID: to.Ptr("00000000-0000-0000-0000-000000000000"), - // SKU: &armnetwork.VirtualNetworkGatewaySKU{ - // Name: to.Ptr(armnetwork.VirtualNetworkGatewaySKUNameErGwScale), - // Capacity: to.Ptr[int32](2), - // Tier: to.Ptr(armnetwork.VirtualNetworkGatewaySKUTierErGwScale), - // }, - // VPNGatewayGeneration: to.Ptr(armnetwork.VPNGatewayGenerationNone), - // VPNType: to.Ptr(armnetwork.VPNTypePolicyBased), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/4883fa5dbf6f2c9093fac8ce334547e9dfac68fa/specification/network/resource-manager/Microsoft.Network/stable/2024-03-01/examples/VirtualNetworkGatewayDelete.json -func ExampleVirtualNetworkGatewaysClient_BeginDelete() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armnetwork.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewVirtualNetworkGatewaysClient().BeginDelete(ctx, "rg1", "vpngw", nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - _, err = poller.PollUntilDone(ctx, nil) - if err != nil { - log.Fatalf("failed to pull the result: %v", err) - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/4883fa5dbf6f2c9093fac8ce334547e9dfac68fa/specification/network/resource-manager/Microsoft.Network/stable/2024-03-01/examples/VirtualNetworkGatewayUpdateTags.json -func ExampleVirtualNetworkGatewaysClient_BeginUpdateTags() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armnetwork.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewVirtualNetworkGatewaysClient().BeginUpdateTags(ctx, "rg1", "vpngw", armnetwork.TagsObject{ - Tags: map[string]*string{ - "tag1": to.Ptr("value1"), - "tag2": to.Ptr("value2"), - }, - }, nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - res, err := poller.PollUntilDone(ctx, nil) - if err != nil { - log.Fatalf("failed to pull the result: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.VirtualNetworkGateway = armnetwork.VirtualNetworkGateway{ - // Name: to.Ptr("vpngw"), - // Type: to.Ptr("Microsoft.Network/virtualNetworkGateways"), - // ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/virtualNetworkGateways/vpngw"), - // Location: to.Ptr("westus"), - // Tags: map[string]*string{ - // "tag1": to.Ptr("value1"), - // "tag2": to.Ptr("value2"), - // }, - // Identity: &armnetwork.ManagedServiceIdentity{ - // Type: to.Ptr(armnetwork.ResourceIdentityTypeUserAssigned), - // UserAssignedIdentities: map[string]*armnetwork.Components1Jq1T4ISchemasManagedserviceidentityPropertiesUserassignedidentitiesAdditionalproperties{ - // "/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.ManagedIdentity/userAssignedIdentities/identity1": &armnetwork.Components1Jq1T4ISchemasManagedserviceidentityPropertiesUserassignedidentitiesAdditionalproperties{ - // }, - // }, - // }, - // Properties: &armnetwork.VirtualNetworkGatewayPropertiesFormat{ - // Active: to.Ptr(false), - // AllowRemoteVnetTraffic: to.Ptr(false), - // AllowVirtualWanTraffic: to.Ptr(false), - // BgpSettings: &armnetwork.BgpSettings{ - // Asn: to.Ptr[int64](65515), - // BgpPeeringAddress: to.Ptr("10.0.0.254"), - // BgpPeeringAddresses: []*armnetwork.IPConfigurationBgpPeeringAddress{ - // { - // CustomBgpIPAddresses: []*string{ - // to.Ptr("169.254.21.10")}, - // DefaultBgpIPAddresses: []*string{ - // to.Ptr("10.3.1.254")}, - // IPConfigurationID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/virtualNetworkGateways/vpngw/ipConfigurations/gwipconfig1"), - // TunnelIPAddresses: []*string{ - // to.Ptr("52.161.10.135")}, - // }}, - // PeerWeight: to.Ptr[int32](0), - // }, - // CustomRoutes: &armnetwork.AddressSpace{ - // AddressPrefixes: []*string{ - // to.Ptr("101.168.0.6/32")}, - // }, - // DisableIPSecReplayProtection: to.Ptr(false), - // EnableBgp: to.Ptr(false), - // EnableBgpRouteTranslationForNat: to.Ptr(false), - // GatewayType: to.Ptr(armnetwork.VirtualNetworkGatewayTypeVPN), - // IPConfigurations: []*armnetwork.VirtualNetworkGatewayIPConfiguration{ - // { - // ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/virtualNetworkGateways/vpngw/ipConfigurations/default"), - // Name: to.Ptr("default"), - // Properties: &armnetwork.VirtualNetworkGatewayIPConfigurationPropertiesFormat{ - // PrivateIPAllocationMethod: to.Ptr(armnetwork.IPAllocationMethodDynamic), - // ProvisioningState: to.Ptr(armnetwork.ProvisioningStateSucceeded), - // PublicIPAddress: &armnetwork.SubResource{ - // ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/publicIPAddresses/testpub1"), - // }, - // Subnet: &armnetwork.SubResource{ - // ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/virtualNetworks/vnet2/subnets/GatewaySubnet"), - // }, - // }, - // }}, - // NatRules: []*armnetwork.VirtualNetworkGatewayNatRule{ - // }, - // ProvisioningState: to.Ptr(armnetwork.ProvisioningStateSucceeded), - // ResourceGUID: to.Ptr("00000000-0000-0000-0000-000000000000"), - // SKU: &armnetwork.VirtualNetworkGatewaySKU{ - // Name: to.Ptr(armnetwork.VirtualNetworkGatewaySKUNameVPNGw1), - // Capacity: to.Ptr[int32](2), - // Tier: to.Ptr(armnetwork.VirtualNetworkGatewaySKUTierVPNGw1), - // }, - // VPNGatewayGeneration: to.Ptr(armnetwork.VPNGatewayGenerationNone), - // VPNType: to.Ptr(armnetwork.VPNTypeRouteBased), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/4883fa5dbf6f2c9093fac8ce334547e9dfac68fa/specification/network/resource-manager/Microsoft.Network/stable/2024-03-01/examples/VirtualNetworkGatewayList.json -func ExampleVirtualNetworkGatewaysClient_NewListPager() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armnetwork.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := clientFactory.NewVirtualNetworkGatewaysClient().NewListPager("rg1", nil) - for pager.More() { - page, err := pager.NextPage(ctx) - if err != nil { - log.Fatalf("failed to advance page: %v", err) - } - for _, v := range page.Value { - // You could use page here. We use blank identifier for just demo purposes. - _ = v - } - // If the HTTP response code is 200 as defined in example definition, your page structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // page.VirtualNetworkGatewayListResult = armnetwork.VirtualNetworkGatewayListResult{ - // Value: []*armnetwork.VirtualNetworkGateway{ - // { - // Name: to.Ptr("vpngw1"), - // Type: to.Ptr("Microsoft.Network/virtualNetworkGateways"), - // ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/virtualNetworkGateways/vpngw1"), - // Location: to.Ptr("loc1"), - // Etag: to.Ptr("W/\"00000000-0000-0000-0000-000000000000\""), - // Properties: &armnetwork.VirtualNetworkGatewayPropertiesFormat{ - // Active: to.Ptr(false), - // AllowRemoteVnetTraffic: to.Ptr(false), - // AllowVirtualWanTraffic: to.Ptr(false), - // BgpSettings: &armnetwork.BgpSettings{ - // Asn: to.Ptr[int64](65515), - // BgpPeeringAddress: to.Ptr("10.0.0.14"), - // PeerWeight: to.Ptr[int32](0), - // }, - // CustomRoutes: &armnetwork.AddressSpace{ - // AddressPrefixes: []*string{ - // to.Ptr("101.168.0.6/32")}, - // }, - // DisableIPSecReplayProtection: to.Ptr(false), - // EnableBgp: to.Ptr(false), - // EnableBgpRouteTranslationForNat: to.Ptr(false), - // EnablePrivateIPAddress: to.Ptr(false), - // GatewayType: to.Ptr(armnetwork.VirtualNetworkGatewayTypeVPN), - // IPConfigurations: []*armnetwork.VirtualNetworkGatewayIPConfiguration{ - // { - // ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/virtualNetworkGateways/vpngw1/ipConfigurations/default"), - // Name: to.Ptr("default"), - // Etag: to.Ptr("W/\"00000000-0000-0000-0000-000000000000\""), - // Properties: &armnetwork.VirtualNetworkGatewayIPConfigurationPropertiesFormat{ - // PrivateIPAllocationMethod: to.Ptr(armnetwork.IPAllocationMethodDynamic), - // ProvisioningState: to.Ptr(armnetwork.ProvisioningStateSucceeded), - // PublicIPAddress: &armnetwork.SubResource{ - // ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/publicIPAddresses/vpngw1-ip"), - // }, - // Subnet: &armnetwork.SubResource{ - // ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/virtualNetworks/vnet1/subnets/GatewaySubnet"), - // }, - // }, - // }}, - // NatRules: []*armnetwork.VirtualNetworkGatewayNatRule{ - // { - // ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/virtualNetworkGateways/vpngw1/natRules/natRule1"), - // Name: to.Ptr("natRule1"), - // Etag: to.Ptr("W/\"00ae2b69-88e7-4b3a-b66a-cfa2244e0801\""), - // Properties: &armnetwork.VirtualNetworkGatewayNatRuleProperties{ - // Type: to.Ptr(armnetwork.VPNNatRuleTypeStatic), - // ExternalMappings: []*armnetwork.VPNNatRuleMapping{ - // { - // AddressSpace: to.Ptr("50.0.0.0/24"), - // }}, - // InternalMappings: []*armnetwork.VPNNatRuleMapping{ - // { - // AddressSpace: to.Ptr("10.10.0.0/24"), - // }}, - // Mode: to.Ptr(armnetwork.VPNNatRuleModeEgressSnat), - // ProvisioningState: to.Ptr(armnetwork.ProvisioningStateSucceeded), - // }, - // }, - // { - // ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/virtualNetworkGateways/vpngw1/natRules/natRule2"), - // Name: to.Ptr("natRule2"), - // Etag: to.Ptr("W/\"00ae2b69-88e7-4b3a-b66a-cfa2244e0801\""), - // Properties: &armnetwork.VirtualNetworkGatewayNatRuleProperties{ - // Type: to.Ptr(armnetwork.VPNNatRuleTypeStatic), - // ExternalMappings: []*armnetwork.VPNNatRuleMapping{ - // { - // AddressSpace: to.Ptr("30.0.0.0/24"), - // }}, - // InternalMappings: []*armnetwork.VPNNatRuleMapping{ - // { - // AddressSpace: to.Ptr("20.10.0.0/24"), - // }}, - // Mode: to.Ptr(armnetwork.VPNNatRuleModeIngressSnat), - // ProvisioningState: to.Ptr(armnetwork.ProvisioningStateSucceeded), - // }, - // }}, - // ProvisioningState: to.Ptr(armnetwork.ProvisioningStateSucceeded), - // ResourceGUID: to.Ptr("00000000-0000-0000-0000-000000000000"), - // SKU: &armnetwork.VirtualNetworkGatewaySKU{ - // Name: to.Ptr(armnetwork.VirtualNetworkGatewaySKUNameVPNGw1), - // Capacity: to.Ptr[int32](2), - // Tier: to.Ptr(armnetwork.VirtualNetworkGatewaySKUTierVPNGw1), - // }, - // VPNClientConfiguration: &armnetwork.VPNClientConfiguration{ - // VPNClientProtocols: []*armnetwork.VPNClientProtocol{ - // }, - // VPNClientRevokedCertificates: []*armnetwork.VPNClientRevokedCertificate{ - // }, - // VPNClientRootCertificates: []*armnetwork.VPNClientRootCertificate{ - // }, - // }, - // VPNGatewayGeneration: to.Ptr(armnetwork.VPNGatewayGenerationNone), - // VPNType: to.Ptr(armnetwork.VPNTypeRouteBased), - // }, - // }, - // { - // Name: to.Ptr("vpngw2"), - // Type: to.Ptr("Microsoft.Network/virtualNetworkGateways"), - // ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/virtualNetworkGateways/vpngw2"), - // Location: to.Ptr("loc2"), - // Etag: to.Ptr("W/\"00000000-0000-0000-0000-000000000000\""), - // Properties: &armnetwork.VirtualNetworkGatewayPropertiesFormat{ - // Active: to.Ptr(false), - // AllowRemoteVnetTraffic: to.Ptr(false), - // AllowVirtualWanTraffic: to.Ptr(false), - // BgpSettings: &armnetwork.BgpSettings{ - // Asn: to.Ptr[int64](65515), - // BgpPeeringAddress: to.Ptr("10.1.0.46"), - // PeerWeight: to.Ptr[int32](0), - // }, - // CustomRoutes: &armnetwork.AddressSpace{ - // AddressPrefixes: []*string{ - // to.Ptr("101.168.0.6/32")}, - // }, - // DisableIPSecReplayProtection: to.Ptr(false), - // EnableBgp: to.Ptr(false), - // EnableBgpRouteTranslationForNat: to.Ptr(false), - // EnablePrivateIPAddress: to.Ptr(true), - // GatewayType: to.Ptr(armnetwork.VirtualNetworkGatewayTypeVPN), - // IPConfigurations: []*armnetwork.VirtualNetworkGatewayIPConfiguration{ - // { - // ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/virtualNetworkGateways/vpngw2/ipConfigurations/default"), - // Name: to.Ptr("default"), - // Etag: to.Ptr("W/\"00000000-0000-0000-0000-000000000000\""), - // Properties: &armnetwork.VirtualNetworkGatewayIPConfigurationPropertiesFormat{ - // PrivateIPAddress: to.Ptr("10.1.0.7"), - // PrivateIPAllocationMethod: to.Ptr(armnetwork.IPAllocationMethodDynamic), - // ProvisioningState: to.Ptr(armnetwork.ProvisioningStateSucceeded), - // PublicIPAddress: &armnetwork.SubResource{ - // ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/publicIPAddresses/vpngw2-ip"), - // }, - // Subnet: &armnetwork.SubResource{ - // ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/virtualNetworks/vnet2/subnets/GatewaySubnet"), - // }, - // }, - // }}, - // NatRules: []*armnetwork.VirtualNetworkGatewayNatRule{ - // { - // ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/virtualNetworkGateways/vpngw2/natRules/natRule1"), - // Name: to.Ptr("natRule1"), - // Etag: to.Ptr("W/\"00ae2b69-88e7-4b3a-b66a-cfa2244e0801\""), - // Properties: &armnetwork.VirtualNetworkGatewayNatRuleProperties{ - // Type: to.Ptr(armnetwork.VPNNatRuleTypeStatic), - // ExternalMappings: []*armnetwork.VPNNatRuleMapping{ - // { - // AddressSpace: to.Ptr("50.0.0.0/24"), - // }}, - // InternalMappings: []*armnetwork.VPNNatRuleMapping{ - // { - // AddressSpace: to.Ptr("10.10.0.0/24"), - // }}, - // Mode: to.Ptr(armnetwork.VPNNatRuleModeEgressSnat), - // ProvisioningState: to.Ptr(armnetwork.ProvisioningStateSucceeded), - // }, - // }, - // { - // ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/virtualNetworkGateways/vpngw2/natRules/natRule2"), - // Name: to.Ptr("natRule2"), - // Etag: to.Ptr("W/\"00ae2b69-88e7-4b3a-b66a-cfa2244e0801\""), - // Properties: &armnetwork.VirtualNetworkGatewayNatRuleProperties{ - // Type: to.Ptr(armnetwork.VPNNatRuleTypeStatic), - // ExternalMappings: []*armnetwork.VPNNatRuleMapping{ - // { - // AddressSpace: to.Ptr("30.0.0.0/24"), - // }}, - // InternalMappings: []*armnetwork.VPNNatRuleMapping{ - // { - // AddressSpace: to.Ptr("20.10.0.0/24"), - // }}, - // Mode: to.Ptr(armnetwork.VPNNatRuleModeIngressSnat), - // ProvisioningState: to.Ptr(armnetwork.ProvisioningStateSucceeded), - // }, - // }}, - // ProvisioningState: to.Ptr(armnetwork.ProvisioningStateSucceeded), - // ResourceGUID: to.Ptr("00000000-0000-0000-0000-000000000000"), - // SKU: &armnetwork.VirtualNetworkGatewaySKU{ - // Name: to.Ptr(armnetwork.VirtualNetworkGatewaySKUNameVPNGw1), - // Capacity: to.Ptr[int32](2), - // Tier: to.Ptr(armnetwork.VirtualNetworkGatewaySKUTierVPNGw1), - // }, - // VPNClientConfiguration: &armnetwork.VPNClientConfiguration{ - // RadiusServers: []*armnetwork.RadiusServer{ - // { - // RadiusServerAddress: to.Ptr("10.2.0.0"), - // RadiusServerScore: to.Ptr[int64](20), - // }}, - // VPNClientProtocols: []*armnetwork.VPNClientProtocol{ - // to.Ptr(armnetwork.VPNClientProtocolOpenVPN)}, - // VPNClientRevokedCertificates: []*armnetwork.VPNClientRevokedCertificate{ - // }, - // VPNClientRootCertificates: []*armnetwork.VPNClientRootCertificate{ - // }, - // }, - // VPNGatewayGeneration: to.Ptr(armnetwork.VPNGatewayGenerationNone), - // VPNType: to.Ptr(armnetwork.VPNTypeRouteBased), - // }, - // }}, - // } - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/4883fa5dbf6f2c9093fac8ce334547e9dfac68fa/specification/network/resource-manager/Microsoft.Network/stable/2024-03-01/examples/VirtualNetworkGatewaysListConnections.json -func ExampleVirtualNetworkGatewaysClient_NewListConnectionsPager() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armnetwork.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := clientFactory.NewVirtualNetworkGatewaysClient().NewListConnectionsPager("testrg", "test-vpn-gateway-1", nil) - for pager.More() { - page, err := pager.NextPage(ctx) - if err != nil { - log.Fatalf("failed to advance page: %v", err) - } - for _, v := range page.Value { - // You could use page here. We use blank identifier for just demo purposes. - _ = v - } - // If the HTTP response code is 200 as defined in example definition, your page structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // page.VirtualNetworkGatewayListConnectionsResult = armnetwork.VirtualNetworkGatewayListConnectionsResult{ - // Value: []*armnetwork.VirtualNetworkGatewayConnectionListEntity{ - // { - // Name: to.Ptr("test-vpn-connection"), - // Type: to.Ptr("Microsoft.Network/connections"), - // ID: to.Ptr("/subscriptions/subid/resourceGroups/testrg/providers/Microsoft.Network/connections/test-vpn-connection"), - // Location: to.Ptr("eastus"), - // Etag: to.Ptr("W/\\\"00000000-0000-0000-0000-000000000000\\\""), - // Properties: &armnetwork.VirtualNetworkGatewayConnectionListEntityPropertiesFormat{ - // ConnectionType: to.Ptr(armnetwork.VirtualNetworkGatewayConnectionTypeVnet2Vnet), - // EgressBytesTransferred: to.Ptr[int64](0), - // EnableBgp: to.Ptr(true), - // IngressBytesTransferred: to.Ptr[int64](0), - // IPSecPolicies: []*armnetwork.IPSecPolicy{ - // }, - // ProvisioningState: to.Ptr(armnetwork.ProvisioningStateSucceeded), - // ResourceGUID: to.Ptr("00000000-0000-0000-0000-000000000000"), - // RoutingWeight: to.Ptr[int32](22), - // TrafficSelectorPolicies: []*armnetwork.TrafficSelectorPolicy{ - // }, - // UsePolicyBasedTrafficSelectors: to.Ptr(false), - // VirtualNetworkGateway1: &armnetwork.VirtualNetworkConnectionGatewayReference{ - // ID: to.Ptr("/subscriptions/subid/resourceGroups/testrg/providers/Microsoft.Network/virtualNetworkGateways/test-vpn-gateway-1"), - // }, - // VirtualNetworkGateway2: &armnetwork.VirtualNetworkConnectionGatewayReference{ - // ID: to.Ptr("/subscriptions/subid/resourceGroups/testrg-2/providers/Microsoft.Network/virtualNetworkGateways/test-vpn-gateway-2"), - // }, - // }, - // }}, - // } - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/4883fa5dbf6f2c9093fac8ce334547e9dfac68fa/specification/network/resource-manager/Microsoft.Network/stable/2024-03-01/examples/VirtualNetworkGatewayReset.json -func ExampleVirtualNetworkGatewaysClient_BeginReset() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armnetwork.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewVirtualNetworkGatewaysClient().BeginReset(ctx, "rg1", "vpngw", &armnetwork.VirtualNetworkGatewaysClientBeginResetOptions{GatewayVip: nil}) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - res, err := poller.PollUntilDone(ctx, nil) - if err != nil { - log.Fatalf("failed to pull the result: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.VirtualNetworkGateway = armnetwork.VirtualNetworkGateway{ - // Name: to.Ptr("vpngw"), - // Type: to.Ptr("Microsoft.Network/virtualNetworkGateways"), - // ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/virtualNetworkGateways/vpngw"), - // Location: to.Ptr("centralus"), - // Etag: to.Ptr("W/\"00000000-0000-0000-0000-000000000000\""), - // Properties: &armnetwork.VirtualNetworkGatewayPropertiesFormat{ - // Active: to.Ptr(false), - // BgpSettings: &armnetwork.BgpSettings{ - // Asn: to.Ptr[int64](65514), - // BgpPeeringAddress: to.Ptr("10.0.1.30"), - // BgpPeeringAddresses: []*armnetwork.IPConfigurationBgpPeeringAddress{ - // { - // CustomBgpIPAddresses: []*string{ - // to.Ptr("169.254.21.10")}, - // DefaultBgpIPAddresses: []*string{ - // to.Ptr("10.3.1.254")}, - // IPConfigurationID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/virtualNetworkGateways/vpngw/ipConfigurations/gwipconfig1"), - // TunnelIPAddresses: []*string{ - // to.Ptr("52.161.10.135")}, - // }}, - // PeerWeight: to.Ptr[int32](0), - // }, - // CustomRoutes: &armnetwork.AddressSpace{ - // AddressPrefixes: []*string{ - // to.Ptr("101.168.0.6/32")}, - // }, - // DisableIPSecReplayProtection: to.Ptr(false), - // EnableBgp: to.Ptr(false), - // EnableBgpRouteTranslationForNat: to.Ptr(false), - // GatewayType: to.Ptr(armnetwork.VirtualNetworkGatewayTypeVPN), - // IPConfigurations: []*armnetwork.VirtualNetworkGatewayIPConfiguration{ - // { - // ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/virtualNetworkGateways/vpngw/ipConfigurations/gwipconfig1"), - // Name: to.Ptr("gwipconfig1"), - // Etag: to.Ptr("W/\"00000000-0000-0000-0000-000000000000\""), - // Properties: &armnetwork.VirtualNetworkGatewayIPConfigurationPropertiesFormat{ - // PrivateIPAllocationMethod: to.Ptr(armnetwork.IPAllocationMethodDynamic), - // ProvisioningState: to.Ptr(armnetwork.ProvisioningStateSucceeded), - // PublicIPAddress: &armnetwork.SubResource{ - // ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/publicIPAddresses/gwpip"), - // }, - // Subnet: &armnetwork.SubResource{ - // ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/virtualNetworks/vnet1/subnets/GatewaySubnet"), - // }, - // }, - // }}, - // NatRules: []*armnetwork.VirtualNetworkGatewayNatRule{ - // }, - // ProvisioningState: to.Ptr(armnetwork.ProvisioningStateSucceeded), - // ResourceGUID: to.Ptr("00000000-0000-0000-0000-000000000000"), - // SKU: &armnetwork.VirtualNetworkGatewaySKU{ - // Name: to.Ptr(armnetwork.VirtualNetworkGatewaySKUNameVPNGw1), - // Capacity: to.Ptr[int32](0), - // Tier: to.Ptr(armnetwork.VirtualNetworkGatewaySKUTierVPNGw1), - // }, - // VPNType: to.Ptr(armnetwork.VPNTypeRouteBased), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/4883fa5dbf6f2c9093fac8ce334547e9dfac68fa/specification/network/resource-manager/Microsoft.Network/stable/2024-03-01/examples/VirtualNetworkGatewayResetVpnClientSharedKey.json -func ExampleVirtualNetworkGatewaysClient_BeginResetVPNClientSharedKey() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armnetwork.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewVirtualNetworkGatewaysClient().BeginResetVPNClientSharedKey(ctx, "rg1", "vpngw", nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - _, err = poller.PollUntilDone(ctx, nil) - if err != nil { - log.Fatalf("failed to pull the result: %v", err) - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/4883fa5dbf6f2c9093fac8ce334547e9dfac68fa/specification/network/resource-manager/Microsoft.Network/stable/2024-03-01/examples/VirtualNetworkGatewayGenerateVpnClientPackage.json -func ExampleVirtualNetworkGatewaysClient_BeginGeneratevpnclientpackage() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armnetwork.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewVirtualNetworkGatewaysClient().BeginGeneratevpnclientpackage(ctx, "rg1", "vpngw", armnetwork.VPNClientParameters{}, nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - res, err := poller.PollUntilDone(ctx, nil) - if err != nil { - log.Fatalf("failed to pull the result: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.Value = "" -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/4883fa5dbf6f2c9093fac8ce334547e9dfac68fa/specification/network/resource-manager/Microsoft.Network/stable/2024-03-01/examples/VirtualNetworkGatewayGenerateVpnProfile.json -func ExampleVirtualNetworkGatewaysClient_BeginGenerateVPNProfile() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armnetwork.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewVirtualNetworkGatewaysClient().BeginGenerateVPNProfile(ctx, "rg1", "vpngw", armnetwork.VPNClientParameters{}, nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - res, err := poller.PollUntilDone(ctx, nil) - if err != nil { - log.Fatalf("failed to pull the result: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.Value = "" -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/4883fa5dbf6f2c9093fac8ce334547e9dfac68fa/specification/network/resource-manager/Microsoft.Network/stable/2024-03-01/examples/VirtualNetworkGatewayGetVpnProfilePackageUrl.json -func ExampleVirtualNetworkGatewaysClient_BeginGetVPNProfilePackageURL() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armnetwork.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewVirtualNetworkGatewaysClient().BeginGetVPNProfilePackageURL(ctx, "rg1", "vpngw", nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - res, err := poller.PollUntilDone(ctx, nil) - if err != nil { - log.Fatalf("failed to pull the result: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.Value = "" -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/4883fa5dbf6f2c9093fac8ce334547e9dfac68fa/specification/network/resource-manager/Microsoft.Network/stable/2024-03-01/examples/VirtualNetworkGatewayGetBGPPeerStatus.json -func ExampleVirtualNetworkGatewaysClient_BeginGetBgpPeerStatus() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armnetwork.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewVirtualNetworkGatewaysClient().BeginGetBgpPeerStatus(ctx, "rg1", "vpngw", &armnetwork.VirtualNetworkGatewaysClientBeginGetBgpPeerStatusOptions{Peer: nil}) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - res, err := poller.PollUntilDone(ctx, nil) - if err != nil { - log.Fatalf("failed to pull the result: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.BgpPeerStatusListResult = armnetwork.BgpPeerStatusListResult{ - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/4883fa5dbf6f2c9093fac8ce334547e9dfac68fa/specification/network/resource-manager/Microsoft.Network/stable/2024-03-01/examples/VirtualNetworkGatewaySupportedVpnDevice.json -func ExampleVirtualNetworkGatewaysClient_SupportedVPNDevices() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armnetwork.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewVirtualNetworkGatewaysClient().SupportedVPNDevices(ctx, "rg1", "vpngw", nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.Value = "" -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/4883fa5dbf6f2c9093fac8ce334547e9dfac68fa/specification/network/resource-manager/Microsoft.Network/stable/2024-03-01/examples/VirtualNetworkGatewayLearnedRoutes.json -func ExampleVirtualNetworkGatewaysClient_BeginGetLearnedRoutes() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armnetwork.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewVirtualNetworkGatewaysClient().BeginGetLearnedRoutes(ctx, "rg1", "vpngw", nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - res, err := poller.PollUntilDone(ctx, nil) - if err != nil { - log.Fatalf("failed to pull the result: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.GatewayRouteListResult = armnetwork.GatewayRouteListResult{ - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/4883fa5dbf6f2c9093fac8ce334547e9dfac68fa/specification/network/resource-manager/Microsoft.Network/stable/2024-03-01/examples/VirtualNetworkGatewayGetAdvertisedRoutes.json -func ExampleVirtualNetworkGatewaysClient_BeginGetAdvertisedRoutes() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armnetwork.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewVirtualNetworkGatewaysClient().BeginGetAdvertisedRoutes(ctx, "rg1", "vpngw", "test", nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - res, err := poller.PollUntilDone(ctx, nil) - if err != nil { - log.Fatalf("failed to pull the result: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.GatewayRouteListResult = armnetwork.GatewayRouteListResult{ - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/4883fa5dbf6f2c9093fac8ce334547e9dfac68fa/specification/network/resource-manager/Microsoft.Network/stable/2024-03-01/examples/VirtualNetworkGatewaySetVpnClientIpsecParameters.json -func ExampleVirtualNetworkGatewaysClient_BeginSetVpnclientIPSecParameters() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armnetwork.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewVirtualNetworkGatewaysClient().BeginSetVpnclientIPSecParameters(ctx, "rg1", "vpngw", armnetwork.VPNClientIPsecParameters{ - DhGroup: to.Ptr(armnetwork.DhGroupDHGroup2), - IkeEncryption: to.Ptr(armnetwork.IkeEncryptionAES256), - IkeIntegrity: to.Ptr(armnetwork.IkeIntegritySHA384), - IPSecEncryption: to.Ptr(armnetwork.IPSecEncryptionAES256), - IPSecIntegrity: to.Ptr(armnetwork.IPSecIntegritySHA256), - PfsGroup: to.Ptr(armnetwork.PfsGroupPFS2), - SaDataSizeKilobytes: to.Ptr[int32](429497), - SaLifeTimeSeconds: to.Ptr[int32](86473), - }, nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - res, err := poller.PollUntilDone(ctx, nil) - if err != nil { - log.Fatalf("failed to pull the result: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.VPNClientIPsecParameters = armnetwork.VPNClientIPsecParameters{ - // DhGroup: to.Ptr(armnetwork.DhGroupDHGroup2), - // IkeEncryption: to.Ptr(armnetwork.IkeEncryptionAES256), - // IkeIntegrity: to.Ptr(armnetwork.IkeIntegritySHA384), - // IPSecEncryption: to.Ptr(armnetwork.IPSecEncryptionAES256), - // IPSecIntegrity: to.Ptr(armnetwork.IPSecIntegritySHA256), - // PfsGroup: to.Ptr(armnetwork.PfsGroupPFS2), - // SaDataSizeKilobytes: to.Ptr[int32](429497), - // SaLifeTimeSeconds: to.Ptr[int32](86473), - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/4883fa5dbf6f2c9093fac8ce334547e9dfac68fa/specification/network/resource-manager/Microsoft.Network/stable/2024-03-01/examples/VirtualNetworkGatewayGetVpnClientIpsecParameters.json -func ExampleVirtualNetworkGatewaysClient_BeginGetVpnclientIPSecParameters() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armnetwork.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewVirtualNetworkGatewaysClient().BeginGetVpnclientIPSecParameters(ctx, "rg1", "vpngw", nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - res, err := poller.PollUntilDone(ctx, nil) - if err != nil { - log.Fatalf("failed to pull the result: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.VPNClientIPsecParameters = armnetwork.VPNClientIPsecParameters{ - // DhGroup: to.Ptr(armnetwork.DhGroupDHGroup2), - // IkeEncryption: to.Ptr(armnetwork.IkeEncryptionAES256), - // IkeIntegrity: to.Ptr(armnetwork.IkeIntegritySHA384), - // IPSecEncryption: to.Ptr(armnetwork.IPSecEncryptionAES256), - // IPSecIntegrity: to.Ptr(armnetwork.IPSecIntegritySHA256), - // PfsGroup: to.Ptr(armnetwork.PfsGroupPFS2), - // SaDataSizeKilobytes: to.Ptr[int32](429497), - // SaLifeTimeSeconds: to.Ptr[int32](86473), - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/4883fa5dbf6f2c9093fac8ce334547e9dfac68fa/specification/network/resource-manager/Microsoft.Network/stable/2024-03-01/examples/VirtualNetworkGatewayVpnDeviceConfigurationScript.json -func ExampleVirtualNetworkGatewaysClient_VPNDeviceConfigurationScript() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armnetwork.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewVirtualNetworkGatewaysClient().VPNDeviceConfigurationScript(ctx, "rg1", "vpngw", armnetwork.VPNDeviceScriptParameters{ - DeviceFamily: to.Ptr("ISR"), - FirmwareVersion: to.Ptr("IOS 15.1 (Preview)"), - Vendor: to.Ptr("Cisco"), - }, nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.Value = "! Microsoft Corporation\r\n! ---------------------------------------------------------------------------------------------------------------------\r\n! Sample VPN tunnel configuration template for IOS-based devices\r\n!\r\n! This configuration template applies to Cisco VPN devices running IOS 15.1 or beyond (ISR or ASR)\r\n!\r\n\r\n\r\n \r\n\r\n! ---------------------------------------------------------------------------------------------------------------------\r\n! ACL rules\r\n!\r\n! Some VPN devices require explicit ACL rules to allow cross-premises traffic:\r\n!\r\n! 1. Allow traffic between on premises address ranges and VNet address ranges\r\n! 2. Allow IKE traffic (UDP:500) between on premises VPN devices and Azure VPN gateway\r\n! 3. Allow IPsec traffic (Proto:ESP) between on premises VPN devices and Azure VPN gateway\r\n!\r\n \r\naccess-list 101 permit ip 10.1.0.0 0.0.255.255 10.0.0.0 0.0.255.255\r\n\r\n! ---------------------------------------------------------------------------------------------------------------------\r\n! Internet Key Exchange (IKE) configuration\r\n!\r\n! This section specifies the authentication, encryption, hashing, and Diffie-Hellman group parameters for IKE\r\n! main mode or phase 1\r\n!\r\n\r\ncrypto ikev2 proposal SwaggerS2S-proposal\r\n encryption DES3\r\n integrity SHA384\r\n group DHGroup24\r\n lifetime 3600\r\n exit\r\n\r\ncrypto ikev2 policy SwaggerS2S-policy\r\n proposal SwaggerS2S-proposal\r\n exit\r\n\r\ncrypto ikev2 keyring SwaggerBranch-keyring\r\n \r\n peer 52.173.199.254\r\n address 52.173.199.254\r\n pre-shared-key lALEHuppeopJmA94exRNiRr2QzuZ6lOsvzu5IlJUEA6LthbTc8g5MTT86MCsGNMzGkTAaLuLnEJoD1Cn4cIlr94qKZm9drsgllzWvsPNezS71stAkaW1Bb7h6GBnDlDP\r\n exit\r\n\r\ncrypto ikev2 profile SwaggerS2S-profile\r\n match address local 10.3.0.0\r\n match identity remote address 52.173.199.254 255.255.255.255\r\n \r\n authentication remote pre-share\r\n authentication local pre-share\r\n keyring SwaggerBranch-keyring\r\n exit\r\n\r\n! ---------------------------------------------------------------------------------------------------------------------\r\n! IPsec configuration\r\n!\r\n! This section specifies encryption, authentication, tunnel mode properties for the Phase 2 negotiation\r\n!\r\ncrypto ipsec transform-set SwaggerS2S-TransformSet DES3 DES3\r\n mode tunnel\r\n exit\r\n\r\n! ---------------------------------------------------------------------------------------------------------------------\r\n! Crypto map configuration\r\n!\r\n! This section defines a crypto profile that binds the cross-premises network traffic to the IPsec and IKE\r\n! policy profiles for this connection. Then defines the VTI (virtual tunnel interface) with the crypto\r\n! profile. A random interface number (tunnel 1) was used with a random link local address (169.254.0.1/28)\r\n! for the tunnel interface. If either selection is already used in the VPN device, please select another\r\n! interface number or address. The only requirement is that they must not overlap with another interface\r\n! on the same VPN device.\r\n!\r\ncrypto ipsec profile SwaggerS2S-IPsecProfile\r\n set transform-set SwaggerS2S-TransformSet\r\n set ikev2-profile SwaggerS2S-profile\r\n set pfs None\r\n set security-association lifetime 3600\r\n exit\r\n\r\n\r\nint tunnel 52.173.199.254\r\n ip address 169.254.0.1 255.255.255.252\r\n ip tcp adjust-mss 1350\r\n tunnel source 10.3.0.0\r\n tunnel mode ipsec ipv4\r\n tunnel destination 52.173.199.254\r\n tunnel protection ipsec profile SwaggerS2S-IPsecProfile\r\n exit\r\n\r\n ip route 10.0.0.0 255.255.0.0 tunnel 52.173.199.254 " -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/4883fa5dbf6f2c9093fac8ce334547e9dfac68fa/specification/network/resource-manager/Microsoft.Network/stable/2024-03-01/examples/VirtualNetworkGatewayStartPacketCaptureFilterData.json -func ExampleVirtualNetworkGatewaysClient_BeginStartPacketCapture_startPacketCaptureOnVirtualNetworkGatewayWithFilter() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armnetwork.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewVirtualNetworkGatewaysClient().BeginStartPacketCapture(ctx, "rg1", "vpngw", &armnetwork.VirtualNetworkGatewaysClientBeginStartPacketCaptureOptions{Parameters: &armnetwork.VPNPacketCaptureStartParameters{ - FilterData: to.Ptr("{'TracingFlags': 11,'MaxPacketBufferSize': 120,'MaxFileSize': 200,'Filters': [{'SourceSubnets': ['20.1.1.0/24'],'DestinationSubnets': ['10.1.1.0/24'],'SourcePort': [500],'DestinationPort': [4500],'Protocol': 6,'TcpFlags': 16,'CaptureSingleDirectionTrafficOnly': true}]}"), - }, - }) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - res, err := poller.PollUntilDone(ctx, nil) - if err != nil { - log.Fatalf("failed to pull the result: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.Value = "\"{\"Status\":\"Successful\",\"Data\":null}\"" -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/4883fa5dbf6f2c9093fac8ce334547e9dfac68fa/specification/network/resource-manager/Microsoft.Network/stable/2024-03-01/examples/VirtualNetworkGatewayStartPacketCapture.json -func ExampleVirtualNetworkGatewaysClient_BeginStartPacketCapture_startPacketCaptureOnVirtualNetworkGatewayWithoutFilter() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armnetwork.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewVirtualNetworkGatewaysClient().BeginStartPacketCapture(ctx, "rg1", "vpngw", &armnetwork.VirtualNetworkGatewaysClientBeginStartPacketCaptureOptions{Parameters: nil}) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - res, err := poller.PollUntilDone(ctx, nil) - if err != nil { - log.Fatalf("failed to pull the result: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.Value = "\"{\"Status\":\"Successful\",\"Data\":null}\"" -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/4883fa5dbf6f2c9093fac8ce334547e9dfac68fa/specification/network/resource-manager/Microsoft.Network/stable/2024-03-01/examples/VirtualNetworkGatewayStopPacketCapture.json -func ExampleVirtualNetworkGatewaysClient_BeginStopPacketCapture() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armnetwork.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewVirtualNetworkGatewaysClient().BeginStopPacketCapture(ctx, "rg1", "vpngw", armnetwork.VPNPacketCaptureStopParameters{ - SasURL: to.Ptr("https://teststorage.blob.core.windows.net/?sv=2018-03-28&ss=bfqt&srt=sco&sp=rwdlacup&se=2019-09-13T07:44:05Z&st=2019-09-06T23:44:05Z&spr=https&sig=V1h9D1riltvZMI69d6ihENnFo%2FrCvTqGgjO2lf%2FVBhE%3D"), - }, nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - res, err := poller.PollUntilDone(ctx, nil) - if err != nil { - log.Fatalf("failed to pull the result: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.Value = "\"{\"Status\":\"Successful\",\"Data\":null}\"" -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/4883fa5dbf6f2c9093fac8ce334547e9dfac68fa/specification/network/resource-manager/Microsoft.Network/stable/2024-03-01/examples/VirtualNetworkGatewayGetVpnclientConnectionHealth.json -func ExampleVirtualNetworkGatewaysClient_BeginGetVpnclientConnectionHealth() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armnetwork.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewVirtualNetworkGatewaysClient().BeginGetVpnclientConnectionHealth(ctx, "p2s-vnet-test", "vpnp2sgw", nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - res, err := poller.PollUntilDone(ctx, nil) - if err != nil { - log.Fatalf("failed to pull the result: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.VPNClientConnectionHealthDetailListResult = armnetwork.VPNClientConnectionHealthDetailListResult{ - // Value: []*armnetwork.VPNClientConnectionHealthDetail{ - // { - // EgressBytesTransferred: to.Ptr[int64](33420), - // EgressPacketsTransferred: to.Ptr[int64](557), - // IngressBytesTransferred: to.Ptr[int64](33420), - // IngressPacketsTransferred: to.Ptr[int64](557), - // MaxBandwidth: to.Ptr[int64](240000000), - // MaxPacketsPerSecond: to.Ptr[int64](4), - // PrivateIPAddress: to.Ptr("192.168.210.2"), - // PublicIPAddress: to.Ptr("167.220.2.232:45522"), - // VPNConnectionDuration: to.Ptr[int64](900), - // VPNConnectionID: to.Ptr("IKEv2_1e1cfe59-5c7c-4315-a876-b11fbfdfeed4"), - // VPNConnectionTime: to.Ptr("2019-05-02T22:26:22"), - // VPNUserName: to.Ptr("gwp2schildcert"), - // }, - // { - // EgressBytesTransferred: to.Ptr[int64](23420), - // EgressPacketsTransferred: to.Ptr[int64](357), - // IngressBytesTransferred: to.Ptr[int64](23420), - // IngressPacketsTransferred: to.Ptr[int64](357), - // MaxBandwidth: to.Ptr[int64](220000000), - // MaxPacketsPerSecond: to.Ptr[int64](4), - // PrivateIPAddress: to.Ptr("192.168.210.1"), - // PublicIPAddress: to.Ptr("167.220.2.232:45213"), - // VPNConnectionDuration: to.Ptr[int64](800), - // VPNConnectionID: to.Ptr("IKEv2_571cfe59-2c7d-1415-e813-c51fbfdfea16"), - // VPNConnectionTime: to.Ptr("2019-05-01T21:06:12"), - // VPNUserName: to.Ptr("gwp2schildcert"), - // }}, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/4883fa5dbf6f2c9093fac8ce334547e9dfac68fa/specification/network/resource-manager/Microsoft.Network/stable/2024-03-01/examples/VirtualNetworkGatewaysDisconnectP2sVpnConnections.json -func ExampleVirtualNetworkGatewaysClient_BeginDisconnectVirtualNetworkGatewayVPNConnections() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armnetwork.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewVirtualNetworkGatewaysClient().BeginDisconnectVirtualNetworkGatewayVPNConnections(ctx, "vpn-gateway-test", "vpngateway", armnetwork.P2SVPNConnectionRequest{ - VPNConnectionIDs: []*string{ - to.Ptr("vpnconnId1"), - to.Ptr("vpnconnId2")}, - }, nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - _, err = poller.PollUntilDone(ctx, nil) - if err != nil { - log.Fatalf("failed to pull the result: %v", err) - } -} diff --git a/sdk/resourcemanager/network/armnetwork/virtualnetworkpeerings_client_example_test.go b/sdk/resourcemanager/network/armnetwork/virtualnetworkpeerings_client_example_test.go deleted file mode 100644 index 9a3f72e722b2..000000000000 --- a/sdk/resourcemanager/network/armnetwork/virtualnetworkpeerings_client_example_test.go +++ /dev/null @@ -1,950 +0,0 @@ -//go:build go1.18 -// +build go1.18 - -// 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. -// DO NOT EDIT. - -package armnetwork_test - -import ( - "context" - "log" - - "github.com/Azure/azure-sdk-for-go/sdk/azcore/to" - "github.com/Azure/azure-sdk-for-go/sdk/azidentity" - "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/network/armnetwork/v6" -) - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/4883fa5dbf6f2c9093fac8ce334547e9dfac68fa/specification/network/resource-manager/Microsoft.Network/stable/2024-03-01/examples/VirtualNetworkPeeringDelete.json -func ExampleVirtualNetworkPeeringsClient_BeginDelete() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armnetwork.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewVirtualNetworkPeeringsClient().BeginDelete(ctx, "peerTest", "vnet1", "peer", nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - _, err = poller.PollUntilDone(ctx, nil) - if err != nil { - log.Fatalf("failed to pull the result: %v", err) - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/4883fa5dbf6f2c9093fac8ce334547e9dfac68fa/specification/network/resource-manager/Microsoft.Network/stable/2024-03-01/examples/VirtualNetworkV6SubnetPeeringGet.json -func ExampleVirtualNetworkPeeringsClient_Get_getV6SubnetPeering() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armnetwork.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewVirtualNetworkPeeringsClient().Get(ctx, "peerTest", "vnet1", "peer", nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.VirtualNetworkPeering = armnetwork.VirtualNetworkPeering{ - // ID: to.Ptr("/subscriptions/subid/resourceGroups/peerTest/providers/Microsoft.Network/virtualNetworks/vnet1/virtualNetworkPeerings/peer"), - // Name: to.Ptr("peer"), - // Properties: &armnetwork.VirtualNetworkPeeringPropertiesFormat{ - // AllowForwardedTraffic: to.Ptr(true), - // AllowGatewayTransit: to.Ptr(false), - // AllowVirtualNetworkAccess: to.Ptr(true), - // EnableOnlyIPv6Peering: to.Ptr(true), - // LocalAddressSpace: &armnetwork.AddressSpace{ - // AddressPrefixes: []*string{ - // to.Ptr("2002:2002::/64")}, - // }, - // LocalSubnetNames: []*string{ - // to.Ptr("Subnet1")}, - // LocalVirtualNetworkAddressSpace: &armnetwork.AddressSpace{ - // AddressPrefixes: []*string{ - // to.Ptr("2002:2002::/64")}, - // }, - // PeerCompleteVnets: to.Ptr(false), - // PeeringState: to.Ptr(armnetwork.VirtualNetworkPeeringStateInitiated), - // PeeringSyncLevel: to.Ptr(armnetwork.VirtualNetworkPeeringLevelFullyInSync), - // ProvisioningState: to.Ptr(armnetwork.ProvisioningStateSucceeded), - // RemoteAddressSpace: &armnetwork.AddressSpace{ - // AddressPrefixes: []*string{ - // to.Ptr("2001:2001::/64")}, - // }, - // RemoteBgpCommunities: &armnetwork.VirtualNetworkBgpCommunities{ - // RegionalCommunity: to.Ptr("12076:50004"), - // VirtualNetworkCommunity: to.Ptr("12076:20002"), - // }, - // RemoteSubnetNames: []*string{ - // to.Ptr("Subnet2")}, - // RemoteVirtualNetwork: &armnetwork.SubResource{ - // ID: to.Ptr("/subscriptions/subid/resourceGroups/peerTest/providers/Microsoft.Network/virtualNetworks/vnet2"), - // }, - // RemoteVirtualNetworkAddressSpace: &armnetwork.AddressSpace{ - // AddressPrefixes: []*string{ - // to.Ptr("2001:2001::/64")}, - // }, - // UseRemoteGateways: to.Ptr(false), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/4883fa5dbf6f2c9093fac8ce334547e9dfac68fa/specification/network/resource-manager/Microsoft.Network/stable/2024-03-01/examples/VirtualNetworkPeeringGet.json -func ExampleVirtualNetworkPeeringsClient_Get_getPeering() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armnetwork.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewVirtualNetworkPeeringsClient().Get(ctx, "peerTest", "vnet1", "peer", nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.VirtualNetworkPeering = armnetwork.VirtualNetworkPeering{ - // ID: to.Ptr("/subscriptions/subid/resourceGroups/peerTest/providers/Microsoft.Network/virtualNetworks/vnet1/virtualNetworkPeerings/peer"), - // Name: to.Ptr("peer"), - // Properties: &armnetwork.VirtualNetworkPeeringPropertiesFormat{ - // AllowForwardedTraffic: to.Ptr(true), - // AllowGatewayTransit: to.Ptr(false), - // AllowVirtualNetworkAccess: to.Ptr(true), - // PeeringState: to.Ptr(armnetwork.VirtualNetworkPeeringStateInitiated), - // PeeringSyncLevel: to.Ptr(armnetwork.VirtualNetworkPeeringLevelFullyInSync), - // ProvisioningState: to.Ptr(armnetwork.ProvisioningStateSucceeded), - // RemoteAddressSpace: &armnetwork.AddressSpace{ - // AddressPrefixes: []*string{ - // to.Ptr("12.0.0.0/8")}, - // }, - // RemoteBgpCommunities: &armnetwork.VirtualNetworkBgpCommunities{ - // RegionalCommunity: to.Ptr("12076:50004"), - // VirtualNetworkCommunity: to.Ptr("12076:20002"), - // }, - // RemoteVirtualNetwork: &armnetwork.SubResource{ - // ID: to.Ptr("/subscriptions/subid/resourceGroups/peerTest/providers/Microsoft.Network/virtualNetworks/vnet2"), - // }, - // RemoteVirtualNetworkAddressSpace: &armnetwork.AddressSpace{ - // AddressPrefixes: []*string{ - // to.Ptr("12.0.0.0/8")}, - // }, - // UseRemoteGateways: to.Ptr(false), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/4883fa5dbf6f2c9093fac8ce334547e9dfac68fa/specification/network/resource-manager/Microsoft.Network/stable/2024-03-01/examples/VirtualNetworkPeeringGetWithRemoteVirtualNetworkEncryption.json -func ExampleVirtualNetworkPeeringsClient_Get_getPeeringWithRemoteVirtualNetworkEncryption() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armnetwork.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewVirtualNetworkPeeringsClient().Get(ctx, "peerTest", "vnet1", "peer", nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.VirtualNetworkPeering = armnetwork.VirtualNetworkPeering{ - // ID: to.Ptr("/subscriptions/subid/resourceGroups/peerTest/providers/Microsoft.Network/virtualNetworks/vnet1/virtualNetworkPeerings/peer"), - // Name: to.Ptr("peer"), - // Properties: &armnetwork.VirtualNetworkPeeringPropertiesFormat{ - // AllowForwardedTraffic: to.Ptr(true), - // AllowGatewayTransit: to.Ptr(false), - // AllowVirtualNetworkAccess: to.Ptr(true), - // PeeringState: to.Ptr(armnetwork.VirtualNetworkPeeringStateInitiated), - // ProvisioningState: to.Ptr(armnetwork.ProvisioningStateSucceeded), - // RemoteAddressSpace: &armnetwork.AddressSpace{ - // AddressPrefixes: []*string{ - // to.Ptr("12.0.0.0/8")}, - // }, - // RemoteBgpCommunities: &armnetwork.VirtualNetworkBgpCommunities{ - // RegionalCommunity: to.Ptr("12076:50004"), - // VirtualNetworkCommunity: to.Ptr("12076:20002"), - // }, - // RemoteVirtualNetwork: &armnetwork.SubResource{ - // ID: to.Ptr("/subscriptions/subid/resourceGroups/peerTest/providers/Microsoft.Network/virtualNetworks/vnet2"), - // }, - // RemoteVirtualNetworkEncryption: &armnetwork.VirtualNetworkEncryption{ - // Enabled: to.Ptr(true), - // Enforcement: to.Ptr(armnetwork.VirtualNetworkEncryptionEnforcementAllowUnencrypted), - // }, - // UseRemoteGateways: to.Ptr(false), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/4883fa5dbf6f2c9093fac8ce334547e9dfac68fa/specification/network/resource-manager/Microsoft.Network/stable/2024-03-01/examples/VirtualNetworkSubnetPeeringGet.json -func ExampleVirtualNetworkPeeringsClient_Get_getSubnetPeering() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armnetwork.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewVirtualNetworkPeeringsClient().Get(ctx, "peerTest", "vnet1", "peer", nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.VirtualNetworkPeering = armnetwork.VirtualNetworkPeering{ - // ID: to.Ptr("/subscriptions/subid/resourceGroups/peerTest/providers/Microsoft.Network/virtualNetworks/vnet1/virtualNetworkPeerings/peer"), - // Name: to.Ptr("peer"), - // Properties: &armnetwork.VirtualNetworkPeeringPropertiesFormat{ - // AllowForwardedTraffic: to.Ptr(true), - // AllowGatewayTransit: to.Ptr(false), - // AllowVirtualNetworkAccess: to.Ptr(true), - // EnableOnlyIPv6Peering: to.Ptr(false), - // LocalAddressSpace: &armnetwork.AddressSpace{ - // AddressPrefixes: []*string{ - // to.Ptr("212.0.0.0/16"), - // to.Ptr("2002:2002::/64")}, - // }, - // LocalSubnetNames: []*string{ - // to.Ptr("Subnet1")}, - // LocalVirtualNetworkAddressSpace: &armnetwork.AddressSpace{ - // AddressPrefixes: []*string{ - // to.Ptr("212.0.0.0/16"), - // to.Ptr("2002:2002::/64")}, - // }, - // PeerCompleteVnets: to.Ptr(false), - // PeeringState: to.Ptr(armnetwork.VirtualNetworkPeeringStateInitiated), - // PeeringSyncLevel: to.Ptr(armnetwork.VirtualNetworkPeeringLevelFullyInSync), - // ProvisioningState: to.Ptr(armnetwork.ProvisioningStateSucceeded), - // RemoteAddressSpace: &armnetwork.AddressSpace{ - // AddressPrefixes: []*string{ - // to.Ptr("12.0.0.0/8"), - // to.Ptr("2001:2001::/64")}, - // }, - // RemoteBgpCommunities: &armnetwork.VirtualNetworkBgpCommunities{ - // RegionalCommunity: to.Ptr("12076:50004"), - // VirtualNetworkCommunity: to.Ptr("12076:20002"), - // }, - // RemoteSubnetNames: []*string{ - // to.Ptr("Subnet2")}, - // RemoteVirtualNetwork: &armnetwork.SubResource{ - // ID: to.Ptr("/subscriptions/subid/resourceGroups/peerTest/providers/Microsoft.Network/virtualNetworks/vnet2"), - // }, - // RemoteVirtualNetworkAddressSpace: &armnetwork.AddressSpace{ - // AddressPrefixes: []*string{ - // to.Ptr("12.0.0.0/8"), - // to.Ptr("2001:2001::/64")}, - // }, - // UseRemoteGateways: to.Ptr(false), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/4883fa5dbf6f2c9093fac8ce334547e9dfac68fa/specification/network/resource-manager/Microsoft.Network/stable/2024-03-01/examples/VirtualNetworkV6SubnetPeeringCreate.json -func ExampleVirtualNetworkPeeringsClient_BeginCreateOrUpdate_createV6SubnetPeering() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armnetwork.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewVirtualNetworkPeeringsClient().BeginCreateOrUpdate(ctx, "peerTest", "vnet1", "peer", armnetwork.VirtualNetworkPeering{ - Properties: &armnetwork.VirtualNetworkPeeringPropertiesFormat{ - AllowForwardedTraffic: to.Ptr(true), - AllowGatewayTransit: to.Ptr(false), - AllowVirtualNetworkAccess: to.Ptr(true), - EnableOnlyIPv6Peering: to.Ptr(true), - LocalSubnetNames: []*string{ - to.Ptr("Subnet1"), - to.Ptr("Subnet4")}, - PeerCompleteVnets: to.Ptr(false), - RemoteSubnetNames: []*string{ - to.Ptr("Subnet2")}, - RemoteVirtualNetwork: &armnetwork.SubResource{ - ID: to.Ptr("/subscriptions/subid/resourceGroups/peerTest/providers/Microsoft.Network/virtualNetworks/vnet2"), - }, - UseRemoteGateways: to.Ptr(false), - }, - }, &armnetwork.VirtualNetworkPeeringsClientBeginCreateOrUpdateOptions{SyncRemoteAddressSpace: nil}) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - res, err := poller.PollUntilDone(ctx, nil) - if err != nil { - log.Fatalf("failed to pull the result: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.VirtualNetworkPeering = armnetwork.VirtualNetworkPeering{ - // ID: to.Ptr("/subscriptions/subid/resourceGroups/peerTest/providers/Microsoft.Network/virtualNetworks/vnet1/virtualNetworkPeerings/peer"), - // Name: to.Ptr("peer"), - // Properties: &armnetwork.VirtualNetworkPeeringPropertiesFormat{ - // AllowForwardedTraffic: to.Ptr(true), - // AllowGatewayTransit: to.Ptr(false), - // AllowVirtualNetworkAccess: to.Ptr(true), - // EnableOnlyIPv6Peering: to.Ptr(true), - // LocalAddressSpace: &armnetwork.AddressSpace{ - // AddressPrefixes: []*string{ - // to.Ptr("2002::/64"), - // to.Ptr("2003::/64")}, - // }, - // LocalSubnetNames: []*string{ - // to.Ptr("Subnet1"), - // to.Ptr("Subnet4")}, - // LocalVirtualNetworkAddressSpace: &armnetwork.AddressSpace{ - // AddressPrefixes: []*string{ - // to.Ptr("2002::/64"), - // to.Ptr("2003::/64")}, - // }, - // PeerCompleteVnets: to.Ptr(false), - // PeeringState: to.Ptr(armnetwork.VirtualNetworkPeeringStateInitiated), - // PeeringSyncLevel: to.Ptr(armnetwork.VirtualNetworkPeeringLevelFullyInSync), - // ProvisioningState: to.Ptr(armnetwork.ProvisioningStateSucceeded), - // RemoteAddressSpace: &armnetwork.AddressSpace{ - // AddressPrefixes: []*string{ - // to.Ptr("2001::/64")}, - // }, - // RemoteBgpCommunities: &armnetwork.VirtualNetworkBgpCommunities{ - // RegionalCommunity: to.Ptr("12076:50004"), - // VirtualNetworkCommunity: to.Ptr("12076:20002"), - // }, - // RemoteSubnetNames: []*string{ - // to.Ptr("Subnet2")}, - // RemoteVirtualNetwork: &armnetwork.SubResource{ - // ID: to.Ptr("/subscriptions/subid/resourceGroups/peerTest/providers/Microsoft.Network/virtualNetworks/vnet2"), - // }, - // RemoteVirtualNetworkAddressSpace: &armnetwork.AddressSpace{ - // AddressPrefixes: []*string{ - // to.Ptr("2001::/64")}, - // }, - // UseRemoteGateways: to.Ptr(false), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/4883fa5dbf6f2c9093fac8ce334547e9dfac68fa/specification/network/resource-manager/Microsoft.Network/stable/2024-03-01/examples/VirtualNetworkPeeringCreate.json -func ExampleVirtualNetworkPeeringsClient_BeginCreateOrUpdate_createPeering() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armnetwork.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewVirtualNetworkPeeringsClient().BeginCreateOrUpdate(ctx, "peerTest", "vnet1", "peer", armnetwork.VirtualNetworkPeering{ - Properties: &armnetwork.VirtualNetworkPeeringPropertiesFormat{ - AllowForwardedTraffic: to.Ptr(true), - AllowGatewayTransit: to.Ptr(false), - AllowVirtualNetworkAccess: to.Ptr(true), - RemoteVirtualNetwork: &armnetwork.SubResource{ - ID: to.Ptr("/subscriptions/subid/resourceGroups/peerTest/providers/Microsoft.Network/virtualNetworks/vnet2"), - }, - UseRemoteGateways: to.Ptr(false), - }, - }, &armnetwork.VirtualNetworkPeeringsClientBeginCreateOrUpdateOptions{SyncRemoteAddressSpace: nil}) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - res, err := poller.PollUntilDone(ctx, nil) - if err != nil { - log.Fatalf("failed to pull the result: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.VirtualNetworkPeering = armnetwork.VirtualNetworkPeering{ - // ID: to.Ptr("/subscriptions/subid/resourceGroups/peerTest/providers/Microsoft.Network/virtualNetworks/vnet1/virtualNetworkPeerings/peer"), - // Name: to.Ptr("peer"), - // Properties: &armnetwork.VirtualNetworkPeeringPropertiesFormat{ - // AllowForwardedTraffic: to.Ptr(true), - // AllowGatewayTransit: to.Ptr(false), - // AllowVirtualNetworkAccess: to.Ptr(true), - // PeeringState: to.Ptr(armnetwork.VirtualNetworkPeeringStateInitiated), - // PeeringSyncLevel: to.Ptr(armnetwork.VirtualNetworkPeeringLevelFullyInSync), - // ProvisioningState: to.Ptr(armnetwork.ProvisioningStateSucceeded), - // RemoteAddressSpace: &armnetwork.AddressSpace{ - // AddressPrefixes: []*string{ - // to.Ptr("12.0.0.0/8")}, - // }, - // RemoteBgpCommunities: &armnetwork.VirtualNetworkBgpCommunities{ - // RegionalCommunity: to.Ptr("12076:50004"), - // VirtualNetworkCommunity: to.Ptr("12076:20002"), - // }, - // RemoteVirtualNetwork: &armnetwork.SubResource{ - // ID: to.Ptr("/subscriptions/subid/resourceGroups/peerTest/providers/Microsoft.Network/virtualNetworks/vnet2"), - // }, - // RemoteVirtualNetworkAddressSpace: &armnetwork.AddressSpace{ - // AddressPrefixes: []*string{ - // to.Ptr("12.0.0.0/8")}, - // }, - // UseRemoteGateways: to.Ptr(false), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/4883fa5dbf6f2c9093fac8ce334547e9dfac68fa/specification/network/resource-manager/Microsoft.Network/stable/2024-03-01/examples/VirtualNetworkPeeringCreateWithRemoteVirtualNetworkEncryption.json -func ExampleVirtualNetworkPeeringsClient_BeginCreateOrUpdate_createPeeringWithRemoteVirtualNetworkEncryption() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armnetwork.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewVirtualNetworkPeeringsClient().BeginCreateOrUpdate(ctx, "peerTest", "vnet1", "peer", armnetwork.VirtualNetworkPeering{ - Properties: &armnetwork.VirtualNetworkPeeringPropertiesFormat{ - AllowForwardedTraffic: to.Ptr(true), - AllowGatewayTransit: to.Ptr(false), - AllowVirtualNetworkAccess: to.Ptr(true), - RemoteVirtualNetwork: &armnetwork.SubResource{ - ID: to.Ptr("/subscriptions/subid/resourceGroups/peerTest/providers/Microsoft.Network/virtualNetworks/vnet2"), - }, - UseRemoteGateways: to.Ptr(false), - }, - }, &armnetwork.VirtualNetworkPeeringsClientBeginCreateOrUpdateOptions{SyncRemoteAddressSpace: nil}) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - res, err := poller.PollUntilDone(ctx, nil) - if err != nil { - log.Fatalf("failed to pull the result: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.VirtualNetworkPeering = armnetwork.VirtualNetworkPeering{ - // ID: to.Ptr("/subscriptions/subid/resourceGroups/peerTest/providers/Microsoft.Network/virtualNetworks/vnet1/virtualNetworkPeerings/peer"), - // Name: to.Ptr("peer"), - // Properties: &armnetwork.VirtualNetworkPeeringPropertiesFormat{ - // AllowForwardedTraffic: to.Ptr(true), - // AllowGatewayTransit: to.Ptr(false), - // AllowVirtualNetworkAccess: to.Ptr(true), - // PeeringState: to.Ptr(armnetwork.VirtualNetworkPeeringStateInitiated), - // ProvisioningState: to.Ptr(armnetwork.ProvisioningStateSucceeded), - // RemoteAddressSpace: &armnetwork.AddressSpace{ - // AddressPrefixes: []*string{ - // to.Ptr("12.0.0.0/8")}, - // }, - // RemoteBgpCommunities: &armnetwork.VirtualNetworkBgpCommunities{ - // RegionalCommunity: to.Ptr("12076:50004"), - // VirtualNetworkCommunity: to.Ptr("12076:20002"), - // }, - // RemoteVirtualNetwork: &armnetwork.SubResource{ - // ID: to.Ptr("/subscriptions/subid/resourceGroups/peerTest/providers/Microsoft.Network/virtualNetworks/vnet2"), - // }, - // RemoteVirtualNetworkEncryption: &armnetwork.VirtualNetworkEncryption{ - // Enabled: to.Ptr(true), - // Enforcement: to.Ptr(armnetwork.VirtualNetworkEncryptionEnforcementAllowUnencrypted), - // }, - // UseRemoteGateways: to.Ptr(false), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/4883fa5dbf6f2c9093fac8ce334547e9dfac68fa/specification/network/resource-manager/Microsoft.Network/stable/2024-03-01/examples/VirtualNetworkSubnetPeeringCreate.json -func ExampleVirtualNetworkPeeringsClient_BeginCreateOrUpdate_createSubnetPeering() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armnetwork.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewVirtualNetworkPeeringsClient().BeginCreateOrUpdate(ctx, "peerTest", "vnet1", "peer", armnetwork.VirtualNetworkPeering{ - Properties: &armnetwork.VirtualNetworkPeeringPropertiesFormat{ - AllowForwardedTraffic: to.Ptr(true), - AllowGatewayTransit: to.Ptr(false), - AllowVirtualNetworkAccess: to.Ptr(true), - EnableOnlyIPv6Peering: to.Ptr(false), - LocalSubnetNames: []*string{ - to.Ptr("Subnet1"), - to.Ptr("Subnet4")}, - PeerCompleteVnets: to.Ptr(false), - RemoteSubnetNames: []*string{ - to.Ptr("Subnet2")}, - RemoteVirtualNetwork: &armnetwork.SubResource{ - ID: to.Ptr("/subscriptions/subid/resourceGroups/peerTest/providers/Microsoft.Network/virtualNetworks/vnet2"), - }, - UseRemoteGateways: to.Ptr(false), - }, - }, &armnetwork.VirtualNetworkPeeringsClientBeginCreateOrUpdateOptions{SyncRemoteAddressSpace: nil}) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - res, err := poller.PollUntilDone(ctx, nil) - if err != nil { - log.Fatalf("failed to pull the result: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.VirtualNetworkPeering = armnetwork.VirtualNetworkPeering{ - // ID: to.Ptr("/subscriptions/subid/resourceGroups/peerTest/providers/Microsoft.Network/virtualNetworks/vnet1/virtualNetworkPeerings/peer"), - // Name: to.Ptr("peer"), - // Properties: &armnetwork.VirtualNetworkPeeringPropertiesFormat{ - // AllowForwardedTraffic: to.Ptr(true), - // AllowGatewayTransit: to.Ptr(false), - // AllowVirtualNetworkAccess: to.Ptr(true), - // EnableOnlyIPv6Peering: to.Ptr(false), - // LocalAddressSpace: &armnetwork.AddressSpace{ - // AddressPrefixes: []*string{ - // to.Ptr("212.0.0.0/16"), - // to.Ptr("13.0.0.0/8"), - // to.Ptr("2002:2002::/64")}, - // }, - // LocalSubnetNames: []*string{ - // to.Ptr("Subnet1"), - // to.Ptr("Subnet4")}, - // LocalVirtualNetworkAddressSpace: &armnetwork.AddressSpace{ - // AddressPrefixes: []*string{ - // to.Ptr("212.0.0.0/16"), - // to.Ptr("13.0.0.0/8"), - // to.Ptr("2002:2002::/64")}, - // }, - // PeerCompleteVnets: to.Ptr(false), - // PeeringState: to.Ptr(armnetwork.VirtualNetworkPeeringStateInitiated), - // PeeringSyncLevel: to.Ptr(armnetwork.VirtualNetworkPeeringLevelFullyInSync), - // ProvisioningState: to.Ptr(armnetwork.ProvisioningStateSucceeded), - // RemoteAddressSpace: &armnetwork.AddressSpace{ - // AddressPrefixes: []*string{ - // to.Ptr("12.0.0.0/8"), - // to.Ptr("2001:2001::/64")}, - // }, - // RemoteBgpCommunities: &armnetwork.VirtualNetworkBgpCommunities{ - // RegionalCommunity: to.Ptr("12076:50004"), - // VirtualNetworkCommunity: to.Ptr("12076:20002"), - // }, - // RemoteSubnetNames: []*string{ - // to.Ptr("Subnet2")}, - // RemoteVirtualNetwork: &armnetwork.SubResource{ - // ID: to.Ptr("/subscriptions/subid/resourceGroups/peerTest/providers/Microsoft.Network/virtualNetworks/vnet2"), - // }, - // RemoteVirtualNetworkAddressSpace: &armnetwork.AddressSpace{ - // AddressPrefixes: []*string{ - // to.Ptr("12.0.0.0/8"), - // to.Ptr("2001:2001::/64")}, - // }, - // UseRemoteGateways: to.Ptr(false), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/4883fa5dbf6f2c9093fac8ce334547e9dfac68fa/specification/network/resource-manager/Microsoft.Network/stable/2024-03-01/examples/VirtualNetworkPeeringSync.json -func ExampleVirtualNetworkPeeringsClient_BeginCreateOrUpdate_syncPeering() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armnetwork.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewVirtualNetworkPeeringsClient().BeginCreateOrUpdate(ctx, "peerTest", "vnet1", "peer", armnetwork.VirtualNetworkPeering{ - Properties: &armnetwork.VirtualNetworkPeeringPropertiesFormat{ - AllowForwardedTraffic: to.Ptr(true), - AllowGatewayTransit: to.Ptr(false), - AllowVirtualNetworkAccess: to.Ptr(true), - RemoteVirtualNetwork: &armnetwork.SubResource{ - ID: to.Ptr("/subscriptions/subid/resourceGroups/peerTest/providers/Microsoft.Network/virtualNetworks/vnet2"), - }, - UseRemoteGateways: to.Ptr(false), - }, - }, &armnetwork.VirtualNetworkPeeringsClientBeginCreateOrUpdateOptions{SyncRemoteAddressSpace: to.Ptr(armnetwork.SyncRemoteAddressSpaceTrue)}) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - res, err := poller.PollUntilDone(ctx, nil) - if err != nil { - log.Fatalf("failed to pull the result: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.VirtualNetworkPeering = armnetwork.VirtualNetworkPeering{ - // ID: to.Ptr("/subscriptions/subid/resourceGroups/peerTest/providers/Microsoft.Network/virtualNetworks/vnet1/virtualNetworkPeerings/peer"), - // Name: to.Ptr("peer"), - // Properties: &armnetwork.VirtualNetworkPeeringPropertiesFormat{ - // AllowForwardedTraffic: to.Ptr(true), - // AllowGatewayTransit: to.Ptr(false), - // AllowVirtualNetworkAccess: to.Ptr(true), - // PeeringState: to.Ptr(armnetwork.VirtualNetworkPeeringStateInitiated), - // PeeringSyncLevel: to.Ptr(armnetwork.VirtualNetworkPeeringLevelFullyInSync), - // ProvisioningState: to.Ptr(armnetwork.ProvisioningStateSucceeded), - // RemoteAddressSpace: &armnetwork.AddressSpace{ - // AddressPrefixes: []*string{ - // to.Ptr("12.0.0.0/8")}, - // }, - // RemoteBgpCommunities: &armnetwork.VirtualNetworkBgpCommunities{ - // RegionalCommunity: to.Ptr("12076:50004"), - // VirtualNetworkCommunity: to.Ptr("12076:20002"), - // }, - // RemoteVirtualNetwork: &armnetwork.SubResource{ - // ID: to.Ptr("/subscriptions/subid/resourceGroups/peerTest/providers/Microsoft.Network/virtualNetworks/vnet2"), - // }, - // RemoteVirtualNetworkAddressSpace: &armnetwork.AddressSpace{ - // AddressPrefixes: []*string{ - // to.Ptr("12.0.0.0/8")}, - // }, - // UseRemoteGateways: to.Ptr(false), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/4883fa5dbf6f2c9093fac8ce334547e9dfac68fa/specification/network/resource-manager/Microsoft.Network/stable/2024-03-01/examples/VirtualNetworkV6SubnetPeeringSync.json -func ExampleVirtualNetworkPeeringsClient_BeginCreateOrUpdate_syncV6SubnetPeering() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armnetwork.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewVirtualNetworkPeeringsClient().BeginCreateOrUpdate(ctx, "peerTest", "vnet1", "peer", armnetwork.VirtualNetworkPeering{ - Properties: &armnetwork.VirtualNetworkPeeringPropertiesFormat{ - AllowForwardedTraffic: to.Ptr(true), - AllowGatewayTransit: to.Ptr(false), - AllowVirtualNetworkAccess: to.Ptr(true), - EnableOnlyIPv6Peering: to.Ptr(true), - PeerCompleteVnets: to.Ptr(false), - RemoteVirtualNetwork: &armnetwork.SubResource{ - ID: to.Ptr("/subscriptions/subid/resourceGroups/peerTest/providers/Microsoft.Network/virtualNetworks/vnet2"), - }, - UseRemoteGateways: to.Ptr(false), - }, - }, &armnetwork.VirtualNetworkPeeringsClientBeginCreateOrUpdateOptions{SyncRemoteAddressSpace: to.Ptr(armnetwork.SyncRemoteAddressSpaceTrue)}) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - res, err := poller.PollUntilDone(ctx, nil) - if err != nil { - log.Fatalf("failed to pull the result: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.VirtualNetworkPeering = armnetwork.VirtualNetworkPeering{ - // ID: to.Ptr("/subscriptions/subid/resourceGroups/peerTest/providers/Microsoft.Network/virtualNetworks/vnet1/virtualNetworkPeerings/peer"), - // Name: to.Ptr("peer"), - // Properties: &armnetwork.VirtualNetworkPeeringPropertiesFormat{ - // AllowForwardedTraffic: to.Ptr(true), - // AllowGatewayTransit: to.Ptr(false), - // AllowVirtualNetworkAccess: to.Ptr(true), - // EnableOnlyIPv6Peering: to.Ptr(true), - // LocalAddressSpace: &armnetwork.AddressSpace{ - // AddressPrefixes: []*string{ - // to.Ptr("2002:2002::/64")}, - // }, - // LocalSubnetNames: []*string{ - // to.Ptr("Subnet1")}, - // LocalVirtualNetworkAddressSpace: &armnetwork.AddressSpace{ - // AddressPrefixes: []*string{ - // to.Ptr("2002:2002::/64")}, - // }, - // PeerCompleteVnets: to.Ptr(false), - // PeeringState: to.Ptr(armnetwork.VirtualNetworkPeeringStateInitiated), - // PeeringSyncLevel: to.Ptr(armnetwork.VirtualNetworkPeeringLevelFullyInSync), - // ProvisioningState: to.Ptr(armnetwork.ProvisioningStateSucceeded), - // RemoteAddressSpace: &armnetwork.AddressSpace{ - // AddressPrefixes: []*string{ - // to.Ptr("2001:2001::/64")}, - // }, - // RemoteBgpCommunities: &armnetwork.VirtualNetworkBgpCommunities{ - // RegionalCommunity: to.Ptr("12076:50004"), - // VirtualNetworkCommunity: to.Ptr("12076:20002"), - // }, - // RemoteSubnetNames: []*string{ - // to.Ptr("Subnet2")}, - // RemoteVirtualNetwork: &armnetwork.SubResource{ - // ID: to.Ptr("/subscriptions/subid/resourceGroups/peerTest/providers/Microsoft.Network/virtualNetworks/vnet2"), - // }, - // RemoteVirtualNetworkAddressSpace: &armnetwork.AddressSpace{ - // AddressPrefixes: []*string{ - // to.Ptr("2001:2001::/64")}, - // }, - // UseRemoteGateways: to.Ptr(false), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/4883fa5dbf6f2c9093fac8ce334547e9dfac68fa/specification/network/resource-manager/Microsoft.Network/stable/2024-03-01/examples/VirtualNetworkSubnetPeeringSync.json -func ExampleVirtualNetworkPeeringsClient_BeginCreateOrUpdate_syncSubnetPeering() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armnetwork.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewVirtualNetworkPeeringsClient().BeginCreateOrUpdate(ctx, "peerTest", "vnet1", "peer", armnetwork.VirtualNetworkPeering{ - Properties: &armnetwork.VirtualNetworkPeeringPropertiesFormat{ - AllowForwardedTraffic: to.Ptr(true), - AllowGatewayTransit: to.Ptr(false), - AllowVirtualNetworkAccess: to.Ptr(true), - EnableOnlyIPv6Peering: to.Ptr(false), - PeerCompleteVnets: to.Ptr(false), - RemoteVirtualNetwork: &armnetwork.SubResource{ - ID: to.Ptr("/subscriptions/subid/resourceGroups/peerTest/providers/Microsoft.Network/virtualNetworks/vnet2"), - }, - UseRemoteGateways: to.Ptr(false), - }, - }, &armnetwork.VirtualNetworkPeeringsClientBeginCreateOrUpdateOptions{SyncRemoteAddressSpace: to.Ptr(armnetwork.SyncRemoteAddressSpaceTrue)}) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - res, err := poller.PollUntilDone(ctx, nil) - if err != nil { - log.Fatalf("failed to pull the result: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.VirtualNetworkPeering = armnetwork.VirtualNetworkPeering{ - // ID: to.Ptr("/subscriptions/subid/resourceGroups/peerTest/providers/Microsoft.Network/virtualNetworks/vnet1/virtualNetworkPeerings/peer"), - // Name: to.Ptr("peer"), - // Properties: &armnetwork.VirtualNetworkPeeringPropertiesFormat{ - // AllowForwardedTraffic: to.Ptr(true), - // AllowGatewayTransit: to.Ptr(false), - // AllowVirtualNetworkAccess: to.Ptr(true), - // EnableOnlyIPv6Peering: to.Ptr(false), - // LocalAddressSpace: &armnetwork.AddressSpace{ - // AddressPrefixes: []*string{ - // to.Ptr("212.0.0.0/16"), - // to.Ptr("2002:2002::/64")}, - // }, - // LocalSubnetNames: []*string{ - // to.Ptr("Subnet1")}, - // LocalVirtualNetworkAddressSpace: &armnetwork.AddressSpace{ - // AddressPrefixes: []*string{ - // to.Ptr("212.0.0.0/16"), - // to.Ptr("2002:2002::/64")}, - // }, - // PeerCompleteVnets: to.Ptr(false), - // PeeringState: to.Ptr(armnetwork.VirtualNetworkPeeringStateInitiated), - // PeeringSyncLevel: to.Ptr(armnetwork.VirtualNetworkPeeringLevelFullyInSync), - // ProvisioningState: to.Ptr(armnetwork.ProvisioningStateSucceeded), - // RemoteAddressSpace: &armnetwork.AddressSpace{ - // AddressPrefixes: []*string{ - // to.Ptr("12.0.0.0/8"), - // to.Ptr("2001:2001::/64")}, - // }, - // RemoteBgpCommunities: &armnetwork.VirtualNetworkBgpCommunities{ - // RegionalCommunity: to.Ptr("12076:50004"), - // VirtualNetworkCommunity: to.Ptr("12076:20002"), - // }, - // RemoteSubnetNames: []*string{ - // to.Ptr("Subnet2")}, - // RemoteVirtualNetwork: &armnetwork.SubResource{ - // ID: to.Ptr("/subscriptions/subid/resourceGroups/peerTest/providers/Microsoft.Network/virtualNetworks/vnet2"), - // }, - // RemoteVirtualNetworkAddressSpace: &armnetwork.AddressSpace{ - // AddressPrefixes: []*string{ - // to.Ptr("12.0.0.0/8"), - // to.Ptr("2001:2001::/64")}, - // }, - // UseRemoteGateways: to.Ptr(false), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/4883fa5dbf6f2c9093fac8ce334547e9dfac68fa/specification/network/resource-manager/Microsoft.Network/stable/2024-03-01/examples/VirtualNetworkPeeringList.json -func ExampleVirtualNetworkPeeringsClient_NewListPager_listPeerings() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armnetwork.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := clientFactory.NewVirtualNetworkPeeringsClient().NewListPager("peerTest", "vnet1", nil) - for pager.More() { - page, err := pager.NextPage(ctx) - if err != nil { - log.Fatalf("failed to advance page: %v", err) - } - for _, v := range page.Value { - // You could use page here. We use blank identifier for just demo purposes. - _ = v - } - // If the HTTP response code is 200 as defined in example definition, your page structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // page.VirtualNetworkPeeringListResult = armnetwork.VirtualNetworkPeeringListResult{ - // Value: []*armnetwork.VirtualNetworkPeering{ - // { - // ID: to.Ptr("/subscriptions/subid/resourceGroups/peerTest/providers/Microsoft.Network/virtualNetworks/vnet1/virtualNetworkPeerings/peer"), - // Name: to.Ptr("peer"), - // Properties: &armnetwork.VirtualNetworkPeeringPropertiesFormat{ - // AllowForwardedTraffic: to.Ptr(true), - // AllowGatewayTransit: to.Ptr(false), - // AllowVirtualNetworkAccess: to.Ptr(true), - // PeeringState: to.Ptr(armnetwork.VirtualNetworkPeeringStateInitiated), - // PeeringSyncLevel: to.Ptr(armnetwork.VirtualNetworkPeeringLevelFullyInSync), - // ProvisioningState: to.Ptr(armnetwork.ProvisioningStateSucceeded), - // RemoteAddressSpace: &armnetwork.AddressSpace{ - // AddressPrefixes: []*string{ - // to.Ptr("12.0.0.0/8")}, - // }, - // RemoteBgpCommunities: &armnetwork.VirtualNetworkBgpCommunities{ - // RegionalCommunity: to.Ptr("12076:50004"), - // VirtualNetworkCommunity: to.Ptr("12076:20002"), - // }, - // RemoteVirtualNetwork: &armnetwork.SubResource{ - // ID: to.Ptr("/subscriptions/subid/resourceGroups/peerTest/providers/Microsoft.Network/virtualNetworks/vnet2"), - // }, - // RemoteVirtualNetworkAddressSpace: &armnetwork.AddressSpace{ - // AddressPrefixes: []*string{ - // to.Ptr("12.0.0.0/8")}, - // }, - // UseRemoteGateways: to.Ptr(false), - // }, - // }, - // { - // ID: to.Ptr("/subscriptions/subid/resourceGroups/peerTest/providers/Microsoft.Network/virtualNetworks/vnet1/virtualNetworkPeerings/peer2"), - // Name: to.Ptr("peer"), - // Properties: &armnetwork.VirtualNetworkPeeringPropertiesFormat{ - // AllowForwardedTraffic: to.Ptr(false), - // AllowGatewayTransit: to.Ptr(false), - // AllowVirtualNetworkAccess: to.Ptr(true), - // PeeringState: to.Ptr(armnetwork.VirtualNetworkPeeringStateInitiated), - // PeeringSyncLevel: to.Ptr(armnetwork.VirtualNetworkPeeringLevelFullyInSync), - // ProvisioningState: to.Ptr(armnetwork.ProvisioningStateSucceeded), - // RemoteAddressSpace: &armnetwork.AddressSpace{ - // AddressPrefixes: []*string{ - // to.Ptr("13.0.0.0/8")}, - // }, - // RemoteBgpCommunities: &armnetwork.VirtualNetworkBgpCommunities{ - // RegionalCommunity: to.Ptr("12076:50004"), - // VirtualNetworkCommunity: to.Ptr("12076:20003"), - // }, - // RemoteVirtualNetwork: &armnetwork.SubResource{ - // ID: to.Ptr("/subscriptions/subid/resourceGroups/peerTest/providers/Microsoft.Network/virtualNetworks/vnet3"), - // }, - // RemoteVirtualNetworkAddressSpace: &armnetwork.AddressSpace{ - // AddressPrefixes: []*string{ - // to.Ptr("13.0.0.0/8")}, - // }, - // UseRemoteGateways: to.Ptr(false), - // }, - // }}, - // } - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/4883fa5dbf6f2c9093fac8ce334547e9dfac68fa/specification/network/resource-manager/Microsoft.Network/stable/2024-03-01/examples/VirtualNetworkPeeringListWithRemoteVirtualNetworkEncryption.json -func ExampleVirtualNetworkPeeringsClient_NewListPager_listPeeringsWithRemoteVirtualNetworkEncryption() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armnetwork.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := clientFactory.NewVirtualNetworkPeeringsClient().NewListPager("peerTest", "vnet1", nil) - for pager.More() { - page, err := pager.NextPage(ctx) - if err != nil { - log.Fatalf("failed to advance page: %v", err) - } - for _, v := range page.Value { - // You could use page here. We use blank identifier for just demo purposes. - _ = v - } - // If the HTTP response code is 200 as defined in example definition, your page structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // page.VirtualNetworkPeeringListResult = armnetwork.VirtualNetworkPeeringListResult{ - // Value: []*armnetwork.VirtualNetworkPeering{ - // { - // ID: to.Ptr("/subscriptions/subid/resourceGroups/peerTest/providers/Microsoft.Network/virtualNetworks/vnet1/virtualNetworkPeerings/peer"), - // Name: to.Ptr("peer"), - // Properties: &armnetwork.VirtualNetworkPeeringPropertiesFormat{ - // AllowForwardedTraffic: to.Ptr(true), - // AllowGatewayTransit: to.Ptr(false), - // AllowVirtualNetworkAccess: to.Ptr(true), - // PeeringState: to.Ptr(armnetwork.VirtualNetworkPeeringStateInitiated), - // ProvisioningState: to.Ptr(armnetwork.ProvisioningStateSucceeded), - // RemoteAddressSpace: &armnetwork.AddressSpace{ - // AddressPrefixes: []*string{ - // to.Ptr("12.0.0.0/8")}, - // }, - // RemoteBgpCommunities: &armnetwork.VirtualNetworkBgpCommunities{ - // RegionalCommunity: to.Ptr("12076:50004"), - // VirtualNetworkCommunity: to.Ptr("12076:20002"), - // }, - // RemoteVirtualNetwork: &armnetwork.SubResource{ - // ID: to.Ptr("/subscriptions/subid/resourceGroups/peerTest/providers/Microsoft.Network/virtualNetworks/vnet2"), - // }, - // RemoteVirtualNetworkEncryption: &armnetwork.VirtualNetworkEncryption{ - // Enabled: to.Ptr(true), - // Enforcement: to.Ptr(armnetwork.VirtualNetworkEncryptionEnforcementAllowUnencrypted), - // }, - // UseRemoteGateways: to.Ptr(false), - // }, - // }, - // { - // ID: to.Ptr("/subscriptions/subid/resourceGroups/peerTest/providers/Microsoft.Network/virtualNetworks/vnet1/virtualNetworkPeerings/peer2"), - // Name: to.Ptr("peer"), - // Properties: &armnetwork.VirtualNetworkPeeringPropertiesFormat{ - // AllowForwardedTraffic: to.Ptr(false), - // AllowGatewayTransit: to.Ptr(false), - // AllowVirtualNetworkAccess: to.Ptr(true), - // PeeringState: to.Ptr(armnetwork.VirtualNetworkPeeringStateInitiated), - // ProvisioningState: to.Ptr(armnetwork.ProvisioningStateSucceeded), - // RemoteAddressSpace: &armnetwork.AddressSpace{ - // AddressPrefixes: []*string{ - // to.Ptr("13.0.0.0/8")}, - // }, - // RemoteBgpCommunities: &armnetwork.VirtualNetworkBgpCommunities{ - // RegionalCommunity: to.Ptr("12076:50004"), - // VirtualNetworkCommunity: to.Ptr("12076:20003"), - // }, - // RemoteVirtualNetwork: &armnetwork.SubResource{ - // ID: to.Ptr("/subscriptions/subid/resourceGroups/peerTest/providers/Microsoft.Network/virtualNetworks/vnet3"), - // }, - // RemoteVirtualNetworkEncryption: &armnetwork.VirtualNetworkEncryption{ - // Enabled: to.Ptr(true), - // Enforcement: to.Ptr(armnetwork.VirtualNetworkEncryptionEnforcementAllowUnencrypted), - // }, - // UseRemoteGateways: to.Ptr(false), - // }, - // }}, - // } - } -} diff --git a/sdk/resourcemanager/network/armnetwork/virtualnetworks_client_example_test.go b/sdk/resourcemanager/network/armnetwork/virtualnetworks_client_example_test.go deleted file mode 100644 index 05ac4aa03391..000000000000 --- a/sdk/resourcemanager/network/armnetwork/virtualnetworks_client_example_test.go +++ /dev/null @@ -1,1116 +0,0 @@ -//go:build go1.18 -// +build go1.18 - -// 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. -// DO NOT EDIT. - -package armnetwork_test - -import ( - "context" - "log" - - "github.com/Azure/azure-sdk-for-go/sdk/azcore/to" - "github.com/Azure/azure-sdk-for-go/sdk/azidentity" - "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/network/armnetwork/v6" -) - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/4883fa5dbf6f2c9093fac8ce334547e9dfac68fa/specification/network/resource-manager/Microsoft.Network/stable/2024-03-01/examples/VirtualNetworkDelete.json -func ExampleVirtualNetworksClient_BeginDelete() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armnetwork.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewVirtualNetworksClient().BeginDelete(ctx, "rg1", "test-vnet", nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - _, err = poller.PollUntilDone(ctx, nil) - if err != nil { - log.Fatalf("failed to pull the result: %v", err) - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/4883fa5dbf6f2c9093fac8ce334547e9dfac68fa/specification/network/resource-manager/Microsoft.Network/stable/2024-03-01/examples/VirtualNetworkGet.json -func ExampleVirtualNetworksClient_Get_getVirtualNetwork() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armnetwork.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewVirtualNetworksClient().Get(ctx, "rg1", "test-vnet", &armnetwork.VirtualNetworksClientGetOptions{Expand: nil}) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.VirtualNetwork = armnetwork.VirtualNetwork{ - // Name: to.Ptr("test-vnet"), - // Type: to.Ptr("Microsoft.Network/virtualNetworks"), - // ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/virtualNetworks/test-vnet"), - // Location: to.Ptr("westus"), - // Properties: &armnetwork.VirtualNetworkPropertiesFormat{ - // AddressSpace: &armnetwork.AddressSpace{ - // AddressPrefixes: []*string{ - // to.Ptr("10.0.0.0/16")}, - // }, - // ProvisioningState: to.Ptr(armnetwork.ProvisioningStateSucceeded), - // Subnets: []*armnetwork.Subnet{ - // { - // ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/virtualNetworks/test-vnet/subnets/subnet1"), - // Name: to.Ptr("subnet1"), - // Properties: &armnetwork.SubnetPropertiesFormat{ - // AddressPrefix: to.Ptr("10.0.1.0/24"), - // IPConfigurations: []*armnetwork.IPConfiguration{ - // { - // ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/loadBalancers/lb/frontendIPConfigurations/fe"), - // }}, - // ProvisioningState: to.Ptr(armnetwork.ProvisioningStateSucceeded), - // }, - // }}, - // VirtualNetworkPeerings: []*armnetwork.VirtualNetworkPeering{ - // }, - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/4883fa5dbf6f2c9093fac8ce334547e9dfac68fa/specification/network/resource-manager/Microsoft.Network/stable/2024-03-01/examples/VirtualNetworkGetWithSubnetDelegation.json -func ExampleVirtualNetworksClient_Get_getVirtualNetworkWithADelegatedSubnet() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armnetwork.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewVirtualNetworksClient().Get(ctx, "rg1", "test-vnet", &armnetwork.VirtualNetworksClientGetOptions{Expand: nil}) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.VirtualNetwork = armnetwork.VirtualNetwork{ - // Name: to.Ptr("test-vnet"), - // Type: to.Ptr("Microsoft.Network/virtualNetworks"), - // ID: to.Ptr("/subscriptions/subId/resourceGroups/rg1/providers/Microsoft.Network/virtualNetworks/test-vnet"), - // Location: to.Ptr("westus"), - // Properties: &armnetwork.VirtualNetworkPropertiesFormat{ - // AddressSpace: &armnetwork.AddressSpace{ - // AddressPrefixes: []*string{ - // to.Ptr("10.0.0.0/16")}, - // }, - // ProvisioningState: to.Ptr(armnetwork.ProvisioningStateSucceeded), - // Subnets: []*armnetwork.Subnet{ - // { - // ID: to.Ptr("/subscriptions/subId/resourceGroups/rg1/providers/Microsoft.Network/virtualNetworks/test-vnet/subnets/subnet1"), - // Name: to.Ptr("subnet1"), - // Properties: &armnetwork.SubnetPropertiesFormat{ - // AddressPrefix: to.Ptr("10.0.1.0/24"), - // Delegations: []*armnetwork.Delegation{ - // { - // ID: to.Ptr("/subscriptions/subId/resourceGroups/rg1/providers/Microsoft.Network/virtualNetworks/test-vnet/subnets/subnet1/delegations/myDelegation"), - // Name: to.Ptr("myDelegation"), - // Properties: &armnetwork.ServiceDelegationPropertiesFormat{ - // Actions: []*string{ - // }, - // ProvisioningState: to.Ptr(armnetwork.ProvisioningStateSucceeded), - // ServiceName: to.Ptr("Microsoft.Provider/resourceType"), - // }, - // }}, - // IPConfigurations: []*armnetwork.IPConfiguration{ - // { - // ID: to.Ptr("/subscriptions/subId/resourceGroups/rg1/providers/Microsoft.Network/loadBalancers/lb/frontendIPConfigurations/fe"), - // }}, - // ProvisioningState: to.Ptr(armnetwork.ProvisioningStateSucceeded), - // Purpose: to.Ptr(""), - // }, - // }}, - // VirtualNetworkPeerings: []*armnetwork.VirtualNetworkPeering{ - // }, - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/4883fa5dbf6f2c9093fac8ce334547e9dfac68fa/specification/network/resource-manager/Microsoft.Network/stable/2024-03-01/examples/VirtualNetworkGetWithServiceAssociationLink.json -func ExampleVirtualNetworksClient_Get_getVirtualNetworkWithServiceAssociationLinks() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armnetwork.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewVirtualNetworksClient().Get(ctx, "rg1", "test-vnet", &armnetwork.VirtualNetworksClientGetOptions{Expand: nil}) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.VirtualNetwork = armnetwork.VirtualNetwork{ - // Name: to.Ptr("test-vnet"), - // Type: to.Ptr("Microsoft.Network/virtualNetworks"), - // ID: to.Ptr("/subscriptions/subId/resourceGroups/rg1/providers/Microsoft.Network/virtualNetworks/test-vnet"), - // Location: to.Ptr("westus"), - // Properties: &armnetwork.VirtualNetworkPropertiesFormat{ - // AddressSpace: &armnetwork.AddressSpace{ - // AddressPrefixes: []*string{ - // to.Ptr("10.0.0.0/16")}, - // }, - // ProvisioningState: to.Ptr(armnetwork.ProvisioningStateSucceeded), - // Subnets: []*armnetwork.Subnet{ - // { - // ID: to.Ptr("/subscriptions/subId/resourceGroups/rg1/providers/Microsoft.Network/virtualNetworks/test-vnet/subnets/subnet1"), - // Name: to.Ptr("subnet1"), - // Etag: to.Ptr("W/\"4d3e91b4-f67f-48be-880b-e4a8abdd019e\""), - // Properties: &armnetwork.SubnetPropertiesFormat{ - // AddressPrefix: to.Ptr("10.0.214.0/24"), - // Delegations: []*armnetwork.Delegation{ - // { - // ID: to.Ptr("/subscriptions/subId/resourceGroups/rg1/providers/Microsoft.Network/virtualNetworks/test-vnet/subnets/subnet1/delegations/aciDelegation"), - // Name: to.Ptr("aciDelegation"), - // Etag: to.Ptr("W/\"4d3e91b4-f67f-48be-880b-e4a8abdd019e\""), - // Properties: &armnetwork.ServiceDelegationPropertiesFormat{ - // Actions: []*string{ - // to.Ptr("Microsoft.Network/virtualNetworks/subnets/action")}, - // ProvisioningState: to.Ptr(armnetwork.ProvisioningStateSucceeded), - // ServiceName: to.Ptr("Microsoft.Provider/resourceType"), - // }, - // }}, - // IPConfigurationProfiles: []*armnetwork.IPConfigurationProfile{ - // { - // ID: to.Ptr("/subscriptions/subId/resourceGroups/rg1/providers/Microsoft.Network/networkProfiles/networkProfile1/containerNetworkInterfaceConfigurations/eth0/ipConfigurations/ipconfigprofile1"), - // }}, - // ProvisioningState: to.Ptr(armnetwork.ProvisioningStateSucceeded), - // ServiceAssociationLinks: []*armnetwork.ServiceAssociationLink{ - // { - // ID: to.Ptr("/subscriptions/subId/resourceGroups/rg1/providers/Microsoft.Network/virtualNetworks/test-vnet/subnets/subnet1/serviceAssociationLinks/serviceAssociationLink1"), - // Name: to.Ptr("serviceAssociationLink1"), - // Etag: to.Ptr("W/\"4d3e91b4-f67f-48be-880b-e4a8abdd019e\""), - // Properties: &armnetwork.ServiceAssociationLinkPropertiesFormat{ - // LinkedResourceType: to.Ptr("Microsoft.Provider/resourceType"), - // ProvisioningState: to.Ptr(armnetwork.ProvisioningStateSucceeded), - // }, - // }}, - // ServiceEndpoints: []*armnetwork.ServiceEndpointPropertiesFormat{ - // }, - // }, - // }}, - // VirtualNetworkPeerings: []*armnetwork.VirtualNetworkPeering{ - // }, - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/4883fa5dbf6f2c9093fac8ce334547e9dfac68fa/specification/network/resource-manager/Microsoft.Network/stable/2024-03-01/examples/VirtualNetworkCreate.json -func ExampleVirtualNetworksClient_BeginCreateOrUpdate_createVirtualNetwork() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armnetwork.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewVirtualNetworksClient().BeginCreateOrUpdate(ctx, "rg1", "test-vnet", armnetwork.VirtualNetwork{ - Location: to.Ptr("eastus"), - Properties: &armnetwork.VirtualNetworkPropertiesFormat{ - AddressSpace: &armnetwork.AddressSpace{ - AddressPrefixes: []*string{ - to.Ptr("10.0.0.0/16")}, - }, - FlowTimeoutInMinutes: to.Ptr[int32](10), - }, - }, nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - res, err := poller.PollUntilDone(ctx, nil) - if err != nil { - log.Fatalf("failed to pull the result: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.VirtualNetwork = armnetwork.VirtualNetwork{ - // Name: to.Ptr("test-vnet"), - // Type: to.Ptr("Microsoft.Network/virtualNetworks"), - // ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/virtualNetworks/test-vnet"), - // Location: to.Ptr("eastus"), - // Properties: &armnetwork.VirtualNetworkPropertiesFormat{ - // AddressSpace: &armnetwork.AddressSpace{ - // AddressPrefixes: []*string{ - // to.Ptr("10.0.0.0/16")}, - // }, - // FlowTimeoutInMinutes: to.Ptr[int32](10), - // ProvisioningState: to.Ptr(armnetwork.ProvisioningStateSucceeded), - // Subnets: []*armnetwork.Subnet{ - // }, - // VirtualNetworkPeerings: []*armnetwork.VirtualNetworkPeering{ - // }, - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/4883fa5dbf6f2c9093fac8ce334547e9dfac68fa/specification/network/resource-manager/Microsoft.Network/stable/2024-03-01/examples/VirtualNetworkCreateWithBgpCommunities.json -func ExampleVirtualNetworksClient_BeginCreateOrUpdate_createVirtualNetworkWithBgpCommunities() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armnetwork.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewVirtualNetworksClient().BeginCreateOrUpdate(ctx, "rg1", "test-vnet", armnetwork.VirtualNetwork{ - Location: to.Ptr("eastus"), - Properties: &armnetwork.VirtualNetworkPropertiesFormat{ - AddressSpace: &armnetwork.AddressSpace{ - AddressPrefixes: []*string{ - to.Ptr("10.0.0.0/16")}, - }, - BgpCommunities: &armnetwork.VirtualNetworkBgpCommunities{ - VirtualNetworkCommunity: to.Ptr("12076:20000"), - }, - Subnets: []*armnetwork.Subnet{ - { - Name: to.Ptr("test-1"), - Properties: &armnetwork.SubnetPropertiesFormat{ - AddressPrefix: to.Ptr("10.0.0.0/24"), - }, - }}, - }, - }, nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - res, err := poller.PollUntilDone(ctx, nil) - if err != nil { - log.Fatalf("failed to pull the result: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.VirtualNetwork = armnetwork.VirtualNetwork{ - // Name: to.Ptr("test-vnet"), - // Type: to.Ptr("Microsoft.Network/virtualNetworks"), - // ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/virtualNetworks/test-vnet"), - // Location: to.Ptr("eastus"), - // Properties: &armnetwork.VirtualNetworkPropertiesFormat{ - // AddressSpace: &armnetwork.AddressSpace{ - // AddressPrefixes: []*string{ - // to.Ptr("10.0.0.0/16")}, - // }, - // BgpCommunities: &armnetwork.VirtualNetworkBgpCommunities{ - // RegionalCommunity: to.Ptr("12076:50004"), - // VirtualNetworkCommunity: to.Ptr("12076:20000"), - // }, - // ProvisioningState: to.Ptr(armnetwork.ProvisioningStateSucceeded), - // Subnets: []*armnetwork.Subnet{ - // { - // ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/virtualNetworks/test-vnet/subnets/test-1"), - // Name: to.Ptr("test-1"), - // Properties: &armnetwork.SubnetPropertiesFormat{ - // AddressPrefix: to.Ptr("10.0.0.0/24"), - // ProvisioningState: to.Ptr(armnetwork.ProvisioningStateSucceeded), - // }, - // }}, - // VirtualNetworkPeerings: []*armnetwork.VirtualNetworkPeering{ - // }, - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/4883fa5dbf6f2c9093fac8ce334547e9dfac68fa/specification/network/resource-manager/Microsoft.Network/stable/2024-03-01/examples/VirtualNetworkCreateSubnetWithDelegation.json -func ExampleVirtualNetworksClient_BeginCreateOrUpdate_createVirtualNetworkWithDelegatedSubnets() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armnetwork.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewVirtualNetworksClient().BeginCreateOrUpdate(ctx, "rg1", "test-vnet", armnetwork.VirtualNetwork{ - Location: to.Ptr("westcentralus"), - Properties: &armnetwork.VirtualNetworkPropertiesFormat{ - AddressSpace: &armnetwork.AddressSpace{ - AddressPrefixes: []*string{ - to.Ptr("10.0.0.0/16")}, - }, - Subnets: []*armnetwork.Subnet{ - { - Name: to.Ptr("test-1"), - Properties: &armnetwork.SubnetPropertiesFormat{ - AddressPrefix: to.Ptr("10.0.0.0/24"), - Delegations: []*armnetwork.Delegation{ - { - Name: to.Ptr("myDelegation"), - Properties: &armnetwork.ServiceDelegationPropertiesFormat{ - ServiceName: to.Ptr("Microsoft.Sql/managedInstances"), - }, - }}, - }, - }}, - }, - }, nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - res, err := poller.PollUntilDone(ctx, nil) - if err != nil { - log.Fatalf("failed to pull the result: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.VirtualNetwork = armnetwork.VirtualNetwork{ - // Name: to.Ptr("test-vnet"), - // Type: to.Ptr("Microsoft.Network/virtualNetworks"), - // ID: to.Ptr("/subscriptions/subId/resourceGroups/rg1/providers/Microsoft.Network/virtualNetworks/test-vnet"), - // Location: to.Ptr("westcentralus"), - // Properties: &armnetwork.VirtualNetworkPropertiesFormat{ - // AddressSpace: &armnetwork.AddressSpace{ - // AddressPrefixes: []*string{ - // to.Ptr("10.0.0.0/16")}, - // }, - // ProvisioningState: to.Ptr(armnetwork.ProvisioningStateSucceeded), - // Subnets: []*armnetwork.Subnet{ - // { - // ID: to.Ptr("/subscriptions/subId/resourceGroups/rg1/providers/Microsoft.Network/virtualNetworks/test-vnet/subnets/test-1"), - // Name: to.Ptr("test-1"), - // Properties: &armnetwork.SubnetPropertiesFormat{ - // AddressPrefix: to.Ptr("10.0.0.0/24"), - // Delegations: []*armnetwork.Delegation{ - // { - // ID: to.Ptr("/subscriptions/subId/resourceGroups/rg1/providers/Microsoft.Network/virtualNetworks/test-vnet/subnets/test-1/delegations/myDelegation"), - // Name: to.Ptr("myDelegation"), - // Properties: &armnetwork.ServiceDelegationPropertiesFormat{ - // Actions: []*string{ - // }, - // ProvisioningState: to.Ptr(armnetwork.ProvisioningStateSucceeded), - // ServiceName: to.Ptr("Microsoft.Sql/managedInstances"), - // }, - // }}, - // ProvisioningState: to.Ptr(armnetwork.ProvisioningStateSucceeded), - // Purpose: to.Ptr(""), - // }, - // }}, - // VirtualNetworkPeerings: []*armnetwork.VirtualNetworkPeering{ - // }, - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/4883fa5dbf6f2c9093fac8ce334547e9dfac68fa/specification/network/resource-manager/Microsoft.Network/stable/2024-03-01/examples/VirtualNetworkCreateWithEncryption.json -func ExampleVirtualNetworksClient_BeginCreateOrUpdate_createVirtualNetworkWithEncryption() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armnetwork.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewVirtualNetworksClient().BeginCreateOrUpdate(ctx, "rg1", "test-vnet", armnetwork.VirtualNetwork{ - Location: to.Ptr("eastus"), - Properties: &armnetwork.VirtualNetworkPropertiesFormat{ - AddressSpace: &armnetwork.AddressSpace{ - AddressPrefixes: []*string{ - to.Ptr("10.0.0.0/16")}, - }, - Encryption: &armnetwork.VirtualNetworkEncryption{ - Enabled: to.Ptr(true), - Enforcement: to.Ptr(armnetwork.VirtualNetworkEncryptionEnforcementAllowUnencrypted), - }, - Subnets: []*armnetwork.Subnet{ - { - Name: to.Ptr("test-1"), - Properties: &armnetwork.SubnetPropertiesFormat{ - AddressPrefix: to.Ptr("10.0.0.0/24"), - }, - }}, - }, - }, nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - res, err := poller.PollUntilDone(ctx, nil) - if err != nil { - log.Fatalf("failed to pull the result: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.VirtualNetwork = armnetwork.VirtualNetwork{ - // Name: to.Ptr("test-vnet"), - // Type: to.Ptr("Microsoft.Network/virtualNetworks"), - // ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/virtualNetworks/test-vnet"), - // Location: to.Ptr("eastus"), - // Properties: &armnetwork.VirtualNetworkPropertiesFormat{ - // AddressSpace: &armnetwork.AddressSpace{ - // AddressPrefixes: []*string{ - // to.Ptr("10.0.0.0/16")}, - // }, - // Encryption: &armnetwork.VirtualNetworkEncryption{ - // Enabled: to.Ptr(true), - // Enforcement: to.Ptr(armnetwork.VirtualNetworkEncryptionEnforcementAllowUnencrypted), - // }, - // ProvisioningState: to.Ptr(armnetwork.ProvisioningStateSucceeded), - // Subnets: []*armnetwork.Subnet{ - // { - // ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/virtualNetworks/test-vnet/subnets/test-1"), - // Name: to.Ptr("test-1"), - // Properties: &armnetwork.SubnetPropertiesFormat{ - // AddressPrefix: to.Ptr("10.0.0.0/24"), - // ProvisioningState: to.Ptr(armnetwork.ProvisioningStateSucceeded), - // }, - // }}, - // VirtualNetworkPeerings: []*armnetwork.VirtualNetworkPeering{ - // }, - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/4883fa5dbf6f2c9093fac8ce334547e9dfac68fa/specification/network/resource-manager/Microsoft.Network/stable/2024-03-01/examples/VirtualNetworkCreateServiceEndpoints.json -func ExampleVirtualNetworksClient_BeginCreateOrUpdate_createVirtualNetworkWithServiceEndpoints() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armnetwork.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewVirtualNetworksClient().BeginCreateOrUpdate(ctx, "vnetTest", "vnet1", armnetwork.VirtualNetwork{ - Location: to.Ptr("eastus"), - Properties: &armnetwork.VirtualNetworkPropertiesFormat{ - AddressSpace: &armnetwork.AddressSpace{ - AddressPrefixes: []*string{ - to.Ptr("10.0.0.0/16")}, - }, - Subnets: []*armnetwork.Subnet{ - { - Name: to.Ptr("test-1"), - Properties: &armnetwork.SubnetPropertiesFormat{ - AddressPrefix: to.Ptr("10.0.0.0/16"), - ServiceEndpoints: []*armnetwork.ServiceEndpointPropertiesFormat{ - { - Service: to.Ptr("Microsoft.Storage"), - }}, - }, - }}, - }, - }, nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - res, err := poller.PollUntilDone(ctx, nil) - if err != nil { - log.Fatalf("failed to pull the result: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.VirtualNetwork = armnetwork.VirtualNetwork{ - // Name: to.Ptr("vnet1"), - // Type: to.Ptr("Microsoft.Network/virtualNetworks"), - // ID: to.Ptr("/subscriptions/subid/resourceGroups/vnetTest/providers/Microsoft.Network/virtualNetworks/vnet1"), - // Location: to.Ptr("eastus"), - // Properties: &armnetwork.VirtualNetworkPropertiesFormat{ - // AddressSpace: &armnetwork.AddressSpace{ - // AddressPrefixes: []*string{ - // to.Ptr("10.0.0.0/16")}, - // }, - // ProvisioningState: to.Ptr(armnetwork.ProvisioningStateSucceeded), - // Subnets: []*armnetwork.Subnet{ - // { - // ID: to.Ptr("/subscriptions/subid/resourceGroups/vnetTest/providers/Microsoft.Network/virtualNetworks/vnet1/subnets/test-1"), - // Name: to.Ptr("test-1"), - // Properties: &armnetwork.SubnetPropertiesFormat{ - // AddressPrefix: to.Ptr("10.0.0.0/16"), - // IPConfigurations: []*armnetwork.IPConfiguration{ - // }, - // ProvisioningState: to.Ptr(armnetwork.ProvisioningStateSucceeded), - // ResourceNavigationLinks: []*armnetwork.ResourceNavigationLink{ - // }, - // ServiceEndpoints: []*armnetwork.ServiceEndpointPropertiesFormat{ - // { - // Locations: []*string{ - // to.Ptr("eastus2(stage)"), - // to.Ptr("usnorth(stage)")}, - // ProvisioningState: to.Ptr(armnetwork.ProvisioningStateSucceeded), - // Service: to.Ptr("Microsoft.Storage"), - // }}, - // }, - // }}, - // VirtualNetworkPeerings: []*armnetwork.VirtualNetworkPeering{ - // }, - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/4883fa5dbf6f2c9093fac8ce334547e9dfac68fa/specification/network/resource-manager/Microsoft.Network/stable/2024-03-01/examples/VirtualNetworkCreateServiceEndpointPolicy.json -func ExampleVirtualNetworksClient_BeginCreateOrUpdate_createVirtualNetworkWithServiceEndpointsAndServiceEndpointPolicy() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armnetwork.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewVirtualNetworksClient().BeginCreateOrUpdate(ctx, "vnetTest", "vnet1", armnetwork.VirtualNetwork{ - Location: to.Ptr("eastus2euap"), - Properties: &armnetwork.VirtualNetworkPropertiesFormat{ - AddressSpace: &armnetwork.AddressSpace{ - AddressPrefixes: []*string{ - to.Ptr("10.0.0.0/16")}, - }, - Subnets: []*armnetwork.Subnet{ - { - Name: to.Ptr("test-1"), - Properties: &armnetwork.SubnetPropertiesFormat{ - AddressPrefix: to.Ptr("10.0.0.0/16"), - ServiceEndpointPolicies: []*armnetwork.ServiceEndpointPolicy{ - { - ID: to.Ptr("/subscriptions/subid/resourceGroups/vnetTest/providers/Microsoft.Network/serviceEndpointPolicies/ServiceEndpointPolicy1"), - }}, - ServiceEndpoints: []*armnetwork.ServiceEndpointPropertiesFormat{ - { - Service: to.Ptr("Microsoft.Storage"), - }}, - }, - }}, - }, - }, nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - res, err := poller.PollUntilDone(ctx, nil) - if err != nil { - log.Fatalf("failed to pull the result: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.VirtualNetwork = armnetwork.VirtualNetwork{ - // Name: to.Ptr("vnet1"), - // Type: to.Ptr("Microsoft.Network/virtualNetworks"), - // ID: to.Ptr("/subscriptions/subid/resourceGroups/vnetTest/providers/Microsoft.Network/virtualNetworks/vnet1"), - // Location: to.Ptr("eastus2euap"), - // Properties: &armnetwork.VirtualNetworkPropertiesFormat{ - // AddressSpace: &armnetwork.AddressSpace{ - // AddressPrefixes: []*string{ - // to.Ptr("10.0.0.0/16")}, - // }, - // ProvisioningState: to.Ptr(armnetwork.ProvisioningStateSucceeded), - // Subnets: []*armnetwork.Subnet{ - // { - // ID: to.Ptr("/subscriptions/subid/resourceGroups/vnetTest/providers/Microsoft.Network/virtualNetworks/vnet1/subnets/test-1"), - // Name: to.Ptr("test-1"), - // Properties: &armnetwork.SubnetPropertiesFormat{ - // AddressPrefix: to.Ptr("10.0.0.0/16"), - // IPConfigurations: []*armnetwork.IPConfiguration{ - // }, - // ProvisioningState: to.Ptr(armnetwork.ProvisioningStateSucceeded), - // ResourceNavigationLinks: []*armnetwork.ResourceNavigationLink{ - // }, - // ServiceEndpointPolicies: []*armnetwork.ServiceEndpointPolicy{ - // { - // ID: to.Ptr("/subscriptions/subid/resourceGroups/vnetTest/providers/Microsoft.Network/serviceEndpointPolicies/ServiceEndpointPolicy1"), - // }}, - // ServiceEndpoints: []*armnetwork.ServiceEndpointPropertiesFormat{ - // { - // Locations: []*string{ - // to.Ptr("eastus2(stage)"), - // to.Ptr("usnorth(stage)")}, - // ProvisioningState: to.Ptr(armnetwork.ProvisioningStateSucceeded), - // Service: to.Ptr("Microsoft.Storage"), - // }}, - // }, - // }}, - // VirtualNetworkPeerings: []*armnetwork.VirtualNetworkPeering{ - // }, - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/4883fa5dbf6f2c9093fac8ce334547e9dfac68fa/specification/network/resource-manager/Microsoft.Network/stable/2024-03-01/examples/VirtualNetworkCreateSubnet.json -func ExampleVirtualNetworksClient_BeginCreateOrUpdate_createVirtualNetworkWithSubnet() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armnetwork.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewVirtualNetworksClient().BeginCreateOrUpdate(ctx, "rg1", "test-vnet", armnetwork.VirtualNetwork{ - Location: to.Ptr("eastus"), - Properties: &armnetwork.VirtualNetworkPropertiesFormat{ - AddressSpace: &armnetwork.AddressSpace{ - AddressPrefixes: []*string{ - to.Ptr("10.0.0.0/16")}, - }, - Subnets: []*armnetwork.Subnet{ - { - Name: to.Ptr("test-1"), - Properties: &armnetwork.SubnetPropertiesFormat{ - AddressPrefix: to.Ptr("10.0.0.0/24"), - }, - }}, - }, - }, nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - res, err := poller.PollUntilDone(ctx, nil) - if err != nil { - log.Fatalf("failed to pull the result: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.VirtualNetwork = armnetwork.VirtualNetwork{ - // Name: to.Ptr("test-vnet"), - // Type: to.Ptr("Microsoft.Network/virtualNetworks"), - // ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/virtualNetworks/test-vnet"), - // Location: to.Ptr("eastus"), - // Properties: &armnetwork.VirtualNetworkPropertiesFormat{ - // AddressSpace: &armnetwork.AddressSpace{ - // AddressPrefixes: []*string{ - // to.Ptr("10.0.0.0/16")}, - // }, - // ProvisioningState: to.Ptr(armnetwork.ProvisioningStateSucceeded), - // Subnets: []*armnetwork.Subnet{ - // { - // ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/virtualNetworks/test-vnet/subnets/test-1"), - // Name: to.Ptr("test-1"), - // Properties: &armnetwork.SubnetPropertiesFormat{ - // AddressPrefix: to.Ptr("10.0.0.0/24"), - // ProvisioningState: to.Ptr(armnetwork.ProvisioningStateSucceeded), - // }, - // }}, - // VirtualNetworkPeerings: []*armnetwork.VirtualNetworkPeering{ - // }, - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/4883fa5dbf6f2c9093fac8ce334547e9dfac68fa/specification/network/resource-manager/Microsoft.Network/stable/2024-03-01/examples/VirtualNetworkCreateSubnetWithAddressPrefixes.json -func ExampleVirtualNetworksClient_BeginCreateOrUpdate_createVirtualNetworkWithSubnetContainingAddressPrefixes() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armnetwork.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewVirtualNetworksClient().BeginCreateOrUpdate(ctx, "rg1", "test-vnet", armnetwork.VirtualNetwork{ - Location: to.Ptr("eastus"), - Properties: &armnetwork.VirtualNetworkPropertiesFormat{ - AddressSpace: &armnetwork.AddressSpace{ - AddressPrefixes: []*string{ - to.Ptr("10.0.0.0/16")}, - }, - Subnets: []*armnetwork.Subnet{ - { - Name: to.Ptr("test-2"), - Properties: &armnetwork.SubnetPropertiesFormat{ - AddressPrefixes: []*string{ - to.Ptr("10.0.0.0/28"), - to.Ptr("10.0.1.0/28")}, - }, - }}, - }, - }, nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - res, err := poller.PollUntilDone(ctx, nil) - if err != nil { - log.Fatalf("failed to pull the result: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.VirtualNetwork = armnetwork.VirtualNetwork{ - // Name: to.Ptr("test-vnet"), - // Type: to.Ptr("Microsoft.Network/virtualNetworks"), - // ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/virtualNetworks/test-vnet"), - // Location: to.Ptr("eastus"), - // Properties: &armnetwork.VirtualNetworkPropertiesFormat{ - // AddressSpace: &armnetwork.AddressSpace{ - // AddressPrefixes: []*string{ - // to.Ptr("10.0.0.0/16")}, - // }, - // ProvisioningState: to.Ptr(armnetwork.ProvisioningStateSucceeded), - // Subnets: []*armnetwork.Subnet{ - // { - // ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/virtualNetworks/test-vnet/subnets/test-2"), - // Name: to.Ptr("test-2"), - // Properties: &armnetwork.SubnetPropertiesFormat{ - // AddressPrefixes: []*string{ - // to.Ptr("10.0.0.0/28"), - // to.Ptr("10.1.0.0/28")}, - // ProvisioningState: to.Ptr(armnetwork.ProvisioningStateSucceeded), - // }, - // }}, - // VirtualNetworkPeerings: []*armnetwork.VirtualNetworkPeering{ - // }, - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/4883fa5dbf6f2c9093fac8ce334547e9dfac68fa/specification/network/resource-manager/Microsoft.Network/stable/2024-03-01/examples/VirtualNetworkUpdateTags.json -func ExampleVirtualNetworksClient_UpdateTags() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armnetwork.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewVirtualNetworksClient().UpdateTags(ctx, "rg1", "test-vnet", armnetwork.TagsObject{ - Tags: map[string]*string{ - "tag1": to.Ptr("value1"), - "tag2": to.Ptr("value2"), - }, - }, nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.VirtualNetwork = armnetwork.VirtualNetwork{ - // Name: to.Ptr("test-vnet"), - // Type: to.Ptr("Microsoft.Network/virtualNetworks"), - // ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/virtualNetworks/test-vnet"), - // Location: to.Ptr("westus"), - // Tags: map[string]*string{ - // "tag1": to.Ptr("value1"), - // "tag2": to.Ptr("value2"), - // }, - // Properties: &armnetwork.VirtualNetworkPropertiesFormat{ - // AddressSpace: &armnetwork.AddressSpace{ - // AddressPrefixes: []*string{ - // to.Ptr("10.0.0.0/16")}, - // }, - // ProvisioningState: to.Ptr(armnetwork.ProvisioningStateSucceeded), - // Subnets: []*armnetwork.Subnet{ - // }, - // VirtualNetworkPeerings: []*armnetwork.VirtualNetworkPeering{ - // }, - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/4883fa5dbf6f2c9093fac8ce334547e9dfac68fa/specification/network/resource-manager/Microsoft.Network/stable/2024-03-01/examples/VirtualNetworkListAll.json -func ExampleVirtualNetworksClient_NewListAllPager() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armnetwork.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := clientFactory.NewVirtualNetworksClient().NewListAllPager(nil) - for pager.More() { - page, err := pager.NextPage(ctx) - if err != nil { - log.Fatalf("failed to advance page: %v", err) - } - for _, v := range page.Value { - // You could use page here. We use blank identifier for just demo purposes. - _ = v - } - // If the HTTP response code is 200 as defined in example definition, your page structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // page.VirtualNetworkListResult = armnetwork.VirtualNetworkListResult{ - // Value: []*armnetwork.VirtualNetwork{ - // { - // Name: to.Ptr("vnet1"), - // Type: to.Ptr("Microsoft.Network/virtualNetworks"), - // ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/virtualNetworks/vnet1"), - // Location: to.Ptr("westus"), - // Properties: &armnetwork.VirtualNetworkPropertiesFormat{ - // AddressSpace: &armnetwork.AddressSpace{ - // AddressPrefixes: []*string{ - // to.Ptr("10.0.0.0/8")}, - // }, - // DhcpOptions: &armnetwork.DhcpOptions{ - // DNSServers: []*string{ - // }, - // }, - // ProvisioningState: to.Ptr(armnetwork.ProvisioningStateSucceeded), - // Subnets: []*armnetwork.Subnet{ - // { - // ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/virtualNetworks/vnet1/subnets/test-1"), - // Name: to.Ptr("test-1"), - // Properties: &armnetwork.SubnetPropertiesFormat{ - // AddressPrefix: to.Ptr("10.0.0.0/24"), - // ProvisioningState: to.Ptr(armnetwork.ProvisioningStateSucceeded), - // }, - // }}, - // VirtualNetworkPeerings: []*armnetwork.VirtualNetworkPeering{ - // }, - // }, - // }, - // { - // Name: to.Ptr("vnet2"), - // Type: to.Ptr("Microsoft.Network/virtualNetworks"), - // ID: to.Ptr("/subscriptions/subid/resourceGroups/rg2/providers/Microsoft.Network/virtualNetworks/vnet2"), - // Location: to.Ptr("westus"), - // Properties: &armnetwork.VirtualNetworkPropertiesFormat{ - // AddressSpace: &armnetwork.AddressSpace{ - // AddressPrefixes: []*string{ - // to.Ptr("10.0.0.0/16")}, - // }, - // DhcpOptions: &armnetwork.DhcpOptions{ - // DNSServers: []*string{ - // to.Ptr("8.8.8.8")}, - // }, - // ProvisioningState: to.Ptr(armnetwork.ProvisioningStateSucceeded), - // Subnets: []*armnetwork.Subnet{ - // }, - // VirtualNetworkPeerings: []*armnetwork.VirtualNetworkPeering{ - // }, - // }, - // }}, - // } - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/4883fa5dbf6f2c9093fac8ce334547e9dfac68fa/specification/network/resource-manager/Microsoft.Network/stable/2024-03-01/examples/VirtualNetworkList.json -func ExampleVirtualNetworksClient_NewListPager() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armnetwork.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := clientFactory.NewVirtualNetworksClient().NewListPager("rg1", nil) - for pager.More() { - page, err := pager.NextPage(ctx) - if err != nil { - log.Fatalf("failed to advance page: %v", err) - } - for _, v := range page.Value { - // You could use page here. We use blank identifier for just demo purposes. - _ = v - } - // If the HTTP response code is 200 as defined in example definition, your page structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // page.VirtualNetworkListResult = armnetwork.VirtualNetworkListResult{ - // Value: []*armnetwork.VirtualNetwork{ - // { - // Name: to.Ptr("vnet1"), - // Type: to.Ptr("Microsoft.Network/virtualNetworks"), - // ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/virtualNetworks/vnet1"), - // Location: to.Ptr("westus"), - // Properties: &armnetwork.VirtualNetworkPropertiesFormat{ - // AddressSpace: &armnetwork.AddressSpace{ - // AddressPrefixes: []*string{ - // to.Ptr("10.0.0.0/8")}, - // }, - // DhcpOptions: &armnetwork.DhcpOptions{ - // DNSServers: []*string{ - // }, - // }, - // ProvisioningState: to.Ptr(armnetwork.ProvisioningStateSucceeded), - // Subnets: []*armnetwork.Subnet{ - // { - // ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/virtualNetworks/vnet1/subnets/test-1"), - // Name: to.Ptr("test-1"), - // Properties: &armnetwork.SubnetPropertiesFormat{ - // AddressPrefix: to.Ptr("10.0.0.0/24"), - // ProvisioningState: to.Ptr(armnetwork.ProvisioningStateSucceeded), - // }, - // }}, - // VirtualNetworkPeerings: []*armnetwork.VirtualNetworkPeering{ - // }, - // }, - // }, - // { - // Name: to.Ptr("vnet2"), - // Type: to.Ptr("Microsoft.Network/virtualNetworks"), - // ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/virtualNetworks/vnet2"), - // Location: to.Ptr("westus"), - // Properties: &armnetwork.VirtualNetworkPropertiesFormat{ - // AddressSpace: &armnetwork.AddressSpace{ - // AddressPrefixes: []*string{ - // to.Ptr("10.0.0.0/16")}, - // }, - // DhcpOptions: &armnetwork.DhcpOptions{ - // DNSServers: []*string{ - // to.Ptr("8.8.8.8")}, - // }, - // ProvisioningState: to.Ptr(armnetwork.ProvisioningStateSucceeded), - // Subnets: []*armnetwork.Subnet{ - // }, - // VirtualNetworkPeerings: []*armnetwork.VirtualNetworkPeering{ - // }, - // }, - // }}, - // } - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/4883fa5dbf6f2c9093fac8ce334547e9dfac68fa/specification/network/resource-manager/Microsoft.Network/stable/2024-03-01/examples/VirtualNetworkCheckIPAddressAvailability.json -func ExampleVirtualNetworksClient_CheckIPAddressAvailability() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armnetwork.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewVirtualNetworksClient().CheckIPAddressAvailability(ctx, "rg1", "test-vnet", "10.0.1.4", nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.IPAddressAvailabilityResult = armnetwork.IPAddressAvailabilityResult{ - // Available: to.Ptr(false), - // AvailableIPAddresses: []*string{ - // to.Ptr("10.0.1.5"), - // to.Ptr("10.0.1.6"), - // to.Ptr("10.0.1.7"), - // to.Ptr("10.0.1.8"), - // to.Ptr("10.0.1.9")}, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/4883fa5dbf6f2c9093fac8ce334547e9dfac68fa/specification/network/resource-manager/Microsoft.Network/stable/2024-03-01/examples/VirtualNetworkListUsage.json -func ExampleVirtualNetworksClient_NewListUsagePager() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armnetwork.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := clientFactory.NewVirtualNetworksClient().NewListUsagePager("rg1", "vnetName", nil) - for pager.More() { - page, err := pager.NextPage(ctx) - if err != nil { - log.Fatalf("failed to advance page: %v", err) - } - for _, v := range page.Value { - // You could use page here. We use blank identifier for just demo purposes. - _ = v - } - // If the HTTP response code is 200 as defined in example definition, your page structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // page.VirtualNetworkListUsageResult = armnetwork.VirtualNetworkListUsageResult{ - // Value: []*armnetwork.VirtualNetworkUsage{ - // { - // Name: &armnetwork.VirtualNetworkUsageName{ - // LocalizedValue: to.Ptr("Subnet size and usage"), - // Value: to.Ptr("SubnetSpace"), - // }, - // CurrentValue: to.Ptr[float64](-1), - // ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/virtualNetworks/vnetName/subnets/GatewaySubnet"), - // Limit: to.Ptr[float64](-1), - // Unit: to.Ptr("Count"), - // }, - // { - // Name: &armnetwork.VirtualNetworkUsageName{ - // LocalizedValue: to.Ptr("Subnet size and usage"), - // Value: to.Ptr("SubnetSpace"), - // }, - // CurrentValue: to.Ptr[float64](2), - // ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/virtualNetworks/vnetName/subnets/newSubnet"), - // Limit: to.Ptr[float64](3), - // Unit: to.Ptr("Count"), - // }}, - // } - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/4883fa5dbf6f2c9093fac8ce334547e9dfac68fa/specification/network/resource-manager/Microsoft.Network/stable/2024-03-01/examples/VirtualNetworkGetDdosProtectionStatus.json -func ExampleVirtualNetworksClient_BeginListDdosProtectionStatus() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armnetwork.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewVirtualNetworksClient().BeginListDdosProtectionStatus(ctx, "rg1", "test-vnet", &armnetwork.VirtualNetworksClientBeginListDdosProtectionStatusOptions{Top: to.Ptr[int32](75), - SkipToken: nil, - }) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - res, err := poller.PollUntilDone(ctx, nil) - if err != nil { - log.Fatalf("failed to pull the result: %v", err) - } - for res.More() { - page, err := res.NextPage(ctx) - if err != nil { - log.Fatalf("failed to advance page: %v", err) - } - for _, v := range page.Value { - // You could use page here. We use blank identifier for just demo purposes. - _ = v - } - // If the HTTP response code is 200 as defined in example definition, your page structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // page.VirtualNetworkDdosProtectionStatusResult = armnetwork.VirtualNetworkDdosProtectionStatusResult{ - // Value: []*armnetwork.PublicIPDdosProtectionStatusResult{ - // { - // DdosProtectionPlanID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/ddosProtectionPlans/test-plan"), - // IsWorkloadProtected: to.Ptr(armnetwork.IsWorkloadProtectedTrue), - // PublicIPAddress: to.Ptr("10.0.1.5"), - // PublicIPAddressID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/publicIPAddresses/test-pip"), - // }, - // { - // IsWorkloadProtected: to.Ptr(armnetwork.IsWorkloadProtectedFalse), - // PublicIPAddress: to.Ptr("10.0.1.6"), - // PublicIPAddressID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/publicIPAddresses/test-pip2"), - // }}, - // } - } -} diff --git a/sdk/resourcemanager/network/armnetwork/virtualnetworktaps_client_example_test.go b/sdk/resourcemanager/network/armnetwork/virtualnetworktaps_client_example_test.go deleted file mode 100644 index 8cd5124d7b8a..000000000000 --- a/sdk/resourcemanager/network/armnetwork/virtualnetworktaps_client_example_test.go +++ /dev/null @@ -1,307 +0,0 @@ -//go:build go1.18 -// +build go1.18 - -// 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. -// DO NOT EDIT. - -package armnetwork_test - -import ( - "context" - "log" - - "github.com/Azure/azure-sdk-for-go/sdk/azcore/to" - "github.com/Azure/azure-sdk-for-go/sdk/azidentity" - "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/network/armnetwork/v6" -) - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/4883fa5dbf6f2c9093fac8ce334547e9dfac68fa/specification/network/resource-manager/Microsoft.Network/stable/2024-03-01/examples/VirtualNetworkTapDelete.json -func ExampleVirtualNetworkTapsClient_BeginDelete() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armnetwork.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewVirtualNetworkTapsClient().BeginDelete(ctx, "rg1", "test-vtap", nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - _, err = poller.PollUntilDone(ctx, nil) - if err != nil { - log.Fatalf("failed to pull the result: %v", err) - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/4883fa5dbf6f2c9093fac8ce334547e9dfac68fa/specification/network/resource-manager/Microsoft.Network/stable/2024-03-01/examples/VirtualNetworkTapGet.json -func ExampleVirtualNetworkTapsClient_Get() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armnetwork.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewVirtualNetworkTapsClient().Get(ctx, "rg1", "testvtap", nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.VirtualNetworkTap = armnetwork.VirtualNetworkTap{ - // Name: to.Ptr("testvtap"), - // Type: to.Ptr("Microsoft.Network/virtualNetworkTaps"), - // ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/virtualNetworkTaps/testvtap"), - // Location: to.Ptr("centraluseuap"), - // Etag: to.Ptr("etag"), - // Properties: &armnetwork.VirtualNetworkTapPropertiesFormat{ - // DestinationNetworkInterfaceIPConfiguration: &armnetwork.InterfaceIPConfiguration{ - // ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/networkInterfaces/testNetworkInterface/ipConfigurations/testIPConfig1"), - // }, - // DestinationPort: to.Ptr[int32](4789), - // NetworkInterfaceTapConfigurations: []*armnetwork.InterfaceTapConfiguration{ - // { - // ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/networkInterfaces/testNetworkInterface2/tapConfigurations/testtapConfiguration"), - // }}, - // ProvisioningState: to.Ptr(armnetwork.ProvisioningStateSucceeded), - // ResourceGUID: to.Ptr("6A7C139D-8B8D-499B-B7CB-4F3F02A8A44F"), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/4883fa5dbf6f2c9093fac8ce334547e9dfac68fa/specification/network/resource-manager/Microsoft.Network/stable/2024-03-01/examples/VirtualNetworkTapCreate.json -func ExampleVirtualNetworkTapsClient_BeginCreateOrUpdate() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armnetwork.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewVirtualNetworkTapsClient().BeginCreateOrUpdate(ctx, "rg1", "test-vtap", armnetwork.VirtualNetworkTap{ - Location: to.Ptr("centraluseuap"), - Properties: &armnetwork.VirtualNetworkTapPropertiesFormat{ - DestinationNetworkInterfaceIPConfiguration: &armnetwork.InterfaceIPConfiguration{ - ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/networkInterfaces/testNetworkInterface/ipConfigurations/ipconfig1"), - }, - }, - }, nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - res, err := poller.PollUntilDone(ctx, nil) - if err != nil { - log.Fatalf("failed to pull the result: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.VirtualNetworkTap = armnetwork.VirtualNetworkTap{ - // Name: to.Ptr("testvtap"), - // Type: to.Ptr("Microsoft.Network/virtualNetworkTaps"), - // ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/virtualNetworkTaps/testvtap"), - // Location: to.Ptr("centraluseuap"), - // Etag: to.Ptr("etag"), - // Properties: &armnetwork.VirtualNetworkTapPropertiesFormat{ - // DestinationNetworkInterfaceIPConfiguration: &armnetwork.InterfaceIPConfiguration{ - // ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/networkInterfaces/testNetworkInterface/ipConfigurations/testIPConfig1"), - // }, - // DestinationPort: to.Ptr[int32](4789), - // NetworkInterfaceTapConfigurations: []*armnetwork.InterfaceTapConfiguration{ - // { - // ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/networkInterfaces/testNetworkInterface2/tapConfigurations/testtapConfiguration"), - // }}, - // ProvisioningState: to.Ptr(armnetwork.ProvisioningStateSucceeded), - // ResourceGUID: to.Ptr("6A7C139D-8B8D-499B-B7CB-4F3F02A8A44F"), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/4883fa5dbf6f2c9093fac8ce334547e9dfac68fa/specification/network/resource-manager/Microsoft.Network/stable/2024-03-01/examples/VirtualNetworkTapUpdateTags.json -func ExampleVirtualNetworkTapsClient_UpdateTags() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armnetwork.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewVirtualNetworkTapsClient().UpdateTags(ctx, "rg1", "test-vtap", armnetwork.TagsObject{ - Tags: map[string]*string{ - "tag1": to.Ptr("value1"), - "tag2": to.Ptr("value2"), - }, - }, nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.VirtualNetworkTap = armnetwork.VirtualNetworkTap{ - // Name: to.Ptr("test-vtap"), - // Type: to.Ptr("Microsoft.Network/virtualNetworkTaps"), - // ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/virtualNetworkTaps/test-vtap"), - // Location: to.Ptr("eastus"), - // Tags: map[string]*string{ - // "tag1": to.Ptr("value1"), - // "tag2": to.Ptr("value2"), - // }, - // Properties: &armnetwork.VirtualNetworkTapPropertiesFormat{ - // DestinationNetworkInterfaceIPConfiguration: &armnetwork.InterfaceIPConfiguration{ - // ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/networkInterfaces/testNetworkInterface/ipConfigurations/testIPConfig1"), - // }, - // DestinationPort: to.Ptr[int32](4789), - // NetworkInterfaceTapConfigurations: []*armnetwork.InterfaceTapConfiguration{ - // { - // ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/networkInterfaces/testNetworkInterface2/tapConfigurations/testtapConfiguration"), - // }}, - // ProvisioningState: to.Ptr(armnetwork.ProvisioningStateSucceeded), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/4883fa5dbf6f2c9093fac8ce334547e9dfac68fa/specification/network/resource-manager/Microsoft.Network/stable/2024-03-01/examples/VirtualNetworkTapListAll.json -func ExampleVirtualNetworkTapsClient_NewListAllPager() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armnetwork.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := clientFactory.NewVirtualNetworkTapsClient().NewListAllPager(nil) - for pager.More() { - page, err := pager.NextPage(ctx) - if err != nil { - log.Fatalf("failed to advance page: %v", err) - } - for _, v := range page.Value { - // You could use page here. We use blank identifier for just demo purposes. - _ = v - } - // If the HTTP response code is 200 as defined in example definition, your page structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // page.VirtualNetworkTapListResult = armnetwork.VirtualNetworkTapListResult{ - // Value: []*armnetwork.VirtualNetworkTap{ - // { - // Name: to.Ptr("testvtap"), - // Type: to.Ptr("Microsoft.Network/virtualNetworkTaps"), - // ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/virtualNetworkTaps/testvtap"), - // Location: to.Ptr("centraluseuap"), - // Etag: to.Ptr("etag"), - // Properties: &armnetwork.VirtualNetworkTapPropertiesFormat{ - // DestinationNetworkInterfaceIPConfiguration: &armnetwork.InterfaceIPConfiguration{ - // ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/networkInterfaces/testNetworkInterface/ipConfigurations/testIPConfig1"), - // }, - // DestinationPort: to.Ptr[int32](4789), - // NetworkInterfaceTapConfigurations: []*armnetwork.InterfaceTapConfiguration{ - // { - // ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/networkInterfaces/testNetworkInterface2/tapConfigurations/testtapConfiguration"), - // }}, - // ProvisioningState: to.Ptr(armnetwork.ProvisioningStateSucceeded), - // ResourceGUID: to.Ptr("6A7C139D-8B8D-499B-B7CB-4F3F02A8A44F"), - // }, - // }, - // { - // Name: to.Ptr("testvtap2"), - // Type: to.Ptr("Microsoft.Network/virtualNetworkTaps"), - // ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/virtualNetworkTaps/testvtap2"), - // Location: to.Ptr("centraluseuap"), - // Etag: to.Ptr("etag"), - // Properties: &armnetwork.VirtualNetworkTapPropertiesFormat{ - // DestinationNetworkInterfaceIPConfiguration: &armnetwork.InterfaceIPConfiguration{ - // ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/networkInterfaces/testNetworkInterface/ipConfigurations/testIPConfig1"), - // }, - // DestinationPort: to.Ptr[int32](4789), - // NetworkInterfaceTapConfigurations: []*armnetwork.InterfaceTapConfiguration{ - // { - // ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/networkInterfaces/testNetworkInterface3/tapConfigurations/testtapConfiguration"), - // }}, - // ProvisioningState: to.Ptr(armnetwork.ProvisioningStateSucceeded), - // ResourceGUID: to.Ptr("6A7C139D-8B8D-499B-B7CB-4F3F02A8A44F"), - // }, - // }}, - // } - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/4883fa5dbf6f2c9093fac8ce334547e9dfac68fa/specification/network/resource-manager/Microsoft.Network/stable/2024-03-01/examples/VirtualNetworkTapList.json -func ExampleVirtualNetworkTapsClient_NewListByResourceGroupPager() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armnetwork.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := clientFactory.NewVirtualNetworkTapsClient().NewListByResourceGroupPager("rg1", nil) - for pager.More() { - page, err := pager.NextPage(ctx) - if err != nil { - log.Fatalf("failed to advance page: %v", err) - } - for _, v := range page.Value { - // You could use page here. We use blank identifier for just demo purposes. - _ = v - } - // If the HTTP response code is 200 as defined in example definition, your page structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // page.VirtualNetworkTapListResult = armnetwork.VirtualNetworkTapListResult{ - // Value: []*armnetwork.VirtualNetworkTap{ - // { - // Name: to.Ptr("testvtap"), - // Type: to.Ptr("Microsoft.Network/virtualNetworkTaps"), - // ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/virtualNetworkTaps/testvtap"), - // Location: to.Ptr("centraluseuap"), - // Etag: to.Ptr("etag"), - // Properties: &armnetwork.VirtualNetworkTapPropertiesFormat{ - // DestinationNetworkInterfaceIPConfiguration: &armnetwork.InterfaceIPConfiguration{ - // ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/networkInterfaces/testNetworkInterface/ipConfigurations/testIPConfig1"), - // }, - // DestinationPort: to.Ptr[int32](4789), - // NetworkInterfaceTapConfigurations: []*armnetwork.InterfaceTapConfiguration{ - // { - // ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/networkInterfaces/testNetworkInterface2/tapConfigurations/testtapConfiguration"), - // }}, - // ProvisioningState: to.Ptr(armnetwork.ProvisioningStateSucceeded), - // ResourceGUID: to.Ptr("6A7C139D-8B8D-499B-B7CB-4F3F02A8A44F"), - // }, - // }, - // { - // Name: to.Ptr("testvtap2"), - // Type: to.Ptr("Microsoft.Network/virtualNetworkTaps"), - // ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/virtualNetworkTaps/testvtap2"), - // Location: to.Ptr("centraluseuap"), - // Etag: to.Ptr("etag"), - // Properties: &armnetwork.VirtualNetworkTapPropertiesFormat{ - // DestinationNetworkInterfaceIPConfiguration: &armnetwork.InterfaceIPConfiguration{ - // ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/networkInterfaces/testNetworkInterface/ipConfigurations/testIPConfig1"), - // }, - // DestinationPort: to.Ptr[int32](4789), - // NetworkInterfaceTapConfigurations: []*armnetwork.InterfaceTapConfiguration{ - // { - // ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/networkInterfaces/testNetworkInterface3/tapConfigurations/testtapConfiguration"), - // }}, - // ProvisioningState: to.Ptr(armnetwork.ProvisioningStateSucceeded), - // ResourceGUID: to.Ptr("6A7C139D-8B8D-499B-B7CB-4F3F02A8A44F"), - // }, - // }}, - // } - } -} diff --git a/sdk/resourcemanager/network/armnetwork/virtualrouterpeerings_client_example_test.go b/sdk/resourcemanager/network/armnetwork/virtualrouterpeerings_client_example_test.go deleted file mode 100644 index d1efb520120a..000000000000 --- a/sdk/resourcemanager/network/armnetwork/virtualrouterpeerings_client_example_test.go +++ /dev/null @@ -1,147 +0,0 @@ -//go:build go1.18 -// +build go1.18 - -// 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. -// DO NOT EDIT. - -package armnetwork_test - -import ( - "context" - "log" - - "github.com/Azure/azure-sdk-for-go/sdk/azcore/to" - "github.com/Azure/azure-sdk-for-go/sdk/azidentity" - "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/network/armnetwork/v6" -) - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/4883fa5dbf6f2c9093fac8ce334547e9dfac68fa/specification/network/resource-manager/Microsoft.Network/stable/2024-03-01/examples/VirtualRouterPeeringDelete.json -func ExampleVirtualRouterPeeringsClient_BeginDelete() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armnetwork.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewVirtualRouterPeeringsClient().BeginDelete(ctx, "rg1", "virtualRouter", "peering1", nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - _, err = poller.PollUntilDone(ctx, nil) - if err != nil { - log.Fatalf("failed to pull the result: %v", err) - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/4883fa5dbf6f2c9093fac8ce334547e9dfac68fa/specification/network/resource-manager/Microsoft.Network/stable/2024-03-01/examples/VirtualRouterPeeringGet.json -func ExampleVirtualRouterPeeringsClient_Get() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armnetwork.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewVirtualRouterPeeringsClient().Get(ctx, "rg1", "virtualRouter", "peering1", nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.VirtualRouterPeering = armnetwork.VirtualRouterPeering{ - // ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/virtualRouters/virtualRouter/peerings/peering1"), - // Name: to.Ptr("peering1"), - // Etag: to.Ptr("W/\"72090554-7e3b-43f2-80ad-99a9020dcb11\""), - // Properties: &armnetwork.VirtualRouterPeeringProperties{ - // PeerAsn: to.Ptr[int64](20000), - // PeerIP: to.Ptr("192.168.1.5"), - // ProvisioningState: to.Ptr(armnetwork.ProvisioningStateSucceeded), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/4883fa5dbf6f2c9093fac8ce334547e9dfac68fa/specification/network/resource-manager/Microsoft.Network/stable/2024-03-01/examples/VirtualRouterPeeringPut.json -func ExampleVirtualRouterPeeringsClient_BeginCreateOrUpdate() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armnetwork.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewVirtualRouterPeeringsClient().BeginCreateOrUpdate(ctx, "rg1", "virtualRouter", "peering1", armnetwork.VirtualRouterPeering{ - Properties: &armnetwork.VirtualRouterPeeringProperties{ - PeerAsn: to.Ptr[int64](20000), - PeerIP: to.Ptr("192.168.1.5"), - }, - }, nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - res, err := poller.PollUntilDone(ctx, nil) - if err != nil { - log.Fatalf("failed to pull the result: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.VirtualRouterPeering = armnetwork.VirtualRouterPeering{ - // ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/virtualRouters/virtualRouter/peerings/peering1"), - // Name: to.Ptr("peering1"), - // Etag: to.Ptr("W/\"72090554-7e3b-43f2-80ad-99a9020dcb11\""), - // Properties: &armnetwork.VirtualRouterPeeringProperties{ - // PeerAsn: to.Ptr[int64](20000), - // PeerIP: to.Ptr("192.168.1.5"), - // ProvisioningState: to.Ptr(armnetwork.ProvisioningStateSucceeded), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/4883fa5dbf6f2c9093fac8ce334547e9dfac68fa/specification/network/resource-manager/Microsoft.Network/stable/2024-03-01/examples/VirtualRouterPeeringList.json -func ExampleVirtualRouterPeeringsClient_NewListPager() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armnetwork.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := clientFactory.NewVirtualRouterPeeringsClient().NewListPager("rg1", "virtualRouter", nil) - for pager.More() { - page, err := pager.NextPage(ctx) - if err != nil { - log.Fatalf("failed to advance page: %v", err) - } - for _, v := range page.Value { - // You could use page here. We use blank identifier for just demo purposes. - _ = v - } - // If the HTTP response code is 200 as defined in example definition, your page structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // page.VirtualRouterPeeringListResult = armnetwork.VirtualRouterPeeringListResult{ - // Value: []*armnetwork.VirtualRouterPeering{ - // { - // ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/virtualRouters/virtualRouter/peerings/peering1"), - // Name: to.Ptr("peering1"), - // Etag: to.Ptr("W/\"72090554-7e3b-43f2-80ad-99a9020dcb11\""), - // Properties: &armnetwork.VirtualRouterPeeringProperties{ - // PeerAsn: to.Ptr[int64](20000), - // PeerIP: to.Ptr("192.168.1.5"), - // ProvisioningState: to.Ptr(armnetwork.ProvisioningStateSucceeded), - // }, - // }}, - // } - } -} diff --git a/sdk/resourcemanager/network/armnetwork/virtualrouters_client_example_test.go b/sdk/resourcemanager/network/armnetwork/virtualrouters_client_example_test.go deleted file mode 100644 index efcde9432b0c..000000000000 --- a/sdk/resourcemanager/network/armnetwork/virtualrouters_client_example_test.go +++ /dev/null @@ -1,246 +0,0 @@ -//go:build go1.18 -// +build go1.18 - -// 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. -// DO NOT EDIT. - -package armnetwork_test - -import ( - "context" - "log" - - "github.com/Azure/azure-sdk-for-go/sdk/azcore/to" - "github.com/Azure/azure-sdk-for-go/sdk/azidentity" - "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/network/armnetwork/v6" -) - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/4883fa5dbf6f2c9093fac8ce334547e9dfac68fa/specification/network/resource-manager/Microsoft.Network/stable/2024-03-01/examples/VirtualRouterDelete.json -func ExampleVirtualRoutersClient_BeginDelete() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armnetwork.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewVirtualRoutersClient().BeginDelete(ctx, "rg1", "virtualRouter", nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - _, err = poller.PollUntilDone(ctx, nil) - if err != nil { - log.Fatalf("failed to pull the result: %v", err) - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/4883fa5dbf6f2c9093fac8ce334547e9dfac68fa/specification/network/resource-manager/Microsoft.Network/stable/2024-03-01/examples/VirtualRouterGet.json -func ExampleVirtualRoutersClient_Get() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armnetwork.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewVirtualRoutersClient().Get(ctx, "rg1", "virtualRouter", &armnetwork.VirtualRoutersClientGetOptions{Expand: nil}) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.VirtualRouter = armnetwork.VirtualRouter{ - // Name: to.Ptr("virtualRouter"), - // Type: to.Ptr("Microsoft.Network/virtualRouters"), - // ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/virtualRouters/virtualRouter"), - // Location: to.Ptr("West US"), - // Tags: map[string]*string{ - // "key1": to.Ptr("value1"), - // }, - // Etag: to.Ptr("w/\\00000000-0000-0000-0000-000000000000\\"), - // Properties: &armnetwork.VirtualRouterPropertiesFormat{ - // HostedGateway: &armnetwork.SubResource{ - // ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/virtualNetworkGateways/vnetGateway"), - // }, - // Peerings: []*armnetwork.SubResource{ - // { - // ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/virtualRouters/virtualRouter/peerings/peering1"), - // }}, - // ProvisioningState: to.Ptr(armnetwork.ProvisioningStateSucceeded), - // VirtualRouterAsn: to.Ptr[int64](10000), - // VirtualRouterIPs: []*string{ - // to.Ptr("192.168.1.1"), - // to.Ptr("192.168.1.2")}, - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/4883fa5dbf6f2c9093fac8ce334547e9dfac68fa/specification/network/resource-manager/Microsoft.Network/stable/2024-03-01/examples/VirtualRouterPut.json -func ExampleVirtualRoutersClient_BeginCreateOrUpdate() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armnetwork.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewVirtualRoutersClient().BeginCreateOrUpdate(ctx, "rg1", "virtualRouter", armnetwork.VirtualRouter{ - Location: to.Ptr("West US"), - Tags: map[string]*string{ - "key1": to.Ptr("value1"), - }, - Properties: &armnetwork.VirtualRouterPropertiesFormat{ - HostedGateway: &armnetwork.SubResource{ - ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/virtualNetworkGateways/vnetGateway"), - }, - }, - }, nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - res, err := poller.PollUntilDone(ctx, nil) - if err != nil { - log.Fatalf("failed to pull the result: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.VirtualRouter = armnetwork.VirtualRouter{ - // Name: to.Ptr("virtualRouter"), - // Type: to.Ptr("Microsoft.Network/virtualRouters"), - // ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/virtualRouters/virtualRouter"), - // Location: to.Ptr("West US"), - // Tags: map[string]*string{ - // "key1": to.Ptr("value1"), - // }, - // Etag: to.Ptr("w/\\00000000-0000-0000-0000-000000000000\\"), - // Properties: &armnetwork.VirtualRouterPropertiesFormat{ - // HostedGateway: &armnetwork.SubResource{ - // ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/virtualNetworkGateways/vnetGateway"), - // }, - // Peerings: []*armnetwork.SubResource{ - // { - // ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/virtualRouters/virtualRouter/peerings/peering1"), - // }}, - // ProvisioningState: to.Ptr(armnetwork.ProvisioningStateSucceeded), - // VirtualRouterAsn: to.Ptr[int64](10000), - // VirtualRouterIPs: []*string{ - // to.Ptr("192.168.1.1"), - // to.Ptr("192.168.1.2")}, - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/4883fa5dbf6f2c9093fac8ce334547e9dfac68fa/specification/network/resource-manager/Microsoft.Network/stable/2024-03-01/examples/VirtualRouterListByResourceGroup.json -func ExampleVirtualRoutersClient_NewListByResourceGroupPager() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armnetwork.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := clientFactory.NewVirtualRoutersClient().NewListByResourceGroupPager("rg1", nil) - for pager.More() { - page, err := pager.NextPage(ctx) - if err != nil { - log.Fatalf("failed to advance page: %v", err) - } - for _, v := range page.Value { - // You could use page here. We use blank identifier for just demo purposes. - _ = v - } - // If the HTTP response code is 200 as defined in example definition, your page structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // page.VirtualRouterListResult = armnetwork.VirtualRouterListResult{ - // Value: []*armnetwork.VirtualRouter{ - // { - // Name: to.Ptr("virtualRouter"), - // Type: to.Ptr("Microsoft.Network/virtualRouters"), - // ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/virtualRouters/virtualRouter"), - // Location: to.Ptr("West US"), - // Tags: map[string]*string{ - // "key1": to.Ptr("value1"), - // }, - // Etag: to.Ptr("w/\\00000000-0000-0000-0000-000000000000\\"), - // Properties: &armnetwork.VirtualRouterPropertiesFormat{ - // HostedGateway: &armnetwork.SubResource{ - // ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/virtualNetworkGateways/vnetGateway"), - // }, - // Peerings: []*armnetwork.SubResource{ - // { - // ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/virtualRouters/virtualRouter/peerings/peering1"), - // }}, - // ProvisioningState: to.Ptr(armnetwork.ProvisioningStateSucceeded), - // VirtualRouterAsn: to.Ptr[int64](10000), - // VirtualRouterIPs: []*string{ - // to.Ptr("192.168.1.1"), - // to.Ptr("192.168.1.2")}, - // }, - // }}, - // } - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/4883fa5dbf6f2c9093fac8ce334547e9dfac68fa/specification/network/resource-manager/Microsoft.Network/stable/2024-03-01/examples/VirtualRouterListBySubscription.json -func ExampleVirtualRoutersClient_NewListPager() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armnetwork.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := clientFactory.NewVirtualRoutersClient().NewListPager(nil) - for pager.More() { - page, err := pager.NextPage(ctx) - if err != nil { - log.Fatalf("failed to advance page: %v", err) - } - for _, v := range page.Value { - // You could use page here. We use blank identifier for just demo purposes. - _ = v - } - // If the HTTP response code is 200 as defined in example definition, your page structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // page.VirtualRouterListResult = armnetwork.VirtualRouterListResult{ - // Value: []*armnetwork.VirtualRouter{ - // { - // Name: to.Ptr("virtualRouter"), - // Type: to.Ptr("Microsoft.Network/virtualRouters"), - // ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/virtualRouters/virtualRouter"), - // Location: to.Ptr("West US"), - // Tags: map[string]*string{ - // "key1": to.Ptr("value1"), - // }, - // Etag: to.Ptr("w/\\00000000-0000-0000-0000-000000000000\\"), - // Properties: &armnetwork.VirtualRouterPropertiesFormat{ - // HostedGateway: &armnetwork.SubResource{ - // ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/virtualNetworkGateways/vnetGateway"), - // }, - // Peerings: []*armnetwork.SubResource{ - // { - // ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/virtualRouters/virtualRouter/peerings/peering1"), - // }}, - // ProvisioningState: to.Ptr(armnetwork.ProvisioningStateSucceeded), - // VirtualRouterAsn: to.Ptr[int64](10000), - // VirtualRouterIPs: []*string{ - // to.Ptr("192.168.1.1"), - // to.Ptr("192.168.1.2")}, - // }, - // }}, - // } - } -} diff --git a/sdk/resourcemanager/network/armnetwork/virtualwans_client_example_test.go b/sdk/resourcemanager/network/armnetwork/virtualwans_client_example_test.go deleted file mode 100644 index 3b38d0d4f38c..000000000000 --- a/sdk/resourcemanager/network/armnetwork/virtualwans_client_example_test.go +++ /dev/null @@ -1,350 +0,0 @@ -//go:build go1.18 -// +build go1.18 - -// 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. -// DO NOT EDIT. - -package armnetwork_test - -import ( - "context" - "log" - - "github.com/Azure/azure-sdk-for-go/sdk/azcore/to" - "github.com/Azure/azure-sdk-for-go/sdk/azidentity" - "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/network/armnetwork/v6" -) - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/4883fa5dbf6f2c9093fac8ce334547e9dfac68fa/specification/network/resource-manager/Microsoft.Network/stable/2024-03-01/examples/VirtualWANGet.json -func ExampleVirtualWansClient_Get() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armnetwork.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewVirtualWansClient().Get(ctx, "rg1", "wan1", nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.VirtualWAN = armnetwork.VirtualWAN{ - // Name: to.Ptr("wan1"), - // Type: to.Ptr("Microsoft.Network/virtualWANs"), - // ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/virtualWANs/wan1"), - // Location: to.Ptr("West US"), - // Tags: map[string]*string{ - // "key1": to.Ptr("value1"), - // }, - // Etag: to.Ptr("w/\\00000000-0000-0000-0000-000000000000\\"), - // Properties: &armnetwork.VirtualWanProperties{ - // Type: to.Ptr("Basic"), - // DisableVPNEncryption: to.Ptr(false), - // ProvisioningState: to.Ptr(armnetwork.ProvisioningStateSucceeded), - // VirtualHubs: []*armnetwork.SubResource{ - // { - // }, - // { - // }}, - // VPNSites: []*armnetwork.SubResource{ - // { - // }, - // { - // }}, - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/4883fa5dbf6f2c9093fac8ce334547e9dfac68fa/specification/network/resource-manager/Microsoft.Network/stable/2024-03-01/examples/VirtualWANPut.json -func ExampleVirtualWansClient_BeginCreateOrUpdate() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armnetwork.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewVirtualWansClient().BeginCreateOrUpdate(ctx, "rg1", "wan1", armnetwork.VirtualWAN{ - Location: to.Ptr("West US"), - Tags: map[string]*string{ - "key1": to.Ptr("value1"), - }, - Properties: &armnetwork.VirtualWanProperties{ - Type: to.Ptr("Basic"), - DisableVPNEncryption: to.Ptr(false), - }, - }, nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - res, err := poller.PollUntilDone(ctx, nil) - if err != nil { - log.Fatalf("failed to pull the result: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.VirtualWAN = armnetwork.VirtualWAN{ - // Name: to.Ptr("wan1"), - // Type: to.Ptr("Microsoft.Network/virtualWANs"), - // ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/virtualWANs/wan1"), - // Location: to.Ptr("West US"), - // Tags: map[string]*string{ - // "key1": to.Ptr("value1"), - // }, - // Etag: to.Ptr("w/\\00000000-0000-0000-0000-000000000000\\"), - // Properties: &armnetwork.VirtualWanProperties{ - // Type: to.Ptr("Basic"), - // DisableVPNEncryption: to.Ptr(false), - // ProvisioningState: to.Ptr(armnetwork.ProvisioningStateSucceeded), - // VirtualHubs: []*armnetwork.SubResource{ - // { - // }, - // { - // }}, - // VPNSites: []*armnetwork.SubResource{ - // { - // }, - // { - // }}, - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/4883fa5dbf6f2c9093fac8ce334547e9dfac68fa/specification/network/resource-manager/Microsoft.Network/stable/2024-03-01/examples/VirtualWANUpdateTags.json -func ExampleVirtualWansClient_UpdateTags() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armnetwork.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewVirtualWansClient().UpdateTags(ctx, "rg1", "wan1", armnetwork.TagsObject{ - Tags: map[string]*string{ - "key1": to.Ptr("value1"), - "key2": to.Ptr("value2"), - }, - }, nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.VirtualWAN = armnetwork.VirtualWAN{ - // Name: to.Ptr("wan1"), - // Type: to.Ptr("Microsoft.Network/virtualWANs"), - // ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/virtualWANs/wan1"), - // Location: to.Ptr("West US"), - // Tags: map[string]*string{ - // "key1": to.Ptr("value1"), - // "key2": to.Ptr("value2"), - // }, - // Etag: to.Ptr("w/\\00000000-0000-0000-0000-000000000000\\"), - // Properties: &armnetwork.VirtualWanProperties{ - // Type: to.Ptr("Basic"), - // DisableVPNEncryption: to.Ptr(false), - // ProvisioningState: to.Ptr(armnetwork.ProvisioningStateSucceeded), - // VirtualHubs: []*armnetwork.SubResource{ - // { - // }, - // { - // }}, - // VPNSites: []*armnetwork.SubResource{ - // { - // }, - // { - // }}, - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/4883fa5dbf6f2c9093fac8ce334547e9dfac68fa/specification/network/resource-manager/Microsoft.Network/stable/2024-03-01/examples/VirtualWANDelete.json -func ExampleVirtualWansClient_BeginDelete() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armnetwork.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewVirtualWansClient().BeginDelete(ctx, "rg1", "virtualWan1", nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - _, err = poller.PollUntilDone(ctx, nil) - if err != nil { - log.Fatalf("failed to pull the result: %v", err) - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/4883fa5dbf6f2c9093fac8ce334547e9dfac68fa/specification/network/resource-manager/Microsoft.Network/stable/2024-03-01/examples/VirtualWANListByResourceGroup.json -func ExampleVirtualWansClient_NewListByResourceGroupPager() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armnetwork.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := clientFactory.NewVirtualWansClient().NewListByResourceGroupPager("rg1", nil) - for pager.More() { - page, err := pager.NextPage(ctx) - if err != nil { - log.Fatalf("failed to advance page: %v", err) - } - for _, v := range page.Value { - // You could use page here. We use blank identifier for just demo purposes. - _ = v - } - // If the HTTP response code is 200 as defined in example definition, your page structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // page.ListVirtualWANsResult = armnetwork.ListVirtualWANsResult{ - // Value: []*armnetwork.VirtualWAN{ - // { - // Name: to.Ptr("wan1"), - // Type: to.Ptr("Microsoft.Network/virtualWANs"), - // ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/virtualWANs/wan1"), - // Location: to.Ptr("West US"), - // Tags: map[string]*string{ - // "key1": to.Ptr("value1"), - // }, - // Etag: to.Ptr("w/\\00000000-0000-0000-0000-000000000000\\"), - // Properties: &armnetwork.VirtualWanProperties{ - // Type: to.Ptr("Basic"), - // DisableVPNEncryption: to.Ptr(false), - // ProvisioningState: to.Ptr(armnetwork.ProvisioningStateSucceeded), - // VirtualHubs: []*armnetwork.SubResource{ - // { - // }, - // { - // }}, - // VPNSites: []*armnetwork.SubResource{ - // { - // }, - // { - // }}, - // }, - // }, - // { - // Name: to.Ptr("wan2"), - // Type: to.Ptr("Microsoft.Network/virtualWANs"), - // ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/virtualWANs/wan2"), - // Location: to.Ptr("East US"), - // Tags: map[string]*string{ - // "key1": to.Ptr("value1"), - // }, - // Etag: to.Ptr("w/\\00000000-0000-0000-0000-000000000000\\"), - // Properties: &armnetwork.VirtualWanProperties{ - // Type: to.Ptr("Basic"), - // DisableVPNEncryption: to.Ptr(false), - // ProvisioningState: to.Ptr(armnetwork.ProvisioningStateSucceeded), - // VirtualHubs: []*armnetwork.SubResource{ - // { - // }, - // { - // }}, - // VPNSites: []*armnetwork.SubResource{ - // { - // }, - // { - // }}, - // }, - // }}, - // } - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/4883fa5dbf6f2c9093fac8ce334547e9dfac68fa/specification/network/resource-manager/Microsoft.Network/stable/2024-03-01/examples/VirtualWANList.json -func ExampleVirtualWansClient_NewListPager() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armnetwork.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := clientFactory.NewVirtualWansClient().NewListPager(nil) - for pager.More() { - page, err := pager.NextPage(ctx) - if err != nil { - log.Fatalf("failed to advance page: %v", err) - } - for _, v := range page.Value { - // You could use page here. We use blank identifier for just demo purposes. - _ = v - } - // If the HTTP response code is 200 as defined in example definition, your page structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // page.ListVirtualWANsResult = armnetwork.ListVirtualWANsResult{ - // Value: []*armnetwork.VirtualWAN{ - // { - // Name: to.Ptr("wan1"), - // Type: to.Ptr("Microsoft.Network/virtualWANs"), - // ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/virtualWANs/wan1"), - // Location: to.Ptr("West US"), - // Tags: map[string]*string{ - // "key1": to.Ptr("value1"), - // }, - // Etag: to.Ptr("w/\\00000000-0000-0000-0000-000000000000\\"), - // Properties: &armnetwork.VirtualWanProperties{ - // Type: to.Ptr("Basic"), - // DisableVPNEncryption: to.Ptr(false), - // ProvisioningState: to.Ptr(armnetwork.ProvisioningStateSucceeded), - // VirtualHubs: []*armnetwork.SubResource{ - // { - // }, - // { - // }}, - // VPNSites: []*armnetwork.SubResource{ - // { - // }, - // { - // }}, - // }, - // }, - // { - // Name: to.Ptr("wan2"), - // Type: to.Ptr("Microsoft.Network/virtualWANs"), - // ID: to.Ptr("/subscriptions/subid/resourceGroups/rg2/providers/Microsoft.Network/virtualWANs/wan2"), - // Location: to.Ptr("East US"), - // Tags: map[string]*string{ - // "key1": to.Ptr("value1"), - // }, - // Etag: to.Ptr("w/\\00000000-0000-0000-0000-000000000000\\"), - // Properties: &armnetwork.VirtualWanProperties{ - // Type: to.Ptr("Basic"), - // DisableVPNEncryption: to.Ptr(false), - // ProvisioningState: to.Ptr(armnetwork.ProvisioningStateSucceeded), - // VirtualHubs: []*armnetwork.SubResource{ - // { - // }, - // { - // }}, - // VPNSites: []*armnetwork.SubResource{ - // { - // }, - // { - // }}, - // }, - // }}, - // } - } -} diff --git a/sdk/resourcemanager/network/armnetwork/vpnconnections_client_example_test.go b/sdk/resourcemanager/network/armnetwork/vpnconnections_client_example_test.go deleted file mode 100644 index 486c9a58b70a..000000000000 --- a/sdk/resourcemanager/network/armnetwork/vpnconnections_client_example_test.go +++ /dev/null @@ -1,411 +0,0 @@ -//go:build go1.18 -// +build go1.18 - -// 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. -// DO NOT EDIT. - -package armnetwork_test - -import ( - "context" - "log" - - "github.com/Azure/azure-sdk-for-go/sdk/azcore/to" - "github.com/Azure/azure-sdk-for-go/sdk/azidentity" - "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/network/armnetwork/v6" -) - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/4883fa5dbf6f2c9093fac8ce334547e9dfac68fa/specification/network/resource-manager/Microsoft.Network/stable/2024-03-01/examples/VpnConnectionGet.json -func ExampleVPNConnectionsClient_Get() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armnetwork.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewVPNConnectionsClient().Get(ctx, "rg1", "gateway1", "vpnConnection1", nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.VPNConnection = armnetwork.VPNConnection{ - // ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/vpnGateways/gateway1/vpnConnections/vpnConnection1"), - // Name: to.Ptr("vpnConnection1"), - // Etag: to.Ptr("w/\\00000000-0000-0000-0000-000000000000\\"), - // Properties: &armnetwork.VPNConnectionProperties{ - // EgressBytesTransferred: to.Ptr[int64](0), - // EnableInternetSecurity: to.Ptr(false), - // IngressBytesTransferred: to.Ptr[int64](0), - // ProvisioningState: to.Ptr(armnetwork.ProvisioningStateSucceeded), - // RemoteVPNSite: &armnetwork.SubResource{ - // ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/vpnSites/vpnSite1"), - // }, - // RoutingConfiguration: &armnetwork.RoutingConfiguration{ - // AssociatedRouteTable: &armnetwork.SubResource{ - // ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/virtualHubs/hub1/hubRouteTables/hubRouteTable1"), - // }, - // InboundRouteMap: &armnetwork.SubResource{ - // ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/virtualHubs/virtualHub1/routeMaps/routeMap1"), - // }, - // OutboundRouteMap: &armnetwork.SubResource{ - // ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/virtualHubs/virtualHub1/routeMaps/routeMap2"), - // }, - // PropagatedRouteTables: &armnetwork.PropagatedRouteTable{ - // IDs: []*armnetwork.SubResource{ - // { - // ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/virtualHubs/hub1/hubRouteTables/hubRouteTable1"), - // }, - // { - // ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/virtualHubs/hub1/hubRouteTables/hubRouteTable2"), - // }, - // { - // ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/virtualHubs/hub1/hubRouteTables/hubRouteTable3"), - // }}, - // Labels: []*string{ - // to.Ptr("label1"), - // to.Ptr("label2")}, - // }, - // }, - // TrafficSelectorPolicies: []*armnetwork.TrafficSelectorPolicy{ - // }, - // VPNLinkConnections: []*armnetwork.VPNSiteLinkConnection{ - // { - // ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/vpnGateways/gateway1/vpnConnections/vpnConnection1/VpnSiteLinkConnections/Connection-Link1"), - // Name: to.Ptr("Connection-Link1"), - // Type: to.Ptr("Microsoft.Network/vpnGateways/vpnConnections/VpnSiteLinkConnections"), - // Etag: to.Ptr("w/\\00000000-0000-0000-0000-000000000000\\"), - // Properties: &armnetwork.VPNSiteLinkConnectionProperties{ - // ConnectionBandwidth: to.Ptr[int32](200), - // EgressBytesTransferred: to.Ptr[int64](0), - // EnableBgp: to.Ptr(false), - // EnableRateLimiting: to.Ptr(false), - // IngressBytesTransferred: to.Ptr[int64](0), - // IPSecPolicies: []*armnetwork.IPSecPolicy{ - // }, - // ProvisioningState: to.Ptr(armnetwork.ProvisioningStateSucceeded), - // RoutingWeight: to.Ptr[int32](0), - // SharedKey: to.Ptr("key"), - // UseLocalAzureIPAddress: to.Ptr(false), - // UsePolicyBasedTrafficSelectors: to.Ptr(false), - // VPNConnectionProtocolType: to.Ptr(armnetwork.VirtualNetworkGatewayConnectionProtocolIKEv2), - // VPNLinkConnectionMode: to.Ptr(armnetwork.VPNLinkConnectionModeResponderOnly), - // VPNSiteLink: &armnetwork.SubResource{ - // ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/vpnSites/vpnSite1/vpnSiteLinks/siteLink1"), - // }, - // }, - // }, - // { - // ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/vpnGateways/gateway1/vpnConnections/vpnConnection1/VpnSiteLinkConnections/Connection-Link2"), - // Name: to.Ptr("Connection-Link2"), - // Type: to.Ptr("Microsoft.Network/vpnGateways/vpnConnections/VpnSiteLinkConnections"), - // Etag: to.Ptr("w/\\00000000-0000-0000-0000-000000000000\\"), - // Properties: &armnetwork.VPNSiteLinkConnectionProperties{ - // ConnectionBandwidth: to.Ptr[int32](200), - // EgressBytesTransferred: to.Ptr[int64](0), - // EnableBgp: to.Ptr(false), - // EnableRateLimiting: to.Ptr(false), - // IngressBytesTransferred: to.Ptr[int64](0), - // IPSecPolicies: []*armnetwork.IPSecPolicy{ - // }, - // ProvisioningState: to.Ptr(armnetwork.ProvisioningStateSucceeded), - // RoutingWeight: to.Ptr[int32](0), - // SharedKey: to.Ptr("key"), - // UseLocalAzureIPAddress: to.Ptr(false), - // UsePolicyBasedTrafficSelectors: to.Ptr(false), - // VPNConnectionProtocolType: to.Ptr(armnetwork.VirtualNetworkGatewayConnectionProtocolIKEv2), - // VPNLinkConnectionMode: to.Ptr(armnetwork.VPNLinkConnectionModeInitiatorOnly), - // VPNSiteLink: &armnetwork.SubResource{ - // ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/vpnSites/vpnSite1/vpnSiteLinks/siteLink2"), - // }, - // }, - // }}, - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/4883fa5dbf6f2c9093fac8ce334547e9dfac68fa/specification/network/resource-manager/Microsoft.Network/stable/2024-03-01/examples/VpnConnectionPut.json -func ExampleVPNConnectionsClient_BeginCreateOrUpdate() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armnetwork.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewVPNConnectionsClient().BeginCreateOrUpdate(ctx, "rg1", "gateway1", "vpnConnection1", armnetwork.VPNConnection{ - Properties: &armnetwork.VPNConnectionProperties{ - RemoteVPNSite: &armnetwork.SubResource{ - ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/vpnSites/vpnSite1"), - }, - RoutingConfiguration: &armnetwork.RoutingConfiguration{ - AssociatedRouteTable: &armnetwork.SubResource{ - ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/virtualHubs/hub1/hubRouteTables/hubRouteTable1"), - }, - InboundRouteMap: &armnetwork.SubResource{ - ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/virtualHubs/virtualHub1/routeMaps/routeMap1"), - }, - OutboundRouteMap: &armnetwork.SubResource{ - ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/virtualHubs/virtualHub1/routeMaps/routeMap2"), - }, - PropagatedRouteTables: &armnetwork.PropagatedRouteTable{ - IDs: []*armnetwork.SubResource{ - { - ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/virtualHubs/hub1/hubRouteTables/hubRouteTable1"), - }, - { - ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/virtualHubs/hub1/hubRouteTables/hubRouteTable2"), - }, - { - ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/virtualHubs/hub1/hubRouteTables/hubRouteTable3"), - }}, - Labels: []*string{ - to.Ptr("label1"), - to.Ptr("label2")}, - }, - }, - TrafficSelectorPolicies: []*armnetwork.TrafficSelectorPolicy{}, - VPNLinkConnections: []*armnetwork.VPNSiteLinkConnection{ - { - Name: to.Ptr("Connection-Link1"), - Properties: &armnetwork.VPNSiteLinkConnectionProperties{ - ConnectionBandwidth: to.Ptr[int32](200), - SharedKey: to.Ptr("key"), - UsePolicyBasedTrafficSelectors: to.Ptr(false), - VPNConnectionProtocolType: to.Ptr(armnetwork.VirtualNetworkGatewayConnectionProtocolIKEv2), - VPNLinkConnectionMode: to.Ptr(armnetwork.VPNLinkConnectionModeDefault), - VPNSiteLink: &armnetwork.SubResource{ - ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/vpnSites/vpnSite1/vpnSiteLinks/siteLink1"), - }, - }, - }}, - }, - }, nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - res, err := poller.PollUntilDone(ctx, nil) - if err != nil { - log.Fatalf("failed to pull the result: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.VPNConnection = armnetwork.VPNConnection{ - // ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/vpnGateways/gateway1/vpnConnections/vpnConnection1"), - // Name: to.Ptr("vpnConnection1"), - // Etag: to.Ptr("w/\\00000000-0000-0000-0000-000000000000\\"), - // Properties: &armnetwork.VPNConnectionProperties{ - // EgressBytesTransferred: to.Ptr[int64](0), - // EnableInternetSecurity: to.Ptr(false), - // IngressBytesTransferred: to.Ptr[int64](0), - // ProvisioningState: to.Ptr(armnetwork.ProvisioningStateSucceeded), - // RemoteVPNSite: &armnetwork.SubResource{ - // ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/vpnSites/vpnSite1"), - // }, - // RoutingConfiguration: &armnetwork.RoutingConfiguration{ - // AssociatedRouteTable: &armnetwork.SubResource{ - // ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/virtualHubs/hub1/hubRouteTables/hubRouteTable1"), - // }, - // InboundRouteMap: &armnetwork.SubResource{ - // ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/virtualHubs/virtualHub1/routeMaps/routeMap1"), - // }, - // OutboundRouteMap: &armnetwork.SubResource{ - // ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/virtualHubs/virtualHub1/routeMaps/routeMap2"), - // }, - // PropagatedRouteTables: &armnetwork.PropagatedRouteTable{ - // IDs: []*armnetwork.SubResource{ - // { - // ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/virtualHubs/hub1/hubRouteTables/hubRouteTable1"), - // }, - // { - // ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/virtualHubs/hub1/hubRouteTables/hubRouteTable2"), - // }, - // { - // ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/virtualHubs/hub1/hubRouteTables/hubRouteTable3"), - // }}, - // Labels: []*string{ - // to.Ptr("label1"), - // to.Ptr("label2")}, - // }, - // }, - // TrafficSelectorPolicies: []*armnetwork.TrafficSelectorPolicy{ - // }, - // VPNLinkConnections: []*armnetwork.VPNSiteLinkConnection{ - // { - // ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/vpnGateways/gateway1/vpnConnections/vpnConnection1/VpnSiteLinkConnections/Connection-Link1"), - // Name: to.Ptr("Connection-Link1"), - // Type: to.Ptr("Microsoft.Network/vpnGateways/vpnConnections/VpnSiteLinkConnections"), - // Etag: to.Ptr("w/\\00000000-0000-0000-0000-000000000000\\"), - // Properties: &armnetwork.VPNSiteLinkConnectionProperties{ - // ConnectionBandwidth: to.Ptr[int32](200), - // EgressBytesTransferred: to.Ptr[int64](0), - // EnableBgp: to.Ptr(false), - // EnableRateLimiting: to.Ptr(false), - // IngressBytesTransferred: to.Ptr[int64](0), - // IPSecPolicies: []*armnetwork.IPSecPolicy{ - // }, - // ProvisioningState: to.Ptr(armnetwork.ProvisioningStateSucceeded), - // RoutingWeight: to.Ptr[int32](0), - // SharedKey: to.Ptr("key"), - // UseLocalAzureIPAddress: to.Ptr(false), - // UsePolicyBasedTrafficSelectors: to.Ptr(false), - // VPNConnectionProtocolType: to.Ptr(armnetwork.VirtualNetworkGatewayConnectionProtocolIKEv2), - // VPNLinkConnectionMode: to.Ptr(armnetwork.VPNLinkConnectionModeDefault), - // VPNSiteLink: &armnetwork.SubResource{ - // ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/vpnSites/vpnSite1/vpnSiteLinks/siteLink1"), - // }, - // }, - // }}, - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/4883fa5dbf6f2c9093fac8ce334547e9dfac68fa/specification/network/resource-manager/Microsoft.Network/stable/2024-03-01/examples/VpnConnectionDelete.json -func ExampleVPNConnectionsClient_BeginDelete() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armnetwork.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewVPNConnectionsClient().BeginDelete(ctx, "rg1", "gateway1", "vpnConnection1", nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - _, err = poller.PollUntilDone(ctx, nil) - if err != nil { - log.Fatalf("failed to pull the result: %v", err) - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/4883fa5dbf6f2c9093fac8ce334547e9dfac68fa/specification/network/resource-manager/Microsoft.Network/stable/2024-03-01/examples/VpnConnectionStartPacketCaptureFilterData.json -func ExampleVPNConnectionsClient_BeginStartPacketCapture_startPacketCaptureOnVpnConnectionWithFilter() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armnetwork.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewVPNConnectionsClient().BeginStartPacketCapture(ctx, "rg1", "gateway1", "vpnConnection1", &armnetwork.VPNConnectionsClientBeginStartPacketCaptureOptions{Parameters: &armnetwork.VPNConnectionPacketCaptureStartParameters{ - FilterData: to.Ptr("{'TracingFlags': 11,'MaxPacketBufferSize': 120,'MaxFileSize': 200,'Filters': [{'SourceSubnets': ['20.1.1.0/24'],'DestinationSubnets': ['10.1.1.0/24'],'SourcePort': [500],'DestinationPort': [4500],'Protocol': 6,'TcpFlags': 16,'CaptureSingleDirectionTrafficOnly': true}]}"), - LinkConnectionNames: []*string{ - to.Ptr("siteLink1"), - to.Ptr("siteLink2")}, - }, - }) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - res, err := poller.PollUntilDone(ctx, nil) - if err != nil { - log.Fatalf("failed to pull the result: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.Value = "\"{\"Status\":\"Successful\",\"Data\":null}\"" -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/4883fa5dbf6f2c9093fac8ce334547e9dfac68fa/specification/network/resource-manager/Microsoft.Network/stable/2024-03-01/examples/VpnConnectionStartPacketCapture.json -func ExampleVPNConnectionsClient_BeginStartPacketCapture_startPacketCaptureOnVpnConnectionWithoutFilter() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armnetwork.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewVPNConnectionsClient().BeginStartPacketCapture(ctx, "rg1", "gateway1", "vpnConnection1", &armnetwork.VPNConnectionsClientBeginStartPacketCaptureOptions{Parameters: &armnetwork.VPNConnectionPacketCaptureStartParameters{ - LinkConnectionNames: []*string{ - to.Ptr("siteLink1"), - to.Ptr("siteLink2")}, - }, - }) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - res, err := poller.PollUntilDone(ctx, nil) - if err != nil { - log.Fatalf("failed to pull the result: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.Value = "\"{\"Status\":\"Successful\",\"Data\":null}\"" -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/4883fa5dbf6f2c9093fac8ce334547e9dfac68fa/specification/network/resource-manager/Microsoft.Network/stable/2024-03-01/examples/VpnConnectionStopPacketCapture.json -func ExampleVPNConnectionsClient_BeginStopPacketCapture() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armnetwork.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewVPNConnectionsClient().BeginStopPacketCapture(ctx, "rg1", "gateway1", "vpnConnection1", &armnetwork.VPNConnectionsClientBeginStopPacketCaptureOptions{Parameters: &armnetwork.VPNConnectionPacketCaptureStopParameters{ - LinkConnectionNames: []*string{ - to.Ptr("vpnSiteLink1"), - to.Ptr("vpnSiteLink2")}, - SasURL: to.Ptr("https://teststorage.blob.core.windows.net/?sv=2018-03-28&ss=bfqt&srt=sco&sp=rwdlacup&se=2019-09-13T07:44:05Z&st=2019-09-06T23:44:05Z&spr=https&sig=V1h9D1riltvZMI69d6ihENnFo%2FrCvTqGgjO2lf%2FVBhE%3D"), - }, - }) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - res, err := poller.PollUntilDone(ctx, nil) - if err != nil { - log.Fatalf("failed to pull the result: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.Value = "\"{\"Status\":\"Successful\",\"Data\":null}\"" -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/4883fa5dbf6f2c9093fac8ce334547e9dfac68fa/specification/network/resource-manager/Microsoft.Network/stable/2024-03-01/examples/VpnConnectionList.json -func ExampleVPNConnectionsClient_NewListByVPNGatewayPager() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armnetwork.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := clientFactory.NewVPNConnectionsClient().NewListByVPNGatewayPager("rg1", "gateway1", nil) - for pager.More() { - page, err := pager.NextPage(ctx) - if err != nil { - log.Fatalf("failed to advance page: %v", err) - } - for _, v := range page.Value { - // You could use page here. We use blank identifier for just demo purposes. - _ = v - } - // If the HTTP response code is 200 as defined in example definition, your page structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // page.ListVPNConnectionsResult = armnetwork.ListVPNConnectionsResult{ - // } - } -} diff --git a/sdk/resourcemanager/network/armnetwork/vpngateways_client_example_test.go b/sdk/resourcemanager/network/armnetwork/vpngateways_client_example_test.go deleted file mode 100644 index c56ce4a23c2b..000000000000 --- a/sdk/resourcemanager/network/armnetwork/vpngateways_client_example_test.go +++ /dev/null @@ -1,1334 +0,0 @@ -//go:build go1.18 -// +build go1.18 - -// 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. -// DO NOT EDIT. - -package armnetwork_test - -import ( - "context" - "log" - - "github.com/Azure/azure-sdk-for-go/sdk/azcore/to" - "github.com/Azure/azure-sdk-for-go/sdk/azidentity" - "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/network/armnetwork/v6" -) - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/4883fa5dbf6f2c9093fac8ce334547e9dfac68fa/specification/network/resource-manager/Microsoft.Network/stable/2024-03-01/examples/VpnGatewayGet.json -func ExampleVPNGatewaysClient_Get() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armnetwork.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewVPNGatewaysClient().Get(ctx, "rg1", "gateway1", nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.VPNGateway = armnetwork.VPNGateway{ - // Name: to.Ptr("gateway1"), - // Type: to.Ptr("Microsoft.Network/vpnGateways"), - // ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/vpnGateways/gateway1"), - // Location: to.Ptr("West US"), - // Etag: to.Ptr("w/\\00000000-0000-0000-0000-000000000000\\"), - // Properties: &armnetwork.VPNGatewayProperties{ - // BgpSettings: &armnetwork.BgpSettings{ - // Asn: to.Ptr[int64](65514), - // BgpPeeringAddress: to.Ptr("10.0.1.30"), - // BgpPeeringAddresses: []*armnetwork.IPConfigurationBgpPeeringAddress{ - // { - // CustomBgpIPAddresses: []*string{ - // to.Ptr("169.254.21.5")}, - // DefaultBgpIPAddresses: []*string{ - // to.Ptr("10.30.0.4")}, - // IPConfigurationID: to.Ptr("Instance0"), - // TunnelIPAddresses: []*string{ - // to.Ptr("104.208.48.178")}, - // }, - // { - // CustomBgpIPAddresses: []*string{ - // to.Ptr("169.254.21.10")}, - // DefaultBgpIPAddresses: []*string{ - // to.Ptr("10.30.0.5")}, - // IPConfigurationID: to.Ptr("Instance1"), - // TunnelIPAddresses: []*string{ - // to.Ptr("104.208.48.179")}, - // }}, - // PeerWeight: to.Ptr[int32](0), - // }, - // Connections: []*armnetwork.VPNConnection{ - // { - // ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/vpnGateways/gateway1/vpnConnections/vpnConnection1"), - // Name: to.Ptr("vpnConnection1"), - // Etag: to.Ptr("w/\\00000000-0000-0000-0000-000000000000\\"), - // Properties: &armnetwork.VPNConnectionProperties{ - // EgressBytesTransferred: to.Ptr[int64](0), - // EnableInternetSecurity: to.Ptr(false), - // IngressBytesTransferred: to.Ptr[int64](0), - // ProvisioningState: to.Ptr(armnetwork.ProvisioningStateSucceeded), - // RemoteVPNSite: &armnetwork.SubResource{ - // ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/vpnSites/vpnSite1"), - // }, - // RoutingConfiguration: &armnetwork.RoutingConfiguration{ - // AssociatedRouteTable: &armnetwork.SubResource{ - // ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/virtualHubs/virtualHub1/hubRouteTables/hubRouteTable1"), - // }, - // PropagatedRouteTables: &armnetwork.PropagatedRouteTable{ - // IDs: []*armnetwork.SubResource{ - // { - // ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/virtualHubs/virtualHub1/hubRouteTables/hubRouteTable1"), - // }, - // { - // ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/virtualHubs/virtualHub1/hubRouteTables/hubRouteTable2"), - // }, - // { - // ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/virtualHubs/virtualHub1/hubRouteTables/hubRouteTable3"), - // }}, - // Labels: []*string{ - // to.Ptr("label1"), - // to.Ptr("label2")}, - // }, - // VnetRoutes: &armnetwork.VnetRoute{ - // StaticRoutes: []*armnetwork.StaticRoute{ - // }, - // }, - // }, - // VPNLinkConnections: []*armnetwork.VPNSiteLinkConnection{ - // { - // ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/vpnGateways/gateway1/vpnConnections/vpnConnection1/VpnSiteLinkConnections/Connection-Link1"), - // Name: to.Ptr("Connection-Link1"), - // Type: to.Ptr("Microsoft.Network/vpnGateways/vpnConnections/VpnSiteLinkConnections"), - // Etag: to.Ptr("w/\\00000000-0000-0000-0000-000000000000\\"), - // Properties: &armnetwork.VPNSiteLinkConnectionProperties{ - // ConnectionBandwidth: to.Ptr[int32](200), - // EgressBytesTransferred: to.Ptr[int64](0), - // EnableBgp: to.Ptr(false), - // EnableRateLimiting: to.Ptr(false), - // IngressBytesTransferred: to.Ptr[int64](0), - // IngressNatRules: []*armnetwork.SubResource{ - // { - // ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/vpnGateways/gateway1/natRules/nat03"), - // }}, - // IPSecPolicies: []*armnetwork.IPSecPolicy{ - // }, - // ProvisioningState: to.Ptr(armnetwork.ProvisioningStateSucceeded), - // RoutingWeight: to.Ptr[int32](0), - // SharedKey: to.Ptr("key"), - // UseLocalAzureIPAddress: to.Ptr(false), - // UsePolicyBasedTrafficSelectors: to.Ptr(false), - // VPNConnectionProtocolType: to.Ptr(armnetwork.VirtualNetworkGatewayConnectionProtocolIKEv2), - // VPNSiteLink: &armnetwork.SubResource{ - // ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/vpnSites/vpnSite1/vpnSiteLinks/siteLink1"), - // }, - // }, - // }, - // { - // ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/vpnGateways/gateway1/vpnConnections/vpnConnection1/VpnSiteLinkConnections/Connection-Link2"), - // Name: to.Ptr("Connection-Link2"), - // Type: to.Ptr("Microsoft.Network/vpnGateways/vpnConnections/VpnSiteLinkConnections"), - // Etag: to.Ptr("w/\\00000000-0000-0000-0000-000000000000\\"), - // Properties: &armnetwork.VPNSiteLinkConnectionProperties{ - // ConnectionBandwidth: to.Ptr[int32](200), - // EgressBytesTransferred: to.Ptr[int64](0), - // EgressNatRules: []*armnetwork.SubResource{ - // { - // ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/vpnGateways/gateway1/natRules/nat04"), - // }}, - // EnableBgp: to.Ptr(false), - // EnableRateLimiting: to.Ptr(false), - // IngressBytesTransferred: to.Ptr[int64](0), - // IPSecPolicies: []*armnetwork.IPSecPolicy{ - // }, - // ProvisioningState: to.Ptr(armnetwork.ProvisioningStateSucceeded), - // RoutingWeight: to.Ptr[int32](0), - // SharedKey: to.Ptr("key"), - // UseLocalAzureIPAddress: to.Ptr(false), - // UsePolicyBasedTrafficSelectors: to.Ptr(false), - // VPNConnectionProtocolType: to.Ptr(armnetwork.VirtualNetworkGatewayConnectionProtocolIKEv2), - // VPNSiteLink: &armnetwork.SubResource{ - // ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/vpnSites/vpnSite1/vpnSiteLinks/siteLink2"), - // }, - // }, - // }}, - // }, - // }}, - // EnableBgpRouteTranslationForNat: to.Ptr(false), - // IsRoutingPreferenceInternet: to.Ptr(false), - // NatRules: []*armnetwork.VPNGatewayNatRule{ - // { - // ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/vpnGateways/gateway1/natRules/nat03"), - // Name: to.Ptr("nat03"), - // Type: to.Ptr("Microsoft.Network/vpnGateways/natRules"), - // Properties: &armnetwork.VPNGatewayNatRuleProperties{ - // Type: to.Ptr(armnetwork.VPNNatRuleTypeDynamic), - // ExternalMappings: []*armnetwork.VPNNatRuleMapping{ - // { - // AddressSpace: to.Ptr("192.168.0.0/26"), - // }}, - // IngressVPNSiteLinkConnections: []*armnetwork.SubResource{ - // { - // ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/vpnGateways/gateway1/vpnConnections/vpnConnection1/vpnLinkConnections/Connection-Link1"), - // }}, - // InternalMappings: []*armnetwork.VPNNatRuleMapping{ - // { - // AddressSpace: to.Ptr("0.0.0.0/26"), - // }}, - // Mode: to.Ptr(armnetwork.VPNNatRuleMode("IgressSnat")), - // }, - // }, - // { - // ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/vpnGateways/gateway1/natRules/nat04"), - // Name: to.Ptr("nat04"), - // Type: to.Ptr("Microsoft.Network/vpnGateways/natRules"), - // Properties: &armnetwork.VPNGatewayNatRuleProperties{ - // Type: to.Ptr(armnetwork.VPNNatRuleTypeStatic), - // EgressVPNSiteLinkConnections: []*armnetwork.SubResource{ - // { - // ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/vpnGateways/gateway1/vpnConnections/vpnConnection1/vpnLinkConnections/Connection-Link2"), - // }}, - // ExternalMappings: []*armnetwork.VPNNatRuleMapping{ - // { - // AddressSpace: to.Ptr("192.168.0.0/26"), - // }}, - // InternalMappings: []*armnetwork.VPNNatRuleMapping{ - // { - // AddressSpace: to.Ptr("0.0.0.0/26"), - // }}, - // Mode: to.Ptr(armnetwork.VPNNatRuleModeEgressSnat), - // }, - // }}, - // ProvisioningState: to.Ptr(armnetwork.ProvisioningStateSucceeded), - // VirtualHub: &armnetwork.SubResource{ - // ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/virtualHubs/virtualHub1"), - // }, - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/4883fa5dbf6f2c9093fac8ce334547e9dfac68fa/specification/network/resource-manager/Microsoft.Network/stable/2024-03-01/examples/VpnGatewayPut.json -func ExampleVPNGatewaysClient_BeginCreateOrUpdate() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armnetwork.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewVPNGatewaysClient().BeginCreateOrUpdate(ctx, "rg1", "gateway1", armnetwork.VPNGateway{ - Location: to.Ptr("westcentralus"), - Tags: map[string]*string{ - "key1": to.Ptr("value1"), - }, - Properties: &armnetwork.VPNGatewayProperties{ - BgpSettings: &armnetwork.BgpSettings{ - Asn: to.Ptr[int64](65515), - BgpPeeringAddresses: []*armnetwork.IPConfigurationBgpPeeringAddress{ - { - CustomBgpIPAddresses: []*string{ - to.Ptr("169.254.21.5")}, - IPConfigurationID: to.Ptr("Instance0"), - }, - { - CustomBgpIPAddresses: []*string{ - to.Ptr("169.254.21.10")}, - IPConfigurationID: to.Ptr("Instance1"), - }}, - PeerWeight: to.Ptr[int32](0), - }, - Connections: []*armnetwork.VPNConnection{ - { - Name: to.Ptr("vpnConnection1"), - Properties: &armnetwork.VPNConnectionProperties{ - RemoteVPNSite: &armnetwork.SubResource{ - ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/vpnSites/vpnSite1"), - }, - VPNLinkConnections: []*armnetwork.VPNSiteLinkConnection{ - { - Name: to.Ptr("Connection-Link1"), - Properties: &armnetwork.VPNSiteLinkConnectionProperties{ - ConnectionBandwidth: to.Ptr[int32](200), - EgressNatRules: []*armnetwork.SubResource{ - { - ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/vpnGateways/gateway1/natRules/nat03"), - }}, - SharedKey: to.Ptr("key"), - VPNConnectionProtocolType: to.Ptr(armnetwork.VirtualNetworkGatewayConnectionProtocolIKEv2), - VPNSiteLink: &armnetwork.SubResource{ - ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/vpnSites/vpnSite1/vpnSiteLinks/siteLink1"), - }, - }, - }}, - }, - }}, - EnableBgpRouteTranslationForNat: to.Ptr(false), - IsRoutingPreferenceInternet: to.Ptr(false), - NatRules: []*armnetwork.VPNGatewayNatRule{ - { - Name: to.Ptr("nat03"), - Properties: &armnetwork.VPNGatewayNatRuleProperties{ - Type: to.Ptr(armnetwork.VPNNatRuleTypeStatic), - ExternalMappings: []*armnetwork.VPNNatRuleMapping{ - { - AddressSpace: to.Ptr("192.168.0.0/26"), - }}, - InternalMappings: []*armnetwork.VPNNatRuleMapping{ - { - AddressSpace: to.Ptr("0.0.0.0/26"), - }}, - IPConfigurationID: to.Ptr(""), - Mode: to.Ptr(armnetwork.VPNNatRuleModeEgressSnat), - }, - }}, - VirtualHub: &armnetwork.SubResource{ - ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/virtualHubs/virtualHub1"), - }, - }, - }, nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - res, err := poller.PollUntilDone(ctx, nil) - if err != nil { - log.Fatalf("failed to pull the result: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.VPNGateway = armnetwork.VPNGateway{ - // Name: to.Ptr("gateway1"), - // Type: to.Ptr("Microsoft.Network/vpnGateways"), - // ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/vpnGateways/gateway1"), - // Location: to.Ptr("West US"), - // Etag: to.Ptr("w/\\00000000-0000-0000-0000-000000000000\\"), - // Properties: &armnetwork.VPNGatewayProperties{ - // BgpSettings: &armnetwork.BgpSettings{ - // Asn: to.Ptr[int64](65514), - // BgpPeeringAddress: to.Ptr("10.0.1.30"), - // BgpPeeringAddresses: []*armnetwork.IPConfigurationBgpPeeringAddress{ - // { - // CustomBgpIPAddresses: []*string{ - // to.Ptr("169.254.21.5")}, - // DefaultBgpIPAddresses: []*string{ - // to.Ptr("10.30.0.4")}, - // IPConfigurationID: to.Ptr("Instance0"), - // TunnelIPAddresses: []*string{ - // to.Ptr("104.208.48.178")}, - // }, - // { - // CustomBgpIPAddresses: []*string{ - // to.Ptr("169.254.21.10")}, - // DefaultBgpIPAddresses: []*string{ - // to.Ptr("10.30.0.5")}, - // IPConfigurationID: to.Ptr("Instance1"), - // TunnelIPAddresses: []*string{ - // to.Ptr("104.208.48.179")}, - // }}, - // PeerWeight: to.Ptr[int32](0), - // }, - // Connections: []*armnetwork.VPNConnection{ - // { - // ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/vpnGateways/gateway1/vpnConnections/vpnConnection1"), - // Name: to.Ptr("vpnConnection1"), - // Etag: to.Ptr("w/\\00000000-0000-0000-0000-000000000000\\"), - // Properties: &armnetwork.VPNConnectionProperties{ - // EgressBytesTransferred: to.Ptr[int64](0), - // EnableInternetSecurity: to.Ptr(false), - // IngressBytesTransferred: to.Ptr[int64](0), - // ProvisioningState: to.Ptr(armnetwork.ProvisioningStateSucceeded), - // RemoteVPNSite: &armnetwork.SubResource{ - // ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/vpnSites/vpnSite1"), - // }, - // RoutingConfiguration: &armnetwork.RoutingConfiguration{ - // AssociatedRouteTable: &armnetwork.SubResource{ - // ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/virtualHubs/virtualHub1/hubRouteTables/hubRouteTable1"), - // }, - // PropagatedRouteTables: &armnetwork.PropagatedRouteTable{ - // IDs: []*armnetwork.SubResource{ - // { - // ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/virtualHubs/virtualHub1/hubRouteTables/hubRouteTable1"), - // }, - // { - // ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/virtualHubs/virtualHub1/hubRouteTables/hubRouteTable2"), - // }, - // { - // ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/virtualHubs/virtualHub1/hubRouteTables/hubRouteTable3"), - // }}, - // Labels: []*string{ - // to.Ptr("label1"), - // to.Ptr("label2")}, - // }, - // VnetRoutes: &armnetwork.VnetRoute{ - // StaticRoutes: []*armnetwork.StaticRoute{ - // }, - // }, - // }, - // VPNLinkConnections: []*armnetwork.VPNSiteLinkConnection{ - // { - // ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/vpnGateways/gateway1/vpnConnections/vpnConnection1/VpnSiteLinkConnections/Connection-Link1"), - // Name: to.Ptr("Connection-Link1"), - // Type: to.Ptr("Microsoft.Network/vpnGateways/vpnConnections/VpnSiteLinkConnections"), - // Etag: to.Ptr("w/\\00000000-0000-0000-0000-000000000000\\"), - // Properties: &armnetwork.VPNSiteLinkConnectionProperties{ - // ConnectionBandwidth: to.Ptr[int32](200), - // EgressBytesTransferred: to.Ptr[int64](0), - // EgressNatRules: []*armnetwork.SubResource{ - // { - // ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/vpnGateways/gateway1/natRules/nat03"), - // }}, - // EnableBgp: to.Ptr(false), - // EnableRateLimiting: to.Ptr(false), - // IngressBytesTransferred: to.Ptr[int64](0), - // IPSecPolicies: []*armnetwork.IPSecPolicy{ - // }, - // ProvisioningState: to.Ptr(armnetwork.ProvisioningStateSucceeded), - // RoutingWeight: to.Ptr[int32](0), - // SharedKey: to.Ptr("key"), - // UseLocalAzureIPAddress: to.Ptr(false), - // UsePolicyBasedTrafficSelectors: to.Ptr(false), - // VPNConnectionProtocolType: to.Ptr(armnetwork.VirtualNetworkGatewayConnectionProtocolIKEv2), - // VPNSiteLink: &armnetwork.SubResource{ - // ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/vpnSites/vpnSite1/vpnSiteLinks/siteLink1"), - // }, - // }, - // }}, - // }, - // }}, - // IsRoutingPreferenceInternet: to.Ptr(false), - // NatRules: []*armnetwork.VPNGatewayNatRule{ - // { - // ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/vpnGateways/gateway1/natRules/nat03"), - // Name: to.Ptr("nat03"), - // Etag: to.Ptr("w/\\00000000-0000-0000-0000-000000000000\\"), - // Properties: &armnetwork.VPNGatewayNatRuleProperties{ - // Type: to.Ptr(armnetwork.VPNNatRuleTypeStatic), - // EgressVPNSiteLinkConnections: []*armnetwork.SubResource{ - // { - // ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/vpnGateways/gateway1/vpnConnections/vpnConnection1/vpnLinkConnections/Connection-Link1"), - // }}, - // ExternalMappings: []*armnetwork.VPNNatRuleMapping{ - // { - // AddressSpace: to.Ptr("192.168.0.0/26"), - // }}, - // InternalMappings: []*armnetwork.VPNNatRuleMapping{ - // { - // AddressSpace: to.Ptr("0.0.0.0/26"), - // }}, - // Mode: to.Ptr(armnetwork.VPNNatRuleModeEgressSnat), - // }, - // }}, - // ProvisioningState: to.Ptr(armnetwork.ProvisioningStateSucceeded), - // VirtualHub: &armnetwork.SubResource{ - // ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/virtualHubs/virtualHub1"), - // }, - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/4883fa5dbf6f2c9093fac8ce334547e9dfac68fa/specification/network/resource-manager/Microsoft.Network/stable/2024-03-01/examples/VpnGatewayUpdateTags.json -func ExampleVPNGatewaysClient_BeginUpdateTags() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armnetwork.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewVPNGatewaysClient().BeginUpdateTags(ctx, "rg1", "gateway1", armnetwork.TagsObject{ - Tags: map[string]*string{ - "tag1": to.Ptr("value1"), - "tag2": to.Ptr("value2"), - }, - }, nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - res, err := poller.PollUntilDone(ctx, nil) - if err != nil { - log.Fatalf("failed to pull the result: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.VPNGateway = armnetwork.VPNGateway{ - // Name: to.Ptr("gateway1"), - // Type: to.Ptr("Microsoft.Network/vpnGateways"), - // ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/vpnGateways/gateway1"), - // Location: to.Ptr("West US"), - // Tags: map[string]*string{ - // "key1": to.Ptr("value1"), - // "key2": to.Ptr("value2"), - // }, - // Etag: to.Ptr("w/\\00000000-0000-0000-0000-000000000000\\"), - // Properties: &armnetwork.VPNGatewayProperties{ - // BgpSettings: &armnetwork.BgpSettings{ - // Asn: to.Ptr[int64](65515), - // BgpPeeringAddress: to.Ptr("10.0.1.30"), - // BgpPeeringAddresses: []*armnetwork.IPConfigurationBgpPeeringAddress{ - // { - // CustomBgpIPAddresses: []*string{ - // to.Ptr("169.254.21.5")}, - // DefaultBgpIPAddresses: []*string{ - // to.Ptr("10.30.0.4")}, - // IPConfigurationID: to.Ptr("Instance0"), - // TunnelIPAddresses: []*string{ - // to.Ptr("104.208.48.178")}, - // }, - // { - // CustomBgpIPAddresses: []*string{ - // to.Ptr("169.254.21.10")}, - // DefaultBgpIPAddresses: []*string{ - // to.Ptr("10.30.0.5")}, - // IPConfigurationID: to.Ptr("Instance1"), - // TunnelIPAddresses: []*string{ - // to.Ptr("104.208.48.179")}, - // }}, - // PeerWeight: to.Ptr[int32](0), - // }, - // Connections: []*armnetwork.VPNConnection{ - // { - // ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/vpnGateways/gateway1/vpnConnections/vpnConnection1"), - // Name: to.Ptr("vpnConnection1"), - // Etag: to.Ptr("w/\\00000000-0000-0000-0000-000000000000\\"), - // Properties: &armnetwork.VPNConnectionProperties{ - // ConnectionStatus: to.Ptr(armnetwork.VPNConnectionStatusConnected), - // EgressBytesTransferred: to.Ptr[int64](0), - // EnableBgp: to.Ptr(false), - // IngressBytesTransferred: to.Ptr[int64](0), - // IPSecPolicies: []*armnetwork.IPSecPolicy{ - // }, - // ProvisioningState: to.Ptr(armnetwork.ProvisioningStateSucceeded), - // RemoteVPNSite: &armnetwork.SubResource{ - // ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/vpnSites/vpnSite1"), - // }, - // RoutingConfiguration: &armnetwork.RoutingConfiguration{ - // AssociatedRouteTable: &armnetwork.SubResource{ - // ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/virtualHubs/virtualHub1/hubRouteTables/hubRouteTable1"), - // }, - // PropagatedRouteTables: &armnetwork.PropagatedRouteTable{ - // IDs: []*armnetwork.SubResource{ - // { - // ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/virtualHubs/virtualHub1/hubRouteTables/hubRouteTable1"), - // }, - // { - // ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/virtualHubs/virtualHub1/hubRouteTables/hubRouteTable2"), - // }, - // { - // ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/virtualHubs/virtualHub1/hubRouteTables/hubRouteTable3"), - // }}, - // Labels: []*string{ - // to.Ptr("label1"), - // to.Ptr("label2")}, - // }, - // VnetRoutes: &armnetwork.VnetRoute{ - // StaticRoutes: []*armnetwork.StaticRoute{ - // }, - // }, - // }, - // RoutingWeight: to.Ptr[int32](0), - // SharedKey: to.Ptr("key"), - // }, - // }}, - // EnableBgpRouteTranslationForNat: to.Ptr(false), - // IsRoutingPreferenceInternet: to.Ptr(false), - // NatRules: []*armnetwork.VPNGatewayNatRule{ - // }, - // ProvisioningState: to.Ptr(armnetwork.ProvisioningStateSucceeded), - // VirtualHub: &armnetwork.SubResource{ - // ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/virtualHubs/virtualHub1"), - // }, - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/4883fa5dbf6f2c9093fac8ce334547e9dfac68fa/specification/network/resource-manager/Microsoft.Network/stable/2024-03-01/examples/VpnGatewayDelete.json -func ExampleVPNGatewaysClient_BeginDelete() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armnetwork.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewVPNGatewaysClient().BeginDelete(ctx, "rg1", "gateway1", nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - _, err = poller.PollUntilDone(ctx, nil) - if err != nil { - log.Fatalf("failed to pull the result: %v", err) - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/4883fa5dbf6f2c9093fac8ce334547e9dfac68fa/specification/network/resource-manager/Microsoft.Network/stable/2024-03-01/examples/VpnGatewayReset.json -func ExampleVPNGatewaysClient_BeginReset() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armnetwork.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewVPNGatewaysClient().BeginReset(ctx, "rg1", "vpngw", &armnetwork.VPNGatewaysClientBeginResetOptions{IPConfigurationID: nil}) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - res, err := poller.PollUntilDone(ctx, nil) - if err != nil { - log.Fatalf("failed to pull the result: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.VPNGateway = armnetwork.VPNGateway{ - // Name: to.Ptr("vpngw"), - // Type: to.Ptr("Microsoft.Network/vpnGateways"), - // ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/vpnGateways/vpngw"), - // Location: to.Ptr("West US"), - // Etag: to.Ptr("w/\\00000000-0000-0000-0000-000000000000\\"), - // Properties: &armnetwork.VPNGatewayProperties{ - // BgpSettings: &armnetwork.BgpSettings{ - // Asn: to.Ptr[int64](65514), - // BgpPeeringAddress: to.Ptr("10.0.1.30"), - // BgpPeeringAddresses: []*armnetwork.IPConfigurationBgpPeeringAddress{ - // { - // CustomBgpIPAddresses: []*string{ - // to.Ptr("169.254.21.5")}, - // DefaultBgpIPAddresses: []*string{ - // to.Ptr("10.30.0.4")}, - // IPConfigurationID: to.Ptr("Instance0"), - // TunnelIPAddresses: []*string{ - // to.Ptr("104.208.48.178")}, - // }, - // { - // CustomBgpIPAddresses: []*string{ - // to.Ptr("169.254.21.10")}, - // DefaultBgpIPAddresses: []*string{ - // to.Ptr("10.30.0.5")}, - // IPConfigurationID: to.Ptr("Instance1"), - // TunnelIPAddresses: []*string{ - // to.Ptr("104.208.48.179")}, - // }}, - // PeerWeight: to.Ptr[int32](0), - // }, - // Connections: []*armnetwork.VPNConnection{ - // { - // ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/vpnGateways/vpngw/vpnConnections/vpnConnection1"), - // Name: to.Ptr("vpnConnection1"), - // Etag: to.Ptr("w/\\00000000-0000-0000-0000-000000000000\\"), - // Properties: &armnetwork.VPNConnectionProperties{ - // ConnectionBandwidth: to.Ptr[int32](100), - // ConnectionStatus: to.Ptr(armnetwork.VPNConnectionStatusConnected), - // EgressBytesTransferred: to.Ptr[int64](0), - // EnableBgp: to.Ptr(false), - // IngressBytesTransferred: to.Ptr[int64](0), - // IPSecPolicies: []*armnetwork.IPSecPolicy{ - // }, - // ProvisioningState: to.Ptr(armnetwork.ProvisioningStateSucceeded), - // RemoteVPNSite: &armnetwork.SubResource{ - // ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/vpnSites/vpnSite1"), - // }, - // RoutingConfiguration: &armnetwork.RoutingConfiguration{ - // AssociatedRouteTable: &armnetwork.SubResource{ - // ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/virtualHubs/virtualHub1/hubRouteTables/hubRouteTable1"), - // }, - // PropagatedRouteTables: &armnetwork.PropagatedRouteTable{ - // IDs: []*armnetwork.SubResource{ - // { - // ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/virtualHubs/virtualHub1/hubRouteTables/hubRouteTable1"), - // }, - // { - // ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/virtualHubs/virtualHub1/hubRouteTables/hubRouteTable2"), - // }, - // { - // ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/virtualHubs/virtualHub1/hubRouteTables/hubRouteTable3"), - // }}, - // Labels: []*string{ - // to.Ptr("label1"), - // to.Ptr("label2")}, - // }, - // VnetRoutes: &armnetwork.VnetRoute{ - // StaticRoutes: []*armnetwork.StaticRoute{ - // }, - // }, - // }, - // RoutingWeight: to.Ptr[int32](0), - // SharedKey: to.Ptr("key"), - // UseLocalAzureIPAddress: to.Ptr(false), - // }, - // }}, - // EnableBgpRouteTranslationForNat: to.Ptr(false), - // IsRoutingPreferenceInternet: to.Ptr(false), - // NatRules: []*armnetwork.VPNGatewayNatRule{ - // }, - // ProvisioningState: to.Ptr(armnetwork.ProvisioningStateSucceeded), - // VirtualHub: &armnetwork.SubResource{ - // ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/virtualHubs/virtualHub1"), - // }, - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/4883fa5dbf6f2c9093fac8ce334547e9dfac68fa/specification/network/resource-manager/Microsoft.Network/stable/2024-03-01/examples/VpnGatewayStartPacketCaptureFilterData.json -func ExampleVPNGatewaysClient_BeginStartPacketCapture_startPacketCaptureOnVpnGatewayWithFilter() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armnetwork.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewVPNGatewaysClient().BeginStartPacketCapture(ctx, "rg1", "vpngw", &armnetwork.VPNGatewaysClientBeginStartPacketCaptureOptions{Parameters: &armnetwork.VPNGatewayPacketCaptureStartParameters{ - FilterData: to.Ptr("{'TracingFlags': 11,'MaxPacketBufferSize': 120,'MaxFileSize': 200,'Filters': [{'SourceSubnets': ['20.1.1.0/24'],'DestinationSubnets': ['10.1.1.0/24'],'SourcePort': [500],'DestinationPort': [4500],'Protocol': 6,'TcpFlags': 16,'CaptureSingleDirectionTrafficOnly': true}]}"), - }, - }) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - res, err := poller.PollUntilDone(ctx, nil) - if err != nil { - log.Fatalf("failed to pull the result: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.Value = "\"{\"Status\":\"Successful\",\"Data\":null}\"" -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/4883fa5dbf6f2c9093fac8ce334547e9dfac68fa/specification/network/resource-manager/Microsoft.Network/stable/2024-03-01/examples/VpnGatewayStartPacketCapture.json -func ExampleVPNGatewaysClient_BeginStartPacketCapture_startPacketCaptureOnVpnGatewayWithoutFilter() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armnetwork.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewVPNGatewaysClient().BeginStartPacketCapture(ctx, "rg1", "vpngw", &armnetwork.VPNGatewaysClientBeginStartPacketCaptureOptions{Parameters: nil}) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - res, err := poller.PollUntilDone(ctx, nil) - if err != nil { - log.Fatalf("failed to pull the result: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.Value = "\"{\"Status\":\"Successful\",\"Data\":null}\"" -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/4883fa5dbf6f2c9093fac8ce334547e9dfac68fa/specification/network/resource-manager/Microsoft.Network/stable/2024-03-01/examples/VpnGatewayStopPacketCapture.json -func ExampleVPNGatewaysClient_BeginStopPacketCapture() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armnetwork.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewVPNGatewaysClient().BeginStopPacketCapture(ctx, "rg1", "vpngw", &armnetwork.VPNGatewaysClientBeginStopPacketCaptureOptions{Parameters: &armnetwork.VPNGatewayPacketCaptureStopParameters{ - SasURL: to.Ptr("https://teststorage.blob.core.windows.net/?sv=2018-03-28&ss=bfqt&srt=sco&sp=rwdlacup&se=2019-09-13T07:44:05Z&st=2019-09-06T23:44:05Z&spr=https&sig=V1h9D1riltvZMI69d6ihENnFo%2FrCvTqGgjO2lf%2FVBhE%3D"), - }, - }) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - res, err := poller.PollUntilDone(ctx, nil) - if err != nil { - log.Fatalf("failed to pull the result: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.Value = "\"{\"Status\":\"Successful\",\"Data\":null}\"" -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/4883fa5dbf6f2c9093fac8ce334547e9dfac68fa/specification/network/resource-manager/Microsoft.Network/stable/2024-03-01/examples/VpnGatewayListByResourceGroup.json -func ExampleVPNGatewaysClient_NewListByResourceGroupPager() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armnetwork.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := clientFactory.NewVPNGatewaysClient().NewListByResourceGroupPager("rg1", nil) - for pager.More() { - page, err := pager.NextPage(ctx) - if err != nil { - log.Fatalf("failed to advance page: %v", err) - } - for _, v := range page.Value { - // You could use page here. We use blank identifier for just demo purposes. - _ = v - } - // If the HTTP response code is 200 as defined in example definition, your page structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // page.ListVPNGatewaysResult = armnetwork.ListVPNGatewaysResult{ - // Value: []*armnetwork.VPNGateway{ - // { - // Name: to.Ptr("gateway1"), - // Type: to.Ptr("Microsoft.Network/vpnGateways"), - // ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/vpnGateways/gateway1"), - // Location: to.Ptr("West US"), - // Etag: to.Ptr("w/\\00000000-0000-0000-0000-000000000000\\"), - // Properties: &armnetwork.VPNGatewayProperties{ - // BgpSettings: &armnetwork.BgpSettings{ - // Asn: to.Ptr[int64](65514), - // BgpPeeringAddress: to.Ptr("10.0.1.30"), - // BgpPeeringAddresses: []*armnetwork.IPConfigurationBgpPeeringAddress{ - // { - // CustomBgpIPAddresses: []*string{ - // to.Ptr("169.254.21.5")}, - // DefaultBgpIPAddresses: []*string{ - // to.Ptr("10.30.0.4")}, - // IPConfigurationID: to.Ptr("Instance0"), - // TunnelIPAddresses: []*string{ - // to.Ptr("104.208.48.178")}, - // }, - // { - // CustomBgpIPAddresses: []*string{ - // to.Ptr("169.254.21.10")}, - // DefaultBgpIPAddresses: []*string{ - // to.Ptr("10.30.0.5")}, - // IPConfigurationID: to.Ptr("Instance1"), - // TunnelIPAddresses: []*string{ - // to.Ptr("104.208.48.179")}, - // }}, - // PeerWeight: to.Ptr[int32](0), - // }, - // Connections: []*armnetwork.VPNConnection{ - // { - // ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/vpnGateways/gateway1/vpnConnections/vpnConnection1"), - // Name: to.Ptr("vpnConnection1"), - // Etag: to.Ptr("w/\\00000000-0000-0000-0000-000000000000\\"), - // Properties: &armnetwork.VPNConnectionProperties{ - // EgressBytesTransferred: to.Ptr[int64](0), - // EnableInternetSecurity: to.Ptr(false), - // IngressBytesTransferred: to.Ptr[int64](0), - // ProvisioningState: to.Ptr(armnetwork.ProvisioningStateSucceeded), - // RemoteVPNSite: &armnetwork.SubResource{ - // ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/vpnSites/vpnSite1"), - // }, - // RoutingConfiguration: &armnetwork.RoutingConfiguration{ - // AssociatedRouteTable: &armnetwork.SubResource{ - // ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/virtualHubs/virtualHub1/hubRouteTables/hubRouteTable1"), - // }, - // PropagatedRouteTables: &armnetwork.PropagatedRouteTable{ - // IDs: []*armnetwork.SubResource{ - // { - // ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/virtualHubs/virtualHub1/hubRouteTables/hubRouteTable1"), - // }, - // { - // ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/virtualHubs/virtualHub1/hubRouteTables/hubRouteTable2"), - // }, - // { - // ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/virtualHubs/virtualHub1/hubRouteTables/hubRouteTable3"), - // }}, - // Labels: []*string{ - // to.Ptr("label1"), - // to.Ptr("label2")}, - // }, - // VnetRoutes: &armnetwork.VnetRoute{ - // StaticRoutes: []*armnetwork.StaticRoute{ - // }, - // }, - // }, - // VPNLinkConnections: []*armnetwork.VPNSiteLinkConnection{ - // { - // ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/vpnGateways/gateway1/vpnConnections/vpnConnection1/VpnSiteLinkConnections/Connection-Link1"), - // Name: to.Ptr("Connection-Link1"), - // Type: to.Ptr("Microsoft.Network/vpnGateways/vpnConnections/VpnSiteLinkConnections"), - // Etag: to.Ptr("w/\\00000000-0000-0000-0000-000000000000\\"), - // Properties: &armnetwork.VPNSiteLinkConnectionProperties{ - // ConnectionBandwidth: to.Ptr[int32](200), - // EgressBytesTransferred: to.Ptr[int64](0), - // EgressNatRules: []*armnetwork.SubResource{ - // { - // ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/vpnGateways/gateway1/natRules/nat03"), - // }}, - // EnableBgp: to.Ptr(false), - // EnableRateLimiting: to.Ptr(false), - // IngressBytesTransferred: to.Ptr[int64](0), - // IPSecPolicies: []*armnetwork.IPSecPolicy{ - // }, - // ProvisioningState: to.Ptr(armnetwork.ProvisioningStateSucceeded), - // RoutingWeight: to.Ptr[int32](0), - // SharedKey: to.Ptr("key"), - // UseLocalAzureIPAddress: to.Ptr(false), - // UsePolicyBasedTrafficSelectors: to.Ptr(false), - // VPNConnectionProtocolType: to.Ptr(armnetwork.VirtualNetworkGatewayConnectionProtocolIKEv2), - // VPNSiteLink: &armnetwork.SubResource{ - // ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/vpnSites/vpnSite1/vpnSiteLinks/siteLink1"), - // }, - // }, - // }, - // { - // ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/vpnGateways/gateway1/vpnConnections/vpnConnection1/VpnSiteLinkConnections/Connection-Link2"), - // Name: to.Ptr("Connection-Link2"), - // Type: to.Ptr("Microsoft.Network/vpnGateways/vpnConnections/VpnSiteLinkConnections"), - // Etag: to.Ptr("w/\\00000000-0000-0000-0000-000000000000\\"), - // Properties: &armnetwork.VPNSiteLinkConnectionProperties{ - // ConnectionBandwidth: to.Ptr[int32](200), - // EgressBytesTransferred: to.Ptr[int64](0), - // EgressNatRules: []*armnetwork.SubResource{ - // { - // ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/vpnGateways/gateway1/natRules/nat03"), - // }}, - // EnableBgp: to.Ptr(false), - // EnableRateLimiting: to.Ptr(false), - // IngressBytesTransferred: to.Ptr[int64](0), - // IPSecPolicies: []*armnetwork.IPSecPolicy{ - // }, - // ProvisioningState: to.Ptr(armnetwork.ProvisioningStateSucceeded), - // RoutingWeight: to.Ptr[int32](0), - // SharedKey: to.Ptr("key"), - // UseLocalAzureIPAddress: to.Ptr(false), - // UsePolicyBasedTrafficSelectors: to.Ptr(false), - // VPNConnectionProtocolType: to.Ptr(armnetwork.VirtualNetworkGatewayConnectionProtocolIKEv2), - // VPNSiteLink: &armnetwork.SubResource{ - // ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/vpnSites/vpnSite1/vpnSiteLinks/siteLink2"), - // }, - // }, - // }}, - // }, - // }}, - // EnableBgpRouteTranslationForNat: to.Ptr(false), - // IsRoutingPreferenceInternet: to.Ptr(false), - // NatRules: []*armnetwork.VPNGatewayNatRule{ - // { - // ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/vpnGateways/gateway1/natRules/nat03"), - // Name: to.Ptr("nat03"), - // Type: to.Ptr("Microsoft.Network/vpnGateways/natRules"), - // Properties: &armnetwork.VPNGatewayNatRuleProperties{ - // Type: to.Ptr(armnetwork.VPNNatRuleTypeStatic), - // EgressVPNSiteLinkConnections: []*armnetwork.SubResource{ - // { - // ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/vpnGateways/gateway1/vpnConnections/vpnConnection1/vpnLinkConnections/Connection-Link1"), - // }}, - // ExternalMappings: []*armnetwork.VPNNatRuleMapping{ - // { - // AddressSpace: to.Ptr("192.168.0.0/26"), - // }}, - // InternalMappings: []*armnetwork.VPNNatRuleMapping{ - // { - // AddressSpace: to.Ptr("0.0.0.0/26"), - // }}, - // Mode: to.Ptr(armnetwork.VPNNatRuleModeEgressSnat), - // }, - // }}, - // ProvisioningState: to.Ptr(armnetwork.ProvisioningStateSucceeded), - // VirtualHub: &armnetwork.SubResource{ - // ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/virtualHubs/virtualHub1"), - // }, - // }, - // }, - // { - // Name: to.Ptr("gateway2"), - // Type: to.Ptr("Microsoft.Network/vpnGateways"), - // ID: to.Ptr("/subscriptions/subid/resourceGroups/rg2/providers/Microsoft.Network/vpnGateways/gateway2"), - // Location: to.Ptr("West US"), - // Etag: to.Ptr("w/\\00000000-0000-0000-0000-000000000000\\"), - // Properties: &armnetwork.VPNGatewayProperties{ - // BgpSettings: &armnetwork.BgpSettings{ - // Asn: to.Ptr[int64](65514), - // BgpPeeringAddress: to.Ptr("10.0.1.30"), - // BgpPeeringAddresses: []*armnetwork.IPConfigurationBgpPeeringAddress{ - // { - // CustomBgpIPAddresses: []*string{ - // to.Ptr("169.254.21.5")}, - // DefaultBgpIPAddresses: []*string{ - // to.Ptr("10.30.0.4")}, - // IPConfigurationID: to.Ptr("Instance0"), - // TunnelIPAddresses: []*string{ - // to.Ptr("104.208.48.178")}, - // }, - // { - // CustomBgpIPAddresses: []*string{ - // to.Ptr("169.254.21.10")}, - // DefaultBgpIPAddresses: []*string{ - // to.Ptr("10.30.0.5")}, - // IPConfigurationID: to.Ptr("Instance1"), - // TunnelIPAddresses: []*string{ - // to.Ptr("104.208.48.179")}, - // }}, - // PeerWeight: to.Ptr[int32](0), - // }, - // Connections: []*armnetwork.VPNConnection{ - // { - // ID: to.Ptr("/subscriptions/subid/resourceGroups/rg2/providers/Microsoft.Network/vpnGateways/gateway2/vpnConnections/vpnConnection2"), - // Name: to.Ptr("vpnConnection1"), - // Etag: to.Ptr("w/\\00000000-0000-0000-0000-000000000000\\"), - // Properties: &armnetwork.VPNConnectionProperties{ - // ConnectionBandwidth: to.Ptr[int32](100), - // ConnectionStatus: to.Ptr(armnetwork.VPNConnectionStatusConnected), - // EgressBytesTransferred: to.Ptr[int64](0), - // EnableBgp: to.Ptr(false), - // IngressBytesTransferred: to.Ptr[int64](0), - // IPSecPolicies: []*armnetwork.IPSecPolicy{ - // }, - // ProvisioningState: to.Ptr(armnetwork.ProvisioningStateSucceeded), - // RemoteVPNSite: &armnetwork.SubResource{ - // ID: to.Ptr("/subscriptions/subid/resourceGroups/rg2/providers/Microsoft.Network/vpnSites/vpnSite2"), - // }, - // RoutingConfiguration: &armnetwork.RoutingConfiguration{ - // AssociatedRouteTable: &armnetwork.SubResource{ - // ID: to.Ptr("/subscriptions/subid/resourceGroups/rg2/providers/Microsoft.Network/virtualHubs/virtualHub2/hubRouteTables/hubRouteTable1"), - // }, - // PropagatedRouteTables: &armnetwork.PropagatedRouteTable{ - // IDs: []*armnetwork.SubResource{ - // { - // ID: to.Ptr("/subscriptions/subid/resourceGroups/rg2/providers/Microsoft.Network/virtualHubs/virtualHub2/hubRouteTables/hubRouteTable1"), - // }, - // { - // ID: to.Ptr("/subscriptions/subid/resourceGroups/rg2/providers/Microsoft.Network/virtualHubs/virtualHub2/hubRouteTables/hubRouteTable2"), - // }, - // { - // ID: to.Ptr("/subscriptions/subid/resourceGroups/rg2/providers/Microsoft.Network/virtualHubs/virtualHub2/hubRouteTables/hubRouteTable3"), - // }}, - // Labels: []*string{ - // to.Ptr("label1"), - // to.Ptr("label2")}, - // }, - // VnetRoutes: &armnetwork.VnetRoute{ - // StaticRoutes: []*armnetwork.StaticRoute{ - // }, - // }, - // }, - // RoutingWeight: to.Ptr[int32](0), - // SharedKey: to.Ptr("key"), - // UseLocalAzureIPAddress: to.Ptr(false), - // }, - // }}, - // EnableBgpRouteTranslationForNat: to.Ptr(false), - // IsRoutingPreferenceInternet: to.Ptr(false), - // NatRules: []*armnetwork.VPNGatewayNatRule{ - // }, - // ProvisioningState: to.Ptr(armnetwork.ProvisioningStateSucceeded), - // VirtualHub: &armnetwork.SubResource{ - // ID: to.Ptr("/subscriptions/subid/resourceGroups/rg2/providers/Microsoft.Network/virtualHubs/virtualHub2"), - // }, - // }, - // }}, - // } - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/4883fa5dbf6f2c9093fac8ce334547e9dfac68fa/specification/network/resource-manager/Microsoft.Network/stable/2024-03-01/examples/VpnGatewayList.json -func ExampleVPNGatewaysClient_NewListPager() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armnetwork.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := clientFactory.NewVPNGatewaysClient().NewListPager(nil) - for pager.More() { - page, err := pager.NextPage(ctx) - if err != nil { - log.Fatalf("failed to advance page: %v", err) - } - for _, v := range page.Value { - // You could use page here. We use blank identifier for just demo purposes. - _ = v - } - // If the HTTP response code is 200 as defined in example definition, your page structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // page.ListVPNGatewaysResult = armnetwork.ListVPNGatewaysResult{ - // Value: []*armnetwork.VPNGateway{ - // { - // Name: to.Ptr("gateway1"), - // Type: to.Ptr("Microsoft.Network/vpnGateways"), - // ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/vpnGateways/gateway1"), - // Location: to.Ptr("West US"), - // Etag: to.Ptr("w/\\00000000-0000-0000-0000-000000000000\\"), - // Properties: &armnetwork.VPNGatewayProperties{ - // BgpSettings: &armnetwork.BgpSettings{ - // Asn: to.Ptr[int64](65514), - // BgpPeeringAddress: to.Ptr("10.0.1.30"), - // BgpPeeringAddresses: []*armnetwork.IPConfigurationBgpPeeringAddress{ - // { - // CustomBgpIPAddresses: []*string{ - // to.Ptr("169.254.21.5")}, - // DefaultBgpIPAddresses: []*string{ - // to.Ptr("10.30.0.4")}, - // IPConfigurationID: to.Ptr("Instance0"), - // TunnelIPAddresses: []*string{ - // to.Ptr("104.208.48.178")}, - // }, - // { - // CustomBgpIPAddresses: []*string{ - // to.Ptr("169.254.21.10")}, - // DefaultBgpIPAddresses: []*string{ - // to.Ptr("10.30.0.5")}, - // IPConfigurationID: to.Ptr("Instance1"), - // TunnelIPAddresses: []*string{ - // to.Ptr("104.208.48.179")}, - // }}, - // PeerWeight: to.Ptr[int32](0), - // }, - // Connections: []*armnetwork.VPNConnection{ - // { - // ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/vpnGateways/gateway1/vpnConnections/vpnConnection1"), - // Name: to.Ptr("vpnConnection1"), - // Etag: to.Ptr("w/\\00000000-0000-0000-0000-000000000000\\"), - // Properties: &armnetwork.VPNConnectionProperties{ - // EgressBytesTransferred: to.Ptr[int64](0), - // EnableInternetSecurity: to.Ptr(false), - // IngressBytesTransferred: to.Ptr[int64](0), - // ProvisioningState: to.Ptr(armnetwork.ProvisioningStateSucceeded), - // RemoteVPNSite: &armnetwork.SubResource{ - // ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/vpnSites/vpnSite1"), - // }, - // RoutingConfiguration: &armnetwork.RoutingConfiguration{ - // AssociatedRouteTable: &armnetwork.SubResource{ - // ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/virtualHubs/virtualHub1/hubRouteTables/hubRouteTable1"), - // }, - // PropagatedRouteTables: &armnetwork.PropagatedRouteTable{ - // IDs: []*armnetwork.SubResource{ - // { - // ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/virtualHubs/virtualHub1/hubRouteTables/hubRouteTable1"), - // }, - // { - // ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/virtualHubs/virtualHub1/hubRouteTables/hubRouteTable2"), - // }, - // { - // ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/virtualHubs/virtualHub1/hubRouteTables/hubRouteTable3"), - // }}, - // Labels: []*string{ - // to.Ptr("label1"), - // to.Ptr("label2")}, - // }, - // VnetRoutes: &armnetwork.VnetRoute{ - // StaticRoutes: []*armnetwork.StaticRoute{ - // }, - // }, - // }, - // VPNLinkConnections: []*armnetwork.VPNSiteLinkConnection{ - // { - // ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/vpnGateways/gateway1/vpnConnections/vpnConnection1/VpnSiteLinkConnections/Connection-Link1"), - // Name: to.Ptr("Connection-Link1"), - // Type: to.Ptr("Microsoft.Network/vpnGateways/vpnConnections/VpnSiteLinkConnections"), - // Etag: to.Ptr("w/\\00000000-0000-0000-0000-000000000000\\"), - // Properties: &armnetwork.VPNSiteLinkConnectionProperties{ - // ConnectionBandwidth: to.Ptr[int32](200), - // EgressBytesTransferred: to.Ptr[int64](0), - // EnableBgp: to.Ptr(false), - // EnableRateLimiting: to.Ptr(false), - // IngressBytesTransferred: to.Ptr[int64](0), - // IngressNatRules: []*armnetwork.SubResource{ - // { - // ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/vpnGateways/gateway1/natRules/nat03"), - // }}, - // IPSecPolicies: []*armnetwork.IPSecPolicy{ - // }, - // ProvisioningState: to.Ptr(armnetwork.ProvisioningStateSucceeded), - // RoutingWeight: to.Ptr[int32](0), - // SharedKey: to.Ptr("key"), - // UseLocalAzureIPAddress: to.Ptr(false), - // UsePolicyBasedTrafficSelectors: to.Ptr(false), - // VPNConnectionProtocolType: to.Ptr(armnetwork.VirtualNetworkGatewayConnectionProtocolIKEv2), - // VPNSiteLink: &armnetwork.SubResource{ - // ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/vpnSites/vpnSite1/vpnSiteLinks/siteLink1"), - // }, - // }, - // }, - // { - // ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/vpnGateways/gateway1/vpnConnections/vpnConnection1/VpnSiteLinkConnections/Connection-Link2"), - // Name: to.Ptr("Connection-Link2"), - // Type: to.Ptr("Microsoft.Network/vpnGateways/vpnConnections/VpnSiteLinkConnections"), - // Etag: to.Ptr("w/\\00000000-0000-0000-0000-000000000000\\"), - // Properties: &armnetwork.VPNSiteLinkConnectionProperties{ - // ConnectionBandwidth: to.Ptr[int32](200), - // EgressBytesTransferred: to.Ptr[int64](0), - // EgressNatRules: []*armnetwork.SubResource{ - // { - // ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/vpnGateways/gateway1/natRules/nat04"), - // }}, - // EnableBgp: to.Ptr(false), - // EnableRateLimiting: to.Ptr(false), - // IngressBytesTransferred: to.Ptr[int64](0), - // IPSecPolicies: []*armnetwork.IPSecPolicy{ - // }, - // ProvisioningState: to.Ptr(armnetwork.ProvisioningStateSucceeded), - // RoutingWeight: to.Ptr[int32](0), - // SharedKey: to.Ptr("key"), - // UseLocalAzureIPAddress: to.Ptr(false), - // UsePolicyBasedTrafficSelectors: to.Ptr(false), - // VPNConnectionProtocolType: to.Ptr(armnetwork.VirtualNetworkGatewayConnectionProtocolIKEv2), - // VPNSiteLink: &armnetwork.SubResource{ - // ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/vpnSites/vpnSite1/vpnSiteLinks/siteLink2"), - // }, - // }, - // }}, - // }, - // }}, - // EnableBgpRouteTranslationForNat: to.Ptr(false), - // IsRoutingPreferenceInternet: to.Ptr(false), - // NatRules: []*armnetwork.VPNGatewayNatRule{ - // { - // ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/vpnGateways/gateway1/natRules/nat03"), - // Name: to.Ptr("nat03"), - // Type: to.Ptr("Microsoft.Network/vpnGateways/natRules"), - // Properties: &armnetwork.VPNGatewayNatRuleProperties{ - // Type: to.Ptr(armnetwork.VPNNatRuleTypeDynamic), - // ExternalMappings: []*armnetwork.VPNNatRuleMapping{ - // { - // AddressSpace: to.Ptr("192.168.0.0/26"), - // }}, - // IngressVPNSiteLinkConnections: []*armnetwork.SubResource{ - // { - // ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/vpnGateways/gateway1/vpnConnections/vpnConnection1/vpnLinkConnections/Connection-Link1"), - // }}, - // InternalMappings: []*armnetwork.VPNNatRuleMapping{ - // { - // AddressSpace: to.Ptr("0.0.0.0/26"), - // }}, - // Mode: to.Ptr(armnetwork.VPNNatRuleMode("IgressSnat")), - // }, - // }, - // { - // ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/vpnGateways/gateway1/natRules/nat04"), - // Name: to.Ptr("nat04"), - // Type: to.Ptr("Microsoft.Network/vpnGateways/natRules"), - // Properties: &armnetwork.VPNGatewayNatRuleProperties{ - // Type: to.Ptr(armnetwork.VPNNatRuleTypeStatic), - // EgressVPNSiteLinkConnections: []*armnetwork.SubResource{ - // { - // ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/vpnGateways/gateway1/vpnConnections/vpnConnection1/vpnLinkConnections/Connection-Link2"), - // }}, - // ExternalMappings: []*armnetwork.VPNNatRuleMapping{ - // { - // AddressSpace: to.Ptr("192.168.0.0/26"), - // }}, - // InternalMappings: []*armnetwork.VPNNatRuleMapping{ - // { - // AddressSpace: to.Ptr("0.0.0.0/26"), - // }}, - // Mode: to.Ptr(armnetwork.VPNNatRuleModeEgressSnat), - // }, - // }}, - // ProvisioningState: to.Ptr(armnetwork.ProvisioningStateSucceeded), - // VirtualHub: &armnetwork.SubResource{ - // ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/virtualHubs/virtualHub1"), - // }, - // }, - // }, - // { - // Name: to.Ptr("gateway2"), - // Type: to.Ptr("Microsoft.Network/vpnGateways"), - // ID: to.Ptr("/subscriptions/subid/resourceGroups/rg2/providers/Microsoft.Network/vpnGateways/gateway2"), - // Location: to.Ptr("West US"), - // Etag: to.Ptr("w/\\00000000-0000-0000-0000-000000000000\\"), - // Properties: &armnetwork.VPNGatewayProperties{ - // BgpSettings: &armnetwork.BgpSettings{ - // Asn: to.Ptr[int64](65514), - // BgpPeeringAddress: to.Ptr("10.0.1.30"), - // BgpPeeringAddresses: []*armnetwork.IPConfigurationBgpPeeringAddress{ - // { - // CustomBgpIPAddresses: []*string{ - // to.Ptr("169.254.21.5")}, - // DefaultBgpIPAddresses: []*string{ - // to.Ptr("10.30.0.4")}, - // IPConfigurationID: to.Ptr("Instance0"), - // TunnelIPAddresses: []*string{ - // to.Ptr("104.208.48.178")}, - // }, - // { - // CustomBgpIPAddresses: []*string{ - // to.Ptr("169.254.21.10")}, - // DefaultBgpIPAddresses: []*string{ - // to.Ptr("10.30.0.5")}, - // IPConfigurationID: to.Ptr("Instance1"), - // TunnelIPAddresses: []*string{ - // to.Ptr("104.208.48.179")}, - // }}, - // PeerWeight: to.Ptr[int32](0), - // }, - // Connections: []*armnetwork.VPNConnection{ - // { - // ID: to.Ptr("/subscriptions/subid/resourceGroups/rg2/providers/Microsoft.Network/vpnGateways/gateway2/vpnConnections/vpnConnection2"), - // Name: to.Ptr("vpnConnection1"), - // Etag: to.Ptr("w/\\00000000-0000-0000-0000-000000000000\\"), - // Properties: &armnetwork.VPNConnectionProperties{ - // ConnectionBandwidth: to.Ptr[int32](100), - // ConnectionStatus: to.Ptr(armnetwork.VPNConnectionStatusConnected), - // EgressBytesTransferred: to.Ptr[int64](0), - // EnableBgp: to.Ptr(false), - // IngressBytesTransferred: to.Ptr[int64](0), - // IPSecPolicies: []*armnetwork.IPSecPolicy{ - // }, - // ProvisioningState: to.Ptr(armnetwork.ProvisioningStateSucceeded), - // RemoteVPNSite: &armnetwork.SubResource{ - // ID: to.Ptr("/subscriptions/subid/resourceGroups/rg2/providers/Microsoft.Network/vpnSites/vpnSite2"), - // }, - // RoutingConfiguration: &armnetwork.RoutingConfiguration{ - // AssociatedRouteTable: &armnetwork.SubResource{ - // ID: to.Ptr("/subscriptions/subid/resourceGroups/rg2/providers/Microsoft.Network/virtualHubs/virtualHub2/hubRouteTables/hubRouteTable1"), - // }, - // PropagatedRouteTables: &armnetwork.PropagatedRouteTable{ - // IDs: []*armnetwork.SubResource{ - // { - // ID: to.Ptr("/subscriptions/subid/resourceGroups/rg2/providers/Microsoft.Network/virtualHubs/virtualHub2/hubRouteTables/hubRouteTable1"), - // }, - // { - // ID: to.Ptr("/subscriptions/subid/resourceGroups/rg2/providers/Microsoft.Network/virtualHubs/virtualHub2/hubRouteTables/hubRouteTable2"), - // }, - // { - // ID: to.Ptr("/subscriptions/subid/resourceGroups/rg2/providers/Microsoft.Network/virtualHubs/virtualHub2/hubRouteTables/hubRouteTable3"), - // }}, - // Labels: []*string{ - // to.Ptr("label1"), - // to.Ptr("label2")}, - // }, - // VnetRoutes: &armnetwork.VnetRoute{ - // StaticRoutes: []*armnetwork.StaticRoute{ - // }, - // }, - // }, - // RoutingWeight: to.Ptr[int32](0), - // SharedKey: to.Ptr("key"), - // UseLocalAzureIPAddress: to.Ptr(false), - // }, - // }}, - // EnableBgpRouteTranslationForNat: to.Ptr(false), - // IsRoutingPreferenceInternet: to.Ptr(false), - // NatRules: []*armnetwork.VPNGatewayNatRule{ - // }, - // ProvisioningState: to.Ptr(armnetwork.ProvisioningStateSucceeded), - // VirtualHub: &armnetwork.SubResource{ - // ID: to.Ptr("/subscriptions/subid/resourceGroups/rg2/providers/Microsoft.Network/virtualHubs/virtualHub2"), - // }, - // }, - // }}, - // } - } -} diff --git a/sdk/resourcemanager/network/armnetwork/vpnlinkconnections_client_example_test.go b/sdk/resourcemanager/network/armnetwork/vpnlinkconnections_client_example_test.go deleted file mode 100644 index 8a0c931023c9..000000000000 --- a/sdk/resourcemanager/network/armnetwork/vpnlinkconnections_client_example_test.go +++ /dev/null @@ -1,221 +0,0 @@ -//go:build go1.18 -// +build go1.18 - -// 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. -// DO NOT EDIT. - -package armnetwork_test - -import ( - "context" - "log" - - "github.com/Azure/azure-sdk-for-go/sdk/azcore/to" - "github.com/Azure/azure-sdk-for-go/sdk/azidentity" - "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/network/armnetwork/v6" -) - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/4883fa5dbf6f2c9093fac8ce334547e9dfac68fa/specification/network/resource-manager/Microsoft.Network/stable/2024-03-01/examples/VpnSiteLinkConnectionReset.json -func ExampleVPNLinkConnectionsClient_BeginResetConnection() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armnetwork.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewVPNLinkConnectionsClient().BeginResetConnection(ctx, "rg1", "gateway1", "vpnConnection1", "Connection-Link1", nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - _, err = poller.PollUntilDone(ctx, nil) - if err != nil { - log.Fatalf("failed to pull the result: %v", err) - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/4883fa5dbf6f2c9093fac8ce334547e9dfac68fa/specification/network/resource-manager/Microsoft.Network/stable/2024-03-01/examples/VpnSiteLinkConnectionSharedKeysGet.json -func ExampleVPNLinkConnectionsClient_NewGetAllSharedKeysPager() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armnetwork.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := clientFactory.NewVPNLinkConnectionsClient().NewGetAllSharedKeysPager("rg1", "gateway1", "vpnConnection1", "Connection-Link1", nil) - for pager.More() { - page, err := pager.NextPage(ctx) - if err != nil { - log.Fatalf("failed to advance page: %v", err) - } - for _, v := range page.Value { - // You could use page here. We use blank identifier for just demo purposes. - _ = v - } - // If the HTTP response code is 200 as defined in example definition, your page structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // page.ConnectionSharedKeyResultList = armnetwork.ConnectionSharedKeyResultList{ - // Value: []*armnetwork.ConnectionSharedKeyResult{ - // { - // ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/vpnGateways/gateway1/vpnConnections/vpnConnection1/vpnLinkConnections/Connection-Link1/sharedKeys/default"), - // Name: to.Ptr("default"), - // Type: to.Ptr("Microsoft.Network/vpnGateways/vpnConnections/vpnLinkConnections/sharedKeys"), - // Properties: &armnetwork.SharedKeyProperties{ - // SharedKeyLength: to.Ptr[int32](16), - // }, - // }}, - // } - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/4883fa5dbf6f2c9093fac8ce334547e9dfac68fa/specification/network/resource-manager/Microsoft.Network/stable/2024-03-01/examples/VpnSiteLinkConnectionDefaultSharedKeyGet.json -func ExampleVPNLinkConnectionsClient_GetDefaultSharedKey() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armnetwork.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewVPNLinkConnectionsClient().GetDefaultSharedKey(ctx, "rg1", "gateway1", "vpnConnection1", "Connection-Link1", nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.ConnectionSharedKeyResult = armnetwork.ConnectionSharedKeyResult{ - // ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/vpnGateways/gateway1/vpnConnections/vpnConnection1/vpnLinkConnections/Connection-Link1/sharedKeys/default"), - // Name: to.Ptr("default"), - // Type: to.Ptr("Microsoft.Network/vpnGateways/vpnConnections/vpnLinkConnections/sharedKeys"), - // Properties: &armnetwork.SharedKeyProperties{ - // SharedKeyLength: to.Ptr[int32](16), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/4883fa5dbf6f2c9093fac8ce334547e9dfac68fa/specification/network/resource-manager/Microsoft.Network/stable/2024-03-01/examples/VpnSiteLinkConnectionDefaultSharedKeyPut.json -func ExampleVPNLinkConnectionsClient_BeginSetOrInitDefaultSharedKey() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armnetwork.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewVPNLinkConnectionsClient().BeginSetOrInitDefaultSharedKey(ctx, "rg1", "gateway1", "vpnConnection1", "Connection-Link1", armnetwork.ConnectionSharedKeyResult{ - Properties: &armnetwork.SharedKeyProperties{ - SharedKey: to.Ptr("ABCDEF123456"), - }, - }, nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - res, err := poller.PollUntilDone(ctx, nil) - if err != nil { - log.Fatalf("failed to pull the result: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.ConnectionSharedKeyResult = armnetwork.ConnectionSharedKeyResult{ - // ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/vpnGateways/gateway1/vpnConnections/vpnConnection1/vpnLinkConnections/Connection-Link1/sharedKeys/default"), - // Name: to.Ptr("default"), - // Type: to.Ptr("Microsoft.Network/vpnGateways/vpnConnections/vpnLinkConnections/sharedKeys"), - // Properties: &armnetwork.SharedKeyProperties{ - // SharedKeyLength: to.Ptr[int32](12), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/4883fa5dbf6f2c9093fac8ce334547e9dfac68fa/specification/network/resource-manager/Microsoft.Network/stable/2024-03-01/examples/VpnSiteLinkConnectionDefaultSharedKeyList.json -func ExampleVPNLinkConnectionsClient_ListDefaultSharedKey() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armnetwork.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewVPNLinkConnectionsClient().ListDefaultSharedKey(ctx, "rg1", "gateway1", "vpnConnection1", "Connection-Link1", nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.ConnectionSharedKeyResult = armnetwork.ConnectionSharedKeyResult{ - // ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/vpnGateways/gateway1/vpnConnections/vpnConnection1/vpnLinkConnections/Connection-Link1/sharedKeys/default"), - // Name: to.Ptr("default"), - // Type: to.Ptr("Microsoft.Network/vpnGateways/vpnConnections/vpnLinkConnections/sharedKeys"), - // Properties: &armnetwork.SharedKeyProperties{ - // SharedKey: to.Ptr("AzureAbc1234"), - // SharedKeyLength: to.Ptr[int32](12), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/4883fa5dbf6f2c9093fac8ce334547e9dfac68fa/specification/network/resource-manager/Microsoft.Network/stable/2024-03-01/examples/VpnSiteLinkConnectionGetIkeSas.json -func ExampleVPNLinkConnectionsClient_BeginGetIkeSas() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armnetwork.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewVPNLinkConnectionsClient().BeginGetIkeSas(ctx, "rg1", "gateway1", "vpnConnection1", "Connection-Link1", nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - res, err := poller.PollUntilDone(ctx, nil) - if err != nil { - log.Fatalf("failed to pull the result: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.Value = "\"{\"Status\":\"Successful\",\"Data\":null}\"" -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/4883fa5dbf6f2c9093fac8ce334547e9dfac68fa/specification/network/resource-manager/Microsoft.Network/stable/2024-03-01/examples/VpnSiteLinkConnectionList.json -func ExampleVPNLinkConnectionsClient_NewListByVPNConnectionPager() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armnetwork.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := clientFactory.NewVPNLinkConnectionsClient().NewListByVPNConnectionPager("rg1", "gateway1", "vpnConnection1", nil) - for pager.More() { - page, err := pager.NextPage(ctx) - if err != nil { - log.Fatalf("failed to advance page: %v", err) - } - for _, v := range page.Value { - // You could use page here. We use blank identifier for just demo purposes. - _ = v - } - // If the HTTP response code is 200 as defined in example definition, your page structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // page.ListVPNSiteLinkConnectionsResult = armnetwork.ListVPNSiteLinkConnectionsResult{ - // } - } -} diff --git a/sdk/resourcemanager/network/armnetwork/vpnserverconfigurations_client_example_test.go b/sdk/resourcemanager/network/armnetwork/vpnserverconfigurations_client_example_test.go deleted file mode 100644 index f7591204f1d4..000000000000 --- a/sdk/resourcemanager/network/armnetwork/vpnserverconfigurations_client_example_test.go +++ /dev/null @@ -1,855 +0,0 @@ -//go:build go1.18 -// +build go1.18 - -// 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. -// DO NOT EDIT. - -package armnetwork_test - -import ( - "context" - "log" - - "github.com/Azure/azure-sdk-for-go/sdk/azcore/to" - "github.com/Azure/azure-sdk-for-go/sdk/azidentity" - "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/network/armnetwork/v6" -) - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/4883fa5dbf6f2c9093fac8ce334547e9dfac68fa/specification/network/resource-manager/Microsoft.Network/stable/2024-03-01/examples/VpnServerConfigurationGet.json -func ExampleVPNServerConfigurationsClient_Get() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armnetwork.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewVPNServerConfigurationsClient().Get(ctx, "rg1", "vpnServerConfiguration1", nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.VPNServerConfiguration = armnetwork.VPNServerConfiguration{ - // Name: to.Ptr("vpnServerConfiguration1"), - // Type: to.Ptr("Microsoft.Network/vpnServerConfigurations"), - // ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/vpnServerConfigurations/vpnServerConfiguration1"), - // Location: to.Ptr("West US"), - // Tags: map[string]*string{ - // "key1": to.Ptr("value1"), - // }, - // Etag: to.Ptr("w/\\00000000-0000-0000-0000-000000000000\\"), - // Properties: &armnetwork.VPNServerConfigurationProperties{ - // ConfigurationPolicyGroups: []*armnetwork.VPNServerConfigurationPolicyGroup{ - // { - // ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/vpnServerConfigurations/vpnServerConfiguration1/vpnServerConfigurationPolicyGroups/policyGroup1"), - // Name: to.Ptr("policyGroup1"), - // Etag: to.Ptr("w/\\00000000-0000-0000-0000-000000000000\\"), - // Properties: &armnetwork.VPNServerConfigurationPolicyGroupProperties{ - // IsDefault: to.Ptr(true), - // P2SConnectionConfigurations: []*armnetwork.SubResource{ - // { - // ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/p2sVpnGateways/p2sVpnGateway1/p2sConnectionConfigurations/P2SConnectionConfig1"), - // }}, - // PolicyMembers: []*armnetwork.VPNServerConfigurationPolicyGroupMember{ - // { - // Name: to.Ptr("policy1"), - // AttributeType: to.Ptr(armnetwork.VPNPolicyMemberAttributeTypeRadiusAzureGroupID), - // AttributeValue: to.Ptr("6ad1bd08"), - // }}, - // Priority: to.Ptr[int32](0), - // ProvisioningState: to.Ptr(armnetwork.ProvisioningStateSucceeded), - // }, - // }, - // { - // ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/vpnServerConfigurations/vpnServerConfiguration1/vpnServerConfigurationPolicyGroups/policyGroup2"), - // Name: to.Ptr("policyGroup2"), - // Etag: to.Ptr("w/\\00000000-0000-0000-0000-000000000000\\"), - // Properties: &armnetwork.VPNServerConfigurationPolicyGroupProperties{ - // IsDefault: to.Ptr(true), - // PolicyMembers: []*armnetwork.VPNServerConfigurationPolicyGroupMember{ - // { - // Name: to.Ptr("policy2"), - // AttributeType: to.Ptr(armnetwork.VPNPolicyMemberAttributeTypeCertificateGroupID), - // AttributeValue: to.Ptr("red.com"), - // }}, - // Priority: to.Ptr[int32](0), - // ProvisioningState: to.Ptr(armnetwork.ProvisioningStateSucceeded), - // }, - // }}, - // ProvisioningState: to.Ptr("Succeeded"), - // RadiusClientRootCertificates: []*armnetwork.VPNServerConfigRadiusClientRootCertificate{ - // { - // Name: to.Ptr("vpnServerConfigRadiusClientRootCert1"), - // Thumbprint: to.Ptr("83FFBFC8848B5A5836C94D0112367E16148A286F"), - // }}, - // RadiusServerRootCertificates: []*armnetwork.VPNServerConfigRadiusServerRootCertificate{ - // { - // Name: to.Ptr("vpnServerConfigRadiusServerRootCer1"), - // PublicCertData: to.Ptr("MIIC5zCCAc+gAwIBAgIQErQ0Hk4aDJxIA+Q5RagB+jANBgkqhkiG9w0BAQsFADAWMRQwEgYDVQQDDAtQMlNSb290Q2VydDAeFw0xNzEyMTQyMTA3MzhaFw0xODEyMTQyMTI3MzhaMBYxFDASBgNVBAMMC1AyU1Jvb3RDZXJ0MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEArP7/NQXmW7cQ/ZR1mv3Y3I29Lt7HTOqzo/1KUOoVH3NItbQIRAQbwKy3UWrOFz4eGNX2GWtNRMdCyWsKeqy9Ltsdfcm1IbKXkl84DFeU/ZacXu4Dl3xX3gV5du4TLZjEowJELyur11Ea2YcjPRQ/FzAF9/hGuboS1HZQEPLx4FdUs9OxCYOtc0MxBCwLfVTTRqarb0Ne+arNYd4kCzIhAke1nOyKAJBda5ZL+VHy3S5S8qGlD46jm8HXugmAkUygS4oIIXOmj/1O9sNAi3LN60zufSzCmP8Rm/iUGX+DHAGGiXxwZOKQLEDaZXKqoHjMPP0XudmSWwOIbyeQVrLhkwIDAQABozEwLzAOBgNVHQ8BAf8EBAMCAgQwHQYDVR0OBBYEFEfeNU2trYxNLF9ONmuJUsT13pKDMA0GCSqGSIb3DQEBCwUAA4IBAQBmM6RJzsGGipxyMhimHKN2xlkejhVsgBoTAhOU0llW9aUSwINJ9zFUGgI8IzUFy1VG776fchHp0LMRmPSIUYk5btEPxbsrPtumPuMH8EQGrS+Rt4pD+78c8H1fEPkq5CmDl/PKu4JoFGv+aFcE+Od0hlILstIF10Qysf++QXDolKfzJa/56bgMeYKFiju73loiRM57ns8ddXpfLl792UVpRkFU62LNns6Y1LKTwapmUF4IvIuAIzd6LZNOQng64LAKXtKnViJ1JQiXwf4CEzhgvAti3/ejpb3U90hsrUcyZi6wBv9bZLcAJRWpz61JNYliM1d1grSwQDKGXNQE4xuM"), - // }}, - // RadiusServers: []*armnetwork.RadiusServer{ - // { - // RadiusServerAddress: to.Ptr("10.0.0.0"), - // RadiusServerScore: to.Ptr[int64](25), - // }}, - // VPNAuthenticationTypes: []*armnetwork.VPNAuthenticationType{ - // to.Ptr(armnetwork.VPNAuthenticationTypeCertificate)}, - // VPNClientIPSecPolicies: []*armnetwork.IPSecPolicy{ - // { - // DhGroup: to.Ptr(armnetwork.DhGroupDHGroup14), - // IkeEncryption: to.Ptr(armnetwork.IkeEncryptionAES256), - // IkeIntegrity: to.Ptr(armnetwork.IkeIntegritySHA384), - // IPSecEncryption: to.Ptr(armnetwork.IPSecEncryptionAES256), - // IPSecIntegrity: to.Ptr(armnetwork.IPSecIntegritySHA256), - // PfsGroup: to.Ptr(armnetwork.PfsGroupPFS14), - // SaDataSizeKilobytes: to.Ptr[int32](429497), - // SaLifeTimeSeconds: to.Ptr[int32](86472), - // }}, - // VPNClientRevokedCertificates: []*armnetwork.VPNServerConfigVPNClientRevokedCertificate{ - // { - // Name: to.Ptr("vpnServerConfigVpnClientRevokedCert1"), - // Thumbprint: to.Ptr("83FFBFC8848B5A5836C94D0112367E16148A286F"), - // }}, - // VPNClientRootCertificates: []*armnetwork.VPNServerConfigVPNClientRootCertificate{ - // { - // Name: to.Ptr("vpnServerConfigVpnClientRootCert1"), - // PublicCertData: to.Ptr("MIIC5zCCAc+gAwIBAgIQErQ0Hk4aDJxIA+Q5RagB+jANBgkqhkiG9w0BAQsFADAWMRQwEgYDVQQDDAtQMlNSb290Q2VydDAeFw0xNzEyMTQyMTA3MzhaFw0xODEyMTQyMTI3MzhaMBYxFDASBgNVBAMMC1AyU1Jvb3RDZXJ0MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEArP7/NQXmW7cQ/ZR1mv3Y3I29Lt7HTOqzo/1KUOoVH3NItbQIRAQbwKy3UWrOFz4eGNX2GWtNRMdCyWsKeqy9Ltsdfcm1IbKXkl84DFeU/ZacXu4Dl3xX3gV5du4TLZjEowJELyur11Ea2YcjPRQ/FzAF9/hGuboS1HZQEPLx4FdUs9OxCYOtc0MxBCwLfVTTRqarb0Ne+arNYd4kCzIhAke1nOyKAJBda5ZL+VHy3S5S8qGlD46jm8HXugmAkUygS4oIIXOmj/1O9sNAi3LN60zufSzCmP8Rm/iUGX+DHAGGiXxwZOKQLEDaZXKqoHjMPP0XudmSWwOIbyeQVrLhkwIDAQABozEwLzAOBgNVHQ8BAf8EBAMCAgQwHQYDVR0OBBYEFEfeNU2trYxNLF9ONmuJUsT13pKDMA0GCSqGSIb3DQEBCwUAA4IBAQBmM6RJzsGGipxyMhimHKN2xlkejhVsgBoTAhOU0llW9aUSwINJ9zFUGgI8IzUFy1VG776fchHp0LMRmPSIUYk5btEPxbsrPtumPuMH8EQGrS+Rt4pD+78c8H1fEPkq5CmDl/PKu4JoFGv+aFcE+Od0hlILstIF10Qysf++QXDolKfzJa/56bgMeYKFiju73loiRM57ns8ddXpfLl792UVpRkFU62LNns6Y1LKTwapmUF4IvIuAIzd6LZNOQng64LAKXtKnViJ1JQiXwf4CEzhgvAti3/ejpb3U90hsrUcyZi6wBv9bZLcAJRWpz61JNYliM1d1grSwQDKGXNQE4xuN"), - // }}, - // VPNProtocols: []*armnetwork.VPNGatewayTunnelingProtocol{ - // to.Ptr(armnetwork.VPNGatewayTunnelingProtocolIkeV2)}, - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/4883fa5dbf6f2c9093fac8ce334547e9dfac68fa/specification/network/resource-manager/Microsoft.Network/stable/2024-03-01/examples/VpnServerConfigurationPut.json -func ExampleVPNServerConfigurationsClient_BeginCreateOrUpdate() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armnetwork.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewVPNServerConfigurationsClient().BeginCreateOrUpdate(ctx, "rg1", "vpnServerConfiguration1", armnetwork.VPNServerConfiguration{ - Location: to.Ptr("West US"), - Tags: map[string]*string{ - "key1": to.Ptr("value1"), - }, - Properties: &armnetwork.VPNServerConfigurationProperties{ - ConfigurationPolicyGroups: []*armnetwork.VPNServerConfigurationPolicyGroup{ - { - ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/vpnServerConfigurations/vpnServerConfiguration1/vpnServerConfigurationPolicyGroups/policyGroup1"), - Name: to.Ptr("policyGroup1"), - Properties: &armnetwork.VPNServerConfigurationPolicyGroupProperties{ - IsDefault: to.Ptr(true), - PolicyMembers: []*armnetwork.VPNServerConfigurationPolicyGroupMember{ - { - Name: to.Ptr("policy1"), - AttributeType: to.Ptr(armnetwork.VPNPolicyMemberAttributeTypeRadiusAzureGroupID), - AttributeValue: to.Ptr("6ad1bd08"), - }}, - Priority: to.Ptr[int32](0), - }, - }, - { - ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/vpnServerConfigurations/vpnServerConfiguration1/vpnServerConfigurationPolicyGroups/policyGroup2"), - Name: to.Ptr("policyGroup2"), - Properties: &armnetwork.VPNServerConfigurationPolicyGroupProperties{ - IsDefault: to.Ptr(true), - PolicyMembers: []*armnetwork.VPNServerConfigurationPolicyGroupMember{ - { - Name: to.Ptr("policy2"), - AttributeType: to.Ptr(armnetwork.VPNPolicyMemberAttributeTypeCertificateGroupID), - AttributeValue: to.Ptr("red.com"), - }}, - Priority: to.Ptr[int32](0), - }, - }}, - RadiusClientRootCertificates: []*armnetwork.VPNServerConfigRadiusClientRootCertificate{ - { - Name: to.Ptr("vpnServerConfigRadiusClientRootCert1"), - Thumbprint: to.Ptr("83FFBFC8848B5A5836C94D0112367E16148A286F"), - }}, - RadiusServerRootCertificates: []*armnetwork.VPNServerConfigRadiusServerRootCertificate{ - { - Name: to.Ptr("vpnServerConfigRadiusServerRootCer1"), - PublicCertData: to.Ptr("MIIC5zCCAc+gAwIBAgIQErQ0Hk4aDJxIA+Q5RagB+jANBgkqhkiG9w0BAQsFADAWMRQwEgYDVQQDDAtQMlNSb290Q2VydDAeFw0xNzEyMTQyMTA3MzhaFw0xODEyMTQyMTI3MzhaMBYxFDASBgNVBAMMC1AyU1Jvb3RDZXJ0MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEArP7/NQXmW7cQ/ZR1mv3Y3I29Lt7HTOqzo/1KUOoVH3NItbQIRAQbwKy3UWrOFz4eGNX2GWtNRMdCyWsKeqy9Ltsdfcm1IbKXkl84DFeU/ZacXu4Dl3xX3gV5du4TLZjEowJELyur11Ea2YcjPRQ/FzAF9/hGuboS1HZQEPLx4FdUs9OxCYOtc0MxBCwLfVTTRqarb0Ne+arNYd4kCzIhAke1nOyKAJBda5ZL+VHy3S5S8qGlD46jm8HXugmAkUygS4oIIXOmj/1O9sNAi3LN60zufSzCmP8Rm/iUGX+DHAGGiXxwZOKQLEDaZXKqoHjMPP0XudmSWwOIbyeQVrLhkwIDAQABozEwLzAOBgNVHQ8BAf8EBAMCAgQwHQYDVR0OBBYEFEfeNU2trYxNLF9ONmuJUsT13pKDMA0GCSqGSIb3DQEBCwUAA4IBAQBmM6RJzsGGipxyMhimHKN2xlkejhVsgBoTAhOU0llW9aUSwINJ9zFUGgI8IzUFy1VG776fchHp0LMRmPSIUYk5btEPxbsrPtumPuMH8EQGrS+Rt4pD+78c8H1fEPkq5CmDl/PKu4JoFGv+aFcE+Od0hlILstIF10Qysf++QXDolKfzJa/56bgMeYKFiju73loiRM57ns8ddXpfLl792UVpRkFU62LNns6Y1LKTwapmUF4IvIuAIzd6LZNOQng64LAKXtKnViJ1JQiXwf4CEzhgvAti3/ejpb3U90hsrUcyZi6wBv9bZLcAJRWpz61JNYliM1d1grSwQDKGXNQE4xuM"), - }}, - RadiusServers: []*armnetwork.RadiusServer{ - { - RadiusServerAddress: to.Ptr("10.0.0.0"), - RadiusServerScore: to.Ptr[int64](25), - RadiusServerSecret: to.Ptr("radiusServerSecret"), - }}, - VPNClientIPSecPolicies: []*armnetwork.IPSecPolicy{ - { - DhGroup: to.Ptr(armnetwork.DhGroupDHGroup14), - IkeEncryption: to.Ptr(armnetwork.IkeEncryptionAES256), - IkeIntegrity: to.Ptr(armnetwork.IkeIntegritySHA384), - IPSecEncryption: to.Ptr(armnetwork.IPSecEncryptionAES256), - IPSecIntegrity: to.Ptr(armnetwork.IPSecIntegritySHA256), - PfsGroup: to.Ptr(armnetwork.PfsGroupPFS14), - SaDataSizeKilobytes: to.Ptr[int32](429497), - SaLifeTimeSeconds: to.Ptr[int32](86472), - }}, - VPNClientRevokedCertificates: []*armnetwork.VPNServerConfigVPNClientRevokedCertificate{ - { - Name: to.Ptr("vpnServerConfigVpnClientRevokedCert1"), - Thumbprint: to.Ptr("83FFBFC8848B5A5836C94D0112367E16148A286F"), - }}, - VPNClientRootCertificates: []*armnetwork.VPNServerConfigVPNClientRootCertificate{ - { - Name: to.Ptr("vpnServerConfigVpnClientRootCert1"), - PublicCertData: to.Ptr("MIIC5zCCAc+gAwIBAgIQErQ0Hk4aDJxIA+Q5RagB+jANBgkqhkiG9w0BAQsFADAWMRQwEgYDVQQDDAtQMlNSb290Q2VydDAeFw0xNzEyMTQyMTA3MzhaFw0xODEyMTQyMTI3MzhaMBYxFDASBgNVBAMMC1AyU1Jvb3RDZXJ0MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEArP7/NQXmW7cQ/ZR1mv3Y3I29Lt7HTOqzo/1KUOoVH3NItbQIRAQbwKy3UWrOFz4eGNX2GWtNRMdCyWsKeqy9Ltsdfcm1IbKXkl84DFeU/ZacXu4Dl3xX3gV5du4TLZjEowJELyur11Ea2YcjPRQ/FzAF9/hGuboS1HZQEPLx4FdUs9OxCYOtc0MxBCwLfVTTRqarb0Ne+arNYd4kCzIhAke1nOyKAJBda5ZL+VHy3S5S8qGlD46jm8HXugmAkUygS4oIIXOmj/1O9sNAi3LN60zufSzCmP8Rm/iUGX+DHAGGiXxwZOKQLEDaZXKqoHjMPP0XudmSWwOIbyeQVrLhkwIDAQABozEwLzAOBgNVHQ8BAf8EBAMCAgQwHQYDVR0OBBYEFEfeNU2trYxNLF9ONmuJUsT13pKDMA0GCSqGSIb3DQEBCwUAA4IBAQBmM6RJzsGGipxyMhimHKN2xlkejhVsgBoTAhOU0llW9aUSwINJ9zFUGgI8IzUFy1VG776fchHp0LMRmPSIUYk5btEPxbsrPtumPuMH8EQGrS+Rt4pD+78c8H1fEPkq5CmDl/PKu4JoFGv+aFcE+Od0hlILstIF10Qysf++QXDolKfzJa/56bgMeYKFiju73loiRM57ns8ddXpfLl792UVpRkFU62LNns6Y1LKTwapmUF4IvIuAIzd6LZNOQng64LAKXtKnViJ1JQiXwf4CEzhgvAti3/ejpb3U90hsrUcyZi6wBv9bZLcAJRWpz61JNYliM1d1grSwQDKGXNQE4xuN"), - }}, - VPNProtocols: []*armnetwork.VPNGatewayTunnelingProtocol{ - to.Ptr(armnetwork.VPNGatewayTunnelingProtocolIkeV2)}, - }, - }, nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - res, err := poller.PollUntilDone(ctx, nil) - if err != nil { - log.Fatalf("failed to pull the result: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.VPNServerConfiguration = armnetwork.VPNServerConfiguration{ - // Name: to.Ptr("vpnServerConfiguration1"), - // Type: to.Ptr("Microsoft.Network/vpnServerConfigurations"), - // ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/vpnServerConfigurations/vpnServerConfiguration1"), - // Location: to.Ptr("West US"), - // Tags: map[string]*string{ - // "key1": to.Ptr("value1"), - // }, - // Etag: to.Ptr("w/\\00000000-0000-0000-0000-000000000000\\"), - // Properties: &armnetwork.VPNServerConfigurationProperties{ - // ConfigurationPolicyGroups: []*armnetwork.VPNServerConfigurationPolicyGroup{ - // { - // ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/vpnServerConfigurations/vpnServerConfiguration1/vpnServerConfigurationPolicyGroups/policyGroup1"), - // Name: to.Ptr("policyGroup1"), - // Etag: to.Ptr("w/\\00000000-0000-0000-0000-000000000000\\"), - // Properties: &armnetwork.VPNServerConfigurationPolicyGroupProperties{ - // IsDefault: to.Ptr(true), - // P2SConnectionConfigurations: []*armnetwork.SubResource{ - // { - // ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/p2sVpnGateways/p2sVpnGateway1/p2sConnectionConfigurations/P2SConnectionConfig1"), - // }}, - // PolicyMembers: []*armnetwork.VPNServerConfigurationPolicyGroupMember{ - // { - // Name: to.Ptr("policy1"), - // AttributeType: to.Ptr(armnetwork.VPNPolicyMemberAttributeTypeRadiusAzureGroupID), - // AttributeValue: to.Ptr("6ad1bd08"), - // }}, - // Priority: to.Ptr[int32](0), - // ProvisioningState: to.Ptr(armnetwork.ProvisioningStateSucceeded), - // }, - // }, - // { - // ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/vpnServerConfigurations/vpnServerConfiguration1/vpnServerConfigurationPolicyGroups/policyGroup2"), - // Name: to.Ptr("policyGroup2"), - // Etag: to.Ptr("w/\\00000000-0000-0000-0000-000000000000\\"), - // Properties: &armnetwork.VPNServerConfigurationPolicyGroupProperties{ - // IsDefault: to.Ptr(true), - // PolicyMembers: []*armnetwork.VPNServerConfigurationPolicyGroupMember{ - // { - // Name: to.Ptr("policy2"), - // AttributeType: to.Ptr(armnetwork.VPNPolicyMemberAttributeTypeCertificateGroupID), - // AttributeValue: to.Ptr("red.com"), - // }}, - // Priority: to.Ptr[int32](0), - // ProvisioningState: to.Ptr(armnetwork.ProvisioningStateSucceeded), - // }, - // }}, - // ProvisioningState: to.Ptr("Succeeded"), - // RadiusClientRootCertificates: []*armnetwork.VPNServerConfigRadiusClientRootCertificate{ - // { - // Name: to.Ptr("vpnServerConfigRadiusClientRootCert1"), - // Thumbprint: to.Ptr("83FFBFC8848B5A5836C94D0112367E16148A286F"), - // }}, - // RadiusServerRootCertificates: []*armnetwork.VPNServerConfigRadiusServerRootCertificate{ - // { - // Name: to.Ptr("vpnServerConfigRadiusServerRootCer1"), - // PublicCertData: to.Ptr("MIIC5zCCAc+gAwIBAgIQErQ0Hk4aDJxIA+Q5RagB+jANBgkqhkiG9w0BAQsFADAWMRQwEgYDVQQDDAtQMlNSb290Q2VydDAeFw0xNzEyMTQyMTA3MzhaFw0xODEyMTQyMTI3MzhaMBYxFDASBgNVBAMMC1AyU1Jvb3RDZXJ0MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEArP7/NQXmW7cQ/ZR1mv3Y3I29Lt7HTOqzo/1KUOoVH3NItbQIRAQbwKy3UWrOFz4eGNX2GWtNRMdCyWsKeqy9Ltsdfcm1IbKXkl84DFeU/ZacXu4Dl3xX3gV5du4TLZjEowJELyur11Ea2YcjPRQ/FzAF9/hGuboS1HZQEPLx4FdUs9OxCYOtc0MxBCwLfVTTRqarb0Ne+arNYd4kCzIhAke1nOyKAJBda5ZL+VHy3S5S8qGlD46jm8HXugmAkUygS4oIIXOmj/1O9sNAi3LN60zufSzCmP8Rm/iUGX+DHAGGiXxwZOKQLEDaZXKqoHjMPP0XudmSWwOIbyeQVrLhkwIDAQABozEwLzAOBgNVHQ8BAf8EBAMCAgQwHQYDVR0OBBYEFEfeNU2trYxNLF9ONmuJUsT13pKDMA0GCSqGSIb3DQEBCwUAA4IBAQBmM6RJzsGGipxyMhimHKN2xlkejhVsgBoTAhOU0llW9aUSwINJ9zFUGgI8IzUFy1VG776fchHp0LMRmPSIUYk5btEPxbsrPtumPuMH8EQGrS+Rt4pD+78c8H1fEPkq5CmDl/PKu4JoFGv+aFcE+Od0hlILstIF10Qysf++QXDolKfzJa/56bgMeYKFiju73loiRM57ns8ddXpfLl792UVpRkFU62LNns6Y1LKTwapmUF4IvIuAIzd6LZNOQng64LAKXtKnViJ1JQiXwf4CEzhgvAti3/ejpb3U90hsrUcyZi6wBv9bZLcAJRWpz61JNYliM1d1grSwQDKGXNQE4xuM"), - // }}, - // RadiusServers: []*armnetwork.RadiusServer{ - // { - // RadiusServerAddress: to.Ptr("10.0.0.0"), - // RadiusServerScore: to.Ptr[int64](25), - // }}, - // VPNAuthenticationTypes: []*armnetwork.VPNAuthenticationType{ - // to.Ptr(armnetwork.VPNAuthenticationTypeCertificate)}, - // VPNClientIPSecPolicies: []*armnetwork.IPSecPolicy{ - // { - // DhGroup: to.Ptr(armnetwork.DhGroupDHGroup14), - // IkeEncryption: to.Ptr(armnetwork.IkeEncryptionAES256), - // IkeIntegrity: to.Ptr(armnetwork.IkeIntegritySHA384), - // IPSecEncryption: to.Ptr(armnetwork.IPSecEncryptionAES256), - // IPSecIntegrity: to.Ptr(armnetwork.IPSecIntegritySHA256), - // PfsGroup: to.Ptr(armnetwork.PfsGroupPFS14), - // SaDataSizeKilobytes: to.Ptr[int32](429497), - // SaLifeTimeSeconds: to.Ptr[int32](86472), - // }}, - // VPNClientRevokedCertificates: []*armnetwork.VPNServerConfigVPNClientRevokedCertificate{ - // { - // Name: to.Ptr("vpnServerConfigVpnClientRevokedCert1"), - // Thumbprint: to.Ptr("83FFBFC8848B5A5836C94D0112367E16148A286F"), - // }}, - // VPNClientRootCertificates: []*armnetwork.VPNServerConfigVPNClientRootCertificate{ - // { - // Name: to.Ptr("vpnServerConfigVpnClientRootCert1"), - // PublicCertData: to.Ptr("MIIC5zCCAc+gAwIBAgIQErQ0Hk4aDJxIA+Q5RagB+jANBgkqhkiG9w0BAQsFADAWMRQwEgYDVQQDDAtQMlNSb290Q2VydDAeFw0xNzEyMTQyMTA3MzhaFw0xODEyMTQyMTI3MzhaMBYxFDASBgNVBAMMC1AyU1Jvb3RDZXJ0MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEArP7/NQXmW7cQ/ZR1mv3Y3I29Lt7HTOqzo/1KUOoVH3NItbQIRAQbwKy3UWrOFz4eGNX2GWtNRMdCyWsKeqy9Ltsdfcm1IbKXkl84DFeU/ZacXu4Dl3xX3gV5du4TLZjEowJELyur11Ea2YcjPRQ/FzAF9/hGuboS1HZQEPLx4FdUs9OxCYOtc0MxBCwLfVTTRqarb0Ne+arNYd4kCzIhAke1nOyKAJBda5ZL+VHy3S5S8qGlD46jm8HXugmAkUygS4oIIXOmj/1O9sNAi3LN60zufSzCmP8Rm/iUGX+DHAGGiXxwZOKQLEDaZXKqoHjMPP0XudmSWwOIbyeQVrLhkwIDAQABozEwLzAOBgNVHQ8BAf8EBAMCAgQwHQYDVR0OBBYEFEfeNU2trYxNLF9ONmuJUsT13pKDMA0GCSqGSIb3DQEBCwUAA4IBAQBmM6RJzsGGipxyMhimHKN2xlkejhVsgBoTAhOU0llW9aUSwINJ9zFUGgI8IzUFy1VG776fchHp0LMRmPSIUYk5btEPxbsrPtumPuMH8EQGrS+Rt4pD+78c8H1fEPkq5CmDl/PKu4JoFGv+aFcE+Od0hlILstIF10Qysf++QXDolKfzJa/56bgMeYKFiju73loiRM57ns8ddXpfLl792UVpRkFU62LNns6Y1LKTwapmUF4IvIuAIzd6LZNOQng64LAKXtKnViJ1JQiXwf4CEzhgvAti3/ejpb3U90hsrUcyZi6wBv9bZLcAJRWpz61JNYliM1d1grSwQDKGXNQE4xuN"), - // }}, - // VPNProtocols: []*armnetwork.VPNGatewayTunnelingProtocol{ - // to.Ptr(armnetwork.VPNGatewayTunnelingProtocolIkeV2)}, - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/4883fa5dbf6f2c9093fac8ce334547e9dfac68fa/specification/network/resource-manager/Microsoft.Network/stable/2024-03-01/examples/VpnServerConfigurationUpdateTags.json -func ExampleVPNServerConfigurationsClient_UpdateTags() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armnetwork.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewVPNServerConfigurationsClient().UpdateTags(ctx, "rg1", "vpnServerConfiguration1", armnetwork.TagsObject{ - Tags: map[string]*string{ - "key1": to.Ptr("value1"), - "key2": to.Ptr("value2"), - }, - }, nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.VPNServerConfiguration = armnetwork.VPNServerConfiguration{ - // Name: to.Ptr("vpnServerConfiguration1"), - // Type: to.Ptr("Microsoft.Network/vpnServerConfigurations"), - // ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/vpnServerConfigurations/vpnServerConfiguration1"), - // Location: to.Ptr("West US"), - // Tags: map[string]*string{ - // "key1": to.Ptr("value1"), - // "key2": to.Ptr("value2"), - // }, - // Etag: to.Ptr("w/\\00000000-0000-0000-0000-000000000000\\"), - // Properties: &armnetwork.VPNServerConfigurationProperties{ - // ConfigurationPolicyGroups: []*armnetwork.VPNServerConfigurationPolicyGroup{ - // { - // ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/vpnServerConfigurations/vpnServerConfiguration1/vpnServerConfigurationPolicyGroups/policyGroup1"), - // Name: to.Ptr("policyGroup1"), - // Etag: to.Ptr("w/\\00000000-0000-0000-0000-000000000000\\"), - // Properties: &armnetwork.VPNServerConfigurationPolicyGroupProperties{ - // IsDefault: to.Ptr(true), - // P2SConnectionConfigurations: []*armnetwork.SubResource{ - // { - // ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/p2sVpnGateways/p2sVpnGateway1/p2sConnectionConfigurations/P2SConnectionConfig1"), - // }}, - // PolicyMembers: []*armnetwork.VPNServerConfigurationPolicyGroupMember{ - // { - // Name: to.Ptr("policy1"), - // AttributeType: to.Ptr(armnetwork.VPNPolicyMemberAttributeTypeRadiusAzureGroupID), - // AttributeValue: to.Ptr("6ad1bd08"), - // }}, - // Priority: to.Ptr[int32](0), - // }, - // }, - // { - // ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/vpnServerConfigurations/vpnServerConfiguration1/vpnServerConfigurationPolicyGroups/policyGroup2"), - // Name: to.Ptr("policyGroup2"), - // Etag: to.Ptr("w/\\00000000-0000-0000-0000-000000000000\\"), - // Properties: &armnetwork.VPNServerConfigurationPolicyGroupProperties{ - // IsDefault: to.Ptr(true), - // PolicyMembers: []*armnetwork.VPNServerConfigurationPolicyGroupMember{ - // { - // Name: to.Ptr("policy2"), - // AttributeType: to.Ptr(armnetwork.VPNPolicyMemberAttributeTypeCertificateGroupID), - // AttributeValue: to.Ptr("red.com"), - // }}, - // Priority: to.Ptr[int32](0), - // }, - // }}, - // ProvisioningState: to.Ptr("Succeeded"), - // RadiusClientRootCertificates: []*armnetwork.VPNServerConfigRadiusClientRootCertificate{ - // { - // Name: to.Ptr("vpnServerConfigRadiusClientRootCert1"), - // Thumbprint: to.Ptr("83FFBFC8848B5A5836C94D0112367E16148A286F"), - // }}, - // RadiusServerAddress: to.Ptr("8.9.9.9"), - // RadiusServerRootCertificates: []*armnetwork.VPNServerConfigRadiusServerRootCertificate{ - // { - // Name: to.Ptr("vpnServerConfigRadiusServerRootCer1"), - // PublicCertData: to.Ptr("MIIC5zCCAc+gAwIBAgIQErQ0Hk4aDJxIA+Q5RagB+jANBgkqhkiG9w0BAQsFADAWMRQwEgYDVQQDDAtQMlNSb290Q2VydDAeFw0xNzEyMTQyMTA3MzhaFw0xODEyMTQyMTI3MzhaMBYxFDASBgNVBAMMC1AyU1Jvb3RDZXJ0MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEArP7/NQXmW7cQ/ZR1mv3Y3I29Lt7HTOqzo/1KUOoVH3NItbQIRAQbwKy3UWrOFz4eGNX2GWtNRMdCyWsKeqy9Ltsdfcm1IbKXkl84DFeU/ZacXu4Dl3xX3gV5du4TLZjEowJELyur11Ea2YcjPRQ/FzAF9/hGuboS1HZQEPLx4FdUs9OxCYOtc0MxBCwLfVTTRqarb0Ne+arNYd4kCzIhAke1nOyKAJBda5ZL+VHy3S5S8qGlD46jm8HXugmAkUygS4oIIXOmj/1O9sNAi3LN60zufSzCmP8Rm/iUGX+DHAGGiXxwZOKQLEDaZXKqoHjMPP0XudmSWwOIbyeQVrLhkwIDAQABozEwLzAOBgNVHQ8BAf8EBAMCAgQwHQYDVR0OBBYEFEfeNU2trYxNLF9ONmuJUsT13pKDMA0GCSqGSIb3DQEBCwUAA4IBAQBmM6RJzsGGipxyMhimHKN2xlkejhVsgBoTAhOU0llW9aUSwINJ9zFUGgI8IzUFy1VG776fchHp0LMRmPSIUYk5btEPxbsrPtumPuMH8EQGrS+Rt4pD+78c8H1fEPkq5CmDl/PKu4JoFGv+aFcE+Od0hlILstIF10Qysf++QXDolKfzJa/56bgMeYKFiju73loiRM57ns8ddXpfLl792UVpRkFU62LNns6Y1LKTwapmUF4IvIuAIzd6LZNOQng64LAKXtKnViJ1JQiXwf4CEzhgvAti3/ejpb3U90hsrUcyZi6wBv9bZLcAJRWpz61JNYliM1d1grSwQDKGXNQE4xuM"), - // }}, - // RadiusServerSecret: to.Ptr(""), - // VPNClientIPSecPolicies: []*armnetwork.IPSecPolicy{ - // { - // DhGroup: to.Ptr(armnetwork.DhGroupDHGroup14), - // IkeEncryption: to.Ptr(armnetwork.IkeEncryptionAES256), - // IkeIntegrity: to.Ptr(armnetwork.IkeIntegritySHA384), - // IPSecEncryption: to.Ptr(armnetwork.IPSecEncryptionAES256), - // IPSecIntegrity: to.Ptr(armnetwork.IPSecIntegritySHA256), - // PfsGroup: to.Ptr(armnetwork.PfsGroupPFS14), - // SaDataSizeKilobytes: to.Ptr[int32](429497), - // SaLifeTimeSeconds: to.Ptr[int32](86472), - // }}, - // VPNClientRevokedCertificates: []*armnetwork.VPNServerConfigVPNClientRevokedCertificate{ - // { - // Name: to.Ptr("vpnServerConfigVpnClientRevokedCert1"), - // Thumbprint: to.Ptr("83FFBFC8848B5A5836C94D0112367E16148A286F"), - // }}, - // VPNClientRootCertificates: []*armnetwork.VPNServerConfigVPNClientRootCertificate{ - // { - // Name: to.Ptr("vpnServerConfigVpnClientRootCert1"), - // PublicCertData: to.Ptr("MIIC5zCCAc+gAwIBAgIQErQ0Hk4aDJxIA+Q5RagB+jANBgkqhkiG9w0BAQsFADAWMRQwEgYDVQQDDAtQMlNSb290Q2VydDAeFw0xNzEyMTQyMTA3MzhaFw0xODEyMTQyMTI3MzhaMBYxFDASBgNVBAMMC1AyU1Jvb3RDZXJ0MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEArP7/NQXmW7cQ/ZR1mv3Y3I29Lt7HTOqzo/1KUOoVH3NItbQIRAQbwKy3UWrOFz4eGNX2GWtNRMdCyWsKeqy9Ltsdfcm1IbKXkl84DFeU/ZacXu4Dl3xX3gV5du4TLZjEowJELyur11Ea2YcjPRQ/FzAF9/hGuboS1HZQEPLx4FdUs9OxCYOtc0MxBCwLfVTTRqarb0Ne+arNYd4kCzIhAke1nOyKAJBda5ZL+VHy3S5S8qGlD46jm8HXugmAkUygS4oIIXOmj/1O9sNAi3LN60zufSzCmP8Rm/iUGX+DHAGGiXxwZOKQLEDaZXKqoHjMPP0XudmSWwOIbyeQVrLhkwIDAQABozEwLzAOBgNVHQ8BAf8EBAMCAgQwHQYDVR0OBBYEFEfeNU2trYxNLF9ONmuJUsT13pKDMA0GCSqGSIb3DQEBCwUAA4IBAQBmM6RJzsGGipxyMhimHKN2xlkejhVsgBoTAhOU0llW9aUSwINJ9zFUGgI8IzUFy1VG776fchHp0LMRmPSIUYk5btEPxbsrPtumPuMH8EQGrS+Rt4pD+78c8H1fEPkq5CmDl/PKu4JoFGv+aFcE+Od0hlILstIF10Qysf++QXDolKfzJa/56bgMeYKFiju73loiRM57ns8ddXpfLl792UVpRkFU62LNns6Y1LKTwapmUF4IvIuAIzd6LZNOQng64LAKXtKnViJ1JQiXwf4CEzhgvAti3/ejpb3U90hsrUcyZi6wBv9bZLcAJRWpz61JNYliM1d1grSwQDKGXNQE4xuN"), - // }}, - // VPNProtocols: []*armnetwork.VPNGatewayTunnelingProtocol{ - // to.Ptr(armnetwork.VPNGatewayTunnelingProtocolIkeV2)}, - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/4883fa5dbf6f2c9093fac8ce334547e9dfac68fa/specification/network/resource-manager/Microsoft.Network/stable/2024-03-01/examples/VpnServerConfigurationDelete.json -func ExampleVPNServerConfigurationsClient_BeginDelete() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armnetwork.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewVPNServerConfigurationsClient().BeginDelete(ctx, "rg1", "vpnServerConfiguration1", nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - _, err = poller.PollUntilDone(ctx, nil) - if err != nil { - log.Fatalf("failed to pull the result: %v", err) - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/4883fa5dbf6f2c9093fac8ce334547e9dfac68fa/specification/network/resource-manager/Microsoft.Network/stable/2024-03-01/examples/VpnServerConfigurationListByResourceGroup.json -func ExampleVPNServerConfigurationsClient_NewListByResourceGroupPager() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armnetwork.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := clientFactory.NewVPNServerConfigurationsClient().NewListByResourceGroupPager("rg1", nil) - for pager.More() { - page, err := pager.NextPage(ctx) - if err != nil { - log.Fatalf("failed to advance page: %v", err) - } - for _, v := range page.Value { - // You could use page here. We use blank identifier for just demo purposes. - _ = v - } - // If the HTTP response code is 200 as defined in example definition, your page structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // page.ListVPNServerConfigurationsResult = armnetwork.ListVPNServerConfigurationsResult{ - // Value: []*armnetwork.VPNServerConfiguration{ - // { - // Name: to.Ptr("vpnServerConfiguration1"), - // Type: to.Ptr("Microsoft.Network/vpnServerConfigurations"), - // ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/vpnServerConfigurations/vpnServerConfiguration1"), - // Location: to.Ptr("West US"), - // Tags: map[string]*string{ - // "key1": to.Ptr("value1"), - // }, - // Etag: to.Ptr("w/\\00000000-0000-0000-0000-000000000000\\"), - // Properties: &armnetwork.VPNServerConfigurationProperties{ - // ConfigurationPolicyGroups: []*armnetwork.VPNServerConfigurationPolicyGroup{ - // { - // ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/vpnServerConfigurations/vpnServerConfiguration1/vpnServerConfigurationPolicyGroups/policyGroup1"), - // Name: to.Ptr("policyGroup1"), - // Etag: to.Ptr("w/\\00000000-0000-0000-0000-000000000000\\"), - // Properties: &armnetwork.VPNServerConfigurationPolicyGroupProperties{ - // IsDefault: to.Ptr(true), - // P2SConnectionConfigurations: []*armnetwork.SubResource{ - // { - // ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/p2sVpnGateways/p2sVpnGateway1/p2sConnectionConfigurations/P2SConnectionConfig1"), - // }}, - // PolicyMembers: []*armnetwork.VPNServerConfigurationPolicyGroupMember{ - // { - // Name: to.Ptr("policy1"), - // AttributeType: to.Ptr(armnetwork.VPNPolicyMemberAttributeTypeRadiusAzureGroupID), - // AttributeValue: to.Ptr("6ad1bd08"), - // }}, - // Priority: to.Ptr[int32](0), - // ProvisioningState: to.Ptr(armnetwork.ProvisioningStateSucceeded), - // }, - // }, - // { - // ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/vpnServerConfigurations/vpnServerConfiguration1/vpnServerConfigurationPolicyGroups/policyGroup2"), - // Name: to.Ptr("policyGroup2"), - // Etag: to.Ptr("w/\\00000000-0000-0000-0000-000000000000\\"), - // Properties: &armnetwork.VPNServerConfigurationPolicyGroupProperties{ - // IsDefault: to.Ptr(true), - // PolicyMembers: []*armnetwork.VPNServerConfigurationPolicyGroupMember{ - // { - // Name: to.Ptr("policy2"), - // AttributeType: to.Ptr(armnetwork.VPNPolicyMemberAttributeTypeCertificateGroupID), - // AttributeValue: to.Ptr("red.com"), - // }}, - // Priority: to.Ptr[int32](0), - // ProvisioningState: to.Ptr(armnetwork.ProvisioningStateSucceeded), - // }, - // }}, - // ProvisioningState: to.Ptr("Succeeded"), - // RadiusClientRootCertificates: []*armnetwork.VPNServerConfigRadiusClientRootCertificate{ - // { - // Name: to.Ptr("vpnServerConfigRadiusClientRootCert1"), - // Thumbprint: to.Ptr("83FFBFC8848B5A5836C94D0112367E16148A286F"), - // }}, - // RadiusServerAddress: to.Ptr("8.9.9.9"), - // RadiusServerRootCertificates: []*armnetwork.VPNServerConfigRadiusServerRootCertificate{ - // { - // Name: to.Ptr("vpnServerConfigRadiusServerRootCer1"), - // PublicCertData: to.Ptr("MIIC5zCCAc+gAwIBAgIQErQ0Hk4aDJxIA+Q5RagB+jANBgkqhkiG9w0BAQsFADAWMRQwEgYDVQQDDAtQMlNSb290Q2VydDAeFw0xNzEyMTQyMTA3MzhaFw0xODEyMTQyMTI3MzhaMBYxFDASBgNVBAMMC1AyU1Jvb3RDZXJ0MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEArP7/NQXmW7cQ/ZR1mv3Y3I29Lt7HTOqzo/1KUOoVH3NItbQIRAQbwKy3UWrOFz4eGNX2GWtNRMdCyWsKeqy9Ltsdfcm1IbKXkl84DFeU/ZacXu4Dl3xX3gV5du4TLZjEowJELyur11Ea2YcjPRQ/FzAF9/hGuboS1HZQEPLx4FdUs9OxCYOtc0MxBCwLfVTTRqarb0Ne+arNYd4kCzIhAke1nOyKAJBda5ZL+VHy3S5S8qGlD46jm8HXugmAkUygS4oIIXOmj/1O9sNAi3LN60zufSzCmP8Rm/iUGX+DHAGGiXxwZOKQLEDaZXKqoHjMPP0XudmSWwOIbyeQVrLhkwIDAQABozEwLzAOBgNVHQ8BAf8EBAMCAgQwHQYDVR0OBBYEFEfeNU2trYxNLF9ONmuJUsT13pKDMA0GCSqGSIb3DQEBCwUAA4IBAQBmM6RJzsGGipxyMhimHKN2xlkejhVsgBoTAhOU0llW9aUSwINJ9zFUGgI8IzUFy1VG776fchHp0LMRmPSIUYk5btEPxbsrPtumPuMH8EQGrS+Rt4pD+78c8H1fEPkq5CmDl/PKu4JoFGv+aFcE+Od0hlILstIF10Qysf++QXDolKfzJa/56bgMeYKFiju73loiRM57ns8ddXpfLl792UVpRkFU62LNns6Y1LKTwapmUF4IvIuAIzd6LZNOQng64LAKXtKnViJ1JQiXwf4CEzhgvAti3/ejpb3U90hsrUcyZi6wBv9bZLcAJRWpz61JNYliM1d1grSwQDKGXNQE4xuM"), - // }}, - // RadiusServerSecret: to.Ptr(""), - // VPNAuthenticationTypes: []*armnetwork.VPNAuthenticationType{ - // to.Ptr(armnetwork.VPNAuthenticationTypeCertificate)}, - // VPNClientIPSecPolicies: []*armnetwork.IPSecPolicy{ - // { - // DhGroup: to.Ptr(armnetwork.DhGroupDHGroup14), - // IkeEncryption: to.Ptr(armnetwork.IkeEncryptionAES256), - // IkeIntegrity: to.Ptr(armnetwork.IkeIntegritySHA384), - // IPSecEncryption: to.Ptr(armnetwork.IPSecEncryptionAES256), - // IPSecIntegrity: to.Ptr(armnetwork.IPSecIntegritySHA256), - // PfsGroup: to.Ptr(armnetwork.PfsGroupPFS14), - // SaDataSizeKilobytes: to.Ptr[int32](429497), - // SaLifeTimeSeconds: to.Ptr[int32](86472), - // }}, - // VPNClientRevokedCertificates: []*armnetwork.VPNServerConfigVPNClientRevokedCertificate{ - // { - // Name: to.Ptr("vpnServerConfigVpnClientRevokedCert1"), - // Thumbprint: to.Ptr("83FFBFC8848B5A5836C94D0112367E16148A286F"), - // }}, - // VPNClientRootCertificates: []*armnetwork.VPNServerConfigVPNClientRootCertificate{ - // { - // Name: to.Ptr("vpnServerConfigVpnClientRootCert1"), - // PublicCertData: to.Ptr("MIIC5zCCAc+gAwIBAgIQErQ0Hk4aDJxIA+Q5RagB+jANBgkqhkiG9w0BAQsFADAWMRQwEgYDVQQDDAtQMlNSb290Q2VydDAeFw0xNzEyMTQyMTA3MzhaFw0xODEyMTQyMTI3MzhaMBYxFDASBgNVBAMMC1AyU1Jvb3RDZXJ0MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEArP7/NQXmW7cQ/ZR1mv3Y3I29Lt7HTOqzo/1KUOoVH3NItbQIRAQbwKy3UWrOFz4eGNX2GWtNRMdCyWsKeqy9Ltsdfcm1IbKXkl84DFeU/ZacXu4Dl3xX3gV5du4TLZjEowJELyur11Ea2YcjPRQ/FzAF9/hGuboS1HZQEPLx4FdUs9OxCYOtc0MxBCwLfVTTRqarb0Ne+arNYd4kCzIhAke1nOyKAJBda5ZL+VHy3S5S8qGlD46jm8HXugmAkUygS4oIIXOmj/1O9sNAi3LN60zufSzCmP8Rm/iUGX+DHAGGiXxwZOKQLEDaZXKqoHjMPP0XudmSWwOIbyeQVrLhkwIDAQABozEwLzAOBgNVHQ8BAf8EBAMCAgQwHQYDVR0OBBYEFEfeNU2trYxNLF9ONmuJUsT13pKDMA0GCSqGSIb3DQEBCwUAA4IBAQBmM6RJzsGGipxyMhimHKN2xlkejhVsgBoTAhOU0llW9aUSwINJ9zFUGgI8IzUFy1VG776fchHp0LMRmPSIUYk5btEPxbsrPtumPuMH8EQGrS+Rt4pD+78c8H1fEPkq5CmDl/PKu4JoFGv+aFcE+Od0hlILstIF10Qysf++QXDolKfzJa/56bgMeYKFiju73loiRM57ns8ddXpfLl792UVpRkFU62LNns6Y1LKTwapmUF4IvIuAIzd6LZNOQng64LAKXtKnViJ1JQiXwf4CEzhgvAti3/ejpb3U90hsrUcyZi6wBv9bZLcAJRWpz61JNYliM1d1grSwQDKGXNQE4xuN"), - // }}, - // VPNProtocols: []*armnetwork.VPNGatewayTunnelingProtocol{ - // to.Ptr(armnetwork.VPNGatewayTunnelingProtocolIkeV2)}, - // }, - // }, - // { - // Name: to.Ptr("vpnServerConfiguration2"), - // Type: to.Ptr("Microsoft.Network/vpnServerConfigurations"), - // ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/vpnServerConfigurations/vpnServerConfiguration2"), - // Location: to.Ptr("West US"), - // Tags: map[string]*string{ - // "key1": to.Ptr("value1"), - // }, - // Etag: to.Ptr("w/\\00000000-0000-0000-0000-000000000000\\"), - // Properties: &armnetwork.VPNServerConfigurationProperties{ - // ConfigurationPolicyGroups: []*armnetwork.VPNServerConfigurationPolicyGroup{ - // { - // ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/vpnServerConfigurations/vpnServerConfiguration1/vpnServerConfigurationPolicyGroups/policyGroup1"), - // Name: to.Ptr("policyGroup1"), - // Etag: to.Ptr("w/\\00000000-0000-0000-0000-000000000000\\"), - // Properties: &armnetwork.VPNServerConfigurationPolicyGroupProperties{ - // IsDefault: to.Ptr(true), - // P2SConnectionConfigurations: []*armnetwork.SubResource{ - // { - // ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/p2sVpnGateways/p2sVpnGateway1/p2sConnectionConfigurations/P2SConnectionConfig1"), - // }}, - // PolicyMembers: []*armnetwork.VPNServerConfigurationPolicyGroupMember{ - // { - // Name: to.Ptr("policy1"), - // AttributeType: to.Ptr(armnetwork.VPNPolicyMemberAttributeTypeRadiusAzureGroupID), - // AttributeValue: to.Ptr("6ad1bd08"), - // }}, - // Priority: to.Ptr[int32](0), - // ProvisioningState: to.Ptr(armnetwork.ProvisioningStateSucceeded), - // }, - // }, - // { - // ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/vpnServerConfigurations/vpnServerConfiguration1/vpnServerConfigurationPolicyGroups/policyGroup2"), - // Name: to.Ptr("policyGroup2"), - // Etag: to.Ptr("w/\\00000000-0000-0000-0000-000000000000\\"), - // Properties: &armnetwork.VPNServerConfigurationPolicyGroupProperties{ - // IsDefault: to.Ptr(true), - // PolicyMembers: []*armnetwork.VPNServerConfigurationPolicyGroupMember{ - // { - // Name: to.Ptr("policy2"), - // AttributeType: to.Ptr(armnetwork.VPNPolicyMemberAttributeTypeCertificateGroupID), - // AttributeValue: to.Ptr("red.com"), - // }}, - // Priority: to.Ptr[int32](0), - // ProvisioningState: to.Ptr(armnetwork.ProvisioningStateSucceeded), - // }, - // }}, - // ProvisioningState: to.Ptr("Succeeded"), - // RadiusClientRootCertificates: []*armnetwork.VPNServerConfigRadiusClientRootCertificate{ - // { - // Name: to.Ptr("vpnServerConfigRadiusClientRootCert1"), - // Thumbprint: to.Ptr("83FFBFC8848B5A5836C94D0112367E16148A286F"), - // }}, - // RadiusServerAddress: to.Ptr("8.9.9.9"), - // RadiusServerRootCertificates: []*armnetwork.VPNServerConfigRadiusServerRootCertificate{ - // { - // Name: to.Ptr("vpnServerConfigRadiusServerRootCer1"), - // PublicCertData: to.Ptr("MIIC5zCCAc+gAwIBAgIQErQ0Hk4aDJxIA+Q5RagB+jANBgkqhkiG9w0BAQsFADAWMRQwEgYDVQQDDAtQMlNSb290Q2VydDAeFw0xNzEyMTQyMTA3MzhaFw0xODEyMTQyMTI3MzhaMBYxFDASBgNVBAMMC1AyU1Jvb3RDZXJ0MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEArP7/NQXmW7cQ/ZR1mv3Y3I29Lt7HTOqzo/1KUOoVH3NItbQIRAQbwKy3UWrOFz4eGNX2GWtNRMdCyWsKeqy9Ltsdfcm1IbKXkl84DFeU/ZacXu4Dl3xX3gV5du4TLZjEowJELyur11Ea2YcjPRQ/FzAF9/hGuboS1HZQEPLx4FdUs9OxCYOtc0MxBCwLfVTTRqarb0Ne+arNYd4kCzIhAke1nOyKAJBda5ZL+VHy3S5S8qGlD46jm8HXugmAkUygS4oIIXOmj/1O9sNAi3LN60zufSzCmP8Rm/iUGX+DHAGGiXxwZOKQLEDaZXKqoHjMPP0XudmSWwOIbyeQVrLhkwIDAQABozEwLzAOBgNVHQ8BAf8EBAMCAgQwHQYDVR0OBBYEFEfeNU2trYxNLF9ONmuJUsT13pKDMA0GCSqGSIb3DQEBCwUAA4IBAQBmM6RJzsGGipxyMhimHKN2xlkejhVsgBoTAhOU0llW9aUSwINJ9zFUGgI8IzUFy1VG776fchHp0LMRmPSIUYk5btEPxbsrPtumPuMH8EQGrS+Rt4pD+78c8H1fEPkq5CmDl/PKu4JoFGv+aFcE+Od0hlILstIF10Qysf++QXDolKfzJa/56bgMeYKFiju73loiRM57ns8ddXpfLl792UVpRkFU62LNns6Y1LKTwapmUF4IvIuAIzd6LZNOQng64LAKXtKnViJ1JQiXwf4CEzhgvAti3/ejpb3U90hsrUcyZi6wBv9bZLcAJRWpz61JNYliM1d1grSwQDKGXNQE4xuM"), - // }}, - // RadiusServerSecret: to.Ptr(""), - // VPNAuthenticationTypes: []*armnetwork.VPNAuthenticationType{ - // to.Ptr(armnetwork.VPNAuthenticationTypeCertificate)}, - // VPNClientIPSecPolicies: []*armnetwork.IPSecPolicy{ - // { - // DhGroup: to.Ptr(armnetwork.DhGroupDHGroup14), - // IkeEncryption: to.Ptr(armnetwork.IkeEncryptionAES256), - // IkeIntegrity: to.Ptr(armnetwork.IkeIntegritySHA384), - // IPSecEncryption: to.Ptr(armnetwork.IPSecEncryptionAES256), - // IPSecIntegrity: to.Ptr(armnetwork.IPSecIntegritySHA256), - // PfsGroup: to.Ptr(armnetwork.PfsGroupPFS14), - // SaDataSizeKilobytes: to.Ptr[int32](429497), - // SaLifeTimeSeconds: to.Ptr[int32](86472), - // }}, - // VPNClientRevokedCertificates: []*armnetwork.VPNServerConfigVPNClientRevokedCertificate{ - // { - // Name: to.Ptr("vpnServerConfigVpnClientRevokedCert1"), - // Thumbprint: to.Ptr("83FFBFC8848B5A5836C94D0112367E16148A286F"), - // }}, - // VPNClientRootCertificates: []*armnetwork.VPNServerConfigVPNClientRootCertificate{ - // { - // Name: to.Ptr("vpnServerConfigVpnClientRootCert1"), - // PublicCertData: to.Ptr("MIIC5zCCAc+gAwIBAgIQErQ0Hk4aDJxIA+Q5RagB+jANBgkqhkiG9w0BAQsFADAWMRQwEgYDVQQDDAtQMlNSb290Q2VydDAeFw0xNzEyMTQyMTA3MzhaFw0xODEyMTQyMTI3MzhaMBYxFDASBgNVBAMMC1AyU1Jvb3RDZXJ0MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEArP7/NQXmW7cQ/ZR1mv3Y3I29Lt7HTOqzo/1KUOoVH3NItbQIRAQbwKy3UWrOFz4eGNX2GWtNRMdCyWsKeqy9Ltsdfcm1IbKXkl84DFeU/ZacXu4Dl3xX3gV5du4TLZjEowJELyur11Ea2YcjPRQ/FzAF9/hGuboS1HZQEPLx4FdUs9OxCYOtc0MxBCwLfVTTRqarb0Ne+arNYd4kCzIhAke1nOyKAJBda5ZL+VHy3S5S8qGlD46jm8HXugmAkUygS4oIIXOmj/1O9sNAi3LN60zufSzCmP8Rm/iUGX+DHAGGiXxwZOKQLEDaZXKqoHjMPP0XudmSWwOIbyeQVrLhkwIDAQABozEwLzAOBgNVHQ8BAf8EBAMCAgQwHQYDVR0OBBYEFEfeNU2trYxNLF9ONmuJUsT13pKDMA0GCSqGSIb3DQEBCwUAA4IBAQBmM6RJzsGGipxyMhimHKN2xlkejhVsgBoTAhOU0llW9aUSwINJ9zFUGgI8IzUFy1VG776fchHp0LMRmPSIUYk5btEPxbsrPtumPuMH8EQGrS+Rt4pD+78c8H1fEPkq5CmDl/PKu4JoFGv+aFcE+Od0hlILstIF10Qysf++QXDolKfzJa/56bgMeYKFiju73loiRM57ns8ddXpfLl792UVpRkFU62LNns6Y1LKTwapmUF4IvIuAIzd6LZNOQng64LAKXtKnViJ1JQiXwf4CEzhgvAti3/ejpb3U90hsrUcyZi6wBv9bZLcAJRWpz61JNYliM1d1grSwQDKGXNQE4xuN"), - // }}, - // VPNProtocols: []*armnetwork.VPNGatewayTunnelingProtocol{ - // to.Ptr(armnetwork.VPNGatewayTunnelingProtocolIkeV2)}, - // }, - // }}, - // } - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/4883fa5dbf6f2c9093fac8ce334547e9dfac68fa/specification/network/resource-manager/Microsoft.Network/stable/2024-03-01/examples/VpnServerConfigurationList.json -func ExampleVPNServerConfigurationsClient_NewListPager() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armnetwork.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := clientFactory.NewVPNServerConfigurationsClient().NewListPager(nil) - for pager.More() { - page, err := pager.NextPage(ctx) - if err != nil { - log.Fatalf("failed to advance page: %v", err) - } - for _, v := range page.Value { - // You could use page here. We use blank identifier for just demo purposes. - _ = v - } - // If the HTTP response code is 200 as defined in example definition, your page structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // page.ListVPNServerConfigurationsResult = armnetwork.ListVPNServerConfigurationsResult{ - // Value: []*armnetwork.VPNServerConfiguration{ - // { - // Name: to.Ptr("vpnServerConfiguration1"), - // Type: to.Ptr("Microsoft.Network/vpnServerConfigurations"), - // ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/vpnServerConfigurations/vpnServerConfiguration1"), - // Location: to.Ptr("West US"), - // Tags: map[string]*string{ - // "key1": to.Ptr("value1"), - // }, - // Etag: to.Ptr("w/\\00000000-0000-0000-0000-000000000000\\"), - // Properties: &armnetwork.VPNServerConfigurationProperties{ - // ConfigurationPolicyGroups: []*armnetwork.VPNServerConfigurationPolicyGroup{ - // { - // ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/vpnServerConfigurations/vpnServerConfiguration1/vpnServerConfigurationPolicyGroups/policyGroup1"), - // Name: to.Ptr("policyGroup1"), - // Etag: to.Ptr("w/\\00000000-0000-0000-0000-000000000000\\"), - // Properties: &armnetwork.VPNServerConfigurationPolicyGroupProperties{ - // IsDefault: to.Ptr(true), - // P2SConnectionConfigurations: []*armnetwork.SubResource{ - // { - // ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/p2sVpnGateways/p2sVpnGateway1/p2sConnectionConfigurations/P2SConnectionConfig1"), - // }}, - // PolicyMembers: []*armnetwork.VPNServerConfigurationPolicyGroupMember{ - // { - // Name: to.Ptr("policy1"), - // AttributeType: to.Ptr(armnetwork.VPNPolicyMemberAttributeTypeRadiusAzureGroupID), - // AttributeValue: to.Ptr("6ad1bd08"), - // }}, - // Priority: to.Ptr[int32](0), - // ProvisioningState: to.Ptr(armnetwork.ProvisioningStateSucceeded), - // }, - // }, - // { - // ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/vpnServerConfigurations/vpnServerConfiguration1/vpnServerConfigurationPolicyGroups/policyGroup2"), - // Name: to.Ptr("policyGroup2"), - // Etag: to.Ptr("w/\\00000000-0000-0000-0000-000000000000\\"), - // Properties: &armnetwork.VPNServerConfigurationPolicyGroupProperties{ - // IsDefault: to.Ptr(true), - // PolicyMembers: []*armnetwork.VPNServerConfigurationPolicyGroupMember{ - // { - // Name: to.Ptr("policy2"), - // AttributeType: to.Ptr(armnetwork.VPNPolicyMemberAttributeTypeCertificateGroupID), - // AttributeValue: to.Ptr("red.com"), - // }}, - // Priority: to.Ptr[int32](0), - // ProvisioningState: to.Ptr(armnetwork.ProvisioningStateSucceeded), - // }, - // }}, - // ProvisioningState: to.Ptr("Succeeded"), - // RadiusClientRootCertificates: []*armnetwork.VPNServerConfigRadiusClientRootCertificate{ - // { - // Name: to.Ptr("vpnServerConfigRadiusClientRootCert1"), - // Thumbprint: to.Ptr("83FFBFC8848B5A5836C94D0112367E16148A286F"), - // }}, - // RadiusServerAddress: to.Ptr("8.9.9.9"), - // RadiusServerRootCertificates: []*armnetwork.VPNServerConfigRadiusServerRootCertificate{ - // { - // Name: to.Ptr("vpnServerConfigRadiusServerRootCer1"), - // PublicCertData: to.Ptr("MIIC5zCCAc+gAwIBAgIQErQ0Hk4aDJxIA+Q5RagB+jANBgkqhkiG9w0BAQsFADAWMRQwEgYDVQQDDAtQMlNSb290Q2VydDAeFw0xNzEyMTQyMTA3MzhaFw0xODEyMTQyMTI3MzhaMBYxFDASBgNVBAMMC1AyU1Jvb3RDZXJ0MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEArP7/NQXmW7cQ/ZR1mv3Y3I29Lt7HTOqzo/1KUOoVH3NItbQIRAQbwKy3UWrOFz4eGNX2GWtNRMdCyWsKeqy9Ltsdfcm1IbKXkl84DFeU/ZacXu4Dl3xX3gV5du4TLZjEowJELyur11Ea2YcjPRQ/FzAF9/hGuboS1HZQEPLx4FdUs9OxCYOtc0MxBCwLfVTTRqarb0Ne+arNYd4kCzIhAke1nOyKAJBda5ZL+VHy3S5S8qGlD46jm8HXugmAkUygS4oIIXOmj/1O9sNAi3LN60zufSzCmP8Rm/iUGX+DHAGGiXxwZOKQLEDaZXKqoHjMPP0XudmSWwOIbyeQVrLhkwIDAQABozEwLzAOBgNVHQ8BAf8EBAMCAgQwHQYDVR0OBBYEFEfeNU2trYxNLF9ONmuJUsT13pKDMA0GCSqGSIb3DQEBCwUAA4IBAQBmM6RJzsGGipxyMhimHKN2xlkejhVsgBoTAhOU0llW9aUSwINJ9zFUGgI8IzUFy1VG776fchHp0LMRmPSIUYk5btEPxbsrPtumPuMH8EQGrS+Rt4pD+78c8H1fEPkq5CmDl/PKu4JoFGv+aFcE+Od0hlILstIF10Qysf++QXDolKfzJa/56bgMeYKFiju73loiRM57ns8ddXpfLl792UVpRkFU62LNns6Y1LKTwapmUF4IvIuAIzd6LZNOQng64LAKXtKnViJ1JQiXwf4CEzhgvAti3/ejpb3U90hsrUcyZi6wBv9bZLcAJRWpz61JNYliM1d1grSwQDKGXNQE4xuM"), - // }}, - // RadiusServerSecret: to.Ptr(""), - // VPNAuthenticationTypes: []*armnetwork.VPNAuthenticationType{ - // to.Ptr(armnetwork.VPNAuthenticationTypeCertificate)}, - // VPNClientIPSecPolicies: []*armnetwork.IPSecPolicy{ - // { - // DhGroup: to.Ptr(armnetwork.DhGroupDHGroup14), - // IkeEncryption: to.Ptr(armnetwork.IkeEncryptionAES256), - // IkeIntegrity: to.Ptr(armnetwork.IkeIntegritySHA384), - // IPSecEncryption: to.Ptr(armnetwork.IPSecEncryptionAES256), - // IPSecIntegrity: to.Ptr(armnetwork.IPSecIntegritySHA256), - // PfsGroup: to.Ptr(armnetwork.PfsGroupPFS14), - // SaDataSizeKilobytes: to.Ptr[int32](429497), - // SaLifeTimeSeconds: to.Ptr[int32](86472), - // }}, - // VPNClientRevokedCertificates: []*armnetwork.VPNServerConfigVPNClientRevokedCertificate{ - // { - // Name: to.Ptr("vpnServerConfigVpnClientRevokedCert1"), - // Thumbprint: to.Ptr("83FFBFC8848B5A5836C94D0112367E16148A286F"), - // }}, - // VPNClientRootCertificates: []*armnetwork.VPNServerConfigVPNClientRootCertificate{ - // { - // Name: to.Ptr("vpnServerConfigVpnClientRootCert1"), - // PublicCertData: to.Ptr("MIIC5zCCAc+gAwIBAgIQErQ0Hk4aDJxIA+Q5RagB+jANBgkqhkiG9w0BAQsFADAWMRQwEgYDVQQDDAtQMlNSb290Q2VydDAeFw0xNzEyMTQyMTA3MzhaFw0xODEyMTQyMTI3MzhaMBYxFDASBgNVBAMMC1AyU1Jvb3RDZXJ0MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEArP7/NQXmW7cQ/ZR1mv3Y3I29Lt7HTOqzo/1KUOoVH3NItbQIRAQbwKy3UWrOFz4eGNX2GWtNRMdCyWsKeqy9Ltsdfcm1IbKXkl84DFeU/ZacXu4Dl3xX3gV5du4TLZjEowJELyur11Ea2YcjPRQ/FzAF9/hGuboS1HZQEPLx4FdUs9OxCYOtc0MxBCwLfVTTRqarb0Ne+arNYd4kCzIhAke1nOyKAJBda5ZL+VHy3S5S8qGlD46jm8HXugmAkUygS4oIIXOmj/1O9sNAi3LN60zufSzCmP8Rm/iUGX+DHAGGiXxwZOKQLEDaZXKqoHjMPP0XudmSWwOIbyeQVrLhkwIDAQABozEwLzAOBgNVHQ8BAf8EBAMCAgQwHQYDVR0OBBYEFEfeNU2trYxNLF9ONmuJUsT13pKDMA0GCSqGSIb3DQEBCwUAA4IBAQBmM6RJzsGGipxyMhimHKN2xlkejhVsgBoTAhOU0llW9aUSwINJ9zFUGgI8IzUFy1VG776fchHp0LMRmPSIUYk5btEPxbsrPtumPuMH8EQGrS+Rt4pD+78c8H1fEPkq5CmDl/PKu4JoFGv+aFcE+Od0hlILstIF10Qysf++QXDolKfzJa/56bgMeYKFiju73loiRM57ns8ddXpfLl792UVpRkFU62LNns6Y1LKTwapmUF4IvIuAIzd6LZNOQng64LAKXtKnViJ1JQiXwf4CEzhgvAti3/ejpb3U90hsrUcyZi6wBv9bZLcAJRWpz61JNYliM1d1grSwQDKGXNQE4xuN"), - // }}, - // VPNProtocols: []*armnetwork.VPNGatewayTunnelingProtocol{ - // to.Ptr(armnetwork.VPNGatewayTunnelingProtocolIkeV2)}, - // }, - // }, - // { - // Name: to.Ptr("vpnServerConfiguration2"), - // Type: to.Ptr("Microsoft.Network/vpnServerConfigurations"), - // ID: to.Ptr("/subscriptions/subid/resourceGroups/rg2/providers/Microsoft.Network/vpnServerConfigurations/vpnServerConfiguration2"), - // Location: to.Ptr("East US"), - // Tags: map[string]*string{ - // "key1": to.Ptr("value1"), - // }, - // Etag: to.Ptr("w/\\00000000-0000-0000-0000-000000000000\\"), - // Properties: &armnetwork.VPNServerConfigurationProperties{ - // ConfigurationPolicyGroups: []*armnetwork.VPNServerConfigurationPolicyGroup{ - // { - // ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/vpnServerConfigurations/vpnServerConfiguration1/vpnServerConfigurationPolicyGroups/policyGroup1"), - // Name: to.Ptr("policyGroup1"), - // Etag: to.Ptr("w/\\00000000-0000-0000-0000-000000000000\\"), - // Properties: &armnetwork.VPNServerConfigurationPolicyGroupProperties{ - // IsDefault: to.Ptr(true), - // P2SConnectionConfigurations: []*armnetwork.SubResource{ - // { - // ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/p2sVpnGateways/p2sVpnGateway1/p2sConnectionConfigurations/P2SConnectionConfig1"), - // }}, - // PolicyMembers: []*armnetwork.VPNServerConfigurationPolicyGroupMember{ - // { - // Name: to.Ptr("policy1"), - // AttributeType: to.Ptr(armnetwork.VPNPolicyMemberAttributeTypeRadiusAzureGroupID), - // AttributeValue: to.Ptr("6ad1bd08"), - // }}, - // Priority: to.Ptr[int32](0), - // ProvisioningState: to.Ptr(armnetwork.ProvisioningStateSucceeded), - // }, - // }, - // { - // ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/vpnServerConfigurations/vpnServerConfiguration1/vpnServerConfigurationPolicyGroups/policyGroup2"), - // Name: to.Ptr("policyGroup2"), - // Etag: to.Ptr("w/\\00000000-0000-0000-0000-000000000000\\"), - // Properties: &armnetwork.VPNServerConfigurationPolicyGroupProperties{ - // IsDefault: to.Ptr(true), - // PolicyMembers: []*armnetwork.VPNServerConfigurationPolicyGroupMember{ - // { - // Name: to.Ptr("policy2"), - // AttributeType: to.Ptr(armnetwork.VPNPolicyMemberAttributeTypeCertificateGroupID), - // AttributeValue: to.Ptr("red.com"), - // }}, - // Priority: to.Ptr[int32](0), - // ProvisioningState: to.Ptr(armnetwork.ProvisioningStateSucceeded), - // }, - // }}, - // ProvisioningState: to.Ptr("Succeeded"), - // RadiusClientRootCertificates: []*armnetwork.VPNServerConfigRadiusClientRootCertificate{ - // { - // Name: to.Ptr("vpnServerConfigRadiusClientRootCert1"), - // Thumbprint: to.Ptr("83FFBFC8848B5A5836C94D0112367E16148A286F"), - // }}, - // RadiusServerRootCertificates: []*armnetwork.VPNServerConfigRadiusServerRootCertificate{ - // { - // Name: to.Ptr("vpnServerConfigRadiusServerRootCer1"), - // PublicCertData: to.Ptr("MIIC5zCCAc+gAwIBAgIQErQ0Hk4aDJxIA+Q5RagB+jANBgkqhkiG9w0BAQsFADAWMRQwEgYDVQQDDAtQMlNSb290Q2VydDAeFw0xNzEyMTQyMTA3MzhaFw0xODEyMTQyMTI3MzhaMBYxFDASBgNVBAMMC1AyU1Jvb3RDZXJ0MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEArP7/NQXmW7cQ/ZR1mv3Y3I29Lt7HTOqzo/1KUOoVH3NItbQIRAQbwKy3UWrOFz4eGNX2GWtNRMdCyWsKeqy9Ltsdfcm1IbKXkl84DFeU/ZacXu4Dl3xX3gV5du4TLZjEowJELyur11Ea2YcjPRQ/FzAF9/hGuboS1HZQEPLx4FdUs9OxCYOtc0MxBCwLfVTTRqarb0Ne+arNYd4kCzIhAke1nOyKAJBda5ZL+VHy3S5S8qGlD46jm8HXugmAkUygS4oIIXOmj/1O9sNAi3LN60zufSzCmP8Rm/iUGX+DHAGGiXxwZOKQLEDaZXKqoHjMPP0XudmSWwOIbyeQVrLhkwIDAQABozEwLzAOBgNVHQ8BAf8EBAMCAgQwHQYDVR0OBBYEFEfeNU2trYxNLF9ONmuJUsT13pKDMA0GCSqGSIb3DQEBCwUAA4IBAQBmM6RJzsGGipxyMhimHKN2xlkejhVsgBoTAhOU0llW9aUSwINJ9zFUGgI8IzUFy1VG776fchHp0LMRmPSIUYk5btEPxbsrPtumPuMH8EQGrS+Rt4pD+78c8H1fEPkq5CmDl/PKu4JoFGv+aFcE+Od0hlILstIF10Qysf++QXDolKfzJa/56bgMeYKFiju73loiRM57ns8ddXpfLl792UVpRkFU62LNns6Y1LKTwapmUF4IvIuAIzd6LZNOQng64LAKXtKnViJ1JQiXwf4CEzhgvAti3/ejpb3U90hsrUcyZi6wBv9bZLcAJRWpz61JNYliM1d1grSwQDKGXNQE4xuM"), - // }}, - // RadiusServers: []*armnetwork.RadiusServer{ - // { - // RadiusServerAddress: to.Ptr("10.0.0.0"), - // RadiusServerScore: to.Ptr[int64](25), - // }}, - // VPNAuthenticationTypes: []*armnetwork.VPNAuthenticationType{ - // to.Ptr(armnetwork.VPNAuthenticationTypeCertificate)}, - // VPNClientIPSecPolicies: []*armnetwork.IPSecPolicy{ - // { - // DhGroup: to.Ptr(armnetwork.DhGroupDHGroup14), - // IkeEncryption: to.Ptr(armnetwork.IkeEncryptionAES256), - // IkeIntegrity: to.Ptr(armnetwork.IkeIntegritySHA384), - // IPSecEncryption: to.Ptr(armnetwork.IPSecEncryptionAES256), - // IPSecIntegrity: to.Ptr(armnetwork.IPSecIntegritySHA256), - // PfsGroup: to.Ptr(armnetwork.PfsGroupPFS14), - // SaDataSizeKilobytes: to.Ptr[int32](429497), - // SaLifeTimeSeconds: to.Ptr[int32](86472), - // }}, - // VPNClientRevokedCertificates: []*armnetwork.VPNServerConfigVPNClientRevokedCertificate{ - // { - // Name: to.Ptr("vpnServerConfigVpnClientRevokedCert1"), - // Thumbprint: to.Ptr("83FFBFC8848B5A5836C94D0112367E16148A286F"), - // }}, - // VPNClientRootCertificates: []*armnetwork.VPNServerConfigVPNClientRootCertificate{ - // { - // Name: to.Ptr("vpnServerConfigVpnClientRootCert1"), - // PublicCertData: to.Ptr("MIIC5zCCAc+gAwIBAgIQErQ0Hk4aDJxIA+Q5RagB+jANBgkqhkiG9w0BAQsFADAWMRQwEgYDVQQDDAtQMlNSb290Q2VydDAeFw0xNzEyMTQyMTA3MzhaFw0xODEyMTQyMTI3MzhaMBYxFDASBgNVBAMMC1AyU1Jvb3RDZXJ0MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEArP7/NQXmW7cQ/ZR1mv3Y3I29Lt7HTOqzo/1KUOoVH3NItbQIRAQbwKy3UWrOFz4eGNX2GWtNRMdCyWsKeqy9Ltsdfcm1IbKXkl84DFeU/ZacXu4Dl3xX3gV5du4TLZjEowJELyur11Ea2YcjPRQ/FzAF9/hGuboS1HZQEPLx4FdUs9OxCYOtc0MxBCwLfVTTRqarb0Ne+arNYd4kCzIhAke1nOyKAJBda5ZL+VHy3S5S8qGlD46jm8HXugmAkUygS4oIIXOmj/1O9sNAi3LN60zufSzCmP8Rm/iUGX+DHAGGiXxwZOKQLEDaZXKqoHjMPP0XudmSWwOIbyeQVrLhkwIDAQABozEwLzAOBgNVHQ8BAf8EBAMCAgQwHQYDVR0OBBYEFEfeNU2trYxNLF9ONmuJUsT13pKDMA0GCSqGSIb3DQEBCwUAA4IBAQBmM6RJzsGGipxyMhimHKN2xlkejhVsgBoTAhOU0llW9aUSwINJ9zFUGgI8IzUFy1VG776fchHp0LMRmPSIUYk5btEPxbsrPtumPuMH8EQGrS+Rt4pD+78c8H1fEPkq5CmDl/PKu4JoFGv+aFcE+Od0hlILstIF10Qysf++QXDolKfzJa/56bgMeYKFiju73loiRM57ns8ddXpfLl792UVpRkFU62LNns6Y1LKTwapmUF4IvIuAIzd6LZNOQng64LAKXtKnViJ1JQiXwf4CEzhgvAti3/ejpb3U90hsrUcyZi6wBv9bZLcAJRWpz61JNYliM1d1grSwQDKGXNQE4xuN"), - // }}, - // VPNProtocols: []*armnetwork.VPNGatewayTunnelingProtocol{ - // to.Ptr(armnetwork.VPNGatewayTunnelingProtocolIkeV2)}, - // }, - // }}, - // } - } -} diff --git a/sdk/resourcemanager/network/armnetwork/vpnserverconfigurationsassociatedwithvirtualwan_client_example_test.go b/sdk/resourcemanager/network/armnetwork/vpnserverconfigurationsassociatedwithvirtualwan_client_example_test.go deleted file mode 100644 index e7224d016ed3..000000000000 --- a/sdk/resourcemanager/network/armnetwork/vpnserverconfigurationsassociatedwithvirtualwan_client_example_test.go +++ /dev/null @@ -1,47 +0,0 @@ -//go:build go1.18 -// +build go1.18 - -// 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. -// DO NOT EDIT. - -package armnetwork_test - -import ( - "context" - "log" - - "github.com/Azure/azure-sdk-for-go/sdk/azidentity" - "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/network/armnetwork/v6" -) - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/4883fa5dbf6f2c9093fac8ce334547e9dfac68fa/specification/network/resource-manager/Microsoft.Network/stable/2024-03-01/examples/GetVirtualWanVpnServerConfigurations.json -func ExampleVPNServerConfigurationsAssociatedWithVirtualWanClient_BeginList() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armnetwork.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewVPNServerConfigurationsAssociatedWithVirtualWanClient().BeginList(ctx, "rg1", "wan1", nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - res, err := poller.PollUntilDone(ctx, nil) - if err != nil { - log.Fatalf("failed to pull the result: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.VPNServerConfigurationsResponse = armnetwork.VPNServerConfigurationsResponse{ - // VPNServerConfigurationResourceIDs: []*string{ - // to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/vpnServerConfigurations/vpnconfig1"), - // to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/vpnServerConfigurations/vpnconfig2")}, - // } -} diff --git a/sdk/resourcemanager/network/armnetwork/vpnsitelinkconnections_client_example_test.go b/sdk/resourcemanager/network/armnetwork/vpnsitelinkconnections_client_example_test.go deleted file mode 100644 index e8dda87c8f38..000000000000 --- a/sdk/resourcemanager/network/armnetwork/vpnsitelinkconnections_client_example_test.go +++ /dev/null @@ -1,72 +0,0 @@ -//go:build go1.18 -// +build go1.18 - -// 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. -// DO NOT EDIT. - -package armnetwork_test - -import ( - "context" - "log" - - "github.com/Azure/azure-sdk-for-go/sdk/azidentity" - "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/network/armnetwork/v6" -) - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/4883fa5dbf6f2c9093fac8ce334547e9dfac68fa/specification/network/resource-manager/Microsoft.Network/stable/2024-03-01/examples/VpnSiteLinkConnectionGet.json -func ExampleVPNSiteLinkConnectionsClient_Get() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armnetwork.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewVPNSiteLinkConnectionsClient().Get(ctx, "rg1", "gateway1", "vpnConnection1", "Connection-Link1", nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.VPNSiteLinkConnection = armnetwork.VPNSiteLinkConnection{ - // ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/vpnGateways/gateway1/vpnConnections/vpnConnection1/VpnSiteLinkConnections/Connection-Link1"), - // Name: to.Ptr("Connection-Link1"), - // Type: to.Ptr("Microsoft.Network/vpnGateways/vpnConnections/VpnSiteLinkConnections"), - // Etag: to.Ptr("w/\\00000000-0000-0000-0000-000000000000\\"), - // Properties: &armnetwork.VPNSiteLinkConnectionProperties{ - // ConnectionBandwidth: to.Ptr[int32](200), - // DpdTimeoutSeconds: to.Ptr[int32](0), - // EgressBytesTransferred: to.Ptr[int64](0), - // EnableBgp: to.Ptr(false), - // EnableRateLimiting: to.Ptr(false), - // IngressBytesTransferred: to.Ptr[int64](0), - // IPSecPolicies: []*armnetwork.IPSecPolicy{ - // }, - // ProvisioningState: to.Ptr(armnetwork.ProvisioningStateSucceeded), - // RoutingWeight: to.Ptr[int32](0), - // SharedKey: to.Ptr("key"), - // UseLocalAzureIPAddress: to.Ptr(false), - // UsePolicyBasedTrafficSelectors: to.Ptr(false), - // VPNConnectionProtocolType: to.Ptr(armnetwork.VirtualNetworkGatewayConnectionProtocolIKEv2), - // VPNGatewayCustomBgpAddresses: []*armnetwork.GatewayCustomBgpIPAddressIPConfiguration{ - // { - // CustomBgpIPAddress: to.Ptr("169.254.21.1"), - // IPConfigurationID: to.Ptr("Instance0"), - // }, - // { - // CustomBgpIPAddress: to.Ptr("169.254.21.3"), - // IPConfigurationID: to.Ptr("Instance1"), - // }}, - // VPNSiteLink: &armnetwork.SubResource{ - // ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/vpnSites/vpnSite1/vpnSiteLinks/siteLink1"), - // }, - // }, - // } -} diff --git a/sdk/resourcemanager/network/armnetwork/vpnsitelinks_client_example_test.go b/sdk/resourcemanager/network/armnetwork/vpnsitelinks_client_example_test.go deleted file mode 100644 index 8b08026718ed..000000000000 --- a/sdk/resourcemanager/network/armnetwork/vpnsitelinks_client_example_test.go +++ /dev/null @@ -1,117 +0,0 @@ -//go:build go1.18 -// +build go1.18 - -// 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. -// DO NOT EDIT. - -package armnetwork_test - -import ( - "context" - "log" - - "github.com/Azure/azure-sdk-for-go/sdk/azidentity" - "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/network/armnetwork/v6" -) - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/4883fa5dbf6f2c9093fac8ce334547e9dfac68fa/specification/network/resource-manager/Microsoft.Network/stable/2024-03-01/examples/VpnSiteLinkGet.json -func ExampleVPNSiteLinksClient_Get() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armnetwork.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewVPNSiteLinksClient().Get(ctx, "rg1", "vpnSite1", "vpnSiteLink1", nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.VPNSiteLink = armnetwork.VPNSiteLink{ - // ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/vpnSites/vpnSite1/vpnSiteLinks/vpnSiteLink1"), - // Name: to.Ptr("vpnSiteLink1"), - // Type: to.Ptr("Microsoft.Network/vpnSites/vpnSiteLinks"), - // Etag: to.Ptr("W/\"00000000-0000-0000-0000-000000000000\""), - // Properties: &armnetwork.VPNSiteLinkProperties{ - // BgpProperties: &armnetwork.VPNLinkBgpSettings{ - // Asn: to.Ptr[int64](1234), - // BgpPeeringAddress: to.Ptr("192.168.0.0"), - // }, - // IPAddress: to.Ptr("50.50.50.56"), - // LinkProperties: &armnetwork.VPNLinkProviderProperties{ - // LinkSpeedInMbps: to.Ptr[int32](0), - // }, - // ProvisioningState: to.Ptr(armnetwork.ProvisioningStateSucceeded), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/4883fa5dbf6f2c9093fac8ce334547e9dfac68fa/specification/network/resource-manager/Microsoft.Network/stable/2024-03-01/examples/VpnSiteLinkListByVpnSite.json -func ExampleVPNSiteLinksClient_NewListByVPNSitePager() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armnetwork.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := clientFactory.NewVPNSiteLinksClient().NewListByVPNSitePager("rg1", "vpnSite1", nil) - for pager.More() { - page, err := pager.NextPage(ctx) - if err != nil { - log.Fatalf("failed to advance page: %v", err) - } - for _, v := range page.Value { - // You could use page here. We use blank identifier for just demo purposes. - _ = v - } - // If the HTTP response code is 200 as defined in example definition, your page structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // page.ListVPNSiteLinksResult = armnetwork.ListVPNSiteLinksResult{ - // Value: []*armnetwork.VPNSiteLink{ - // { - // ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/vpnSites/vpnSite1/vpnSiteLinks/vpnSiteLink1"), - // Name: to.Ptr("vpnSiteLink1"), - // Type: to.Ptr("Microsoft.Network/vpnSites/vpnSiteLinks"), - // Etag: to.Ptr("W/\"00000000-0000-0000-0000-000000000000\""), - // Properties: &armnetwork.VPNSiteLinkProperties{ - // BgpProperties: &armnetwork.VPNLinkBgpSettings{ - // Asn: to.Ptr[int64](1234), - // BgpPeeringAddress: to.Ptr("192.168.0.0"), - // }, - // IPAddress: to.Ptr("50.50.50.56"), - // LinkProperties: &armnetwork.VPNLinkProviderProperties{ - // LinkSpeedInMbps: to.Ptr[int32](200), - // }, - // ProvisioningState: to.Ptr(armnetwork.ProvisioningStateSucceeded), - // }, - // }, - // { - // ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/vpnSites/vpnSite1/vpnSiteLinks/vpnSiteLink2"), - // Name: to.Ptr("vpnSiteLink2"), - // Type: to.Ptr("Microsoft.Network/vpnSites/vpnSiteLinks"), - // Etag: to.Ptr("W/\"00000000-0000-0000-0000-000000000000\""), - // Properties: &armnetwork.VPNSiteLinkProperties{ - // BgpProperties: &armnetwork.VPNLinkBgpSettings{ - // Asn: to.Ptr[int64](1234), - // BgpPeeringAddress: to.Ptr("192.168.0.1"), - // }, - // IPAddress: to.Ptr("40.40.40.46"), - // LinkProperties: &armnetwork.VPNLinkProviderProperties{ - // LinkSpeedInMbps: to.Ptr[int32](200), - // }, - // ProvisioningState: to.Ptr(armnetwork.ProvisioningStateSucceeded), - // }, - // }}, - // } - } -} diff --git a/sdk/resourcemanager/network/armnetwork/vpnsites_client_example_test.go b/sdk/resourcemanager/network/armnetwork/vpnsites_client_example_test.go deleted file mode 100644 index da877f8282e4..000000000000 --- a/sdk/resourcemanager/network/armnetwork/vpnsites_client_example_test.go +++ /dev/null @@ -1,462 +0,0 @@ -//go:build go1.18 -// +build go1.18 - -// 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. -// DO NOT EDIT. - -package armnetwork_test - -import ( - "context" - "log" - - "github.com/Azure/azure-sdk-for-go/sdk/azcore/to" - "github.com/Azure/azure-sdk-for-go/sdk/azidentity" - "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/network/armnetwork/v6" -) - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/4883fa5dbf6f2c9093fac8ce334547e9dfac68fa/specification/network/resource-manager/Microsoft.Network/stable/2024-03-01/examples/VpnSiteGet.json -func ExampleVPNSitesClient_Get() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armnetwork.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewVPNSitesClient().Get(ctx, "rg1", "vpnSite1", nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.VPNSite = armnetwork.VPNSite{ - // Name: to.Ptr("vpnSite1"), - // Type: to.Ptr("Microsoft.Network/vpnSites"), - // ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/vpnSites/vpnSite1"), - // Location: to.Ptr("West US"), - // Tags: map[string]*string{ - // "key1": to.Ptr("value1"), - // }, - // Etag: to.Ptr("w/\\00000000-0000-0000-0000-000000000000\\"), - // Properties: &armnetwork.VPNSiteProperties{ - // AddressSpace: &armnetwork.AddressSpace{ - // AddressPrefixes: []*string{ - // to.Ptr("10.0.0.0/16")}, - // }, - // DeviceProperties: &armnetwork.DeviceProperties{ - // LinkSpeedInMbps: to.Ptr[int32](0), - // }, - // IsSecuritySite: to.Ptr(false), - // ProvisioningState: to.Ptr(armnetwork.ProvisioningStateSucceeded), - // VirtualWan: &armnetwork.SubResource{ - // ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/virtualWANs/wan1"), - // }, - // VPNSiteLinks: []*armnetwork.VPNSiteLink{ - // { - // ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/vpnSites/vpnSite1/vpnSiteLinks/vpnSiteLink1"), - // Name: to.Ptr("vpnSiteLink1"), - // Type: to.Ptr("Microsoft.Network/vpnSites/vpnSiteLinks"), - // Etag: to.Ptr("W/\"00000000-0000-0000-0000-000000000000\""), - // Properties: &armnetwork.VPNSiteLinkProperties{ - // BgpProperties: &armnetwork.VPNLinkBgpSettings{ - // Asn: to.Ptr[int64](1234), - // BgpPeeringAddress: to.Ptr("192.168.0.0"), - // }, - // IPAddress: to.Ptr("50.50.50.56"), - // LinkProperties: &armnetwork.VPNLinkProviderProperties{ - // LinkProviderName: to.Ptr("vendor1"), - // LinkSpeedInMbps: to.Ptr[int32](0), - // }, - // ProvisioningState: to.Ptr(armnetwork.ProvisioningStateSucceeded), - // }, - // }}, - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/4883fa5dbf6f2c9093fac8ce334547e9dfac68fa/specification/network/resource-manager/Microsoft.Network/stable/2024-03-01/examples/VpnSitePut.json -func ExampleVPNSitesClient_BeginCreateOrUpdate() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armnetwork.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewVPNSitesClient().BeginCreateOrUpdate(ctx, "rg1", "vpnSite1", armnetwork.VPNSite{ - Location: to.Ptr("West US"), - Tags: map[string]*string{ - "key1": to.Ptr("value1"), - }, - Properties: &armnetwork.VPNSiteProperties{ - AddressSpace: &armnetwork.AddressSpace{ - AddressPrefixes: []*string{ - to.Ptr("10.0.0.0/16")}, - }, - IsSecuritySite: to.Ptr(false), - O365Policy: &armnetwork.O365PolicyProperties{ - BreakOutCategories: &armnetwork.O365BreakOutCategoryPolicies{ - Default: to.Ptr(false), - Allow: to.Ptr(true), - Optimize: to.Ptr(true), - }, - }, - VirtualWan: &armnetwork.SubResource{ - ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/virtualWANs/wan1"), - }, - VPNSiteLinks: []*armnetwork.VPNSiteLink{ - { - Name: to.Ptr("vpnSiteLink1"), - Properties: &armnetwork.VPNSiteLinkProperties{ - BgpProperties: &armnetwork.VPNLinkBgpSettings{ - Asn: to.Ptr[int64](1234), - BgpPeeringAddress: to.Ptr("192.168.0.0"), - }, - Fqdn: to.Ptr("link1.vpnsite1.contoso.com"), - IPAddress: to.Ptr("50.50.50.56"), - LinkProperties: &armnetwork.VPNLinkProviderProperties{ - LinkProviderName: to.Ptr("vendor1"), - LinkSpeedInMbps: to.Ptr[int32](0), - }, - }, - }}, - }, - }, nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - res, err := poller.PollUntilDone(ctx, nil) - if err != nil { - log.Fatalf("failed to pull the result: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.VPNSite = armnetwork.VPNSite{ - // Name: to.Ptr("vpnSite1"), - // Type: to.Ptr("Microsoft.Network/vpnSites"), - // ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/vpnSites/vpnSite1"), - // Location: to.Ptr("West US"), - // Tags: map[string]*string{ - // "key1": to.Ptr("value1"), - // }, - // Etag: to.Ptr("w/\\00000000-0000-0000-0000-000000000000\\"), - // Properties: &armnetwork.VPNSiteProperties{ - // AddressSpace: &armnetwork.AddressSpace{ - // AddressPrefixes: []*string{ - // to.Ptr("10.0.0.0/16")}, - // }, - // DeviceProperties: &armnetwork.DeviceProperties{ - // LinkSpeedInMbps: to.Ptr[int32](0), - // }, - // IsSecuritySite: to.Ptr(false), - // ProvisioningState: to.Ptr(armnetwork.ProvisioningStateSucceeded), - // VirtualWan: &armnetwork.SubResource{ - // ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/virtualWANs/wan1"), - // }, - // VPNSiteLinks: []*armnetwork.VPNSiteLink{ - // { - // ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/vpnSites/vpnSite1/vpnSiteLinks/vpnSiteLink1"), - // Name: to.Ptr("vpnSiteLink1"), - // Type: to.Ptr("Microsoft.Network/vpnSites/vpnSiteLinks"), - // Etag: to.Ptr("W/\"00000000-0000-0000-0000-000000000000\""), - // Properties: &armnetwork.VPNSiteLinkProperties{ - // BgpProperties: &armnetwork.VPNLinkBgpSettings{ - // Asn: to.Ptr[int64](1234), - // BgpPeeringAddress: to.Ptr("192.168.0.0"), - // }, - // IPAddress: to.Ptr("50.50.50.56"), - // LinkProperties: &armnetwork.VPNLinkProviderProperties{ - // LinkProviderName: to.Ptr("vendor1"), - // LinkSpeedInMbps: to.Ptr[int32](0), - // }, - // ProvisioningState: to.Ptr(armnetwork.ProvisioningStateSucceeded), - // }, - // }}, - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/4883fa5dbf6f2c9093fac8ce334547e9dfac68fa/specification/network/resource-manager/Microsoft.Network/stable/2024-03-01/examples/VpnSiteUpdateTags.json -func ExampleVPNSitesClient_UpdateTags() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armnetwork.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewVPNSitesClient().UpdateTags(ctx, "rg1", "vpnSite1", armnetwork.TagsObject{ - Tags: map[string]*string{ - "key1": to.Ptr("value1"), - "key2": to.Ptr("value2"), - }, - }, nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.VPNSite = armnetwork.VPNSite{ - // Name: to.Ptr("vpnSite1"), - // Type: to.Ptr("Microsoft.Network/vpnSites"), - // ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/vpnSites/vpnSite1"), - // Location: to.Ptr("West US"), - // Tags: map[string]*string{ - // "key1": to.Ptr("value1"), - // "key2": to.Ptr("value2"), - // }, - // Etag: to.Ptr("w/\\00000000-0000-0000-0000-000000000000\\"), - // Properties: &armnetwork.VPNSiteProperties{ - // AddressSpace: &armnetwork.AddressSpace{ - // AddressPrefixes: []*string{ - // to.Ptr("10.0.0.0/16")}, - // }, - // BgpProperties: &armnetwork.BgpSettings{ - // Asn: to.Ptr[int64](1234), - // BgpPeeringAddress: to.Ptr("192.168.0.0"), - // }, - // DeviceProperties: &armnetwork.DeviceProperties{ - // DeviceModel: to.Ptr("model01"), - // DeviceVendor: to.Ptr("vendor1"), - // LinkSpeedInMbps: to.Ptr[int32](200), - // }, - // IPAddress: to.Ptr("10.0.0.0"), - // ProvisioningState: to.Ptr(armnetwork.ProvisioningStateSucceeded), - // VirtualWan: &armnetwork.SubResource{ - // }, - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/4883fa5dbf6f2c9093fac8ce334547e9dfac68fa/specification/network/resource-manager/Microsoft.Network/stable/2024-03-01/examples/VpnSiteDelete.json -func ExampleVPNSitesClient_BeginDelete() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armnetwork.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewVPNSitesClient().BeginDelete(ctx, "rg1", "vpnSite1", nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - _, err = poller.PollUntilDone(ctx, nil) - if err != nil { - log.Fatalf("failed to pull the result: %v", err) - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/4883fa5dbf6f2c9093fac8ce334547e9dfac68fa/specification/network/resource-manager/Microsoft.Network/stable/2024-03-01/examples/VpnSiteListByResourceGroup.json -func ExampleVPNSitesClient_NewListByResourceGroupPager() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armnetwork.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := clientFactory.NewVPNSitesClient().NewListByResourceGroupPager("rg1", nil) - for pager.More() { - page, err := pager.NextPage(ctx) - if err != nil { - log.Fatalf("failed to advance page: %v", err) - } - for _, v := range page.Value { - // You could use page here. We use blank identifier for just demo purposes. - _ = v - } - // If the HTTP response code is 200 as defined in example definition, your page structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // page.ListVPNSitesResult = armnetwork.ListVPNSitesResult{ - // Value: []*armnetwork.VPNSite{ - // { - // Name: to.Ptr("vpnSite1"), - // Type: to.Ptr("Microsoft.Network/vpnSites"), - // ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/vpnSites/vpnSite1"), - // Location: to.Ptr("West US"), - // Tags: map[string]*string{ - // "key1": to.Ptr("value1"), - // }, - // Etag: to.Ptr("w/\\00000000-0000-0000-0000-000000000000\\"), - // Properties: &armnetwork.VPNSiteProperties{ - // AddressSpace: &armnetwork.AddressSpace{ - // AddressPrefixes: []*string{ - // to.Ptr("10.0.0.0/16")}, - // }, - // DeviceProperties: &armnetwork.DeviceProperties{ - // LinkSpeedInMbps: to.Ptr[int32](0), - // }, - // IsSecuritySite: to.Ptr(false), - // ProvisioningState: to.Ptr(armnetwork.ProvisioningStateSucceeded), - // VirtualWan: &armnetwork.SubResource{ - // ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/virtualWANs/wan1"), - // }, - // VPNSiteLinks: []*armnetwork.VPNSiteLink{ - // { - // ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/vpnSites/vpnSite1/vpnSiteLinks/vpnSiteLink1"), - // Name: to.Ptr("vpnSiteLink1"), - // Type: to.Ptr("Microsoft.Network/vpnSites/vpnSiteLinks"), - // Etag: to.Ptr("W/\"00000000-0000-0000-0000-000000000000\""), - // Properties: &armnetwork.VPNSiteLinkProperties{ - // BgpProperties: &armnetwork.VPNLinkBgpSettings{ - // Asn: to.Ptr[int64](1234), - // BgpPeeringAddress: to.Ptr("192.168.0.0"), - // }, - // IPAddress: to.Ptr("50.50.50.56"), - // LinkProperties: &armnetwork.VPNLinkProviderProperties{ - // LinkSpeedInMbps: to.Ptr[int32](0), - // }, - // ProvisioningState: to.Ptr(armnetwork.ProvisioningStateSucceeded), - // }, - // }}, - // }, - // }, - // { - // Name: to.Ptr("vpnSite2"), - // Type: to.Ptr("Microsoft.Network/vpnSites"), - // ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/vpnSites/vpnSite2"), - // Location: to.Ptr("West US"), - // Tags: map[string]*string{ - // "key1": to.Ptr("value1"), - // }, - // Etag: to.Ptr("w/\\00000000-0000-0000-0000-000000000000\\"), - // Properties: &armnetwork.VPNSiteProperties{ - // AddressSpace: &armnetwork.AddressSpace{ - // AddressPrefixes: []*string{ - // to.Ptr("10.0.0.0/16")}, - // }, - // BgpProperties: &armnetwork.BgpSettings{ - // Asn: to.Ptr[int64](1234), - // BgpPeeringAddress: to.Ptr("192.168.0.0"), - // }, - // DeviceProperties: &armnetwork.DeviceProperties{ - // DeviceModel: to.Ptr("model01"), - // DeviceVendor: to.Ptr("vendor1"), - // LinkSpeedInMbps: to.Ptr[int32](200), - // }, - // IPAddress: to.Ptr("10.1.0.0"), - // ProvisioningState: to.Ptr(armnetwork.ProvisioningStateSucceeded), - // VirtualWan: &armnetwork.SubResource{ - // }, - // }, - // }}, - // } - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/4883fa5dbf6f2c9093fac8ce334547e9dfac68fa/specification/network/resource-manager/Microsoft.Network/stable/2024-03-01/examples/VpnSiteList.json -func ExampleVPNSitesClient_NewListPager() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armnetwork.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := clientFactory.NewVPNSitesClient().NewListPager(nil) - for pager.More() { - page, err := pager.NextPage(ctx) - if err != nil { - log.Fatalf("failed to advance page: %v", err) - } - for _, v := range page.Value { - // You could use page here. We use blank identifier for just demo purposes. - _ = v - } - // If the HTTP response code is 200 as defined in example definition, your page structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // page.ListVPNSitesResult = armnetwork.ListVPNSitesResult{ - // Value: []*armnetwork.VPNSite{ - // { - // Name: to.Ptr("vpnSite1"), - // Type: to.Ptr("Microsoft.Network/vpnSites"), - // ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/vpnSites/vpnSite1"), - // Location: to.Ptr("West US"), - // Tags: map[string]*string{ - // "key1": to.Ptr("value1"), - // }, - // Etag: to.Ptr("w/\\00000000-0000-0000-0000-000000000000\\"), - // Properties: &armnetwork.VPNSiteProperties{ - // AddressSpace: &armnetwork.AddressSpace{ - // AddressPrefixes: []*string{ - // to.Ptr("10.0.0.0/16")}, - // }, - // DeviceProperties: &armnetwork.DeviceProperties{ - // LinkSpeedInMbps: to.Ptr[int32](0), - // }, - // IsSecuritySite: to.Ptr(false), - // ProvisioningState: to.Ptr(armnetwork.ProvisioningStateSucceeded), - // VirtualWan: &armnetwork.SubResource{ - // ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/virtualWANs/wan1"), - // }, - // VPNSiteLinks: []*armnetwork.VPNSiteLink{ - // { - // ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/vpnSites/vpnSite1/vpnSiteLinks/vpnSiteLink1"), - // Name: to.Ptr("vpnSiteLink1"), - // Type: to.Ptr("Microsoft.Network/vpnSites/vpnSiteLinks"), - // Etag: to.Ptr("W/\"00000000-0000-0000-0000-000000000000\""), - // Properties: &armnetwork.VPNSiteLinkProperties{ - // BgpProperties: &armnetwork.VPNLinkBgpSettings{ - // Asn: to.Ptr[int64](1234), - // BgpPeeringAddress: to.Ptr("192.168.0.0"), - // }, - // IPAddress: to.Ptr("50.50.50.56"), - // LinkProperties: &armnetwork.VPNLinkProviderProperties{ - // LinkSpeedInMbps: to.Ptr[int32](0), - // }, - // ProvisioningState: to.Ptr(armnetwork.ProvisioningStateSucceeded), - // }, - // }}, - // }, - // }, - // { - // Name: to.Ptr("vpnSite2"), - // Type: to.Ptr("Microsoft.Network/vpnSites"), - // ID: to.Ptr("/subscriptions/subid/resourceGroups/rg2/providers/Microsoft.Network/vpnSites/vpnSite2"), - // Location: to.Ptr("East US"), - // Tags: map[string]*string{ - // "key1": to.Ptr("value1"), - // }, - // Etag: to.Ptr("w/\\00000000-0000-0000-0000-000000000000\\"), - // Properties: &armnetwork.VPNSiteProperties{ - // AddressSpace: &armnetwork.AddressSpace{ - // AddressPrefixes: []*string{ - // to.Ptr("10.0.0.0/16")}, - // }, - // BgpProperties: &armnetwork.BgpSettings{ - // Asn: to.Ptr[int64](1234), - // BgpPeeringAddress: to.Ptr("192.168.0.0"), - // }, - // DeviceProperties: &armnetwork.DeviceProperties{ - // DeviceModel: to.Ptr("model01"), - // DeviceVendor: to.Ptr("vendor1"), - // LinkSpeedInMbps: to.Ptr[int32](200), - // }, - // IPAddress: to.Ptr("10.1.0.0"), - // IsSecuritySite: to.Ptr(false), - // ProvisioningState: to.Ptr(armnetwork.ProvisioningStateSucceeded), - // VirtualWan: &armnetwork.SubResource{ - // }, - // }, - // }}, - // } - } -} diff --git a/sdk/resourcemanager/network/armnetwork/vpnsitesconfiguration_client_example_test.go b/sdk/resourcemanager/network/armnetwork/vpnsitesconfiguration_client_example_test.go deleted file mode 100644 index 57a899e91a3b..000000000000 --- a/sdk/resourcemanager/network/armnetwork/vpnsitesconfiguration_client_example_test.go +++ /dev/null @@ -1,44 +0,0 @@ -//go:build go1.18 -// +build go1.18 - -// 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. -// DO NOT EDIT. - -package armnetwork_test - -import ( - "context" - "log" - - "github.com/Azure/azure-sdk-for-go/sdk/azcore/to" - "github.com/Azure/azure-sdk-for-go/sdk/azidentity" - "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/network/armnetwork/v6" -) - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/4883fa5dbf6f2c9093fac8ce334547e9dfac68fa/specification/network/resource-manager/Microsoft.Network/stable/2024-03-01/examples/VpnSitesConfigurationDownload.json -func ExampleVPNSitesConfigurationClient_BeginDownload() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armnetwork.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewVPNSitesConfigurationClient().BeginDownload(ctx, "rg1", "wan1", armnetwork.GetVPNSitesConfigurationRequest{ - OutputBlobSasURL: to.Ptr("https://blobcortextesturl.blob.core.windows.net/folderforconfig/vpnFile?sp=rw&se=2018-01-10T03%3A42%3A04Z&sv=2017-04-17&sig=WvXrT5bDmDFfgHs%2Brz%2BjAu123eRCNE9BO0eQYcPDT7pY%3D&sr=b"), - VPNSites: []*string{ - to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/vpnSites/abc")}, - }, nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - _, err = poller.PollUntilDone(ctx, nil) - if err != nil { - log.Fatalf("failed to pull the result: %v", err) - } -} diff --git a/sdk/resourcemanager/network/armnetwork/watchers_client_example_test.go b/sdk/resourcemanager/network/armnetwork/watchers_client_example_test.go deleted file mode 100644 index 3497e31c8df8..000000000000 --- a/sdk/resourcemanager/network/armnetwork/watchers_client_example_test.go +++ /dev/null @@ -1,933 +0,0 @@ -//go:build go1.18 -// +build go1.18 - -// 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. -// DO NOT EDIT. - -package armnetwork_test - -import ( - "context" - "log" - - "time" - - "github.com/Azure/azure-sdk-for-go/sdk/azcore/to" - "github.com/Azure/azure-sdk-for-go/sdk/azidentity" - "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/network/armnetwork/v6" -) - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/4883fa5dbf6f2c9093fac8ce334547e9dfac68fa/specification/network/resource-manager/Microsoft.Network/stable/2024-03-01/examples/NetworkWatcherCreate.json -func ExampleWatchersClient_CreateOrUpdate() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armnetwork.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewWatchersClient().CreateOrUpdate(ctx, "rg1", "nw1", armnetwork.Watcher{ - Location: to.Ptr("eastus"), - Properties: &armnetwork.WatcherPropertiesFormat{}, - }, nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.Watcher = armnetwork.Watcher{ - // Name: to.Ptr("nw1"), - // Type: to.Ptr("Microsoft.Network/networkWatchers"), - // ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/networkWatchers/nw1"), - // Location: to.Ptr("eastus"), - // Tags: map[string]*string{ - // }, - // Etag: to.Ptr("W/\"00000000-0000-0000-0000-000000000000\""), - // Properties: &armnetwork.WatcherPropertiesFormat{ - // ProvisioningState: to.Ptr(armnetwork.ProvisioningStateSucceeded), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/4883fa5dbf6f2c9093fac8ce334547e9dfac68fa/specification/network/resource-manager/Microsoft.Network/stable/2024-03-01/examples/NetworkWatcherGet.json -func ExampleWatchersClient_Get() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armnetwork.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewWatchersClient().Get(ctx, "rg1", "nw1", nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.Watcher = armnetwork.Watcher{ - // Name: to.Ptr("nw1"), - // Type: to.Ptr("Microsoft.Network/networkWatchers"), - // ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/networkWatchers/nw1"), - // Location: to.Ptr("eastus"), - // Tags: map[string]*string{ - // }, - // Etag: to.Ptr("W/\"00000000-0000-0000-0000-000000000000\""), - // Properties: &armnetwork.WatcherPropertiesFormat{ - // ProvisioningState: to.Ptr(armnetwork.ProvisioningStateSucceeded), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/4883fa5dbf6f2c9093fac8ce334547e9dfac68fa/specification/network/resource-manager/Microsoft.Network/stable/2024-03-01/examples/NetworkWatcherDelete.json -func ExampleWatchersClient_BeginDelete() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armnetwork.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewWatchersClient().BeginDelete(ctx, "rg1", "nw1", nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - _, err = poller.PollUntilDone(ctx, nil) - if err != nil { - log.Fatalf("failed to pull the result: %v", err) - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/4883fa5dbf6f2c9093fac8ce334547e9dfac68fa/specification/network/resource-manager/Microsoft.Network/stable/2024-03-01/examples/NetworkWatcherUpdateTags.json -func ExampleWatchersClient_UpdateTags() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armnetwork.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewWatchersClient().UpdateTags(ctx, "rg1", "nw1", armnetwork.TagsObject{ - Tags: map[string]*string{ - "tag1": to.Ptr("value1"), - "tag2": to.Ptr("value2"), - }, - }, nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.Watcher = armnetwork.Watcher{ - // Name: to.Ptr("nw1"), - // Type: to.Ptr("Microsoft.Network/networkWatchers"), - // ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/networkWatchers/nw1"), - // Location: to.Ptr("eastus"), - // Tags: map[string]*string{ - // "tag1": to.Ptr("value1"), - // "tag2": to.Ptr("value2"), - // }, - // Etag: to.Ptr("W/\"00000000-0000-0000-0000-000000000000\""), - // Properties: &armnetwork.WatcherPropertiesFormat{ - // ProvisioningState: to.Ptr(armnetwork.ProvisioningStateSucceeded), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/4883fa5dbf6f2c9093fac8ce334547e9dfac68fa/specification/network/resource-manager/Microsoft.Network/stable/2024-03-01/examples/NetworkWatcherList.json -func ExampleWatchersClient_NewListPager() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armnetwork.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := clientFactory.NewWatchersClient().NewListPager("rg1", nil) - for pager.More() { - page, err := pager.NextPage(ctx) - if err != nil { - log.Fatalf("failed to advance page: %v", err) - } - for _, v := range page.Value { - // You could use page here. We use blank identifier for just demo purposes. - _ = v - } - // If the HTTP response code is 200 as defined in example definition, your page structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // page.WatcherListResult = armnetwork.WatcherListResult{ - // Value: []*armnetwork.Watcher{ - // { - // Name: to.Ptr("nw1"), - // Type: to.Ptr("Microsoft.Network/networkWatchers"), - // ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/networkWatchers/nw1"), - // Location: to.Ptr("eastus"), - // Tags: map[string]*string{ - // }, - // Etag: to.Ptr("W/\"00000000-0000-0000-0000-000000000000\""), - // Properties: &armnetwork.WatcherPropertiesFormat{ - // ProvisioningState: to.Ptr(armnetwork.ProvisioningStateSucceeded), - // }, - // }, - // { - // Name: to.Ptr("nw2"), - // Type: to.Ptr("Microsoft.Network/networkWatchers"), - // ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/networkWatchers/nw2"), - // Location: to.Ptr("eastus"), - // Tags: map[string]*string{ - // }, - // Etag: to.Ptr("W/\"00000000-0000-0000-0000-000000000000\""), - // Properties: &armnetwork.WatcherPropertiesFormat{ - // ProvisioningState: to.Ptr(armnetwork.ProvisioningStateSucceeded), - // }, - // }}, - // } - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/4883fa5dbf6f2c9093fac8ce334547e9dfac68fa/specification/network/resource-manager/Microsoft.Network/stable/2024-03-01/examples/NetworkWatcherListAll.json -func ExampleWatchersClient_NewListAllPager() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armnetwork.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := clientFactory.NewWatchersClient().NewListAllPager(nil) - for pager.More() { - page, err := pager.NextPage(ctx) - if err != nil { - log.Fatalf("failed to advance page: %v", err) - } - for _, v := range page.Value { - // You could use page here. We use blank identifier for just demo purposes. - _ = v - } - // If the HTTP response code is 200 as defined in example definition, your page structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // page.WatcherListResult = armnetwork.WatcherListResult{ - // Value: []*armnetwork.Watcher{ - // { - // Name: to.Ptr("nw1"), - // Type: to.Ptr("Microsoft.Network/networkWatchers"), - // ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/networkWatchers/nw1"), - // Location: to.Ptr("eastus"), - // Tags: map[string]*string{ - // }, - // Etag: to.Ptr("W/\"00000000-0000-0000-0000-000000000000\""), - // Properties: &armnetwork.WatcherPropertiesFormat{ - // ProvisioningState: to.Ptr(armnetwork.ProvisioningStateSucceeded), - // }, - // }, - // { - // Name: to.Ptr("nw2"), - // Type: to.Ptr("Microsoft.Network/networkWatchers"), - // ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/networkWatchers/nw2"), - // Location: to.Ptr("westus"), - // Tags: map[string]*string{ - // }, - // Etag: to.Ptr("W/\"00000000-0000-0000-0000-000000000000\""), - // Properties: &armnetwork.WatcherPropertiesFormat{ - // ProvisioningState: to.Ptr(armnetwork.ProvisioningStateSucceeded), - // }, - // }}, - // } - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/4883fa5dbf6f2c9093fac8ce334547e9dfac68fa/specification/network/resource-manager/Microsoft.Network/stable/2024-03-01/examples/NetworkWatcherTopologyGet.json -func ExampleWatchersClient_GetTopology() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armnetwork.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewWatchersClient().GetTopology(ctx, "rg1", "nw1", armnetwork.TopologyParameters{ - TargetResourceGroupName: to.Ptr("rg2"), - }, nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.Topology = armnetwork.Topology{ - // CreatedDateTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2017-08-02T19:31:55.946Z"); return t}()), - // ID: to.Ptr("ce592f46-8164-4bf2-ad36-b8e4acf6fb68"), - // LastModified: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2017-05-27T00:00:13.200Z"); return t}()), - // Resources: []*armnetwork.TopologyResource{ - // { - // Name: to.Ptr("MultiTierApp0"), - // Associations: []*armnetwork.TopologyAssociation{ - // { - // Name: to.Ptr("appNic0"), - // AssociationType: to.Ptr(armnetwork.AssociationTypeContains), - // ResourceID: to.Ptr("/subscriptions/subid/resourceGroups/rg2/providers/Microsoft.Network/networkInterfaces/appNic0"), - // }, - // { - // Name: to.Ptr("appNic10"), - // AssociationType: to.Ptr(armnetwork.AssociationTypeContains), - // ResourceID: to.Ptr("/subscriptions/subid/resourceGroups/rg2/providers/Microsoft.Network/networkInterfaces/appNic10"), - // }}, - // ID: to.Ptr("/subscriptions/subid/resourceGroups/rg2/providers/Microsoft.Compute/virtualMachines/MultiTierApp0"), - // Location: to.Ptr("westus"), - // }}, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/4883fa5dbf6f2c9093fac8ce334547e9dfac68fa/specification/network/resource-manager/Microsoft.Network/stable/2024-03-01/examples/NetworkWatcherIpFlowVerify.json -func ExampleWatchersClient_BeginVerifyIPFlow() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armnetwork.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewWatchersClient().BeginVerifyIPFlow(ctx, "rg1", "nw1", armnetwork.VerificationIPFlowParameters{ - Direction: to.Ptr(armnetwork.DirectionOutbound), - LocalIPAddress: to.Ptr("10.2.0.4"), - LocalPort: to.Ptr("80"), - RemoteIPAddress: to.Ptr("121.10.1.1"), - RemotePort: to.Ptr("80"), - TargetResourceID: to.Ptr("/subscriptions/subid/resourceGroups/rg2/providers/Microsoft.Compute/virtualMachines/vm1"), - Protocol: to.Ptr(armnetwork.IPFlowProtocolTCP), - }, nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - res, err := poller.PollUntilDone(ctx, nil) - if err != nil { - log.Fatalf("failed to pull the result: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.VerificationIPFlowResult = armnetwork.VerificationIPFlowResult{ - // Access: to.Ptr(armnetwork.AccessAllow), - // RuleName: to.Ptr("Rule1"), - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/4883fa5dbf6f2c9093fac8ce334547e9dfac68fa/specification/network/resource-manager/Microsoft.Network/stable/2024-03-01/examples/NetworkWatcherNextHopGet.json -func ExampleWatchersClient_BeginGetNextHop() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armnetwork.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewWatchersClient().BeginGetNextHop(ctx, "rg1", "nw1", armnetwork.NextHopParameters{ - DestinationIPAddress: to.Ptr("10.0.0.10"), - SourceIPAddress: to.Ptr("10.0.0.5"), - TargetNicResourceID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/networkInterfaces/nic1"), - TargetResourceID: to.Ptr("/subscriptions/subid/resourceGroups/rg2/providers/Microsoft.Compute/virtualMachines/vm1"), - }, nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - res, err := poller.PollUntilDone(ctx, nil) - if err != nil { - log.Fatalf("failed to pull the result: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.NextHopResult = armnetwork.NextHopResult{ - // NextHopIPAddress: to.Ptr("10.0.0.1"), - // NextHopType: to.Ptr(armnetwork.NextHopTypeVnetLocal), - // RouteTableID: to.Ptr("/subscriptions/subid/resourceGroups/rg2/providers/Microsoft.Network/routeTables/rt1"), - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/4883fa5dbf6f2c9093fac8ce334547e9dfac68fa/specification/network/resource-manager/Microsoft.Network/stable/2024-03-01/examples/NetworkWatcherSecurityGroupViewGet.json -func ExampleWatchersClient_BeginGetVMSecurityRules() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armnetwork.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewWatchersClient().BeginGetVMSecurityRules(ctx, "rg1", "nw1", armnetwork.SecurityGroupViewParameters{ - TargetResourceID: to.Ptr("/subscriptions/subid/resourceGroups/rg2/providers/Microsoft.Compute/virtualMachines/vm1"), - }, nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - res, err := poller.PollUntilDone(ctx, nil) - if err != nil { - log.Fatalf("failed to pull the result: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.SecurityGroupViewResult = armnetwork.SecurityGroupViewResult{ - // NetworkInterfaces: []*armnetwork.SecurityGroupNetworkInterface{ - // { - // ID: to.Ptr("/subscriptions/subid/resourceGroups/rg2/providers/Microsoft.Network/networkInterfaces/nic1"), - // SecurityRuleAssociations: &armnetwork.SecurityRuleAssociations{ - // DefaultSecurityRules: []*armnetwork.SecurityRule{ - // { - // ID: to.Ptr("/subscriptions//resourceGroups//providers/Microsoft.Network/networkSecurityGroups//defaultSecurityRules/"), - // Name: to.Ptr("AllowVnetInBound"), - // Properties: &armnetwork.SecurityRulePropertiesFormat{ - // Description: to.Ptr("Allow inbound traffic from all VMs in VNET"), - // Access: to.Ptr(armnetwork.SecurityRuleAccessAllow), - // DestinationAddressPrefix: to.Ptr("VirtualNetwork"), - // DestinationPortRange: to.Ptr("*"), - // Direction: to.Ptr(armnetwork.SecurityRuleDirectionInbound), - // Priority: to.Ptr[int32](65000), - // ProvisioningState: to.Ptr(armnetwork.ProvisioningStateSucceeded), - // SourceAddressPrefix: to.Ptr("VirtualNetwork"), - // SourcePortRange: to.Ptr("*"), - // Protocol: to.Ptr(armnetwork.SecurityRuleProtocolAsterisk), - // }, - // }}, - // EffectiveSecurityRules: []*armnetwork.EffectiveNetworkSecurityRule{ - // { - // Name: to.Ptr("DefaultOutboundDenyAll"), - // Access: to.Ptr(armnetwork.SecurityRuleAccessDeny), - // DestinationAddressPrefix: to.Ptr("*"), - // DestinationPortRange: to.Ptr("0-65535"), - // Direction: to.Ptr(armnetwork.SecurityRuleDirectionOutbound), - // Priority: to.Ptr[int32](65500), - // SourceAddressPrefix: to.Ptr("*"), - // SourcePortRange: to.Ptr("0-65535"), - // Protocol: to.Ptr(armnetwork.EffectiveSecurityRuleProtocolAll), - // }}, - // SubnetAssociation: &armnetwork.SubnetAssociation{ - // ID: to.Ptr("/subscriptions/subid/resourceGroups/rg2/providers/Microsoft.Network/virtualNetworks/vnet1/subnets/subnet1"), - // SecurityRules: []*armnetwork.SecurityRule{ - // { - // ID: to.Ptr("/subscriptions/subid/resourceGroups/rg2/providers/Microsoft.Network/networkSecurityGroups/AppNSG/securityRules/fe_rule"), - // Name: to.Ptr("fe_rule"), - // Etag: to.Ptr("W/\"00000000-0000-0000-0000-000000000000\""), - // Properties: &armnetwork.SecurityRulePropertiesFormat{ - // Description: to.Ptr("Allow Frontend"), - // Access: to.Ptr(armnetwork.SecurityRuleAccessAllow), - // DestinationAddressPrefix: to.Ptr("*"), - // DestinationPortRange: to.Ptr("*"), - // Direction: to.Ptr(armnetwork.SecurityRuleDirectionInbound), - // Priority: to.Ptr[int32](100), - // ProvisioningState: to.Ptr(armnetwork.ProvisioningStateSucceeded), - // SourceAddressPrefix: to.Ptr("10.1.0.0/24"), - // SourcePortRange: to.Ptr("*"), - // Protocol: to.Ptr(armnetwork.SecurityRuleProtocolTCP), - // }, - // }}, - // }, - // }, - // }}, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/4883fa5dbf6f2c9093fac8ce334547e9dfac68fa/specification/network/resource-manager/Microsoft.Network/stable/2024-03-01/examples/NetworkWatcherTroubleshootGet.json -func ExampleWatchersClient_BeginGetTroubleshooting() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armnetwork.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewWatchersClient().BeginGetTroubleshooting(ctx, "rg1", "nw1", armnetwork.TroubleshootingParameters{ - Properties: &armnetwork.TroubleshootingProperties{ - StorageID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Storage/storageAccounts/st1"), - StoragePath: to.Ptr("https://st1.blob.core.windows.net/cn1"), - }, - TargetResourceID: to.Ptr("/subscriptions/subid/resourceGroups/rg2/providers/Microsoft.Compute/virtualMachines/vm1"), - }, nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - res, err := poller.PollUntilDone(ctx, nil) - if err != nil { - log.Fatalf("failed to pull the result: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.TroubleshootingResult = armnetwork.TroubleshootingResult{ - // Code: to.Ptr("UnHealthy"), - // EndTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2017-01-12T00:20:09.914Z"); return t}()), - // Results: []*armnetwork.TroubleshootingDetails{ - // { - // Detail: to.Ptr("During this time S2S VPN tunnels to on premises sites or other Azure virtual networks will be disconnected"), - // ID: to.Ptr("000000"), - // ReasonType: to.Ptr("VipUnResponsive"), - // RecommendedActions: []*armnetwork.TroubleshootingRecommendedActions{ - // { - // ActionText: to.Ptr("Verify if there is a network security group (NSG) applied to the GatewaySubnet"), - // ActionURI: to.Ptr("https://docs.microsoft.com/en-us/azure/virtual-network/virtual-networks-create-nsg-arm-pportal"), - // ActionURIText: to.Ptr("Verify"), - // }, - // { - // ActionText: to.Ptr("If your VPN gateway isn't up and running by the expected resolution time, contact support"), - // ActionURI: to.Ptr("http://azure.microsoft.com/support"), - // ActionURIText: to.Ptr("contact support"), - // }}, - // Summary: to.Ptr("We are sorry, your VPN gateway is unreachable from the Internet"), - // }}, - // StartTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2017-01-12T00:19:47.044Z"); return t}()), - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/4883fa5dbf6f2c9093fac8ce334547e9dfac68fa/specification/network/resource-manager/Microsoft.Network/stable/2024-03-01/examples/NetworkWatcherTroubleshootResultQuery.json -func ExampleWatchersClient_BeginGetTroubleshootingResult() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armnetwork.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewWatchersClient().BeginGetTroubleshootingResult(ctx, "rg1", "nw1", armnetwork.QueryTroubleshootingParameters{ - TargetResourceID: to.Ptr("/subscriptions/subid/resourceGroups/rg2/providers/Microsoft.Compute/virtualMachines/vm1"), - }, nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - res, err := poller.PollUntilDone(ctx, nil) - if err != nil { - log.Fatalf("failed to pull the result: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.TroubleshootingResult = armnetwork.TroubleshootingResult{ - // Code: to.Ptr("UnHealthy"), - // EndTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2017-01-12T00:20:09.914Z"); return t}()), - // Results: []*armnetwork.TroubleshootingDetails{ - // { - // Detail: to.Ptr("During this time S2S VPN tunnels to on premises sites or other Azure virtual networks will be disconnected"), - // ID: to.Ptr("000000"), - // ReasonType: to.Ptr("VipUnResponsive"), - // RecommendedActions: []*armnetwork.TroubleshootingRecommendedActions{ - // { - // ActionText: to.Ptr("Verify if there is a network security group (NSG) applied to the GatewaySubnet"), - // ActionURI: to.Ptr("https://docs.microsoft.com/en-us/azure/virtual-network/virtual-networks-create-nsg-arm-pportal"), - // ActionURIText: to.Ptr("Verify"), - // }, - // { - // ActionText: to.Ptr("If your VPN gateway isn't up and running by the expected resolution time, contact support"), - // ActionURI: to.Ptr("http://azure.microsoft.com/support"), - // ActionURIText: to.Ptr("contact support"), - // }}, - // Summary: to.Ptr("We are sorry, your VPN gateway is unreachable from the Internet"), - // }}, - // StartTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2017-01-12T00:19:47.044Z"); return t}()), - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/4883fa5dbf6f2c9093fac8ce334547e9dfac68fa/specification/network/resource-manager/Microsoft.Network/stable/2024-03-01/examples/NetworkWatcherFlowLogConfigure.json -func ExampleWatchersClient_BeginSetFlowLogConfiguration() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armnetwork.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewWatchersClient().BeginSetFlowLogConfiguration(ctx, "rg1", "nw1", armnetwork.FlowLogInformation{ - Identity: &armnetwork.ManagedServiceIdentity{ - Type: to.Ptr(armnetwork.ResourceIdentityTypeUserAssigned), - UserAssignedIdentities: map[string]*armnetwork.Components1Jq1T4ISchemasManagedserviceidentityPropertiesUserassignedidentitiesAdditionalproperties{ - "/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.ManagedIdentity/userAssignedIdentities/id1": {}, - }, - }, - Properties: &armnetwork.FlowLogProperties{ - Enabled: to.Ptr(true), - StorageID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Storage/storageAccounts/st1"), - }, - TargetResourceID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/networkSecurityGroups/nsg1"), - }, nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - res, err := poller.PollUntilDone(ctx, nil) - if err != nil { - log.Fatalf("failed to pull the result: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.FlowLogInformation = armnetwork.FlowLogInformation{ - // Identity: &armnetwork.ManagedServiceIdentity{ - // Type: to.Ptr(armnetwork.ResourceIdentityTypeUserAssigned), - // UserAssignedIdentities: map[string]*armnetwork.Components1Jq1T4ISchemasManagedserviceidentityPropertiesUserassignedidentitiesAdditionalproperties{ - // "/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.ManagedIdentity/userAssignedIdentities/id1": &armnetwork.Components1Jq1T4ISchemasManagedserviceidentityPropertiesUserassignedidentitiesAdditionalproperties{ - // ClientID: to.Ptr("c16d15e1-f60a-40e4-8a05-df3d3f655c14"), - // PrincipalID: to.Ptr("e3858881-e40c-43bd-9cde-88da39c05023"), - // }, - // }, - // }, - // Properties: &armnetwork.FlowLogProperties{ - // Enabled: to.Ptr(true), - // StorageID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Storage/storageAccounts/st1"), - // }, - // TargetResourceID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/networkSecurityGroups/nsg1"), - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/4883fa5dbf6f2c9093fac8ce334547e9dfac68fa/specification/network/resource-manager/Microsoft.Network/stable/2024-03-01/examples/NetworkWatcherFlowLogStatusQuery.json -func ExampleWatchersClient_BeginGetFlowLogStatus() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armnetwork.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewWatchersClient().BeginGetFlowLogStatus(ctx, "rg1", "nw1", armnetwork.FlowLogStatusParameters{ - TargetResourceID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/networkSecurityGroups/nsg1"), - }, nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - res, err := poller.PollUntilDone(ctx, nil) - if err != nil { - log.Fatalf("failed to pull the result: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.FlowLogInformation = armnetwork.FlowLogInformation{ - // Identity: &armnetwork.ManagedServiceIdentity{ - // Type: to.Ptr(armnetwork.ResourceIdentityTypeUserAssigned), - // UserAssignedIdentities: map[string]*armnetwork.Components1Jq1T4ISchemasManagedserviceidentityPropertiesUserassignedidentitiesAdditionalproperties{ - // "/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.ManagedIdentity/userAssignedIdentities/id1": &armnetwork.Components1Jq1T4ISchemasManagedserviceidentityPropertiesUserassignedidentitiesAdditionalproperties{ - // ClientID: to.Ptr("c16d15e1-f60a-40e4-8a05-df3d3f655c14"), - // PrincipalID: to.Ptr("e3858881-e40c-43bd-9cde-88da39c05023"), - // }, - // }, - // }, - // Properties: &armnetwork.FlowLogProperties{ - // Enabled: to.Ptr(true), - // StorageID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Storage/storageAccounts/st1"), - // }, - // TargetResourceID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/networkSecurityGroups/nsg1"), - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/4883fa5dbf6f2c9093fac8ce334547e9dfac68fa/specification/network/resource-manager/Microsoft.Network/stable/2024-03-01/examples/NetworkWatcherConnectivityCheck.json -func ExampleWatchersClient_BeginCheckConnectivity() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armnetwork.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewWatchersClient().BeginCheckConnectivity(ctx, "rg1", "nw1", armnetwork.ConnectivityParameters{ - Destination: &armnetwork.ConnectivityDestination{ - Address: to.Ptr("192.168.100.4"), - Port: to.Ptr[int32](3389), - }, - PreferredIPVersion: to.Ptr(armnetwork.IPVersionIPv4), - Source: &armnetwork.ConnectivitySource{ - ResourceID: to.Ptr("/subscriptions/subid/resourceGroups/rg2/providers/Microsoft.Compute/virtualMachines/vm1"), - }, - }, nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - res, err := poller.PollUntilDone(ctx, nil) - if err != nil { - log.Fatalf("failed to pull the result: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.ConnectivityInformation = armnetwork.ConnectivityInformation{ - // AvgLatencyInMs: to.Ptr[int32](1), - // ConnectionStatus: to.Ptr(armnetwork.ConnectionStatusConnected), - // Hops: []*armnetwork.ConnectivityHop{ - // { - // Type: to.Ptr("Source"), - // Address: to.Ptr("10.1.1.4"), - // ID: to.Ptr("7dbbe7aa-60ba-4650-831e-63d775d38e9e"), - // Issues: []*armnetwork.ConnectivityIssue{ - // }, - // NextHopIDs: []*string{ - // to.Ptr("75c8d819-b208-4584-a311-1aa45ce753f9")}, - // ResourceID: to.Ptr("subscriptions/subid/resourceGroups/rg2/providers/Microsoft.Network/networkInterfaces/nic0/ipConfigurations/ipconfig1"), - // }, - // { - // Type: to.Ptr("VirtualNetwork"), - // Address: to.Ptr("192.168.100.4"), - // ID: to.Ptr("75c8d819-b208-4584-a311-1aa45ce753f9"), - // Issues: []*armnetwork.ConnectivityIssue{ - // }, - // NextHopIDs: []*string{ - // }, - // ResourceID: to.Ptr("subscriptions/subid/resourceGroups/rg2/providers/Microsoft.Network/networkInterfaces/nic1/ipConfigurations/ipconfig1"), - // }}, - // MaxLatencyInMs: to.Ptr[int32](4), - // MinLatencyInMs: to.Ptr[int32](1), - // ProbesFailed: to.Ptr[int32](0), - // ProbesSent: to.Ptr[int32](100), - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/4883fa5dbf6f2c9093fac8ce334547e9dfac68fa/specification/network/resource-manager/Microsoft.Network/stable/2024-03-01/examples/NetworkWatcherAzureReachabilityReportGet.json -func ExampleWatchersClient_BeginGetAzureReachabilityReport() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armnetwork.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewWatchersClient().BeginGetAzureReachabilityReport(ctx, "rg1", "nw1", armnetwork.AzureReachabilityReportParameters{ - AzureLocations: []*string{ - to.Ptr("West US")}, - EndTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2017-09-10T00:00:00.000Z"); return t }()), - ProviderLocation: &armnetwork.AzureReachabilityReportLocation{ - Country: to.Ptr("United States"), - State: to.Ptr("washington"), - }, - Providers: []*string{ - to.Ptr("Frontier Communications of America, Inc. - ASN 5650")}, - StartTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2017-09-07T00:00:00.000Z"); return t }()), - }, nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - res, err := poller.PollUntilDone(ctx, nil) - if err != nil { - log.Fatalf("failed to pull the result: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.AzureReachabilityReport = armnetwork.AzureReachabilityReport{ - // AggregationLevel: to.Ptr("State"), - // ProviderLocation: &armnetwork.AzureReachabilityReportLocation{ - // Country: to.Ptr("United States"), - // State: to.Ptr("washington"), - // }, - // ReachabilityReport: []*armnetwork.AzureReachabilityReportItem{ - // { - // AzureLocation: to.Ptr("West US"), - // Latencies: []*armnetwork.AzureReachabilityReportLatencyInfo{ - // { - // Score: to.Ptr[int32](94), - // TimeStamp: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2017-09-07T00:00:00.000Z"); return t}()), - // }, - // { - // Score: to.Ptr[int32](94), - // TimeStamp: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2017-09-08T00:00:00.000Z"); return t}()), - // }, - // { - // Score: to.Ptr[int32](94), - // TimeStamp: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2017-09-09T00:00:00.000Z"); return t}()), - // }}, - // Provider: to.Ptr("Frontier Communications of America, Inc. - ASN 5650"), - // }}, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/4883fa5dbf6f2c9093fac8ce334547e9dfac68fa/specification/network/resource-manager/Microsoft.Network/stable/2024-03-01/examples/NetworkWatcherAvailableProvidersListGet.json -func ExampleWatchersClient_BeginListAvailableProviders() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armnetwork.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewWatchersClient().BeginListAvailableProviders(ctx, "rg1", "nw1", armnetwork.AvailableProvidersListParameters{ - AzureLocations: []*string{ - to.Ptr("West US")}, - City: to.Ptr("seattle"), - Country: to.Ptr("United States"), - State: to.Ptr("washington"), - }, nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - res, err := poller.PollUntilDone(ctx, nil) - if err != nil { - log.Fatalf("failed to pull the result: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.AvailableProvidersList = armnetwork.AvailableProvidersList{ - // Countries: []*armnetwork.AvailableProvidersListCountry{ - // { - // CountryName: to.Ptr("United States"), - // States: []*armnetwork.AvailableProvidersListState{ - // { - // Cities: []*armnetwork.AvailableProvidersListCity{ - // { - // CityName: to.Ptr("seattle"), - // Providers: []*string{ - // to.Ptr("Comcast Cable Communications, Inc. - ASN 7922"), - // to.Ptr("Comcast Cable Communications, LLC - ASN 7922"), - // to.Ptr("Level 3 Communications, Inc. (GBLX) - ASN 3549"), - // to.Ptr("Qwest Communications Company, LLC - ASN 209")}, - // }}, - // StateName: to.Ptr("washington"), - // }}, - // }}, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/4883fa5dbf6f2c9093fac8ce334547e9dfac68fa/specification/network/resource-manager/Microsoft.Network/stable/2024-03-01/examples/NetworkWatcherNetworkConfigurationDiagnostic.json -func ExampleWatchersClient_BeginGetNetworkConfigurationDiagnostic() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armnetwork.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewWatchersClient().BeginGetNetworkConfigurationDiagnostic(ctx, "rg1", "nw1", armnetwork.ConfigurationDiagnosticParameters{ - Profiles: []*armnetwork.ConfigurationDiagnosticProfile{ - { - Destination: to.Ptr("12.11.12.14"), - DestinationPort: to.Ptr("12100"), - Direction: to.Ptr(armnetwork.DirectionInbound), - Source: to.Ptr("10.1.0.4"), - Protocol: to.Ptr("TCP"), - }}, - TargetResourceID: to.Ptr("/subscriptions/subid/resourceGroups/rg2/providers/Microsoft.Compute/virtualMachines/vm1"), - }, nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - res, err := poller.PollUntilDone(ctx, nil) - if err != nil { - log.Fatalf("failed to pull the result: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.ConfigurationDiagnosticResponse = armnetwork.ConfigurationDiagnosticResponse{ - // Results: []*armnetwork.ConfigurationDiagnosticResult{ - // { - // NetworkSecurityGroupResult: &armnetwork.SecurityGroupResult{ - // EvaluatedNetworkSecurityGroups: []*armnetwork.EvaluatedNetworkSecurityGroup{ - // { - // AppliedTo: to.Ptr("/subscriptions/subid/resourceGroups/rg2/providers/Microsoft.Network/virtualNetworks/vnet/subnets/AppSubnet"), - // MatchedRule: &armnetwork.MatchedRule{ - // Action: to.Ptr("Allow"), - // RuleName: to.Ptr("UserRule_fe_rule"), - // }, - // NetworkSecurityGroupID: to.Ptr("/subscriptions/subid/resourceGroups/rg2/providers/Microsoft.Network/networkSecurityGroups/nsg1"), - // RulesEvaluationResult: []*armnetwork.SecurityRulesEvaluationResult{ - // { - // Name: to.Ptr("UserRule_Cleanuptool-Allow-100"), - // DestinationMatched: to.Ptr(true), - // DestinationPortMatched: to.Ptr(false), - // ProtocolMatched: to.Ptr(true), - // SourceMatched: to.Ptr(false), - // SourcePortMatched: to.Ptr(true), - // }, - // { - // Name: to.Ptr("UserRule_Cleanuptool-Allow-101"), - // DestinationMatched: to.Ptr(true), - // DestinationPortMatched: to.Ptr(false), - // ProtocolMatched: to.Ptr(true), - // SourceMatched: to.Ptr(true), - // SourcePortMatched: to.Ptr(true), - // }, - // { - // Name: to.Ptr("UserRule_Cleanuptool-Allow-102"), - // DestinationMatched: to.Ptr(true), - // DestinationPortMatched: to.Ptr(false), - // ProtocolMatched: to.Ptr(true), - // SourceMatched: to.Ptr(false), - // SourcePortMatched: to.Ptr(true), - // }, - // { - // Name: to.Ptr("UserRule_Cleanuptool-Deny-103"), - // DestinationMatched: to.Ptr(true), - // DestinationPortMatched: to.Ptr(false), - // ProtocolMatched: to.Ptr(true), - // SourceMatched: to.Ptr(true), - // SourcePortMatched: to.Ptr(true), - // }, - // { - // Name: to.Ptr("UserRule_fe_rule"), - // DestinationMatched: to.Ptr(true), - // DestinationPortMatched: to.Ptr(true), - // ProtocolMatched: to.Ptr(true), - // SourceMatched: to.Ptr(true), - // SourcePortMatched: to.Ptr(true), - // }}, - // }, - // { - // AppliedTo: to.Ptr("/subscriptions/subid/resourceGroups/rg2/providers/Microsoft.Network/virtualNetworks/vnet/networkInterfaces/nic"), - // MatchedRule: &armnetwork.MatchedRule{ - // Action: to.Ptr("Allow"), - // RuleName: to.Ptr("UserRule_fe_rule"), - // }, - // NetworkSecurityGroupID: to.Ptr("/subscriptions/61cc8a98-a8be-4bfe-a04e-0b461f93fe35/resourceGroups/NwRgCentralUSEUAP_copy/providers/Microsoft.Network/networkSecurityGroups/AppNSG"), - // RulesEvaluationResult: []*armnetwork.SecurityRulesEvaluationResult{ - // { - // Name: to.Ptr("UserRule_fe_rule"), - // DestinationMatched: to.Ptr(true), - // DestinationPortMatched: to.Ptr(true), - // ProtocolMatched: to.Ptr(true), - // SourceMatched: to.Ptr(true), - // SourcePortMatched: to.Ptr(true), - // }}, - // }}, - // SecurityRuleAccessResult: to.Ptr(armnetwork.SecurityRuleAccessAllow), - // }, - // Profile: &armnetwork.ConfigurationDiagnosticProfile{ - // Destination: to.Ptr("12.11.12.14"), - // DestinationPort: to.Ptr("12100"), - // Direction: to.Ptr(armnetwork.DirectionInbound), - // Source: to.Ptr("10.1.0.4"), - // Protocol: to.Ptr("TCP"), - // }, - // }}, - // } -} diff --git a/sdk/resourcemanager/network/armnetwork/webapplicationfirewallpolicies_client_example_test.go b/sdk/resourcemanager/network/armnetwork/webapplicationfirewallpolicies_client_example_test.go deleted file mode 100644 index 5ebf6f551424..000000000000 --- a/sdk/resourcemanager/network/armnetwork/webapplicationfirewallpolicies_client_example_test.go +++ /dev/null @@ -1,1383 +0,0 @@ -//go:build go1.18 -// +build go1.18 - -// 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. -// DO NOT EDIT. - -package armnetwork_test - -import ( - "context" - "log" - - "github.com/Azure/azure-sdk-for-go/sdk/azcore/to" - "github.com/Azure/azure-sdk-for-go/sdk/azidentity" - "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/network/armnetwork/v6" -) - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/4883fa5dbf6f2c9093fac8ce334547e9dfac68fa/specification/network/resource-manager/Microsoft.Network/stable/2024-03-01/examples/WafListPolicies.json -func ExampleWebApplicationFirewallPoliciesClient_NewListPager() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armnetwork.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := clientFactory.NewWebApplicationFirewallPoliciesClient().NewListPager("rg1", nil) - for pager.More() { - page, err := pager.NextPage(ctx) - if err != nil { - log.Fatalf("failed to advance page: %v", err) - } - for _, v := range page.Value { - // You could use page here. We use blank identifier for just demo purposes. - _ = v - } - // If the HTTP response code is 200 as defined in example definition, your page structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // page.WebApplicationFirewallPolicyListResult = armnetwork.WebApplicationFirewallPolicyListResult{ - // Value: []*armnetwork.WebApplicationFirewallPolicy{ - // { - // Name: to.Ptr("Policy1"), - // Type: to.Ptr("Microsoft.Network/applicationgatewaywebapplicationfirewallpolicies"), - // ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/ApplicationGatewayWebApplicationFirewallPolicies/Policy1"), - // Location: to.Ptr("WestUs"), - // Tags: map[string]*string{ - // "key1": to.Ptr("value1"), - // "key2": to.Ptr("value2"), - // }, - // Properties: &armnetwork.WebApplicationFirewallPolicyPropertiesFormat{ - // CustomRules: []*armnetwork.WebApplicationFirewallCustomRule{ - // { - // Name: to.Ptr("Rule1"), - // Action: to.Ptr(armnetwork.WebApplicationFirewallActionBlock), - // MatchConditions: []*armnetwork.MatchCondition{ - // { - // MatchValues: []*string{ - // to.Ptr("192.168.1.0/24"), - // to.Ptr("10.0.0.0/24")}, - // MatchVariables: []*armnetwork.MatchVariable{ - // { - // VariableName: to.Ptr(armnetwork.WebApplicationFirewallMatchVariableRemoteAddr), - // }}, - // NegationConditon: to.Ptr(false), - // Operator: to.Ptr(armnetwork.WebApplicationFirewallOperatorIPMatch), - // Transforms: []*armnetwork.WebApplicationFirewallTransform{ - // }, - // }}, - // Priority: to.Ptr[int32](1), - // RuleType: to.Ptr(armnetwork.WebApplicationFirewallRuleTypeMatchRule), - // State: to.Ptr(armnetwork.WebApplicationFirewallStateEnabled), - // }, - // { - // Name: to.Ptr("Rule2"), - // Action: to.Ptr(armnetwork.WebApplicationFirewallActionBlock), - // MatchConditions: []*armnetwork.MatchCondition{ - // { - // MatchValues: []*string{ - // to.Ptr("192.168.1.0/24")}, - // MatchVariables: []*armnetwork.MatchVariable{ - // { - // VariableName: to.Ptr(armnetwork.WebApplicationFirewallMatchVariableRemoteAddr), - // }}, - // NegationConditon: to.Ptr(false), - // Operator: to.Ptr(armnetwork.WebApplicationFirewallOperatorIPMatch), - // }, - // { - // MatchValues: []*string{ - // to.Ptr("Windows")}, - // MatchVariables: []*armnetwork.MatchVariable{ - // { - // Selector: to.Ptr("UserAgent"), - // VariableName: to.Ptr(armnetwork.WebApplicationFirewallMatchVariable("RequestHeader")), - // }}, - // NegationConditon: to.Ptr(false), - // Operator: to.Ptr(armnetwork.WebApplicationFirewallOperatorContains), - // }}, - // Priority: to.Ptr[int32](2), - // RuleType: to.Ptr(armnetwork.WebApplicationFirewallRuleTypeMatchRule), - // State: to.Ptr(armnetwork.WebApplicationFirewallStateEnabled), - // }, - // { - // Name: to.Ptr("RateLimitRule3"), - // Action: to.Ptr(armnetwork.WebApplicationFirewallActionBlock), - // GroupByUserSession: []*armnetwork.GroupByUserSession{ - // { - // GroupByVariables: []*armnetwork.GroupByVariable{ - // { - // VariableName: to.Ptr(armnetwork.ApplicationGatewayFirewallUserSessionVariableClientAddr), - // }}, - // }}, - // MatchConditions: []*armnetwork.MatchCondition{ - // { - // MatchValues: []*string{ - // to.Ptr("192.168.1.0/24"), - // to.Ptr("10.0.0.0/24")}, - // MatchVariables: []*armnetwork.MatchVariable{ - // { - // VariableName: to.Ptr(armnetwork.WebApplicationFirewallMatchVariableRemoteAddr), - // }}, - // NegationConditon: to.Ptr(true), - // Operator: to.Ptr(armnetwork.WebApplicationFirewallOperatorIPMatch), - // }}, - // Priority: to.Ptr[int32](3), - // RateLimitDuration: to.Ptr(armnetwork.ApplicationGatewayFirewallRateLimitDurationOneMin), - // RateLimitThreshold: to.Ptr[int32](10), - // RuleType: to.Ptr(armnetwork.WebApplicationFirewallRuleTypeRateLimitRule), - // }}, - // ManagedRules: &armnetwork.ManagedRulesDefinition{ - // ManagedRuleSets: []*armnetwork.ManagedRuleSet{ - // { - // RuleSetType: to.Ptr("OWASP"), - // RuleSetVersion: to.Ptr("3.2"), - // }}, - // Exceptions: []*armnetwork.ExceptionEntry{ - // { - // ExceptionManagedRuleSets: []*armnetwork.ExclusionManagedRuleSet{ - // { - // RuleSetType: to.Ptr("OWASP"), - // RuleSetVersion: to.Ptr("3.2"), - // }}, - // MatchVariable: to.Ptr(armnetwork.ExceptionEntryMatchVariableRequestURI), - // ValueMatchOperator: to.Ptr(armnetwork.ExceptionEntryValueMatchOperatorContains), - // Values: []*string{ - // to.Ptr("health"), - // to.Ptr("account/images"), - // to.Ptr("default.aspx")}, - // }, - // { - // ExceptionManagedRuleSets: []*armnetwork.ExclusionManagedRuleSet{ - // { - // RuleGroups: []*armnetwork.ExclusionManagedRuleGroup{ - // { - // RuleGroupName: to.Ptr("REQUEST-932-APPLICATION-ATTACK-RCE"), - // }}, - // RuleSetType: to.Ptr("OWASP"), - // RuleSetVersion: to.Ptr("3.2"), - // }}, - // MatchVariable: to.Ptr(armnetwork.ExceptionEntryMatchVariableRequestHeader), - // Selector: to.Ptr("User-Agent"), - // SelectorMatchOperator: to.Ptr(armnetwork.ExceptionEntrySelectorMatchOperatorStartsWith), - // ValueMatchOperator: to.Ptr(armnetwork.ExceptionEntryValueMatchOperatorContains), - // Values: []*string{ - // to.Ptr("Mozilla/5.0"), - // to.Ptr("Chrome/122.0.0.0")}, - // }, - // { - // ExceptionManagedRuleSets: []*armnetwork.ExclusionManagedRuleSet{ - // { - // RuleGroups: []*armnetwork.ExclusionManagedRuleGroup{ - // { - // RuleGroupName: to.Ptr("BadBots"), - // Rules: []*armnetwork.ExclusionManagedRule{ - // { - // RuleID: to.Ptr("100100"), - // }}, - // }}, - // RuleSetType: to.Ptr("Microsoft_BotManagerRuleSet"), - // RuleSetVersion: to.Ptr("1.0"), - // }}, - // MatchVariable: to.Ptr(armnetwork.ExceptionEntryMatchVariableRemoteAddr), - // ValueMatchOperator: to.Ptr(armnetwork.ExceptionEntryValueMatchOperatorIPMatch), - // Values: []*string{ - // to.Ptr("1.2.3.4"), - // to.Ptr("10.0.0.1/6")}, - // }}, - // }, - // PolicySettings: &armnetwork.PolicySettings{ - // CustomBlockResponseBody: to.Ptr("SGVsbG8="), - // CustomBlockResponseStatusCode: to.Ptr[int32](405), - // FileUploadEnforcement: to.Ptr(true), - // FileUploadLimitInMb: to.Ptr[int32](4000), - // LogScrubbing: &armnetwork.PolicySettingsLogScrubbing{ - // ScrubbingRules: []*armnetwork.WebApplicationFirewallScrubbingRules{ - // { - // MatchVariable: to.Ptr(armnetwork.ScrubbingRuleEntryMatchVariableRequestArgNames), - // Selector: to.Ptr("test"), - // SelectorMatchOperator: to.Ptr(armnetwork.ScrubbingRuleEntryMatchOperatorEquals), - // State: to.Ptr(armnetwork.ScrubbingRuleEntryStateEnabled), - // }, - // { - // MatchVariable: to.Ptr(armnetwork.ScrubbingRuleEntryMatchVariableRequestIPAddress), - // SelectorMatchOperator: to.Ptr(armnetwork.ScrubbingRuleEntryMatchOperatorEqualsAny), - // State: to.Ptr(armnetwork.ScrubbingRuleEntryStateEnabled), - // }}, - // State: to.Ptr(armnetwork.WebApplicationFirewallScrubbingStateEnabled), - // }, - // MaxRequestBodySizeInKb: to.Ptr[int32](2000), - // Mode: to.Ptr(armnetwork.WebApplicationFirewallModeDetection), - // RequestBodyCheck: to.Ptr(true), - // RequestBodyEnforcement: to.Ptr(true), - // RequestBodyInspectLimitInKB: to.Ptr[int32](2000), - // State: to.Ptr(armnetwork.WebApplicationFirewallEnabledStateEnabled), - // }, - // ProvisioningState: to.Ptr(armnetwork.ProvisioningStateSucceeded), - // ResourceState: to.Ptr(armnetwork.WebApplicationFirewallPolicyResourceStateEnabled), - // }, - // }}, - // } - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/4883fa5dbf6f2c9093fac8ce334547e9dfac68fa/specification/network/resource-manager/Microsoft.Network/stable/2024-03-01/examples/WafListAllPolicies.json -func ExampleWebApplicationFirewallPoliciesClient_NewListAllPager() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armnetwork.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := clientFactory.NewWebApplicationFirewallPoliciesClient().NewListAllPager(nil) - for pager.More() { - page, err := pager.NextPage(ctx) - if err != nil { - log.Fatalf("failed to advance page: %v", err) - } - for _, v := range page.Value { - // You could use page here. We use blank identifier for just demo purposes. - _ = v - } - // If the HTTP response code is 200 as defined in example definition, your page structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // page.WebApplicationFirewallPolicyListResult = armnetwork.WebApplicationFirewallPolicyListResult{ - // Value: []*armnetwork.WebApplicationFirewallPolicy{ - // { - // Name: to.Ptr("Policy1"), - // Type: to.Ptr("Microsoft.Network/applicationgatewaywebapplicationfirewallpolicies"), - // ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/ApplicationGatewayWebApplicationFirewallPolicies/Policy1"), - // Location: to.Ptr("WestUs"), - // Tags: map[string]*string{ - // "key1": to.Ptr("value1"), - // "key2": to.Ptr("value2"), - // }, - // Properties: &armnetwork.WebApplicationFirewallPolicyPropertiesFormat{ - // CustomRules: []*armnetwork.WebApplicationFirewallCustomRule{ - // { - // Name: to.Ptr("Rule1"), - // Action: to.Ptr(armnetwork.WebApplicationFirewallActionBlock), - // MatchConditions: []*armnetwork.MatchCondition{ - // { - // MatchValues: []*string{ - // to.Ptr("192.168.1.0/24"), - // to.Ptr("10.0.0.0/24")}, - // MatchVariables: []*armnetwork.MatchVariable{ - // { - // VariableName: to.Ptr(armnetwork.WebApplicationFirewallMatchVariableRemoteAddr), - // }}, - // NegationConditon: to.Ptr(false), - // Operator: to.Ptr(armnetwork.WebApplicationFirewallOperatorIPMatch), - // Transforms: []*armnetwork.WebApplicationFirewallTransform{ - // }, - // }}, - // Priority: to.Ptr[int32](1), - // RuleType: to.Ptr(armnetwork.WebApplicationFirewallRuleTypeMatchRule), - // State: to.Ptr(armnetwork.WebApplicationFirewallStateEnabled), - // }, - // { - // Name: to.Ptr("Rule2"), - // Action: to.Ptr(armnetwork.WebApplicationFirewallActionBlock), - // MatchConditions: []*armnetwork.MatchCondition{ - // { - // MatchValues: []*string{ - // to.Ptr("192.168.1.0/24")}, - // MatchVariables: []*armnetwork.MatchVariable{ - // { - // VariableName: to.Ptr(armnetwork.WebApplicationFirewallMatchVariableRemoteAddr), - // }}, - // NegationConditon: to.Ptr(false), - // Operator: to.Ptr(armnetwork.WebApplicationFirewallOperatorIPMatch), - // }, - // { - // MatchValues: []*string{ - // to.Ptr("Windows")}, - // MatchVariables: []*armnetwork.MatchVariable{ - // { - // Selector: to.Ptr("UserAgent"), - // VariableName: to.Ptr(armnetwork.WebApplicationFirewallMatchVariable("RequestHeader")), - // }}, - // NegationConditon: to.Ptr(false), - // Operator: to.Ptr(armnetwork.WebApplicationFirewallOperatorContains), - // }}, - // Priority: to.Ptr[int32](2), - // RuleType: to.Ptr(armnetwork.WebApplicationFirewallRuleTypeMatchRule), - // State: to.Ptr(armnetwork.WebApplicationFirewallStateEnabled), - // }, - // { - // Name: to.Ptr("RateLimitRule3"), - // Action: to.Ptr(armnetwork.WebApplicationFirewallActionBlock), - // GroupByUserSession: []*armnetwork.GroupByUserSession{ - // { - // GroupByVariables: []*armnetwork.GroupByVariable{ - // { - // VariableName: to.Ptr(armnetwork.ApplicationGatewayFirewallUserSessionVariableClientAddr), - // }}, - // }}, - // MatchConditions: []*armnetwork.MatchCondition{ - // { - // MatchValues: []*string{ - // to.Ptr("192.168.1.0/24"), - // to.Ptr("10.0.0.0/24")}, - // MatchVariables: []*armnetwork.MatchVariable{ - // { - // VariableName: to.Ptr(armnetwork.WebApplicationFirewallMatchVariableRemoteAddr), - // }}, - // NegationConditon: to.Ptr(true), - // Operator: to.Ptr(armnetwork.WebApplicationFirewallOperatorIPMatch), - // }}, - // Priority: to.Ptr[int32](3), - // RateLimitDuration: to.Ptr(armnetwork.ApplicationGatewayFirewallRateLimitDurationOneMin), - // RateLimitThreshold: to.Ptr[int32](10), - // RuleType: to.Ptr(armnetwork.WebApplicationFirewallRuleTypeRateLimitRule), - // }}, - // ManagedRules: &armnetwork.ManagedRulesDefinition{ - // ManagedRuleSets: []*armnetwork.ManagedRuleSet{ - // { - // RuleSetType: to.Ptr("OWASP"), - // RuleSetVersion: to.Ptr("3.2"), - // }}, - // Exceptions: []*armnetwork.ExceptionEntry{ - // { - // ExceptionManagedRuleSets: []*armnetwork.ExclusionManagedRuleSet{ - // { - // RuleSetType: to.Ptr("OWASP"), - // RuleSetVersion: to.Ptr("3.2"), - // }}, - // MatchVariable: to.Ptr(armnetwork.ExceptionEntryMatchVariableRequestURI), - // ValueMatchOperator: to.Ptr(armnetwork.ExceptionEntryValueMatchOperatorContains), - // Values: []*string{ - // to.Ptr("health"), - // to.Ptr("account/images"), - // to.Ptr("default.aspx")}, - // }, - // { - // ExceptionManagedRuleSets: []*armnetwork.ExclusionManagedRuleSet{ - // { - // RuleGroups: []*armnetwork.ExclusionManagedRuleGroup{ - // { - // RuleGroupName: to.Ptr("REQUEST-932-APPLICATION-ATTACK-RCE"), - // }}, - // RuleSetType: to.Ptr("OWASP"), - // RuleSetVersion: to.Ptr("3.2"), - // }}, - // MatchVariable: to.Ptr(armnetwork.ExceptionEntryMatchVariableRequestHeader), - // Selector: to.Ptr("User-Agent"), - // SelectorMatchOperator: to.Ptr(armnetwork.ExceptionEntrySelectorMatchOperatorStartsWith), - // ValueMatchOperator: to.Ptr(armnetwork.ExceptionEntryValueMatchOperatorContains), - // Values: []*string{ - // to.Ptr("Mozilla/5.0"), - // to.Ptr("Chrome/122.0.0.0")}, - // }, - // { - // ExceptionManagedRuleSets: []*armnetwork.ExclusionManagedRuleSet{ - // { - // RuleGroups: []*armnetwork.ExclusionManagedRuleGroup{ - // { - // RuleGroupName: to.Ptr("BadBots"), - // Rules: []*armnetwork.ExclusionManagedRule{ - // { - // RuleID: to.Ptr("100100"), - // }}, - // }}, - // RuleSetType: to.Ptr("Microsoft_BotManagerRuleSet"), - // RuleSetVersion: to.Ptr("1.0"), - // }}, - // MatchVariable: to.Ptr(armnetwork.ExceptionEntryMatchVariableRemoteAddr), - // ValueMatchOperator: to.Ptr(armnetwork.ExceptionEntryValueMatchOperatorIPMatch), - // Values: []*string{ - // to.Ptr("1.2.3.4"), - // to.Ptr("10.0.0.1/6")}, - // }}, - // }, - // PolicySettings: &armnetwork.PolicySettings{ - // CustomBlockResponseBody: to.Ptr("SGVsbG8="), - // CustomBlockResponseStatusCode: to.Ptr[int32](405), - // FileUploadEnforcement: to.Ptr(true), - // FileUploadLimitInMb: to.Ptr[int32](4000), - // LogScrubbing: &armnetwork.PolicySettingsLogScrubbing{ - // ScrubbingRules: []*armnetwork.WebApplicationFirewallScrubbingRules{ - // { - // MatchVariable: to.Ptr(armnetwork.ScrubbingRuleEntryMatchVariableRequestArgNames), - // Selector: to.Ptr("test"), - // SelectorMatchOperator: to.Ptr(armnetwork.ScrubbingRuleEntryMatchOperatorEquals), - // State: to.Ptr(armnetwork.ScrubbingRuleEntryStateEnabled), - // }, - // { - // MatchVariable: to.Ptr(armnetwork.ScrubbingRuleEntryMatchVariableRequestIPAddress), - // Selector: to.Ptr("*"), - // SelectorMatchOperator: to.Ptr(armnetwork.ScrubbingRuleEntryMatchOperatorEqualsAny), - // State: to.Ptr(armnetwork.ScrubbingRuleEntryStateEnabled), - // }}, - // State: to.Ptr(armnetwork.WebApplicationFirewallScrubbingStateEnabled), - // }, - // MaxRequestBodySizeInKb: to.Ptr[int32](2000), - // Mode: to.Ptr(armnetwork.WebApplicationFirewallModePrevention), - // RequestBodyCheck: to.Ptr(true), - // RequestBodyEnforcement: to.Ptr(true), - // RequestBodyInspectLimitInKB: to.Ptr[int32](2000), - // State: to.Ptr(armnetwork.WebApplicationFirewallEnabledStateEnabled), - // }, - // ProvisioningState: to.Ptr(armnetwork.ProvisioningStateSucceeded), - // ResourceState: to.Ptr(armnetwork.WebApplicationFirewallPolicyResourceStateEnabled), - // }, - // }}, - // } - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/4883fa5dbf6f2c9093fac8ce334547e9dfac68fa/specification/network/resource-manager/Microsoft.Network/stable/2024-03-01/examples/WafPolicyGet.json -func ExampleWebApplicationFirewallPoliciesClient_Get() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armnetwork.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewWebApplicationFirewallPoliciesClient().Get(ctx, "rg1", "Policy1", nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.WebApplicationFirewallPolicy = armnetwork.WebApplicationFirewallPolicy{ - // Name: to.Ptr("Policy1"), - // Type: to.Ptr("Microsoft.Network/applicationgatewaywebapplicationfirewallpolicies"), - // ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/ApplicationGatewayWebApplicationFirewallPolicies/Policy1"), - // Location: to.Ptr("WestUs"), - // Tags: map[string]*string{ - // "key1": to.Ptr("value1"), - // "key2": to.Ptr("value2"), - // }, - // Properties: &armnetwork.WebApplicationFirewallPolicyPropertiesFormat{ - // ApplicationGatewayForContainers: []*armnetwork.ApplicationGatewayForContainersReferenceDefinition{ - // { - // ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.ServiceNetworking/trafficControllers/agc1"), - // }}, - // CustomRules: []*armnetwork.WebApplicationFirewallCustomRule{ - // { - // Name: to.Ptr("Rule1"), - // Action: to.Ptr(armnetwork.WebApplicationFirewallActionBlock), - // MatchConditions: []*armnetwork.MatchCondition{ - // { - // MatchValues: []*string{ - // to.Ptr("192.168.1.0/24"), - // to.Ptr("10.0.0.0/24")}, - // MatchVariables: []*armnetwork.MatchVariable{ - // { - // VariableName: to.Ptr(armnetwork.WebApplicationFirewallMatchVariableRemoteAddr), - // }}, - // NegationConditon: to.Ptr(false), - // Operator: to.Ptr(armnetwork.WebApplicationFirewallOperatorIPMatch), - // Transforms: []*armnetwork.WebApplicationFirewallTransform{ - // }, - // }}, - // Priority: to.Ptr[int32](1), - // RuleType: to.Ptr(armnetwork.WebApplicationFirewallRuleTypeMatchRule), - // State: to.Ptr(armnetwork.WebApplicationFirewallStateEnabled), - // }, - // { - // Name: to.Ptr("Rule2"), - // Action: to.Ptr(armnetwork.WebApplicationFirewallActionBlock), - // MatchConditions: []*armnetwork.MatchCondition{ - // { - // MatchValues: []*string{ - // to.Ptr("192.168.1.0/24")}, - // MatchVariables: []*armnetwork.MatchVariable{ - // { - // VariableName: to.Ptr(armnetwork.WebApplicationFirewallMatchVariableRemoteAddr), - // }}, - // NegationConditon: to.Ptr(false), - // Operator: to.Ptr(armnetwork.WebApplicationFirewallOperatorIPMatch), - // }, - // { - // MatchValues: []*string{ - // to.Ptr("Windows")}, - // MatchVariables: []*armnetwork.MatchVariable{ - // { - // Selector: to.Ptr("UserAgent"), - // VariableName: to.Ptr(armnetwork.WebApplicationFirewallMatchVariable("RequestHeader")), - // }}, - // NegationConditon: to.Ptr(false), - // Operator: to.Ptr(armnetwork.WebApplicationFirewallOperatorContains), - // }}, - // Priority: to.Ptr[int32](2), - // RuleType: to.Ptr(armnetwork.WebApplicationFirewallRuleTypeMatchRule), - // State: to.Ptr(armnetwork.WebApplicationFirewallStateEnabled), - // }, - // { - // Name: to.Ptr("RateLimitRule3"), - // Action: to.Ptr(armnetwork.WebApplicationFirewallActionBlock), - // GroupByUserSession: []*armnetwork.GroupByUserSession{ - // { - // GroupByVariables: []*armnetwork.GroupByVariable{ - // { - // VariableName: to.Ptr(armnetwork.ApplicationGatewayFirewallUserSessionVariableClientAddr), - // }}, - // }}, - // MatchConditions: []*armnetwork.MatchCondition{ - // { - // MatchValues: []*string{ - // to.Ptr("192.168.1.0/24"), - // to.Ptr("10.0.0.0/24")}, - // MatchVariables: []*armnetwork.MatchVariable{ - // { - // VariableName: to.Ptr(armnetwork.WebApplicationFirewallMatchVariableRemoteAddr), - // }}, - // NegationConditon: to.Ptr(true), - // Operator: to.Ptr(armnetwork.WebApplicationFirewallOperatorIPMatch), - // }}, - // Priority: to.Ptr[int32](3), - // RateLimitDuration: to.Ptr(armnetwork.ApplicationGatewayFirewallRateLimitDurationOneMin), - // RateLimitThreshold: to.Ptr[int32](10), - // RuleType: to.Ptr(armnetwork.WebApplicationFirewallRuleTypeRateLimitRule), - // }, - // { - // Name: to.Ptr("Rule4"), - // Action: to.Ptr(armnetwork.WebApplicationFirewallActionJSChallenge), - // MatchConditions: []*armnetwork.MatchCondition{ - // { - // MatchValues: []*string{ - // to.Ptr("192.168.1.0/24")}, - // MatchVariables: []*armnetwork.MatchVariable{ - // { - // VariableName: to.Ptr(armnetwork.WebApplicationFirewallMatchVariableRemoteAddr), - // }}, - // NegationConditon: to.Ptr(false), - // Operator: to.Ptr(armnetwork.WebApplicationFirewallOperatorIPMatch), - // }, - // { - // MatchValues: []*string{ - // to.Ptr("Bot")}, - // MatchVariables: []*armnetwork.MatchVariable{ - // { - // Selector: to.Ptr("UserAgent"), - // VariableName: to.Ptr(armnetwork.WebApplicationFirewallMatchVariableRequestHeaders), - // }}, - // NegationConditon: to.Ptr(false), - // Operator: to.Ptr(armnetwork.WebApplicationFirewallOperatorContains), - // }}, - // Priority: to.Ptr[int32](4), - // RuleType: to.Ptr(armnetwork.WebApplicationFirewallRuleTypeMatchRule), - // State: to.Ptr(armnetwork.WebApplicationFirewallStateEnabled), - // }}, - // ManagedRules: &armnetwork.ManagedRulesDefinition{ - // Exclusions: []*armnetwork.OwaspCrsExclusionEntry{ - // { - // MatchVariable: to.Ptr(armnetwork.OwaspCrsExclusionEntryMatchVariableRequestHeaderNames), - // Selector: to.Ptr("testHeader1"), - // SelectorMatchOperator: to.Ptr(armnetwork.OwaspCrsExclusionEntrySelectorMatchOperatorEquals), - // }, - // { - // MatchVariable: to.Ptr(armnetwork.OwaspCrsExclusionEntryMatchVariableRequestHeaderNames), - // Selector: to.Ptr("testHeader2"), - // SelectorMatchOperator: to.Ptr(armnetwork.OwaspCrsExclusionEntrySelectorMatchOperatorStartsWith), - // }, - // { - // MatchVariable: to.Ptr(armnetwork.OwaspCrsExclusionEntryMatchVariableRequestArgValues), - // Selector: to.Ptr("hello"), - // SelectorMatchOperator: to.Ptr(armnetwork.OwaspCrsExclusionEntrySelectorMatchOperatorStartsWith), - // }, - // { - // ExclusionManagedRuleSets: []*armnetwork.ExclusionManagedRuleSet{ - // { - // RuleGroups: []*armnetwork.ExclusionManagedRuleGroup{ - // { - // RuleGroupName: to.Ptr("REQUEST-930-APPLICATION-ATTACK-LFI"), - // Rules: []*armnetwork.ExclusionManagedRule{ - // { - // RuleID: to.Ptr("930120"), - // }}, - // }, - // { - // RuleGroupName: to.Ptr("REQUEST-932-APPLICATION-ATTACK-RCE"), - // }}, - // RuleSetType: to.Ptr("OWASP"), - // RuleSetVersion: to.Ptr("3.2"), - // }}, - // MatchVariable: to.Ptr(armnetwork.OwaspCrsExclusionEntryMatchVariableRequestArgNames), - // Selector: to.Ptr("hello"), - // SelectorMatchOperator: to.Ptr(armnetwork.OwaspCrsExclusionEntrySelectorMatchOperatorStartsWith), - // }, - // { - // ExclusionManagedRuleSets: []*armnetwork.ExclusionManagedRuleSet{ - // { - // RuleGroups: []*armnetwork.ExclusionManagedRuleGroup{ - // }, - // RuleSetType: to.Ptr("OWASP"), - // RuleSetVersion: to.Ptr("3.1"), - // }}, - // MatchVariable: to.Ptr(armnetwork.OwaspCrsExclusionEntryMatchVariableRequestArgNames), - // Selector: to.Ptr("hello"), - // SelectorMatchOperator: to.Ptr(armnetwork.OwaspCrsExclusionEntrySelectorMatchOperatorEndsWith), - // }}, - // ManagedRuleSets: []*armnetwork.ManagedRuleSet{ - // { - // RuleGroupOverrides: []*armnetwork.ManagedRuleGroupOverride{ - // { - // RuleGroupName: to.Ptr("REQUEST-942-APPLICATION-ATTACK-SQLI"), - // Rules: []*armnetwork.ManagedRuleOverride{ - // { - // Action: to.Ptr(armnetwork.ActionTypeAnomalyScoring), - // RuleID: to.Ptr("942130"), - // State: to.Ptr(armnetwork.ManagedRuleEnabledStateDisabled), - // }, - // { - // Action: to.Ptr(armnetwork.ActionTypeAnomalyScoring), - // RuleID: to.Ptr("942110"), - // State: to.Ptr(armnetwork.ManagedRuleEnabledStateDisabled), - // }, - // { - // Action: to.Ptr(armnetwork.ActionTypeLog), - // RuleID: to.Ptr("942140"), - // State: to.Ptr(armnetwork.ManagedRuleEnabledStateEnabled), - // }}, - // }, - // { - // RuleGroupName: to.Ptr("REQUEST-920-PROTOCOL-ENFORCEMENT"), - // Rules: []*armnetwork.ManagedRuleOverride{ - // { - // Action: to.Ptr(armnetwork.ActionTypeAnomalyScoring), - // RuleID: to.Ptr("920100"), - // State: to.Ptr(armnetwork.ManagedRuleEnabledStateDisabled), - // }, - // { - // Action: to.Ptr(armnetwork.ActionTypeAnomalyScoring), - // RuleID: to.Ptr("920120"), - // State: to.Ptr(armnetwork.ManagedRuleEnabledStateDisabled), - // }, - // { - // Action: to.Ptr(armnetwork.ActionTypeBlock), - // RuleID: to.Ptr("920130"), - // State: to.Ptr(armnetwork.ManagedRuleEnabledStateEnabled), - // }}, - // }}, - // RuleSetType: to.Ptr("OWASP"), - // RuleSetVersion: to.Ptr("3.2"), - // }, - // { - // RuleGroupOverrides: []*armnetwork.ManagedRuleGroupOverride{ - // { - // RuleGroupName: to.Ptr("UnknownBots"), - // Rules: []*armnetwork.ManagedRuleOverride{ - // { - // Action: to.Ptr(armnetwork.ActionTypeJSChallenge), - // RuleID: to.Ptr("300700"), - // State: to.Ptr(armnetwork.ManagedRuleEnabledStateEnabled), - // }}, - // }}, - // RuleSetType: to.Ptr("Microsoft_BotManagerRuleSet"), - // RuleSetVersion: to.Ptr("1.0"), - // }, - // { - // RuleGroupOverrides: []*armnetwork.ManagedRuleGroupOverride{ - // { - // RuleGroupName: to.Ptr("ExcessiveRequests"), - // Rules: []*armnetwork.ManagedRuleOverride{ - // { - // Action: to.Ptr(armnetwork.ActionTypeBlock), - // RuleID: to.Ptr("500100"), - // Sensitivity: to.Ptr(armnetwork.SensitivityTypeHigh), - // State: to.Ptr(armnetwork.ManagedRuleEnabledStateEnabled), - // }}, - // }}, - // RuleSetType: to.Ptr("Microsoft_HTTPDDoSRuleSet"), - // RuleSetVersion: to.Ptr("1.0"), - // }}, - // Exceptions: []*armnetwork.ExceptionEntry{ - // { - // ExceptionManagedRuleSets: []*armnetwork.ExclusionManagedRuleSet{ - // { - // RuleSetType: to.Ptr("OWASP"), - // RuleSetVersion: to.Ptr("3.2"), - // }}, - // MatchVariable: to.Ptr(armnetwork.ExceptionEntryMatchVariableRequestURI), - // ValueMatchOperator: to.Ptr(armnetwork.ExceptionEntryValueMatchOperatorContains), - // Values: []*string{ - // to.Ptr("health"), - // to.Ptr("account/images"), - // to.Ptr("default.aspx")}, - // }, - // { - // ExceptionManagedRuleSets: []*armnetwork.ExclusionManagedRuleSet{ - // { - // RuleGroups: []*armnetwork.ExclusionManagedRuleGroup{ - // { - // RuleGroupName: to.Ptr("REQUEST-932-APPLICATION-ATTACK-RCE"), - // }}, - // RuleSetType: to.Ptr("OWASP"), - // RuleSetVersion: to.Ptr("3.2"), - // }}, - // MatchVariable: to.Ptr(armnetwork.ExceptionEntryMatchVariableRequestHeader), - // Selector: to.Ptr("User-Agent"), - // SelectorMatchOperator: to.Ptr(armnetwork.ExceptionEntrySelectorMatchOperatorStartsWith), - // ValueMatchOperator: to.Ptr(armnetwork.ExceptionEntryValueMatchOperatorContains), - // Values: []*string{ - // to.Ptr("Mozilla/5.0"), - // to.Ptr("Chrome/122.0.0.0")}, - // }, - // { - // ExceptionManagedRuleSets: []*armnetwork.ExclusionManagedRuleSet{ - // { - // RuleGroups: []*armnetwork.ExclusionManagedRuleGroup{ - // { - // RuleGroupName: to.Ptr("BadBots"), - // Rules: []*armnetwork.ExclusionManagedRule{ - // { - // RuleID: to.Ptr("100100"), - // }}, - // }}, - // RuleSetType: to.Ptr("Microsoft_BotManagerRuleSet"), - // RuleSetVersion: to.Ptr("1.0"), - // }}, - // MatchVariable: to.Ptr(armnetwork.ExceptionEntryMatchVariableRemoteAddr), - // ValueMatchOperator: to.Ptr(armnetwork.ExceptionEntryValueMatchOperatorIPMatch), - // Values: []*string{ - // to.Ptr("1.2.3.4"), - // to.Ptr("10.0.0.1/6")}, - // }}, - // }, - // PolicySettings: &armnetwork.PolicySettings{ - // CustomBlockResponseBody: to.Ptr("SGVsbG8="), - // CustomBlockResponseStatusCode: to.Ptr[int32](405), - // FileUploadEnforcement: to.Ptr(true), - // FileUploadLimitInMb: to.Ptr[int32](4000), - // JsChallengeCookieExpirationInMins: to.Ptr[int32](100), - // LogScrubbing: &armnetwork.PolicySettingsLogScrubbing{ - // ScrubbingRules: []*armnetwork.WebApplicationFirewallScrubbingRules{ - // { - // MatchVariable: to.Ptr(armnetwork.ScrubbingRuleEntryMatchVariableRequestArgNames), - // Selector: to.Ptr("test"), - // SelectorMatchOperator: to.Ptr(armnetwork.ScrubbingRuleEntryMatchOperatorEquals), - // State: to.Ptr(armnetwork.ScrubbingRuleEntryStateEnabled), - // }, - // { - // MatchVariable: to.Ptr(armnetwork.ScrubbingRuleEntryMatchVariableRequestIPAddress), - // SelectorMatchOperator: to.Ptr(armnetwork.ScrubbingRuleEntryMatchOperatorEqualsAny), - // State: to.Ptr(armnetwork.ScrubbingRuleEntryStateEnabled), - // }}, - // State: to.Ptr(armnetwork.WebApplicationFirewallScrubbingStateEnabled), - // }, - // MaxRequestBodySizeInKb: to.Ptr[int32](2000), - // Mode: to.Ptr(armnetwork.WebApplicationFirewallModePrevention), - // RequestBodyCheck: to.Ptr(true), - // RequestBodyEnforcement: to.Ptr(true), - // RequestBodyInspectLimitInKB: to.Ptr[int32](2000), - // State: to.Ptr(armnetwork.WebApplicationFirewallEnabledStateEnabled), - // }, - // ProvisioningState: to.Ptr(armnetwork.ProvisioningStateSucceeded), - // ResourceState: to.Ptr(armnetwork.WebApplicationFirewallPolicyResourceStateEnabled), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/4883fa5dbf6f2c9093fac8ce334547e9dfac68fa/specification/network/resource-manager/Microsoft.Network/stable/2024-03-01/examples/WafPolicyCreateOrUpdate.json -func ExampleWebApplicationFirewallPoliciesClient_CreateOrUpdate() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armnetwork.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewWebApplicationFirewallPoliciesClient().CreateOrUpdate(ctx, "rg1", "Policy1", armnetwork.WebApplicationFirewallPolicy{ - Location: to.Ptr("WestUs"), - Properties: &armnetwork.WebApplicationFirewallPolicyPropertiesFormat{ - CustomRules: []*armnetwork.WebApplicationFirewallCustomRule{ - { - Name: to.Ptr("Rule1"), - Action: to.Ptr(armnetwork.WebApplicationFirewallActionBlock), - MatchConditions: []*armnetwork.MatchCondition{ - { - MatchValues: []*string{ - to.Ptr("192.168.1.0/24"), - to.Ptr("10.0.0.0/24")}, - MatchVariables: []*armnetwork.MatchVariable{ - { - VariableName: to.Ptr(armnetwork.WebApplicationFirewallMatchVariableRemoteAddr), - }}, - Operator: to.Ptr(armnetwork.WebApplicationFirewallOperatorIPMatch), - }}, - Priority: to.Ptr[int32](1), - RuleType: to.Ptr(armnetwork.WebApplicationFirewallRuleTypeMatchRule), - }, - { - Name: to.Ptr("Rule2"), - Action: to.Ptr(armnetwork.WebApplicationFirewallActionBlock), - MatchConditions: []*armnetwork.MatchCondition{ - { - MatchValues: []*string{ - to.Ptr("192.168.1.0/24")}, - MatchVariables: []*armnetwork.MatchVariable{ - { - VariableName: to.Ptr(armnetwork.WebApplicationFirewallMatchVariableRemoteAddr), - }}, - Operator: to.Ptr(armnetwork.WebApplicationFirewallOperatorIPMatch), - }, - { - MatchValues: []*string{ - to.Ptr("Windows")}, - MatchVariables: []*armnetwork.MatchVariable{ - { - Selector: to.Ptr("UserAgent"), - VariableName: to.Ptr(armnetwork.WebApplicationFirewallMatchVariableRequestHeaders), - }}, - Operator: to.Ptr(armnetwork.WebApplicationFirewallOperatorContains), - }}, - Priority: to.Ptr[int32](2), - RuleType: to.Ptr(armnetwork.WebApplicationFirewallRuleTypeMatchRule), - }, - { - Name: to.Ptr("RateLimitRule3"), - Action: to.Ptr(armnetwork.WebApplicationFirewallActionBlock), - GroupByUserSession: []*armnetwork.GroupByUserSession{ - { - GroupByVariables: []*armnetwork.GroupByVariable{ - { - VariableName: to.Ptr(armnetwork.ApplicationGatewayFirewallUserSessionVariableClientAddr), - }}, - }}, - MatchConditions: []*armnetwork.MatchCondition{ - { - MatchValues: []*string{ - to.Ptr("192.168.1.0/24"), - to.Ptr("10.0.0.0/24")}, - MatchVariables: []*armnetwork.MatchVariable{ - { - VariableName: to.Ptr(armnetwork.WebApplicationFirewallMatchVariableRemoteAddr), - }}, - NegationConditon: to.Ptr(true), - Operator: to.Ptr(armnetwork.WebApplicationFirewallOperatorIPMatch), - }}, - Priority: to.Ptr[int32](3), - RateLimitDuration: to.Ptr(armnetwork.ApplicationGatewayFirewallRateLimitDurationOneMin), - RateLimitThreshold: to.Ptr[int32](10), - RuleType: to.Ptr(armnetwork.WebApplicationFirewallRuleTypeRateLimitRule), - }, - { - Name: to.Ptr("Rule4"), - Action: to.Ptr(armnetwork.WebApplicationFirewallActionJSChallenge), - MatchConditions: []*armnetwork.MatchCondition{ - { - MatchValues: []*string{ - to.Ptr("192.168.1.0/24")}, - MatchVariables: []*armnetwork.MatchVariable{ - { - VariableName: to.Ptr(armnetwork.WebApplicationFirewallMatchVariableRemoteAddr), - }}, - Operator: to.Ptr(armnetwork.WebApplicationFirewallOperatorIPMatch), - }, - { - MatchValues: []*string{ - to.Ptr("Bot")}, - MatchVariables: []*armnetwork.MatchVariable{ - { - Selector: to.Ptr("UserAgent"), - VariableName: to.Ptr(armnetwork.WebApplicationFirewallMatchVariableRequestHeaders), - }}, - Operator: to.Ptr(armnetwork.WebApplicationFirewallOperatorContains), - }}, - Priority: to.Ptr[int32](4), - RuleType: to.Ptr(armnetwork.WebApplicationFirewallRuleTypeMatchRule), - }}, - ManagedRules: &armnetwork.ManagedRulesDefinition{ - Exclusions: []*armnetwork.OwaspCrsExclusionEntry{ - { - ExclusionManagedRuleSets: []*armnetwork.ExclusionManagedRuleSet{ - { - RuleGroups: []*armnetwork.ExclusionManagedRuleGroup{ - { - RuleGroupName: to.Ptr("REQUEST-930-APPLICATION-ATTACK-LFI"), - Rules: []*armnetwork.ExclusionManagedRule{ - { - RuleID: to.Ptr("930120"), - }}, - }, - { - RuleGroupName: to.Ptr("REQUEST-932-APPLICATION-ATTACK-RCE"), - }}, - RuleSetType: to.Ptr("OWASP"), - RuleSetVersion: to.Ptr("3.2"), - }}, - MatchVariable: to.Ptr(armnetwork.OwaspCrsExclusionEntryMatchVariableRequestArgNames), - Selector: to.Ptr("hello"), - SelectorMatchOperator: to.Ptr(armnetwork.OwaspCrsExclusionEntrySelectorMatchOperatorStartsWith), - }, - { - ExclusionManagedRuleSets: []*armnetwork.ExclusionManagedRuleSet{ - { - RuleGroups: []*armnetwork.ExclusionManagedRuleGroup{}, - RuleSetType: to.Ptr("OWASP"), - RuleSetVersion: to.Ptr("3.1"), - }}, - MatchVariable: to.Ptr(armnetwork.OwaspCrsExclusionEntryMatchVariableRequestArgNames), - Selector: to.Ptr("hello"), - SelectorMatchOperator: to.Ptr(armnetwork.OwaspCrsExclusionEntrySelectorMatchOperatorEndsWith), - }, - { - MatchVariable: to.Ptr(armnetwork.OwaspCrsExclusionEntryMatchVariableRequestArgNames), - Selector: to.Ptr("test"), - SelectorMatchOperator: to.Ptr(armnetwork.OwaspCrsExclusionEntrySelectorMatchOperatorStartsWith), - }, - { - MatchVariable: to.Ptr(armnetwork.OwaspCrsExclusionEntryMatchVariableRequestArgValues), - Selector: to.Ptr("test"), - SelectorMatchOperator: to.Ptr(armnetwork.OwaspCrsExclusionEntrySelectorMatchOperatorStartsWith), - }}, - ManagedRuleSets: []*armnetwork.ManagedRuleSet{ - { - RuleGroupOverrides: []*armnetwork.ManagedRuleGroupOverride{ - { - RuleGroupName: to.Ptr("REQUEST-931-APPLICATION-ATTACK-RFI"), - Rules: []*armnetwork.ManagedRuleOverride{ - { - Action: to.Ptr(armnetwork.ActionTypeLog), - RuleID: to.Ptr("931120"), - State: to.Ptr(armnetwork.ManagedRuleEnabledStateEnabled), - }, - { - Action: to.Ptr(armnetwork.ActionTypeAnomalyScoring), - RuleID: to.Ptr("931130"), - State: to.Ptr(armnetwork.ManagedRuleEnabledStateDisabled), - }}, - }}, - RuleSetType: to.Ptr("OWASP"), - RuleSetVersion: to.Ptr("3.2"), - }, - { - RuleGroupOverrides: []*armnetwork.ManagedRuleGroupOverride{ - { - RuleGroupName: to.Ptr("UnknownBots"), - Rules: []*armnetwork.ManagedRuleOverride{ - { - Action: to.Ptr(armnetwork.ActionTypeJSChallenge), - RuleID: to.Ptr("300700"), - State: to.Ptr(armnetwork.ManagedRuleEnabledStateEnabled), - }}, - }}, - RuleSetType: to.Ptr("Microsoft_BotManagerRuleSet"), - RuleSetVersion: to.Ptr("1.0"), - }, - { - RuleGroupOverrides: []*armnetwork.ManagedRuleGroupOverride{ - { - RuleGroupName: to.Ptr("ExcessiveRequests"), - Rules: []*armnetwork.ManagedRuleOverride{ - { - Action: to.Ptr(armnetwork.ActionTypeBlock), - RuleID: to.Ptr("500100"), - Sensitivity: to.Ptr(armnetwork.SensitivityTypeHigh), - State: to.Ptr(armnetwork.ManagedRuleEnabledStateEnabled), - }}, - }}, - RuleSetType: to.Ptr("Microsoft_HTTPDDoSRuleSet"), - RuleSetVersion: to.Ptr("1.0"), - }}, - Exceptions: []*armnetwork.ExceptionEntry{ - { - ExceptionManagedRuleSets: []*armnetwork.ExclusionManagedRuleSet{ - { - RuleSetType: to.Ptr("OWASP"), - RuleSetVersion: to.Ptr("3.2"), - }}, - MatchVariable: to.Ptr(armnetwork.ExceptionEntryMatchVariableRequestURI), - ValueMatchOperator: to.Ptr(armnetwork.ExceptionEntryValueMatchOperatorContains), - Values: []*string{ - to.Ptr("health"), - to.Ptr("account/images"), - to.Ptr("default.aspx")}, - }, - { - ExceptionManagedRuleSets: []*armnetwork.ExclusionManagedRuleSet{ - { - RuleGroups: []*armnetwork.ExclusionManagedRuleGroup{ - { - RuleGroupName: to.Ptr("REQUEST-932-APPLICATION-ATTACK-RCE"), - }}, - RuleSetType: to.Ptr("OWASP"), - RuleSetVersion: to.Ptr("3.2"), - }}, - MatchVariable: to.Ptr(armnetwork.ExceptionEntryMatchVariableRequestHeader), - Selector: to.Ptr("User-Agent"), - SelectorMatchOperator: to.Ptr(armnetwork.ExceptionEntrySelectorMatchOperatorStartsWith), - ValueMatchOperator: to.Ptr(armnetwork.ExceptionEntryValueMatchOperatorContains), - Values: []*string{ - to.Ptr("Mozilla/5.0"), - to.Ptr("Chrome/122.0.0.0")}, - }, - { - ExceptionManagedRuleSets: []*armnetwork.ExclusionManagedRuleSet{ - { - RuleGroups: []*armnetwork.ExclusionManagedRuleGroup{ - { - RuleGroupName: to.Ptr("BadBots"), - Rules: []*armnetwork.ExclusionManagedRule{ - { - RuleID: to.Ptr("100100"), - }}, - }}, - RuleSetType: to.Ptr("Microsoft_BotManagerRuleSet"), - RuleSetVersion: to.Ptr("1.0"), - }}, - MatchVariable: to.Ptr(armnetwork.ExceptionEntryMatchVariableRemoteAddr), - ValueMatchOperator: to.Ptr(armnetwork.ExceptionEntryValueMatchOperatorIPMatch), - Values: []*string{ - to.Ptr("1.2.3.4"), - to.Ptr("10.0.0.1/6")}, - }}, - }, - PolicySettings: &armnetwork.PolicySettings{ - JsChallengeCookieExpirationInMins: to.Ptr[int32](100), - LogScrubbing: &armnetwork.PolicySettingsLogScrubbing{ - ScrubbingRules: []*armnetwork.WebApplicationFirewallScrubbingRules{ - { - MatchVariable: to.Ptr(armnetwork.ScrubbingRuleEntryMatchVariableRequestArgNames), - Selector: to.Ptr("test"), - SelectorMatchOperator: to.Ptr(armnetwork.ScrubbingRuleEntryMatchOperatorEquals), - State: to.Ptr(armnetwork.ScrubbingRuleEntryStateEnabled), - }, - { - MatchVariable: to.Ptr(armnetwork.ScrubbingRuleEntryMatchVariableRequestIPAddress), - SelectorMatchOperator: to.Ptr(armnetwork.ScrubbingRuleEntryMatchOperatorEqualsAny), - State: to.Ptr(armnetwork.ScrubbingRuleEntryStateEnabled), - }}, - State: to.Ptr(armnetwork.WebApplicationFirewallScrubbingStateEnabled), - }, - }, - }, - }, nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.WebApplicationFirewallPolicy = armnetwork.WebApplicationFirewallPolicy{ - // Name: to.Ptr("Policy1"), - // Type: to.Ptr("Microsoft.Network/applicationgatewaywebapplicationfirewallpolicies"), - // ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/ApplicationGatewayWebApplicationFirewallPolicies/Policy1"), - // Location: to.Ptr("WestUs"), - // Tags: map[string]*string{ - // "key1": to.Ptr("value1"), - // "key2": to.Ptr("value2"), - // }, - // Properties: &armnetwork.WebApplicationFirewallPolicyPropertiesFormat{ - // CustomRules: []*armnetwork.WebApplicationFirewallCustomRule{ - // { - // Name: to.Ptr("Rule1"), - // Action: to.Ptr(armnetwork.WebApplicationFirewallActionBlock), - // MatchConditions: []*armnetwork.MatchCondition{ - // { - // MatchValues: []*string{ - // to.Ptr("192.168.1.0/24"), - // to.Ptr("10.0.0.0/24")}, - // MatchVariables: []*armnetwork.MatchVariable{ - // { - // VariableName: to.Ptr(armnetwork.WebApplicationFirewallMatchVariableRemoteAddr), - // }}, - // NegationConditon: to.Ptr(false), - // Operator: to.Ptr(armnetwork.WebApplicationFirewallOperatorIPMatch), - // Transforms: []*armnetwork.WebApplicationFirewallTransform{ - // }, - // }}, - // Priority: to.Ptr[int32](1), - // RuleType: to.Ptr(armnetwork.WebApplicationFirewallRuleTypeMatchRule), - // State: to.Ptr(armnetwork.WebApplicationFirewallStateEnabled), - // }, - // { - // Name: to.Ptr("Rule2"), - // Action: to.Ptr(armnetwork.WebApplicationFirewallActionBlock), - // MatchConditions: []*armnetwork.MatchCondition{ - // { - // MatchValues: []*string{ - // to.Ptr("192.168.1.0/24")}, - // MatchVariables: []*armnetwork.MatchVariable{ - // { - // VariableName: to.Ptr(armnetwork.WebApplicationFirewallMatchVariableRemoteAddr), - // }}, - // NegationConditon: to.Ptr(false), - // Operator: to.Ptr(armnetwork.WebApplicationFirewallOperatorIPMatch), - // }, - // { - // MatchValues: []*string{ - // to.Ptr("Windows")}, - // MatchVariables: []*armnetwork.MatchVariable{ - // { - // Selector: to.Ptr("UserAgent"), - // VariableName: to.Ptr(armnetwork.WebApplicationFirewallMatchVariable("RequestHeader")), - // }}, - // NegationConditon: to.Ptr(false), - // Operator: to.Ptr(armnetwork.WebApplicationFirewallOperatorContains), - // }}, - // Priority: to.Ptr[int32](2), - // RuleType: to.Ptr(armnetwork.WebApplicationFirewallRuleTypeMatchRule), - // State: to.Ptr(armnetwork.WebApplicationFirewallStateEnabled), - // }, - // { - // Name: to.Ptr("RateLimitRule3"), - // Action: to.Ptr(armnetwork.WebApplicationFirewallActionBlock), - // GroupByUserSession: []*armnetwork.GroupByUserSession{ - // { - // GroupByVariables: []*armnetwork.GroupByVariable{ - // { - // VariableName: to.Ptr(armnetwork.ApplicationGatewayFirewallUserSessionVariableClientAddr), - // }}, - // }}, - // MatchConditions: []*armnetwork.MatchCondition{ - // { - // MatchValues: []*string{ - // to.Ptr("192.168.1.0/24"), - // to.Ptr("10.0.0.0/24")}, - // MatchVariables: []*armnetwork.MatchVariable{ - // { - // VariableName: to.Ptr(armnetwork.WebApplicationFirewallMatchVariableRemoteAddr), - // }}, - // NegationConditon: to.Ptr(true), - // Operator: to.Ptr(armnetwork.WebApplicationFirewallOperatorIPMatch), - // }}, - // Priority: to.Ptr[int32](3), - // RateLimitDuration: to.Ptr(armnetwork.ApplicationGatewayFirewallRateLimitDurationOneMin), - // RateLimitThreshold: to.Ptr[int32](10), - // RuleType: to.Ptr(armnetwork.WebApplicationFirewallRuleTypeRateLimitRule), - // }, - // { - // Name: to.Ptr("Rule4"), - // Action: to.Ptr(armnetwork.WebApplicationFirewallActionJSChallenge), - // MatchConditions: []*armnetwork.MatchCondition{ - // { - // MatchValues: []*string{ - // to.Ptr("192.168.1.0/24")}, - // MatchVariables: []*armnetwork.MatchVariable{ - // { - // VariableName: to.Ptr(armnetwork.WebApplicationFirewallMatchVariableRemoteAddr), - // }}, - // NegationConditon: to.Ptr(false), - // Operator: to.Ptr(armnetwork.WebApplicationFirewallOperatorIPMatch), - // }, - // { - // MatchValues: []*string{ - // to.Ptr("Bot")}, - // MatchVariables: []*armnetwork.MatchVariable{ - // { - // Selector: to.Ptr("UserAgent"), - // VariableName: to.Ptr(armnetwork.WebApplicationFirewallMatchVariableRequestHeaders), - // }}, - // NegationConditon: to.Ptr(false), - // Operator: to.Ptr(armnetwork.WebApplicationFirewallOperatorContains), - // }}, - // Priority: to.Ptr[int32](4), - // RuleType: to.Ptr(armnetwork.WebApplicationFirewallRuleTypeMatchRule), - // State: to.Ptr(armnetwork.WebApplicationFirewallStateEnabled), - // }}, - // ManagedRules: &armnetwork.ManagedRulesDefinition{ - // Exclusions: []*armnetwork.OwaspCrsExclusionEntry{ - // { - // ExclusionManagedRuleSets: []*armnetwork.ExclusionManagedRuleSet{ - // { - // RuleGroups: []*armnetwork.ExclusionManagedRuleGroup{ - // { - // RuleGroupName: to.Ptr("REQUEST-930-APPLICATION-ATTACK-LFI"), - // Rules: []*armnetwork.ExclusionManagedRule{ - // { - // RuleID: to.Ptr("930120"), - // }}, - // }, - // { - // RuleGroupName: to.Ptr("REQUEST-932-APPLICATION-ATTACK-RCE"), - // }}, - // RuleSetType: to.Ptr("OWASP"), - // RuleSetVersion: to.Ptr("3.2"), - // }}, - // MatchVariable: to.Ptr(armnetwork.OwaspCrsExclusionEntryMatchVariableRequestArgNames), - // Selector: to.Ptr("hello"), - // SelectorMatchOperator: to.Ptr(armnetwork.OwaspCrsExclusionEntrySelectorMatchOperatorStartsWith), - // }, - // { - // ExclusionManagedRuleSets: []*armnetwork.ExclusionManagedRuleSet{ - // { - // RuleGroups: []*armnetwork.ExclusionManagedRuleGroup{ - // }, - // RuleSetType: to.Ptr("OWASP"), - // RuleSetVersion: to.Ptr("3.1"), - // }}, - // MatchVariable: to.Ptr(armnetwork.OwaspCrsExclusionEntryMatchVariableRequestArgNames), - // Selector: to.Ptr("hello"), - // SelectorMatchOperator: to.Ptr(armnetwork.OwaspCrsExclusionEntrySelectorMatchOperatorEndsWith), - // }, - // { - // MatchVariable: to.Ptr(armnetwork.OwaspCrsExclusionEntryMatchVariableRequestArgNames), - // Selector: to.Ptr("test"), - // SelectorMatchOperator: to.Ptr(armnetwork.OwaspCrsExclusionEntrySelectorMatchOperatorStartsWith), - // }, - // { - // MatchVariable: to.Ptr(armnetwork.OwaspCrsExclusionEntryMatchVariableRequestArgValues), - // Selector: to.Ptr("test"), - // SelectorMatchOperator: to.Ptr(armnetwork.OwaspCrsExclusionEntrySelectorMatchOperatorStartsWith), - // }}, - // ManagedRuleSets: []*armnetwork.ManagedRuleSet{ - // { - // RuleGroupOverrides: []*armnetwork.ManagedRuleGroupOverride{ - // { - // RuleGroupName: to.Ptr("REQUEST-931-APPLICATION-ATTACK-RFI"), - // Rules: []*armnetwork.ManagedRuleOverride{ - // { - // Action: to.Ptr(armnetwork.ActionTypeLog), - // RuleID: to.Ptr("931120"), - // State: to.Ptr(armnetwork.ManagedRuleEnabledStateEnabled), - // }, - // { - // Action: to.Ptr(armnetwork.ActionTypeAnomalyScoring), - // RuleID: to.Ptr("931130"), - // State: to.Ptr(armnetwork.ManagedRuleEnabledStateDisabled), - // }}, - // }}, - // RuleSetType: to.Ptr("OWASP"), - // RuleSetVersion: to.Ptr("3.2"), - // }, - // { - // RuleGroupOverrides: []*armnetwork.ManagedRuleGroupOverride{ - // { - // RuleGroupName: to.Ptr("UnknownBots"), - // Rules: []*armnetwork.ManagedRuleOverride{ - // { - // Action: to.Ptr(armnetwork.ActionTypeJSChallenge), - // RuleID: to.Ptr("300700"), - // State: to.Ptr(armnetwork.ManagedRuleEnabledStateEnabled), - // }}, - // }}, - // RuleSetType: to.Ptr("Microsoft_BotManagerRuleSet"), - // RuleSetVersion: to.Ptr("1.0"), - // }, - // { - // RuleGroupOverrides: []*armnetwork.ManagedRuleGroupOverride{ - // { - // RuleGroupName: to.Ptr("ExcessiveRequests"), - // Rules: []*armnetwork.ManagedRuleOverride{ - // { - // Action: to.Ptr(armnetwork.ActionTypeBlock), - // RuleID: to.Ptr("500100"), - // Sensitivity: to.Ptr(armnetwork.SensitivityTypeHigh), - // State: to.Ptr(armnetwork.ManagedRuleEnabledStateEnabled), - // }}, - // }}, - // RuleSetType: to.Ptr("Microsoft_HTTPDDoSRuleSet"), - // RuleSetVersion: to.Ptr("1.0"), - // }}, - // Exceptions: []*armnetwork.ExceptionEntry{ - // { - // ExceptionManagedRuleSets: []*armnetwork.ExclusionManagedRuleSet{ - // { - // RuleSetType: to.Ptr("OWASP"), - // RuleSetVersion: to.Ptr("3.2"), - // }}, - // MatchVariable: to.Ptr(armnetwork.ExceptionEntryMatchVariableRequestURI), - // ValueMatchOperator: to.Ptr(armnetwork.ExceptionEntryValueMatchOperatorContains), - // Values: []*string{ - // to.Ptr("health"), - // to.Ptr("account/images"), - // to.Ptr("default.aspx")}, - // }, - // { - // ExceptionManagedRuleSets: []*armnetwork.ExclusionManagedRuleSet{ - // { - // RuleGroups: []*armnetwork.ExclusionManagedRuleGroup{ - // { - // RuleGroupName: to.Ptr("REQUEST-932-APPLICATION-ATTACK-RCE"), - // }}, - // RuleSetType: to.Ptr("OWASP"), - // RuleSetVersion: to.Ptr("3.2"), - // }}, - // MatchVariable: to.Ptr(armnetwork.ExceptionEntryMatchVariableRequestHeader), - // Selector: to.Ptr("User-Agent"), - // SelectorMatchOperator: to.Ptr(armnetwork.ExceptionEntrySelectorMatchOperatorStartsWith), - // ValueMatchOperator: to.Ptr(armnetwork.ExceptionEntryValueMatchOperatorContains), - // Values: []*string{ - // to.Ptr("Mozilla/5.0"), - // to.Ptr("Chrome/122.0.0.0")}, - // }, - // { - // ExceptionManagedRuleSets: []*armnetwork.ExclusionManagedRuleSet{ - // { - // RuleGroups: []*armnetwork.ExclusionManagedRuleGroup{ - // { - // RuleGroupName: to.Ptr("BadBots"), - // Rules: []*armnetwork.ExclusionManagedRule{ - // { - // RuleID: to.Ptr("100100"), - // }}, - // }}, - // RuleSetType: to.Ptr("Microsoft_BotManagerRuleSet"), - // RuleSetVersion: to.Ptr("1.0"), - // }}, - // MatchVariable: to.Ptr(armnetwork.ExceptionEntryMatchVariableRemoteAddr), - // ValueMatchOperator: to.Ptr(armnetwork.ExceptionEntryValueMatchOperatorIPMatch), - // Values: []*string{ - // to.Ptr("1.2.3.4"), - // to.Ptr("10.0.0.1/6")}, - // }}, - // }, - // PolicySettings: &armnetwork.PolicySettings{ - // CustomBlockResponseBody: to.Ptr("SGVsbG8="), - // CustomBlockResponseStatusCode: to.Ptr[int32](405), - // FileUploadEnforcement: to.Ptr(true), - // FileUploadLimitInMb: to.Ptr[int32](4000), - // JsChallengeCookieExpirationInMins: to.Ptr[int32](100), - // LogScrubbing: &armnetwork.PolicySettingsLogScrubbing{ - // ScrubbingRules: []*armnetwork.WebApplicationFirewallScrubbingRules{ - // { - // MatchVariable: to.Ptr(armnetwork.ScrubbingRuleEntryMatchVariableRequestArgNames), - // Selector: to.Ptr("test"), - // SelectorMatchOperator: to.Ptr(armnetwork.ScrubbingRuleEntryMatchOperatorEquals), - // State: to.Ptr(armnetwork.ScrubbingRuleEntryStateEnabled), - // }, - // { - // MatchVariable: to.Ptr(armnetwork.ScrubbingRuleEntryMatchVariableRequestIPAddress), - // SelectorMatchOperator: to.Ptr(armnetwork.ScrubbingRuleEntryMatchOperatorEqualsAny), - // State: to.Ptr(armnetwork.ScrubbingRuleEntryStateEnabled), - // }}, - // State: to.Ptr(armnetwork.WebApplicationFirewallScrubbingStateEnabled), - // }, - // MaxRequestBodySizeInKb: to.Ptr[int32](2000), - // Mode: to.Ptr(armnetwork.WebApplicationFirewallModeDetection), - // RequestBodyCheck: to.Ptr(true), - // RequestBodyEnforcement: to.Ptr(true), - // RequestBodyInspectLimitInKB: to.Ptr[int32](2000), - // State: to.Ptr(armnetwork.WebApplicationFirewallEnabledStateEnabled), - // }, - // ProvisioningState: to.Ptr(armnetwork.ProvisioningStateSucceeded), - // ResourceState: to.Ptr(armnetwork.WebApplicationFirewallPolicyResourceStateEnabled), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/4883fa5dbf6f2c9093fac8ce334547e9dfac68fa/specification/network/resource-manager/Microsoft.Network/stable/2024-03-01/examples/WafPolicyDelete.json -func ExampleWebApplicationFirewallPoliciesClient_BeginDelete() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armnetwork.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewWebApplicationFirewallPoliciesClient().BeginDelete(ctx, "rg1", "Policy1", nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - _, err = poller.PollUntilDone(ctx, nil) - if err != nil { - log.Fatalf("failed to pull the result: %v", err) - } -} diff --git a/sdk/resourcemanager/network/armnetwork/webcategories_client_example_test.go b/sdk/resourcemanager/network/armnetwork/webcategories_client_example_test.go deleted file mode 100644 index 2fb0c5ca4ef1..000000000000 --- a/sdk/resourcemanager/network/armnetwork/webcategories_client_example_test.go +++ /dev/null @@ -1,84 +0,0 @@ -//go:build go1.18 -// +build go1.18 - -// 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. -// DO NOT EDIT. - -package armnetwork_test - -import ( - "context" - "log" - - "github.com/Azure/azure-sdk-for-go/sdk/azidentity" - "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/network/armnetwork/v6" -) - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/4883fa5dbf6f2c9093fac8ce334547e9dfac68fa/specification/network/resource-manager/Microsoft.Network/stable/2024-03-01/examples/AzureWebCategoryGet.json -func ExampleWebCategoriesClient_Get() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armnetwork.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewWebCategoriesClient().Get(ctx, "Arts", &armnetwork.WebCategoriesClientGetOptions{Expand: nil}) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.AzureWebCategory = armnetwork.AzureWebCategory{ - // Name: to.Ptr("Arts"), - // Type: to.Ptr("Microsoft.Network/azureWebCategories"), - // Etag: to.Ptr("w/\\00000000-0000-0000-0000-000000000000\\"), - // ID: to.Ptr("/subscriptions/4de8428a-4a92-4cea-90ff-b47128b8cab8/providers/Microsoft.Network/azureWebCategories/Arts"), - // Properties: &armnetwork.AzureWebCategoryPropertiesFormat{ - // Group: to.Ptr("General"), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/4883fa5dbf6f2c9093fac8ce334547e9dfac68fa/specification/network/resource-manager/Microsoft.Network/stable/2024-03-01/examples/AzureWebCategoriesListBySubscription.json -func ExampleWebCategoriesClient_NewListBySubscriptionPager() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armnetwork.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := clientFactory.NewWebCategoriesClient().NewListBySubscriptionPager(nil) - for pager.More() { - page, err := pager.NextPage(ctx) - if err != nil { - log.Fatalf("failed to advance page: %v", err) - } - for _, v := range page.Value { - // You could use page here. We use blank identifier for just demo purposes. - _ = v - } - // If the HTTP response code is 200 as defined in example definition, your page structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // page.AzureWebCategoryListResult = armnetwork.AzureWebCategoryListResult{ - // Value: []*armnetwork.AzureWebCategory{ - // { - // Name: to.Ptr("Arts"), - // Type: to.Ptr("Microsoft.Network/azureWebCategories"), - // Etag: to.Ptr("w/\\00000000-0000-0000-0000-000000000000\\"), - // ID: to.Ptr("/subscriptions/4de8428a-4a92-4cea-90ff-b47128b8cab8/providers/Microsoft.Network/azureWebCategories/Arts"), - // Properties: &armnetwork.AzureWebCategoryPropertiesFormat{ - // Group: to.Ptr("General"), - // }, - // }}, - // } - } -}