github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/network/armnetwork/v6@v6.2.0/ipallocations_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  // IPAllocationsClient contains the methods for the IPAllocations group.
    24  // Don't use this type directly, use NewIPAllocationsClient() instead.
    25  type IPAllocationsClient struct {
    26  	internal       *arm.Client
    27  	subscriptionID string
    28  }
    29  
    30  // NewIPAllocationsClient creates a new instance of IPAllocationsClient 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 NewIPAllocationsClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) (*IPAllocationsClient, error) {
    36  	cl, err := arm.NewClient(moduleName, moduleVersion, credential, options)
    37  	if err != nil {
    38  		return nil, err
    39  	}
    40  	client := &IPAllocationsClient{
    41  		subscriptionID: subscriptionID,
    42  		internal:       cl,
    43  	}
    44  	return client, nil
    45  }
    46  
    47  // BeginCreateOrUpdate - Creates or updates an IpAllocation in the specified 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  //   - ipAllocationName - The name of the IpAllocation.
    53  //   - parameters - Parameters supplied to the create or update virtual network operation.
    54  //   - options - IPAllocationsClientBeginCreateOrUpdateOptions contains the optional parameters for the IPAllocationsClient.BeginCreateOrUpdate
    55  //     method.
    56  func (client *IPAllocationsClient) BeginCreateOrUpdate(ctx context.Context, resourceGroupName string, ipAllocationName string, parameters IPAllocation, options *IPAllocationsClientBeginCreateOrUpdateOptions) (*runtime.Poller[IPAllocationsClientCreateOrUpdateResponse], error) {
    57  	if options == nil || options.ResumeToken == "" {
    58  		resp, err := client.createOrUpdate(ctx, resourceGroupName, ipAllocationName, parameters, options)
    59  		if err != nil {
    60  			return nil, err
    61  		}
    62  		poller, err := runtime.NewPoller(resp, client.internal.Pipeline(), &runtime.NewPollerOptions[IPAllocationsClientCreateOrUpdateResponse]{
    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[IPAllocationsClientCreateOrUpdateResponse]{
    69  			Tracer: client.internal.Tracer(),
    70  		})
    71  	}
    72  }
    73  
    74  // CreateOrUpdate - Creates or updates an IpAllocation in the specified resource group.
    75  // If the operation fails it returns an *azcore.ResponseError type.
    76  //
    77  // Generated from API version 2024-05-01
    78  func (client *IPAllocationsClient) createOrUpdate(ctx context.Context, resourceGroupName string, ipAllocationName string, parameters IPAllocation, options *IPAllocationsClientBeginCreateOrUpdateOptions) (*http.Response, error) {
    79  	var err error
    80  	const operationName = "IPAllocationsClient.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, ipAllocationName, 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) {
    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 *IPAllocationsClient) createOrUpdateCreateRequest(ctx context.Context, resourceGroupName string, ipAllocationName string, parameters IPAllocation, options *IPAllocationsClientBeginCreateOrUpdateOptions) (*policy.Request, error) {
   101  	urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/IpAllocations/{ipAllocationName}"
   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 ipAllocationName == "" {
   107  		return nil, errors.New("parameter ipAllocationName cannot be empty")
   108  	}
   109  	urlPath = strings.ReplaceAll(urlPath, "{ipAllocationName}", url.PathEscape(ipAllocationName))
   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 IpAllocation.
   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  //   - ipAllocationName - The name of the IpAllocation.
   134  //   - options - IPAllocationsClientBeginDeleteOptions contains the optional parameters for the IPAllocationsClient.BeginDelete
   135  //     method.
   136  func (client *IPAllocationsClient) BeginDelete(ctx context.Context, resourceGroupName string, ipAllocationName string, options *IPAllocationsClientBeginDeleteOptions) (*runtime.Poller[IPAllocationsClientDeleteResponse], error) {
   137  	if options == nil || options.ResumeToken == "" {
   138  		resp, err := client.deleteOperation(ctx, resourceGroupName, ipAllocationName, options)
   139  		if err != nil {
   140  			return nil, err
   141  		}
   142  		poller, err := runtime.NewPoller(resp, client.internal.Pipeline(), &runtime.NewPollerOptions[IPAllocationsClientDeleteResponse]{
   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[IPAllocationsClientDeleteResponse]{
   149  			Tracer: client.internal.Tracer(),
   150  		})
   151  	}
   152  }
   153  
   154  // Delete - Deletes the specified IpAllocation.
   155  // If the operation fails it returns an *azcore.ResponseError type.
   156  //
   157  // Generated from API version 2024-05-01
   158  func (client *IPAllocationsClient) deleteOperation(ctx context.Context, resourceGroupName string, ipAllocationName string, options *IPAllocationsClientBeginDeleteOptions) (*http.Response, error) {
   159  	var err error
   160  	const operationName = "IPAllocationsClient.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, ipAllocationName, 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 *IPAllocationsClient) deleteCreateRequest(ctx context.Context, resourceGroupName string, ipAllocationName string, options *IPAllocationsClientBeginDeleteOptions) (*policy.Request, error) {
   181  	urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/IpAllocations/{ipAllocationName}"
   182  	if resourceGroupName == "" {
   183  		return nil, errors.New("parameter resourceGroupName cannot be empty")
   184  	}
   185  	urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName))
   186  	if ipAllocationName == "" {
   187  		return nil, errors.New("parameter ipAllocationName cannot be empty")
   188  	}
   189  	urlPath = strings.ReplaceAll(urlPath, "{ipAllocationName}", url.PathEscape(ipAllocationName))
   190  	if client.subscriptionID == "" {
   191  		return nil, errors.New("parameter client.subscriptionID cannot be empty")
   192  	}
   193  	urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID))
   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 - Gets the specified IpAllocation by resource group.
   206  // If the operation fails it returns an *azcore.ResponseError type.
   207  //
   208  // Generated from API version 2024-05-01
   209  //   - resourceGroupName - The name of the resource group.
   210  //   - ipAllocationName - The name of the IpAllocation.
   211  //   - options - IPAllocationsClientGetOptions contains the optional parameters for the IPAllocationsClient.Get method.
   212  func (client *IPAllocationsClient) Get(ctx context.Context, resourceGroupName string, ipAllocationName string, options *IPAllocationsClientGetOptions) (IPAllocationsClientGetResponse, error) {
   213  	var err error
   214  	const operationName = "IPAllocationsClient.Get"
   215  	ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName)
   216  	ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil)
   217  	defer func() { endSpan(err) }()
   218  	req, err := client.getCreateRequest(ctx, resourceGroupName, ipAllocationName, options)
   219  	if err != nil {
   220  		return IPAllocationsClientGetResponse{}, err
   221  	}
   222  	httpResp, err := client.internal.Pipeline().Do(req)
   223  	if err != nil {
   224  		return IPAllocationsClientGetResponse{}, err
   225  	}
   226  	if !runtime.HasStatusCode(httpResp, http.StatusOK) {
   227  		err = runtime.NewResponseError(httpResp)
   228  		return IPAllocationsClientGetResponse{}, err
   229  	}
   230  	resp, err := client.getHandleResponse(httpResp)
   231  	return resp, err
   232  }
   233  
   234  // getCreateRequest creates the Get request.
   235  func (client *IPAllocationsClient) getCreateRequest(ctx context.Context, resourceGroupName string, ipAllocationName string, options *IPAllocationsClientGetOptions) (*policy.Request, error) {
   236  	urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/IpAllocations/{ipAllocationName}"
   237  	if resourceGroupName == "" {
   238  		return nil, errors.New("parameter resourceGroupName cannot be empty")
   239  	}
   240  	urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName))
   241  	if ipAllocationName == "" {
   242  		return nil, errors.New("parameter ipAllocationName cannot be empty")
   243  	}
   244  	urlPath = strings.ReplaceAll(urlPath, "{ipAllocationName}", url.PathEscape(ipAllocationName))
   245  	if client.subscriptionID == "" {
   246  		return nil, errors.New("parameter client.subscriptionID cannot be empty")
   247  	}
   248  	urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID))
   249  	req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.internal.Endpoint(), urlPath))
   250  	if err != nil {
   251  		return nil, err
   252  	}
   253  	reqQP := req.Raw().URL.Query()
   254  	if options != nil && options.Expand != nil {
   255  		reqQP.Set("$expand", *options.Expand)
   256  	}
   257  	reqQP.Set("api-version", "2024-05-01")
   258  	req.Raw().URL.RawQuery = reqQP.Encode()
   259  	req.Raw().Header["Accept"] = []string{"application/json"}
   260  	return req, nil
   261  }
   262  
   263  // getHandleResponse handles the Get response.
   264  func (client *IPAllocationsClient) getHandleResponse(resp *http.Response) (IPAllocationsClientGetResponse, error) {
   265  	result := IPAllocationsClientGetResponse{}
   266  	if err := runtime.UnmarshalAsJSON(resp, &result.IPAllocation); err != nil {
   267  		return IPAllocationsClientGetResponse{}, err
   268  	}
   269  	return result, nil
   270  }
   271  
   272  // NewListPager - Gets all IpAllocations in a subscription.
   273  //
   274  // Generated from API version 2024-05-01
   275  //   - options - IPAllocationsClientListOptions contains the optional parameters for the IPAllocationsClient.NewListPager method.
   276  func (client *IPAllocationsClient) NewListPager(options *IPAllocationsClientListOptions) *runtime.Pager[IPAllocationsClientListResponse] {
   277  	return runtime.NewPager(runtime.PagingHandler[IPAllocationsClientListResponse]{
   278  		More: func(page IPAllocationsClientListResponse) bool {
   279  			return page.NextLink != nil && len(*page.NextLink) > 0
   280  		},
   281  		Fetcher: func(ctx context.Context, page *IPAllocationsClientListResponse) (IPAllocationsClientListResponse, error) {
   282  			ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, "IPAllocationsClient.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, options)
   289  			}, nil)
   290  			if err != nil {
   291  				return IPAllocationsClientListResponse{}, 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 *IPAllocationsClient) listCreateRequest(ctx context.Context, options *IPAllocationsClientListOptions) (*policy.Request, error) {
   301  	urlPath := "/subscriptions/{subscriptionId}/providers/Microsoft.Network/IpAllocations"
   302  	if client.subscriptionID == "" {
   303  		return nil, errors.New("parameter client.subscriptionID cannot be empty")
   304  	}
   305  	urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID))
   306  	req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.internal.Endpoint(), urlPath))
   307  	if err != nil {
   308  		return nil, err
   309  	}
   310  	reqQP := req.Raw().URL.Query()
   311  	reqQP.Set("api-version", "2024-05-01")
   312  	req.Raw().URL.RawQuery = reqQP.Encode()
   313  	req.Raw().Header["Accept"] = []string{"application/json"}
   314  	return req, nil
   315  }
   316  
   317  // listHandleResponse handles the List response.
   318  func (client *IPAllocationsClient) listHandleResponse(resp *http.Response) (IPAllocationsClientListResponse, error) {
   319  	result := IPAllocationsClientListResponse{}
   320  	if err := runtime.UnmarshalAsJSON(resp, &result.IPAllocationListResult); err != nil {
   321  		return IPAllocationsClientListResponse{}, err
   322  	}
   323  	return result, nil
   324  }
   325  
   326  // NewListByResourceGroupPager - Gets all IpAllocations in a resource group.
   327  //
   328  // Generated from API version 2024-05-01
   329  //   - resourceGroupName - The name of the resource group.
   330  //   - options - IPAllocationsClientListByResourceGroupOptions contains the optional parameters for the IPAllocationsClient.NewListByResourceGroupPager
   331  //     method.
   332  func (client *IPAllocationsClient) NewListByResourceGroupPager(resourceGroupName string, options *IPAllocationsClientListByResourceGroupOptions) *runtime.Pager[IPAllocationsClientListByResourceGroupResponse] {
   333  	return runtime.NewPager(runtime.PagingHandler[IPAllocationsClientListByResourceGroupResponse]{
   334  		More: func(page IPAllocationsClientListByResourceGroupResponse) bool {
   335  			return page.NextLink != nil && len(*page.NextLink) > 0
   336  		},
   337  		Fetcher: func(ctx context.Context, page *IPAllocationsClientListByResourceGroupResponse) (IPAllocationsClientListByResourceGroupResponse, error) {
   338  			ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, "IPAllocationsClient.NewListByResourceGroupPager")
   339  			nextLink := ""
   340  			if page != nil {
   341  				nextLink = *page.NextLink
   342  			}
   343  			resp, err := runtime.FetcherForNextLink(ctx, client.internal.Pipeline(), nextLink, func(ctx context.Context) (*policy.Request, error) {
   344  				return client.listByResourceGroupCreateRequest(ctx, resourceGroupName, options)
   345  			}, nil)
   346  			if err != nil {
   347  				return IPAllocationsClientListByResourceGroupResponse{}, err
   348  			}
   349  			return client.listByResourceGroupHandleResponse(resp)
   350  		},
   351  		Tracer: client.internal.Tracer(),
   352  	})
   353  }
   354  
   355  // listByResourceGroupCreateRequest creates the ListByResourceGroup request.
   356  func (client *IPAllocationsClient) listByResourceGroupCreateRequest(ctx context.Context, resourceGroupName string, options *IPAllocationsClientListByResourceGroupOptions) (*policy.Request, error) {
   357  	urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/IpAllocations"
   358  	if resourceGroupName == "" {
   359  		return nil, errors.New("parameter resourceGroupName cannot be empty")
   360  	}
   361  	urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName))
   362  	if client.subscriptionID == "" {
   363  		return nil, errors.New("parameter client.subscriptionID cannot be empty")
   364  	}
   365  	urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID))
   366  	req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.internal.Endpoint(), urlPath))
   367  	if err != nil {
   368  		return nil, err
   369  	}
   370  	reqQP := req.Raw().URL.Query()
   371  	reqQP.Set("api-version", "2024-05-01")
   372  	req.Raw().URL.RawQuery = reqQP.Encode()
   373  	req.Raw().Header["Accept"] = []string{"application/json"}
   374  	return req, nil
   375  }
   376  
   377  // listByResourceGroupHandleResponse handles the ListByResourceGroup response.
   378  func (client *IPAllocationsClient) listByResourceGroupHandleResponse(resp *http.Response) (IPAllocationsClientListByResourceGroupResponse, error) {
   379  	result := IPAllocationsClientListByResourceGroupResponse{}
   380  	if err := runtime.UnmarshalAsJSON(resp, &result.IPAllocationListResult); err != nil {
   381  		return IPAllocationsClientListByResourceGroupResponse{}, err
   382  	}
   383  	return result, nil
   384  }
   385  
   386  // UpdateTags - Updates a IpAllocation tags.
   387  // If the operation fails it returns an *azcore.ResponseError type.
   388  //
   389  // Generated from API version 2024-05-01
   390  //   - resourceGroupName - The name of the resource group.
   391  //   - ipAllocationName - The name of the IpAllocation.
   392  //   - parameters - Parameters supplied to update IpAllocation tags.
   393  //   - options - IPAllocationsClientUpdateTagsOptions contains the optional parameters for the IPAllocationsClient.UpdateTags
   394  //     method.
   395  func (client *IPAllocationsClient) UpdateTags(ctx context.Context, resourceGroupName string, ipAllocationName string, parameters TagsObject, options *IPAllocationsClientUpdateTagsOptions) (IPAllocationsClientUpdateTagsResponse, error) {
   396  	var err error
   397  	const operationName = "IPAllocationsClient.UpdateTags"
   398  	ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName)
   399  	ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil)
   400  	defer func() { endSpan(err) }()
   401  	req, err := client.updateTagsCreateRequest(ctx, resourceGroupName, ipAllocationName, parameters, options)
   402  	if err != nil {
   403  		return IPAllocationsClientUpdateTagsResponse{}, err
   404  	}
   405  	httpResp, err := client.internal.Pipeline().Do(req)
   406  	if err != nil {
   407  		return IPAllocationsClientUpdateTagsResponse{}, err
   408  	}
   409  	if !runtime.HasStatusCode(httpResp, http.StatusOK) {
   410  		err = runtime.NewResponseError(httpResp)
   411  		return IPAllocationsClientUpdateTagsResponse{}, err
   412  	}
   413  	resp, err := client.updateTagsHandleResponse(httpResp)
   414  	return resp, err
   415  }
   416  
   417  // updateTagsCreateRequest creates the UpdateTags request.
   418  func (client *IPAllocationsClient) updateTagsCreateRequest(ctx context.Context, resourceGroupName string, ipAllocationName string, parameters TagsObject, options *IPAllocationsClientUpdateTagsOptions) (*policy.Request, error) {
   419  	urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/IpAllocations/{ipAllocationName}"
   420  	if resourceGroupName == "" {
   421  		return nil, errors.New("parameter resourceGroupName cannot be empty")
   422  	}
   423  	urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName))
   424  	if ipAllocationName == "" {
   425  		return nil, errors.New("parameter ipAllocationName cannot be empty")
   426  	}
   427  	urlPath = strings.ReplaceAll(urlPath, "{ipAllocationName}", url.PathEscape(ipAllocationName))
   428  	if client.subscriptionID == "" {
   429  		return nil, errors.New("parameter client.subscriptionID cannot be empty")
   430  	}
   431  	urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID))
   432  	req, err := runtime.NewRequest(ctx, http.MethodPatch, runtime.JoinPaths(client.internal.Endpoint(), urlPath))
   433  	if err != nil {
   434  		return nil, err
   435  	}
   436  	reqQP := req.Raw().URL.Query()
   437  	reqQP.Set("api-version", "2024-05-01")
   438  	req.Raw().URL.RawQuery = reqQP.Encode()
   439  	req.Raw().Header["Accept"] = []string{"application/json"}
   440  	if err := runtime.MarshalAsJSON(req, parameters); err != nil {
   441  		return nil, err
   442  	}
   443  	return req, nil
   444  }
   445  
   446  // updateTagsHandleResponse handles the UpdateTags response.
   447  func (client *IPAllocationsClient) updateTagsHandleResponse(resp *http.Response) (IPAllocationsClientUpdateTagsResponse, error) {
   448  	result := IPAllocationsClientUpdateTagsResponse{}
   449  	if err := runtime.UnmarshalAsJSON(resp, &result.IPAllocation); err != nil {
   450  		return IPAllocationsClientUpdateTagsResponse{}, err
   451  	}
   452  	return result, nil
   453  }