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/tracing" 14 "net/http" 15) 16 17// PrivateLinkServicesClient is the network Client 18type PrivateLinkServicesClient struct { 19 BaseClient 20} 21 22// NewPrivateLinkServicesClient creates an instance of the PrivateLinkServicesClient client. 23func NewPrivateLinkServicesClient(subscriptionID string) PrivateLinkServicesClient { 24 return NewPrivateLinkServicesClientWithBaseURI(DefaultBaseURI, subscriptionID) 25} 26 27// NewPrivateLinkServicesClientWithBaseURI creates an instance of the PrivateLinkServicesClient client using a custom 28// endpoint. Use this when interacting with an Azure cloud that uses a non-standard base URI (sovereign clouds, Azure 29// stack). 30func NewPrivateLinkServicesClientWithBaseURI(baseURI string, subscriptionID string) PrivateLinkServicesClient { 31 return PrivateLinkServicesClient{NewWithBaseURI(baseURI, subscriptionID)} 32} 33 34// CheckPrivateLinkServiceVisibility checks the subscription is visible to private link service 35// Parameters: 36// location - the location of the domain name. 37// parameters - the request body of CheckPrivateLinkService API call. 38func (client PrivateLinkServicesClient) CheckPrivateLinkServiceVisibility(ctx context.Context, location string, parameters CheckPrivateLinkServiceVisibilityRequest) (result PrivateLinkServicesCheckPrivateLinkServiceVisibilityFuture, err error) { 39 if tracing.IsEnabled() { 40 ctx = tracing.StartSpan(ctx, fqdn+"/PrivateLinkServicesClient.CheckPrivateLinkServiceVisibility") 41 defer func() { 42 sc := -1 43 if result.FutureAPI != nil && result.FutureAPI.Response() != nil { 44 sc = result.FutureAPI.Response().StatusCode 45 } 46 tracing.EndSpan(ctx, sc, err) 47 }() 48 } 49 req, err := client.CheckPrivateLinkServiceVisibilityPreparer(ctx, location, parameters) 50 if err != nil { 51 err = autorest.NewErrorWithError(err, "network.PrivateLinkServicesClient", "CheckPrivateLinkServiceVisibility", nil, "Failure preparing request") 52 return 53 } 54 55 result, err = client.CheckPrivateLinkServiceVisibilitySender(req) 56 if err != nil { 57 err = autorest.NewErrorWithError(err, "network.PrivateLinkServicesClient", "CheckPrivateLinkServiceVisibility", nil, "Failure sending request") 58 return 59 } 60 61 return 62} 63 64// CheckPrivateLinkServiceVisibilityPreparer prepares the CheckPrivateLinkServiceVisibility request. 65func (client PrivateLinkServicesClient) CheckPrivateLinkServiceVisibilityPreparer(ctx context.Context, location string, parameters CheckPrivateLinkServiceVisibilityRequest) (*http.Request, error) { 66 pathParameters := map[string]interface{}{ 67 "location": autorest.Encode("path", location), 68 "subscriptionId": autorest.Encode("path", client.SubscriptionID), 69 } 70 71 const APIVersion = "2019-04-01" 72 queryParameters := map[string]interface{}{ 73 "api-version": APIVersion, 74 } 75 76 preparer := autorest.CreatePreparer( 77 autorest.AsContentType("application/json; charset=utf-8"), 78 autorest.AsPost(), 79 autorest.WithBaseURL(client.BaseURI), 80 autorest.WithPathParameters("/subscriptions/{subscriptionId}/providers/Microsoft.Network/locations/{location}/checkPrivateLinkServiceVisibility", pathParameters), 81 autorest.WithJSON(parameters), 82 autorest.WithQueryParameters(queryParameters)) 83 return preparer.Prepare((&http.Request{}).WithContext(ctx)) 84} 85 86// CheckPrivateLinkServiceVisibilitySender sends the CheckPrivateLinkServiceVisibility request. The method will close the 87// http.Response Body if it receives an error. 88func (client PrivateLinkServicesClient) CheckPrivateLinkServiceVisibilitySender(req *http.Request) (future PrivateLinkServicesCheckPrivateLinkServiceVisibilityFuture, err error) { 89 var resp *http.Response 90 resp, err = client.Send(req, azure.DoRetryWithRegistration(client.Client)) 91 if err != nil { 92 return 93 } 94 var azf azure.Future 95 azf, err = azure.NewFutureFromResponse(resp) 96 future.FutureAPI = &azf 97 future.Result = future.result 98 return 99} 100 101// CheckPrivateLinkServiceVisibilityResponder handles the response to the CheckPrivateLinkServiceVisibility request. The method always 102// closes the http.Response Body. 103func (client PrivateLinkServicesClient) CheckPrivateLinkServiceVisibilityResponder(resp *http.Response) (result PrivateLinkServiceVisibility, err error) { 104 err = autorest.Respond( 105 resp, 106 azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted), 107 autorest.ByUnmarshallingJSON(&result), 108 autorest.ByClosing()) 109 result.Response = autorest.Response{Response: resp} 110 return 111} 112 113// CheckPrivateLinkServiceVisibilityByResourceGroup checks the subscription is visible to private link service 114// Parameters: 115// location - the location of the domain name. 116// resourceGroupName - the name of the resource group. 117// parameters - the request body of CheckPrivateLinkService API call. 118func (client PrivateLinkServicesClient) CheckPrivateLinkServiceVisibilityByResourceGroup(ctx context.Context, location string, resourceGroupName string, parameters CheckPrivateLinkServiceVisibilityRequest) (result PrivateLinkServicesCheckPrivateLinkServiceVisibilityByResourceGroupFuture, err error) { 119 if tracing.IsEnabled() { 120 ctx = tracing.StartSpan(ctx, fqdn+"/PrivateLinkServicesClient.CheckPrivateLinkServiceVisibilityByResourceGroup") 121 defer func() { 122 sc := -1 123 if result.FutureAPI != nil && result.FutureAPI.Response() != nil { 124 sc = result.FutureAPI.Response().StatusCode 125 } 126 tracing.EndSpan(ctx, sc, err) 127 }() 128 } 129 req, err := client.CheckPrivateLinkServiceVisibilityByResourceGroupPreparer(ctx, location, resourceGroupName, parameters) 130 if err != nil { 131 err = autorest.NewErrorWithError(err, "network.PrivateLinkServicesClient", "CheckPrivateLinkServiceVisibilityByResourceGroup", nil, "Failure preparing request") 132 return 133 } 134 135 result, err = client.CheckPrivateLinkServiceVisibilityByResourceGroupSender(req) 136 if err != nil { 137 err = autorest.NewErrorWithError(err, "network.PrivateLinkServicesClient", "CheckPrivateLinkServiceVisibilityByResourceGroup", nil, "Failure sending request") 138 return 139 } 140 141 return 142} 143 144// CheckPrivateLinkServiceVisibilityByResourceGroupPreparer prepares the CheckPrivateLinkServiceVisibilityByResourceGroup request. 145func (client PrivateLinkServicesClient) CheckPrivateLinkServiceVisibilityByResourceGroupPreparer(ctx context.Context, location string, resourceGroupName string, parameters CheckPrivateLinkServiceVisibilityRequest) (*http.Request, error) { 146 pathParameters := map[string]interface{}{ 147 "location": autorest.Encode("path", location), 148 "resourceGroupName": autorest.Encode("path", resourceGroupName), 149 "subscriptionId": autorest.Encode("path", client.SubscriptionID), 150 } 151 152 const APIVersion = "2019-04-01" 153 queryParameters := map[string]interface{}{ 154 "api-version": APIVersion, 155 } 156 157 preparer := autorest.CreatePreparer( 158 autorest.AsContentType("application/json; charset=utf-8"), 159 autorest.AsPost(), 160 autorest.WithBaseURL(client.BaseURI), 161 autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/locations/{location}/checkPrivateLinkServiceVisibility", pathParameters), 162 autorest.WithJSON(parameters), 163 autorest.WithQueryParameters(queryParameters)) 164 return preparer.Prepare((&http.Request{}).WithContext(ctx)) 165} 166 167// CheckPrivateLinkServiceVisibilityByResourceGroupSender sends the CheckPrivateLinkServiceVisibilityByResourceGroup request. The method will close the 168// http.Response Body if it receives an error. 169func (client PrivateLinkServicesClient) CheckPrivateLinkServiceVisibilityByResourceGroupSender(req *http.Request) (future PrivateLinkServicesCheckPrivateLinkServiceVisibilityByResourceGroupFuture, err error) { 170 var resp *http.Response 171 resp, err = client.Send(req, azure.DoRetryWithRegistration(client.Client)) 172 if err != nil { 173 return 174 } 175 var azf azure.Future 176 azf, err = azure.NewFutureFromResponse(resp) 177 future.FutureAPI = &azf 178 future.Result = future.result 179 return 180} 181 182// CheckPrivateLinkServiceVisibilityByResourceGroupResponder handles the response to the CheckPrivateLinkServiceVisibilityByResourceGroup request. The method always 183// closes the http.Response Body. 184func (client PrivateLinkServicesClient) CheckPrivateLinkServiceVisibilityByResourceGroupResponder(resp *http.Response) (result PrivateLinkServiceVisibility, err error) { 185 err = autorest.Respond( 186 resp, 187 azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted), 188 autorest.ByUnmarshallingJSON(&result), 189 autorest.ByClosing()) 190 result.Response = autorest.Response{Response: resp} 191 return 192} 193 194// CreateOrUpdate creates or updates an private link service in the specified resource group. 195// Parameters: 196// resourceGroupName - the name of the resource group. 197// serviceName - the name of the private link service. 198// parameters - parameters supplied to the create or update private link service operation. 199func (client PrivateLinkServicesClient) CreateOrUpdate(ctx context.Context, resourceGroupName string, serviceName string, parameters PrivateLinkService) (result PrivateLinkServicesCreateOrUpdateFuture, err error) { 200 if tracing.IsEnabled() { 201 ctx = tracing.StartSpan(ctx, fqdn+"/PrivateLinkServicesClient.CreateOrUpdate") 202 defer func() { 203 sc := -1 204 if result.FutureAPI != nil && result.FutureAPI.Response() != nil { 205 sc = result.FutureAPI.Response().StatusCode 206 } 207 tracing.EndSpan(ctx, sc, err) 208 }() 209 } 210 req, err := client.CreateOrUpdatePreparer(ctx, resourceGroupName, serviceName, parameters) 211 if err != nil { 212 err = autorest.NewErrorWithError(err, "network.PrivateLinkServicesClient", "CreateOrUpdate", nil, "Failure preparing request") 213 return 214 } 215 216 result, err = client.CreateOrUpdateSender(req) 217 if err != nil { 218 err = autorest.NewErrorWithError(err, "network.PrivateLinkServicesClient", "CreateOrUpdate", nil, "Failure sending request") 219 return 220 } 221 222 return 223} 224 225// CreateOrUpdatePreparer prepares the CreateOrUpdate request. 226func (client PrivateLinkServicesClient) CreateOrUpdatePreparer(ctx context.Context, resourceGroupName string, serviceName string, parameters PrivateLinkService) (*http.Request, error) { 227 pathParameters := map[string]interface{}{ 228 "resourceGroupName": autorest.Encode("path", resourceGroupName), 229 "serviceName": autorest.Encode("path", serviceName), 230 "subscriptionId": autorest.Encode("path", client.SubscriptionID), 231 } 232 233 const APIVersion = "2019-04-01" 234 queryParameters := map[string]interface{}{ 235 "api-version": APIVersion, 236 } 237 238 preparer := autorest.CreatePreparer( 239 autorest.AsContentType("application/json; charset=utf-8"), 240 autorest.AsPut(), 241 autorest.WithBaseURL(client.BaseURI), 242 autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/privateLinkServices/{serviceName}", pathParameters), 243 autorest.WithJSON(parameters), 244 autorest.WithQueryParameters(queryParameters)) 245 return preparer.Prepare((&http.Request{}).WithContext(ctx)) 246} 247 248// CreateOrUpdateSender sends the CreateOrUpdate request. The method will close the 249// http.Response Body if it receives an error. 250func (client PrivateLinkServicesClient) CreateOrUpdateSender(req *http.Request) (future PrivateLinkServicesCreateOrUpdateFuture, err error) { 251 var resp *http.Response 252 resp, err = client.Send(req, azure.DoRetryWithRegistration(client.Client)) 253 if err != nil { 254 return 255 } 256 var azf azure.Future 257 azf, err = azure.NewFutureFromResponse(resp) 258 future.FutureAPI = &azf 259 future.Result = future.result 260 return 261} 262 263// CreateOrUpdateResponder handles the response to the CreateOrUpdate request. The method always 264// closes the http.Response Body. 265func (client PrivateLinkServicesClient) CreateOrUpdateResponder(resp *http.Response) (result PrivateLinkService, err error) { 266 err = autorest.Respond( 267 resp, 268 azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusCreated), 269 autorest.ByUnmarshallingJSON(&result), 270 autorest.ByClosing()) 271 result.Response = autorest.Response{Response: resp} 272 return 273} 274 275// Delete deletes the specified private link service. 276// Parameters: 277// resourceGroupName - the name of the resource group. 278// serviceName - the name of the private link service. 279func (client PrivateLinkServicesClient) Delete(ctx context.Context, resourceGroupName string, serviceName string) (result PrivateLinkServicesDeleteFuture, err error) { 280 if tracing.IsEnabled() { 281 ctx = tracing.StartSpan(ctx, fqdn+"/PrivateLinkServicesClient.Delete") 282 defer func() { 283 sc := -1 284 if result.FutureAPI != nil && result.FutureAPI.Response() != nil { 285 sc = result.FutureAPI.Response().StatusCode 286 } 287 tracing.EndSpan(ctx, sc, err) 288 }() 289 } 290 req, err := client.DeletePreparer(ctx, resourceGroupName, serviceName) 291 if err != nil { 292 err = autorest.NewErrorWithError(err, "network.PrivateLinkServicesClient", "Delete", nil, "Failure preparing request") 293 return 294 } 295 296 result, err = client.DeleteSender(req) 297 if err != nil { 298 err = autorest.NewErrorWithError(err, "network.PrivateLinkServicesClient", "Delete", nil, "Failure sending request") 299 return 300 } 301 302 return 303} 304 305// DeletePreparer prepares the Delete request. 306func (client PrivateLinkServicesClient) DeletePreparer(ctx context.Context, resourceGroupName string, serviceName string) (*http.Request, error) { 307 pathParameters := map[string]interface{}{ 308 "resourceGroupName": autorest.Encode("path", resourceGroupName), 309 "serviceName": autorest.Encode("path", serviceName), 310 "subscriptionId": autorest.Encode("path", client.SubscriptionID), 311 } 312 313 const APIVersion = "2019-04-01" 314 queryParameters := map[string]interface{}{ 315 "api-version": APIVersion, 316 } 317 318 preparer := autorest.CreatePreparer( 319 autorest.AsDelete(), 320 autorest.WithBaseURL(client.BaseURI), 321 autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/privateLinkServices/{serviceName}", pathParameters), 322 autorest.WithQueryParameters(queryParameters)) 323 return preparer.Prepare((&http.Request{}).WithContext(ctx)) 324} 325 326// DeleteSender sends the Delete request. The method will close the 327// http.Response Body if it receives an error. 328func (client PrivateLinkServicesClient) DeleteSender(req *http.Request) (future PrivateLinkServicesDeleteFuture, err error) { 329 var resp *http.Response 330 resp, err = client.Send(req, azure.DoRetryWithRegistration(client.Client)) 331 if err != nil { 332 return 333 } 334 var azf azure.Future 335 azf, err = azure.NewFutureFromResponse(resp) 336 future.FutureAPI = &azf 337 future.Result = future.result 338 return 339} 340 341// DeleteResponder handles the response to the Delete request. The method always 342// closes the http.Response Body. 343func (client PrivateLinkServicesClient) DeleteResponder(resp *http.Response) (result autorest.Response, err error) { 344 err = autorest.Respond( 345 resp, 346 azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted, http.StatusNoContent), 347 autorest.ByClosing()) 348 result.Response = resp 349 return 350} 351 352// DeletePrivateEndpointConnection delete private end point connection for a private link service in a subscription. 353// Parameters: 354// resourceGroupName - the name of the resource group. 355// serviceName - the name of the private link service. 356// peConnectionName - the name of the private end point connection. 357func (client PrivateLinkServicesClient) DeletePrivateEndpointConnection(ctx context.Context, resourceGroupName string, serviceName string, peConnectionName string) (result PrivateLinkServicesDeletePrivateEndpointConnectionFuture, err error) { 358 if tracing.IsEnabled() { 359 ctx = tracing.StartSpan(ctx, fqdn+"/PrivateLinkServicesClient.DeletePrivateEndpointConnection") 360 defer func() { 361 sc := -1 362 if result.FutureAPI != nil && result.FutureAPI.Response() != nil { 363 sc = result.FutureAPI.Response().StatusCode 364 } 365 tracing.EndSpan(ctx, sc, err) 366 }() 367 } 368 req, err := client.DeletePrivateEndpointConnectionPreparer(ctx, resourceGroupName, serviceName, peConnectionName) 369 if err != nil { 370 err = autorest.NewErrorWithError(err, "network.PrivateLinkServicesClient", "DeletePrivateEndpointConnection", nil, "Failure preparing request") 371 return 372 } 373 374 result, err = client.DeletePrivateEndpointConnectionSender(req) 375 if err != nil { 376 err = autorest.NewErrorWithError(err, "network.PrivateLinkServicesClient", "DeletePrivateEndpointConnection", nil, "Failure sending request") 377 return 378 } 379 380 return 381} 382 383// DeletePrivateEndpointConnectionPreparer prepares the DeletePrivateEndpointConnection request. 384func (client PrivateLinkServicesClient) DeletePrivateEndpointConnectionPreparer(ctx context.Context, resourceGroupName string, serviceName string, peConnectionName string) (*http.Request, error) { 385 pathParameters := map[string]interface{}{ 386 "peConnectionName": autorest.Encode("path", peConnectionName), 387 "resourceGroupName": autorest.Encode("path", resourceGroupName), 388 "serviceName": autorest.Encode("path", serviceName), 389 "subscriptionId": autorest.Encode("path", client.SubscriptionID), 390 } 391 392 const APIVersion = "2019-04-01" 393 queryParameters := map[string]interface{}{ 394 "api-version": APIVersion, 395 } 396 397 preparer := autorest.CreatePreparer( 398 autorest.AsDelete(), 399 autorest.WithBaseURL(client.BaseURI), 400 autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/privateLinkServices/{serviceName}/privateEndpointConnections/{peConnectionName}", pathParameters), 401 autorest.WithQueryParameters(queryParameters)) 402 return preparer.Prepare((&http.Request{}).WithContext(ctx)) 403} 404 405// DeletePrivateEndpointConnectionSender sends the DeletePrivateEndpointConnection request. The method will close the 406// http.Response Body if it receives an error. 407func (client PrivateLinkServicesClient) DeletePrivateEndpointConnectionSender(req *http.Request) (future PrivateLinkServicesDeletePrivateEndpointConnectionFuture, err error) { 408 var resp *http.Response 409 resp, err = client.Send(req, azure.DoRetryWithRegistration(client.Client)) 410 if err != nil { 411 return 412 } 413 var azf azure.Future 414 azf, err = azure.NewFutureFromResponse(resp) 415 future.FutureAPI = &azf 416 future.Result = future.result 417 return 418} 419 420// DeletePrivateEndpointConnectionResponder handles the response to the DeletePrivateEndpointConnection request. The method always 421// closes the http.Response Body. 422func (client PrivateLinkServicesClient) DeletePrivateEndpointConnectionResponder(resp *http.Response) (result autorest.Response, err error) { 423 err = autorest.Respond( 424 resp, 425 azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted, http.StatusNoContent), 426 autorest.ByClosing()) 427 result.Response = resp 428 return 429} 430 431// Get gets the specified private link service by resource group. 432// Parameters: 433// resourceGroupName - the name of the resource group. 434// serviceName - the name of the private link service. 435// expand - expands referenced resources. 436func (client PrivateLinkServicesClient) Get(ctx context.Context, resourceGroupName string, serviceName string, expand string) (result PrivateLinkService, err error) { 437 if tracing.IsEnabled() { 438 ctx = tracing.StartSpan(ctx, fqdn+"/PrivateLinkServicesClient.Get") 439 defer func() { 440 sc := -1 441 if result.Response.Response != nil { 442 sc = result.Response.Response.StatusCode 443 } 444 tracing.EndSpan(ctx, sc, err) 445 }() 446 } 447 req, err := client.GetPreparer(ctx, resourceGroupName, serviceName, expand) 448 if err != nil { 449 err = autorest.NewErrorWithError(err, "network.PrivateLinkServicesClient", "Get", nil, "Failure preparing request") 450 return 451 } 452 453 resp, err := client.GetSender(req) 454 if err != nil { 455 result.Response = autorest.Response{Response: resp} 456 err = autorest.NewErrorWithError(err, "network.PrivateLinkServicesClient", "Get", resp, "Failure sending request") 457 return 458 } 459 460 result, err = client.GetResponder(resp) 461 if err != nil { 462 err = autorest.NewErrorWithError(err, "network.PrivateLinkServicesClient", "Get", resp, "Failure responding to request") 463 return 464 } 465 466 return 467} 468 469// GetPreparer prepares the Get request. 470func (client PrivateLinkServicesClient) GetPreparer(ctx context.Context, resourceGroupName string, serviceName string, expand string) (*http.Request, error) { 471 pathParameters := map[string]interface{}{ 472 "resourceGroupName": autorest.Encode("path", resourceGroupName), 473 "serviceName": autorest.Encode("path", serviceName), 474 "subscriptionId": autorest.Encode("path", client.SubscriptionID), 475 } 476 477 const APIVersion = "2019-04-01" 478 queryParameters := map[string]interface{}{ 479 "api-version": APIVersion, 480 } 481 if len(expand) > 0 { 482 queryParameters["$expand"] = autorest.Encode("query", expand) 483 } 484 485 preparer := autorest.CreatePreparer( 486 autorest.AsGet(), 487 autorest.WithBaseURL(client.BaseURI), 488 autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/privateLinkServices/{serviceName}", pathParameters), 489 autorest.WithQueryParameters(queryParameters)) 490 return preparer.Prepare((&http.Request{}).WithContext(ctx)) 491} 492 493// GetSender sends the Get request. The method will close the 494// http.Response Body if it receives an error. 495func (client PrivateLinkServicesClient) GetSender(req *http.Request) (*http.Response, error) { 496 return client.Send(req, azure.DoRetryWithRegistration(client.Client)) 497} 498 499// GetResponder handles the response to the Get request. The method always 500// closes the http.Response Body. 501func (client PrivateLinkServicesClient) GetResponder(resp *http.Response) (result PrivateLinkService, err error) { 502 err = autorest.Respond( 503 resp, 504 azure.WithErrorUnlessStatusCode(http.StatusOK), 505 autorest.ByUnmarshallingJSON(&result), 506 autorest.ByClosing()) 507 result.Response = autorest.Response{Response: resp} 508 return 509} 510 511// List gets all private link services in a resource group. 512// Parameters: 513// resourceGroupName - the name of the resource group. 514func (client PrivateLinkServicesClient) List(ctx context.Context, resourceGroupName string) (result PrivateLinkServiceListResultPage, err error) { 515 if tracing.IsEnabled() { 516 ctx = tracing.StartSpan(ctx, fqdn+"/PrivateLinkServicesClient.List") 517 defer func() { 518 sc := -1 519 if result.plslr.Response.Response != nil { 520 sc = result.plslr.Response.Response.StatusCode 521 } 522 tracing.EndSpan(ctx, sc, err) 523 }() 524 } 525 result.fn = client.listNextResults 526 req, err := client.ListPreparer(ctx, resourceGroupName) 527 if err != nil { 528 err = autorest.NewErrorWithError(err, "network.PrivateLinkServicesClient", "List", nil, "Failure preparing request") 529 return 530 } 531 532 resp, err := client.ListSender(req) 533 if err != nil { 534 result.plslr.Response = autorest.Response{Response: resp} 535 err = autorest.NewErrorWithError(err, "network.PrivateLinkServicesClient", "List", resp, "Failure sending request") 536 return 537 } 538 539 result.plslr, err = client.ListResponder(resp) 540 if err != nil { 541 err = autorest.NewErrorWithError(err, "network.PrivateLinkServicesClient", "List", resp, "Failure responding to request") 542 return 543 } 544 if result.plslr.hasNextLink() && result.plslr.IsEmpty() { 545 err = result.NextWithContext(ctx) 546 return 547 } 548 549 return 550} 551 552// ListPreparer prepares the List request. 553func (client PrivateLinkServicesClient) ListPreparer(ctx context.Context, resourceGroupName string) (*http.Request, error) { 554 pathParameters := map[string]interface{}{ 555 "resourceGroupName": autorest.Encode("path", resourceGroupName), 556 "subscriptionId": autorest.Encode("path", client.SubscriptionID), 557 } 558 559 const APIVersion = "2019-04-01" 560 queryParameters := map[string]interface{}{ 561 "api-version": APIVersion, 562 } 563 564 preparer := autorest.CreatePreparer( 565 autorest.AsGet(), 566 autorest.WithBaseURL(client.BaseURI), 567 autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/privateLinkServices", pathParameters), 568 autorest.WithQueryParameters(queryParameters)) 569 return preparer.Prepare((&http.Request{}).WithContext(ctx)) 570} 571 572// ListSender sends the List request. The method will close the 573// http.Response Body if it receives an error. 574func (client PrivateLinkServicesClient) ListSender(req *http.Request) (*http.Response, error) { 575 return client.Send(req, azure.DoRetryWithRegistration(client.Client)) 576} 577 578// ListResponder handles the response to the List request. The method always 579// closes the http.Response Body. 580func (client PrivateLinkServicesClient) ListResponder(resp *http.Response) (result PrivateLinkServiceListResult, err error) { 581 err = autorest.Respond( 582 resp, 583 azure.WithErrorUnlessStatusCode(http.StatusOK), 584 autorest.ByUnmarshallingJSON(&result), 585 autorest.ByClosing()) 586 result.Response = autorest.Response{Response: resp} 587 return 588} 589 590// listNextResults retrieves the next set of results, if any. 591func (client PrivateLinkServicesClient) listNextResults(ctx context.Context, lastResults PrivateLinkServiceListResult) (result PrivateLinkServiceListResult, err error) { 592 req, err := lastResults.privateLinkServiceListResultPreparer(ctx) 593 if err != nil { 594 return result, autorest.NewErrorWithError(err, "network.PrivateLinkServicesClient", "listNextResults", nil, "Failure preparing next results request") 595 } 596 if req == nil { 597 return 598 } 599 resp, err := client.ListSender(req) 600 if err != nil { 601 result.Response = autorest.Response{Response: resp} 602 return result, autorest.NewErrorWithError(err, "network.PrivateLinkServicesClient", "listNextResults", resp, "Failure sending next results request") 603 } 604 result, err = client.ListResponder(resp) 605 if err != nil { 606 err = autorest.NewErrorWithError(err, "network.PrivateLinkServicesClient", "listNextResults", resp, "Failure responding to next results request") 607 } 608 return 609} 610 611// ListComplete enumerates all values, automatically crossing page boundaries as required. 612func (client PrivateLinkServicesClient) ListComplete(ctx context.Context, resourceGroupName string) (result PrivateLinkServiceListResultIterator, err error) { 613 if tracing.IsEnabled() { 614 ctx = tracing.StartSpan(ctx, fqdn+"/PrivateLinkServicesClient.List") 615 defer func() { 616 sc := -1 617 if result.Response().Response.Response != nil { 618 sc = result.page.Response().Response.Response.StatusCode 619 } 620 tracing.EndSpan(ctx, sc, err) 621 }() 622 } 623 result.page, err = client.List(ctx, resourceGroupName) 624 return 625} 626 627// ListAutoApprovedPrivateLinkServices returns all of the private link service ids that can be linked to a Private 628// Endpoint with auto approved in this subscription in this region. 629// Parameters: 630// location - the location of the domain name. 631func (client PrivateLinkServicesClient) ListAutoApprovedPrivateLinkServices(ctx context.Context, location string) (result AutoApprovedPrivateLinkServicesResultPage, err error) { 632 if tracing.IsEnabled() { 633 ctx = tracing.StartSpan(ctx, fqdn+"/PrivateLinkServicesClient.ListAutoApprovedPrivateLinkServices") 634 defer func() { 635 sc := -1 636 if result.aaplsr.Response.Response != nil { 637 sc = result.aaplsr.Response.Response.StatusCode 638 } 639 tracing.EndSpan(ctx, sc, err) 640 }() 641 } 642 result.fn = client.listAutoApprovedPrivateLinkServicesNextResults 643 req, err := client.ListAutoApprovedPrivateLinkServicesPreparer(ctx, location) 644 if err != nil { 645 err = autorest.NewErrorWithError(err, "network.PrivateLinkServicesClient", "ListAutoApprovedPrivateLinkServices", nil, "Failure preparing request") 646 return 647 } 648 649 resp, err := client.ListAutoApprovedPrivateLinkServicesSender(req) 650 if err != nil { 651 result.aaplsr.Response = autorest.Response{Response: resp} 652 err = autorest.NewErrorWithError(err, "network.PrivateLinkServicesClient", "ListAutoApprovedPrivateLinkServices", resp, "Failure sending request") 653 return 654 } 655 656 result.aaplsr, err = client.ListAutoApprovedPrivateLinkServicesResponder(resp) 657 if err != nil { 658 err = autorest.NewErrorWithError(err, "network.PrivateLinkServicesClient", "ListAutoApprovedPrivateLinkServices", resp, "Failure responding to request") 659 return 660 } 661 if result.aaplsr.hasNextLink() && result.aaplsr.IsEmpty() { 662 err = result.NextWithContext(ctx) 663 return 664 } 665 666 return 667} 668 669// ListAutoApprovedPrivateLinkServicesPreparer prepares the ListAutoApprovedPrivateLinkServices request. 670func (client PrivateLinkServicesClient) ListAutoApprovedPrivateLinkServicesPreparer(ctx context.Context, location string) (*http.Request, error) { 671 pathParameters := map[string]interface{}{ 672 "location": autorest.Encode("path", location), 673 "subscriptionId": autorest.Encode("path", client.SubscriptionID), 674 } 675 676 const APIVersion = "2019-04-01" 677 queryParameters := map[string]interface{}{ 678 "api-version": APIVersion, 679 } 680 681 preparer := autorest.CreatePreparer( 682 autorest.AsGet(), 683 autorest.WithBaseURL(client.BaseURI), 684 autorest.WithPathParameters("/subscriptions/{subscriptionId}/providers/Microsoft.Network/locations/{location}/autoApprovedPrivateLinkServices", pathParameters), 685 autorest.WithQueryParameters(queryParameters)) 686 return preparer.Prepare((&http.Request{}).WithContext(ctx)) 687} 688 689// ListAutoApprovedPrivateLinkServicesSender sends the ListAutoApprovedPrivateLinkServices request. The method will close the 690// http.Response Body if it receives an error. 691func (client PrivateLinkServicesClient) ListAutoApprovedPrivateLinkServicesSender(req *http.Request) (*http.Response, error) { 692 return client.Send(req, azure.DoRetryWithRegistration(client.Client)) 693} 694 695// ListAutoApprovedPrivateLinkServicesResponder handles the response to the ListAutoApprovedPrivateLinkServices request. The method always 696// closes the http.Response Body. 697func (client PrivateLinkServicesClient) ListAutoApprovedPrivateLinkServicesResponder(resp *http.Response) (result AutoApprovedPrivateLinkServicesResult, err error) { 698 err = autorest.Respond( 699 resp, 700 azure.WithErrorUnlessStatusCode(http.StatusOK), 701 autorest.ByUnmarshallingJSON(&result), 702 autorest.ByClosing()) 703 result.Response = autorest.Response{Response: resp} 704 return 705} 706 707// listAutoApprovedPrivateLinkServicesNextResults retrieves the next set of results, if any. 708func (client PrivateLinkServicesClient) listAutoApprovedPrivateLinkServicesNextResults(ctx context.Context, lastResults AutoApprovedPrivateLinkServicesResult) (result AutoApprovedPrivateLinkServicesResult, err error) { 709 req, err := lastResults.autoApprovedPrivateLinkServicesResultPreparer(ctx) 710 if err != nil { 711 return result, autorest.NewErrorWithError(err, "network.PrivateLinkServicesClient", "listAutoApprovedPrivateLinkServicesNextResults", nil, "Failure preparing next results request") 712 } 713 if req == nil { 714 return 715 } 716 resp, err := client.ListAutoApprovedPrivateLinkServicesSender(req) 717 if err != nil { 718 result.Response = autorest.Response{Response: resp} 719 return result, autorest.NewErrorWithError(err, "network.PrivateLinkServicesClient", "listAutoApprovedPrivateLinkServicesNextResults", resp, "Failure sending next results request") 720 } 721 result, err = client.ListAutoApprovedPrivateLinkServicesResponder(resp) 722 if err != nil { 723 err = autorest.NewErrorWithError(err, "network.PrivateLinkServicesClient", "listAutoApprovedPrivateLinkServicesNextResults", resp, "Failure responding to next results request") 724 } 725 return 726} 727 728// ListAutoApprovedPrivateLinkServicesComplete enumerates all values, automatically crossing page boundaries as required. 729func (client PrivateLinkServicesClient) ListAutoApprovedPrivateLinkServicesComplete(ctx context.Context, location string) (result AutoApprovedPrivateLinkServicesResultIterator, err error) { 730 if tracing.IsEnabled() { 731 ctx = tracing.StartSpan(ctx, fqdn+"/PrivateLinkServicesClient.ListAutoApprovedPrivateLinkServices") 732 defer func() { 733 sc := -1 734 if result.Response().Response.Response != nil { 735 sc = result.page.Response().Response.Response.StatusCode 736 } 737 tracing.EndSpan(ctx, sc, err) 738 }() 739 } 740 result.page, err = client.ListAutoApprovedPrivateLinkServices(ctx, location) 741 return 742} 743 744// ListAutoApprovedPrivateLinkServicesByResourceGroup returns all of the private link service ids that can be linked to 745// a Private Endpoint with auto approved in this subscription in this region. 746// Parameters: 747// location - the location of the domain name. 748// resourceGroupName - the name of the resource group. 749func (client PrivateLinkServicesClient) ListAutoApprovedPrivateLinkServicesByResourceGroup(ctx context.Context, location string, resourceGroupName string) (result AutoApprovedPrivateLinkServicesResultPage, err error) { 750 if tracing.IsEnabled() { 751 ctx = tracing.StartSpan(ctx, fqdn+"/PrivateLinkServicesClient.ListAutoApprovedPrivateLinkServicesByResourceGroup") 752 defer func() { 753 sc := -1 754 if result.aaplsr.Response.Response != nil { 755 sc = result.aaplsr.Response.Response.StatusCode 756 } 757 tracing.EndSpan(ctx, sc, err) 758 }() 759 } 760 result.fn = client.listAutoApprovedPrivateLinkServicesByResourceGroupNextResults 761 req, err := client.ListAutoApprovedPrivateLinkServicesByResourceGroupPreparer(ctx, location, resourceGroupName) 762 if err != nil { 763 err = autorest.NewErrorWithError(err, "network.PrivateLinkServicesClient", "ListAutoApprovedPrivateLinkServicesByResourceGroup", nil, "Failure preparing request") 764 return 765 } 766 767 resp, err := client.ListAutoApprovedPrivateLinkServicesByResourceGroupSender(req) 768 if err != nil { 769 result.aaplsr.Response = autorest.Response{Response: resp} 770 err = autorest.NewErrorWithError(err, "network.PrivateLinkServicesClient", "ListAutoApprovedPrivateLinkServicesByResourceGroup", resp, "Failure sending request") 771 return 772 } 773 774 result.aaplsr, err = client.ListAutoApprovedPrivateLinkServicesByResourceGroupResponder(resp) 775 if err != nil { 776 err = autorest.NewErrorWithError(err, "network.PrivateLinkServicesClient", "ListAutoApprovedPrivateLinkServicesByResourceGroup", resp, "Failure responding to request") 777 return 778 } 779 if result.aaplsr.hasNextLink() && result.aaplsr.IsEmpty() { 780 err = result.NextWithContext(ctx) 781 return 782 } 783 784 return 785} 786 787// ListAutoApprovedPrivateLinkServicesByResourceGroupPreparer prepares the ListAutoApprovedPrivateLinkServicesByResourceGroup request. 788func (client PrivateLinkServicesClient) ListAutoApprovedPrivateLinkServicesByResourceGroupPreparer(ctx context.Context, location string, resourceGroupName string) (*http.Request, error) { 789 pathParameters := map[string]interface{}{ 790 "location": autorest.Encode("path", location), 791 "resourceGroupName": autorest.Encode("path", resourceGroupName), 792 "subscriptionId": autorest.Encode("path", client.SubscriptionID), 793 } 794 795 const APIVersion = "2019-04-01" 796 queryParameters := map[string]interface{}{ 797 "api-version": APIVersion, 798 } 799 800 preparer := autorest.CreatePreparer( 801 autorest.AsGet(), 802 autorest.WithBaseURL(client.BaseURI), 803 autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/locations/{location}/autoApprovedPrivateLinkServices", pathParameters), 804 autorest.WithQueryParameters(queryParameters)) 805 return preparer.Prepare((&http.Request{}).WithContext(ctx)) 806} 807 808// ListAutoApprovedPrivateLinkServicesByResourceGroupSender sends the ListAutoApprovedPrivateLinkServicesByResourceGroup request. The method will close the 809// http.Response Body if it receives an error. 810func (client PrivateLinkServicesClient) ListAutoApprovedPrivateLinkServicesByResourceGroupSender(req *http.Request) (*http.Response, error) { 811 return client.Send(req, azure.DoRetryWithRegistration(client.Client)) 812} 813 814// ListAutoApprovedPrivateLinkServicesByResourceGroupResponder handles the response to the ListAutoApprovedPrivateLinkServicesByResourceGroup request. The method always 815// closes the http.Response Body. 816func (client PrivateLinkServicesClient) ListAutoApprovedPrivateLinkServicesByResourceGroupResponder(resp *http.Response) (result AutoApprovedPrivateLinkServicesResult, err error) { 817 err = autorest.Respond( 818 resp, 819 azure.WithErrorUnlessStatusCode(http.StatusOK), 820 autorest.ByUnmarshallingJSON(&result), 821 autorest.ByClosing()) 822 result.Response = autorest.Response{Response: resp} 823 return 824} 825 826// listAutoApprovedPrivateLinkServicesByResourceGroupNextResults retrieves the next set of results, if any. 827func (client PrivateLinkServicesClient) listAutoApprovedPrivateLinkServicesByResourceGroupNextResults(ctx context.Context, lastResults AutoApprovedPrivateLinkServicesResult) (result AutoApprovedPrivateLinkServicesResult, err error) { 828 req, err := lastResults.autoApprovedPrivateLinkServicesResultPreparer(ctx) 829 if err != nil { 830 return result, autorest.NewErrorWithError(err, "network.PrivateLinkServicesClient", "listAutoApprovedPrivateLinkServicesByResourceGroupNextResults", nil, "Failure preparing next results request") 831 } 832 if req == nil { 833 return 834 } 835 resp, err := client.ListAutoApprovedPrivateLinkServicesByResourceGroupSender(req) 836 if err != nil { 837 result.Response = autorest.Response{Response: resp} 838 return result, autorest.NewErrorWithError(err, "network.PrivateLinkServicesClient", "listAutoApprovedPrivateLinkServicesByResourceGroupNextResults", resp, "Failure sending next results request") 839 } 840 result, err = client.ListAutoApprovedPrivateLinkServicesByResourceGroupResponder(resp) 841 if err != nil { 842 err = autorest.NewErrorWithError(err, "network.PrivateLinkServicesClient", "listAutoApprovedPrivateLinkServicesByResourceGroupNextResults", resp, "Failure responding to next results request") 843 } 844 return 845} 846 847// ListAutoApprovedPrivateLinkServicesByResourceGroupComplete enumerates all values, automatically crossing page boundaries as required. 848func (client PrivateLinkServicesClient) ListAutoApprovedPrivateLinkServicesByResourceGroupComplete(ctx context.Context, location string, resourceGroupName string) (result AutoApprovedPrivateLinkServicesResultIterator, err error) { 849 if tracing.IsEnabled() { 850 ctx = tracing.StartSpan(ctx, fqdn+"/PrivateLinkServicesClient.ListAutoApprovedPrivateLinkServicesByResourceGroup") 851 defer func() { 852 sc := -1 853 if result.Response().Response.Response != nil { 854 sc = result.page.Response().Response.Response.StatusCode 855 } 856 tracing.EndSpan(ctx, sc, err) 857 }() 858 } 859 result.page, err = client.ListAutoApprovedPrivateLinkServicesByResourceGroup(ctx, location, resourceGroupName) 860 return 861} 862 863// ListBySubscription gets all private link service in a subscription. 864func (client PrivateLinkServicesClient) ListBySubscription(ctx context.Context) (result PrivateLinkServiceListResultPage, err error) { 865 if tracing.IsEnabled() { 866 ctx = tracing.StartSpan(ctx, fqdn+"/PrivateLinkServicesClient.ListBySubscription") 867 defer func() { 868 sc := -1 869 if result.plslr.Response.Response != nil { 870 sc = result.plslr.Response.Response.StatusCode 871 } 872 tracing.EndSpan(ctx, sc, err) 873 }() 874 } 875 result.fn = client.listBySubscriptionNextResults 876 req, err := client.ListBySubscriptionPreparer(ctx) 877 if err != nil { 878 err = autorest.NewErrorWithError(err, "network.PrivateLinkServicesClient", "ListBySubscription", nil, "Failure preparing request") 879 return 880 } 881 882 resp, err := client.ListBySubscriptionSender(req) 883 if err != nil { 884 result.plslr.Response = autorest.Response{Response: resp} 885 err = autorest.NewErrorWithError(err, "network.PrivateLinkServicesClient", "ListBySubscription", resp, "Failure sending request") 886 return 887 } 888 889 result.plslr, err = client.ListBySubscriptionResponder(resp) 890 if err != nil { 891 err = autorest.NewErrorWithError(err, "network.PrivateLinkServicesClient", "ListBySubscription", resp, "Failure responding to request") 892 return 893 } 894 if result.plslr.hasNextLink() && result.plslr.IsEmpty() { 895 err = result.NextWithContext(ctx) 896 return 897 } 898 899 return 900} 901 902// ListBySubscriptionPreparer prepares the ListBySubscription request. 903func (client PrivateLinkServicesClient) ListBySubscriptionPreparer(ctx context.Context) (*http.Request, error) { 904 pathParameters := map[string]interface{}{ 905 "subscriptionId": autorest.Encode("path", client.SubscriptionID), 906 } 907 908 const APIVersion = "2019-04-01" 909 queryParameters := map[string]interface{}{ 910 "api-version": APIVersion, 911 } 912 913 preparer := autorest.CreatePreparer( 914 autorest.AsGet(), 915 autorest.WithBaseURL(client.BaseURI), 916 autorest.WithPathParameters("/subscriptions/{subscriptionId}/providers/Microsoft.Network/privateLinkServices", pathParameters), 917 autorest.WithQueryParameters(queryParameters)) 918 return preparer.Prepare((&http.Request{}).WithContext(ctx)) 919} 920 921// ListBySubscriptionSender sends the ListBySubscription request. The method will close the 922// http.Response Body if it receives an error. 923func (client PrivateLinkServicesClient) ListBySubscriptionSender(req *http.Request) (*http.Response, error) { 924 return client.Send(req, azure.DoRetryWithRegistration(client.Client)) 925} 926 927// ListBySubscriptionResponder handles the response to the ListBySubscription request. The method always 928// closes the http.Response Body. 929func (client PrivateLinkServicesClient) ListBySubscriptionResponder(resp *http.Response) (result PrivateLinkServiceListResult, err error) { 930 err = autorest.Respond( 931 resp, 932 azure.WithErrorUnlessStatusCode(http.StatusOK), 933 autorest.ByUnmarshallingJSON(&result), 934 autorest.ByClosing()) 935 result.Response = autorest.Response{Response: resp} 936 return 937} 938 939// listBySubscriptionNextResults retrieves the next set of results, if any. 940func (client PrivateLinkServicesClient) listBySubscriptionNextResults(ctx context.Context, lastResults PrivateLinkServiceListResult) (result PrivateLinkServiceListResult, err error) { 941 req, err := lastResults.privateLinkServiceListResultPreparer(ctx) 942 if err != nil { 943 return result, autorest.NewErrorWithError(err, "network.PrivateLinkServicesClient", "listBySubscriptionNextResults", nil, "Failure preparing next results request") 944 } 945 if req == nil { 946 return 947 } 948 resp, err := client.ListBySubscriptionSender(req) 949 if err != nil { 950 result.Response = autorest.Response{Response: resp} 951 return result, autorest.NewErrorWithError(err, "network.PrivateLinkServicesClient", "listBySubscriptionNextResults", resp, "Failure sending next results request") 952 } 953 result, err = client.ListBySubscriptionResponder(resp) 954 if err != nil { 955 err = autorest.NewErrorWithError(err, "network.PrivateLinkServicesClient", "listBySubscriptionNextResults", resp, "Failure responding to next results request") 956 } 957 return 958} 959 960// ListBySubscriptionComplete enumerates all values, automatically crossing page boundaries as required. 961func (client PrivateLinkServicesClient) ListBySubscriptionComplete(ctx context.Context) (result PrivateLinkServiceListResultIterator, err error) { 962 if tracing.IsEnabled() { 963 ctx = tracing.StartSpan(ctx, fqdn+"/PrivateLinkServicesClient.ListBySubscription") 964 defer func() { 965 sc := -1 966 if result.Response().Response.Response != nil { 967 sc = result.page.Response().Response.Response.StatusCode 968 } 969 tracing.EndSpan(ctx, sc, err) 970 }() 971 } 972 result.page, err = client.ListBySubscription(ctx) 973 return 974} 975 976// UpdatePrivateEndpointConnection approve or reject private end point connection for a private link service in a 977// subscription. 978// Parameters: 979// resourceGroupName - the name of the resource group. 980// serviceName - the name of the private link service. 981// peConnectionName - the name of the private end point connection. 982// parameters - parameters supplied to approve or reject the private end point connection. 983func (client PrivateLinkServicesClient) UpdatePrivateEndpointConnection(ctx context.Context, resourceGroupName string, serviceName string, peConnectionName string, parameters PrivateEndpointConnection) (result PrivateEndpointConnection, err error) { 984 if tracing.IsEnabled() { 985 ctx = tracing.StartSpan(ctx, fqdn+"/PrivateLinkServicesClient.UpdatePrivateEndpointConnection") 986 defer func() { 987 sc := -1 988 if result.Response.Response != nil { 989 sc = result.Response.Response.StatusCode 990 } 991 tracing.EndSpan(ctx, sc, err) 992 }() 993 } 994 req, err := client.UpdatePrivateEndpointConnectionPreparer(ctx, resourceGroupName, serviceName, peConnectionName, parameters) 995 if err != nil { 996 err = autorest.NewErrorWithError(err, "network.PrivateLinkServicesClient", "UpdatePrivateEndpointConnection", nil, "Failure preparing request") 997 return 998 } 999 1000 resp, err := client.UpdatePrivateEndpointConnectionSender(req) 1001 if err != nil { 1002 result.Response = autorest.Response{Response: resp} 1003 err = autorest.NewErrorWithError(err, "network.PrivateLinkServicesClient", "UpdatePrivateEndpointConnection", resp, "Failure sending request") 1004 return 1005 } 1006 1007 result, err = client.UpdatePrivateEndpointConnectionResponder(resp) 1008 if err != nil { 1009 err = autorest.NewErrorWithError(err, "network.PrivateLinkServicesClient", "UpdatePrivateEndpointConnection", resp, "Failure responding to request") 1010 return 1011 } 1012 1013 return 1014} 1015 1016// UpdatePrivateEndpointConnectionPreparer prepares the UpdatePrivateEndpointConnection request. 1017func (client PrivateLinkServicesClient) UpdatePrivateEndpointConnectionPreparer(ctx context.Context, resourceGroupName string, serviceName string, peConnectionName string, parameters PrivateEndpointConnection) (*http.Request, error) { 1018 pathParameters := map[string]interface{}{ 1019 "peConnectionName": autorest.Encode("path", peConnectionName), 1020 "resourceGroupName": autorest.Encode("path", resourceGroupName), 1021 "serviceName": autorest.Encode("path", serviceName), 1022 "subscriptionId": autorest.Encode("path", client.SubscriptionID), 1023 } 1024 1025 const APIVersion = "2019-04-01" 1026 queryParameters := map[string]interface{}{ 1027 "api-version": APIVersion, 1028 } 1029 1030 parameters.Type = nil 1031 parameters.Etag = nil 1032 preparer := autorest.CreatePreparer( 1033 autorest.AsContentType("application/json; charset=utf-8"), 1034 autorest.AsPut(), 1035 autorest.WithBaseURL(client.BaseURI), 1036 autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/privateLinkServices/{serviceName}/privateEndpointConnections/{peConnectionName}", pathParameters), 1037 autorest.WithJSON(parameters), 1038 autorest.WithQueryParameters(queryParameters)) 1039 return preparer.Prepare((&http.Request{}).WithContext(ctx)) 1040} 1041 1042// UpdatePrivateEndpointConnectionSender sends the UpdatePrivateEndpointConnection request. The method will close the 1043// http.Response Body if it receives an error. 1044func (client PrivateLinkServicesClient) UpdatePrivateEndpointConnectionSender(req *http.Request) (*http.Response, error) { 1045 return client.Send(req, azure.DoRetryWithRegistration(client.Client)) 1046} 1047 1048// UpdatePrivateEndpointConnectionResponder handles the response to the UpdatePrivateEndpointConnection request. The method always 1049// closes the http.Response Body. 1050func (client PrivateLinkServicesClient) UpdatePrivateEndpointConnectionResponder(resp *http.Response) (result PrivateEndpointConnection, err error) { 1051 err = autorest.Respond( 1052 resp, 1053 azure.WithErrorUnlessStatusCode(http.StatusOK), 1054 autorest.ByUnmarshallingJSON(&result), 1055 autorest.ByClosing()) 1056 result.Response = autorest.Response{Response: resp} 1057 return 1058} 1059