github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/network/armnetwork/v6@v6.2.0/managers_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  	"strconv"
    21  	"strings"
    22  )
    23  
    24  // ManagersClient contains the methods for the NetworkManagers group.
    25  // Don't use this type directly, use NewManagersClient() instead.
    26  type ManagersClient struct {
    27  	internal       *arm.Client
    28  	subscriptionID string
    29  }
    30  
    31  // NewManagersClient creates a new instance of ManagersClient with the specified values.
    32  //   - subscriptionID - The subscription credentials which uniquely identify the Microsoft Azure subscription. The subscription
    33  //     ID forms part of the URI for every service call.
    34  //   - credential - used to authorize requests. Usually a credential from azidentity.
    35  //   - options - pass nil to accept the default values.
    36  func NewManagersClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) (*ManagersClient, error) {
    37  	cl, err := arm.NewClient(moduleName, moduleVersion, credential, options)
    38  	if err != nil {
    39  		return nil, err
    40  	}
    41  	client := &ManagersClient{
    42  		subscriptionID: subscriptionID,
    43  		internal:       cl,
    44  	}
    45  	return client, nil
    46  }
    47  
    48  // CreateOrUpdate - Creates or updates a Network Manager.
    49  // If the operation fails it returns an *azcore.ResponseError type.
    50  //
    51  // Generated from API version 2024-05-01
    52  //   - resourceGroupName - The name of the resource group.
    53  //   - networkManagerName - The name of the network manager.
    54  //   - parameters - Parameters supplied to specify which network manager is.
    55  //   - options - ManagersClientCreateOrUpdateOptions contains the optional parameters for the ManagersClient.CreateOrUpdate method.
    56  func (client *ManagersClient) CreateOrUpdate(ctx context.Context, resourceGroupName string, networkManagerName string, parameters Manager, options *ManagersClientCreateOrUpdateOptions) (ManagersClientCreateOrUpdateResponse, error) {
    57  	var err error
    58  	const operationName = "ManagersClient.CreateOrUpdate"
    59  	ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName)
    60  	ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil)
    61  	defer func() { endSpan(err) }()
    62  	req, err := client.createOrUpdateCreateRequest(ctx, resourceGroupName, networkManagerName, parameters, options)
    63  	if err != nil {
    64  		return ManagersClientCreateOrUpdateResponse{}, err
    65  	}
    66  	httpResp, err := client.internal.Pipeline().Do(req)
    67  	if err != nil {
    68  		return ManagersClientCreateOrUpdateResponse{}, err
    69  	}
    70  	if !runtime.HasStatusCode(httpResp, http.StatusOK, http.StatusCreated) {
    71  		err = runtime.NewResponseError(httpResp)
    72  		return ManagersClientCreateOrUpdateResponse{}, err
    73  	}
    74  	resp, err := client.createOrUpdateHandleResponse(httpResp)
    75  	return resp, err
    76  }
    77  
    78  // createOrUpdateCreateRequest creates the CreateOrUpdate request.
    79  func (client *ManagersClient) createOrUpdateCreateRequest(ctx context.Context, resourceGroupName string, networkManagerName string, parameters Manager, options *ManagersClientCreateOrUpdateOptions) (*policy.Request, error) {
    80  	urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/networkManagers/{networkManagerName}"
    81  	if client.subscriptionID == "" {
    82  		return nil, errors.New("parameter client.subscriptionID cannot be empty")
    83  	}
    84  	urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID))
    85  	if resourceGroupName == "" {
    86  		return nil, errors.New("parameter resourceGroupName cannot be empty")
    87  	}
    88  	urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName))
    89  	if networkManagerName == "" {
    90  		return nil, errors.New("parameter networkManagerName cannot be empty")
    91  	}
    92  	urlPath = strings.ReplaceAll(urlPath, "{networkManagerName}", url.PathEscape(networkManagerName))
    93  	req, err := runtime.NewRequest(ctx, http.MethodPut, runtime.JoinPaths(client.internal.Endpoint(), urlPath))
    94  	if err != nil {
    95  		return nil, err
    96  	}
    97  	reqQP := req.Raw().URL.Query()
    98  	reqQP.Set("api-version", "2024-05-01")
    99  	req.Raw().URL.RawQuery = reqQP.Encode()
   100  	req.Raw().Header["Accept"] = []string{"application/json"}
   101  	if err := runtime.MarshalAsJSON(req, parameters); err != nil {
   102  		return nil, err
   103  	}
   104  	return req, nil
   105  }
   106  
   107  // createOrUpdateHandleResponse handles the CreateOrUpdate response.
   108  func (client *ManagersClient) createOrUpdateHandleResponse(resp *http.Response) (ManagersClientCreateOrUpdateResponse, error) {
   109  	result := ManagersClientCreateOrUpdateResponse{}
   110  	if err := runtime.UnmarshalAsJSON(resp, &result.Manager); err != nil {
   111  		return ManagersClientCreateOrUpdateResponse{}, err
   112  	}
   113  	return result, nil
   114  }
   115  
   116  // BeginDelete - Deletes a network manager.
   117  // If the operation fails it returns an *azcore.ResponseError type.
   118  //
   119  // Generated from API version 2024-05-01
   120  //   - resourceGroupName - The name of the resource group.
   121  //   - networkManagerName - The name of the network manager.
   122  //   - options - ManagersClientBeginDeleteOptions contains the optional parameters for the ManagersClient.BeginDelete method.
   123  func (client *ManagersClient) BeginDelete(ctx context.Context, resourceGroupName string, networkManagerName string, options *ManagersClientBeginDeleteOptions) (*runtime.Poller[ManagersClientDeleteResponse], error) {
   124  	if options == nil || options.ResumeToken == "" {
   125  		resp, err := client.deleteOperation(ctx, resourceGroupName, networkManagerName, options)
   126  		if err != nil {
   127  			return nil, err
   128  		}
   129  		poller, err := runtime.NewPoller(resp, client.internal.Pipeline(), &runtime.NewPollerOptions[ManagersClientDeleteResponse]{
   130  			FinalStateVia: runtime.FinalStateViaLocation,
   131  			Tracer:        client.internal.Tracer(),
   132  		})
   133  		return poller, err
   134  	} else {
   135  		return runtime.NewPollerFromResumeToken(options.ResumeToken, client.internal.Pipeline(), &runtime.NewPollerFromResumeTokenOptions[ManagersClientDeleteResponse]{
   136  			Tracer: client.internal.Tracer(),
   137  		})
   138  	}
   139  }
   140  
   141  // Delete - Deletes a network manager.
   142  // If the operation fails it returns an *azcore.ResponseError type.
   143  //
   144  // Generated from API version 2024-05-01
   145  func (client *ManagersClient) deleteOperation(ctx context.Context, resourceGroupName string, networkManagerName string, options *ManagersClientBeginDeleteOptions) (*http.Response, error) {
   146  	var err error
   147  	const operationName = "ManagersClient.BeginDelete"
   148  	ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName)
   149  	ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil)
   150  	defer func() { endSpan(err) }()
   151  	req, err := client.deleteCreateRequest(ctx, resourceGroupName, networkManagerName, options)
   152  	if err != nil {
   153  		return nil, err
   154  	}
   155  	httpResp, err := client.internal.Pipeline().Do(req)
   156  	if err != nil {
   157  		return nil, err
   158  	}
   159  	if !runtime.HasStatusCode(httpResp, http.StatusOK, http.StatusAccepted, http.StatusNoContent) {
   160  		err = runtime.NewResponseError(httpResp)
   161  		return nil, err
   162  	}
   163  	return httpResp, nil
   164  }
   165  
   166  // deleteCreateRequest creates the Delete request.
   167  func (client *ManagersClient) deleteCreateRequest(ctx context.Context, resourceGroupName string, networkManagerName string, options *ManagersClientBeginDeleteOptions) (*policy.Request, error) {
   168  	urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/networkManagers/{networkManagerName}"
   169  	if client.subscriptionID == "" {
   170  		return nil, errors.New("parameter client.subscriptionID cannot be empty")
   171  	}
   172  	urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID))
   173  	if resourceGroupName == "" {
   174  		return nil, errors.New("parameter resourceGroupName cannot be empty")
   175  	}
   176  	urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName))
   177  	if networkManagerName == "" {
   178  		return nil, errors.New("parameter networkManagerName cannot be empty")
   179  	}
   180  	urlPath = strings.ReplaceAll(urlPath, "{networkManagerName}", url.PathEscape(networkManagerName))
   181  	req, err := runtime.NewRequest(ctx, http.MethodDelete, runtime.JoinPaths(client.internal.Endpoint(), urlPath))
   182  	if err != nil {
   183  		return nil, err
   184  	}
   185  	reqQP := req.Raw().URL.Query()
   186  	reqQP.Set("api-version", "2024-05-01")
   187  	if options != nil && options.Force != nil {
   188  		reqQP.Set("force", strconv.FormatBool(*options.Force))
   189  	}
   190  	req.Raw().URL.RawQuery = reqQP.Encode()
   191  	req.Raw().Header["Accept"] = []string{"application/json"}
   192  	return req, nil
   193  }
   194  
   195  // Get - Gets the specified Network Manager.
   196  // If the operation fails it returns an *azcore.ResponseError type.
   197  //
   198  // Generated from API version 2024-05-01
   199  //   - resourceGroupName - The name of the resource group.
   200  //   - networkManagerName - The name of the network manager.
   201  //   - options - ManagersClientGetOptions contains the optional parameters for the ManagersClient.Get method.
   202  func (client *ManagersClient) Get(ctx context.Context, resourceGroupName string, networkManagerName string, options *ManagersClientGetOptions) (ManagersClientGetResponse, error) {
   203  	var err error
   204  	const operationName = "ManagersClient.Get"
   205  	ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName)
   206  	ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil)
   207  	defer func() { endSpan(err) }()
   208  	req, err := client.getCreateRequest(ctx, resourceGroupName, networkManagerName, options)
   209  	if err != nil {
   210  		return ManagersClientGetResponse{}, err
   211  	}
   212  	httpResp, err := client.internal.Pipeline().Do(req)
   213  	if err != nil {
   214  		return ManagersClientGetResponse{}, err
   215  	}
   216  	if !runtime.HasStatusCode(httpResp, http.StatusOK) {
   217  		err = runtime.NewResponseError(httpResp)
   218  		return ManagersClientGetResponse{}, err
   219  	}
   220  	resp, err := client.getHandleResponse(httpResp)
   221  	return resp, err
   222  }
   223  
   224  // getCreateRequest creates the Get request.
   225  func (client *ManagersClient) getCreateRequest(ctx context.Context, resourceGroupName string, networkManagerName string, options *ManagersClientGetOptions) (*policy.Request, error) {
   226  	urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/networkManagers/{networkManagerName}"
   227  	if client.subscriptionID == "" {
   228  		return nil, errors.New("parameter client.subscriptionID cannot be empty")
   229  	}
   230  	urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID))
   231  	if resourceGroupName == "" {
   232  		return nil, errors.New("parameter resourceGroupName cannot be empty")
   233  	}
   234  	urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName))
   235  	if networkManagerName == "" {
   236  		return nil, errors.New("parameter networkManagerName cannot be empty")
   237  	}
   238  	urlPath = strings.ReplaceAll(urlPath, "{networkManagerName}", url.PathEscape(networkManagerName))
   239  	req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.internal.Endpoint(), urlPath))
   240  	if err != nil {
   241  		return nil, err
   242  	}
   243  	reqQP := req.Raw().URL.Query()
   244  	reqQP.Set("api-version", "2024-05-01")
   245  	req.Raw().URL.RawQuery = reqQP.Encode()
   246  	req.Raw().Header["Accept"] = []string{"application/json"}
   247  	return req, nil
   248  }
   249  
   250  // getHandleResponse handles the Get response.
   251  func (client *ManagersClient) getHandleResponse(resp *http.Response) (ManagersClientGetResponse, error) {
   252  	result := ManagersClientGetResponse{}
   253  	if err := runtime.UnmarshalAsJSON(resp, &result.Manager); err != nil {
   254  		return ManagersClientGetResponse{}, err
   255  	}
   256  	return result, nil
   257  }
   258  
   259  // NewListPager - List network managers in a resource group.
   260  //
   261  // Generated from API version 2024-05-01
   262  //   - resourceGroupName - The name of the resource group.
   263  //   - options - ManagersClientListOptions contains the optional parameters for the ManagersClient.NewListPager method.
   264  func (client *ManagersClient) NewListPager(resourceGroupName string, options *ManagersClientListOptions) *runtime.Pager[ManagersClientListResponse] {
   265  	return runtime.NewPager(runtime.PagingHandler[ManagersClientListResponse]{
   266  		More: func(page ManagersClientListResponse) bool {
   267  			return page.NextLink != nil && len(*page.NextLink) > 0
   268  		},
   269  		Fetcher: func(ctx context.Context, page *ManagersClientListResponse) (ManagersClientListResponse, error) {
   270  			ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, "ManagersClient.NewListPager")
   271  			nextLink := ""
   272  			if page != nil {
   273  				nextLink = *page.NextLink
   274  			}
   275  			resp, err := runtime.FetcherForNextLink(ctx, client.internal.Pipeline(), nextLink, func(ctx context.Context) (*policy.Request, error) {
   276  				return client.listCreateRequest(ctx, resourceGroupName, options)
   277  			}, nil)
   278  			if err != nil {
   279  				return ManagersClientListResponse{}, err
   280  			}
   281  			return client.listHandleResponse(resp)
   282  		},
   283  		Tracer: client.internal.Tracer(),
   284  	})
   285  }
   286  
   287  // listCreateRequest creates the List request.
   288  func (client *ManagersClient) listCreateRequest(ctx context.Context, resourceGroupName string, options *ManagersClientListOptions) (*policy.Request, error) {
   289  	urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/networkManagers"
   290  	if client.subscriptionID == "" {
   291  		return nil, errors.New("parameter client.subscriptionID cannot be empty")
   292  	}
   293  	urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID))
   294  	if resourceGroupName == "" {
   295  		return nil, errors.New("parameter resourceGroupName cannot be empty")
   296  	}
   297  	urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName))
   298  	req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.internal.Endpoint(), urlPath))
   299  	if err != nil {
   300  		return nil, err
   301  	}
   302  	reqQP := req.Raw().URL.Query()
   303  	if options != nil && options.SkipToken != nil {
   304  		reqQP.Set("$skipToken", *options.SkipToken)
   305  	}
   306  	if options != nil && options.Top != nil {
   307  		reqQP.Set("$top", strconv.FormatInt(int64(*options.Top), 10))
   308  	}
   309  	reqQP.Set("api-version", "2024-05-01")
   310  	req.Raw().URL.RawQuery = reqQP.Encode()
   311  	req.Raw().Header["Accept"] = []string{"application/json"}
   312  	return req, nil
   313  }
   314  
   315  // listHandleResponse handles the List response.
   316  func (client *ManagersClient) listHandleResponse(resp *http.Response) (ManagersClientListResponse, error) {
   317  	result := ManagersClientListResponse{}
   318  	if err := runtime.UnmarshalAsJSON(resp, &result.ManagerListResult); err != nil {
   319  		return ManagersClientListResponse{}, err
   320  	}
   321  	return result, nil
   322  }
   323  
   324  // NewListBySubscriptionPager - List all network managers in a subscription.
   325  //
   326  // Generated from API version 2024-05-01
   327  //   - options - ManagersClientListBySubscriptionOptions contains the optional parameters for the ManagersClient.NewListBySubscriptionPager
   328  //     method.
   329  func (client *ManagersClient) NewListBySubscriptionPager(options *ManagersClientListBySubscriptionOptions) *runtime.Pager[ManagersClientListBySubscriptionResponse] {
   330  	return runtime.NewPager(runtime.PagingHandler[ManagersClientListBySubscriptionResponse]{
   331  		More: func(page ManagersClientListBySubscriptionResponse) bool {
   332  			return page.NextLink != nil && len(*page.NextLink) > 0
   333  		},
   334  		Fetcher: func(ctx context.Context, page *ManagersClientListBySubscriptionResponse) (ManagersClientListBySubscriptionResponse, error) {
   335  			ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, "ManagersClient.NewListBySubscriptionPager")
   336  			nextLink := ""
   337  			if page != nil {
   338  				nextLink = *page.NextLink
   339  			}
   340  			resp, err := runtime.FetcherForNextLink(ctx, client.internal.Pipeline(), nextLink, func(ctx context.Context) (*policy.Request, error) {
   341  				return client.listBySubscriptionCreateRequest(ctx, options)
   342  			}, nil)
   343  			if err != nil {
   344  				return ManagersClientListBySubscriptionResponse{}, err
   345  			}
   346  			return client.listBySubscriptionHandleResponse(resp)
   347  		},
   348  		Tracer: client.internal.Tracer(),
   349  	})
   350  }
   351  
   352  // listBySubscriptionCreateRequest creates the ListBySubscription request.
   353  func (client *ManagersClient) listBySubscriptionCreateRequest(ctx context.Context, options *ManagersClientListBySubscriptionOptions) (*policy.Request, error) {
   354  	urlPath := "/subscriptions/{subscriptionId}/providers/Microsoft.Network/networkManagers"
   355  	if client.subscriptionID == "" {
   356  		return nil, errors.New("parameter client.subscriptionID cannot be empty")
   357  	}
   358  	urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID))
   359  	req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.internal.Endpoint(), urlPath))
   360  	if err != nil {
   361  		return nil, err
   362  	}
   363  	reqQP := req.Raw().URL.Query()
   364  	if options != nil && options.SkipToken != nil {
   365  		reqQP.Set("$skipToken", *options.SkipToken)
   366  	}
   367  	if options != nil && options.Top != nil {
   368  		reqQP.Set("$top", strconv.FormatInt(int64(*options.Top), 10))
   369  	}
   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  // listBySubscriptionHandleResponse handles the ListBySubscription response.
   377  func (client *ManagersClient) listBySubscriptionHandleResponse(resp *http.Response) (ManagersClientListBySubscriptionResponse, error) {
   378  	result := ManagersClientListBySubscriptionResponse{}
   379  	if err := runtime.UnmarshalAsJSON(resp, &result.ManagerListResult); err != nil {
   380  		return ManagersClientListBySubscriptionResponse{}, err
   381  	}
   382  	return result, nil
   383  }
   384  
   385  // Patch - Patch NetworkManager.
   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  //   - networkManagerName - The name of the network manager.
   391  //   - parameters - Parameters supplied to specify which network manager is.
   392  //   - options - ManagersClientPatchOptions contains the optional parameters for the ManagersClient.Patch method.
   393  func (client *ManagersClient) Patch(ctx context.Context, resourceGroupName string, networkManagerName string, parameters PatchObject, options *ManagersClientPatchOptions) (ManagersClientPatchResponse, error) {
   394  	var err error
   395  	const operationName = "ManagersClient.Patch"
   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.patchCreateRequest(ctx, resourceGroupName, networkManagerName, parameters, options)
   400  	if err != nil {
   401  		return ManagersClientPatchResponse{}, err
   402  	}
   403  	httpResp, err := client.internal.Pipeline().Do(req)
   404  	if err != nil {
   405  		return ManagersClientPatchResponse{}, err
   406  	}
   407  	if !runtime.HasStatusCode(httpResp, http.StatusOK) {
   408  		err = runtime.NewResponseError(httpResp)
   409  		return ManagersClientPatchResponse{}, err
   410  	}
   411  	resp, err := client.patchHandleResponse(httpResp)
   412  	return resp, err
   413  }
   414  
   415  // patchCreateRequest creates the Patch request.
   416  func (client *ManagersClient) patchCreateRequest(ctx context.Context, resourceGroupName string, networkManagerName string, parameters PatchObject, options *ManagersClientPatchOptions) (*policy.Request, error) {
   417  	urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/networkManagers/{networkManagerName}"
   418  	if client.subscriptionID == "" {
   419  		return nil, errors.New("parameter client.subscriptionID cannot be empty")
   420  	}
   421  	urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID))
   422  	if resourceGroupName == "" {
   423  		return nil, errors.New("parameter resourceGroupName cannot be empty")
   424  	}
   425  	urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName))
   426  	if networkManagerName == "" {
   427  		return nil, errors.New("parameter networkManagerName cannot be empty")
   428  	}
   429  	urlPath = strings.ReplaceAll(urlPath, "{networkManagerName}", url.PathEscape(networkManagerName))
   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  // patchHandleResponse handles the Patch response.
   445  func (client *ManagersClient) patchHandleResponse(resp *http.Response) (ManagersClientPatchResponse, error) {
   446  	result := ManagersClientPatchResponse{}
   447  	if err := runtime.UnmarshalAsJSON(resp, &result.Manager); err != nil {
   448  		return ManagersClientPatchResponse{}, err
   449  	}
   450  	return result, nil
   451  }