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