github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/network/armnetwork/v6@v6.2.0/vpnserverconfigurations_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  // VPNServerConfigurationsClient contains the methods for the VPNServerConfigurations group.
    24  // Don't use this type directly, use NewVPNServerConfigurationsClient() instead.
    25  type VPNServerConfigurationsClient struct {
    26  	internal       *arm.Client
    27  	subscriptionID string
    28  }
    29  
    30  // NewVPNServerConfigurationsClient creates a new instance of VPNServerConfigurationsClient 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 NewVPNServerConfigurationsClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) (*VPNServerConfigurationsClient, error) {
    36  	cl, err := arm.NewClient(moduleName, moduleVersion, credential, options)
    37  	if err != nil {
    38  		return nil, err
    39  	}
    40  	client := &VPNServerConfigurationsClient{
    41  		subscriptionID: subscriptionID,
    42  		internal:       cl,
    43  	}
    44  	return client, nil
    45  }
    46  
    47  // BeginCreateOrUpdate - Creates a VpnServerConfiguration resource if it doesn't exist else updates the existing VpnServerConfiguration.
    48  // If the operation fails it returns an *azcore.ResponseError type.
    49  //
    50  // Generated from API version 2024-05-01
    51  //   - resourceGroupName - The resource group name of the VpnServerConfiguration.
    52  //   - vpnServerConfigurationName - The name of the VpnServerConfiguration being created or updated.
    53  //   - vpnServerConfigurationParameters - Parameters supplied to create or update VpnServerConfiguration.
    54  //   - options - VPNServerConfigurationsClientBeginCreateOrUpdateOptions contains the optional parameters for the VPNServerConfigurationsClient.BeginCreateOrUpdate
    55  //     method.
    56  func (client *VPNServerConfigurationsClient) BeginCreateOrUpdate(ctx context.Context, resourceGroupName string, vpnServerConfigurationName string, vpnServerConfigurationParameters VPNServerConfiguration, options *VPNServerConfigurationsClientBeginCreateOrUpdateOptions) (*runtime.Poller[VPNServerConfigurationsClientCreateOrUpdateResponse], error) {
    57  	if options == nil || options.ResumeToken == "" {
    58  		resp, err := client.createOrUpdate(ctx, resourceGroupName, vpnServerConfigurationName, vpnServerConfigurationParameters, options)
    59  		if err != nil {
    60  			return nil, err
    61  		}
    62  		poller, err := runtime.NewPoller(resp, client.internal.Pipeline(), &runtime.NewPollerOptions[VPNServerConfigurationsClientCreateOrUpdateResponse]{
    63  			FinalStateVia: runtime.FinalStateViaAzureAsyncOp,
    64  			Tracer:        client.internal.Tracer(),
    65  		})
    66  		return poller, err
    67  	} else {
    68  		return runtime.NewPollerFromResumeToken(options.ResumeToken, client.internal.Pipeline(), &runtime.NewPollerFromResumeTokenOptions[VPNServerConfigurationsClientCreateOrUpdateResponse]{
    69  			Tracer: client.internal.Tracer(),
    70  		})
    71  	}
    72  }
    73  
    74  // CreateOrUpdate - Creates a VpnServerConfiguration resource if it doesn't exist else updates the existing VpnServerConfiguration.
    75  // If the operation fails it returns an *azcore.ResponseError type.
    76  //
    77  // Generated from API version 2024-05-01
    78  func (client *VPNServerConfigurationsClient) createOrUpdate(ctx context.Context, resourceGroupName string, vpnServerConfigurationName string, vpnServerConfigurationParameters VPNServerConfiguration, options *VPNServerConfigurationsClientBeginCreateOrUpdateOptions) (*http.Response, error) {
    79  	var err error
    80  	const operationName = "VPNServerConfigurationsClient.BeginCreateOrUpdate"
    81  	ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName)
    82  	ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil)
    83  	defer func() { endSpan(err) }()
    84  	req, err := client.createOrUpdateCreateRequest(ctx, resourceGroupName, vpnServerConfigurationName, vpnServerConfigurationParameters, options)
    85  	if err != nil {
    86  		return nil, err
    87  	}
    88  	httpResp, err := client.internal.Pipeline().Do(req)
    89  	if err != nil {
    90  		return nil, err
    91  	}
    92  	if !runtime.HasStatusCode(httpResp, http.StatusOK, http.StatusCreated) {
    93  		err = runtime.NewResponseError(httpResp)
    94  		return nil, err
    95  	}
    96  	return httpResp, nil
    97  }
    98  
    99  // createOrUpdateCreateRequest creates the CreateOrUpdate request.
   100  func (client *VPNServerConfigurationsClient) createOrUpdateCreateRequest(ctx context.Context, resourceGroupName string, vpnServerConfigurationName string, vpnServerConfigurationParameters VPNServerConfiguration, options *VPNServerConfigurationsClientBeginCreateOrUpdateOptions) (*policy.Request, error) {
   101  	urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/vpnServerConfigurations/{vpnServerConfigurationName}"
   102  	if client.subscriptionID == "" {
   103  		return nil, errors.New("parameter client.subscriptionID cannot be empty")
   104  	}
   105  	urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID))
   106  	if resourceGroupName == "" {
   107  		return nil, errors.New("parameter resourceGroupName cannot be empty")
   108  	}
   109  	urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName))
   110  	if vpnServerConfigurationName == "" {
   111  		return nil, errors.New("parameter vpnServerConfigurationName cannot be empty")
   112  	}
   113  	urlPath = strings.ReplaceAll(urlPath, "{vpnServerConfigurationName}", url.PathEscape(vpnServerConfigurationName))
   114  	req, err := runtime.NewRequest(ctx, http.MethodPut, runtime.JoinPaths(client.internal.Endpoint(), urlPath))
   115  	if err != nil {
   116  		return nil, err
   117  	}
   118  	reqQP := req.Raw().URL.Query()
   119  	reqQP.Set("api-version", "2024-05-01")
   120  	req.Raw().URL.RawQuery = reqQP.Encode()
   121  	req.Raw().Header["Accept"] = []string{"application/json"}
   122  	if err := runtime.MarshalAsJSON(req, vpnServerConfigurationParameters); err != nil {
   123  		return nil, err
   124  	}
   125  	return req, nil
   126  }
   127  
   128  // BeginDelete - Deletes a VpnServerConfiguration.
   129  // If the operation fails it returns an *azcore.ResponseError type.
   130  //
   131  // Generated from API version 2024-05-01
   132  //   - resourceGroupName - The resource group name of the VpnServerConfiguration.
   133  //   - vpnServerConfigurationName - The name of the VpnServerConfiguration being deleted.
   134  //   - options - VPNServerConfigurationsClientBeginDeleteOptions contains the optional parameters for the VPNServerConfigurationsClient.BeginDelete
   135  //     method.
   136  func (client *VPNServerConfigurationsClient) BeginDelete(ctx context.Context, resourceGroupName string, vpnServerConfigurationName string, options *VPNServerConfigurationsClientBeginDeleteOptions) (*runtime.Poller[VPNServerConfigurationsClientDeleteResponse], error) {
   137  	if options == nil || options.ResumeToken == "" {
   138  		resp, err := client.deleteOperation(ctx, resourceGroupName, vpnServerConfigurationName, options)
   139  		if err != nil {
   140  			return nil, err
   141  		}
   142  		poller, err := runtime.NewPoller(resp, client.internal.Pipeline(), &runtime.NewPollerOptions[VPNServerConfigurationsClientDeleteResponse]{
   143  			FinalStateVia: runtime.FinalStateViaLocation,
   144  			Tracer:        client.internal.Tracer(),
   145  		})
   146  		return poller, err
   147  	} else {
   148  		return runtime.NewPollerFromResumeToken(options.ResumeToken, client.internal.Pipeline(), &runtime.NewPollerFromResumeTokenOptions[VPNServerConfigurationsClientDeleteResponse]{
   149  			Tracer: client.internal.Tracer(),
   150  		})
   151  	}
   152  }
   153  
   154  // Delete - Deletes a VpnServerConfiguration.
   155  // If the operation fails it returns an *azcore.ResponseError type.
   156  //
   157  // Generated from API version 2024-05-01
   158  func (client *VPNServerConfigurationsClient) deleteOperation(ctx context.Context, resourceGroupName string, vpnServerConfigurationName string, options *VPNServerConfigurationsClientBeginDeleteOptions) (*http.Response, error) {
   159  	var err error
   160  	const operationName = "VPNServerConfigurationsClient.BeginDelete"
   161  	ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName)
   162  	ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil)
   163  	defer func() { endSpan(err) }()
   164  	req, err := client.deleteCreateRequest(ctx, resourceGroupName, vpnServerConfigurationName, options)
   165  	if err != nil {
   166  		return nil, err
   167  	}
   168  	httpResp, err := client.internal.Pipeline().Do(req)
   169  	if err != nil {
   170  		return nil, err
   171  	}
   172  	if !runtime.HasStatusCode(httpResp, http.StatusOK, http.StatusAccepted, http.StatusNoContent) {
   173  		err = runtime.NewResponseError(httpResp)
   174  		return nil, err
   175  	}
   176  	return httpResp, nil
   177  }
   178  
   179  // deleteCreateRequest creates the Delete request.
   180  func (client *VPNServerConfigurationsClient) deleteCreateRequest(ctx context.Context, resourceGroupName string, vpnServerConfigurationName string, options *VPNServerConfigurationsClientBeginDeleteOptions) (*policy.Request, error) {
   181  	urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/vpnServerConfigurations/{vpnServerConfigurationName}"
   182  	if client.subscriptionID == "" {
   183  		return nil, errors.New("parameter client.subscriptionID cannot be empty")
   184  	}
   185  	urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID))
   186  	if resourceGroupName == "" {
   187  		return nil, errors.New("parameter resourceGroupName cannot be empty")
   188  	}
   189  	urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName))
   190  	if vpnServerConfigurationName == "" {
   191  		return nil, errors.New("parameter vpnServerConfigurationName cannot be empty")
   192  	}
   193  	urlPath = strings.ReplaceAll(urlPath, "{vpnServerConfigurationName}", url.PathEscape(vpnServerConfigurationName))
   194  	req, err := runtime.NewRequest(ctx, http.MethodDelete, runtime.JoinPaths(client.internal.Endpoint(), urlPath))
   195  	if err != nil {
   196  		return nil, err
   197  	}
   198  	reqQP := req.Raw().URL.Query()
   199  	reqQP.Set("api-version", "2024-05-01")
   200  	req.Raw().URL.RawQuery = reqQP.Encode()
   201  	req.Raw().Header["Accept"] = []string{"application/json"}
   202  	return req, nil
   203  }
   204  
   205  // Get - Retrieves the details of a VpnServerConfiguration.
   206  // If the operation fails it returns an *azcore.ResponseError type.
   207  //
   208  // Generated from API version 2024-05-01
   209  //   - resourceGroupName - The resource group name of the VpnServerConfiguration.
   210  //   - vpnServerConfigurationName - The name of the VpnServerConfiguration being retrieved.
   211  //   - options - VPNServerConfigurationsClientGetOptions contains the optional parameters for the VPNServerConfigurationsClient.Get
   212  //     method.
   213  func (client *VPNServerConfigurationsClient) Get(ctx context.Context, resourceGroupName string, vpnServerConfigurationName string, options *VPNServerConfigurationsClientGetOptions) (VPNServerConfigurationsClientGetResponse, error) {
   214  	var err error
   215  	const operationName = "VPNServerConfigurationsClient.Get"
   216  	ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName)
   217  	ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil)
   218  	defer func() { endSpan(err) }()
   219  	req, err := client.getCreateRequest(ctx, resourceGroupName, vpnServerConfigurationName, options)
   220  	if err != nil {
   221  		return VPNServerConfigurationsClientGetResponse{}, err
   222  	}
   223  	httpResp, err := client.internal.Pipeline().Do(req)
   224  	if err != nil {
   225  		return VPNServerConfigurationsClientGetResponse{}, err
   226  	}
   227  	if !runtime.HasStatusCode(httpResp, http.StatusOK) {
   228  		err = runtime.NewResponseError(httpResp)
   229  		return VPNServerConfigurationsClientGetResponse{}, err
   230  	}
   231  	resp, err := client.getHandleResponse(httpResp)
   232  	return resp, err
   233  }
   234  
   235  // getCreateRequest creates the Get request.
   236  func (client *VPNServerConfigurationsClient) getCreateRequest(ctx context.Context, resourceGroupName string, vpnServerConfigurationName string, options *VPNServerConfigurationsClientGetOptions) (*policy.Request, error) {
   237  	urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/vpnServerConfigurations/{vpnServerConfigurationName}"
   238  	if client.subscriptionID == "" {
   239  		return nil, errors.New("parameter client.subscriptionID cannot be empty")
   240  	}
   241  	urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID))
   242  	if resourceGroupName == "" {
   243  		return nil, errors.New("parameter resourceGroupName cannot be empty")
   244  	}
   245  	urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName))
   246  	if vpnServerConfigurationName == "" {
   247  		return nil, errors.New("parameter vpnServerConfigurationName cannot be empty")
   248  	}
   249  	urlPath = strings.ReplaceAll(urlPath, "{vpnServerConfigurationName}", url.PathEscape(vpnServerConfigurationName))
   250  	req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.internal.Endpoint(), urlPath))
   251  	if err != nil {
   252  		return nil, err
   253  	}
   254  	reqQP := req.Raw().URL.Query()
   255  	reqQP.Set("api-version", "2024-05-01")
   256  	req.Raw().URL.RawQuery = reqQP.Encode()
   257  	req.Raw().Header["Accept"] = []string{"application/json"}
   258  	return req, nil
   259  }
   260  
   261  // getHandleResponse handles the Get response.
   262  func (client *VPNServerConfigurationsClient) getHandleResponse(resp *http.Response) (VPNServerConfigurationsClientGetResponse, error) {
   263  	result := VPNServerConfigurationsClientGetResponse{}
   264  	if err := runtime.UnmarshalAsJSON(resp, &result.VPNServerConfiguration); err != nil {
   265  		return VPNServerConfigurationsClientGetResponse{}, err
   266  	}
   267  	return result, nil
   268  }
   269  
   270  // NewListPager - Lists all the VpnServerConfigurations in a subscription.
   271  //
   272  // Generated from API version 2024-05-01
   273  //   - options - VPNServerConfigurationsClientListOptions contains the optional parameters for the VPNServerConfigurationsClient.NewListPager
   274  //     method.
   275  func (client *VPNServerConfigurationsClient) NewListPager(options *VPNServerConfigurationsClientListOptions) *runtime.Pager[VPNServerConfigurationsClientListResponse] {
   276  	return runtime.NewPager(runtime.PagingHandler[VPNServerConfigurationsClientListResponse]{
   277  		More: func(page VPNServerConfigurationsClientListResponse) bool {
   278  			return page.NextLink != nil && len(*page.NextLink) > 0
   279  		},
   280  		Fetcher: func(ctx context.Context, page *VPNServerConfigurationsClientListResponse) (VPNServerConfigurationsClientListResponse, error) {
   281  			ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, "VPNServerConfigurationsClient.NewListPager")
   282  			nextLink := ""
   283  			if page != nil {
   284  				nextLink = *page.NextLink
   285  			}
   286  			resp, err := runtime.FetcherForNextLink(ctx, client.internal.Pipeline(), nextLink, func(ctx context.Context) (*policy.Request, error) {
   287  				return client.listCreateRequest(ctx, options)
   288  			}, nil)
   289  			if err != nil {
   290  				return VPNServerConfigurationsClientListResponse{}, err
   291  			}
   292  			return client.listHandleResponse(resp)
   293  		},
   294  		Tracer: client.internal.Tracer(),
   295  	})
   296  }
   297  
   298  // listCreateRequest creates the List request.
   299  func (client *VPNServerConfigurationsClient) listCreateRequest(ctx context.Context, options *VPNServerConfigurationsClientListOptions) (*policy.Request, error) {
   300  	urlPath := "/subscriptions/{subscriptionId}/providers/Microsoft.Network/vpnServerConfigurations"
   301  	if client.subscriptionID == "" {
   302  		return nil, errors.New("parameter client.subscriptionID cannot be empty")
   303  	}
   304  	urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID))
   305  	req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.internal.Endpoint(), urlPath))
   306  	if err != nil {
   307  		return nil, err
   308  	}
   309  	reqQP := req.Raw().URL.Query()
   310  	reqQP.Set("api-version", "2024-05-01")
   311  	req.Raw().URL.RawQuery = reqQP.Encode()
   312  	req.Raw().Header["Accept"] = []string{"application/json"}
   313  	return req, nil
   314  }
   315  
   316  // listHandleResponse handles the List response.
   317  func (client *VPNServerConfigurationsClient) listHandleResponse(resp *http.Response) (VPNServerConfigurationsClientListResponse, error) {
   318  	result := VPNServerConfigurationsClientListResponse{}
   319  	if err := runtime.UnmarshalAsJSON(resp, &result.ListVPNServerConfigurationsResult); err != nil {
   320  		return VPNServerConfigurationsClientListResponse{}, err
   321  	}
   322  	return result, nil
   323  }
   324  
   325  // NewListByResourceGroupPager - Lists all the vpnServerConfigurations in a resource group.
   326  //
   327  // Generated from API version 2024-05-01
   328  //   - resourceGroupName - The resource group name of the VpnServerConfiguration.
   329  //   - options - VPNServerConfigurationsClientListByResourceGroupOptions contains the optional parameters for the VPNServerConfigurationsClient.NewListByResourceGroupPager
   330  //     method.
   331  func (client *VPNServerConfigurationsClient) NewListByResourceGroupPager(resourceGroupName string, options *VPNServerConfigurationsClientListByResourceGroupOptions) *runtime.Pager[VPNServerConfigurationsClientListByResourceGroupResponse] {
   332  	return runtime.NewPager(runtime.PagingHandler[VPNServerConfigurationsClientListByResourceGroupResponse]{
   333  		More: func(page VPNServerConfigurationsClientListByResourceGroupResponse) bool {
   334  			return page.NextLink != nil && len(*page.NextLink) > 0
   335  		},
   336  		Fetcher: func(ctx context.Context, page *VPNServerConfigurationsClientListByResourceGroupResponse) (VPNServerConfigurationsClientListByResourceGroupResponse, error) {
   337  			ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, "VPNServerConfigurationsClient.NewListByResourceGroupPager")
   338  			nextLink := ""
   339  			if page != nil {
   340  				nextLink = *page.NextLink
   341  			}
   342  			resp, err := runtime.FetcherForNextLink(ctx, client.internal.Pipeline(), nextLink, func(ctx context.Context) (*policy.Request, error) {
   343  				return client.listByResourceGroupCreateRequest(ctx, resourceGroupName, options)
   344  			}, nil)
   345  			if err != nil {
   346  				return VPNServerConfigurationsClientListByResourceGroupResponse{}, err
   347  			}
   348  			return client.listByResourceGroupHandleResponse(resp)
   349  		},
   350  		Tracer: client.internal.Tracer(),
   351  	})
   352  }
   353  
   354  // listByResourceGroupCreateRequest creates the ListByResourceGroup request.
   355  func (client *VPNServerConfigurationsClient) listByResourceGroupCreateRequest(ctx context.Context, resourceGroupName string, options *VPNServerConfigurationsClientListByResourceGroupOptions) (*policy.Request, error) {
   356  	urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/vpnServerConfigurations"
   357  	if client.subscriptionID == "" {
   358  		return nil, errors.New("parameter client.subscriptionID cannot be empty")
   359  	}
   360  	urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID))
   361  	if resourceGroupName == "" {
   362  		return nil, errors.New("parameter resourceGroupName cannot be empty")
   363  	}
   364  	urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName))
   365  	req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.internal.Endpoint(), urlPath))
   366  	if err != nil {
   367  		return nil, err
   368  	}
   369  	reqQP := req.Raw().URL.Query()
   370  	reqQP.Set("api-version", "2024-05-01")
   371  	req.Raw().URL.RawQuery = reqQP.Encode()
   372  	req.Raw().Header["Accept"] = []string{"application/json"}
   373  	return req, nil
   374  }
   375  
   376  // listByResourceGroupHandleResponse handles the ListByResourceGroup response.
   377  func (client *VPNServerConfigurationsClient) listByResourceGroupHandleResponse(resp *http.Response) (VPNServerConfigurationsClientListByResourceGroupResponse, error) {
   378  	result := VPNServerConfigurationsClientListByResourceGroupResponse{}
   379  	if err := runtime.UnmarshalAsJSON(resp, &result.ListVPNServerConfigurationsResult); err != nil {
   380  		return VPNServerConfigurationsClientListByResourceGroupResponse{}, err
   381  	}
   382  	return result, nil
   383  }
   384  
   385  // UpdateTags - Updates VpnServerConfiguration tags.
   386  // If the operation fails it returns an *azcore.ResponseError type.
   387  //
   388  // Generated from API version 2024-05-01
   389  //   - resourceGroupName - The resource group name of the VpnServerConfiguration.
   390  //   - vpnServerConfigurationName - The name of the VpnServerConfiguration being updated.
   391  //   - vpnServerConfigurationParameters - Parameters supplied to update VpnServerConfiguration tags.
   392  //   - options - VPNServerConfigurationsClientUpdateTagsOptions contains the optional parameters for the VPNServerConfigurationsClient.UpdateTags
   393  //     method.
   394  func (client *VPNServerConfigurationsClient) UpdateTags(ctx context.Context, resourceGroupName string, vpnServerConfigurationName string, vpnServerConfigurationParameters TagsObject, options *VPNServerConfigurationsClientUpdateTagsOptions) (VPNServerConfigurationsClientUpdateTagsResponse, error) {
   395  	var err error
   396  	const operationName = "VPNServerConfigurationsClient.UpdateTags"
   397  	ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName)
   398  	ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil)
   399  	defer func() { endSpan(err) }()
   400  	req, err := client.updateTagsCreateRequest(ctx, resourceGroupName, vpnServerConfigurationName, vpnServerConfigurationParameters, options)
   401  	if err != nil {
   402  		return VPNServerConfigurationsClientUpdateTagsResponse{}, err
   403  	}
   404  	httpResp, err := client.internal.Pipeline().Do(req)
   405  	if err != nil {
   406  		return VPNServerConfigurationsClientUpdateTagsResponse{}, err
   407  	}
   408  	if !runtime.HasStatusCode(httpResp, http.StatusOK) {
   409  		err = runtime.NewResponseError(httpResp)
   410  		return VPNServerConfigurationsClientUpdateTagsResponse{}, err
   411  	}
   412  	resp, err := client.updateTagsHandleResponse(httpResp)
   413  	return resp, err
   414  }
   415  
   416  // updateTagsCreateRequest creates the UpdateTags request.
   417  func (client *VPNServerConfigurationsClient) updateTagsCreateRequest(ctx context.Context, resourceGroupName string, vpnServerConfigurationName string, vpnServerConfigurationParameters TagsObject, options *VPNServerConfigurationsClientUpdateTagsOptions) (*policy.Request, error) {
   418  	urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/vpnServerConfigurations/{vpnServerConfigurationName}"
   419  	if client.subscriptionID == "" {
   420  		return nil, errors.New("parameter client.subscriptionID cannot be empty")
   421  	}
   422  	urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID))
   423  	if resourceGroupName == "" {
   424  		return nil, errors.New("parameter resourceGroupName cannot be empty")
   425  	}
   426  	urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName))
   427  	if vpnServerConfigurationName == "" {
   428  		return nil, errors.New("parameter vpnServerConfigurationName cannot be empty")
   429  	}
   430  	urlPath = strings.ReplaceAll(urlPath, "{vpnServerConfigurationName}", url.PathEscape(vpnServerConfigurationName))
   431  	req, err := runtime.NewRequest(ctx, http.MethodPatch, runtime.JoinPaths(client.internal.Endpoint(), urlPath))
   432  	if err != nil {
   433  		return nil, err
   434  	}
   435  	reqQP := req.Raw().URL.Query()
   436  	reqQP.Set("api-version", "2024-05-01")
   437  	req.Raw().URL.RawQuery = reqQP.Encode()
   438  	req.Raw().Header["Accept"] = []string{"application/json"}
   439  	if err := runtime.MarshalAsJSON(req, vpnServerConfigurationParameters); err != nil {
   440  		return nil, err
   441  	}
   442  	return req, nil
   443  }
   444  
   445  // updateTagsHandleResponse handles the UpdateTags response.
   446  func (client *VPNServerConfigurationsClient) updateTagsHandleResponse(resp *http.Response) (VPNServerConfigurationsClientUpdateTagsResponse, error) {
   447  	result := VPNServerConfigurationsClientUpdateTagsResponse{}
   448  	if err := runtime.UnmarshalAsJSON(resp, &result.VPNServerConfiguration); err != nil {
   449  		return VPNServerConfigurationsClientUpdateTagsResponse{}, err
   450  	}
   451  	return result, nil
   452  }