github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/network/armnetwork/v6@v6.2.0/interfaces_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 // InterfacesClient contains the methods for the NetworkInterfaces group. 24 // Don't use this type directly, use NewInterfacesClient() instead. 25 type InterfacesClient struct { 26 internal *arm.Client 27 subscriptionID string 28 } 29 30 // NewInterfacesClient creates a new instance of InterfacesClient 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 NewInterfacesClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) (*InterfacesClient, error) { 36 cl, err := arm.NewClient(moduleName, moduleVersion, credential, options) 37 if err != nil { 38 return nil, err 39 } 40 client := &InterfacesClient{ 41 subscriptionID: subscriptionID, 42 internal: cl, 43 } 44 return client, nil 45 } 46 47 // BeginCreateOrUpdate - Creates or updates a network interface. 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 // - networkInterfaceName - The name of the network interface. 53 // - parameters - Parameters supplied to the create or update network interface operation. 54 // - options - InterfacesClientBeginCreateOrUpdateOptions contains the optional parameters for the InterfacesClient.BeginCreateOrUpdate 55 // method. 56 func (client *InterfacesClient) BeginCreateOrUpdate(ctx context.Context, resourceGroupName string, networkInterfaceName string, parameters Interface, options *InterfacesClientBeginCreateOrUpdateOptions) (*runtime.Poller[InterfacesClientCreateOrUpdateResponse], error) { 57 if options == nil || options.ResumeToken == "" { 58 resp, err := client.createOrUpdate(ctx, resourceGroupName, networkInterfaceName, parameters, options) 59 if err != nil { 60 return nil, err 61 } 62 poller, err := runtime.NewPoller(resp, client.internal.Pipeline(), &runtime.NewPollerOptions[InterfacesClientCreateOrUpdateResponse]{ 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[InterfacesClientCreateOrUpdateResponse]{ 69 Tracer: client.internal.Tracer(), 70 }) 71 } 72 } 73 74 // CreateOrUpdate - Creates or updates a network interface. 75 // If the operation fails it returns an *azcore.ResponseError type. 76 // 77 // Generated from API version 2024-05-01 78 func (client *InterfacesClient) createOrUpdate(ctx context.Context, resourceGroupName string, networkInterfaceName string, parameters Interface, options *InterfacesClientBeginCreateOrUpdateOptions) (*http.Response, error) { 79 var err error 80 const operationName = "InterfacesClient.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, networkInterfaceName, 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 *InterfacesClient) createOrUpdateCreateRequest(ctx context.Context, resourceGroupName string, networkInterfaceName string, parameters Interface, options *InterfacesClientBeginCreateOrUpdateOptions) (*policy.Request, error) { 101 urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/networkInterfaces/{networkInterfaceName}" 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 networkInterfaceName == "" { 107 return nil, errors.New("parameter networkInterfaceName cannot be empty") 108 } 109 urlPath = strings.ReplaceAll(urlPath, "{networkInterfaceName}", url.PathEscape(networkInterfaceName)) 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 network interface. 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 // - networkInterfaceName - The name of the network interface. 134 // - options - InterfacesClientBeginDeleteOptions contains the optional parameters for the InterfacesClient.BeginDelete method. 135 func (client *InterfacesClient) BeginDelete(ctx context.Context, resourceGroupName string, networkInterfaceName string, options *InterfacesClientBeginDeleteOptions) (*runtime.Poller[InterfacesClientDeleteResponse], error) { 136 if options == nil || options.ResumeToken == "" { 137 resp, err := client.deleteOperation(ctx, resourceGroupName, networkInterfaceName, options) 138 if err != nil { 139 return nil, err 140 } 141 poller, err := runtime.NewPoller(resp, client.internal.Pipeline(), &runtime.NewPollerOptions[InterfacesClientDeleteResponse]{ 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[InterfacesClientDeleteResponse]{ 148 Tracer: client.internal.Tracer(), 149 }) 150 } 151 } 152 153 // Delete - Deletes the specified network interface. 154 // If the operation fails it returns an *azcore.ResponseError type. 155 // 156 // Generated from API version 2024-05-01 157 func (client *InterfacesClient) deleteOperation(ctx context.Context, resourceGroupName string, networkInterfaceName string, options *InterfacesClientBeginDeleteOptions) (*http.Response, error) { 158 var err error 159 const operationName = "InterfacesClient.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, networkInterfaceName, 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 *InterfacesClient) deleteCreateRequest(ctx context.Context, resourceGroupName string, networkInterfaceName string, options *InterfacesClientBeginDeleteOptions) (*policy.Request, error) { 180 urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/networkInterfaces/{networkInterfaceName}" 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 networkInterfaceName == "" { 186 return nil, errors.New("parameter networkInterfaceName cannot be empty") 187 } 188 urlPath = strings.ReplaceAll(urlPath, "{networkInterfaceName}", url.PathEscape(networkInterfaceName)) 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 information about the specified network interface. 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 // - networkInterfaceName - The name of the network interface. 210 // - options - InterfacesClientGetOptions contains the optional parameters for the InterfacesClient.Get method. 211 func (client *InterfacesClient) Get(ctx context.Context, resourceGroupName string, networkInterfaceName string, options *InterfacesClientGetOptions) (InterfacesClientGetResponse, error) { 212 var err error 213 const operationName = "InterfacesClient.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, networkInterfaceName, options) 218 if err != nil { 219 return InterfacesClientGetResponse{}, err 220 } 221 httpResp, err := client.internal.Pipeline().Do(req) 222 if err != nil { 223 return InterfacesClientGetResponse{}, err 224 } 225 if !runtime.HasStatusCode(httpResp, http.StatusOK) { 226 err = runtime.NewResponseError(httpResp) 227 return InterfacesClientGetResponse{}, err 228 } 229 resp, err := client.getHandleResponse(httpResp) 230 return resp, err 231 } 232 233 // getCreateRequest creates the Get request. 234 func (client *InterfacesClient) getCreateRequest(ctx context.Context, resourceGroupName string, networkInterfaceName string, options *InterfacesClientGetOptions) (*policy.Request, error) { 235 urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/networkInterfaces/{networkInterfaceName}" 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 networkInterfaceName == "" { 241 return nil, errors.New("parameter networkInterfaceName cannot be empty") 242 } 243 urlPath = strings.ReplaceAll(urlPath, "{networkInterfaceName}", url.PathEscape(networkInterfaceName)) 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 *InterfacesClient) getHandleResponse(resp *http.Response) (InterfacesClientGetResponse, error) { 264 result := InterfacesClientGetResponse{} 265 if err := runtime.UnmarshalAsJSON(resp, &result.Interface); err != nil { 266 return InterfacesClientGetResponse{}, err 267 } 268 return result, nil 269 } 270 271 // GetCloudServiceNetworkInterface - Get the specified network interface in a cloud service. 272 // If the operation fails it returns an *azcore.ResponseError type. 273 // 274 // Generated from API version 2024-05-01 275 // - resourceGroupName - The name of the resource group. 276 // - cloudServiceName - The name of the cloud service. 277 // - roleInstanceName - The name of role instance. 278 // - networkInterfaceName - The name of the network interface. 279 // - options - InterfacesClientGetCloudServiceNetworkInterfaceOptions contains the optional parameters for the InterfacesClient.GetCloudServiceNetworkInterface 280 // method. 281 func (client *InterfacesClient) GetCloudServiceNetworkInterface(ctx context.Context, resourceGroupName string, cloudServiceName string, roleInstanceName string, networkInterfaceName string, options *InterfacesClientGetCloudServiceNetworkInterfaceOptions) (InterfacesClientGetCloudServiceNetworkInterfaceResponse, error) { 282 var err error 283 const operationName = "InterfacesClient.GetCloudServiceNetworkInterface" 284 ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) 285 ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) 286 defer func() { endSpan(err) }() 287 req, err := client.getCloudServiceNetworkInterfaceCreateRequest(ctx, resourceGroupName, cloudServiceName, roleInstanceName, networkInterfaceName, options) 288 if err != nil { 289 return InterfacesClientGetCloudServiceNetworkInterfaceResponse{}, err 290 } 291 httpResp, err := client.internal.Pipeline().Do(req) 292 if err != nil { 293 return InterfacesClientGetCloudServiceNetworkInterfaceResponse{}, err 294 } 295 if !runtime.HasStatusCode(httpResp, http.StatusOK) { 296 err = runtime.NewResponseError(httpResp) 297 return InterfacesClientGetCloudServiceNetworkInterfaceResponse{}, err 298 } 299 resp, err := client.getCloudServiceNetworkInterfaceHandleResponse(httpResp) 300 return resp, err 301 } 302 303 // getCloudServiceNetworkInterfaceCreateRequest creates the GetCloudServiceNetworkInterface request. 304 func (client *InterfacesClient) getCloudServiceNetworkInterfaceCreateRequest(ctx context.Context, resourceGroupName string, cloudServiceName string, roleInstanceName string, networkInterfaceName string, options *InterfacesClientGetCloudServiceNetworkInterfaceOptions) (*policy.Request, error) { 305 urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/cloudServices/{cloudServiceName}/roleInstances/{roleInstanceName}/networkInterfaces/{networkInterfaceName}" 306 if resourceGroupName == "" { 307 return nil, errors.New("parameter resourceGroupName cannot be empty") 308 } 309 urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) 310 if cloudServiceName == "" { 311 return nil, errors.New("parameter cloudServiceName cannot be empty") 312 } 313 urlPath = strings.ReplaceAll(urlPath, "{cloudServiceName}", url.PathEscape(cloudServiceName)) 314 if roleInstanceName == "" { 315 return nil, errors.New("parameter roleInstanceName cannot be empty") 316 } 317 urlPath = strings.ReplaceAll(urlPath, "{roleInstanceName}", url.PathEscape(roleInstanceName)) 318 if networkInterfaceName == "" { 319 return nil, errors.New("parameter networkInterfaceName cannot be empty") 320 } 321 urlPath = strings.ReplaceAll(urlPath, "{networkInterfaceName}", url.PathEscape(networkInterfaceName)) 322 if client.subscriptionID == "" { 323 return nil, errors.New("parameter client.subscriptionID cannot be empty") 324 } 325 urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) 326 req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) 327 if err != nil { 328 return nil, err 329 } 330 reqQP := req.Raw().URL.Query() 331 if options != nil && options.Expand != nil { 332 reqQP.Set("$expand", *options.Expand) 333 } 334 reqQP.Set("api-version", "2024-05-01") 335 req.Raw().URL.RawQuery = reqQP.Encode() 336 req.Raw().Header["Accept"] = []string{"application/json"} 337 return req, nil 338 } 339 340 // getCloudServiceNetworkInterfaceHandleResponse handles the GetCloudServiceNetworkInterface response. 341 func (client *InterfacesClient) getCloudServiceNetworkInterfaceHandleResponse(resp *http.Response) (InterfacesClientGetCloudServiceNetworkInterfaceResponse, error) { 342 result := InterfacesClientGetCloudServiceNetworkInterfaceResponse{} 343 if err := runtime.UnmarshalAsJSON(resp, &result.Interface); err != nil { 344 return InterfacesClientGetCloudServiceNetworkInterfaceResponse{}, err 345 } 346 return result, nil 347 } 348 349 // BeginGetEffectiveRouteTable - Gets all route tables applied to a network interface. 350 // If the operation fails it returns an *azcore.ResponseError type. 351 // 352 // Generated from API version 2024-05-01 353 // - resourceGroupName - The name of the resource group. 354 // - networkInterfaceName - The name of the network interface. 355 // - options - InterfacesClientBeginGetEffectiveRouteTableOptions contains the optional parameters for the InterfacesClient.BeginGetEffectiveRouteTable 356 // method. 357 func (client *InterfacesClient) BeginGetEffectiveRouteTable(ctx context.Context, resourceGroupName string, networkInterfaceName string, options *InterfacesClientBeginGetEffectiveRouteTableOptions) (*runtime.Poller[InterfacesClientGetEffectiveRouteTableResponse], error) { 358 if options == nil || options.ResumeToken == "" { 359 resp, err := client.getEffectiveRouteTable(ctx, resourceGroupName, networkInterfaceName, options) 360 if err != nil { 361 return nil, err 362 } 363 poller, err := runtime.NewPoller(resp, client.internal.Pipeline(), &runtime.NewPollerOptions[InterfacesClientGetEffectiveRouteTableResponse]{ 364 FinalStateVia: runtime.FinalStateViaLocation, 365 Tracer: client.internal.Tracer(), 366 }) 367 return poller, err 368 } else { 369 return runtime.NewPollerFromResumeToken(options.ResumeToken, client.internal.Pipeline(), &runtime.NewPollerFromResumeTokenOptions[InterfacesClientGetEffectiveRouteTableResponse]{ 370 Tracer: client.internal.Tracer(), 371 }) 372 } 373 } 374 375 // GetEffectiveRouteTable - Gets all route tables applied to a network interface. 376 // If the operation fails it returns an *azcore.ResponseError type. 377 // 378 // Generated from API version 2024-05-01 379 func (client *InterfacesClient) getEffectiveRouteTable(ctx context.Context, resourceGroupName string, networkInterfaceName string, options *InterfacesClientBeginGetEffectiveRouteTableOptions) (*http.Response, error) { 380 var err error 381 const operationName = "InterfacesClient.BeginGetEffectiveRouteTable" 382 ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) 383 ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) 384 defer func() { endSpan(err) }() 385 req, err := client.getEffectiveRouteTableCreateRequest(ctx, resourceGroupName, networkInterfaceName, options) 386 if err != nil { 387 return nil, err 388 } 389 httpResp, err := client.internal.Pipeline().Do(req) 390 if err != nil { 391 return nil, err 392 } 393 if !runtime.HasStatusCode(httpResp, http.StatusOK, http.StatusAccepted) { 394 err = runtime.NewResponseError(httpResp) 395 return nil, err 396 } 397 return httpResp, nil 398 } 399 400 // getEffectiveRouteTableCreateRequest creates the GetEffectiveRouteTable request. 401 func (client *InterfacesClient) getEffectiveRouteTableCreateRequest(ctx context.Context, resourceGroupName string, networkInterfaceName string, options *InterfacesClientBeginGetEffectiveRouteTableOptions) (*policy.Request, error) { 402 urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/networkInterfaces/{networkInterfaceName}/effectiveRouteTable" 403 if resourceGroupName == "" { 404 return nil, errors.New("parameter resourceGroupName cannot be empty") 405 } 406 urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) 407 if networkInterfaceName == "" { 408 return nil, errors.New("parameter networkInterfaceName cannot be empty") 409 } 410 urlPath = strings.ReplaceAll(urlPath, "{networkInterfaceName}", url.PathEscape(networkInterfaceName)) 411 if client.subscriptionID == "" { 412 return nil, errors.New("parameter client.subscriptionID cannot be empty") 413 } 414 urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) 415 req, err := runtime.NewRequest(ctx, http.MethodPost, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) 416 if err != nil { 417 return nil, err 418 } 419 reqQP := req.Raw().URL.Query() 420 reqQP.Set("api-version", "2024-05-01") 421 req.Raw().URL.RawQuery = reqQP.Encode() 422 req.Raw().Header["Accept"] = []string{"application/json"} 423 return req, nil 424 } 425 426 // GetVirtualMachineScaleSetIPConfiguration - Get the specified network interface ip configuration in a virtual machine scale 427 // set. 428 // If the operation fails it returns an *azcore.ResponseError type. 429 // 430 // Generated from API version 2018-10-01 431 // - resourceGroupName - The name of the resource group. 432 // - virtualMachineScaleSetName - The name of the virtual machine scale set. 433 // - virtualmachineIndex - The virtual machine index. 434 // - networkInterfaceName - The name of the network interface. 435 // - ipConfigurationName - The name of the ip configuration. 436 // - options - InterfacesClientGetVirtualMachineScaleSetIPConfigurationOptions contains the optional parameters for the InterfacesClient.GetVirtualMachineScaleSetIPConfiguration 437 // method. 438 func (client *InterfacesClient) GetVirtualMachineScaleSetIPConfiguration(ctx context.Context, resourceGroupName string, virtualMachineScaleSetName string, virtualmachineIndex string, networkInterfaceName string, ipConfigurationName string, options *InterfacesClientGetVirtualMachineScaleSetIPConfigurationOptions) (InterfacesClientGetVirtualMachineScaleSetIPConfigurationResponse, error) { 439 var err error 440 const operationName = "InterfacesClient.GetVirtualMachineScaleSetIPConfiguration" 441 ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) 442 ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) 443 defer func() { endSpan(err) }() 444 req, err := client.getVirtualMachineScaleSetIPConfigurationCreateRequest(ctx, resourceGroupName, virtualMachineScaleSetName, virtualmachineIndex, networkInterfaceName, ipConfigurationName, options) 445 if err != nil { 446 return InterfacesClientGetVirtualMachineScaleSetIPConfigurationResponse{}, err 447 } 448 httpResp, err := client.internal.Pipeline().Do(req) 449 if err != nil { 450 return InterfacesClientGetVirtualMachineScaleSetIPConfigurationResponse{}, err 451 } 452 if !runtime.HasStatusCode(httpResp, http.StatusOK) { 453 err = runtime.NewResponseError(httpResp) 454 return InterfacesClientGetVirtualMachineScaleSetIPConfigurationResponse{}, err 455 } 456 resp, err := client.getVirtualMachineScaleSetIPConfigurationHandleResponse(httpResp) 457 return resp, err 458 } 459 460 // getVirtualMachineScaleSetIPConfigurationCreateRequest creates the GetVirtualMachineScaleSetIPConfiguration request. 461 func (client *InterfacesClient) getVirtualMachineScaleSetIPConfigurationCreateRequest(ctx context.Context, resourceGroupName string, virtualMachineScaleSetName string, virtualmachineIndex string, networkInterfaceName string, ipConfigurationName string, options *InterfacesClientGetVirtualMachineScaleSetIPConfigurationOptions) (*policy.Request, error) { 462 urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/microsoft.Compute/virtualMachineScaleSets/{virtualMachineScaleSetName}/virtualMachines/{virtualmachineIndex}/networkInterfaces/{networkInterfaceName}/ipConfigurations/{ipConfigurationName}" 463 if resourceGroupName == "" { 464 return nil, errors.New("parameter resourceGroupName cannot be empty") 465 } 466 urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) 467 if virtualMachineScaleSetName == "" { 468 return nil, errors.New("parameter virtualMachineScaleSetName cannot be empty") 469 } 470 urlPath = strings.ReplaceAll(urlPath, "{virtualMachineScaleSetName}", url.PathEscape(virtualMachineScaleSetName)) 471 if virtualmachineIndex == "" { 472 return nil, errors.New("parameter virtualmachineIndex cannot be empty") 473 } 474 urlPath = strings.ReplaceAll(urlPath, "{virtualmachineIndex}", url.PathEscape(virtualmachineIndex)) 475 if networkInterfaceName == "" { 476 return nil, errors.New("parameter networkInterfaceName cannot be empty") 477 } 478 urlPath = strings.ReplaceAll(urlPath, "{networkInterfaceName}", url.PathEscape(networkInterfaceName)) 479 if ipConfigurationName == "" { 480 return nil, errors.New("parameter ipConfigurationName cannot be empty") 481 } 482 urlPath = strings.ReplaceAll(urlPath, "{ipConfigurationName}", url.PathEscape(ipConfigurationName)) 483 if client.subscriptionID == "" { 484 return nil, errors.New("parameter client.subscriptionID cannot be empty") 485 } 486 urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) 487 req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) 488 if err != nil { 489 return nil, err 490 } 491 reqQP := req.Raw().URL.Query() 492 if options != nil && options.Expand != nil { 493 reqQP.Set("$expand", *options.Expand) 494 } 495 reqQP.Set("api-version", "2018-10-01") 496 req.Raw().URL.RawQuery = reqQP.Encode() 497 req.Raw().Header["Accept"] = []string{"application/json"} 498 return req, nil 499 } 500 501 // getVirtualMachineScaleSetIPConfigurationHandleResponse handles the GetVirtualMachineScaleSetIPConfiguration response. 502 func (client *InterfacesClient) getVirtualMachineScaleSetIPConfigurationHandleResponse(resp *http.Response) (InterfacesClientGetVirtualMachineScaleSetIPConfigurationResponse, error) { 503 result := InterfacesClientGetVirtualMachineScaleSetIPConfigurationResponse{} 504 if err := runtime.UnmarshalAsJSON(resp, &result.InterfaceIPConfiguration); err != nil { 505 return InterfacesClientGetVirtualMachineScaleSetIPConfigurationResponse{}, err 506 } 507 return result, nil 508 } 509 510 // GetVirtualMachineScaleSetNetworkInterface - Get the specified network interface in a virtual machine scale set. 511 // If the operation fails it returns an *azcore.ResponseError type. 512 // 513 // Generated from API version 2018-10-01 514 // - resourceGroupName - The name of the resource group. 515 // - virtualMachineScaleSetName - The name of the virtual machine scale set. 516 // - virtualmachineIndex - The virtual machine index. 517 // - networkInterfaceName - The name of the network interface. 518 // - options - InterfacesClientGetVirtualMachineScaleSetNetworkInterfaceOptions contains the optional parameters for the InterfacesClient.GetVirtualMachineScaleSetNetworkInterface 519 // method. 520 func (client *InterfacesClient) GetVirtualMachineScaleSetNetworkInterface(ctx context.Context, resourceGroupName string, virtualMachineScaleSetName string, virtualmachineIndex string, networkInterfaceName string, options *InterfacesClientGetVirtualMachineScaleSetNetworkInterfaceOptions) (InterfacesClientGetVirtualMachineScaleSetNetworkInterfaceResponse, error) { 521 var err error 522 const operationName = "InterfacesClient.GetVirtualMachineScaleSetNetworkInterface" 523 ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) 524 ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) 525 defer func() { endSpan(err) }() 526 req, err := client.getVirtualMachineScaleSetNetworkInterfaceCreateRequest(ctx, resourceGroupName, virtualMachineScaleSetName, virtualmachineIndex, networkInterfaceName, options) 527 if err != nil { 528 return InterfacesClientGetVirtualMachineScaleSetNetworkInterfaceResponse{}, err 529 } 530 httpResp, err := client.internal.Pipeline().Do(req) 531 if err != nil { 532 return InterfacesClientGetVirtualMachineScaleSetNetworkInterfaceResponse{}, err 533 } 534 if !runtime.HasStatusCode(httpResp, http.StatusOK) { 535 err = runtime.NewResponseError(httpResp) 536 return InterfacesClientGetVirtualMachineScaleSetNetworkInterfaceResponse{}, err 537 } 538 resp, err := client.getVirtualMachineScaleSetNetworkInterfaceHandleResponse(httpResp) 539 return resp, err 540 } 541 542 // getVirtualMachineScaleSetNetworkInterfaceCreateRequest creates the GetVirtualMachineScaleSetNetworkInterface request. 543 func (client *InterfacesClient) getVirtualMachineScaleSetNetworkInterfaceCreateRequest(ctx context.Context, resourceGroupName string, virtualMachineScaleSetName string, virtualmachineIndex string, networkInterfaceName string, options *InterfacesClientGetVirtualMachineScaleSetNetworkInterfaceOptions) (*policy.Request, error) { 544 urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/microsoft.Compute/virtualMachineScaleSets/{virtualMachineScaleSetName}/virtualMachines/{virtualmachineIndex}/networkInterfaces/{networkInterfaceName}" 545 if resourceGroupName == "" { 546 return nil, errors.New("parameter resourceGroupName cannot be empty") 547 } 548 urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) 549 if virtualMachineScaleSetName == "" { 550 return nil, errors.New("parameter virtualMachineScaleSetName cannot be empty") 551 } 552 urlPath = strings.ReplaceAll(urlPath, "{virtualMachineScaleSetName}", url.PathEscape(virtualMachineScaleSetName)) 553 if virtualmachineIndex == "" { 554 return nil, errors.New("parameter virtualmachineIndex cannot be empty") 555 } 556 urlPath = strings.ReplaceAll(urlPath, "{virtualmachineIndex}", url.PathEscape(virtualmachineIndex)) 557 if networkInterfaceName == "" { 558 return nil, errors.New("parameter networkInterfaceName cannot be empty") 559 } 560 urlPath = strings.ReplaceAll(urlPath, "{networkInterfaceName}", url.PathEscape(networkInterfaceName)) 561 if client.subscriptionID == "" { 562 return nil, errors.New("parameter client.subscriptionID cannot be empty") 563 } 564 urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) 565 req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) 566 if err != nil { 567 return nil, err 568 } 569 reqQP := req.Raw().URL.Query() 570 if options != nil && options.Expand != nil { 571 reqQP.Set("$expand", *options.Expand) 572 } 573 reqQP.Set("api-version", "2018-10-01") 574 req.Raw().URL.RawQuery = reqQP.Encode() 575 req.Raw().Header["Accept"] = []string{"application/json"} 576 return req, nil 577 } 578 579 // getVirtualMachineScaleSetNetworkInterfaceHandleResponse handles the GetVirtualMachineScaleSetNetworkInterface response. 580 func (client *InterfacesClient) getVirtualMachineScaleSetNetworkInterfaceHandleResponse(resp *http.Response) (InterfacesClientGetVirtualMachineScaleSetNetworkInterfaceResponse, error) { 581 result := InterfacesClientGetVirtualMachineScaleSetNetworkInterfaceResponse{} 582 if err := runtime.UnmarshalAsJSON(resp, &result.Interface); err != nil { 583 return InterfacesClientGetVirtualMachineScaleSetNetworkInterfaceResponse{}, err 584 } 585 return result, nil 586 } 587 588 // NewListPager - Gets all network interfaces in a resource group. 589 // 590 // Generated from API version 2024-05-01 591 // - resourceGroupName - The name of the resource group. 592 // - options - InterfacesClientListOptions contains the optional parameters for the InterfacesClient.NewListPager method. 593 func (client *InterfacesClient) NewListPager(resourceGroupName string, options *InterfacesClientListOptions) *runtime.Pager[InterfacesClientListResponse] { 594 return runtime.NewPager(runtime.PagingHandler[InterfacesClientListResponse]{ 595 More: func(page InterfacesClientListResponse) bool { 596 return page.NextLink != nil && len(*page.NextLink) > 0 597 }, 598 Fetcher: func(ctx context.Context, page *InterfacesClientListResponse) (InterfacesClientListResponse, error) { 599 ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, "InterfacesClient.NewListPager") 600 nextLink := "" 601 if page != nil { 602 nextLink = *page.NextLink 603 } 604 resp, err := runtime.FetcherForNextLink(ctx, client.internal.Pipeline(), nextLink, func(ctx context.Context) (*policy.Request, error) { 605 return client.listCreateRequest(ctx, resourceGroupName, options) 606 }, nil) 607 if err != nil { 608 return InterfacesClientListResponse{}, err 609 } 610 return client.listHandleResponse(resp) 611 }, 612 Tracer: client.internal.Tracer(), 613 }) 614 } 615 616 // listCreateRequest creates the List request. 617 func (client *InterfacesClient) listCreateRequest(ctx context.Context, resourceGroupName string, options *InterfacesClientListOptions) (*policy.Request, error) { 618 urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/networkInterfaces" 619 if resourceGroupName == "" { 620 return nil, errors.New("parameter resourceGroupName cannot be empty") 621 } 622 urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) 623 if client.subscriptionID == "" { 624 return nil, errors.New("parameter client.subscriptionID cannot be empty") 625 } 626 urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) 627 req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) 628 if err != nil { 629 return nil, err 630 } 631 reqQP := req.Raw().URL.Query() 632 reqQP.Set("api-version", "2024-05-01") 633 req.Raw().URL.RawQuery = reqQP.Encode() 634 req.Raw().Header["Accept"] = []string{"application/json"} 635 return req, nil 636 } 637 638 // listHandleResponse handles the List response. 639 func (client *InterfacesClient) listHandleResponse(resp *http.Response) (InterfacesClientListResponse, error) { 640 result := InterfacesClientListResponse{} 641 if err := runtime.UnmarshalAsJSON(resp, &result.InterfaceListResult); err != nil { 642 return InterfacesClientListResponse{}, err 643 } 644 return result, nil 645 } 646 647 // NewListAllPager - Gets all network interfaces in a subscription. 648 // 649 // Generated from API version 2024-05-01 650 // - options - InterfacesClientListAllOptions contains the optional parameters for the InterfacesClient.NewListAllPager method. 651 func (client *InterfacesClient) NewListAllPager(options *InterfacesClientListAllOptions) *runtime.Pager[InterfacesClientListAllResponse] { 652 return runtime.NewPager(runtime.PagingHandler[InterfacesClientListAllResponse]{ 653 More: func(page InterfacesClientListAllResponse) bool { 654 return page.NextLink != nil && len(*page.NextLink) > 0 655 }, 656 Fetcher: func(ctx context.Context, page *InterfacesClientListAllResponse) (InterfacesClientListAllResponse, error) { 657 ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, "InterfacesClient.NewListAllPager") 658 nextLink := "" 659 if page != nil { 660 nextLink = *page.NextLink 661 } 662 resp, err := runtime.FetcherForNextLink(ctx, client.internal.Pipeline(), nextLink, func(ctx context.Context) (*policy.Request, error) { 663 return client.listAllCreateRequest(ctx, options) 664 }, nil) 665 if err != nil { 666 return InterfacesClientListAllResponse{}, err 667 } 668 return client.listAllHandleResponse(resp) 669 }, 670 Tracer: client.internal.Tracer(), 671 }) 672 } 673 674 // listAllCreateRequest creates the ListAll request. 675 func (client *InterfacesClient) listAllCreateRequest(ctx context.Context, options *InterfacesClientListAllOptions) (*policy.Request, error) { 676 urlPath := "/subscriptions/{subscriptionId}/providers/Microsoft.Network/networkInterfaces" 677 if client.subscriptionID == "" { 678 return nil, errors.New("parameter client.subscriptionID cannot be empty") 679 } 680 urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) 681 req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) 682 if err != nil { 683 return nil, err 684 } 685 reqQP := req.Raw().URL.Query() 686 reqQP.Set("api-version", "2024-05-01") 687 req.Raw().URL.RawQuery = reqQP.Encode() 688 req.Raw().Header["Accept"] = []string{"application/json"} 689 return req, nil 690 } 691 692 // listAllHandleResponse handles the ListAll response. 693 func (client *InterfacesClient) listAllHandleResponse(resp *http.Response) (InterfacesClientListAllResponse, error) { 694 result := InterfacesClientListAllResponse{} 695 if err := runtime.UnmarshalAsJSON(resp, &result.InterfaceListResult); err != nil { 696 return InterfacesClientListAllResponse{}, err 697 } 698 return result, nil 699 } 700 701 // NewListCloudServiceNetworkInterfacesPager - Gets all network interfaces in a cloud service. 702 // 703 // Generated from API version 2024-05-01 704 // - resourceGroupName - The name of the resource group. 705 // - cloudServiceName - The name of the cloud service. 706 // - options - InterfacesClientListCloudServiceNetworkInterfacesOptions contains the optional parameters for the InterfacesClient.NewListCloudServiceNetworkInterfacesPager 707 // method. 708 func (client *InterfacesClient) NewListCloudServiceNetworkInterfacesPager(resourceGroupName string, cloudServiceName string, options *InterfacesClientListCloudServiceNetworkInterfacesOptions) *runtime.Pager[InterfacesClientListCloudServiceNetworkInterfacesResponse] { 709 return runtime.NewPager(runtime.PagingHandler[InterfacesClientListCloudServiceNetworkInterfacesResponse]{ 710 More: func(page InterfacesClientListCloudServiceNetworkInterfacesResponse) bool { 711 return page.NextLink != nil && len(*page.NextLink) > 0 712 }, 713 Fetcher: func(ctx context.Context, page *InterfacesClientListCloudServiceNetworkInterfacesResponse) (InterfacesClientListCloudServiceNetworkInterfacesResponse, error) { 714 ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, "InterfacesClient.NewListCloudServiceNetworkInterfacesPager") 715 nextLink := "" 716 if page != nil { 717 nextLink = *page.NextLink 718 } 719 resp, err := runtime.FetcherForNextLink(ctx, client.internal.Pipeline(), nextLink, func(ctx context.Context) (*policy.Request, error) { 720 return client.listCloudServiceNetworkInterfacesCreateRequest(ctx, resourceGroupName, cloudServiceName, options) 721 }, nil) 722 if err != nil { 723 return InterfacesClientListCloudServiceNetworkInterfacesResponse{}, err 724 } 725 return client.listCloudServiceNetworkInterfacesHandleResponse(resp) 726 }, 727 Tracer: client.internal.Tracer(), 728 }) 729 } 730 731 // listCloudServiceNetworkInterfacesCreateRequest creates the ListCloudServiceNetworkInterfaces request. 732 func (client *InterfacesClient) listCloudServiceNetworkInterfacesCreateRequest(ctx context.Context, resourceGroupName string, cloudServiceName string, options *InterfacesClientListCloudServiceNetworkInterfacesOptions) (*policy.Request, error) { 733 urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/cloudServices/{cloudServiceName}/networkInterfaces" 734 if resourceGroupName == "" { 735 return nil, errors.New("parameter resourceGroupName cannot be empty") 736 } 737 urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) 738 if cloudServiceName == "" { 739 return nil, errors.New("parameter cloudServiceName cannot be empty") 740 } 741 urlPath = strings.ReplaceAll(urlPath, "{cloudServiceName}", url.PathEscape(cloudServiceName)) 742 if client.subscriptionID == "" { 743 return nil, errors.New("parameter client.subscriptionID cannot be empty") 744 } 745 urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) 746 req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) 747 if err != nil { 748 return nil, err 749 } 750 reqQP := req.Raw().URL.Query() 751 reqQP.Set("api-version", "2024-05-01") 752 req.Raw().URL.RawQuery = reqQP.Encode() 753 req.Raw().Header["Accept"] = []string{"application/json"} 754 return req, nil 755 } 756 757 // listCloudServiceNetworkInterfacesHandleResponse handles the ListCloudServiceNetworkInterfaces response. 758 func (client *InterfacesClient) listCloudServiceNetworkInterfacesHandleResponse(resp *http.Response) (InterfacesClientListCloudServiceNetworkInterfacesResponse, error) { 759 result := InterfacesClientListCloudServiceNetworkInterfacesResponse{} 760 if err := runtime.UnmarshalAsJSON(resp, &result.InterfaceListResult); err != nil { 761 return InterfacesClientListCloudServiceNetworkInterfacesResponse{}, err 762 } 763 return result, nil 764 } 765 766 // NewListCloudServiceRoleInstanceNetworkInterfacesPager - Gets information about all network interfaces in a role instance 767 // in a cloud service. 768 // 769 // Generated from API version 2024-05-01 770 // - resourceGroupName - The name of the resource group. 771 // - cloudServiceName - The name of the cloud service. 772 // - roleInstanceName - The name of role instance. 773 // - options - InterfacesClientListCloudServiceRoleInstanceNetworkInterfacesOptions contains the optional parameters for the 774 // InterfacesClient.NewListCloudServiceRoleInstanceNetworkInterfacesPager method. 775 func (client *InterfacesClient) NewListCloudServiceRoleInstanceNetworkInterfacesPager(resourceGroupName string, cloudServiceName string, roleInstanceName string, options *InterfacesClientListCloudServiceRoleInstanceNetworkInterfacesOptions) *runtime.Pager[InterfacesClientListCloudServiceRoleInstanceNetworkInterfacesResponse] { 776 return runtime.NewPager(runtime.PagingHandler[InterfacesClientListCloudServiceRoleInstanceNetworkInterfacesResponse]{ 777 More: func(page InterfacesClientListCloudServiceRoleInstanceNetworkInterfacesResponse) bool { 778 return page.NextLink != nil && len(*page.NextLink) > 0 779 }, 780 Fetcher: func(ctx context.Context, page *InterfacesClientListCloudServiceRoleInstanceNetworkInterfacesResponse) (InterfacesClientListCloudServiceRoleInstanceNetworkInterfacesResponse, error) { 781 ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, "InterfacesClient.NewListCloudServiceRoleInstanceNetworkInterfacesPager") 782 nextLink := "" 783 if page != nil { 784 nextLink = *page.NextLink 785 } 786 resp, err := runtime.FetcherForNextLink(ctx, client.internal.Pipeline(), nextLink, func(ctx context.Context) (*policy.Request, error) { 787 return client.listCloudServiceRoleInstanceNetworkInterfacesCreateRequest(ctx, resourceGroupName, cloudServiceName, roleInstanceName, options) 788 }, nil) 789 if err != nil { 790 return InterfacesClientListCloudServiceRoleInstanceNetworkInterfacesResponse{}, err 791 } 792 return client.listCloudServiceRoleInstanceNetworkInterfacesHandleResponse(resp) 793 }, 794 Tracer: client.internal.Tracer(), 795 }) 796 } 797 798 // listCloudServiceRoleInstanceNetworkInterfacesCreateRequest creates the ListCloudServiceRoleInstanceNetworkInterfaces request. 799 func (client *InterfacesClient) listCloudServiceRoleInstanceNetworkInterfacesCreateRequest(ctx context.Context, resourceGroupName string, cloudServiceName string, roleInstanceName string, options *InterfacesClientListCloudServiceRoleInstanceNetworkInterfacesOptions) (*policy.Request, error) { 800 urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/cloudServices/{cloudServiceName}/roleInstances/{roleInstanceName}/networkInterfaces" 801 if resourceGroupName == "" { 802 return nil, errors.New("parameter resourceGroupName cannot be empty") 803 } 804 urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) 805 if cloudServiceName == "" { 806 return nil, errors.New("parameter cloudServiceName cannot be empty") 807 } 808 urlPath = strings.ReplaceAll(urlPath, "{cloudServiceName}", url.PathEscape(cloudServiceName)) 809 if roleInstanceName == "" { 810 return nil, errors.New("parameter roleInstanceName cannot be empty") 811 } 812 urlPath = strings.ReplaceAll(urlPath, "{roleInstanceName}", url.PathEscape(roleInstanceName)) 813 if client.subscriptionID == "" { 814 return nil, errors.New("parameter client.subscriptionID cannot be empty") 815 } 816 urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) 817 req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) 818 if err != nil { 819 return nil, err 820 } 821 reqQP := req.Raw().URL.Query() 822 reqQP.Set("api-version", "2024-05-01") 823 req.Raw().URL.RawQuery = reqQP.Encode() 824 req.Raw().Header["Accept"] = []string{"application/json"} 825 return req, nil 826 } 827 828 // listCloudServiceRoleInstanceNetworkInterfacesHandleResponse handles the ListCloudServiceRoleInstanceNetworkInterfaces response. 829 func (client *InterfacesClient) listCloudServiceRoleInstanceNetworkInterfacesHandleResponse(resp *http.Response) (InterfacesClientListCloudServiceRoleInstanceNetworkInterfacesResponse, error) { 830 result := InterfacesClientListCloudServiceRoleInstanceNetworkInterfacesResponse{} 831 if err := runtime.UnmarshalAsJSON(resp, &result.InterfaceListResult); err != nil { 832 return InterfacesClientListCloudServiceRoleInstanceNetworkInterfacesResponse{}, err 833 } 834 return result, nil 835 } 836 837 // BeginListEffectiveNetworkSecurityGroups - Gets all network security groups applied to a network interface. 838 // If the operation fails it returns an *azcore.ResponseError type. 839 // 840 // Generated from API version 2024-05-01 841 // - resourceGroupName - The name of the resource group. 842 // - networkInterfaceName - The name of the network interface. 843 // - options - InterfacesClientBeginListEffectiveNetworkSecurityGroupsOptions contains the optional parameters for the InterfacesClient.BeginListEffectiveNetworkSecurityGroups 844 // method. 845 func (client *InterfacesClient) BeginListEffectiveNetworkSecurityGroups(ctx context.Context, resourceGroupName string, networkInterfaceName string, options *InterfacesClientBeginListEffectiveNetworkSecurityGroupsOptions) (*runtime.Poller[InterfacesClientListEffectiveNetworkSecurityGroupsResponse], error) { 846 if options == nil || options.ResumeToken == "" { 847 resp, err := client.listEffectiveNetworkSecurityGroups(ctx, resourceGroupName, networkInterfaceName, options) 848 if err != nil { 849 return nil, err 850 } 851 poller, err := runtime.NewPoller(resp, client.internal.Pipeline(), &runtime.NewPollerOptions[InterfacesClientListEffectiveNetworkSecurityGroupsResponse]{ 852 FinalStateVia: runtime.FinalStateViaLocation, 853 Tracer: client.internal.Tracer(), 854 }) 855 return poller, err 856 } else { 857 return runtime.NewPollerFromResumeToken(options.ResumeToken, client.internal.Pipeline(), &runtime.NewPollerFromResumeTokenOptions[InterfacesClientListEffectiveNetworkSecurityGroupsResponse]{ 858 Tracer: client.internal.Tracer(), 859 }) 860 } 861 } 862 863 // ListEffectiveNetworkSecurityGroups - Gets all network security groups applied to a network interface. 864 // If the operation fails it returns an *azcore.ResponseError type. 865 // 866 // Generated from API version 2024-05-01 867 func (client *InterfacesClient) listEffectiveNetworkSecurityGroups(ctx context.Context, resourceGroupName string, networkInterfaceName string, options *InterfacesClientBeginListEffectiveNetworkSecurityGroupsOptions) (*http.Response, error) { 868 var err error 869 const operationName = "InterfacesClient.BeginListEffectiveNetworkSecurityGroups" 870 ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) 871 ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) 872 defer func() { endSpan(err) }() 873 req, err := client.listEffectiveNetworkSecurityGroupsCreateRequest(ctx, resourceGroupName, networkInterfaceName, options) 874 if err != nil { 875 return nil, err 876 } 877 httpResp, err := client.internal.Pipeline().Do(req) 878 if err != nil { 879 return nil, err 880 } 881 if !runtime.HasStatusCode(httpResp, http.StatusOK, http.StatusAccepted) { 882 err = runtime.NewResponseError(httpResp) 883 return nil, err 884 } 885 return httpResp, nil 886 } 887 888 // listEffectiveNetworkSecurityGroupsCreateRequest creates the ListEffectiveNetworkSecurityGroups request. 889 func (client *InterfacesClient) listEffectiveNetworkSecurityGroupsCreateRequest(ctx context.Context, resourceGroupName string, networkInterfaceName string, options *InterfacesClientBeginListEffectiveNetworkSecurityGroupsOptions) (*policy.Request, error) { 890 urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/networkInterfaces/{networkInterfaceName}/effectiveNetworkSecurityGroups" 891 if resourceGroupName == "" { 892 return nil, errors.New("parameter resourceGroupName cannot be empty") 893 } 894 urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) 895 if networkInterfaceName == "" { 896 return nil, errors.New("parameter networkInterfaceName cannot be empty") 897 } 898 urlPath = strings.ReplaceAll(urlPath, "{networkInterfaceName}", url.PathEscape(networkInterfaceName)) 899 if client.subscriptionID == "" { 900 return nil, errors.New("parameter client.subscriptionID cannot be empty") 901 } 902 urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) 903 req, err := runtime.NewRequest(ctx, http.MethodPost, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) 904 if err != nil { 905 return nil, err 906 } 907 reqQP := req.Raw().URL.Query() 908 reqQP.Set("api-version", "2024-05-01") 909 req.Raw().URL.RawQuery = reqQP.Encode() 910 req.Raw().Header["Accept"] = []string{"application/json"} 911 return req, nil 912 } 913 914 // NewListVirtualMachineScaleSetIPConfigurationsPager - Get the specified network interface ip configuration in a virtual 915 // machine scale set. 916 // 917 // Generated from API version 2018-10-01 918 // - resourceGroupName - The name of the resource group. 919 // - virtualMachineScaleSetName - The name of the virtual machine scale set. 920 // - virtualmachineIndex - The virtual machine index. 921 // - networkInterfaceName - The name of the network interface. 922 // - options - InterfacesClientListVirtualMachineScaleSetIPConfigurationsOptions contains the optional parameters for the InterfacesClient.NewListVirtualMachineScaleSetIPConfigurationsPager 923 // method. 924 func (client *InterfacesClient) NewListVirtualMachineScaleSetIPConfigurationsPager(resourceGroupName string, virtualMachineScaleSetName string, virtualmachineIndex string, networkInterfaceName string, options *InterfacesClientListVirtualMachineScaleSetIPConfigurationsOptions) *runtime.Pager[InterfacesClientListVirtualMachineScaleSetIPConfigurationsResponse] { 925 return runtime.NewPager(runtime.PagingHandler[InterfacesClientListVirtualMachineScaleSetIPConfigurationsResponse]{ 926 More: func(page InterfacesClientListVirtualMachineScaleSetIPConfigurationsResponse) bool { 927 return page.NextLink != nil && len(*page.NextLink) > 0 928 }, 929 Fetcher: func(ctx context.Context, page *InterfacesClientListVirtualMachineScaleSetIPConfigurationsResponse) (InterfacesClientListVirtualMachineScaleSetIPConfigurationsResponse, error) { 930 ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, "InterfacesClient.NewListVirtualMachineScaleSetIPConfigurationsPager") 931 nextLink := "" 932 if page != nil { 933 nextLink = *page.NextLink 934 } 935 resp, err := runtime.FetcherForNextLink(ctx, client.internal.Pipeline(), nextLink, func(ctx context.Context) (*policy.Request, error) { 936 return client.listVirtualMachineScaleSetIPConfigurationsCreateRequest(ctx, resourceGroupName, virtualMachineScaleSetName, virtualmachineIndex, networkInterfaceName, options) 937 }, nil) 938 if err != nil { 939 return InterfacesClientListVirtualMachineScaleSetIPConfigurationsResponse{}, err 940 } 941 return client.listVirtualMachineScaleSetIPConfigurationsHandleResponse(resp) 942 }, 943 Tracer: client.internal.Tracer(), 944 }) 945 } 946 947 // listVirtualMachineScaleSetIPConfigurationsCreateRequest creates the ListVirtualMachineScaleSetIPConfigurations request. 948 func (client *InterfacesClient) listVirtualMachineScaleSetIPConfigurationsCreateRequest(ctx context.Context, resourceGroupName string, virtualMachineScaleSetName string, virtualmachineIndex string, networkInterfaceName string, options *InterfacesClientListVirtualMachineScaleSetIPConfigurationsOptions) (*policy.Request, error) { 949 urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/microsoft.Compute/virtualMachineScaleSets/{virtualMachineScaleSetName}/virtualMachines/{virtualmachineIndex}/networkInterfaces/{networkInterfaceName}/ipConfigurations" 950 if resourceGroupName == "" { 951 return nil, errors.New("parameter resourceGroupName cannot be empty") 952 } 953 urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) 954 if virtualMachineScaleSetName == "" { 955 return nil, errors.New("parameter virtualMachineScaleSetName cannot be empty") 956 } 957 urlPath = strings.ReplaceAll(urlPath, "{virtualMachineScaleSetName}", url.PathEscape(virtualMachineScaleSetName)) 958 if virtualmachineIndex == "" { 959 return nil, errors.New("parameter virtualmachineIndex cannot be empty") 960 } 961 urlPath = strings.ReplaceAll(urlPath, "{virtualmachineIndex}", url.PathEscape(virtualmachineIndex)) 962 if networkInterfaceName == "" { 963 return nil, errors.New("parameter networkInterfaceName cannot be empty") 964 } 965 urlPath = strings.ReplaceAll(urlPath, "{networkInterfaceName}", url.PathEscape(networkInterfaceName)) 966 if client.subscriptionID == "" { 967 return nil, errors.New("parameter client.subscriptionID cannot be empty") 968 } 969 urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) 970 req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) 971 if err != nil { 972 return nil, err 973 } 974 reqQP := req.Raw().URL.Query() 975 if options != nil && options.Expand != nil { 976 reqQP.Set("$expand", *options.Expand) 977 } 978 reqQP.Set("api-version", "2018-10-01") 979 req.Raw().URL.RawQuery = reqQP.Encode() 980 req.Raw().Header["Accept"] = []string{"application/json"} 981 return req, nil 982 } 983 984 // listVirtualMachineScaleSetIPConfigurationsHandleResponse handles the ListVirtualMachineScaleSetIPConfigurations response. 985 func (client *InterfacesClient) listVirtualMachineScaleSetIPConfigurationsHandleResponse(resp *http.Response) (InterfacesClientListVirtualMachineScaleSetIPConfigurationsResponse, error) { 986 result := InterfacesClientListVirtualMachineScaleSetIPConfigurationsResponse{} 987 if err := runtime.UnmarshalAsJSON(resp, &result.InterfaceIPConfigurationListResult); err != nil { 988 return InterfacesClientListVirtualMachineScaleSetIPConfigurationsResponse{}, err 989 } 990 return result, nil 991 } 992 993 // NewListVirtualMachineScaleSetNetworkInterfacesPager - Gets all network interfaces in a virtual machine scale set. 994 // 995 // Generated from API version 2018-10-01 996 // - resourceGroupName - The name of the resource group. 997 // - virtualMachineScaleSetName - The name of the virtual machine scale set. 998 // - options - InterfacesClientListVirtualMachineScaleSetNetworkInterfacesOptions contains the optional parameters for the InterfacesClient.NewListVirtualMachineScaleSetNetworkInterfacesPager 999 // method. 1000 func (client *InterfacesClient) NewListVirtualMachineScaleSetNetworkInterfacesPager(resourceGroupName string, virtualMachineScaleSetName string, options *InterfacesClientListVirtualMachineScaleSetNetworkInterfacesOptions) *runtime.Pager[InterfacesClientListVirtualMachineScaleSetNetworkInterfacesResponse] { 1001 return runtime.NewPager(runtime.PagingHandler[InterfacesClientListVirtualMachineScaleSetNetworkInterfacesResponse]{ 1002 More: func(page InterfacesClientListVirtualMachineScaleSetNetworkInterfacesResponse) bool { 1003 return page.NextLink != nil && len(*page.NextLink) > 0 1004 }, 1005 Fetcher: func(ctx context.Context, page *InterfacesClientListVirtualMachineScaleSetNetworkInterfacesResponse) (InterfacesClientListVirtualMachineScaleSetNetworkInterfacesResponse, error) { 1006 ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, "InterfacesClient.NewListVirtualMachineScaleSetNetworkInterfacesPager") 1007 nextLink := "" 1008 if page != nil { 1009 nextLink = *page.NextLink 1010 } 1011 resp, err := runtime.FetcherForNextLink(ctx, client.internal.Pipeline(), nextLink, func(ctx context.Context) (*policy.Request, error) { 1012 return client.listVirtualMachineScaleSetNetworkInterfacesCreateRequest(ctx, resourceGroupName, virtualMachineScaleSetName, options) 1013 }, nil) 1014 if err != nil { 1015 return InterfacesClientListVirtualMachineScaleSetNetworkInterfacesResponse{}, err 1016 } 1017 return client.listVirtualMachineScaleSetNetworkInterfacesHandleResponse(resp) 1018 }, 1019 Tracer: client.internal.Tracer(), 1020 }) 1021 } 1022 1023 // listVirtualMachineScaleSetNetworkInterfacesCreateRequest creates the ListVirtualMachineScaleSetNetworkInterfaces request. 1024 func (client *InterfacesClient) listVirtualMachineScaleSetNetworkInterfacesCreateRequest(ctx context.Context, resourceGroupName string, virtualMachineScaleSetName string, options *InterfacesClientListVirtualMachineScaleSetNetworkInterfacesOptions) (*policy.Request, error) { 1025 urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/microsoft.Compute/virtualMachineScaleSets/{virtualMachineScaleSetName}/networkInterfaces" 1026 if resourceGroupName == "" { 1027 return nil, errors.New("parameter resourceGroupName cannot be empty") 1028 } 1029 urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) 1030 if virtualMachineScaleSetName == "" { 1031 return nil, errors.New("parameter virtualMachineScaleSetName cannot be empty") 1032 } 1033 urlPath = strings.ReplaceAll(urlPath, "{virtualMachineScaleSetName}", url.PathEscape(virtualMachineScaleSetName)) 1034 if client.subscriptionID == "" { 1035 return nil, errors.New("parameter client.subscriptionID cannot be empty") 1036 } 1037 urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) 1038 req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) 1039 if err != nil { 1040 return nil, err 1041 } 1042 reqQP := req.Raw().URL.Query() 1043 reqQP.Set("api-version", "2018-10-01") 1044 req.Raw().URL.RawQuery = reqQP.Encode() 1045 req.Raw().Header["Accept"] = []string{"application/json"} 1046 return req, nil 1047 } 1048 1049 // listVirtualMachineScaleSetNetworkInterfacesHandleResponse handles the ListVirtualMachineScaleSetNetworkInterfaces response. 1050 func (client *InterfacesClient) listVirtualMachineScaleSetNetworkInterfacesHandleResponse(resp *http.Response) (InterfacesClientListVirtualMachineScaleSetNetworkInterfacesResponse, error) { 1051 result := InterfacesClientListVirtualMachineScaleSetNetworkInterfacesResponse{} 1052 if err := runtime.UnmarshalAsJSON(resp, &result.InterfaceListResult); err != nil { 1053 return InterfacesClientListVirtualMachineScaleSetNetworkInterfacesResponse{}, err 1054 } 1055 return result, nil 1056 } 1057 1058 // NewListVirtualMachineScaleSetVMNetworkInterfacesPager - Gets information about all network interfaces in a virtual machine 1059 // in a virtual machine scale set. 1060 // 1061 // Generated from API version 2018-10-01 1062 // - resourceGroupName - The name of the resource group. 1063 // - virtualMachineScaleSetName - The name of the virtual machine scale set. 1064 // - virtualmachineIndex - The virtual machine index. 1065 // - options - InterfacesClientListVirtualMachineScaleSetVMNetworkInterfacesOptions contains the optional parameters for the 1066 // InterfacesClient.NewListVirtualMachineScaleSetVMNetworkInterfacesPager method. 1067 func (client *InterfacesClient) NewListVirtualMachineScaleSetVMNetworkInterfacesPager(resourceGroupName string, virtualMachineScaleSetName string, virtualmachineIndex string, options *InterfacesClientListVirtualMachineScaleSetVMNetworkInterfacesOptions) *runtime.Pager[InterfacesClientListVirtualMachineScaleSetVMNetworkInterfacesResponse] { 1068 return runtime.NewPager(runtime.PagingHandler[InterfacesClientListVirtualMachineScaleSetVMNetworkInterfacesResponse]{ 1069 More: func(page InterfacesClientListVirtualMachineScaleSetVMNetworkInterfacesResponse) bool { 1070 return page.NextLink != nil && len(*page.NextLink) > 0 1071 }, 1072 Fetcher: func(ctx context.Context, page *InterfacesClientListVirtualMachineScaleSetVMNetworkInterfacesResponse) (InterfacesClientListVirtualMachineScaleSetVMNetworkInterfacesResponse, error) { 1073 ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, "InterfacesClient.NewListVirtualMachineScaleSetVMNetworkInterfacesPager") 1074 nextLink := "" 1075 if page != nil { 1076 nextLink = *page.NextLink 1077 } 1078 resp, err := runtime.FetcherForNextLink(ctx, client.internal.Pipeline(), nextLink, func(ctx context.Context) (*policy.Request, error) { 1079 return client.listVirtualMachineScaleSetVMNetworkInterfacesCreateRequest(ctx, resourceGroupName, virtualMachineScaleSetName, virtualmachineIndex, options) 1080 }, nil) 1081 if err != nil { 1082 return InterfacesClientListVirtualMachineScaleSetVMNetworkInterfacesResponse{}, err 1083 } 1084 return client.listVirtualMachineScaleSetVMNetworkInterfacesHandleResponse(resp) 1085 }, 1086 Tracer: client.internal.Tracer(), 1087 }) 1088 } 1089 1090 // listVirtualMachineScaleSetVMNetworkInterfacesCreateRequest creates the ListVirtualMachineScaleSetVMNetworkInterfaces request. 1091 func (client *InterfacesClient) listVirtualMachineScaleSetVMNetworkInterfacesCreateRequest(ctx context.Context, resourceGroupName string, virtualMachineScaleSetName string, virtualmachineIndex string, options *InterfacesClientListVirtualMachineScaleSetVMNetworkInterfacesOptions) (*policy.Request, error) { 1092 urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/microsoft.Compute/virtualMachineScaleSets/{virtualMachineScaleSetName}/virtualMachines/{virtualmachineIndex}/networkInterfaces" 1093 if resourceGroupName == "" { 1094 return nil, errors.New("parameter resourceGroupName cannot be empty") 1095 } 1096 urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) 1097 if virtualMachineScaleSetName == "" { 1098 return nil, errors.New("parameter virtualMachineScaleSetName cannot be empty") 1099 } 1100 urlPath = strings.ReplaceAll(urlPath, "{virtualMachineScaleSetName}", url.PathEscape(virtualMachineScaleSetName)) 1101 if virtualmachineIndex == "" { 1102 return nil, errors.New("parameter virtualmachineIndex cannot be empty") 1103 } 1104 urlPath = strings.ReplaceAll(urlPath, "{virtualmachineIndex}", url.PathEscape(virtualmachineIndex)) 1105 if client.subscriptionID == "" { 1106 return nil, errors.New("parameter client.subscriptionID cannot be empty") 1107 } 1108 urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) 1109 req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) 1110 if err != nil { 1111 return nil, err 1112 } 1113 reqQP := req.Raw().URL.Query() 1114 reqQP.Set("api-version", "2018-10-01") 1115 req.Raw().URL.RawQuery = reqQP.Encode() 1116 req.Raw().Header["Accept"] = []string{"application/json"} 1117 return req, nil 1118 } 1119 1120 // listVirtualMachineScaleSetVMNetworkInterfacesHandleResponse handles the ListVirtualMachineScaleSetVMNetworkInterfaces response. 1121 func (client *InterfacesClient) listVirtualMachineScaleSetVMNetworkInterfacesHandleResponse(resp *http.Response) (InterfacesClientListVirtualMachineScaleSetVMNetworkInterfacesResponse, error) { 1122 result := InterfacesClientListVirtualMachineScaleSetVMNetworkInterfacesResponse{} 1123 if err := runtime.UnmarshalAsJSON(resp, &result.InterfaceListResult); err != nil { 1124 return InterfacesClientListVirtualMachineScaleSetVMNetworkInterfacesResponse{}, err 1125 } 1126 return result, nil 1127 } 1128 1129 // UpdateTags - Updates a network interface tags. 1130 // If the operation fails it returns an *azcore.ResponseError type. 1131 // 1132 // Generated from API version 2024-05-01 1133 // - resourceGroupName - The name of the resource group. 1134 // - networkInterfaceName - The name of the network interface. 1135 // - parameters - Parameters supplied to update network interface tags. 1136 // - options - InterfacesClientUpdateTagsOptions contains the optional parameters for the InterfacesClient.UpdateTags method. 1137 func (client *InterfacesClient) UpdateTags(ctx context.Context, resourceGroupName string, networkInterfaceName string, parameters TagsObject, options *InterfacesClientUpdateTagsOptions) (InterfacesClientUpdateTagsResponse, error) { 1138 var err error 1139 const operationName = "InterfacesClient.UpdateTags" 1140 ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) 1141 ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) 1142 defer func() { endSpan(err) }() 1143 req, err := client.updateTagsCreateRequest(ctx, resourceGroupName, networkInterfaceName, parameters, options) 1144 if err != nil { 1145 return InterfacesClientUpdateTagsResponse{}, err 1146 } 1147 httpResp, err := client.internal.Pipeline().Do(req) 1148 if err != nil { 1149 return InterfacesClientUpdateTagsResponse{}, err 1150 } 1151 if !runtime.HasStatusCode(httpResp, http.StatusOK) { 1152 err = runtime.NewResponseError(httpResp) 1153 return InterfacesClientUpdateTagsResponse{}, err 1154 } 1155 resp, err := client.updateTagsHandleResponse(httpResp) 1156 return resp, err 1157 } 1158 1159 // updateTagsCreateRequest creates the UpdateTags request. 1160 func (client *InterfacesClient) updateTagsCreateRequest(ctx context.Context, resourceGroupName string, networkInterfaceName string, parameters TagsObject, options *InterfacesClientUpdateTagsOptions) (*policy.Request, error) { 1161 urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/networkInterfaces/{networkInterfaceName}" 1162 if resourceGroupName == "" { 1163 return nil, errors.New("parameter resourceGroupName cannot be empty") 1164 } 1165 urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) 1166 if networkInterfaceName == "" { 1167 return nil, errors.New("parameter networkInterfaceName cannot be empty") 1168 } 1169 urlPath = strings.ReplaceAll(urlPath, "{networkInterfaceName}", url.PathEscape(networkInterfaceName)) 1170 if client.subscriptionID == "" { 1171 return nil, errors.New("parameter client.subscriptionID cannot be empty") 1172 } 1173 urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) 1174 req, err := runtime.NewRequest(ctx, http.MethodPatch, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) 1175 if err != nil { 1176 return nil, err 1177 } 1178 reqQP := req.Raw().URL.Query() 1179 reqQP.Set("api-version", "2024-05-01") 1180 req.Raw().URL.RawQuery = reqQP.Encode() 1181 req.Raw().Header["Accept"] = []string{"application/json"} 1182 if err := runtime.MarshalAsJSON(req, parameters); err != nil { 1183 return nil, err 1184 } 1185 return req, nil 1186 } 1187 1188 // updateTagsHandleResponse handles the UpdateTags response. 1189 func (client *InterfacesClient) updateTagsHandleResponse(resp *http.Response) (InterfacesClientUpdateTagsResponse, error) { 1190 result := InterfacesClientUpdateTagsResponse{} 1191 if err := runtime.UnmarshalAsJSON(resp, &result.Interface); err != nil { 1192 return InterfacesClientUpdateTagsResponse{}, err 1193 } 1194 return result, nil 1195 }