1package network 2 3// Copyright (c) Microsoft and contributors. All rights reserved. 4// 5// Licensed under the Apache License, Version 2.0 (the "License"); 6// you may not use this file except in compliance with the License. 7// You may obtain a copy of the License at 8// http://www.apache.org/licenses/LICENSE-2.0 9// 10// Unless required by applicable law or agreed to in writing, software 11// distributed under the License is distributed on an "AS IS" BASIS, 12// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13// 14// See the License for the specific language governing permissions and 15// limitations under the License. 16// 17// Code generated by Microsoft (R) AutoRest Code Generator. 18// Changes may cause incorrect behavior and will be lost if the code is regenerated. 19 20import ( 21 "context" 22 "github.com/Azure/go-autorest/autorest" 23 "github.com/Azure/go-autorest/autorest/azure" 24 "github.com/Azure/go-autorest/autorest/validation" 25 "github.com/Azure/go-autorest/tracing" 26 "net/http" 27) 28 29// VirtualNetworkTapsClient is the network Client 30type VirtualNetworkTapsClient struct { 31 BaseClient 32} 33 34// NewVirtualNetworkTapsClient creates an instance of the VirtualNetworkTapsClient client. 35func NewVirtualNetworkTapsClient(subscriptionID string) VirtualNetworkTapsClient { 36 return NewVirtualNetworkTapsClientWithBaseURI(DefaultBaseURI, subscriptionID) 37} 38 39// NewVirtualNetworkTapsClientWithBaseURI creates an instance of the VirtualNetworkTapsClient client using a custom 40// endpoint. Use this when interacting with an Azure cloud that uses a non-standard base URI (sovereign clouds, Azure 41// stack). 42func NewVirtualNetworkTapsClientWithBaseURI(baseURI string, subscriptionID string) VirtualNetworkTapsClient { 43 return VirtualNetworkTapsClient{NewWithBaseURI(baseURI, subscriptionID)} 44} 45 46// CreateOrUpdate creates or updates a Virtual Network Tap. 47// Parameters: 48// resourceGroupName - the name of the resource group. 49// tapName - the name of the virtual network tap. 50// parameters - parameters supplied to the create or update virtual network tap operation. 51func (client VirtualNetworkTapsClient) CreateOrUpdate(ctx context.Context, resourceGroupName string, tapName string, parameters VirtualNetworkTap) (result VirtualNetworkTapsCreateOrUpdateFuture, err error) { 52 if tracing.IsEnabled() { 53 ctx = tracing.StartSpan(ctx, fqdn+"/VirtualNetworkTapsClient.CreateOrUpdate") 54 defer func() { 55 sc := -1 56 if result.Response() != nil { 57 sc = result.Response().StatusCode 58 } 59 tracing.EndSpan(ctx, sc, err) 60 }() 61 } 62 if err := validation.Validate([]validation.Validation{ 63 {TargetValue: parameters, 64 Constraints: []validation.Constraint{{Target: "parameters.VirtualNetworkTapPropertiesFormat", Name: validation.Null, Rule: false, 65 Chain: []validation.Constraint{{Target: "parameters.VirtualNetworkTapPropertiesFormat.DestinationNetworkInterfaceIPConfiguration", Name: validation.Null, Rule: false, 66 Chain: []validation.Constraint{{Target: "parameters.VirtualNetworkTapPropertiesFormat.DestinationNetworkInterfaceIPConfiguration.InterfaceIPConfigurationPropertiesFormat", Name: validation.Null, Rule: false, 67 Chain: []validation.Constraint{{Target: "parameters.VirtualNetworkTapPropertiesFormat.DestinationNetworkInterfaceIPConfiguration.InterfaceIPConfigurationPropertiesFormat.PublicIPAddress", Name: validation.Null, Rule: false, 68 Chain: []validation.Constraint{{Target: "parameters.VirtualNetworkTapPropertiesFormat.DestinationNetworkInterfaceIPConfiguration.InterfaceIPConfigurationPropertiesFormat.PublicIPAddress.PublicIPAddressPropertiesFormat", Name: validation.Null, Rule: false, 69 Chain: []validation.Constraint{{Target: "parameters.VirtualNetworkTapPropertiesFormat.DestinationNetworkInterfaceIPConfiguration.InterfaceIPConfigurationPropertiesFormat.PublicIPAddress.PublicIPAddressPropertiesFormat.IPConfiguration", Name: validation.Null, Rule: false, 70 Chain: []validation.Constraint{{Target: "parameters.VirtualNetworkTapPropertiesFormat.DestinationNetworkInterfaceIPConfiguration.InterfaceIPConfigurationPropertiesFormat.PublicIPAddress.PublicIPAddressPropertiesFormat.IPConfiguration.IPConfigurationPropertiesFormat", Name: validation.Null, Rule: false, 71 Chain: []validation.Constraint{{Target: "parameters.VirtualNetworkTapPropertiesFormat.DestinationNetworkInterfaceIPConfiguration.InterfaceIPConfigurationPropertiesFormat.PublicIPAddress.PublicIPAddressPropertiesFormat.IPConfiguration.IPConfigurationPropertiesFormat.PublicIPAddress", Name: validation.Null, Rule: false, Chain: nil}}}, 72 }}, 73 }}, 74 }}, 75 }}, 76 }}, 77 {Target: "parameters.VirtualNetworkTapPropertiesFormat.DestinationLoadBalancerFrontEndIPConfiguration", Name: validation.Null, Rule: false, 78 Chain: []validation.Constraint{{Target: "parameters.VirtualNetworkTapPropertiesFormat.DestinationLoadBalancerFrontEndIPConfiguration.FrontendIPConfigurationPropertiesFormat", Name: validation.Null, Rule: false, 79 Chain: []validation.Constraint{{Target: "parameters.VirtualNetworkTapPropertiesFormat.DestinationLoadBalancerFrontEndIPConfiguration.FrontendIPConfigurationPropertiesFormat.PublicIPAddress", Name: validation.Null, Rule: false, 80 Chain: []validation.Constraint{{Target: "parameters.VirtualNetworkTapPropertiesFormat.DestinationLoadBalancerFrontEndIPConfiguration.FrontendIPConfigurationPropertiesFormat.PublicIPAddress.PublicIPAddressPropertiesFormat", Name: validation.Null, Rule: false, 81 Chain: []validation.Constraint{{Target: "parameters.VirtualNetworkTapPropertiesFormat.DestinationLoadBalancerFrontEndIPConfiguration.FrontendIPConfigurationPropertiesFormat.PublicIPAddress.PublicIPAddressPropertiesFormat.IPConfiguration", Name: validation.Null, Rule: false, 82 Chain: []validation.Constraint{{Target: "parameters.VirtualNetworkTapPropertiesFormat.DestinationLoadBalancerFrontEndIPConfiguration.FrontendIPConfigurationPropertiesFormat.PublicIPAddress.PublicIPAddressPropertiesFormat.IPConfiguration.IPConfigurationPropertiesFormat", Name: validation.Null, Rule: false, 83 Chain: []validation.Constraint{{Target: "parameters.VirtualNetworkTapPropertiesFormat.DestinationLoadBalancerFrontEndIPConfiguration.FrontendIPConfigurationPropertiesFormat.PublicIPAddress.PublicIPAddressPropertiesFormat.IPConfiguration.IPConfigurationPropertiesFormat.PublicIPAddress", Name: validation.Null, Rule: false, Chain: nil}}}, 84 }}, 85 }}, 86 }}, 87 }}, 88 }}, 89 }}}}}); err != nil { 90 return result, validation.NewError("network.VirtualNetworkTapsClient", "CreateOrUpdate", err.Error()) 91 } 92 93 req, err := client.CreateOrUpdatePreparer(ctx, resourceGroupName, tapName, parameters) 94 if err != nil { 95 err = autorest.NewErrorWithError(err, "network.VirtualNetworkTapsClient", "CreateOrUpdate", nil, "Failure preparing request") 96 return 97 } 98 99 result, err = client.CreateOrUpdateSender(req) 100 if err != nil { 101 err = autorest.NewErrorWithError(err, "network.VirtualNetworkTapsClient", "CreateOrUpdate", result.Response(), "Failure sending request") 102 return 103 } 104 105 return 106} 107 108// CreateOrUpdatePreparer prepares the CreateOrUpdate request. 109func (client VirtualNetworkTapsClient) CreateOrUpdatePreparer(ctx context.Context, resourceGroupName string, tapName string, parameters VirtualNetworkTap) (*http.Request, error) { 110 pathParameters := map[string]interface{}{ 111 "resourceGroupName": autorest.Encode("path", resourceGroupName), 112 "subscriptionId": autorest.Encode("path", client.SubscriptionID), 113 "tapName": autorest.Encode("path", tapName), 114 } 115 116 const APIVersion = "2019-04-01" 117 queryParameters := map[string]interface{}{ 118 "api-version": APIVersion, 119 } 120 121 preparer := autorest.CreatePreparer( 122 autorest.AsContentType("application/json; charset=utf-8"), 123 autorest.AsPut(), 124 autorest.WithBaseURL(client.BaseURI), 125 autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/virtualNetworkTaps/{tapName}", pathParameters), 126 autorest.WithJSON(parameters), 127 autorest.WithQueryParameters(queryParameters)) 128 return preparer.Prepare((&http.Request{}).WithContext(ctx)) 129} 130 131// CreateOrUpdateSender sends the CreateOrUpdate request. The method will close the 132// http.Response Body if it receives an error. 133func (client VirtualNetworkTapsClient) CreateOrUpdateSender(req *http.Request) (future VirtualNetworkTapsCreateOrUpdateFuture, err error) { 134 var resp *http.Response 135 resp, err = client.Send(req, azure.DoRetryWithRegistration(client.Client)) 136 if err != nil { 137 return 138 } 139 future.Future, err = azure.NewFutureFromResponse(resp) 140 return 141} 142 143// CreateOrUpdateResponder handles the response to the CreateOrUpdate request. The method always 144// closes the http.Response Body. 145func (client VirtualNetworkTapsClient) CreateOrUpdateResponder(resp *http.Response) (result VirtualNetworkTap, err error) { 146 err = autorest.Respond( 147 resp, 148 client.ByInspecting(), 149 azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusCreated), 150 autorest.ByUnmarshallingJSON(&result), 151 autorest.ByClosing()) 152 result.Response = autorest.Response{Response: resp} 153 return 154} 155 156// Delete deletes the specified virtual network tap. 157// Parameters: 158// resourceGroupName - the name of the resource group. 159// tapName - the name of the virtual network tap. 160func (client VirtualNetworkTapsClient) Delete(ctx context.Context, resourceGroupName string, tapName string) (result VirtualNetworkTapsDeleteFuture, err error) { 161 if tracing.IsEnabled() { 162 ctx = tracing.StartSpan(ctx, fqdn+"/VirtualNetworkTapsClient.Delete") 163 defer func() { 164 sc := -1 165 if result.Response() != nil { 166 sc = result.Response().StatusCode 167 } 168 tracing.EndSpan(ctx, sc, err) 169 }() 170 } 171 req, err := client.DeletePreparer(ctx, resourceGroupName, tapName) 172 if err != nil { 173 err = autorest.NewErrorWithError(err, "network.VirtualNetworkTapsClient", "Delete", nil, "Failure preparing request") 174 return 175 } 176 177 result, err = client.DeleteSender(req) 178 if err != nil { 179 err = autorest.NewErrorWithError(err, "network.VirtualNetworkTapsClient", "Delete", result.Response(), "Failure sending request") 180 return 181 } 182 183 return 184} 185 186// DeletePreparer prepares the Delete request. 187func (client VirtualNetworkTapsClient) DeletePreparer(ctx context.Context, resourceGroupName string, tapName string) (*http.Request, error) { 188 pathParameters := map[string]interface{}{ 189 "resourceGroupName": autorest.Encode("path", resourceGroupName), 190 "subscriptionId": autorest.Encode("path", client.SubscriptionID), 191 "tapName": autorest.Encode("path", tapName), 192 } 193 194 const APIVersion = "2019-04-01" 195 queryParameters := map[string]interface{}{ 196 "api-version": APIVersion, 197 } 198 199 preparer := autorest.CreatePreparer( 200 autorest.AsDelete(), 201 autorest.WithBaseURL(client.BaseURI), 202 autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/virtualNetworkTaps/{tapName}", pathParameters), 203 autorest.WithQueryParameters(queryParameters)) 204 return preparer.Prepare((&http.Request{}).WithContext(ctx)) 205} 206 207// DeleteSender sends the Delete request. The method will close the 208// http.Response Body if it receives an error. 209func (client VirtualNetworkTapsClient) DeleteSender(req *http.Request) (future VirtualNetworkTapsDeleteFuture, err error) { 210 var resp *http.Response 211 resp, err = client.Send(req, azure.DoRetryWithRegistration(client.Client)) 212 if err != nil { 213 return 214 } 215 future.Future, err = azure.NewFutureFromResponse(resp) 216 return 217} 218 219// DeleteResponder handles the response to the Delete request. The method always 220// closes the http.Response Body. 221func (client VirtualNetworkTapsClient) DeleteResponder(resp *http.Response) (result autorest.Response, err error) { 222 err = autorest.Respond( 223 resp, 224 client.ByInspecting(), 225 azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted, http.StatusNoContent), 226 autorest.ByClosing()) 227 result.Response = resp 228 return 229} 230 231// Get gets information about the specified virtual network tap. 232// Parameters: 233// resourceGroupName - the name of the resource group. 234// tapName - the name of virtual network tap. 235func (client VirtualNetworkTapsClient) Get(ctx context.Context, resourceGroupName string, tapName string) (result VirtualNetworkTap, err error) { 236 if tracing.IsEnabled() { 237 ctx = tracing.StartSpan(ctx, fqdn+"/VirtualNetworkTapsClient.Get") 238 defer func() { 239 sc := -1 240 if result.Response.Response != nil { 241 sc = result.Response.Response.StatusCode 242 } 243 tracing.EndSpan(ctx, sc, err) 244 }() 245 } 246 req, err := client.GetPreparer(ctx, resourceGroupName, tapName) 247 if err != nil { 248 err = autorest.NewErrorWithError(err, "network.VirtualNetworkTapsClient", "Get", nil, "Failure preparing request") 249 return 250 } 251 252 resp, err := client.GetSender(req) 253 if err != nil { 254 result.Response = autorest.Response{Response: resp} 255 err = autorest.NewErrorWithError(err, "network.VirtualNetworkTapsClient", "Get", resp, "Failure sending request") 256 return 257 } 258 259 result, err = client.GetResponder(resp) 260 if err != nil { 261 err = autorest.NewErrorWithError(err, "network.VirtualNetworkTapsClient", "Get", resp, "Failure responding to request") 262 } 263 264 return 265} 266 267// GetPreparer prepares the Get request. 268func (client VirtualNetworkTapsClient) GetPreparer(ctx context.Context, resourceGroupName string, tapName string) (*http.Request, error) { 269 pathParameters := map[string]interface{}{ 270 "resourceGroupName": autorest.Encode("path", resourceGroupName), 271 "subscriptionId": autorest.Encode("path", client.SubscriptionID), 272 "tapName": autorest.Encode("path", tapName), 273 } 274 275 const APIVersion = "2019-04-01" 276 queryParameters := map[string]interface{}{ 277 "api-version": APIVersion, 278 } 279 280 preparer := autorest.CreatePreparer( 281 autorest.AsGet(), 282 autorest.WithBaseURL(client.BaseURI), 283 autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/virtualNetworkTaps/{tapName}", pathParameters), 284 autorest.WithQueryParameters(queryParameters)) 285 return preparer.Prepare((&http.Request{}).WithContext(ctx)) 286} 287 288// GetSender sends the Get request. The method will close the 289// http.Response Body if it receives an error. 290func (client VirtualNetworkTapsClient) GetSender(req *http.Request) (*http.Response, error) { 291 return client.Send(req, azure.DoRetryWithRegistration(client.Client)) 292} 293 294// GetResponder handles the response to the Get request. The method always 295// closes the http.Response Body. 296func (client VirtualNetworkTapsClient) GetResponder(resp *http.Response) (result VirtualNetworkTap, err error) { 297 err = autorest.Respond( 298 resp, 299 client.ByInspecting(), 300 azure.WithErrorUnlessStatusCode(http.StatusOK), 301 autorest.ByUnmarshallingJSON(&result), 302 autorest.ByClosing()) 303 result.Response = autorest.Response{Response: resp} 304 return 305} 306 307// ListAll gets all the VirtualNetworkTaps in a subscription. 308func (client VirtualNetworkTapsClient) ListAll(ctx context.Context) (result VirtualNetworkTapListResultPage, err error) { 309 if tracing.IsEnabled() { 310 ctx = tracing.StartSpan(ctx, fqdn+"/VirtualNetworkTapsClient.ListAll") 311 defer func() { 312 sc := -1 313 if result.vntlr.Response.Response != nil { 314 sc = result.vntlr.Response.Response.StatusCode 315 } 316 tracing.EndSpan(ctx, sc, err) 317 }() 318 } 319 result.fn = client.listAllNextResults 320 req, err := client.ListAllPreparer(ctx) 321 if err != nil { 322 err = autorest.NewErrorWithError(err, "network.VirtualNetworkTapsClient", "ListAll", nil, "Failure preparing request") 323 return 324 } 325 326 resp, err := client.ListAllSender(req) 327 if err != nil { 328 result.vntlr.Response = autorest.Response{Response: resp} 329 err = autorest.NewErrorWithError(err, "network.VirtualNetworkTapsClient", "ListAll", resp, "Failure sending request") 330 return 331 } 332 333 result.vntlr, err = client.ListAllResponder(resp) 334 if err != nil { 335 err = autorest.NewErrorWithError(err, "network.VirtualNetworkTapsClient", "ListAll", resp, "Failure responding to request") 336 } 337 338 return 339} 340 341// ListAllPreparer prepares the ListAll request. 342func (client VirtualNetworkTapsClient) ListAllPreparer(ctx context.Context) (*http.Request, error) { 343 pathParameters := map[string]interface{}{ 344 "subscriptionId": autorest.Encode("path", client.SubscriptionID), 345 } 346 347 const APIVersion = "2019-04-01" 348 queryParameters := map[string]interface{}{ 349 "api-version": APIVersion, 350 } 351 352 preparer := autorest.CreatePreparer( 353 autorest.AsGet(), 354 autorest.WithBaseURL(client.BaseURI), 355 autorest.WithPathParameters("/subscriptions/{subscriptionId}/providers/Microsoft.Network/virtualNetworkTaps", pathParameters), 356 autorest.WithQueryParameters(queryParameters)) 357 return preparer.Prepare((&http.Request{}).WithContext(ctx)) 358} 359 360// ListAllSender sends the ListAll request. The method will close the 361// http.Response Body if it receives an error. 362func (client VirtualNetworkTapsClient) ListAllSender(req *http.Request) (*http.Response, error) { 363 return client.Send(req, azure.DoRetryWithRegistration(client.Client)) 364} 365 366// ListAllResponder handles the response to the ListAll request. The method always 367// closes the http.Response Body. 368func (client VirtualNetworkTapsClient) ListAllResponder(resp *http.Response) (result VirtualNetworkTapListResult, err error) { 369 err = autorest.Respond( 370 resp, 371 client.ByInspecting(), 372 azure.WithErrorUnlessStatusCode(http.StatusOK), 373 autorest.ByUnmarshallingJSON(&result), 374 autorest.ByClosing()) 375 result.Response = autorest.Response{Response: resp} 376 return 377} 378 379// listAllNextResults retrieves the next set of results, if any. 380func (client VirtualNetworkTapsClient) listAllNextResults(ctx context.Context, lastResults VirtualNetworkTapListResult) (result VirtualNetworkTapListResult, err error) { 381 req, err := lastResults.virtualNetworkTapListResultPreparer(ctx) 382 if err != nil { 383 return result, autorest.NewErrorWithError(err, "network.VirtualNetworkTapsClient", "listAllNextResults", nil, "Failure preparing next results request") 384 } 385 if req == nil { 386 return 387 } 388 resp, err := client.ListAllSender(req) 389 if err != nil { 390 result.Response = autorest.Response{Response: resp} 391 return result, autorest.NewErrorWithError(err, "network.VirtualNetworkTapsClient", "listAllNextResults", resp, "Failure sending next results request") 392 } 393 result, err = client.ListAllResponder(resp) 394 if err != nil { 395 err = autorest.NewErrorWithError(err, "network.VirtualNetworkTapsClient", "listAllNextResults", resp, "Failure responding to next results request") 396 } 397 return 398} 399 400// ListAllComplete enumerates all values, automatically crossing page boundaries as required. 401func (client VirtualNetworkTapsClient) ListAllComplete(ctx context.Context) (result VirtualNetworkTapListResultIterator, err error) { 402 if tracing.IsEnabled() { 403 ctx = tracing.StartSpan(ctx, fqdn+"/VirtualNetworkTapsClient.ListAll") 404 defer func() { 405 sc := -1 406 if result.Response().Response.Response != nil { 407 sc = result.page.Response().Response.Response.StatusCode 408 } 409 tracing.EndSpan(ctx, sc, err) 410 }() 411 } 412 result.page, err = client.ListAll(ctx) 413 return 414} 415 416// ListByResourceGroup gets all the VirtualNetworkTaps in a subscription. 417// Parameters: 418// resourceGroupName - the name of the resource group. 419func (client VirtualNetworkTapsClient) ListByResourceGroup(ctx context.Context, resourceGroupName string) (result VirtualNetworkTapListResultPage, err error) { 420 if tracing.IsEnabled() { 421 ctx = tracing.StartSpan(ctx, fqdn+"/VirtualNetworkTapsClient.ListByResourceGroup") 422 defer func() { 423 sc := -1 424 if result.vntlr.Response.Response != nil { 425 sc = result.vntlr.Response.Response.StatusCode 426 } 427 tracing.EndSpan(ctx, sc, err) 428 }() 429 } 430 result.fn = client.listByResourceGroupNextResults 431 req, err := client.ListByResourceGroupPreparer(ctx, resourceGroupName) 432 if err != nil { 433 err = autorest.NewErrorWithError(err, "network.VirtualNetworkTapsClient", "ListByResourceGroup", nil, "Failure preparing request") 434 return 435 } 436 437 resp, err := client.ListByResourceGroupSender(req) 438 if err != nil { 439 result.vntlr.Response = autorest.Response{Response: resp} 440 err = autorest.NewErrorWithError(err, "network.VirtualNetworkTapsClient", "ListByResourceGroup", resp, "Failure sending request") 441 return 442 } 443 444 result.vntlr, err = client.ListByResourceGroupResponder(resp) 445 if err != nil { 446 err = autorest.NewErrorWithError(err, "network.VirtualNetworkTapsClient", "ListByResourceGroup", resp, "Failure responding to request") 447 } 448 449 return 450} 451 452// ListByResourceGroupPreparer prepares the ListByResourceGroup request. 453func (client VirtualNetworkTapsClient) ListByResourceGroupPreparer(ctx context.Context, resourceGroupName string) (*http.Request, error) { 454 pathParameters := map[string]interface{}{ 455 "resourceGroupName": autorest.Encode("path", resourceGroupName), 456 "subscriptionId": autorest.Encode("path", client.SubscriptionID), 457 } 458 459 const APIVersion = "2019-04-01" 460 queryParameters := map[string]interface{}{ 461 "api-version": APIVersion, 462 } 463 464 preparer := autorest.CreatePreparer( 465 autorest.AsGet(), 466 autorest.WithBaseURL(client.BaseURI), 467 autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/virtualNetworkTaps", pathParameters), 468 autorest.WithQueryParameters(queryParameters)) 469 return preparer.Prepare((&http.Request{}).WithContext(ctx)) 470} 471 472// ListByResourceGroupSender sends the ListByResourceGroup request. The method will close the 473// http.Response Body if it receives an error. 474func (client VirtualNetworkTapsClient) ListByResourceGroupSender(req *http.Request) (*http.Response, error) { 475 return client.Send(req, azure.DoRetryWithRegistration(client.Client)) 476} 477 478// ListByResourceGroupResponder handles the response to the ListByResourceGroup request. The method always 479// closes the http.Response Body. 480func (client VirtualNetworkTapsClient) ListByResourceGroupResponder(resp *http.Response) (result VirtualNetworkTapListResult, err error) { 481 err = autorest.Respond( 482 resp, 483 client.ByInspecting(), 484 azure.WithErrorUnlessStatusCode(http.StatusOK), 485 autorest.ByUnmarshallingJSON(&result), 486 autorest.ByClosing()) 487 result.Response = autorest.Response{Response: resp} 488 return 489} 490 491// listByResourceGroupNextResults retrieves the next set of results, if any. 492func (client VirtualNetworkTapsClient) listByResourceGroupNextResults(ctx context.Context, lastResults VirtualNetworkTapListResult) (result VirtualNetworkTapListResult, err error) { 493 req, err := lastResults.virtualNetworkTapListResultPreparer(ctx) 494 if err != nil { 495 return result, autorest.NewErrorWithError(err, "network.VirtualNetworkTapsClient", "listByResourceGroupNextResults", nil, "Failure preparing next results request") 496 } 497 if req == nil { 498 return 499 } 500 resp, err := client.ListByResourceGroupSender(req) 501 if err != nil { 502 result.Response = autorest.Response{Response: resp} 503 return result, autorest.NewErrorWithError(err, "network.VirtualNetworkTapsClient", "listByResourceGroupNextResults", resp, "Failure sending next results request") 504 } 505 result, err = client.ListByResourceGroupResponder(resp) 506 if err != nil { 507 err = autorest.NewErrorWithError(err, "network.VirtualNetworkTapsClient", "listByResourceGroupNextResults", resp, "Failure responding to next results request") 508 } 509 return 510} 511 512// ListByResourceGroupComplete enumerates all values, automatically crossing page boundaries as required. 513func (client VirtualNetworkTapsClient) ListByResourceGroupComplete(ctx context.Context, resourceGroupName string) (result VirtualNetworkTapListResultIterator, err error) { 514 if tracing.IsEnabled() { 515 ctx = tracing.StartSpan(ctx, fqdn+"/VirtualNetworkTapsClient.ListByResourceGroup") 516 defer func() { 517 sc := -1 518 if result.Response().Response.Response != nil { 519 sc = result.page.Response().Response.Response.StatusCode 520 } 521 tracing.EndSpan(ctx, sc, err) 522 }() 523 } 524 result.page, err = client.ListByResourceGroup(ctx, resourceGroupName) 525 return 526} 527 528// UpdateTags updates an VirtualNetworkTap tags. 529// Parameters: 530// resourceGroupName - the name of the resource group. 531// tapName - the name of the tap. 532// tapParameters - parameters supplied to update VirtualNetworkTap tags. 533func (client VirtualNetworkTapsClient) UpdateTags(ctx context.Context, resourceGroupName string, tapName string, tapParameters TagsObject) (result VirtualNetworkTapsUpdateTagsFuture, err error) { 534 if tracing.IsEnabled() { 535 ctx = tracing.StartSpan(ctx, fqdn+"/VirtualNetworkTapsClient.UpdateTags") 536 defer func() { 537 sc := -1 538 if result.Response() != nil { 539 sc = result.Response().StatusCode 540 } 541 tracing.EndSpan(ctx, sc, err) 542 }() 543 } 544 req, err := client.UpdateTagsPreparer(ctx, resourceGroupName, tapName, tapParameters) 545 if err != nil { 546 err = autorest.NewErrorWithError(err, "network.VirtualNetworkTapsClient", "UpdateTags", nil, "Failure preparing request") 547 return 548 } 549 550 result, err = client.UpdateTagsSender(req) 551 if err != nil { 552 err = autorest.NewErrorWithError(err, "network.VirtualNetworkTapsClient", "UpdateTags", result.Response(), "Failure sending request") 553 return 554 } 555 556 return 557} 558 559// UpdateTagsPreparer prepares the UpdateTags request. 560func (client VirtualNetworkTapsClient) UpdateTagsPreparer(ctx context.Context, resourceGroupName string, tapName string, tapParameters TagsObject) (*http.Request, error) { 561 pathParameters := map[string]interface{}{ 562 "resourceGroupName": autorest.Encode("path", resourceGroupName), 563 "subscriptionId": autorest.Encode("path", client.SubscriptionID), 564 "tapName": autorest.Encode("path", tapName), 565 } 566 567 const APIVersion = "2019-04-01" 568 queryParameters := map[string]interface{}{ 569 "api-version": APIVersion, 570 } 571 572 preparer := autorest.CreatePreparer( 573 autorest.AsContentType("application/json; charset=utf-8"), 574 autorest.AsPatch(), 575 autorest.WithBaseURL(client.BaseURI), 576 autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/virtualNetworkTaps/{tapName}", pathParameters), 577 autorest.WithJSON(tapParameters), 578 autorest.WithQueryParameters(queryParameters)) 579 return preparer.Prepare((&http.Request{}).WithContext(ctx)) 580} 581 582// UpdateTagsSender sends the UpdateTags request. The method will close the 583// http.Response Body if it receives an error. 584func (client VirtualNetworkTapsClient) UpdateTagsSender(req *http.Request) (future VirtualNetworkTapsUpdateTagsFuture, err error) { 585 var resp *http.Response 586 resp, err = client.Send(req, azure.DoRetryWithRegistration(client.Client)) 587 if err != nil { 588 return 589 } 590 future.Future, err = azure.NewFutureFromResponse(resp) 591 return 592} 593 594// UpdateTagsResponder handles the response to the UpdateTags request. The method always 595// closes the http.Response Body. 596func (client VirtualNetworkTapsClient) UpdateTagsResponder(resp *http.Response) (result VirtualNetworkTap, err error) { 597 err = autorest.Respond( 598 resp, 599 client.ByInspecting(), 600 azure.WithErrorUnlessStatusCode(http.StatusOK), 601 autorest.ByUnmarshallingJSON(&result), 602 autorest.ByClosing()) 603 result.Response = autorest.Response{Response: resp} 604 return 605} 606