1package network 2 3// Copyright (c) Microsoft Corporation. All rights reserved. 4// Licensed under the MIT License. See License.txt in the project root for license information. 5// 6// Code generated by Microsoft (R) AutoRest Code Generator. 7// Changes may cause incorrect behavior and will be lost if the code is regenerated. 8 9import ( 10 "context" 11 "github.com/Azure/go-autorest/autorest" 12 "github.com/Azure/go-autorest/autorest/azure" 13 "github.com/Azure/go-autorest/autorest/validation" 14 "github.com/Azure/go-autorest/tracing" 15 "net/http" 16) 17 18// WatchersClient is the network Client 19type WatchersClient struct { 20 BaseClient 21} 22 23// NewWatchersClient creates an instance of the WatchersClient client. 24func NewWatchersClient(subscriptionID string) WatchersClient { 25 return NewWatchersClientWithBaseURI(DefaultBaseURI, subscriptionID) 26} 27 28// NewWatchersClientWithBaseURI creates an instance of the WatchersClient client using a custom endpoint. Use this 29// when interacting with an Azure cloud that uses a non-standard base URI (sovereign clouds, Azure stack). 30func NewWatchersClientWithBaseURI(baseURI string, subscriptionID string) WatchersClient { 31 return WatchersClient{NewWithBaseURI(baseURI, subscriptionID)} 32} 33 34// CheckConnectivity verifies the possibility of establishing a direct TCP connection from a virtual machine to a given 35// endpoint including another VM or an arbitrary remote server. 36// Parameters: 37// resourceGroupName - the name of the network watcher resource group. 38// networkWatcherName - the name of the network watcher resource. 39// parameters - parameters that determine how the connectivity check will be performed. 40func (client WatchersClient) CheckConnectivity(ctx context.Context, resourceGroupName string, networkWatcherName string, parameters ConnectivityParameters) (result WatchersCheckConnectivityFuture, err error) { 41 if tracing.IsEnabled() { 42 ctx = tracing.StartSpan(ctx, fqdn+"/WatchersClient.CheckConnectivity") 43 defer func() { 44 sc := -1 45 if result.FutureAPI != nil && result.FutureAPI.Response() != nil { 46 sc = result.FutureAPI.Response().StatusCode 47 } 48 tracing.EndSpan(ctx, sc, err) 49 }() 50 } 51 if err := validation.Validate([]validation.Validation{ 52 {TargetValue: parameters, 53 Constraints: []validation.Constraint{{Target: "parameters.Source", Name: validation.Null, Rule: true, 54 Chain: []validation.Constraint{{Target: "parameters.Source.ResourceID", Name: validation.Null, Rule: true, Chain: nil}}}, 55 {Target: "parameters.Destination", Name: validation.Null, Rule: true, Chain: nil}}}}); err != nil { 56 return result, validation.NewError("network.WatchersClient", "CheckConnectivity", err.Error()) 57 } 58 59 req, err := client.CheckConnectivityPreparer(ctx, resourceGroupName, networkWatcherName, parameters) 60 if err != nil { 61 err = autorest.NewErrorWithError(err, "network.WatchersClient", "CheckConnectivity", nil, "Failure preparing request") 62 return 63 } 64 65 result, err = client.CheckConnectivitySender(req) 66 if err != nil { 67 err = autorest.NewErrorWithError(err, "network.WatchersClient", "CheckConnectivity", nil, "Failure sending request") 68 return 69 } 70 71 return 72} 73 74// CheckConnectivityPreparer prepares the CheckConnectivity request. 75func (client WatchersClient) CheckConnectivityPreparer(ctx context.Context, resourceGroupName string, networkWatcherName string, parameters ConnectivityParameters) (*http.Request, error) { 76 pathParameters := map[string]interface{}{ 77 "networkWatcherName": autorest.Encode("path", networkWatcherName), 78 "resourceGroupName": autorest.Encode("path", resourceGroupName), 79 "subscriptionId": autorest.Encode("path", client.SubscriptionID), 80 } 81 82 const APIVersion = "2018-08-01" 83 queryParameters := map[string]interface{}{ 84 "api-version": APIVersion, 85 } 86 87 preparer := autorest.CreatePreparer( 88 autorest.AsContentType("application/json; charset=utf-8"), 89 autorest.AsPost(), 90 autorest.WithBaseURL(client.BaseURI), 91 autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/networkWatchers/{networkWatcherName}/connectivityCheck", pathParameters), 92 autorest.WithJSON(parameters), 93 autorest.WithQueryParameters(queryParameters)) 94 return preparer.Prepare((&http.Request{}).WithContext(ctx)) 95} 96 97// CheckConnectivitySender sends the CheckConnectivity request. The method will close the 98// http.Response Body if it receives an error. 99func (client WatchersClient) CheckConnectivitySender(req *http.Request) (future WatchersCheckConnectivityFuture, err error) { 100 var resp *http.Response 101 resp, err = client.Send(req, azure.DoRetryWithRegistration(client.Client)) 102 if err != nil { 103 return 104 } 105 var azf azure.Future 106 azf, err = azure.NewFutureFromResponse(resp) 107 future.FutureAPI = &azf 108 future.Result = future.result 109 return 110} 111 112// CheckConnectivityResponder handles the response to the CheckConnectivity request. The method always 113// closes the http.Response Body. 114func (client WatchersClient) CheckConnectivityResponder(resp *http.Response) (result ConnectivityInformation, err error) { 115 err = autorest.Respond( 116 resp, 117 azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted), 118 autorest.ByUnmarshallingJSON(&result), 119 autorest.ByClosing()) 120 result.Response = autorest.Response{Response: resp} 121 return 122} 123 124// CreateOrUpdate creates or updates a network watcher in the specified resource group. 125// Parameters: 126// resourceGroupName - the name of the resource group. 127// networkWatcherName - the name of the network watcher. 128// parameters - parameters that define the network watcher resource. 129func (client WatchersClient) CreateOrUpdate(ctx context.Context, resourceGroupName string, networkWatcherName string, parameters Watcher) (result Watcher, err error) { 130 if tracing.IsEnabled() { 131 ctx = tracing.StartSpan(ctx, fqdn+"/WatchersClient.CreateOrUpdate") 132 defer func() { 133 sc := -1 134 if result.Response.Response != nil { 135 sc = result.Response.Response.StatusCode 136 } 137 tracing.EndSpan(ctx, sc, err) 138 }() 139 } 140 req, err := client.CreateOrUpdatePreparer(ctx, resourceGroupName, networkWatcherName, parameters) 141 if err != nil { 142 err = autorest.NewErrorWithError(err, "network.WatchersClient", "CreateOrUpdate", nil, "Failure preparing request") 143 return 144 } 145 146 resp, err := client.CreateOrUpdateSender(req) 147 if err != nil { 148 result.Response = autorest.Response{Response: resp} 149 err = autorest.NewErrorWithError(err, "network.WatchersClient", "CreateOrUpdate", resp, "Failure sending request") 150 return 151 } 152 153 result, err = client.CreateOrUpdateResponder(resp) 154 if err != nil { 155 err = autorest.NewErrorWithError(err, "network.WatchersClient", "CreateOrUpdate", resp, "Failure responding to request") 156 return 157 } 158 159 return 160} 161 162// CreateOrUpdatePreparer prepares the CreateOrUpdate request. 163func (client WatchersClient) CreateOrUpdatePreparer(ctx context.Context, resourceGroupName string, networkWatcherName string, parameters Watcher) (*http.Request, error) { 164 pathParameters := map[string]interface{}{ 165 "networkWatcherName": autorest.Encode("path", networkWatcherName), 166 "resourceGroupName": autorest.Encode("path", resourceGroupName), 167 "subscriptionId": autorest.Encode("path", client.SubscriptionID), 168 } 169 170 const APIVersion = "2018-08-01" 171 queryParameters := map[string]interface{}{ 172 "api-version": APIVersion, 173 } 174 175 preparer := autorest.CreatePreparer( 176 autorest.AsContentType("application/json; charset=utf-8"), 177 autorest.AsPut(), 178 autorest.WithBaseURL(client.BaseURI), 179 autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/networkWatchers/{networkWatcherName}", pathParameters), 180 autorest.WithJSON(parameters), 181 autorest.WithQueryParameters(queryParameters)) 182 return preparer.Prepare((&http.Request{}).WithContext(ctx)) 183} 184 185// CreateOrUpdateSender sends the CreateOrUpdate request. The method will close the 186// http.Response Body if it receives an error. 187func (client WatchersClient) CreateOrUpdateSender(req *http.Request) (*http.Response, error) { 188 return client.Send(req, azure.DoRetryWithRegistration(client.Client)) 189} 190 191// CreateOrUpdateResponder handles the response to the CreateOrUpdate request. The method always 192// closes the http.Response Body. 193func (client WatchersClient) CreateOrUpdateResponder(resp *http.Response) (result Watcher, err error) { 194 err = autorest.Respond( 195 resp, 196 azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusCreated), 197 autorest.ByUnmarshallingJSON(&result), 198 autorest.ByClosing()) 199 result.Response = autorest.Response{Response: resp} 200 return 201} 202 203// Delete deletes the specified network watcher resource. 204// Parameters: 205// resourceGroupName - the name of the resource group. 206// networkWatcherName - the name of the network watcher. 207func (client WatchersClient) Delete(ctx context.Context, resourceGroupName string, networkWatcherName string) (result WatchersDeleteFuture, err error) { 208 if tracing.IsEnabled() { 209 ctx = tracing.StartSpan(ctx, fqdn+"/WatchersClient.Delete") 210 defer func() { 211 sc := -1 212 if result.FutureAPI != nil && result.FutureAPI.Response() != nil { 213 sc = result.FutureAPI.Response().StatusCode 214 } 215 tracing.EndSpan(ctx, sc, err) 216 }() 217 } 218 req, err := client.DeletePreparer(ctx, resourceGroupName, networkWatcherName) 219 if err != nil { 220 err = autorest.NewErrorWithError(err, "network.WatchersClient", "Delete", nil, "Failure preparing request") 221 return 222 } 223 224 result, err = client.DeleteSender(req) 225 if err != nil { 226 err = autorest.NewErrorWithError(err, "network.WatchersClient", "Delete", nil, "Failure sending request") 227 return 228 } 229 230 return 231} 232 233// DeletePreparer prepares the Delete request. 234func (client WatchersClient) DeletePreparer(ctx context.Context, resourceGroupName string, networkWatcherName string) (*http.Request, error) { 235 pathParameters := map[string]interface{}{ 236 "networkWatcherName": autorest.Encode("path", networkWatcherName), 237 "resourceGroupName": autorest.Encode("path", resourceGroupName), 238 "subscriptionId": autorest.Encode("path", client.SubscriptionID), 239 } 240 241 const APIVersion = "2018-08-01" 242 queryParameters := map[string]interface{}{ 243 "api-version": APIVersion, 244 } 245 246 preparer := autorest.CreatePreparer( 247 autorest.AsDelete(), 248 autorest.WithBaseURL(client.BaseURI), 249 autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/networkWatchers/{networkWatcherName}", pathParameters), 250 autorest.WithQueryParameters(queryParameters)) 251 return preparer.Prepare((&http.Request{}).WithContext(ctx)) 252} 253 254// DeleteSender sends the Delete request. The method will close the 255// http.Response Body if it receives an error. 256func (client WatchersClient) DeleteSender(req *http.Request) (future WatchersDeleteFuture, err error) { 257 var resp *http.Response 258 resp, err = client.Send(req, azure.DoRetryWithRegistration(client.Client)) 259 if err != nil { 260 return 261 } 262 var azf azure.Future 263 azf, err = azure.NewFutureFromResponse(resp) 264 future.FutureAPI = &azf 265 future.Result = future.result 266 return 267} 268 269// DeleteResponder handles the response to the Delete request. The method always 270// closes the http.Response Body. 271func (client WatchersClient) DeleteResponder(resp *http.Response) (result autorest.Response, err error) { 272 err = autorest.Respond( 273 resp, 274 azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted, http.StatusNoContent), 275 autorest.ByClosing()) 276 result.Response = resp 277 return 278} 279 280// Get gets the specified network watcher by resource group. 281// Parameters: 282// resourceGroupName - the name of the resource group. 283// networkWatcherName - the name of the network watcher. 284func (client WatchersClient) Get(ctx context.Context, resourceGroupName string, networkWatcherName string) (result Watcher, err error) { 285 if tracing.IsEnabled() { 286 ctx = tracing.StartSpan(ctx, fqdn+"/WatchersClient.Get") 287 defer func() { 288 sc := -1 289 if result.Response.Response != nil { 290 sc = result.Response.Response.StatusCode 291 } 292 tracing.EndSpan(ctx, sc, err) 293 }() 294 } 295 req, err := client.GetPreparer(ctx, resourceGroupName, networkWatcherName) 296 if err != nil { 297 err = autorest.NewErrorWithError(err, "network.WatchersClient", "Get", nil, "Failure preparing request") 298 return 299 } 300 301 resp, err := client.GetSender(req) 302 if err != nil { 303 result.Response = autorest.Response{Response: resp} 304 err = autorest.NewErrorWithError(err, "network.WatchersClient", "Get", resp, "Failure sending request") 305 return 306 } 307 308 result, err = client.GetResponder(resp) 309 if err != nil { 310 err = autorest.NewErrorWithError(err, "network.WatchersClient", "Get", resp, "Failure responding to request") 311 return 312 } 313 314 return 315} 316 317// GetPreparer prepares the Get request. 318func (client WatchersClient) GetPreparer(ctx context.Context, resourceGroupName string, networkWatcherName string) (*http.Request, error) { 319 pathParameters := map[string]interface{}{ 320 "networkWatcherName": autorest.Encode("path", networkWatcherName), 321 "resourceGroupName": autorest.Encode("path", resourceGroupName), 322 "subscriptionId": autorest.Encode("path", client.SubscriptionID), 323 } 324 325 const APIVersion = "2018-08-01" 326 queryParameters := map[string]interface{}{ 327 "api-version": APIVersion, 328 } 329 330 preparer := autorest.CreatePreparer( 331 autorest.AsGet(), 332 autorest.WithBaseURL(client.BaseURI), 333 autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/networkWatchers/{networkWatcherName}", pathParameters), 334 autorest.WithQueryParameters(queryParameters)) 335 return preparer.Prepare((&http.Request{}).WithContext(ctx)) 336} 337 338// GetSender sends the Get request. The method will close the 339// http.Response Body if it receives an error. 340func (client WatchersClient) GetSender(req *http.Request) (*http.Response, error) { 341 return client.Send(req, azure.DoRetryWithRegistration(client.Client)) 342} 343 344// GetResponder handles the response to the Get request. The method always 345// closes the http.Response Body. 346func (client WatchersClient) GetResponder(resp *http.Response) (result Watcher, err error) { 347 err = autorest.Respond( 348 resp, 349 azure.WithErrorUnlessStatusCode(http.StatusOK), 350 autorest.ByUnmarshallingJSON(&result), 351 autorest.ByClosing()) 352 result.Response = autorest.Response{Response: resp} 353 return 354} 355 356// GetAzureReachabilityReport gets the relative latency score for internet service providers from a specified location 357// to Azure regions. 358// Parameters: 359// resourceGroupName - the name of the network watcher resource group. 360// networkWatcherName - the name of the network watcher resource. 361// parameters - parameters that determine Azure reachability report configuration. 362func (client WatchersClient) GetAzureReachabilityReport(ctx context.Context, resourceGroupName string, networkWatcherName string, parameters AzureReachabilityReportParameters) (result WatchersGetAzureReachabilityReportFuture, err error) { 363 if tracing.IsEnabled() { 364 ctx = tracing.StartSpan(ctx, fqdn+"/WatchersClient.GetAzureReachabilityReport") 365 defer func() { 366 sc := -1 367 if result.FutureAPI != nil && result.FutureAPI.Response() != nil { 368 sc = result.FutureAPI.Response().StatusCode 369 } 370 tracing.EndSpan(ctx, sc, err) 371 }() 372 } 373 if err := validation.Validate([]validation.Validation{ 374 {TargetValue: parameters, 375 Constraints: []validation.Constraint{{Target: "parameters.ProviderLocation", Name: validation.Null, Rule: true, 376 Chain: []validation.Constraint{{Target: "parameters.ProviderLocation.Country", Name: validation.Null, Rule: true, Chain: nil}}}, 377 {Target: "parameters.StartTime", Name: validation.Null, Rule: true, Chain: nil}, 378 {Target: "parameters.EndTime", Name: validation.Null, Rule: true, Chain: nil}}}}); err != nil { 379 return result, validation.NewError("network.WatchersClient", "GetAzureReachabilityReport", err.Error()) 380 } 381 382 req, err := client.GetAzureReachabilityReportPreparer(ctx, resourceGroupName, networkWatcherName, parameters) 383 if err != nil { 384 err = autorest.NewErrorWithError(err, "network.WatchersClient", "GetAzureReachabilityReport", nil, "Failure preparing request") 385 return 386 } 387 388 result, err = client.GetAzureReachabilityReportSender(req) 389 if err != nil { 390 err = autorest.NewErrorWithError(err, "network.WatchersClient", "GetAzureReachabilityReport", nil, "Failure sending request") 391 return 392 } 393 394 return 395} 396 397// GetAzureReachabilityReportPreparer prepares the GetAzureReachabilityReport request. 398func (client WatchersClient) GetAzureReachabilityReportPreparer(ctx context.Context, resourceGroupName string, networkWatcherName string, parameters AzureReachabilityReportParameters) (*http.Request, error) { 399 pathParameters := map[string]interface{}{ 400 "networkWatcherName": autorest.Encode("path", networkWatcherName), 401 "resourceGroupName": autorest.Encode("path", resourceGroupName), 402 "subscriptionId": autorest.Encode("path", client.SubscriptionID), 403 } 404 405 const APIVersion = "2018-08-01" 406 queryParameters := map[string]interface{}{ 407 "api-version": APIVersion, 408 } 409 410 preparer := autorest.CreatePreparer( 411 autorest.AsContentType("application/json; charset=utf-8"), 412 autorest.AsPost(), 413 autorest.WithBaseURL(client.BaseURI), 414 autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/networkWatchers/{networkWatcherName}/azureReachabilityReport", pathParameters), 415 autorest.WithJSON(parameters), 416 autorest.WithQueryParameters(queryParameters)) 417 return preparer.Prepare((&http.Request{}).WithContext(ctx)) 418} 419 420// GetAzureReachabilityReportSender sends the GetAzureReachabilityReport request. The method will close the 421// http.Response Body if it receives an error. 422func (client WatchersClient) GetAzureReachabilityReportSender(req *http.Request) (future WatchersGetAzureReachabilityReportFuture, err error) { 423 var resp *http.Response 424 resp, err = client.Send(req, azure.DoRetryWithRegistration(client.Client)) 425 if err != nil { 426 return 427 } 428 var azf azure.Future 429 azf, err = azure.NewFutureFromResponse(resp) 430 future.FutureAPI = &azf 431 future.Result = future.result 432 return 433} 434 435// GetAzureReachabilityReportResponder handles the response to the GetAzureReachabilityReport request. The method always 436// closes the http.Response Body. 437func (client WatchersClient) GetAzureReachabilityReportResponder(resp *http.Response) (result AzureReachabilityReport, err error) { 438 err = autorest.Respond( 439 resp, 440 azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted), 441 autorest.ByUnmarshallingJSON(&result), 442 autorest.ByClosing()) 443 result.Response = autorest.Response{Response: resp} 444 return 445} 446 447// GetFlowLogStatus queries status of flow log and traffic analytics (optional) on a specified resource. 448// Parameters: 449// resourceGroupName - the name of the network watcher resource group. 450// networkWatcherName - the name of the network watcher resource. 451// parameters - parameters that define a resource to query flow log and traffic analytics (optional) status. 452func (client WatchersClient) GetFlowLogStatus(ctx context.Context, resourceGroupName string, networkWatcherName string, parameters FlowLogStatusParameters) (result WatchersGetFlowLogStatusFuture, err error) { 453 if tracing.IsEnabled() { 454 ctx = tracing.StartSpan(ctx, fqdn+"/WatchersClient.GetFlowLogStatus") 455 defer func() { 456 sc := -1 457 if result.FutureAPI != nil && result.FutureAPI.Response() != nil { 458 sc = result.FutureAPI.Response().StatusCode 459 } 460 tracing.EndSpan(ctx, sc, err) 461 }() 462 } 463 if err := validation.Validate([]validation.Validation{ 464 {TargetValue: parameters, 465 Constraints: []validation.Constraint{{Target: "parameters.TargetResourceID", Name: validation.Null, Rule: true, Chain: nil}}}}); err != nil { 466 return result, validation.NewError("network.WatchersClient", "GetFlowLogStatus", err.Error()) 467 } 468 469 req, err := client.GetFlowLogStatusPreparer(ctx, resourceGroupName, networkWatcherName, parameters) 470 if err != nil { 471 err = autorest.NewErrorWithError(err, "network.WatchersClient", "GetFlowLogStatus", nil, "Failure preparing request") 472 return 473 } 474 475 result, err = client.GetFlowLogStatusSender(req) 476 if err != nil { 477 err = autorest.NewErrorWithError(err, "network.WatchersClient", "GetFlowLogStatus", nil, "Failure sending request") 478 return 479 } 480 481 return 482} 483 484// GetFlowLogStatusPreparer prepares the GetFlowLogStatus request. 485func (client WatchersClient) GetFlowLogStatusPreparer(ctx context.Context, resourceGroupName string, networkWatcherName string, parameters FlowLogStatusParameters) (*http.Request, error) { 486 pathParameters := map[string]interface{}{ 487 "networkWatcherName": autorest.Encode("path", networkWatcherName), 488 "resourceGroupName": autorest.Encode("path", resourceGroupName), 489 "subscriptionId": autorest.Encode("path", client.SubscriptionID), 490 } 491 492 const APIVersion = "2018-08-01" 493 queryParameters := map[string]interface{}{ 494 "api-version": APIVersion, 495 } 496 497 preparer := autorest.CreatePreparer( 498 autorest.AsContentType("application/json; charset=utf-8"), 499 autorest.AsPost(), 500 autorest.WithBaseURL(client.BaseURI), 501 autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/networkWatchers/{networkWatcherName}/queryFlowLogStatus", pathParameters), 502 autorest.WithJSON(parameters), 503 autorest.WithQueryParameters(queryParameters)) 504 return preparer.Prepare((&http.Request{}).WithContext(ctx)) 505} 506 507// GetFlowLogStatusSender sends the GetFlowLogStatus request. The method will close the 508// http.Response Body if it receives an error. 509func (client WatchersClient) GetFlowLogStatusSender(req *http.Request) (future WatchersGetFlowLogStatusFuture, err error) { 510 var resp *http.Response 511 resp, err = client.Send(req, azure.DoRetryWithRegistration(client.Client)) 512 if err != nil { 513 return 514 } 515 var azf azure.Future 516 azf, err = azure.NewFutureFromResponse(resp) 517 future.FutureAPI = &azf 518 future.Result = future.result 519 return 520} 521 522// GetFlowLogStatusResponder handles the response to the GetFlowLogStatus request. The method always 523// closes the http.Response Body. 524func (client WatchersClient) GetFlowLogStatusResponder(resp *http.Response) (result FlowLogInformation, err error) { 525 err = autorest.Respond( 526 resp, 527 azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted), 528 autorest.ByUnmarshallingJSON(&result), 529 autorest.ByClosing()) 530 result.Response = autorest.Response{Response: resp} 531 return 532} 533 534// GetNetworkConfigurationDiagnostic get network configuration diagnostic. 535// Parameters: 536// resourceGroupName - the name of the resource group. 537// networkWatcherName - the name of the network watcher. 538// parameters - parameters to get network configuration diagnostic. 539func (client WatchersClient) GetNetworkConfigurationDiagnostic(ctx context.Context, resourceGroupName string, networkWatcherName string, parameters ConfigurationDiagnosticParameters) (result WatchersGetNetworkConfigurationDiagnosticFuture, err error) { 540 if tracing.IsEnabled() { 541 ctx = tracing.StartSpan(ctx, fqdn+"/WatchersClient.GetNetworkConfigurationDiagnostic") 542 defer func() { 543 sc := -1 544 if result.FutureAPI != nil && result.FutureAPI.Response() != nil { 545 sc = result.FutureAPI.Response().StatusCode 546 } 547 tracing.EndSpan(ctx, sc, err) 548 }() 549 } 550 if err := validation.Validate([]validation.Validation{ 551 {TargetValue: parameters, 552 Constraints: []validation.Constraint{{Target: "parameters.TargetResourceID", Name: validation.Null, Rule: true, Chain: nil}, 553 {Target: "parameters.Profiles", Name: validation.Null, Rule: true, Chain: nil}}}}); err != nil { 554 return result, validation.NewError("network.WatchersClient", "GetNetworkConfigurationDiagnostic", err.Error()) 555 } 556 557 req, err := client.GetNetworkConfigurationDiagnosticPreparer(ctx, resourceGroupName, networkWatcherName, parameters) 558 if err != nil { 559 err = autorest.NewErrorWithError(err, "network.WatchersClient", "GetNetworkConfigurationDiagnostic", nil, "Failure preparing request") 560 return 561 } 562 563 result, err = client.GetNetworkConfigurationDiagnosticSender(req) 564 if err != nil { 565 err = autorest.NewErrorWithError(err, "network.WatchersClient", "GetNetworkConfigurationDiagnostic", nil, "Failure sending request") 566 return 567 } 568 569 return 570} 571 572// GetNetworkConfigurationDiagnosticPreparer prepares the GetNetworkConfigurationDiagnostic request. 573func (client WatchersClient) GetNetworkConfigurationDiagnosticPreparer(ctx context.Context, resourceGroupName string, networkWatcherName string, parameters ConfigurationDiagnosticParameters) (*http.Request, error) { 574 pathParameters := map[string]interface{}{ 575 "networkWatcherName": autorest.Encode("path", networkWatcherName), 576 "resourceGroupName": autorest.Encode("path", resourceGroupName), 577 "subscriptionId": autorest.Encode("path", client.SubscriptionID), 578 } 579 580 const APIVersion = "2018-08-01" 581 queryParameters := map[string]interface{}{ 582 "api-version": APIVersion, 583 } 584 585 preparer := autorest.CreatePreparer( 586 autorest.AsContentType("application/json; charset=utf-8"), 587 autorest.AsPost(), 588 autorest.WithBaseURL(client.BaseURI), 589 autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/networkWatchers/{networkWatcherName}/networkConfigurationDiagnostic", pathParameters), 590 autorest.WithJSON(parameters), 591 autorest.WithQueryParameters(queryParameters)) 592 return preparer.Prepare((&http.Request{}).WithContext(ctx)) 593} 594 595// GetNetworkConfigurationDiagnosticSender sends the GetNetworkConfigurationDiagnostic request. The method will close the 596// http.Response Body if it receives an error. 597func (client WatchersClient) GetNetworkConfigurationDiagnosticSender(req *http.Request) (future WatchersGetNetworkConfigurationDiagnosticFuture, err error) { 598 var resp *http.Response 599 resp, err = client.Send(req, azure.DoRetryWithRegistration(client.Client)) 600 if err != nil { 601 return 602 } 603 var azf azure.Future 604 azf, err = azure.NewFutureFromResponse(resp) 605 future.FutureAPI = &azf 606 future.Result = future.result 607 return 608} 609 610// GetNetworkConfigurationDiagnosticResponder handles the response to the GetNetworkConfigurationDiagnostic request. The method always 611// closes the http.Response Body. 612func (client WatchersClient) GetNetworkConfigurationDiagnosticResponder(resp *http.Response) (result ConfigurationDiagnosticResponse, err error) { 613 err = autorest.Respond( 614 resp, 615 azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted), 616 autorest.ByUnmarshallingJSON(&result), 617 autorest.ByClosing()) 618 result.Response = autorest.Response{Response: resp} 619 return 620} 621 622// GetNextHop gets the next hop from the specified VM. 623// Parameters: 624// resourceGroupName - the name of the resource group. 625// networkWatcherName - the name of the network watcher. 626// parameters - parameters that define the source and destination endpoint. 627func (client WatchersClient) GetNextHop(ctx context.Context, resourceGroupName string, networkWatcherName string, parameters NextHopParameters) (result WatchersGetNextHopFuture, err error) { 628 if tracing.IsEnabled() { 629 ctx = tracing.StartSpan(ctx, fqdn+"/WatchersClient.GetNextHop") 630 defer func() { 631 sc := -1 632 if result.FutureAPI != nil && result.FutureAPI.Response() != nil { 633 sc = result.FutureAPI.Response().StatusCode 634 } 635 tracing.EndSpan(ctx, sc, err) 636 }() 637 } 638 if err := validation.Validate([]validation.Validation{ 639 {TargetValue: parameters, 640 Constraints: []validation.Constraint{{Target: "parameters.TargetResourceID", Name: validation.Null, Rule: true, Chain: nil}, 641 {Target: "parameters.SourceIPAddress", Name: validation.Null, Rule: true, Chain: nil}, 642 {Target: "parameters.DestinationIPAddress", Name: validation.Null, Rule: true, Chain: nil}}}}); err != nil { 643 return result, validation.NewError("network.WatchersClient", "GetNextHop", err.Error()) 644 } 645 646 req, err := client.GetNextHopPreparer(ctx, resourceGroupName, networkWatcherName, parameters) 647 if err != nil { 648 err = autorest.NewErrorWithError(err, "network.WatchersClient", "GetNextHop", nil, "Failure preparing request") 649 return 650 } 651 652 result, err = client.GetNextHopSender(req) 653 if err != nil { 654 err = autorest.NewErrorWithError(err, "network.WatchersClient", "GetNextHop", nil, "Failure sending request") 655 return 656 } 657 658 return 659} 660 661// GetNextHopPreparer prepares the GetNextHop request. 662func (client WatchersClient) GetNextHopPreparer(ctx context.Context, resourceGroupName string, networkWatcherName string, parameters NextHopParameters) (*http.Request, error) { 663 pathParameters := map[string]interface{}{ 664 "networkWatcherName": autorest.Encode("path", networkWatcherName), 665 "resourceGroupName": autorest.Encode("path", resourceGroupName), 666 "subscriptionId": autorest.Encode("path", client.SubscriptionID), 667 } 668 669 const APIVersion = "2018-08-01" 670 queryParameters := map[string]interface{}{ 671 "api-version": APIVersion, 672 } 673 674 preparer := autorest.CreatePreparer( 675 autorest.AsContentType("application/json; charset=utf-8"), 676 autorest.AsPost(), 677 autorest.WithBaseURL(client.BaseURI), 678 autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/networkWatchers/{networkWatcherName}/nextHop", pathParameters), 679 autorest.WithJSON(parameters), 680 autorest.WithQueryParameters(queryParameters)) 681 return preparer.Prepare((&http.Request{}).WithContext(ctx)) 682} 683 684// GetNextHopSender sends the GetNextHop request. The method will close the 685// http.Response Body if it receives an error. 686func (client WatchersClient) GetNextHopSender(req *http.Request) (future WatchersGetNextHopFuture, err error) { 687 var resp *http.Response 688 resp, err = client.Send(req, azure.DoRetryWithRegistration(client.Client)) 689 if err != nil { 690 return 691 } 692 var azf azure.Future 693 azf, err = azure.NewFutureFromResponse(resp) 694 future.FutureAPI = &azf 695 future.Result = future.result 696 return 697} 698 699// GetNextHopResponder handles the response to the GetNextHop request. The method always 700// closes the http.Response Body. 701func (client WatchersClient) GetNextHopResponder(resp *http.Response) (result NextHopResult, err error) { 702 err = autorest.Respond( 703 resp, 704 azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted), 705 autorest.ByUnmarshallingJSON(&result), 706 autorest.ByClosing()) 707 result.Response = autorest.Response{Response: resp} 708 return 709} 710 711// GetTopology gets the current network topology by resource group. 712// Parameters: 713// resourceGroupName - the name of the resource group. 714// networkWatcherName - the name of the network watcher. 715// parameters - parameters that define the representation of topology. 716func (client WatchersClient) GetTopology(ctx context.Context, resourceGroupName string, networkWatcherName string, parameters TopologyParameters) (result Topology, err error) { 717 if tracing.IsEnabled() { 718 ctx = tracing.StartSpan(ctx, fqdn+"/WatchersClient.GetTopology") 719 defer func() { 720 sc := -1 721 if result.Response.Response != nil { 722 sc = result.Response.Response.StatusCode 723 } 724 tracing.EndSpan(ctx, sc, err) 725 }() 726 } 727 req, err := client.GetTopologyPreparer(ctx, resourceGroupName, networkWatcherName, parameters) 728 if err != nil { 729 err = autorest.NewErrorWithError(err, "network.WatchersClient", "GetTopology", nil, "Failure preparing request") 730 return 731 } 732 733 resp, err := client.GetTopologySender(req) 734 if err != nil { 735 result.Response = autorest.Response{Response: resp} 736 err = autorest.NewErrorWithError(err, "network.WatchersClient", "GetTopology", resp, "Failure sending request") 737 return 738 } 739 740 result, err = client.GetTopologyResponder(resp) 741 if err != nil { 742 err = autorest.NewErrorWithError(err, "network.WatchersClient", "GetTopology", resp, "Failure responding to request") 743 return 744 } 745 746 return 747} 748 749// GetTopologyPreparer prepares the GetTopology request. 750func (client WatchersClient) GetTopologyPreparer(ctx context.Context, resourceGroupName string, networkWatcherName string, parameters TopologyParameters) (*http.Request, error) { 751 pathParameters := map[string]interface{}{ 752 "networkWatcherName": autorest.Encode("path", networkWatcherName), 753 "resourceGroupName": autorest.Encode("path", resourceGroupName), 754 "subscriptionId": autorest.Encode("path", client.SubscriptionID), 755 } 756 757 const APIVersion = "2018-08-01" 758 queryParameters := map[string]interface{}{ 759 "api-version": APIVersion, 760 } 761 762 preparer := autorest.CreatePreparer( 763 autorest.AsContentType("application/json; charset=utf-8"), 764 autorest.AsPost(), 765 autorest.WithBaseURL(client.BaseURI), 766 autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/networkWatchers/{networkWatcherName}/topology", pathParameters), 767 autorest.WithJSON(parameters), 768 autorest.WithQueryParameters(queryParameters)) 769 return preparer.Prepare((&http.Request{}).WithContext(ctx)) 770} 771 772// GetTopologySender sends the GetTopology request. The method will close the 773// http.Response Body if it receives an error. 774func (client WatchersClient) GetTopologySender(req *http.Request) (*http.Response, error) { 775 return client.Send(req, azure.DoRetryWithRegistration(client.Client)) 776} 777 778// GetTopologyResponder handles the response to the GetTopology request. The method always 779// closes the http.Response Body. 780func (client WatchersClient) GetTopologyResponder(resp *http.Response) (result Topology, err error) { 781 err = autorest.Respond( 782 resp, 783 azure.WithErrorUnlessStatusCode(http.StatusOK), 784 autorest.ByUnmarshallingJSON(&result), 785 autorest.ByClosing()) 786 result.Response = autorest.Response{Response: resp} 787 return 788} 789 790// GetTroubleshooting initiate troubleshooting on a specified resource 791// Parameters: 792// resourceGroupName - the name of the resource group. 793// networkWatcherName - the name of the network watcher resource. 794// parameters - parameters that define the resource to troubleshoot. 795func (client WatchersClient) GetTroubleshooting(ctx context.Context, resourceGroupName string, networkWatcherName string, parameters TroubleshootingParameters) (result WatchersGetTroubleshootingFuture, err error) { 796 if tracing.IsEnabled() { 797 ctx = tracing.StartSpan(ctx, fqdn+"/WatchersClient.GetTroubleshooting") 798 defer func() { 799 sc := -1 800 if result.FutureAPI != nil && result.FutureAPI.Response() != nil { 801 sc = result.FutureAPI.Response().StatusCode 802 } 803 tracing.EndSpan(ctx, sc, err) 804 }() 805 } 806 if err := validation.Validate([]validation.Validation{ 807 {TargetValue: parameters, 808 Constraints: []validation.Constraint{{Target: "parameters.TargetResourceID", Name: validation.Null, Rule: true, Chain: nil}, 809 {Target: "parameters.TroubleshootingProperties", Name: validation.Null, Rule: true, 810 Chain: []validation.Constraint{{Target: "parameters.TroubleshootingProperties.StorageID", Name: validation.Null, Rule: true, Chain: nil}, 811 {Target: "parameters.TroubleshootingProperties.StoragePath", Name: validation.Null, Rule: true, Chain: nil}, 812 }}}}}); err != nil { 813 return result, validation.NewError("network.WatchersClient", "GetTroubleshooting", err.Error()) 814 } 815 816 req, err := client.GetTroubleshootingPreparer(ctx, resourceGroupName, networkWatcherName, parameters) 817 if err != nil { 818 err = autorest.NewErrorWithError(err, "network.WatchersClient", "GetTroubleshooting", nil, "Failure preparing request") 819 return 820 } 821 822 result, err = client.GetTroubleshootingSender(req) 823 if err != nil { 824 err = autorest.NewErrorWithError(err, "network.WatchersClient", "GetTroubleshooting", nil, "Failure sending request") 825 return 826 } 827 828 return 829} 830 831// GetTroubleshootingPreparer prepares the GetTroubleshooting request. 832func (client WatchersClient) GetTroubleshootingPreparer(ctx context.Context, resourceGroupName string, networkWatcherName string, parameters TroubleshootingParameters) (*http.Request, error) { 833 pathParameters := map[string]interface{}{ 834 "networkWatcherName": autorest.Encode("path", networkWatcherName), 835 "resourceGroupName": autorest.Encode("path", resourceGroupName), 836 "subscriptionId": autorest.Encode("path", client.SubscriptionID), 837 } 838 839 const APIVersion = "2018-08-01" 840 queryParameters := map[string]interface{}{ 841 "api-version": APIVersion, 842 } 843 844 preparer := autorest.CreatePreparer( 845 autorest.AsContentType("application/json; charset=utf-8"), 846 autorest.AsPost(), 847 autorest.WithBaseURL(client.BaseURI), 848 autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/networkWatchers/{networkWatcherName}/troubleshoot", pathParameters), 849 autorest.WithJSON(parameters), 850 autorest.WithQueryParameters(queryParameters)) 851 return preparer.Prepare((&http.Request{}).WithContext(ctx)) 852} 853 854// GetTroubleshootingSender sends the GetTroubleshooting request. The method will close the 855// http.Response Body if it receives an error. 856func (client WatchersClient) GetTroubleshootingSender(req *http.Request) (future WatchersGetTroubleshootingFuture, err error) { 857 var resp *http.Response 858 resp, err = client.Send(req, azure.DoRetryWithRegistration(client.Client)) 859 if err != nil { 860 return 861 } 862 var azf azure.Future 863 azf, err = azure.NewFutureFromResponse(resp) 864 future.FutureAPI = &azf 865 future.Result = future.result 866 return 867} 868 869// GetTroubleshootingResponder handles the response to the GetTroubleshooting request. The method always 870// closes the http.Response Body. 871func (client WatchersClient) GetTroubleshootingResponder(resp *http.Response) (result TroubleshootingResult, err error) { 872 err = autorest.Respond( 873 resp, 874 azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted), 875 autorest.ByUnmarshallingJSON(&result), 876 autorest.ByClosing()) 877 result.Response = autorest.Response{Response: resp} 878 return 879} 880 881// GetTroubleshootingResult get the last completed troubleshooting result on a specified resource 882// Parameters: 883// resourceGroupName - the name of the resource group. 884// networkWatcherName - the name of the network watcher resource. 885// parameters - parameters that define the resource to query the troubleshooting result. 886func (client WatchersClient) GetTroubleshootingResult(ctx context.Context, resourceGroupName string, networkWatcherName string, parameters QueryTroubleshootingParameters) (result WatchersGetTroubleshootingResultFuture, err error) { 887 if tracing.IsEnabled() { 888 ctx = tracing.StartSpan(ctx, fqdn+"/WatchersClient.GetTroubleshootingResult") 889 defer func() { 890 sc := -1 891 if result.FutureAPI != nil && result.FutureAPI.Response() != nil { 892 sc = result.FutureAPI.Response().StatusCode 893 } 894 tracing.EndSpan(ctx, sc, err) 895 }() 896 } 897 if err := validation.Validate([]validation.Validation{ 898 {TargetValue: parameters, 899 Constraints: []validation.Constraint{{Target: "parameters.TargetResourceID", Name: validation.Null, Rule: true, Chain: nil}}}}); err != nil { 900 return result, validation.NewError("network.WatchersClient", "GetTroubleshootingResult", err.Error()) 901 } 902 903 req, err := client.GetTroubleshootingResultPreparer(ctx, resourceGroupName, networkWatcherName, parameters) 904 if err != nil { 905 err = autorest.NewErrorWithError(err, "network.WatchersClient", "GetTroubleshootingResult", nil, "Failure preparing request") 906 return 907 } 908 909 result, err = client.GetTroubleshootingResultSender(req) 910 if err != nil { 911 err = autorest.NewErrorWithError(err, "network.WatchersClient", "GetTroubleshootingResult", nil, "Failure sending request") 912 return 913 } 914 915 return 916} 917 918// GetTroubleshootingResultPreparer prepares the GetTroubleshootingResult request. 919func (client WatchersClient) GetTroubleshootingResultPreparer(ctx context.Context, resourceGroupName string, networkWatcherName string, parameters QueryTroubleshootingParameters) (*http.Request, error) { 920 pathParameters := map[string]interface{}{ 921 "networkWatcherName": autorest.Encode("path", networkWatcherName), 922 "resourceGroupName": autorest.Encode("path", resourceGroupName), 923 "subscriptionId": autorest.Encode("path", client.SubscriptionID), 924 } 925 926 const APIVersion = "2018-08-01" 927 queryParameters := map[string]interface{}{ 928 "api-version": APIVersion, 929 } 930 931 preparer := autorest.CreatePreparer( 932 autorest.AsContentType("application/json; charset=utf-8"), 933 autorest.AsPost(), 934 autorest.WithBaseURL(client.BaseURI), 935 autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/networkWatchers/{networkWatcherName}/queryTroubleshootResult", pathParameters), 936 autorest.WithJSON(parameters), 937 autorest.WithQueryParameters(queryParameters)) 938 return preparer.Prepare((&http.Request{}).WithContext(ctx)) 939} 940 941// GetTroubleshootingResultSender sends the GetTroubleshootingResult request. The method will close the 942// http.Response Body if it receives an error. 943func (client WatchersClient) GetTroubleshootingResultSender(req *http.Request) (future WatchersGetTroubleshootingResultFuture, err error) { 944 var resp *http.Response 945 resp, err = client.Send(req, azure.DoRetryWithRegistration(client.Client)) 946 if err != nil { 947 return 948 } 949 var azf azure.Future 950 azf, err = azure.NewFutureFromResponse(resp) 951 future.FutureAPI = &azf 952 future.Result = future.result 953 return 954} 955 956// GetTroubleshootingResultResponder handles the response to the GetTroubleshootingResult request. The method always 957// closes the http.Response Body. 958func (client WatchersClient) GetTroubleshootingResultResponder(resp *http.Response) (result TroubleshootingResult, err error) { 959 err = autorest.Respond( 960 resp, 961 azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted), 962 autorest.ByUnmarshallingJSON(&result), 963 autorest.ByClosing()) 964 result.Response = autorest.Response{Response: resp} 965 return 966} 967 968// GetVMSecurityRules gets the configured and effective security group rules on the specified VM. 969// Parameters: 970// resourceGroupName - the name of the resource group. 971// networkWatcherName - the name of the network watcher. 972// parameters - parameters that define the VM to check security groups for. 973func (client WatchersClient) GetVMSecurityRules(ctx context.Context, resourceGroupName string, networkWatcherName string, parameters SecurityGroupViewParameters) (result WatchersGetVMSecurityRulesFuture, err error) { 974 if tracing.IsEnabled() { 975 ctx = tracing.StartSpan(ctx, fqdn+"/WatchersClient.GetVMSecurityRules") 976 defer func() { 977 sc := -1 978 if result.FutureAPI != nil && result.FutureAPI.Response() != nil { 979 sc = result.FutureAPI.Response().StatusCode 980 } 981 tracing.EndSpan(ctx, sc, err) 982 }() 983 } 984 if err := validation.Validate([]validation.Validation{ 985 {TargetValue: parameters, 986 Constraints: []validation.Constraint{{Target: "parameters.TargetResourceID", Name: validation.Null, Rule: true, Chain: nil}}}}); err != nil { 987 return result, validation.NewError("network.WatchersClient", "GetVMSecurityRules", err.Error()) 988 } 989 990 req, err := client.GetVMSecurityRulesPreparer(ctx, resourceGroupName, networkWatcherName, parameters) 991 if err != nil { 992 err = autorest.NewErrorWithError(err, "network.WatchersClient", "GetVMSecurityRules", nil, "Failure preparing request") 993 return 994 } 995 996 result, err = client.GetVMSecurityRulesSender(req) 997 if err != nil { 998 err = autorest.NewErrorWithError(err, "network.WatchersClient", "GetVMSecurityRules", nil, "Failure sending request") 999 return 1000 } 1001 1002 return 1003} 1004 1005// GetVMSecurityRulesPreparer prepares the GetVMSecurityRules request. 1006func (client WatchersClient) GetVMSecurityRulesPreparer(ctx context.Context, resourceGroupName string, networkWatcherName string, parameters SecurityGroupViewParameters) (*http.Request, error) { 1007 pathParameters := map[string]interface{}{ 1008 "networkWatcherName": autorest.Encode("path", networkWatcherName), 1009 "resourceGroupName": autorest.Encode("path", resourceGroupName), 1010 "subscriptionId": autorest.Encode("path", client.SubscriptionID), 1011 } 1012 1013 const APIVersion = "2018-08-01" 1014 queryParameters := map[string]interface{}{ 1015 "api-version": APIVersion, 1016 } 1017 1018 preparer := autorest.CreatePreparer( 1019 autorest.AsContentType("application/json; charset=utf-8"), 1020 autorest.AsPost(), 1021 autorest.WithBaseURL(client.BaseURI), 1022 autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/networkWatchers/{networkWatcherName}/securityGroupView", pathParameters), 1023 autorest.WithJSON(parameters), 1024 autorest.WithQueryParameters(queryParameters)) 1025 return preparer.Prepare((&http.Request{}).WithContext(ctx)) 1026} 1027 1028// GetVMSecurityRulesSender sends the GetVMSecurityRules request. The method will close the 1029// http.Response Body if it receives an error. 1030func (client WatchersClient) GetVMSecurityRulesSender(req *http.Request) (future WatchersGetVMSecurityRulesFuture, err error) { 1031 var resp *http.Response 1032 resp, err = client.Send(req, azure.DoRetryWithRegistration(client.Client)) 1033 if err != nil { 1034 return 1035 } 1036 var azf azure.Future 1037 azf, err = azure.NewFutureFromResponse(resp) 1038 future.FutureAPI = &azf 1039 future.Result = future.result 1040 return 1041} 1042 1043// GetVMSecurityRulesResponder handles the response to the GetVMSecurityRules request. The method always 1044// closes the http.Response Body. 1045func (client WatchersClient) GetVMSecurityRulesResponder(resp *http.Response) (result SecurityGroupViewResult, err error) { 1046 err = autorest.Respond( 1047 resp, 1048 azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted), 1049 autorest.ByUnmarshallingJSON(&result), 1050 autorest.ByClosing()) 1051 result.Response = autorest.Response{Response: resp} 1052 return 1053} 1054 1055// List gets all network watchers by resource group. 1056// Parameters: 1057// resourceGroupName - the name of the resource group. 1058func (client WatchersClient) List(ctx context.Context, resourceGroupName string) (result WatcherListResult, err error) { 1059 if tracing.IsEnabled() { 1060 ctx = tracing.StartSpan(ctx, fqdn+"/WatchersClient.List") 1061 defer func() { 1062 sc := -1 1063 if result.Response.Response != nil { 1064 sc = result.Response.Response.StatusCode 1065 } 1066 tracing.EndSpan(ctx, sc, err) 1067 }() 1068 } 1069 req, err := client.ListPreparer(ctx, resourceGroupName) 1070 if err != nil { 1071 err = autorest.NewErrorWithError(err, "network.WatchersClient", "List", nil, "Failure preparing request") 1072 return 1073 } 1074 1075 resp, err := client.ListSender(req) 1076 if err != nil { 1077 result.Response = autorest.Response{Response: resp} 1078 err = autorest.NewErrorWithError(err, "network.WatchersClient", "List", resp, "Failure sending request") 1079 return 1080 } 1081 1082 result, err = client.ListResponder(resp) 1083 if err != nil { 1084 err = autorest.NewErrorWithError(err, "network.WatchersClient", "List", resp, "Failure responding to request") 1085 return 1086 } 1087 1088 return 1089} 1090 1091// ListPreparer prepares the List request. 1092func (client WatchersClient) ListPreparer(ctx context.Context, resourceGroupName string) (*http.Request, error) { 1093 pathParameters := map[string]interface{}{ 1094 "resourceGroupName": autorest.Encode("path", resourceGroupName), 1095 "subscriptionId": autorest.Encode("path", client.SubscriptionID), 1096 } 1097 1098 const APIVersion = "2018-08-01" 1099 queryParameters := map[string]interface{}{ 1100 "api-version": APIVersion, 1101 } 1102 1103 preparer := autorest.CreatePreparer( 1104 autorest.AsGet(), 1105 autorest.WithBaseURL(client.BaseURI), 1106 autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/networkWatchers", pathParameters), 1107 autorest.WithQueryParameters(queryParameters)) 1108 return preparer.Prepare((&http.Request{}).WithContext(ctx)) 1109} 1110 1111// ListSender sends the List request. The method will close the 1112// http.Response Body if it receives an error. 1113func (client WatchersClient) ListSender(req *http.Request) (*http.Response, error) { 1114 return client.Send(req, azure.DoRetryWithRegistration(client.Client)) 1115} 1116 1117// ListResponder handles the response to the List request. The method always 1118// closes the http.Response Body. 1119func (client WatchersClient) ListResponder(resp *http.Response) (result WatcherListResult, err error) { 1120 err = autorest.Respond( 1121 resp, 1122 azure.WithErrorUnlessStatusCode(http.StatusOK), 1123 autorest.ByUnmarshallingJSON(&result), 1124 autorest.ByClosing()) 1125 result.Response = autorest.Response{Response: resp} 1126 return 1127} 1128 1129// ListAll gets all network watchers by subscription. 1130func (client WatchersClient) ListAll(ctx context.Context) (result WatcherListResult, err error) { 1131 if tracing.IsEnabled() { 1132 ctx = tracing.StartSpan(ctx, fqdn+"/WatchersClient.ListAll") 1133 defer func() { 1134 sc := -1 1135 if result.Response.Response != nil { 1136 sc = result.Response.Response.StatusCode 1137 } 1138 tracing.EndSpan(ctx, sc, err) 1139 }() 1140 } 1141 req, err := client.ListAllPreparer(ctx) 1142 if err != nil { 1143 err = autorest.NewErrorWithError(err, "network.WatchersClient", "ListAll", nil, "Failure preparing request") 1144 return 1145 } 1146 1147 resp, err := client.ListAllSender(req) 1148 if err != nil { 1149 result.Response = autorest.Response{Response: resp} 1150 err = autorest.NewErrorWithError(err, "network.WatchersClient", "ListAll", resp, "Failure sending request") 1151 return 1152 } 1153 1154 result, err = client.ListAllResponder(resp) 1155 if err != nil { 1156 err = autorest.NewErrorWithError(err, "network.WatchersClient", "ListAll", resp, "Failure responding to request") 1157 return 1158 } 1159 1160 return 1161} 1162 1163// ListAllPreparer prepares the ListAll request. 1164func (client WatchersClient) ListAllPreparer(ctx context.Context) (*http.Request, error) { 1165 pathParameters := map[string]interface{}{ 1166 "subscriptionId": autorest.Encode("path", client.SubscriptionID), 1167 } 1168 1169 const APIVersion = "2018-08-01" 1170 queryParameters := map[string]interface{}{ 1171 "api-version": APIVersion, 1172 } 1173 1174 preparer := autorest.CreatePreparer( 1175 autorest.AsGet(), 1176 autorest.WithBaseURL(client.BaseURI), 1177 autorest.WithPathParameters("/subscriptions/{subscriptionId}/providers/Microsoft.Network/networkWatchers", pathParameters), 1178 autorest.WithQueryParameters(queryParameters)) 1179 return preparer.Prepare((&http.Request{}).WithContext(ctx)) 1180} 1181 1182// ListAllSender sends the ListAll request. The method will close the 1183// http.Response Body if it receives an error. 1184func (client WatchersClient) ListAllSender(req *http.Request) (*http.Response, error) { 1185 return client.Send(req, azure.DoRetryWithRegistration(client.Client)) 1186} 1187 1188// ListAllResponder handles the response to the ListAll request. The method always 1189// closes the http.Response Body. 1190func (client WatchersClient) ListAllResponder(resp *http.Response) (result WatcherListResult, err error) { 1191 err = autorest.Respond( 1192 resp, 1193 azure.WithErrorUnlessStatusCode(http.StatusOK), 1194 autorest.ByUnmarshallingJSON(&result), 1195 autorest.ByClosing()) 1196 result.Response = autorest.Response{Response: resp} 1197 return 1198} 1199 1200// ListAvailableProviders lists all available internet service providers for a specified Azure region. 1201// Parameters: 1202// resourceGroupName - the name of the network watcher resource group. 1203// networkWatcherName - the name of the network watcher resource. 1204// parameters - parameters that scope the list of available providers. 1205func (client WatchersClient) ListAvailableProviders(ctx context.Context, resourceGroupName string, networkWatcherName string, parameters AvailableProvidersListParameters) (result WatchersListAvailableProvidersFuture, err error) { 1206 if tracing.IsEnabled() { 1207 ctx = tracing.StartSpan(ctx, fqdn+"/WatchersClient.ListAvailableProviders") 1208 defer func() { 1209 sc := -1 1210 if result.FutureAPI != nil && result.FutureAPI.Response() != nil { 1211 sc = result.FutureAPI.Response().StatusCode 1212 } 1213 tracing.EndSpan(ctx, sc, err) 1214 }() 1215 } 1216 req, err := client.ListAvailableProvidersPreparer(ctx, resourceGroupName, networkWatcherName, parameters) 1217 if err != nil { 1218 err = autorest.NewErrorWithError(err, "network.WatchersClient", "ListAvailableProviders", nil, "Failure preparing request") 1219 return 1220 } 1221 1222 result, err = client.ListAvailableProvidersSender(req) 1223 if err != nil { 1224 err = autorest.NewErrorWithError(err, "network.WatchersClient", "ListAvailableProviders", nil, "Failure sending request") 1225 return 1226 } 1227 1228 return 1229} 1230 1231// ListAvailableProvidersPreparer prepares the ListAvailableProviders request. 1232func (client WatchersClient) ListAvailableProvidersPreparer(ctx context.Context, resourceGroupName string, networkWatcherName string, parameters AvailableProvidersListParameters) (*http.Request, error) { 1233 pathParameters := map[string]interface{}{ 1234 "networkWatcherName": autorest.Encode("path", networkWatcherName), 1235 "resourceGroupName": autorest.Encode("path", resourceGroupName), 1236 "subscriptionId": autorest.Encode("path", client.SubscriptionID), 1237 } 1238 1239 const APIVersion = "2018-08-01" 1240 queryParameters := map[string]interface{}{ 1241 "api-version": APIVersion, 1242 } 1243 1244 preparer := autorest.CreatePreparer( 1245 autorest.AsContentType("application/json; charset=utf-8"), 1246 autorest.AsPost(), 1247 autorest.WithBaseURL(client.BaseURI), 1248 autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/networkWatchers/{networkWatcherName}/availableProvidersList", pathParameters), 1249 autorest.WithJSON(parameters), 1250 autorest.WithQueryParameters(queryParameters)) 1251 return preparer.Prepare((&http.Request{}).WithContext(ctx)) 1252} 1253 1254// ListAvailableProvidersSender sends the ListAvailableProviders request. The method will close the 1255// http.Response Body if it receives an error. 1256func (client WatchersClient) ListAvailableProvidersSender(req *http.Request) (future WatchersListAvailableProvidersFuture, err error) { 1257 var resp *http.Response 1258 resp, err = client.Send(req, azure.DoRetryWithRegistration(client.Client)) 1259 if err != nil { 1260 return 1261 } 1262 var azf azure.Future 1263 azf, err = azure.NewFutureFromResponse(resp) 1264 future.FutureAPI = &azf 1265 future.Result = future.result 1266 return 1267} 1268 1269// ListAvailableProvidersResponder handles the response to the ListAvailableProviders request. The method always 1270// closes the http.Response Body. 1271func (client WatchersClient) ListAvailableProvidersResponder(resp *http.Response) (result AvailableProvidersList, err error) { 1272 err = autorest.Respond( 1273 resp, 1274 azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted), 1275 autorest.ByUnmarshallingJSON(&result), 1276 autorest.ByClosing()) 1277 result.Response = autorest.Response{Response: resp} 1278 return 1279} 1280 1281// SetFlowLogConfiguration configures flow log and traffic analytics (optional) on a specified resource. 1282// Parameters: 1283// resourceGroupName - the name of the network watcher resource group. 1284// networkWatcherName - the name of the network watcher resource. 1285// parameters - parameters that define the configuration of flow log. 1286func (client WatchersClient) SetFlowLogConfiguration(ctx context.Context, resourceGroupName string, networkWatcherName string, parameters FlowLogInformation) (result WatchersSetFlowLogConfigurationFuture, err error) { 1287 if tracing.IsEnabled() { 1288 ctx = tracing.StartSpan(ctx, fqdn+"/WatchersClient.SetFlowLogConfiguration") 1289 defer func() { 1290 sc := -1 1291 if result.FutureAPI != nil && result.FutureAPI.Response() != nil { 1292 sc = result.FutureAPI.Response().StatusCode 1293 } 1294 tracing.EndSpan(ctx, sc, err) 1295 }() 1296 } 1297 if err := validation.Validate([]validation.Validation{ 1298 {TargetValue: parameters, 1299 Constraints: []validation.Constraint{{Target: "parameters.TargetResourceID", Name: validation.Null, Rule: true, Chain: nil}, 1300 {Target: "parameters.FlowLogProperties", Name: validation.Null, Rule: true, 1301 Chain: []validation.Constraint{{Target: "parameters.FlowLogProperties.StorageID", Name: validation.Null, Rule: true, Chain: nil}, 1302 {Target: "parameters.FlowLogProperties.Enabled", Name: validation.Null, Rule: true, Chain: nil}, 1303 }}, 1304 {Target: "parameters.FlowAnalyticsConfiguration", Name: validation.Null, Rule: false, 1305 Chain: []validation.Constraint{{Target: "parameters.FlowAnalyticsConfiguration.NetworkWatcherFlowAnalyticsConfiguration", Name: validation.Null, Rule: true, 1306 Chain: []validation.Constraint{{Target: "parameters.FlowAnalyticsConfiguration.NetworkWatcherFlowAnalyticsConfiguration.Enabled", Name: validation.Null, Rule: true, Chain: nil}, 1307 {Target: "parameters.FlowAnalyticsConfiguration.NetworkWatcherFlowAnalyticsConfiguration.WorkspaceID", Name: validation.Null, Rule: true, Chain: nil}, 1308 {Target: "parameters.FlowAnalyticsConfiguration.NetworkWatcherFlowAnalyticsConfiguration.WorkspaceRegion", Name: validation.Null, Rule: true, Chain: nil}, 1309 {Target: "parameters.FlowAnalyticsConfiguration.NetworkWatcherFlowAnalyticsConfiguration.WorkspaceResourceID", Name: validation.Null, Rule: true, Chain: nil}, 1310 }}, 1311 }}}}}); err != nil { 1312 return result, validation.NewError("network.WatchersClient", "SetFlowLogConfiguration", err.Error()) 1313 } 1314 1315 req, err := client.SetFlowLogConfigurationPreparer(ctx, resourceGroupName, networkWatcherName, parameters) 1316 if err != nil { 1317 err = autorest.NewErrorWithError(err, "network.WatchersClient", "SetFlowLogConfiguration", nil, "Failure preparing request") 1318 return 1319 } 1320 1321 result, err = client.SetFlowLogConfigurationSender(req) 1322 if err != nil { 1323 err = autorest.NewErrorWithError(err, "network.WatchersClient", "SetFlowLogConfiguration", nil, "Failure sending request") 1324 return 1325 } 1326 1327 return 1328} 1329 1330// SetFlowLogConfigurationPreparer prepares the SetFlowLogConfiguration request. 1331func (client WatchersClient) SetFlowLogConfigurationPreparer(ctx context.Context, resourceGroupName string, networkWatcherName string, parameters FlowLogInformation) (*http.Request, error) { 1332 pathParameters := map[string]interface{}{ 1333 "networkWatcherName": autorest.Encode("path", networkWatcherName), 1334 "resourceGroupName": autorest.Encode("path", resourceGroupName), 1335 "subscriptionId": autorest.Encode("path", client.SubscriptionID), 1336 } 1337 1338 const APIVersion = "2018-08-01" 1339 queryParameters := map[string]interface{}{ 1340 "api-version": APIVersion, 1341 } 1342 1343 preparer := autorest.CreatePreparer( 1344 autorest.AsContentType("application/json; charset=utf-8"), 1345 autorest.AsPost(), 1346 autorest.WithBaseURL(client.BaseURI), 1347 autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/networkWatchers/{networkWatcherName}/configureFlowLog", pathParameters), 1348 autorest.WithJSON(parameters), 1349 autorest.WithQueryParameters(queryParameters)) 1350 return preparer.Prepare((&http.Request{}).WithContext(ctx)) 1351} 1352 1353// SetFlowLogConfigurationSender sends the SetFlowLogConfiguration request. The method will close the 1354// http.Response Body if it receives an error. 1355func (client WatchersClient) SetFlowLogConfigurationSender(req *http.Request) (future WatchersSetFlowLogConfigurationFuture, err error) { 1356 var resp *http.Response 1357 resp, err = client.Send(req, azure.DoRetryWithRegistration(client.Client)) 1358 if err != nil { 1359 return 1360 } 1361 var azf azure.Future 1362 azf, err = azure.NewFutureFromResponse(resp) 1363 future.FutureAPI = &azf 1364 future.Result = future.result 1365 return 1366} 1367 1368// SetFlowLogConfigurationResponder handles the response to the SetFlowLogConfiguration request. The method always 1369// closes the http.Response Body. 1370func (client WatchersClient) SetFlowLogConfigurationResponder(resp *http.Response) (result FlowLogInformation, err error) { 1371 err = autorest.Respond( 1372 resp, 1373 azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted), 1374 autorest.ByUnmarshallingJSON(&result), 1375 autorest.ByClosing()) 1376 result.Response = autorest.Response{Response: resp} 1377 return 1378} 1379 1380// UpdateTags updates a network watcher tags. 1381// Parameters: 1382// resourceGroupName - the name of the resource group. 1383// networkWatcherName - the name of the network watcher. 1384// parameters - parameters supplied to update network watcher tags. 1385func (client WatchersClient) UpdateTags(ctx context.Context, resourceGroupName string, networkWatcherName string, parameters TagsObject) (result Watcher, err error) { 1386 if tracing.IsEnabled() { 1387 ctx = tracing.StartSpan(ctx, fqdn+"/WatchersClient.UpdateTags") 1388 defer func() { 1389 sc := -1 1390 if result.Response.Response != nil { 1391 sc = result.Response.Response.StatusCode 1392 } 1393 tracing.EndSpan(ctx, sc, err) 1394 }() 1395 } 1396 req, err := client.UpdateTagsPreparer(ctx, resourceGroupName, networkWatcherName, parameters) 1397 if err != nil { 1398 err = autorest.NewErrorWithError(err, "network.WatchersClient", "UpdateTags", nil, "Failure preparing request") 1399 return 1400 } 1401 1402 resp, err := client.UpdateTagsSender(req) 1403 if err != nil { 1404 result.Response = autorest.Response{Response: resp} 1405 err = autorest.NewErrorWithError(err, "network.WatchersClient", "UpdateTags", resp, "Failure sending request") 1406 return 1407 } 1408 1409 result, err = client.UpdateTagsResponder(resp) 1410 if err != nil { 1411 err = autorest.NewErrorWithError(err, "network.WatchersClient", "UpdateTags", resp, "Failure responding to request") 1412 return 1413 } 1414 1415 return 1416} 1417 1418// UpdateTagsPreparer prepares the UpdateTags request. 1419func (client WatchersClient) UpdateTagsPreparer(ctx context.Context, resourceGroupName string, networkWatcherName string, parameters TagsObject) (*http.Request, error) { 1420 pathParameters := map[string]interface{}{ 1421 "networkWatcherName": autorest.Encode("path", networkWatcherName), 1422 "resourceGroupName": autorest.Encode("path", resourceGroupName), 1423 "subscriptionId": autorest.Encode("path", client.SubscriptionID), 1424 } 1425 1426 const APIVersion = "2018-08-01" 1427 queryParameters := map[string]interface{}{ 1428 "api-version": APIVersion, 1429 } 1430 1431 preparer := autorest.CreatePreparer( 1432 autorest.AsContentType("application/json; charset=utf-8"), 1433 autorest.AsPatch(), 1434 autorest.WithBaseURL(client.BaseURI), 1435 autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/networkWatchers/{networkWatcherName}", pathParameters), 1436 autorest.WithJSON(parameters), 1437 autorest.WithQueryParameters(queryParameters)) 1438 return preparer.Prepare((&http.Request{}).WithContext(ctx)) 1439} 1440 1441// UpdateTagsSender sends the UpdateTags request. The method will close the 1442// http.Response Body if it receives an error. 1443func (client WatchersClient) UpdateTagsSender(req *http.Request) (*http.Response, error) { 1444 return client.Send(req, azure.DoRetryWithRegistration(client.Client)) 1445} 1446 1447// UpdateTagsResponder handles the response to the UpdateTags request. The method always 1448// closes the http.Response Body. 1449func (client WatchersClient) UpdateTagsResponder(resp *http.Response) (result Watcher, err error) { 1450 err = autorest.Respond( 1451 resp, 1452 azure.WithErrorUnlessStatusCode(http.StatusOK), 1453 autorest.ByUnmarshallingJSON(&result), 1454 autorest.ByClosing()) 1455 result.Response = autorest.Response{Response: resp} 1456 return 1457} 1458 1459// VerifyIPFlow verify IP flow from the specified VM to a location given the currently configured NSG rules. 1460// Parameters: 1461// resourceGroupName - the name of the resource group. 1462// networkWatcherName - the name of the network watcher. 1463// parameters - parameters that define the IP flow to be verified. 1464func (client WatchersClient) VerifyIPFlow(ctx context.Context, resourceGroupName string, networkWatcherName string, parameters VerificationIPFlowParameters) (result WatchersVerifyIPFlowFuture, err error) { 1465 if tracing.IsEnabled() { 1466 ctx = tracing.StartSpan(ctx, fqdn+"/WatchersClient.VerifyIPFlow") 1467 defer func() { 1468 sc := -1 1469 if result.FutureAPI != nil && result.FutureAPI.Response() != nil { 1470 sc = result.FutureAPI.Response().StatusCode 1471 } 1472 tracing.EndSpan(ctx, sc, err) 1473 }() 1474 } 1475 if err := validation.Validate([]validation.Validation{ 1476 {TargetValue: parameters, 1477 Constraints: []validation.Constraint{{Target: "parameters.TargetResourceID", Name: validation.Null, Rule: true, Chain: nil}, 1478 {Target: "parameters.LocalPort", Name: validation.Null, Rule: true, Chain: nil}, 1479 {Target: "parameters.RemotePort", Name: validation.Null, Rule: true, Chain: nil}, 1480 {Target: "parameters.LocalIPAddress", Name: validation.Null, Rule: true, Chain: nil}, 1481 {Target: "parameters.RemoteIPAddress", Name: validation.Null, Rule: true, Chain: nil}}}}); err != nil { 1482 return result, validation.NewError("network.WatchersClient", "VerifyIPFlow", err.Error()) 1483 } 1484 1485 req, err := client.VerifyIPFlowPreparer(ctx, resourceGroupName, networkWatcherName, parameters) 1486 if err != nil { 1487 err = autorest.NewErrorWithError(err, "network.WatchersClient", "VerifyIPFlow", nil, "Failure preparing request") 1488 return 1489 } 1490 1491 result, err = client.VerifyIPFlowSender(req) 1492 if err != nil { 1493 err = autorest.NewErrorWithError(err, "network.WatchersClient", "VerifyIPFlow", nil, "Failure sending request") 1494 return 1495 } 1496 1497 return 1498} 1499 1500// VerifyIPFlowPreparer prepares the VerifyIPFlow request. 1501func (client WatchersClient) VerifyIPFlowPreparer(ctx context.Context, resourceGroupName string, networkWatcherName string, parameters VerificationIPFlowParameters) (*http.Request, error) { 1502 pathParameters := map[string]interface{}{ 1503 "networkWatcherName": autorest.Encode("path", networkWatcherName), 1504 "resourceGroupName": autorest.Encode("path", resourceGroupName), 1505 "subscriptionId": autorest.Encode("path", client.SubscriptionID), 1506 } 1507 1508 const APIVersion = "2018-08-01" 1509 queryParameters := map[string]interface{}{ 1510 "api-version": APIVersion, 1511 } 1512 1513 preparer := autorest.CreatePreparer( 1514 autorest.AsContentType("application/json; charset=utf-8"), 1515 autorest.AsPost(), 1516 autorest.WithBaseURL(client.BaseURI), 1517 autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/networkWatchers/{networkWatcherName}/ipFlowVerify", pathParameters), 1518 autorest.WithJSON(parameters), 1519 autorest.WithQueryParameters(queryParameters)) 1520 return preparer.Prepare((&http.Request{}).WithContext(ctx)) 1521} 1522 1523// VerifyIPFlowSender sends the VerifyIPFlow request. The method will close the 1524// http.Response Body if it receives an error. 1525func (client WatchersClient) VerifyIPFlowSender(req *http.Request) (future WatchersVerifyIPFlowFuture, err error) { 1526 var resp *http.Response 1527 resp, err = client.Send(req, azure.DoRetryWithRegistration(client.Client)) 1528 if err != nil { 1529 return 1530 } 1531 var azf azure.Future 1532 azf, err = azure.NewFutureFromResponse(resp) 1533 future.FutureAPI = &azf 1534 future.Result = future.result 1535 return 1536} 1537 1538// VerifyIPFlowResponder handles the response to the VerifyIPFlow request. The method always 1539// closes the http.Response Body. 1540func (client WatchersClient) VerifyIPFlowResponder(resp *http.Response) (result VerificationIPFlowResult, err error) { 1541 err = autorest.Respond( 1542 resp, 1543 azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted), 1544 autorest.ByUnmarshallingJSON(&result), 1545 autorest.ByClosing()) 1546 result.Response = autorest.Response{Response: resp} 1547 return 1548} 1549