github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/network/armnetwork/v6@v6.2.0/ipgroups_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  // IPGroupsClient contains the methods for the IPGroups group.
    24  // Don't use this type directly, use NewIPGroupsClient() instead.
    25  type IPGroupsClient struct {
    26  	internal       *arm.Client
    27  	subscriptionID string
    28  }
    29  
    30  // NewIPGroupsClient creates a new instance of IPGroupsClient 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 NewIPGroupsClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) (*IPGroupsClient, error) {
    36  	cl, err := arm.NewClient(moduleName, moduleVersion, credential, options)
    37  	if err != nil {
    38  		return nil, err
    39  	}
    40  	client := &IPGroupsClient{
    41  		subscriptionID: subscriptionID,
    42  		internal:       cl,
    43  	}
    44  	return client, nil
    45  }
    46  
    47  // BeginCreateOrUpdate - Creates or updates an ipGroups in a 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  //   - ipGroupsName - The name of the ipGroups.
    53  //   - parameters - Parameters supplied to the create or update IpGroups operation.
    54  //   - options - IPGroupsClientBeginCreateOrUpdateOptions contains the optional parameters for the IPGroupsClient.BeginCreateOrUpdate
    55  //     method.
    56  func (client *IPGroupsClient) BeginCreateOrUpdate(ctx context.Context, resourceGroupName string, ipGroupsName string, parameters IPGroup, options *IPGroupsClientBeginCreateOrUpdateOptions) (*runtime.Poller[IPGroupsClientCreateOrUpdateResponse], error) {
    57  	if options == nil || options.ResumeToken == "" {
    58  		resp, err := client.createOrUpdate(ctx, resourceGroupName, ipGroupsName, parameters, options)
    59  		if err != nil {
    60  			return nil, err
    61  		}
    62  		poller, err := runtime.NewPoller(resp, client.internal.Pipeline(), &runtime.NewPollerOptions[IPGroupsClientCreateOrUpdateResponse]{
    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[IPGroupsClientCreateOrUpdateResponse]{
    69  			Tracer: client.internal.Tracer(),
    70  		})
    71  	}
    72  }
    73  
    74  // CreateOrUpdate - Creates or updates an ipGroups in a 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 *IPGroupsClient) createOrUpdate(ctx context.Context, resourceGroupName string, ipGroupsName string, parameters IPGroup, options *IPGroupsClientBeginCreateOrUpdateOptions) (*http.Response, error) {
    79  	var err error
    80  	const operationName = "IPGroupsClient.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, ipGroupsName, 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 *IPGroupsClient) createOrUpdateCreateRequest(ctx context.Context, resourceGroupName string, ipGroupsName string, parameters IPGroup, options *IPGroupsClientBeginCreateOrUpdateOptions) (*policy.Request, error) {
   101  	urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/ipGroups/{ipGroupsName}"
   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 ipGroupsName == "" {
   107  		return nil, errors.New("parameter ipGroupsName cannot be empty")
   108  	}
   109  	urlPath = strings.ReplaceAll(urlPath, "{ipGroupsName}", url.PathEscape(ipGroupsName))
   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 ipGroups.
   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  //   - ipGroupsName - The name of the ipGroups.
   134  //   - options - IPGroupsClientBeginDeleteOptions contains the optional parameters for the IPGroupsClient.BeginDelete method.
   135  func (client *IPGroupsClient) BeginDelete(ctx context.Context, resourceGroupName string, ipGroupsName string, options *IPGroupsClientBeginDeleteOptions) (*runtime.Poller[IPGroupsClientDeleteResponse], error) {
   136  	if options == nil || options.ResumeToken == "" {
   137  		resp, err := client.deleteOperation(ctx, resourceGroupName, ipGroupsName, options)
   138  		if err != nil {
   139  			return nil, err
   140  		}
   141  		poller, err := runtime.NewPoller(resp, client.internal.Pipeline(), &runtime.NewPollerOptions[IPGroupsClientDeleteResponse]{
   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[IPGroupsClientDeleteResponse]{
   148  			Tracer: client.internal.Tracer(),
   149  		})
   150  	}
   151  }
   152  
   153  // Delete - Deletes the specified ipGroups.
   154  // If the operation fails it returns an *azcore.ResponseError type.
   155  //
   156  // Generated from API version 2024-05-01
   157  func (client *IPGroupsClient) deleteOperation(ctx context.Context, resourceGroupName string, ipGroupsName string, options *IPGroupsClientBeginDeleteOptions) (*http.Response, error) {
   158  	var err error
   159  	const operationName = "IPGroupsClient.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, ipGroupsName, 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 *IPGroupsClient) deleteCreateRequest(ctx context.Context, resourceGroupName string, ipGroupsName string, options *IPGroupsClientBeginDeleteOptions) (*policy.Request, error) {
   180  	urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/ipGroups/{ipGroupsName}"
   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 ipGroupsName == "" {
   186  		return nil, errors.New("parameter ipGroupsName cannot be empty")
   187  	}
   188  	urlPath = strings.ReplaceAll(urlPath, "{ipGroupsName}", url.PathEscape(ipGroupsName))
   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 ipGroups.
   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  //   - ipGroupsName - The name of the ipGroups.
   210  //   - options - IPGroupsClientGetOptions contains the optional parameters for the IPGroupsClient.Get method.
   211  func (client *IPGroupsClient) Get(ctx context.Context, resourceGroupName string, ipGroupsName string, options *IPGroupsClientGetOptions) (IPGroupsClientGetResponse, error) {
   212  	var err error
   213  	const operationName = "IPGroupsClient.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, ipGroupsName, options)
   218  	if err != nil {
   219  		return IPGroupsClientGetResponse{}, err
   220  	}
   221  	httpResp, err := client.internal.Pipeline().Do(req)
   222  	if err != nil {
   223  		return IPGroupsClientGetResponse{}, err
   224  	}
   225  	if !runtime.HasStatusCode(httpResp, http.StatusOK) {
   226  		err = runtime.NewResponseError(httpResp)
   227  		return IPGroupsClientGetResponse{}, err
   228  	}
   229  	resp, err := client.getHandleResponse(httpResp)
   230  	return resp, err
   231  }
   232  
   233  // getCreateRequest creates the Get request.
   234  func (client *IPGroupsClient) getCreateRequest(ctx context.Context, resourceGroupName string, ipGroupsName string, options *IPGroupsClientGetOptions) (*policy.Request, error) {
   235  	urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/ipGroups/{ipGroupsName}"
   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 ipGroupsName == "" {
   241  		return nil, errors.New("parameter ipGroupsName cannot be empty")
   242  	}
   243  	urlPath = strings.ReplaceAll(urlPath, "{ipGroupsName}", url.PathEscape(ipGroupsName))
   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 *IPGroupsClient) getHandleResponse(resp *http.Response) (IPGroupsClientGetResponse, error) {
   264  	result := IPGroupsClientGetResponse{}
   265  	if err := runtime.UnmarshalAsJSON(resp, &result.IPGroup); err != nil {
   266  		return IPGroupsClientGetResponse{}, err
   267  	}
   268  	return result, nil
   269  }
   270  
   271  // NewListPager - Gets all IpGroups in a subscription.
   272  //
   273  // Generated from API version 2024-05-01
   274  //   - options - IPGroupsClientListOptions contains the optional parameters for the IPGroupsClient.NewListPager method.
   275  func (client *IPGroupsClient) NewListPager(options *IPGroupsClientListOptions) *runtime.Pager[IPGroupsClientListResponse] {
   276  	return runtime.NewPager(runtime.PagingHandler[IPGroupsClientListResponse]{
   277  		More: func(page IPGroupsClientListResponse) bool {
   278  			return page.NextLink != nil && len(*page.NextLink) > 0
   279  		},
   280  		Fetcher: func(ctx context.Context, page *IPGroupsClientListResponse) (IPGroupsClientListResponse, error) {
   281  			ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, "IPGroupsClient.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 IPGroupsClientListResponse{}, 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 *IPGroupsClient) listCreateRequest(ctx context.Context, options *IPGroupsClientListOptions) (*policy.Request, error) {
   300  	urlPath := "/subscriptions/{subscriptionId}/providers/Microsoft.Network/ipGroups"
   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 *IPGroupsClient) listHandleResponse(resp *http.Response) (IPGroupsClientListResponse, error) {
   318  	result := IPGroupsClientListResponse{}
   319  	if err := runtime.UnmarshalAsJSON(resp, &result.IPGroupListResult); err != nil {
   320  		return IPGroupsClientListResponse{}, err
   321  	}
   322  	return result, nil
   323  }
   324  
   325  // NewListByResourceGroupPager - Gets all IpGroups in a resource group.
   326  //
   327  // Generated from API version 2024-05-01
   328  //   - resourceGroupName - The name of the resource group.
   329  //   - options - IPGroupsClientListByResourceGroupOptions contains the optional parameters for the IPGroupsClient.NewListByResourceGroupPager
   330  //     method.
   331  func (client *IPGroupsClient) NewListByResourceGroupPager(resourceGroupName string, options *IPGroupsClientListByResourceGroupOptions) *runtime.Pager[IPGroupsClientListByResourceGroupResponse] {
   332  	return runtime.NewPager(runtime.PagingHandler[IPGroupsClientListByResourceGroupResponse]{
   333  		More: func(page IPGroupsClientListByResourceGroupResponse) bool {
   334  			return page.NextLink != nil && len(*page.NextLink) > 0
   335  		},
   336  		Fetcher: func(ctx context.Context, page *IPGroupsClientListByResourceGroupResponse) (IPGroupsClientListByResourceGroupResponse, error) {
   337  			ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, "IPGroupsClient.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 IPGroupsClientListByResourceGroupResponse{}, 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 *IPGroupsClient) listByResourceGroupCreateRequest(ctx context.Context, resourceGroupName string, options *IPGroupsClientListByResourceGroupOptions) (*policy.Request, error) {
   356  	urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/ipGroups"
   357  	if resourceGroupName == "" {
   358  		return nil, errors.New("parameter resourceGroupName cannot be empty")
   359  	}
   360  	urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName))
   361  	if client.subscriptionID == "" {
   362  		return nil, errors.New("parameter client.subscriptionID cannot be empty")
   363  	}
   364  	urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID))
   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 *IPGroupsClient) listByResourceGroupHandleResponse(resp *http.Response) (IPGroupsClientListByResourceGroupResponse, error) {
   378  	result := IPGroupsClientListByResourceGroupResponse{}
   379  	if err := runtime.UnmarshalAsJSON(resp, &result.IPGroupListResult); err != nil {
   380  		return IPGroupsClientListByResourceGroupResponse{}, err
   381  	}
   382  	return result, nil
   383  }
   384  
   385  // UpdateGroups - Updates tags of an IpGroups resource.
   386  // If the operation fails it returns an *azcore.ResponseError type.
   387  //
   388  // Generated from API version 2024-05-01
   389  //   - resourceGroupName - The name of the resource group.
   390  //   - ipGroupsName - The name of the ipGroups.
   391  //   - parameters - Parameters supplied to the update ipGroups operation.
   392  //   - options - IPGroupsClientUpdateGroupsOptions contains the optional parameters for the IPGroupsClient.UpdateGroups method.
   393  func (client *IPGroupsClient) UpdateGroups(ctx context.Context, resourceGroupName string, ipGroupsName string, parameters TagsObject, options *IPGroupsClientUpdateGroupsOptions) (IPGroupsClientUpdateGroupsResponse, error) {
   394  	var err error
   395  	const operationName = "IPGroupsClient.UpdateGroups"
   396  	ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName)
   397  	ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil)
   398  	defer func() { endSpan(err) }()
   399  	req, err := client.updateGroupsCreateRequest(ctx, resourceGroupName, ipGroupsName, parameters, options)
   400  	if err != nil {
   401  		return IPGroupsClientUpdateGroupsResponse{}, err
   402  	}
   403  	httpResp, err := client.internal.Pipeline().Do(req)
   404  	if err != nil {
   405  		return IPGroupsClientUpdateGroupsResponse{}, err
   406  	}
   407  	if !runtime.HasStatusCode(httpResp, http.StatusOK) {
   408  		err = runtime.NewResponseError(httpResp)
   409  		return IPGroupsClientUpdateGroupsResponse{}, err
   410  	}
   411  	resp, err := client.updateGroupsHandleResponse(httpResp)
   412  	return resp, err
   413  }
   414  
   415  // updateGroupsCreateRequest creates the UpdateGroups request.
   416  func (client *IPGroupsClient) updateGroupsCreateRequest(ctx context.Context, resourceGroupName string, ipGroupsName string, parameters TagsObject, options *IPGroupsClientUpdateGroupsOptions) (*policy.Request, error) {
   417  	urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/ipGroups/{ipGroupsName}"
   418  	if resourceGroupName == "" {
   419  		return nil, errors.New("parameter resourceGroupName cannot be empty")
   420  	}
   421  	urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName))
   422  	if ipGroupsName == "" {
   423  		return nil, errors.New("parameter ipGroupsName cannot be empty")
   424  	}
   425  	urlPath = strings.ReplaceAll(urlPath, "{ipGroupsName}", url.PathEscape(ipGroupsName))
   426  	if client.subscriptionID == "" {
   427  		return nil, errors.New("parameter client.subscriptionID cannot be empty")
   428  	}
   429  	urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID))
   430  	req, err := runtime.NewRequest(ctx, http.MethodPatch, runtime.JoinPaths(client.internal.Endpoint(), urlPath))
   431  	if err != nil {
   432  		return nil, err
   433  	}
   434  	reqQP := req.Raw().URL.Query()
   435  	reqQP.Set("api-version", "2024-05-01")
   436  	req.Raw().URL.RawQuery = reqQP.Encode()
   437  	req.Raw().Header["Accept"] = []string{"application/json"}
   438  	if err := runtime.MarshalAsJSON(req, parameters); err != nil {
   439  		return nil, err
   440  	}
   441  	return req, nil
   442  }
   443  
   444  // updateGroupsHandleResponse handles the UpdateGroups response.
   445  func (client *IPGroupsClient) updateGroupsHandleResponse(resp *http.Response) (IPGroupsClientUpdateGroupsResponse, error) {
   446  	result := IPGroupsClientUpdateGroupsResponse{}
   447  	if err := runtime.UnmarshalAsJSON(resp, &result.IPGroup); err != nil {
   448  		return IPGroupsClientUpdateGroupsResponse{}, err
   449  	}
   450  	return result, nil
   451  }