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