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