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