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