github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/network/armnetwork/v6@v6.2.0/applicationgateways_client.go (about)

     1  //go:build go1.18
     2  // +build go1.18
     3  
     4  // Copyright (c) Microsoft Corporation. All rights reserved.
     5  // Licensed under the MIT License. See License.txt in the project root for license information.
     6  // Code generated by Microsoft (R) AutoRest Code Generator. DO NOT EDIT.
     7  // Changes may cause incorrect behavior and will be lost if the code is regenerated.
     8  
     9  package armnetwork
    10  
    11  import (
    12  	"context"
    13  	"errors"
    14  	"github.com/Azure/azure-sdk-for-go/sdk/azcore"
    15  	"github.com/Azure/azure-sdk-for-go/sdk/azcore/arm"
    16  	"github.com/Azure/azure-sdk-for-go/sdk/azcore/policy"
    17  	"github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime"
    18  	"net/http"
    19  	"net/url"
    20  	"strings"
    21  )
    22  
    23  // ApplicationGatewaysClient contains the methods for the ApplicationGateways group.
    24  // Don't use this type directly, use NewApplicationGatewaysClient() instead.
    25  type ApplicationGatewaysClient struct {
    26  	internal       *arm.Client
    27  	subscriptionID string
    28  }
    29  
    30  // NewApplicationGatewaysClient creates a new instance of ApplicationGatewaysClient with the specified values.
    31  //   - subscriptionID - The subscription credentials which uniquely identify the Microsoft Azure subscription. The subscription
    32  //     ID forms part of the URI for every service call.
    33  //   - credential - used to authorize requests. Usually a credential from azidentity.
    34  //   - options - pass nil to accept the default values.
    35  func NewApplicationGatewaysClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) (*ApplicationGatewaysClient, error) {
    36  	cl, err := arm.NewClient(moduleName, moduleVersion, credential, options)
    37  	if err != nil {
    38  		return nil, err
    39  	}
    40  	client := &ApplicationGatewaysClient{
    41  		subscriptionID: subscriptionID,
    42  		internal:       cl,
    43  	}
    44  	return client, nil
    45  }
    46  
    47  // BeginBackendHealth - Gets the backend health of the specified application gateway in a resource group.
    48  // If the operation fails it returns an *azcore.ResponseError type.
    49  //
    50  // Generated from API version 2024-05-01
    51  //   - resourceGroupName - The name of the resource group.
    52  //   - applicationGatewayName - The name of the application gateway.
    53  //   - options - ApplicationGatewaysClientBeginBackendHealthOptions contains the optional parameters for the ApplicationGatewaysClient.BeginBackendHealth
    54  //     method.
    55  func (client *ApplicationGatewaysClient) BeginBackendHealth(ctx context.Context, resourceGroupName string, applicationGatewayName string, options *ApplicationGatewaysClientBeginBackendHealthOptions) (*runtime.Poller[ApplicationGatewaysClientBackendHealthResponse], error) {
    56  	if options == nil || options.ResumeToken == "" {
    57  		resp, err := client.backendHealth(ctx, resourceGroupName, applicationGatewayName, options)
    58  		if err != nil {
    59  			return nil, err
    60  		}
    61  		poller, err := runtime.NewPoller(resp, client.internal.Pipeline(), &runtime.NewPollerOptions[ApplicationGatewaysClientBackendHealthResponse]{
    62  			FinalStateVia: runtime.FinalStateViaLocation,
    63  			Tracer:        client.internal.Tracer(),
    64  		})
    65  		return poller, err
    66  	} else {
    67  		return runtime.NewPollerFromResumeToken(options.ResumeToken, client.internal.Pipeline(), &runtime.NewPollerFromResumeTokenOptions[ApplicationGatewaysClientBackendHealthResponse]{
    68  			Tracer: client.internal.Tracer(),
    69  		})
    70  	}
    71  }
    72  
    73  // BackendHealth - Gets the backend health of the specified application gateway in a resource group.
    74  // If the operation fails it returns an *azcore.ResponseError type.
    75  //
    76  // Generated from API version 2024-05-01
    77  func (client *ApplicationGatewaysClient) backendHealth(ctx context.Context, resourceGroupName string, applicationGatewayName string, options *ApplicationGatewaysClientBeginBackendHealthOptions) (*http.Response, error) {
    78  	var err error
    79  	const operationName = "ApplicationGatewaysClient.BeginBackendHealth"
    80  	ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName)
    81  	ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil)
    82  	defer func() { endSpan(err) }()
    83  	req, err := client.backendHealthCreateRequest(ctx, resourceGroupName, applicationGatewayName, options)
    84  	if err != nil {
    85  		return nil, err
    86  	}
    87  	httpResp, err := client.internal.Pipeline().Do(req)
    88  	if err != nil {
    89  		return nil, err
    90  	}
    91  	if !runtime.HasStatusCode(httpResp, http.StatusOK, http.StatusAccepted) {
    92  		err = runtime.NewResponseError(httpResp)
    93  		return nil, err
    94  	}
    95  	return httpResp, nil
    96  }
    97  
    98  // backendHealthCreateRequest creates the BackendHealth request.
    99  func (client *ApplicationGatewaysClient) backendHealthCreateRequest(ctx context.Context, resourceGroupName string, applicationGatewayName string, options *ApplicationGatewaysClientBeginBackendHealthOptions) (*policy.Request, error) {
   100  	urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/applicationGateways/{applicationGatewayName}/backendhealth"
   101  	if resourceGroupName == "" {
   102  		return nil, errors.New("parameter resourceGroupName cannot be empty")
   103  	}
   104  	urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName))
   105  	if applicationGatewayName == "" {
   106  		return nil, errors.New("parameter applicationGatewayName cannot be empty")
   107  	}
   108  	urlPath = strings.ReplaceAll(urlPath, "{applicationGatewayName}", url.PathEscape(applicationGatewayName))
   109  	if client.subscriptionID == "" {
   110  		return nil, errors.New("parameter client.subscriptionID cannot be empty")
   111  	}
   112  	urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID))
   113  	req, err := runtime.NewRequest(ctx, http.MethodPost, runtime.JoinPaths(client.internal.Endpoint(), urlPath))
   114  	if err != nil {
   115  		return nil, err
   116  	}
   117  	reqQP := req.Raw().URL.Query()
   118  	if options != nil && options.Expand != nil {
   119  		reqQP.Set("$expand", *options.Expand)
   120  	}
   121  	reqQP.Set("api-version", "2024-05-01")
   122  	req.Raw().URL.RawQuery = reqQP.Encode()
   123  	req.Raw().Header["Accept"] = []string{"application/json"}
   124  	return req, nil
   125  }
   126  
   127  // BeginBackendHealthOnDemand - Gets the backend health for given combination of backend pool and http setting of the specified
   128  // application gateway in a resource group.
   129  // If the operation fails it returns an *azcore.ResponseError type.
   130  //
   131  // Generated from API version 2024-05-01
   132  //   - resourceGroupName - The name of the resource group.
   133  //   - applicationGatewayName - The name of the application gateway.
   134  //   - probeRequest - Request body for on-demand test probe operation.
   135  //   - options - ApplicationGatewaysClientBeginBackendHealthOnDemandOptions contains the optional parameters for the ApplicationGatewaysClient.BeginBackendHealthOnDemand
   136  //     method.
   137  func (client *ApplicationGatewaysClient) BeginBackendHealthOnDemand(ctx context.Context, resourceGroupName string, applicationGatewayName string, probeRequest ApplicationGatewayOnDemandProbe, options *ApplicationGatewaysClientBeginBackendHealthOnDemandOptions) (*runtime.Poller[ApplicationGatewaysClientBackendHealthOnDemandResponse], error) {
   138  	if options == nil || options.ResumeToken == "" {
   139  		resp, err := client.backendHealthOnDemand(ctx, resourceGroupName, applicationGatewayName, probeRequest, options)
   140  		if err != nil {
   141  			return nil, err
   142  		}
   143  		poller, err := runtime.NewPoller(resp, client.internal.Pipeline(), &runtime.NewPollerOptions[ApplicationGatewaysClientBackendHealthOnDemandResponse]{
   144  			FinalStateVia: runtime.FinalStateViaLocation,
   145  			Tracer:        client.internal.Tracer(),
   146  		})
   147  		return poller, err
   148  	} else {
   149  		return runtime.NewPollerFromResumeToken(options.ResumeToken, client.internal.Pipeline(), &runtime.NewPollerFromResumeTokenOptions[ApplicationGatewaysClientBackendHealthOnDemandResponse]{
   150  			Tracer: client.internal.Tracer(),
   151  		})
   152  	}
   153  }
   154  
   155  // BackendHealthOnDemand - Gets the backend health for given combination of backend pool and http setting of the specified
   156  // application gateway in a resource group.
   157  // If the operation fails it returns an *azcore.ResponseError type.
   158  //
   159  // Generated from API version 2024-05-01
   160  func (client *ApplicationGatewaysClient) backendHealthOnDemand(ctx context.Context, resourceGroupName string, applicationGatewayName string, probeRequest ApplicationGatewayOnDemandProbe, options *ApplicationGatewaysClientBeginBackendHealthOnDemandOptions) (*http.Response, error) {
   161  	var err error
   162  	const operationName = "ApplicationGatewaysClient.BeginBackendHealthOnDemand"
   163  	ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName)
   164  	ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil)
   165  	defer func() { endSpan(err) }()
   166  	req, err := client.backendHealthOnDemandCreateRequest(ctx, resourceGroupName, applicationGatewayName, probeRequest, options)
   167  	if err != nil {
   168  		return nil, err
   169  	}
   170  	httpResp, err := client.internal.Pipeline().Do(req)
   171  	if err != nil {
   172  		return nil, err
   173  	}
   174  	if !runtime.HasStatusCode(httpResp, http.StatusOK, http.StatusAccepted) {
   175  		err = runtime.NewResponseError(httpResp)
   176  		return nil, err
   177  	}
   178  	return httpResp, nil
   179  }
   180  
   181  // backendHealthOnDemandCreateRequest creates the BackendHealthOnDemand request.
   182  func (client *ApplicationGatewaysClient) backendHealthOnDemandCreateRequest(ctx context.Context, resourceGroupName string, applicationGatewayName string, probeRequest ApplicationGatewayOnDemandProbe, options *ApplicationGatewaysClientBeginBackendHealthOnDemandOptions) (*policy.Request, error) {
   183  	urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/applicationGateways/{applicationGatewayName}/getBackendHealthOnDemand"
   184  	if resourceGroupName == "" {
   185  		return nil, errors.New("parameter resourceGroupName cannot be empty")
   186  	}
   187  	urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName))
   188  	if applicationGatewayName == "" {
   189  		return nil, errors.New("parameter applicationGatewayName cannot be empty")
   190  	}
   191  	urlPath = strings.ReplaceAll(urlPath, "{applicationGatewayName}", url.PathEscape(applicationGatewayName))
   192  	if client.subscriptionID == "" {
   193  		return nil, errors.New("parameter client.subscriptionID cannot be empty")
   194  	}
   195  	urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID))
   196  	req, err := runtime.NewRequest(ctx, http.MethodPost, runtime.JoinPaths(client.internal.Endpoint(), urlPath))
   197  	if err != nil {
   198  		return nil, err
   199  	}
   200  	reqQP := req.Raw().URL.Query()
   201  	if options != nil && options.Expand != nil {
   202  		reqQP.Set("$expand", *options.Expand)
   203  	}
   204  	reqQP.Set("api-version", "2024-05-01")
   205  	req.Raw().URL.RawQuery = reqQP.Encode()
   206  	req.Raw().Header["Accept"] = []string{"application/json"}
   207  	if err := runtime.MarshalAsJSON(req, probeRequest); err != nil {
   208  		return nil, err
   209  	}
   210  	return req, nil
   211  }
   212  
   213  // BeginCreateOrUpdate - Creates or updates the specified application gateway.
   214  // If the operation fails it returns an *azcore.ResponseError type.
   215  //
   216  // Generated from API version 2024-05-01
   217  //   - resourceGroupName - The name of the resource group.
   218  //   - applicationGatewayName - The name of the application gateway.
   219  //   - parameters - Parameters supplied to the create or update application gateway operation.
   220  //   - options - ApplicationGatewaysClientBeginCreateOrUpdateOptions contains the optional parameters for the ApplicationGatewaysClient.BeginCreateOrUpdate
   221  //     method.
   222  func (client *ApplicationGatewaysClient) BeginCreateOrUpdate(ctx context.Context, resourceGroupName string, applicationGatewayName string, parameters ApplicationGateway, options *ApplicationGatewaysClientBeginCreateOrUpdateOptions) (*runtime.Poller[ApplicationGatewaysClientCreateOrUpdateResponse], error) {
   223  	if options == nil || options.ResumeToken == "" {
   224  		resp, err := client.createOrUpdate(ctx, resourceGroupName, applicationGatewayName, parameters, options)
   225  		if err != nil {
   226  			return nil, err
   227  		}
   228  		poller, err := runtime.NewPoller(resp, client.internal.Pipeline(), &runtime.NewPollerOptions[ApplicationGatewaysClientCreateOrUpdateResponse]{
   229  			FinalStateVia: runtime.FinalStateViaAzureAsyncOp,
   230  			Tracer:        client.internal.Tracer(),
   231  		})
   232  		return poller, err
   233  	} else {
   234  		return runtime.NewPollerFromResumeToken(options.ResumeToken, client.internal.Pipeline(), &runtime.NewPollerFromResumeTokenOptions[ApplicationGatewaysClientCreateOrUpdateResponse]{
   235  			Tracer: client.internal.Tracer(),
   236  		})
   237  	}
   238  }
   239  
   240  // CreateOrUpdate - Creates or updates the specified application gateway.
   241  // If the operation fails it returns an *azcore.ResponseError type.
   242  //
   243  // Generated from API version 2024-05-01
   244  func (client *ApplicationGatewaysClient) createOrUpdate(ctx context.Context, resourceGroupName string, applicationGatewayName string, parameters ApplicationGateway, options *ApplicationGatewaysClientBeginCreateOrUpdateOptions) (*http.Response, error) {
   245  	var err error
   246  	const operationName = "ApplicationGatewaysClient.BeginCreateOrUpdate"
   247  	ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName)
   248  	ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil)
   249  	defer func() { endSpan(err) }()
   250  	req, err := client.createOrUpdateCreateRequest(ctx, resourceGroupName, applicationGatewayName, parameters, options)
   251  	if err != nil {
   252  		return nil, err
   253  	}
   254  	httpResp, err := client.internal.Pipeline().Do(req)
   255  	if err != nil {
   256  		return nil, err
   257  	}
   258  	if !runtime.HasStatusCode(httpResp, http.StatusOK, http.StatusCreated) {
   259  		err = runtime.NewResponseError(httpResp)
   260  		return nil, err
   261  	}
   262  	return httpResp, nil
   263  }
   264  
   265  // createOrUpdateCreateRequest creates the CreateOrUpdate request.
   266  func (client *ApplicationGatewaysClient) createOrUpdateCreateRequest(ctx context.Context, resourceGroupName string, applicationGatewayName string, parameters ApplicationGateway, options *ApplicationGatewaysClientBeginCreateOrUpdateOptions) (*policy.Request, error) {
   267  	urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/applicationGateways/{applicationGatewayName}"
   268  	if resourceGroupName == "" {
   269  		return nil, errors.New("parameter resourceGroupName cannot be empty")
   270  	}
   271  	urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName))
   272  	if applicationGatewayName == "" {
   273  		return nil, errors.New("parameter applicationGatewayName cannot be empty")
   274  	}
   275  	urlPath = strings.ReplaceAll(urlPath, "{applicationGatewayName}", url.PathEscape(applicationGatewayName))
   276  	if client.subscriptionID == "" {
   277  		return nil, errors.New("parameter client.subscriptionID cannot be empty")
   278  	}
   279  	urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID))
   280  	req, err := runtime.NewRequest(ctx, http.MethodPut, runtime.JoinPaths(client.internal.Endpoint(), urlPath))
   281  	if err != nil {
   282  		return nil, err
   283  	}
   284  	reqQP := req.Raw().URL.Query()
   285  	reqQP.Set("api-version", "2024-05-01")
   286  	req.Raw().URL.RawQuery = reqQP.Encode()
   287  	req.Raw().Header["Accept"] = []string{"application/json"}
   288  	if err := runtime.MarshalAsJSON(req, parameters); err != nil {
   289  		return nil, err
   290  	}
   291  	return req, nil
   292  }
   293  
   294  // BeginDelete - Deletes the specified application gateway.
   295  // If the operation fails it returns an *azcore.ResponseError type.
   296  //
   297  // Generated from API version 2024-05-01
   298  //   - resourceGroupName - The name of the resource group.
   299  //   - applicationGatewayName - The name of the application gateway.
   300  //   - options - ApplicationGatewaysClientBeginDeleteOptions contains the optional parameters for the ApplicationGatewaysClient.BeginDelete
   301  //     method.
   302  func (client *ApplicationGatewaysClient) BeginDelete(ctx context.Context, resourceGroupName string, applicationGatewayName string, options *ApplicationGatewaysClientBeginDeleteOptions) (*runtime.Poller[ApplicationGatewaysClientDeleteResponse], error) {
   303  	if options == nil || options.ResumeToken == "" {
   304  		resp, err := client.deleteOperation(ctx, resourceGroupName, applicationGatewayName, options)
   305  		if err != nil {
   306  			return nil, err
   307  		}
   308  		poller, err := runtime.NewPoller(resp, client.internal.Pipeline(), &runtime.NewPollerOptions[ApplicationGatewaysClientDeleteResponse]{
   309  			FinalStateVia: runtime.FinalStateViaLocation,
   310  			Tracer:        client.internal.Tracer(),
   311  		})
   312  		return poller, err
   313  	} else {
   314  		return runtime.NewPollerFromResumeToken(options.ResumeToken, client.internal.Pipeline(), &runtime.NewPollerFromResumeTokenOptions[ApplicationGatewaysClientDeleteResponse]{
   315  			Tracer: client.internal.Tracer(),
   316  		})
   317  	}
   318  }
   319  
   320  // Delete - Deletes the specified application gateway.
   321  // If the operation fails it returns an *azcore.ResponseError type.
   322  //
   323  // Generated from API version 2024-05-01
   324  func (client *ApplicationGatewaysClient) deleteOperation(ctx context.Context, resourceGroupName string, applicationGatewayName string, options *ApplicationGatewaysClientBeginDeleteOptions) (*http.Response, error) {
   325  	var err error
   326  	const operationName = "ApplicationGatewaysClient.BeginDelete"
   327  	ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName)
   328  	ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil)
   329  	defer func() { endSpan(err) }()
   330  	req, err := client.deleteCreateRequest(ctx, resourceGroupName, applicationGatewayName, options)
   331  	if err != nil {
   332  		return nil, err
   333  	}
   334  	httpResp, err := client.internal.Pipeline().Do(req)
   335  	if err != nil {
   336  		return nil, err
   337  	}
   338  	if !runtime.HasStatusCode(httpResp, http.StatusOK, http.StatusAccepted, http.StatusNoContent) {
   339  		err = runtime.NewResponseError(httpResp)
   340  		return nil, err
   341  	}
   342  	return httpResp, nil
   343  }
   344  
   345  // deleteCreateRequest creates the Delete request.
   346  func (client *ApplicationGatewaysClient) deleteCreateRequest(ctx context.Context, resourceGroupName string, applicationGatewayName string, options *ApplicationGatewaysClientBeginDeleteOptions) (*policy.Request, error) {
   347  	urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/applicationGateways/{applicationGatewayName}"
   348  	if resourceGroupName == "" {
   349  		return nil, errors.New("parameter resourceGroupName cannot be empty")
   350  	}
   351  	urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName))
   352  	if applicationGatewayName == "" {
   353  		return nil, errors.New("parameter applicationGatewayName cannot be empty")
   354  	}
   355  	urlPath = strings.ReplaceAll(urlPath, "{applicationGatewayName}", url.PathEscape(applicationGatewayName))
   356  	if client.subscriptionID == "" {
   357  		return nil, errors.New("parameter client.subscriptionID cannot be empty")
   358  	}
   359  	urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID))
   360  	req, err := runtime.NewRequest(ctx, http.MethodDelete, runtime.JoinPaths(client.internal.Endpoint(), urlPath))
   361  	if err != nil {
   362  		return nil, err
   363  	}
   364  	reqQP := req.Raw().URL.Query()
   365  	reqQP.Set("api-version", "2024-05-01")
   366  	req.Raw().URL.RawQuery = reqQP.Encode()
   367  	req.Raw().Header["Accept"] = []string{"application/json"}
   368  	return req, nil
   369  }
   370  
   371  // Get - Gets the specified application gateway.
   372  // If the operation fails it returns an *azcore.ResponseError type.
   373  //
   374  // Generated from API version 2024-05-01
   375  //   - resourceGroupName - The name of the resource group.
   376  //   - applicationGatewayName - The name of the application gateway.
   377  //   - options - ApplicationGatewaysClientGetOptions contains the optional parameters for the ApplicationGatewaysClient.Get method.
   378  func (client *ApplicationGatewaysClient) Get(ctx context.Context, resourceGroupName string, applicationGatewayName string, options *ApplicationGatewaysClientGetOptions) (ApplicationGatewaysClientGetResponse, error) {
   379  	var err error
   380  	const operationName = "ApplicationGatewaysClient.Get"
   381  	ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName)
   382  	ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil)
   383  	defer func() { endSpan(err) }()
   384  	req, err := client.getCreateRequest(ctx, resourceGroupName, applicationGatewayName, options)
   385  	if err != nil {
   386  		return ApplicationGatewaysClientGetResponse{}, err
   387  	}
   388  	httpResp, err := client.internal.Pipeline().Do(req)
   389  	if err != nil {
   390  		return ApplicationGatewaysClientGetResponse{}, err
   391  	}
   392  	if !runtime.HasStatusCode(httpResp, http.StatusOK) {
   393  		err = runtime.NewResponseError(httpResp)
   394  		return ApplicationGatewaysClientGetResponse{}, err
   395  	}
   396  	resp, err := client.getHandleResponse(httpResp)
   397  	return resp, err
   398  }
   399  
   400  // getCreateRequest creates the Get request.
   401  func (client *ApplicationGatewaysClient) getCreateRequest(ctx context.Context, resourceGroupName string, applicationGatewayName string, options *ApplicationGatewaysClientGetOptions) (*policy.Request, error) {
   402  	urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/applicationGateways/{applicationGatewayName}"
   403  	if resourceGroupName == "" {
   404  		return nil, errors.New("parameter resourceGroupName cannot be empty")
   405  	}
   406  	urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName))
   407  	if applicationGatewayName == "" {
   408  		return nil, errors.New("parameter applicationGatewayName cannot be empty")
   409  	}
   410  	urlPath = strings.ReplaceAll(urlPath, "{applicationGatewayName}", url.PathEscape(applicationGatewayName))
   411  	if client.subscriptionID == "" {
   412  		return nil, errors.New("parameter client.subscriptionID cannot be empty")
   413  	}
   414  	urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID))
   415  	req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.internal.Endpoint(), urlPath))
   416  	if err != nil {
   417  		return nil, err
   418  	}
   419  	reqQP := req.Raw().URL.Query()
   420  	reqQP.Set("api-version", "2024-05-01")
   421  	req.Raw().URL.RawQuery = reqQP.Encode()
   422  	req.Raw().Header["Accept"] = []string{"application/json"}
   423  	return req, nil
   424  }
   425  
   426  // getHandleResponse handles the Get response.
   427  func (client *ApplicationGatewaysClient) getHandleResponse(resp *http.Response) (ApplicationGatewaysClientGetResponse, error) {
   428  	result := ApplicationGatewaysClientGetResponse{}
   429  	if err := runtime.UnmarshalAsJSON(resp, &result.ApplicationGateway); err != nil {
   430  		return ApplicationGatewaysClientGetResponse{}, err
   431  	}
   432  	return result, nil
   433  }
   434  
   435  // GetSSLPredefinedPolicy - Gets Ssl predefined policy with the specified policy name.
   436  // If the operation fails it returns an *azcore.ResponseError type.
   437  //
   438  // Generated from API version 2024-05-01
   439  //   - predefinedPolicyName - Name of Ssl predefined policy.
   440  //   - options - ApplicationGatewaysClientGetSSLPredefinedPolicyOptions contains the optional parameters for the ApplicationGatewaysClient.GetSSLPredefinedPolicy
   441  //     method.
   442  func (client *ApplicationGatewaysClient) GetSSLPredefinedPolicy(ctx context.Context, predefinedPolicyName string, options *ApplicationGatewaysClientGetSSLPredefinedPolicyOptions) (ApplicationGatewaysClientGetSSLPredefinedPolicyResponse, error) {
   443  	var err error
   444  	const operationName = "ApplicationGatewaysClient.GetSSLPredefinedPolicy"
   445  	ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName)
   446  	ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil)
   447  	defer func() { endSpan(err) }()
   448  	req, err := client.getSSLPredefinedPolicyCreateRequest(ctx, predefinedPolicyName, options)
   449  	if err != nil {
   450  		return ApplicationGatewaysClientGetSSLPredefinedPolicyResponse{}, err
   451  	}
   452  	httpResp, err := client.internal.Pipeline().Do(req)
   453  	if err != nil {
   454  		return ApplicationGatewaysClientGetSSLPredefinedPolicyResponse{}, err
   455  	}
   456  	if !runtime.HasStatusCode(httpResp, http.StatusOK) {
   457  		err = runtime.NewResponseError(httpResp)
   458  		return ApplicationGatewaysClientGetSSLPredefinedPolicyResponse{}, err
   459  	}
   460  	resp, err := client.getSSLPredefinedPolicyHandleResponse(httpResp)
   461  	return resp, err
   462  }
   463  
   464  // getSSLPredefinedPolicyCreateRequest creates the GetSSLPredefinedPolicy request.
   465  func (client *ApplicationGatewaysClient) getSSLPredefinedPolicyCreateRequest(ctx context.Context, predefinedPolicyName string, options *ApplicationGatewaysClientGetSSLPredefinedPolicyOptions) (*policy.Request, error) {
   466  	urlPath := "/subscriptions/{subscriptionId}/providers/Microsoft.Network/applicationGatewayAvailableSslOptions/default/predefinedPolicies/{predefinedPolicyName}"
   467  	if client.subscriptionID == "" {
   468  		return nil, errors.New("parameter client.subscriptionID cannot be empty")
   469  	}
   470  	urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID))
   471  	if predefinedPolicyName == "" {
   472  		return nil, errors.New("parameter predefinedPolicyName cannot be empty")
   473  	}
   474  	urlPath = strings.ReplaceAll(urlPath, "{predefinedPolicyName}", url.PathEscape(predefinedPolicyName))
   475  	req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.internal.Endpoint(), urlPath))
   476  	if err != nil {
   477  		return nil, err
   478  	}
   479  	reqQP := req.Raw().URL.Query()
   480  	reqQP.Set("api-version", "2024-05-01")
   481  	req.Raw().URL.RawQuery = reqQP.Encode()
   482  	req.Raw().Header["Accept"] = []string{"application/json"}
   483  	return req, nil
   484  }
   485  
   486  // getSSLPredefinedPolicyHandleResponse handles the GetSSLPredefinedPolicy response.
   487  func (client *ApplicationGatewaysClient) getSSLPredefinedPolicyHandleResponse(resp *http.Response) (ApplicationGatewaysClientGetSSLPredefinedPolicyResponse, error) {
   488  	result := ApplicationGatewaysClientGetSSLPredefinedPolicyResponse{}
   489  	if err := runtime.UnmarshalAsJSON(resp, &result.ApplicationGatewaySSLPredefinedPolicy); err != nil {
   490  		return ApplicationGatewaysClientGetSSLPredefinedPolicyResponse{}, err
   491  	}
   492  	return result, nil
   493  }
   494  
   495  // NewListPager - Lists all application gateways in a resource group.
   496  //
   497  // Generated from API version 2024-05-01
   498  //   - resourceGroupName - The name of the resource group.
   499  //   - options - ApplicationGatewaysClientListOptions contains the optional parameters for the ApplicationGatewaysClient.NewListPager
   500  //     method.
   501  func (client *ApplicationGatewaysClient) NewListPager(resourceGroupName string, options *ApplicationGatewaysClientListOptions) *runtime.Pager[ApplicationGatewaysClientListResponse] {
   502  	return runtime.NewPager(runtime.PagingHandler[ApplicationGatewaysClientListResponse]{
   503  		More: func(page ApplicationGatewaysClientListResponse) bool {
   504  			return page.NextLink != nil && len(*page.NextLink) > 0
   505  		},
   506  		Fetcher: func(ctx context.Context, page *ApplicationGatewaysClientListResponse) (ApplicationGatewaysClientListResponse, error) {
   507  			ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, "ApplicationGatewaysClient.NewListPager")
   508  			nextLink := ""
   509  			if page != nil {
   510  				nextLink = *page.NextLink
   511  			}
   512  			resp, err := runtime.FetcherForNextLink(ctx, client.internal.Pipeline(), nextLink, func(ctx context.Context) (*policy.Request, error) {
   513  				return client.listCreateRequest(ctx, resourceGroupName, options)
   514  			}, nil)
   515  			if err != nil {
   516  				return ApplicationGatewaysClientListResponse{}, err
   517  			}
   518  			return client.listHandleResponse(resp)
   519  		},
   520  		Tracer: client.internal.Tracer(),
   521  	})
   522  }
   523  
   524  // listCreateRequest creates the List request.
   525  func (client *ApplicationGatewaysClient) listCreateRequest(ctx context.Context, resourceGroupName string, options *ApplicationGatewaysClientListOptions) (*policy.Request, error) {
   526  	urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/applicationGateways"
   527  	if resourceGroupName == "" {
   528  		return nil, errors.New("parameter resourceGroupName cannot be empty")
   529  	}
   530  	urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName))
   531  	if client.subscriptionID == "" {
   532  		return nil, errors.New("parameter client.subscriptionID cannot be empty")
   533  	}
   534  	urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID))
   535  	req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.internal.Endpoint(), urlPath))
   536  	if err != nil {
   537  		return nil, err
   538  	}
   539  	reqQP := req.Raw().URL.Query()
   540  	reqQP.Set("api-version", "2024-05-01")
   541  	req.Raw().URL.RawQuery = reqQP.Encode()
   542  	req.Raw().Header["Accept"] = []string{"application/json"}
   543  	return req, nil
   544  }
   545  
   546  // listHandleResponse handles the List response.
   547  func (client *ApplicationGatewaysClient) listHandleResponse(resp *http.Response) (ApplicationGatewaysClientListResponse, error) {
   548  	result := ApplicationGatewaysClientListResponse{}
   549  	if err := runtime.UnmarshalAsJSON(resp, &result.ApplicationGatewayListResult); err != nil {
   550  		return ApplicationGatewaysClientListResponse{}, err
   551  	}
   552  	return result, nil
   553  }
   554  
   555  // NewListAllPager - Gets all the application gateways in a subscription.
   556  //
   557  // Generated from API version 2024-05-01
   558  //   - options - ApplicationGatewaysClientListAllOptions contains the optional parameters for the ApplicationGatewaysClient.NewListAllPager
   559  //     method.
   560  func (client *ApplicationGatewaysClient) NewListAllPager(options *ApplicationGatewaysClientListAllOptions) *runtime.Pager[ApplicationGatewaysClientListAllResponse] {
   561  	return runtime.NewPager(runtime.PagingHandler[ApplicationGatewaysClientListAllResponse]{
   562  		More: func(page ApplicationGatewaysClientListAllResponse) bool {
   563  			return page.NextLink != nil && len(*page.NextLink) > 0
   564  		},
   565  		Fetcher: func(ctx context.Context, page *ApplicationGatewaysClientListAllResponse) (ApplicationGatewaysClientListAllResponse, error) {
   566  			ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, "ApplicationGatewaysClient.NewListAllPager")
   567  			nextLink := ""
   568  			if page != nil {
   569  				nextLink = *page.NextLink
   570  			}
   571  			resp, err := runtime.FetcherForNextLink(ctx, client.internal.Pipeline(), nextLink, func(ctx context.Context) (*policy.Request, error) {
   572  				return client.listAllCreateRequest(ctx, options)
   573  			}, nil)
   574  			if err != nil {
   575  				return ApplicationGatewaysClientListAllResponse{}, err
   576  			}
   577  			return client.listAllHandleResponse(resp)
   578  		},
   579  		Tracer: client.internal.Tracer(),
   580  	})
   581  }
   582  
   583  // listAllCreateRequest creates the ListAll request.
   584  func (client *ApplicationGatewaysClient) listAllCreateRequest(ctx context.Context, options *ApplicationGatewaysClientListAllOptions) (*policy.Request, error) {
   585  	urlPath := "/subscriptions/{subscriptionId}/providers/Microsoft.Network/applicationGateways"
   586  	if client.subscriptionID == "" {
   587  		return nil, errors.New("parameter client.subscriptionID cannot be empty")
   588  	}
   589  	urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID))
   590  	req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.internal.Endpoint(), urlPath))
   591  	if err != nil {
   592  		return nil, err
   593  	}
   594  	reqQP := req.Raw().URL.Query()
   595  	reqQP.Set("api-version", "2024-05-01")
   596  	req.Raw().URL.RawQuery = reqQP.Encode()
   597  	req.Raw().Header["Accept"] = []string{"application/json"}
   598  	return req, nil
   599  }
   600  
   601  // listAllHandleResponse handles the ListAll response.
   602  func (client *ApplicationGatewaysClient) listAllHandleResponse(resp *http.Response) (ApplicationGatewaysClientListAllResponse, error) {
   603  	result := ApplicationGatewaysClientListAllResponse{}
   604  	if err := runtime.UnmarshalAsJSON(resp, &result.ApplicationGatewayListResult); err != nil {
   605  		return ApplicationGatewaysClientListAllResponse{}, err
   606  	}
   607  	return result, nil
   608  }
   609  
   610  // ListAvailableRequestHeaders - Lists all available request headers.
   611  // If the operation fails it returns an *azcore.ResponseError type.
   612  //
   613  // Generated from API version 2024-05-01
   614  //   - options - ApplicationGatewaysClientListAvailableRequestHeadersOptions contains the optional parameters for the ApplicationGatewaysClient.ListAvailableRequestHeaders
   615  //     method.
   616  func (client *ApplicationGatewaysClient) ListAvailableRequestHeaders(ctx context.Context, options *ApplicationGatewaysClientListAvailableRequestHeadersOptions) (ApplicationGatewaysClientListAvailableRequestHeadersResponse, error) {
   617  	var err error
   618  	const operationName = "ApplicationGatewaysClient.ListAvailableRequestHeaders"
   619  	ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName)
   620  	ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil)
   621  	defer func() { endSpan(err) }()
   622  	req, err := client.listAvailableRequestHeadersCreateRequest(ctx, options)
   623  	if err != nil {
   624  		return ApplicationGatewaysClientListAvailableRequestHeadersResponse{}, err
   625  	}
   626  	httpResp, err := client.internal.Pipeline().Do(req)
   627  	if err != nil {
   628  		return ApplicationGatewaysClientListAvailableRequestHeadersResponse{}, err
   629  	}
   630  	if !runtime.HasStatusCode(httpResp, http.StatusOK) {
   631  		err = runtime.NewResponseError(httpResp)
   632  		return ApplicationGatewaysClientListAvailableRequestHeadersResponse{}, err
   633  	}
   634  	resp, err := client.listAvailableRequestHeadersHandleResponse(httpResp)
   635  	return resp, err
   636  }
   637  
   638  // listAvailableRequestHeadersCreateRequest creates the ListAvailableRequestHeaders request.
   639  func (client *ApplicationGatewaysClient) listAvailableRequestHeadersCreateRequest(ctx context.Context, options *ApplicationGatewaysClientListAvailableRequestHeadersOptions) (*policy.Request, error) {
   640  	urlPath := "/subscriptions/{subscriptionId}/providers/Microsoft.Network/applicationGatewayAvailableRequestHeaders"
   641  	if client.subscriptionID == "" {
   642  		return nil, errors.New("parameter client.subscriptionID cannot be empty")
   643  	}
   644  	urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID))
   645  	req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.internal.Endpoint(), urlPath))
   646  	if err != nil {
   647  		return nil, err
   648  	}
   649  	reqQP := req.Raw().URL.Query()
   650  	reqQP.Set("api-version", "2024-05-01")
   651  	req.Raw().URL.RawQuery = reqQP.Encode()
   652  	req.Raw().Header["Accept"] = []string{"application/json"}
   653  	return req, nil
   654  }
   655  
   656  // listAvailableRequestHeadersHandleResponse handles the ListAvailableRequestHeaders response.
   657  func (client *ApplicationGatewaysClient) listAvailableRequestHeadersHandleResponse(resp *http.Response) (ApplicationGatewaysClientListAvailableRequestHeadersResponse, error) {
   658  	result := ApplicationGatewaysClientListAvailableRequestHeadersResponse{}
   659  	if err := runtime.UnmarshalAsJSON(resp, &result.StringArray); err != nil {
   660  		return ApplicationGatewaysClientListAvailableRequestHeadersResponse{}, err
   661  	}
   662  	return result, nil
   663  }
   664  
   665  // ListAvailableResponseHeaders - Lists all available response headers.
   666  // If the operation fails it returns an *azcore.ResponseError type.
   667  //
   668  // Generated from API version 2024-05-01
   669  //   - options - ApplicationGatewaysClientListAvailableResponseHeadersOptions contains the optional parameters for the ApplicationGatewaysClient.ListAvailableResponseHeaders
   670  //     method.
   671  func (client *ApplicationGatewaysClient) ListAvailableResponseHeaders(ctx context.Context, options *ApplicationGatewaysClientListAvailableResponseHeadersOptions) (ApplicationGatewaysClientListAvailableResponseHeadersResponse, error) {
   672  	var err error
   673  	const operationName = "ApplicationGatewaysClient.ListAvailableResponseHeaders"
   674  	ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName)
   675  	ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil)
   676  	defer func() { endSpan(err) }()
   677  	req, err := client.listAvailableResponseHeadersCreateRequest(ctx, options)
   678  	if err != nil {
   679  		return ApplicationGatewaysClientListAvailableResponseHeadersResponse{}, err
   680  	}
   681  	httpResp, err := client.internal.Pipeline().Do(req)
   682  	if err != nil {
   683  		return ApplicationGatewaysClientListAvailableResponseHeadersResponse{}, err
   684  	}
   685  	if !runtime.HasStatusCode(httpResp, http.StatusOK) {
   686  		err = runtime.NewResponseError(httpResp)
   687  		return ApplicationGatewaysClientListAvailableResponseHeadersResponse{}, err
   688  	}
   689  	resp, err := client.listAvailableResponseHeadersHandleResponse(httpResp)
   690  	return resp, err
   691  }
   692  
   693  // listAvailableResponseHeadersCreateRequest creates the ListAvailableResponseHeaders request.
   694  func (client *ApplicationGatewaysClient) listAvailableResponseHeadersCreateRequest(ctx context.Context, options *ApplicationGatewaysClientListAvailableResponseHeadersOptions) (*policy.Request, error) {
   695  	urlPath := "/subscriptions/{subscriptionId}/providers/Microsoft.Network/applicationGatewayAvailableResponseHeaders"
   696  	if client.subscriptionID == "" {
   697  		return nil, errors.New("parameter client.subscriptionID cannot be empty")
   698  	}
   699  	urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID))
   700  	req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.internal.Endpoint(), urlPath))
   701  	if err != nil {
   702  		return nil, err
   703  	}
   704  	reqQP := req.Raw().URL.Query()
   705  	reqQP.Set("api-version", "2024-05-01")
   706  	req.Raw().URL.RawQuery = reqQP.Encode()
   707  	req.Raw().Header["Accept"] = []string{"application/json"}
   708  	return req, nil
   709  }
   710  
   711  // listAvailableResponseHeadersHandleResponse handles the ListAvailableResponseHeaders response.
   712  func (client *ApplicationGatewaysClient) listAvailableResponseHeadersHandleResponse(resp *http.Response) (ApplicationGatewaysClientListAvailableResponseHeadersResponse, error) {
   713  	result := ApplicationGatewaysClientListAvailableResponseHeadersResponse{}
   714  	if err := runtime.UnmarshalAsJSON(resp, &result.StringArray); err != nil {
   715  		return ApplicationGatewaysClientListAvailableResponseHeadersResponse{}, err
   716  	}
   717  	return result, nil
   718  }
   719  
   720  // ListAvailableSSLOptions - Lists available Ssl options for configuring Ssl policy.
   721  // If the operation fails it returns an *azcore.ResponseError type.
   722  //
   723  // Generated from API version 2024-05-01
   724  //   - options - ApplicationGatewaysClientListAvailableSSLOptionsOptions contains the optional parameters for the ApplicationGatewaysClient.ListAvailableSSLOptions
   725  //     method.
   726  func (client *ApplicationGatewaysClient) ListAvailableSSLOptions(ctx context.Context, options *ApplicationGatewaysClientListAvailableSSLOptionsOptions) (ApplicationGatewaysClientListAvailableSSLOptionsResponse, error) {
   727  	var err error
   728  	const operationName = "ApplicationGatewaysClient.ListAvailableSSLOptions"
   729  	ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName)
   730  	ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil)
   731  	defer func() { endSpan(err) }()
   732  	req, err := client.listAvailableSSLOptionsCreateRequest(ctx, options)
   733  	if err != nil {
   734  		return ApplicationGatewaysClientListAvailableSSLOptionsResponse{}, err
   735  	}
   736  	httpResp, err := client.internal.Pipeline().Do(req)
   737  	if err != nil {
   738  		return ApplicationGatewaysClientListAvailableSSLOptionsResponse{}, err
   739  	}
   740  	if !runtime.HasStatusCode(httpResp, http.StatusOK) {
   741  		err = runtime.NewResponseError(httpResp)
   742  		return ApplicationGatewaysClientListAvailableSSLOptionsResponse{}, err
   743  	}
   744  	resp, err := client.listAvailableSSLOptionsHandleResponse(httpResp)
   745  	return resp, err
   746  }
   747  
   748  // listAvailableSSLOptionsCreateRequest creates the ListAvailableSSLOptions request.
   749  func (client *ApplicationGatewaysClient) listAvailableSSLOptionsCreateRequest(ctx context.Context, options *ApplicationGatewaysClientListAvailableSSLOptionsOptions) (*policy.Request, error) {
   750  	urlPath := "/subscriptions/{subscriptionId}/providers/Microsoft.Network/applicationGatewayAvailableSslOptions/default"
   751  	if client.subscriptionID == "" {
   752  		return nil, errors.New("parameter client.subscriptionID cannot be empty")
   753  	}
   754  	urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID))
   755  	req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.internal.Endpoint(), urlPath))
   756  	if err != nil {
   757  		return nil, err
   758  	}
   759  	reqQP := req.Raw().URL.Query()
   760  	reqQP.Set("api-version", "2024-05-01")
   761  	req.Raw().URL.RawQuery = reqQP.Encode()
   762  	req.Raw().Header["Accept"] = []string{"application/json"}
   763  	return req, nil
   764  }
   765  
   766  // listAvailableSSLOptionsHandleResponse handles the ListAvailableSSLOptions response.
   767  func (client *ApplicationGatewaysClient) listAvailableSSLOptionsHandleResponse(resp *http.Response) (ApplicationGatewaysClientListAvailableSSLOptionsResponse, error) {
   768  	result := ApplicationGatewaysClientListAvailableSSLOptionsResponse{}
   769  	if err := runtime.UnmarshalAsJSON(resp, &result.ApplicationGatewayAvailableSSLOptions); err != nil {
   770  		return ApplicationGatewaysClientListAvailableSSLOptionsResponse{}, err
   771  	}
   772  	return result, nil
   773  }
   774  
   775  // NewListAvailableSSLPredefinedPoliciesPager - Lists all SSL predefined policies for configuring Ssl policy.
   776  //
   777  // Generated from API version 2024-05-01
   778  //   - options - ApplicationGatewaysClientListAvailableSSLPredefinedPoliciesOptions contains the optional parameters for the ApplicationGatewaysClient.NewListAvailableSSLPredefinedPoliciesPager
   779  //     method.
   780  func (client *ApplicationGatewaysClient) NewListAvailableSSLPredefinedPoliciesPager(options *ApplicationGatewaysClientListAvailableSSLPredefinedPoliciesOptions) *runtime.Pager[ApplicationGatewaysClientListAvailableSSLPredefinedPoliciesResponse] {
   781  	return runtime.NewPager(runtime.PagingHandler[ApplicationGatewaysClientListAvailableSSLPredefinedPoliciesResponse]{
   782  		More: func(page ApplicationGatewaysClientListAvailableSSLPredefinedPoliciesResponse) bool {
   783  			return page.NextLink != nil && len(*page.NextLink) > 0
   784  		},
   785  		Fetcher: func(ctx context.Context, page *ApplicationGatewaysClientListAvailableSSLPredefinedPoliciesResponse) (ApplicationGatewaysClientListAvailableSSLPredefinedPoliciesResponse, error) {
   786  			ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, "ApplicationGatewaysClient.NewListAvailableSSLPredefinedPoliciesPager")
   787  			nextLink := ""
   788  			if page != nil {
   789  				nextLink = *page.NextLink
   790  			}
   791  			resp, err := runtime.FetcherForNextLink(ctx, client.internal.Pipeline(), nextLink, func(ctx context.Context) (*policy.Request, error) {
   792  				return client.listAvailableSSLPredefinedPoliciesCreateRequest(ctx, options)
   793  			}, nil)
   794  			if err != nil {
   795  				return ApplicationGatewaysClientListAvailableSSLPredefinedPoliciesResponse{}, err
   796  			}
   797  			return client.listAvailableSSLPredefinedPoliciesHandleResponse(resp)
   798  		},
   799  		Tracer: client.internal.Tracer(),
   800  	})
   801  }
   802  
   803  // listAvailableSSLPredefinedPoliciesCreateRequest creates the ListAvailableSSLPredefinedPolicies request.
   804  func (client *ApplicationGatewaysClient) listAvailableSSLPredefinedPoliciesCreateRequest(ctx context.Context, options *ApplicationGatewaysClientListAvailableSSLPredefinedPoliciesOptions) (*policy.Request, error) {
   805  	urlPath := "/subscriptions/{subscriptionId}/providers/Microsoft.Network/applicationGatewayAvailableSslOptions/default/predefinedPolicies"
   806  	if client.subscriptionID == "" {
   807  		return nil, errors.New("parameter client.subscriptionID cannot be empty")
   808  	}
   809  	urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID))
   810  	req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.internal.Endpoint(), urlPath))
   811  	if err != nil {
   812  		return nil, err
   813  	}
   814  	reqQP := req.Raw().URL.Query()
   815  	reqQP.Set("api-version", "2024-05-01")
   816  	req.Raw().URL.RawQuery = reqQP.Encode()
   817  	req.Raw().Header["Accept"] = []string{"application/json"}
   818  	return req, nil
   819  }
   820  
   821  // listAvailableSSLPredefinedPoliciesHandleResponse handles the ListAvailableSSLPredefinedPolicies response.
   822  func (client *ApplicationGatewaysClient) listAvailableSSLPredefinedPoliciesHandleResponse(resp *http.Response) (ApplicationGatewaysClientListAvailableSSLPredefinedPoliciesResponse, error) {
   823  	result := ApplicationGatewaysClientListAvailableSSLPredefinedPoliciesResponse{}
   824  	if err := runtime.UnmarshalAsJSON(resp, &result.ApplicationGatewayAvailableSSLPredefinedPolicies); err != nil {
   825  		return ApplicationGatewaysClientListAvailableSSLPredefinedPoliciesResponse{}, err
   826  	}
   827  	return result, nil
   828  }
   829  
   830  // ListAvailableServerVariables - Lists all available server variables.
   831  // If the operation fails it returns an *azcore.ResponseError type.
   832  //
   833  // Generated from API version 2024-05-01
   834  //   - options - ApplicationGatewaysClientListAvailableServerVariablesOptions contains the optional parameters for the ApplicationGatewaysClient.ListAvailableServerVariables
   835  //     method.
   836  func (client *ApplicationGatewaysClient) ListAvailableServerVariables(ctx context.Context, options *ApplicationGatewaysClientListAvailableServerVariablesOptions) (ApplicationGatewaysClientListAvailableServerVariablesResponse, error) {
   837  	var err error
   838  	const operationName = "ApplicationGatewaysClient.ListAvailableServerVariables"
   839  	ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName)
   840  	ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil)
   841  	defer func() { endSpan(err) }()
   842  	req, err := client.listAvailableServerVariablesCreateRequest(ctx, options)
   843  	if err != nil {
   844  		return ApplicationGatewaysClientListAvailableServerVariablesResponse{}, err
   845  	}
   846  	httpResp, err := client.internal.Pipeline().Do(req)
   847  	if err != nil {
   848  		return ApplicationGatewaysClientListAvailableServerVariablesResponse{}, err
   849  	}
   850  	if !runtime.HasStatusCode(httpResp, http.StatusOK) {
   851  		err = runtime.NewResponseError(httpResp)
   852  		return ApplicationGatewaysClientListAvailableServerVariablesResponse{}, err
   853  	}
   854  	resp, err := client.listAvailableServerVariablesHandleResponse(httpResp)
   855  	return resp, err
   856  }
   857  
   858  // listAvailableServerVariablesCreateRequest creates the ListAvailableServerVariables request.
   859  func (client *ApplicationGatewaysClient) listAvailableServerVariablesCreateRequest(ctx context.Context, options *ApplicationGatewaysClientListAvailableServerVariablesOptions) (*policy.Request, error) {
   860  	urlPath := "/subscriptions/{subscriptionId}/providers/Microsoft.Network/applicationGatewayAvailableServerVariables"
   861  	if client.subscriptionID == "" {
   862  		return nil, errors.New("parameter client.subscriptionID cannot be empty")
   863  	}
   864  	urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID))
   865  	req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.internal.Endpoint(), urlPath))
   866  	if err != nil {
   867  		return nil, err
   868  	}
   869  	reqQP := req.Raw().URL.Query()
   870  	reqQP.Set("api-version", "2024-05-01")
   871  	req.Raw().URL.RawQuery = reqQP.Encode()
   872  	req.Raw().Header["Accept"] = []string{"application/json"}
   873  	return req, nil
   874  }
   875  
   876  // listAvailableServerVariablesHandleResponse handles the ListAvailableServerVariables response.
   877  func (client *ApplicationGatewaysClient) listAvailableServerVariablesHandleResponse(resp *http.Response) (ApplicationGatewaysClientListAvailableServerVariablesResponse, error) {
   878  	result := ApplicationGatewaysClientListAvailableServerVariablesResponse{}
   879  	if err := runtime.UnmarshalAsJSON(resp, &result.StringArray); err != nil {
   880  		return ApplicationGatewaysClientListAvailableServerVariablesResponse{}, err
   881  	}
   882  	return result, nil
   883  }
   884  
   885  // ListAvailableWafRuleSets - Lists all available web application firewall rule sets.
   886  // If the operation fails it returns an *azcore.ResponseError type.
   887  //
   888  // Generated from API version 2024-05-01
   889  //   - options - ApplicationGatewaysClientListAvailableWafRuleSetsOptions contains the optional parameters for the ApplicationGatewaysClient.ListAvailableWafRuleSets
   890  //     method.
   891  func (client *ApplicationGatewaysClient) ListAvailableWafRuleSets(ctx context.Context, options *ApplicationGatewaysClientListAvailableWafRuleSetsOptions) (ApplicationGatewaysClientListAvailableWafRuleSetsResponse, error) {
   892  	var err error
   893  	const operationName = "ApplicationGatewaysClient.ListAvailableWafRuleSets"
   894  	ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName)
   895  	ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil)
   896  	defer func() { endSpan(err) }()
   897  	req, err := client.listAvailableWafRuleSetsCreateRequest(ctx, options)
   898  	if err != nil {
   899  		return ApplicationGatewaysClientListAvailableWafRuleSetsResponse{}, err
   900  	}
   901  	httpResp, err := client.internal.Pipeline().Do(req)
   902  	if err != nil {
   903  		return ApplicationGatewaysClientListAvailableWafRuleSetsResponse{}, err
   904  	}
   905  	if !runtime.HasStatusCode(httpResp, http.StatusOK) {
   906  		err = runtime.NewResponseError(httpResp)
   907  		return ApplicationGatewaysClientListAvailableWafRuleSetsResponse{}, err
   908  	}
   909  	resp, err := client.listAvailableWafRuleSetsHandleResponse(httpResp)
   910  	return resp, err
   911  }
   912  
   913  // listAvailableWafRuleSetsCreateRequest creates the ListAvailableWafRuleSets request.
   914  func (client *ApplicationGatewaysClient) listAvailableWafRuleSetsCreateRequest(ctx context.Context, options *ApplicationGatewaysClientListAvailableWafRuleSetsOptions) (*policy.Request, error) {
   915  	urlPath := "/subscriptions/{subscriptionId}/providers/Microsoft.Network/applicationGatewayAvailableWafRuleSets"
   916  	if client.subscriptionID == "" {
   917  		return nil, errors.New("parameter client.subscriptionID cannot be empty")
   918  	}
   919  	urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID))
   920  	req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.internal.Endpoint(), urlPath))
   921  	if err != nil {
   922  		return nil, err
   923  	}
   924  	reqQP := req.Raw().URL.Query()
   925  	reqQP.Set("api-version", "2024-05-01")
   926  	req.Raw().URL.RawQuery = reqQP.Encode()
   927  	req.Raw().Header["Accept"] = []string{"application/json"}
   928  	return req, nil
   929  }
   930  
   931  // listAvailableWafRuleSetsHandleResponse handles the ListAvailableWafRuleSets response.
   932  func (client *ApplicationGatewaysClient) listAvailableWafRuleSetsHandleResponse(resp *http.Response) (ApplicationGatewaysClientListAvailableWafRuleSetsResponse, error) {
   933  	result := ApplicationGatewaysClientListAvailableWafRuleSetsResponse{}
   934  	if err := runtime.UnmarshalAsJSON(resp, &result.ApplicationGatewayAvailableWafRuleSetsResult); err != nil {
   935  		return ApplicationGatewaysClientListAvailableWafRuleSetsResponse{}, err
   936  	}
   937  	return result, nil
   938  }
   939  
   940  // BeginStart - Starts the specified application gateway.
   941  // If the operation fails it returns an *azcore.ResponseError type.
   942  //
   943  // Generated from API version 2024-05-01
   944  //   - resourceGroupName - The name of the resource group.
   945  //   - applicationGatewayName - The name of the application gateway.
   946  //   - options - ApplicationGatewaysClientBeginStartOptions contains the optional parameters for the ApplicationGatewaysClient.BeginStart
   947  //     method.
   948  func (client *ApplicationGatewaysClient) BeginStart(ctx context.Context, resourceGroupName string, applicationGatewayName string, options *ApplicationGatewaysClientBeginStartOptions) (*runtime.Poller[ApplicationGatewaysClientStartResponse], error) {
   949  	if options == nil || options.ResumeToken == "" {
   950  		resp, err := client.start(ctx, resourceGroupName, applicationGatewayName, options)
   951  		if err != nil {
   952  			return nil, err
   953  		}
   954  		poller, err := runtime.NewPoller(resp, client.internal.Pipeline(), &runtime.NewPollerOptions[ApplicationGatewaysClientStartResponse]{
   955  			FinalStateVia: runtime.FinalStateViaLocation,
   956  			Tracer:        client.internal.Tracer(),
   957  		})
   958  		return poller, err
   959  	} else {
   960  		return runtime.NewPollerFromResumeToken(options.ResumeToken, client.internal.Pipeline(), &runtime.NewPollerFromResumeTokenOptions[ApplicationGatewaysClientStartResponse]{
   961  			Tracer: client.internal.Tracer(),
   962  		})
   963  	}
   964  }
   965  
   966  // Start - Starts the specified application gateway.
   967  // If the operation fails it returns an *azcore.ResponseError type.
   968  //
   969  // Generated from API version 2024-05-01
   970  func (client *ApplicationGatewaysClient) start(ctx context.Context, resourceGroupName string, applicationGatewayName string, options *ApplicationGatewaysClientBeginStartOptions) (*http.Response, error) {
   971  	var err error
   972  	const operationName = "ApplicationGatewaysClient.BeginStart"
   973  	ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName)
   974  	ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil)
   975  	defer func() { endSpan(err) }()
   976  	req, err := client.startCreateRequest(ctx, resourceGroupName, applicationGatewayName, options)
   977  	if err != nil {
   978  		return nil, err
   979  	}
   980  	httpResp, err := client.internal.Pipeline().Do(req)
   981  	if err != nil {
   982  		return nil, err
   983  	}
   984  	if !runtime.HasStatusCode(httpResp, http.StatusOK, http.StatusAccepted) {
   985  		err = runtime.NewResponseError(httpResp)
   986  		return nil, err
   987  	}
   988  	return httpResp, nil
   989  }
   990  
   991  // startCreateRequest creates the Start request.
   992  func (client *ApplicationGatewaysClient) startCreateRequest(ctx context.Context, resourceGroupName string, applicationGatewayName string, options *ApplicationGatewaysClientBeginStartOptions) (*policy.Request, error) {
   993  	urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/applicationGateways/{applicationGatewayName}/start"
   994  	if resourceGroupName == "" {
   995  		return nil, errors.New("parameter resourceGroupName cannot be empty")
   996  	}
   997  	urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName))
   998  	if applicationGatewayName == "" {
   999  		return nil, errors.New("parameter applicationGatewayName cannot be empty")
  1000  	}
  1001  	urlPath = strings.ReplaceAll(urlPath, "{applicationGatewayName}", url.PathEscape(applicationGatewayName))
  1002  	if client.subscriptionID == "" {
  1003  		return nil, errors.New("parameter client.subscriptionID cannot be empty")
  1004  	}
  1005  	urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID))
  1006  	req, err := runtime.NewRequest(ctx, http.MethodPost, runtime.JoinPaths(client.internal.Endpoint(), urlPath))
  1007  	if err != nil {
  1008  		return nil, err
  1009  	}
  1010  	reqQP := req.Raw().URL.Query()
  1011  	reqQP.Set("api-version", "2024-05-01")
  1012  	req.Raw().URL.RawQuery = reqQP.Encode()
  1013  	req.Raw().Header["Accept"] = []string{"application/json"}
  1014  	return req, nil
  1015  }
  1016  
  1017  // BeginStop - Stops the specified application gateway in a resource group.
  1018  // If the operation fails it returns an *azcore.ResponseError type.
  1019  //
  1020  // Generated from API version 2024-05-01
  1021  //   - resourceGroupName - The name of the resource group.
  1022  //   - applicationGatewayName - The name of the application gateway.
  1023  //   - options - ApplicationGatewaysClientBeginStopOptions contains the optional parameters for the ApplicationGatewaysClient.BeginStop
  1024  //     method.
  1025  func (client *ApplicationGatewaysClient) BeginStop(ctx context.Context, resourceGroupName string, applicationGatewayName string, options *ApplicationGatewaysClientBeginStopOptions) (*runtime.Poller[ApplicationGatewaysClientStopResponse], error) {
  1026  	if options == nil || options.ResumeToken == "" {
  1027  		resp, err := client.stop(ctx, resourceGroupName, applicationGatewayName, options)
  1028  		if err != nil {
  1029  			return nil, err
  1030  		}
  1031  		poller, err := runtime.NewPoller(resp, client.internal.Pipeline(), &runtime.NewPollerOptions[ApplicationGatewaysClientStopResponse]{
  1032  			FinalStateVia: runtime.FinalStateViaLocation,
  1033  			Tracer:        client.internal.Tracer(),
  1034  		})
  1035  		return poller, err
  1036  	} else {
  1037  		return runtime.NewPollerFromResumeToken(options.ResumeToken, client.internal.Pipeline(), &runtime.NewPollerFromResumeTokenOptions[ApplicationGatewaysClientStopResponse]{
  1038  			Tracer: client.internal.Tracer(),
  1039  		})
  1040  	}
  1041  }
  1042  
  1043  // Stop - Stops the specified application gateway in a resource group.
  1044  // If the operation fails it returns an *azcore.ResponseError type.
  1045  //
  1046  // Generated from API version 2024-05-01
  1047  func (client *ApplicationGatewaysClient) stop(ctx context.Context, resourceGroupName string, applicationGatewayName string, options *ApplicationGatewaysClientBeginStopOptions) (*http.Response, error) {
  1048  	var err error
  1049  	const operationName = "ApplicationGatewaysClient.BeginStop"
  1050  	ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName)
  1051  	ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil)
  1052  	defer func() { endSpan(err) }()
  1053  	req, err := client.stopCreateRequest(ctx, resourceGroupName, applicationGatewayName, options)
  1054  	if err != nil {
  1055  		return nil, err
  1056  	}
  1057  	httpResp, err := client.internal.Pipeline().Do(req)
  1058  	if err != nil {
  1059  		return nil, err
  1060  	}
  1061  	if !runtime.HasStatusCode(httpResp, http.StatusOK, http.StatusAccepted) {
  1062  		err = runtime.NewResponseError(httpResp)
  1063  		return nil, err
  1064  	}
  1065  	return httpResp, nil
  1066  }
  1067  
  1068  // stopCreateRequest creates the Stop request.
  1069  func (client *ApplicationGatewaysClient) stopCreateRequest(ctx context.Context, resourceGroupName string, applicationGatewayName string, options *ApplicationGatewaysClientBeginStopOptions) (*policy.Request, error) {
  1070  	urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/applicationGateways/{applicationGatewayName}/stop"
  1071  	if resourceGroupName == "" {
  1072  		return nil, errors.New("parameter resourceGroupName cannot be empty")
  1073  	}
  1074  	urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName))
  1075  	if applicationGatewayName == "" {
  1076  		return nil, errors.New("parameter applicationGatewayName cannot be empty")
  1077  	}
  1078  	urlPath = strings.ReplaceAll(urlPath, "{applicationGatewayName}", url.PathEscape(applicationGatewayName))
  1079  	if client.subscriptionID == "" {
  1080  		return nil, errors.New("parameter client.subscriptionID cannot be empty")
  1081  	}
  1082  	urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID))
  1083  	req, err := runtime.NewRequest(ctx, http.MethodPost, runtime.JoinPaths(client.internal.Endpoint(), urlPath))
  1084  	if err != nil {
  1085  		return nil, err
  1086  	}
  1087  	reqQP := req.Raw().URL.Query()
  1088  	reqQP.Set("api-version", "2024-05-01")
  1089  	req.Raw().URL.RawQuery = reqQP.Encode()
  1090  	req.Raw().Header["Accept"] = []string{"application/json"}
  1091  	return req, nil
  1092  }
  1093  
  1094  // UpdateTags - Updates the specified application gateway tags.
  1095  // If the operation fails it returns an *azcore.ResponseError type.
  1096  //
  1097  // Generated from API version 2024-05-01
  1098  //   - resourceGroupName - The name of the resource group.
  1099  //   - applicationGatewayName - The name of the application gateway.
  1100  //   - parameters - Parameters supplied to update application gateway tags.
  1101  //   - options - ApplicationGatewaysClientUpdateTagsOptions contains the optional parameters for the ApplicationGatewaysClient.UpdateTags
  1102  //     method.
  1103  func (client *ApplicationGatewaysClient) UpdateTags(ctx context.Context, resourceGroupName string, applicationGatewayName string, parameters TagsObject, options *ApplicationGatewaysClientUpdateTagsOptions) (ApplicationGatewaysClientUpdateTagsResponse, error) {
  1104  	var err error
  1105  	const operationName = "ApplicationGatewaysClient.UpdateTags"
  1106  	ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName)
  1107  	ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil)
  1108  	defer func() { endSpan(err) }()
  1109  	req, err := client.updateTagsCreateRequest(ctx, resourceGroupName, applicationGatewayName, parameters, options)
  1110  	if err != nil {
  1111  		return ApplicationGatewaysClientUpdateTagsResponse{}, err
  1112  	}
  1113  	httpResp, err := client.internal.Pipeline().Do(req)
  1114  	if err != nil {
  1115  		return ApplicationGatewaysClientUpdateTagsResponse{}, err
  1116  	}
  1117  	if !runtime.HasStatusCode(httpResp, http.StatusOK) {
  1118  		err = runtime.NewResponseError(httpResp)
  1119  		return ApplicationGatewaysClientUpdateTagsResponse{}, err
  1120  	}
  1121  	resp, err := client.updateTagsHandleResponse(httpResp)
  1122  	return resp, err
  1123  }
  1124  
  1125  // updateTagsCreateRequest creates the UpdateTags request.
  1126  func (client *ApplicationGatewaysClient) updateTagsCreateRequest(ctx context.Context, resourceGroupName string, applicationGatewayName string, parameters TagsObject, options *ApplicationGatewaysClientUpdateTagsOptions) (*policy.Request, error) {
  1127  	urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/applicationGateways/{applicationGatewayName}"
  1128  	if resourceGroupName == "" {
  1129  		return nil, errors.New("parameter resourceGroupName cannot be empty")
  1130  	}
  1131  	urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName))
  1132  	if applicationGatewayName == "" {
  1133  		return nil, errors.New("parameter applicationGatewayName cannot be empty")
  1134  	}
  1135  	urlPath = strings.ReplaceAll(urlPath, "{applicationGatewayName}", url.PathEscape(applicationGatewayName))
  1136  	if client.subscriptionID == "" {
  1137  		return nil, errors.New("parameter client.subscriptionID cannot be empty")
  1138  	}
  1139  	urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID))
  1140  	req, err := runtime.NewRequest(ctx, http.MethodPatch, runtime.JoinPaths(client.internal.Endpoint(), urlPath))
  1141  	if err != nil {
  1142  		return nil, err
  1143  	}
  1144  	reqQP := req.Raw().URL.Query()
  1145  	reqQP.Set("api-version", "2024-05-01")
  1146  	req.Raw().URL.RawQuery = reqQP.Encode()
  1147  	req.Raw().Header["Accept"] = []string{"application/json"}
  1148  	if err := runtime.MarshalAsJSON(req, parameters); err != nil {
  1149  		return nil, err
  1150  	}
  1151  	return req, nil
  1152  }
  1153  
  1154  // updateTagsHandleResponse handles the UpdateTags response.
  1155  func (client *ApplicationGatewaysClient) updateTagsHandleResponse(resp *http.Response) (ApplicationGatewaysClientUpdateTagsResponse, error) {
  1156  	result := ApplicationGatewaysClientUpdateTagsResponse{}
  1157  	if err := runtime.UnmarshalAsJSON(resp, &result.ApplicationGateway); err != nil {
  1158  		return ApplicationGatewaysClientUpdateTagsResponse{}, err
  1159  	}
  1160  	return result, nil
  1161  }