github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/network/armnetwork/v6@v6.2.0/virtualnetworkgateways_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 // VirtualNetworkGatewaysClient contains the methods for the VirtualNetworkGateways group. 25 // Don't use this type directly, use NewVirtualNetworkGatewaysClient() instead. 26 type VirtualNetworkGatewaysClient struct { 27 internal *arm.Client 28 subscriptionID string 29 } 30 31 // NewVirtualNetworkGatewaysClient creates a new instance of VirtualNetworkGatewaysClient 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 NewVirtualNetworkGatewaysClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) (*VirtualNetworkGatewaysClient, error) { 37 cl, err := arm.NewClient(moduleName, moduleVersion, credential, options) 38 if err != nil { 39 return nil, err 40 } 41 client := &VirtualNetworkGatewaysClient{ 42 subscriptionID: subscriptionID, 43 internal: cl, 44 } 45 return client, nil 46 } 47 48 // BeginCreateOrUpdate - Creates or updates a virtual network gateway in the specified resource group. 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 // - virtualNetworkGatewayName - The name of the virtual network gateway. 54 // - parameters - Parameters supplied to create or update virtual network gateway operation. 55 // - options - VirtualNetworkGatewaysClientBeginCreateOrUpdateOptions contains the optional parameters for the VirtualNetworkGatewaysClient.BeginCreateOrUpdate 56 // method. 57 func (client *VirtualNetworkGatewaysClient) BeginCreateOrUpdate(ctx context.Context, resourceGroupName string, virtualNetworkGatewayName string, parameters VirtualNetworkGateway, options *VirtualNetworkGatewaysClientBeginCreateOrUpdateOptions) (*runtime.Poller[VirtualNetworkGatewaysClientCreateOrUpdateResponse], error) { 58 if options == nil || options.ResumeToken == "" { 59 resp, err := client.createOrUpdate(ctx, resourceGroupName, virtualNetworkGatewayName, parameters, options) 60 if err != nil { 61 return nil, err 62 } 63 poller, err := runtime.NewPoller(resp, client.internal.Pipeline(), &runtime.NewPollerOptions[VirtualNetworkGatewaysClientCreateOrUpdateResponse]{ 64 FinalStateVia: runtime.FinalStateViaAzureAsyncOp, 65 Tracer: client.internal.Tracer(), 66 }) 67 return poller, err 68 } else { 69 return runtime.NewPollerFromResumeToken(options.ResumeToken, client.internal.Pipeline(), &runtime.NewPollerFromResumeTokenOptions[VirtualNetworkGatewaysClientCreateOrUpdateResponse]{ 70 Tracer: client.internal.Tracer(), 71 }) 72 } 73 } 74 75 // CreateOrUpdate - Creates or updates a virtual network gateway in the specified resource group. 76 // If the operation fails it returns an *azcore.ResponseError type. 77 // 78 // Generated from API version 2024-05-01 79 func (client *VirtualNetworkGatewaysClient) createOrUpdate(ctx context.Context, resourceGroupName string, virtualNetworkGatewayName string, parameters VirtualNetworkGateway, options *VirtualNetworkGatewaysClientBeginCreateOrUpdateOptions) (*http.Response, error) { 80 var err error 81 const operationName = "VirtualNetworkGatewaysClient.BeginCreateOrUpdate" 82 ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) 83 ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) 84 defer func() { endSpan(err) }() 85 req, err := client.createOrUpdateCreateRequest(ctx, resourceGroupName, virtualNetworkGatewayName, parameters, options) 86 if err != nil { 87 return nil, err 88 } 89 httpResp, err := client.internal.Pipeline().Do(req) 90 if err != nil { 91 return nil, err 92 } 93 if !runtime.HasStatusCode(httpResp, http.StatusOK, http.StatusCreated) { 94 err = runtime.NewResponseError(httpResp) 95 return nil, err 96 } 97 return httpResp, nil 98 } 99 100 // createOrUpdateCreateRequest creates the CreateOrUpdate request. 101 func (client *VirtualNetworkGatewaysClient) createOrUpdateCreateRequest(ctx context.Context, resourceGroupName string, virtualNetworkGatewayName string, parameters VirtualNetworkGateway, options *VirtualNetworkGatewaysClientBeginCreateOrUpdateOptions) (*policy.Request, error) { 102 urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/virtualNetworkGateways/{virtualNetworkGatewayName}" 103 if resourceGroupName == "" { 104 return nil, errors.New("parameter resourceGroupName cannot be empty") 105 } 106 urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) 107 if virtualNetworkGatewayName == "" { 108 return nil, errors.New("parameter virtualNetworkGatewayName cannot be empty") 109 } 110 urlPath = strings.ReplaceAll(urlPath, "{virtualNetworkGatewayName}", url.PathEscape(virtualNetworkGatewayName)) 111 if client.subscriptionID == "" { 112 return nil, errors.New("parameter client.subscriptionID cannot be empty") 113 } 114 urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) 115 req, err := runtime.NewRequest(ctx, http.MethodPut, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) 116 if err != nil { 117 return nil, err 118 } 119 reqQP := req.Raw().URL.Query() 120 reqQP.Set("api-version", "2024-05-01") 121 req.Raw().URL.RawQuery = reqQP.Encode() 122 req.Raw().Header["Accept"] = []string{"application/json"} 123 if err := runtime.MarshalAsJSON(req, parameters); err != nil { 124 return nil, err 125 } 126 return req, nil 127 } 128 129 // BeginDelete - Deletes the specified virtual network gateway. 130 // If the operation fails it returns an *azcore.ResponseError type. 131 // 132 // Generated from API version 2024-05-01 133 // - resourceGroupName - The name of the resource group. 134 // - virtualNetworkGatewayName - The name of the virtual network gateway. 135 // - options - VirtualNetworkGatewaysClientBeginDeleteOptions contains the optional parameters for the VirtualNetworkGatewaysClient.BeginDelete 136 // method. 137 func (client *VirtualNetworkGatewaysClient) BeginDelete(ctx context.Context, resourceGroupName string, virtualNetworkGatewayName string, options *VirtualNetworkGatewaysClientBeginDeleteOptions) (*runtime.Poller[VirtualNetworkGatewaysClientDeleteResponse], error) { 138 if options == nil || options.ResumeToken == "" { 139 resp, err := client.deleteOperation(ctx, resourceGroupName, virtualNetworkGatewayName, options) 140 if err != nil { 141 return nil, err 142 } 143 poller, err := runtime.NewPoller(resp, client.internal.Pipeline(), &runtime.NewPollerOptions[VirtualNetworkGatewaysClientDeleteResponse]{ 144 FinalStateVia: runtime.FinalStateViaLocation, 145 Tracer: client.internal.Tracer(), 146 }) 147 return poller, err 148 } else { 149 return runtime.NewPollerFromResumeToken(options.ResumeToken, client.internal.Pipeline(), &runtime.NewPollerFromResumeTokenOptions[VirtualNetworkGatewaysClientDeleteResponse]{ 150 Tracer: client.internal.Tracer(), 151 }) 152 } 153 } 154 155 // Delete - Deletes the specified virtual network gateway. 156 // If the operation fails it returns an *azcore.ResponseError type. 157 // 158 // Generated from API version 2024-05-01 159 func (client *VirtualNetworkGatewaysClient) deleteOperation(ctx context.Context, resourceGroupName string, virtualNetworkGatewayName string, options *VirtualNetworkGatewaysClientBeginDeleteOptions) (*http.Response, error) { 160 var err error 161 const operationName = "VirtualNetworkGatewaysClient.BeginDelete" 162 ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) 163 ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) 164 defer func() { endSpan(err) }() 165 req, err := client.deleteCreateRequest(ctx, resourceGroupName, virtualNetworkGatewayName, options) 166 if err != nil { 167 return nil, err 168 } 169 httpResp, err := client.internal.Pipeline().Do(req) 170 if err != nil { 171 return nil, err 172 } 173 if !runtime.HasStatusCode(httpResp, http.StatusOK, http.StatusAccepted, http.StatusNoContent) { 174 err = runtime.NewResponseError(httpResp) 175 return nil, err 176 } 177 return httpResp, nil 178 } 179 180 // deleteCreateRequest creates the Delete request. 181 func (client *VirtualNetworkGatewaysClient) deleteCreateRequest(ctx context.Context, resourceGroupName string, virtualNetworkGatewayName string, options *VirtualNetworkGatewaysClientBeginDeleteOptions) (*policy.Request, error) { 182 urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/virtualNetworkGateways/{virtualNetworkGatewayName}" 183 if resourceGroupName == "" { 184 return nil, errors.New("parameter resourceGroupName cannot be empty") 185 } 186 urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) 187 if virtualNetworkGatewayName == "" { 188 return nil, errors.New("parameter virtualNetworkGatewayName cannot be empty") 189 } 190 urlPath = strings.ReplaceAll(urlPath, "{virtualNetworkGatewayName}", url.PathEscape(virtualNetworkGatewayName)) 191 if client.subscriptionID == "" { 192 return nil, errors.New("parameter client.subscriptionID cannot be empty") 193 } 194 urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) 195 req, err := runtime.NewRequest(ctx, http.MethodDelete, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) 196 if err != nil { 197 return nil, err 198 } 199 reqQP := req.Raw().URL.Query() 200 reqQP.Set("api-version", "2024-05-01") 201 req.Raw().URL.RawQuery = reqQP.Encode() 202 req.Raw().Header["Accept"] = []string{"application/json"} 203 return req, nil 204 } 205 206 // BeginDisconnectVirtualNetworkGatewayVPNConnections - Disconnect vpn connections of virtual network gateway in the specified 207 // resource group. 208 // If the operation fails it returns an *azcore.ResponseError type. 209 // 210 // Generated from API version 2024-05-01 211 // - resourceGroupName - The name of the resource group. 212 // - virtualNetworkGatewayName - The name of the virtual network gateway. 213 // - request - The parameters are supplied to disconnect vpn connections. 214 // - options - VirtualNetworkGatewaysClientBeginDisconnectVirtualNetworkGatewayVPNConnectionsOptions contains the optional parameters 215 // for the VirtualNetworkGatewaysClient.BeginDisconnectVirtualNetworkGatewayVPNConnections method. 216 func (client *VirtualNetworkGatewaysClient) BeginDisconnectVirtualNetworkGatewayVPNConnections(ctx context.Context, resourceGroupName string, virtualNetworkGatewayName string, request P2SVPNConnectionRequest, options *VirtualNetworkGatewaysClientBeginDisconnectVirtualNetworkGatewayVPNConnectionsOptions) (*runtime.Poller[VirtualNetworkGatewaysClientDisconnectVirtualNetworkGatewayVPNConnectionsResponse], error) { 217 if options == nil || options.ResumeToken == "" { 218 resp, err := client.disconnectVirtualNetworkGatewayVPNConnections(ctx, resourceGroupName, virtualNetworkGatewayName, request, options) 219 if err != nil { 220 return nil, err 221 } 222 poller, err := runtime.NewPoller(resp, client.internal.Pipeline(), &runtime.NewPollerOptions[VirtualNetworkGatewaysClientDisconnectVirtualNetworkGatewayVPNConnectionsResponse]{ 223 FinalStateVia: runtime.FinalStateViaLocation, 224 Tracer: client.internal.Tracer(), 225 }) 226 return poller, err 227 } else { 228 return runtime.NewPollerFromResumeToken(options.ResumeToken, client.internal.Pipeline(), &runtime.NewPollerFromResumeTokenOptions[VirtualNetworkGatewaysClientDisconnectVirtualNetworkGatewayVPNConnectionsResponse]{ 229 Tracer: client.internal.Tracer(), 230 }) 231 } 232 } 233 234 // DisconnectVirtualNetworkGatewayVPNConnections - Disconnect vpn connections of virtual network gateway in the specified 235 // resource group. 236 // If the operation fails it returns an *azcore.ResponseError type. 237 // 238 // Generated from API version 2024-05-01 239 func (client *VirtualNetworkGatewaysClient) disconnectVirtualNetworkGatewayVPNConnections(ctx context.Context, resourceGroupName string, virtualNetworkGatewayName string, request P2SVPNConnectionRequest, options *VirtualNetworkGatewaysClientBeginDisconnectVirtualNetworkGatewayVPNConnectionsOptions) (*http.Response, error) { 240 var err error 241 const operationName = "VirtualNetworkGatewaysClient.BeginDisconnectVirtualNetworkGatewayVPNConnections" 242 ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) 243 ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) 244 defer func() { endSpan(err) }() 245 req, err := client.disconnectVirtualNetworkGatewayVPNConnectionsCreateRequest(ctx, resourceGroupName, virtualNetworkGatewayName, request, options) 246 if err != nil { 247 return nil, err 248 } 249 httpResp, err := client.internal.Pipeline().Do(req) 250 if err != nil { 251 return nil, err 252 } 253 if !runtime.HasStatusCode(httpResp, http.StatusOK, http.StatusAccepted) { 254 err = runtime.NewResponseError(httpResp) 255 return nil, err 256 } 257 return httpResp, nil 258 } 259 260 // disconnectVirtualNetworkGatewayVPNConnectionsCreateRequest creates the DisconnectVirtualNetworkGatewayVPNConnections request. 261 func (client *VirtualNetworkGatewaysClient) disconnectVirtualNetworkGatewayVPNConnectionsCreateRequest(ctx context.Context, resourceGroupName string, virtualNetworkGatewayName string, request P2SVPNConnectionRequest, options *VirtualNetworkGatewaysClientBeginDisconnectVirtualNetworkGatewayVPNConnectionsOptions) (*policy.Request, error) { 262 urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/virtualNetworkGateways/{virtualNetworkGatewayName}/disconnectVirtualNetworkGatewayVpnConnections" 263 if client.subscriptionID == "" { 264 return nil, errors.New("parameter client.subscriptionID cannot be empty") 265 } 266 urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) 267 if resourceGroupName == "" { 268 return nil, errors.New("parameter resourceGroupName cannot be empty") 269 } 270 urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) 271 if virtualNetworkGatewayName == "" { 272 return nil, errors.New("parameter virtualNetworkGatewayName cannot be empty") 273 } 274 urlPath = strings.ReplaceAll(urlPath, "{virtualNetworkGatewayName}", url.PathEscape(virtualNetworkGatewayName)) 275 req, err := runtime.NewRequest(ctx, http.MethodPost, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) 276 if err != nil { 277 return nil, err 278 } 279 reqQP := req.Raw().URL.Query() 280 reqQP.Set("api-version", "2024-05-01") 281 req.Raw().URL.RawQuery = reqQP.Encode() 282 req.Raw().Header["Accept"] = []string{"application/json"} 283 if err := runtime.MarshalAsJSON(req, request); err != nil { 284 return nil, err 285 } 286 return req, nil 287 } 288 289 // BeginGenerateVPNProfile - Generates VPN profile for P2S client of the virtual network gateway in the specified resource 290 // group. Used for IKEV2 and radius based authentication. 291 // If the operation fails it returns an *azcore.ResponseError type. 292 // 293 // Generated from API version 2024-05-01 294 // - resourceGroupName - The name of the resource group. 295 // - virtualNetworkGatewayName - The name of the virtual network gateway. 296 // - parameters - Parameters supplied to the generate virtual network gateway VPN client package operation. 297 // - options - VirtualNetworkGatewaysClientBeginGenerateVPNProfileOptions contains the optional parameters for the VirtualNetworkGatewaysClient.BeginGenerateVPNProfile 298 // method. 299 func (client *VirtualNetworkGatewaysClient) BeginGenerateVPNProfile(ctx context.Context, resourceGroupName string, virtualNetworkGatewayName string, parameters VPNClientParameters, options *VirtualNetworkGatewaysClientBeginGenerateVPNProfileOptions) (*runtime.Poller[VirtualNetworkGatewaysClientGenerateVPNProfileResponse], error) { 300 if options == nil || options.ResumeToken == "" { 301 resp, err := client.generateVPNProfile(ctx, resourceGroupName, virtualNetworkGatewayName, parameters, options) 302 if err != nil { 303 return nil, err 304 } 305 poller, err := runtime.NewPoller(resp, client.internal.Pipeline(), &runtime.NewPollerOptions[VirtualNetworkGatewaysClientGenerateVPNProfileResponse]{ 306 FinalStateVia: runtime.FinalStateViaLocation, 307 Tracer: client.internal.Tracer(), 308 }) 309 return poller, err 310 } else { 311 return runtime.NewPollerFromResumeToken(options.ResumeToken, client.internal.Pipeline(), &runtime.NewPollerFromResumeTokenOptions[VirtualNetworkGatewaysClientGenerateVPNProfileResponse]{ 312 Tracer: client.internal.Tracer(), 313 }) 314 } 315 } 316 317 // GenerateVPNProfile - Generates VPN profile for P2S client of the virtual network gateway in the specified resource group. 318 // Used for IKEV2 and radius based authentication. 319 // If the operation fails it returns an *azcore.ResponseError type. 320 // 321 // Generated from API version 2024-05-01 322 func (client *VirtualNetworkGatewaysClient) generateVPNProfile(ctx context.Context, resourceGroupName string, virtualNetworkGatewayName string, parameters VPNClientParameters, options *VirtualNetworkGatewaysClientBeginGenerateVPNProfileOptions) (*http.Response, error) { 323 var err error 324 const operationName = "VirtualNetworkGatewaysClient.BeginGenerateVPNProfile" 325 ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) 326 ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) 327 defer func() { endSpan(err) }() 328 req, err := client.generateVPNProfileCreateRequest(ctx, resourceGroupName, virtualNetworkGatewayName, parameters, options) 329 if err != nil { 330 return nil, err 331 } 332 httpResp, err := client.internal.Pipeline().Do(req) 333 if err != nil { 334 return nil, err 335 } 336 if !runtime.HasStatusCode(httpResp, http.StatusOK, http.StatusAccepted) { 337 err = runtime.NewResponseError(httpResp) 338 return nil, err 339 } 340 return httpResp, nil 341 } 342 343 // generateVPNProfileCreateRequest creates the GenerateVPNProfile request. 344 func (client *VirtualNetworkGatewaysClient) generateVPNProfileCreateRequest(ctx context.Context, resourceGroupName string, virtualNetworkGatewayName string, parameters VPNClientParameters, options *VirtualNetworkGatewaysClientBeginGenerateVPNProfileOptions) (*policy.Request, error) { 345 urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/virtualNetworkGateways/{virtualNetworkGatewayName}/generatevpnprofile" 346 if resourceGroupName == "" { 347 return nil, errors.New("parameter resourceGroupName cannot be empty") 348 } 349 urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) 350 if virtualNetworkGatewayName == "" { 351 return nil, errors.New("parameter virtualNetworkGatewayName cannot be empty") 352 } 353 urlPath = strings.ReplaceAll(urlPath, "{virtualNetworkGatewayName}", url.PathEscape(virtualNetworkGatewayName)) 354 if client.subscriptionID == "" { 355 return nil, errors.New("parameter client.subscriptionID cannot be empty") 356 } 357 urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) 358 req, err := runtime.NewRequest(ctx, http.MethodPost, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) 359 if err != nil { 360 return nil, err 361 } 362 reqQP := req.Raw().URL.Query() 363 reqQP.Set("api-version", "2024-05-01") 364 req.Raw().URL.RawQuery = reqQP.Encode() 365 req.Raw().Header["Accept"] = []string{"application/json"} 366 if err := runtime.MarshalAsJSON(req, parameters); err != nil { 367 return nil, err 368 } 369 return req, nil 370 } 371 372 // BeginGeneratevpnclientpackage - Generates VPN client package for P2S client of the virtual network gateway in the specified 373 // resource group. 374 // If the operation fails it returns an *azcore.ResponseError type. 375 // 376 // Generated from API version 2024-05-01 377 // - resourceGroupName - The name of the resource group. 378 // - virtualNetworkGatewayName - The name of the virtual network gateway. 379 // - parameters - Parameters supplied to the generate virtual network gateway VPN client package operation. 380 // - options - VirtualNetworkGatewaysClientBeginGeneratevpnclientpackageOptions contains the optional parameters for the VirtualNetworkGatewaysClient.BeginGeneratevpnclientpackage 381 // method. 382 func (client *VirtualNetworkGatewaysClient) BeginGeneratevpnclientpackage(ctx context.Context, resourceGroupName string, virtualNetworkGatewayName string, parameters VPNClientParameters, options *VirtualNetworkGatewaysClientBeginGeneratevpnclientpackageOptions) (*runtime.Poller[VirtualNetworkGatewaysClientGeneratevpnclientpackageResponse], error) { 383 if options == nil || options.ResumeToken == "" { 384 resp, err := client.generatevpnclientpackage(ctx, resourceGroupName, virtualNetworkGatewayName, parameters, options) 385 if err != nil { 386 return nil, err 387 } 388 poller, err := runtime.NewPoller(resp, client.internal.Pipeline(), &runtime.NewPollerOptions[VirtualNetworkGatewaysClientGeneratevpnclientpackageResponse]{ 389 FinalStateVia: runtime.FinalStateViaLocation, 390 Tracer: client.internal.Tracer(), 391 }) 392 return poller, err 393 } else { 394 return runtime.NewPollerFromResumeToken(options.ResumeToken, client.internal.Pipeline(), &runtime.NewPollerFromResumeTokenOptions[VirtualNetworkGatewaysClientGeneratevpnclientpackageResponse]{ 395 Tracer: client.internal.Tracer(), 396 }) 397 } 398 } 399 400 // Generatevpnclientpackage - Generates VPN client package for P2S client of the virtual network gateway in the specified 401 // resource group. 402 // If the operation fails it returns an *azcore.ResponseError type. 403 // 404 // Generated from API version 2024-05-01 405 func (client *VirtualNetworkGatewaysClient) generatevpnclientpackage(ctx context.Context, resourceGroupName string, virtualNetworkGatewayName string, parameters VPNClientParameters, options *VirtualNetworkGatewaysClientBeginGeneratevpnclientpackageOptions) (*http.Response, error) { 406 var err error 407 const operationName = "VirtualNetworkGatewaysClient.BeginGeneratevpnclientpackage" 408 ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) 409 ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) 410 defer func() { endSpan(err) }() 411 req, err := client.generatevpnclientpackageCreateRequest(ctx, resourceGroupName, virtualNetworkGatewayName, parameters, options) 412 if err != nil { 413 return nil, err 414 } 415 httpResp, err := client.internal.Pipeline().Do(req) 416 if err != nil { 417 return nil, err 418 } 419 if !runtime.HasStatusCode(httpResp, http.StatusOK, http.StatusAccepted) { 420 err = runtime.NewResponseError(httpResp) 421 return nil, err 422 } 423 return httpResp, nil 424 } 425 426 // generatevpnclientpackageCreateRequest creates the Generatevpnclientpackage request. 427 func (client *VirtualNetworkGatewaysClient) generatevpnclientpackageCreateRequest(ctx context.Context, resourceGroupName string, virtualNetworkGatewayName string, parameters VPNClientParameters, options *VirtualNetworkGatewaysClientBeginGeneratevpnclientpackageOptions) (*policy.Request, error) { 428 urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/virtualNetworkGateways/{virtualNetworkGatewayName}/generatevpnclientpackage" 429 if resourceGroupName == "" { 430 return nil, errors.New("parameter resourceGroupName cannot be empty") 431 } 432 urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) 433 if virtualNetworkGatewayName == "" { 434 return nil, errors.New("parameter virtualNetworkGatewayName cannot be empty") 435 } 436 urlPath = strings.ReplaceAll(urlPath, "{virtualNetworkGatewayName}", url.PathEscape(virtualNetworkGatewayName)) 437 if client.subscriptionID == "" { 438 return nil, errors.New("parameter client.subscriptionID cannot be empty") 439 } 440 urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) 441 req, err := runtime.NewRequest(ctx, http.MethodPost, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) 442 if err != nil { 443 return nil, err 444 } 445 reqQP := req.Raw().URL.Query() 446 reqQP.Set("api-version", "2024-05-01") 447 req.Raw().URL.RawQuery = reqQP.Encode() 448 req.Raw().Header["Accept"] = []string{"application/json"} 449 if err := runtime.MarshalAsJSON(req, parameters); err != nil { 450 return nil, err 451 } 452 return req, nil 453 } 454 455 // Get - Gets the specified virtual network gateway by resource group. 456 // If the operation fails it returns an *azcore.ResponseError type. 457 // 458 // Generated from API version 2024-05-01 459 // - resourceGroupName - The name of the resource group. 460 // - virtualNetworkGatewayName - The name of the virtual network gateway. 461 // - options - VirtualNetworkGatewaysClientGetOptions contains the optional parameters for the VirtualNetworkGatewaysClient.Get 462 // method. 463 func (client *VirtualNetworkGatewaysClient) Get(ctx context.Context, resourceGroupName string, virtualNetworkGatewayName string, options *VirtualNetworkGatewaysClientGetOptions) (VirtualNetworkGatewaysClientGetResponse, error) { 464 var err error 465 const operationName = "VirtualNetworkGatewaysClient.Get" 466 ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) 467 ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) 468 defer func() { endSpan(err) }() 469 req, err := client.getCreateRequest(ctx, resourceGroupName, virtualNetworkGatewayName, options) 470 if err != nil { 471 return VirtualNetworkGatewaysClientGetResponse{}, err 472 } 473 httpResp, err := client.internal.Pipeline().Do(req) 474 if err != nil { 475 return VirtualNetworkGatewaysClientGetResponse{}, err 476 } 477 if !runtime.HasStatusCode(httpResp, http.StatusOK) { 478 err = runtime.NewResponseError(httpResp) 479 return VirtualNetworkGatewaysClientGetResponse{}, err 480 } 481 resp, err := client.getHandleResponse(httpResp) 482 return resp, err 483 } 484 485 // getCreateRequest creates the Get request. 486 func (client *VirtualNetworkGatewaysClient) getCreateRequest(ctx context.Context, resourceGroupName string, virtualNetworkGatewayName string, options *VirtualNetworkGatewaysClientGetOptions) (*policy.Request, error) { 487 urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/virtualNetworkGateways/{virtualNetworkGatewayName}" 488 if resourceGroupName == "" { 489 return nil, errors.New("parameter resourceGroupName cannot be empty") 490 } 491 urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) 492 if virtualNetworkGatewayName == "" { 493 return nil, errors.New("parameter virtualNetworkGatewayName cannot be empty") 494 } 495 urlPath = strings.ReplaceAll(urlPath, "{virtualNetworkGatewayName}", url.PathEscape(virtualNetworkGatewayName)) 496 if client.subscriptionID == "" { 497 return nil, errors.New("parameter client.subscriptionID cannot be empty") 498 } 499 urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) 500 req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) 501 if err != nil { 502 return nil, err 503 } 504 reqQP := req.Raw().URL.Query() 505 reqQP.Set("api-version", "2024-05-01") 506 req.Raw().URL.RawQuery = reqQP.Encode() 507 req.Raw().Header["Accept"] = []string{"application/json"} 508 return req, nil 509 } 510 511 // getHandleResponse handles the Get response. 512 func (client *VirtualNetworkGatewaysClient) getHandleResponse(resp *http.Response) (VirtualNetworkGatewaysClientGetResponse, error) { 513 result := VirtualNetworkGatewaysClientGetResponse{} 514 if err := runtime.UnmarshalAsJSON(resp, &result.VirtualNetworkGateway); err != nil { 515 return VirtualNetworkGatewaysClientGetResponse{}, err 516 } 517 return result, nil 518 } 519 520 // BeginGetAdvertisedRoutes - This operation retrieves a list of routes the virtual network gateway is advertising to the 521 // specified peer. 522 // If the operation fails it returns an *azcore.ResponseError type. 523 // 524 // Generated from API version 2024-05-01 525 // - resourceGroupName - The name of the resource group. 526 // - virtualNetworkGatewayName - The name of the virtual network gateway. 527 // - peer - The IP address of the peer. 528 // - options - VirtualNetworkGatewaysClientBeginGetAdvertisedRoutesOptions contains the optional parameters for the VirtualNetworkGatewaysClient.BeginGetAdvertisedRoutes 529 // method. 530 func (client *VirtualNetworkGatewaysClient) BeginGetAdvertisedRoutes(ctx context.Context, resourceGroupName string, virtualNetworkGatewayName string, peer string, options *VirtualNetworkGatewaysClientBeginGetAdvertisedRoutesOptions) (*runtime.Poller[VirtualNetworkGatewaysClientGetAdvertisedRoutesResponse], error) { 531 if options == nil || options.ResumeToken == "" { 532 resp, err := client.getAdvertisedRoutes(ctx, resourceGroupName, virtualNetworkGatewayName, peer, options) 533 if err != nil { 534 return nil, err 535 } 536 poller, err := runtime.NewPoller(resp, client.internal.Pipeline(), &runtime.NewPollerOptions[VirtualNetworkGatewaysClientGetAdvertisedRoutesResponse]{ 537 FinalStateVia: runtime.FinalStateViaLocation, 538 Tracer: client.internal.Tracer(), 539 }) 540 return poller, err 541 } else { 542 return runtime.NewPollerFromResumeToken(options.ResumeToken, client.internal.Pipeline(), &runtime.NewPollerFromResumeTokenOptions[VirtualNetworkGatewaysClientGetAdvertisedRoutesResponse]{ 543 Tracer: client.internal.Tracer(), 544 }) 545 } 546 } 547 548 // GetAdvertisedRoutes - This operation retrieves a list of routes the virtual network gateway is advertising to the specified 549 // peer. 550 // If the operation fails it returns an *azcore.ResponseError type. 551 // 552 // Generated from API version 2024-05-01 553 func (client *VirtualNetworkGatewaysClient) getAdvertisedRoutes(ctx context.Context, resourceGroupName string, virtualNetworkGatewayName string, peer string, options *VirtualNetworkGatewaysClientBeginGetAdvertisedRoutesOptions) (*http.Response, error) { 554 var err error 555 const operationName = "VirtualNetworkGatewaysClient.BeginGetAdvertisedRoutes" 556 ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) 557 ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) 558 defer func() { endSpan(err) }() 559 req, err := client.getAdvertisedRoutesCreateRequest(ctx, resourceGroupName, virtualNetworkGatewayName, peer, options) 560 if err != nil { 561 return nil, err 562 } 563 httpResp, err := client.internal.Pipeline().Do(req) 564 if err != nil { 565 return nil, err 566 } 567 if !runtime.HasStatusCode(httpResp, http.StatusOK, http.StatusAccepted) { 568 err = runtime.NewResponseError(httpResp) 569 return nil, err 570 } 571 return httpResp, nil 572 } 573 574 // getAdvertisedRoutesCreateRequest creates the GetAdvertisedRoutes request. 575 func (client *VirtualNetworkGatewaysClient) getAdvertisedRoutesCreateRequest(ctx context.Context, resourceGroupName string, virtualNetworkGatewayName string, peer string, options *VirtualNetworkGatewaysClientBeginGetAdvertisedRoutesOptions) (*policy.Request, error) { 576 urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/virtualNetworkGateways/{virtualNetworkGatewayName}/getAdvertisedRoutes" 577 if resourceGroupName == "" { 578 return nil, errors.New("parameter resourceGroupName cannot be empty") 579 } 580 urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) 581 if virtualNetworkGatewayName == "" { 582 return nil, errors.New("parameter virtualNetworkGatewayName cannot be empty") 583 } 584 urlPath = strings.ReplaceAll(urlPath, "{virtualNetworkGatewayName}", url.PathEscape(virtualNetworkGatewayName)) 585 if client.subscriptionID == "" { 586 return nil, errors.New("parameter client.subscriptionID cannot be empty") 587 } 588 urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) 589 req, err := runtime.NewRequest(ctx, http.MethodPost, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) 590 if err != nil { 591 return nil, err 592 } 593 reqQP := req.Raw().URL.Query() 594 reqQP.Set("api-version", "2024-05-01") 595 reqQP.Set("peer", peer) 596 req.Raw().URL.RawQuery = reqQP.Encode() 597 req.Raw().Header["Accept"] = []string{"application/json"} 598 return req, nil 599 } 600 601 // BeginGetBgpPeerStatus - The GetBgpPeerStatus operation retrieves the status of all BGP peers. 602 // If the operation fails it returns an *azcore.ResponseError type. 603 // 604 // Generated from API version 2024-05-01 605 // - resourceGroupName - The name of the resource group. 606 // - virtualNetworkGatewayName - The name of the virtual network gateway. 607 // - options - VirtualNetworkGatewaysClientBeginGetBgpPeerStatusOptions contains the optional parameters for the VirtualNetworkGatewaysClient.BeginGetBgpPeerStatus 608 // method. 609 func (client *VirtualNetworkGatewaysClient) BeginGetBgpPeerStatus(ctx context.Context, resourceGroupName string, virtualNetworkGatewayName string, options *VirtualNetworkGatewaysClientBeginGetBgpPeerStatusOptions) (*runtime.Poller[VirtualNetworkGatewaysClientGetBgpPeerStatusResponse], error) { 610 if options == nil || options.ResumeToken == "" { 611 resp, err := client.getBgpPeerStatus(ctx, resourceGroupName, virtualNetworkGatewayName, options) 612 if err != nil { 613 return nil, err 614 } 615 poller, err := runtime.NewPoller(resp, client.internal.Pipeline(), &runtime.NewPollerOptions[VirtualNetworkGatewaysClientGetBgpPeerStatusResponse]{ 616 FinalStateVia: runtime.FinalStateViaLocation, 617 Tracer: client.internal.Tracer(), 618 }) 619 return poller, err 620 } else { 621 return runtime.NewPollerFromResumeToken(options.ResumeToken, client.internal.Pipeline(), &runtime.NewPollerFromResumeTokenOptions[VirtualNetworkGatewaysClientGetBgpPeerStatusResponse]{ 622 Tracer: client.internal.Tracer(), 623 }) 624 } 625 } 626 627 // GetBgpPeerStatus - The GetBgpPeerStatus operation retrieves the status of all BGP peers. 628 // If the operation fails it returns an *azcore.ResponseError type. 629 // 630 // Generated from API version 2024-05-01 631 func (client *VirtualNetworkGatewaysClient) getBgpPeerStatus(ctx context.Context, resourceGroupName string, virtualNetworkGatewayName string, options *VirtualNetworkGatewaysClientBeginGetBgpPeerStatusOptions) (*http.Response, error) { 632 var err error 633 const operationName = "VirtualNetworkGatewaysClient.BeginGetBgpPeerStatus" 634 ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) 635 ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) 636 defer func() { endSpan(err) }() 637 req, err := client.getBgpPeerStatusCreateRequest(ctx, resourceGroupName, virtualNetworkGatewayName, options) 638 if err != nil { 639 return nil, err 640 } 641 httpResp, err := client.internal.Pipeline().Do(req) 642 if err != nil { 643 return nil, err 644 } 645 if !runtime.HasStatusCode(httpResp, http.StatusOK, http.StatusAccepted) { 646 err = runtime.NewResponseError(httpResp) 647 return nil, err 648 } 649 return httpResp, nil 650 } 651 652 // getBgpPeerStatusCreateRequest creates the GetBgpPeerStatus request. 653 func (client *VirtualNetworkGatewaysClient) getBgpPeerStatusCreateRequest(ctx context.Context, resourceGroupName string, virtualNetworkGatewayName string, options *VirtualNetworkGatewaysClientBeginGetBgpPeerStatusOptions) (*policy.Request, error) { 654 urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/virtualNetworkGateways/{virtualNetworkGatewayName}/getBgpPeerStatus" 655 if resourceGroupName == "" { 656 return nil, errors.New("parameter resourceGroupName cannot be empty") 657 } 658 urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) 659 if virtualNetworkGatewayName == "" { 660 return nil, errors.New("parameter virtualNetworkGatewayName cannot be empty") 661 } 662 urlPath = strings.ReplaceAll(urlPath, "{virtualNetworkGatewayName}", url.PathEscape(virtualNetworkGatewayName)) 663 if client.subscriptionID == "" { 664 return nil, errors.New("parameter client.subscriptionID cannot be empty") 665 } 666 urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) 667 req, err := runtime.NewRequest(ctx, http.MethodPost, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) 668 if err != nil { 669 return nil, err 670 } 671 reqQP := req.Raw().URL.Query() 672 reqQP.Set("api-version", "2024-05-01") 673 if options != nil && options.Peer != nil { 674 reqQP.Set("peer", *options.Peer) 675 } 676 req.Raw().URL.RawQuery = reqQP.Encode() 677 req.Raw().Header["Accept"] = []string{"application/json"} 678 return req, nil 679 } 680 681 // BeginGetFailoverAllTestDetails - This operation retrieves the details of all the failover tests performed on the gateway 682 // for different peering locations 683 // If the operation fails it returns an *azcore.ResponseError type. 684 // 685 // Generated from API version 2024-05-01 686 // - resourceGroupName - The name of the resource group. 687 // - virtualNetworkGatewayName - The name of the virtual network gateway. 688 // - typeParam - The type of failover test 689 // - fetchLatest - Fetch only the latest tests for each peering location 690 // - options - VirtualNetworkGatewaysClientBeginGetFailoverAllTestDetailsOptions contains the optional parameters for the VirtualNetworkGatewaysClient.BeginGetFailoverAllTestDetails 691 // method. 692 func (client *VirtualNetworkGatewaysClient) BeginGetFailoverAllTestDetails(ctx context.Context, resourceGroupName string, virtualNetworkGatewayName string, typeParam string, fetchLatest bool, options *VirtualNetworkGatewaysClientBeginGetFailoverAllTestDetailsOptions) (*runtime.Poller[VirtualNetworkGatewaysClientGetFailoverAllTestDetailsResponse], error) { 693 if options == nil || options.ResumeToken == "" { 694 resp, err := client.getFailoverAllTestDetails(ctx, resourceGroupName, virtualNetworkGatewayName, typeParam, fetchLatest, options) 695 if err != nil { 696 return nil, err 697 } 698 poller, err := runtime.NewPoller(resp, client.internal.Pipeline(), &runtime.NewPollerOptions[VirtualNetworkGatewaysClientGetFailoverAllTestDetailsResponse]{ 699 FinalStateVia: runtime.FinalStateViaLocation, 700 Tracer: client.internal.Tracer(), 701 }) 702 return poller, err 703 } else { 704 return runtime.NewPollerFromResumeToken(options.ResumeToken, client.internal.Pipeline(), &runtime.NewPollerFromResumeTokenOptions[VirtualNetworkGatewaysClientGetFailoverAllTestDetailsResponse]{ 705 Tracer: client.internal.Tracer(), 706 }) 707 } 708 } 709 710 // GetFailoverAllTestDetails - This operation retrieves the details of all the failover tests performed on the gateway for 711 // different peering locations 712 // If the operation fails it returns an *azcore.ResponseError type. 713 // 714 // Generated from API version 2024-05-01 715 func (client *VirtualNetworkGatewaysClient) getFailoverAllTestDetails(ctx context.Context, resourceGroupName string, virtualNetworkGatewayName string, typeParam string, fetchLatest bool, options *VirtualNetworkGatewaysClientBeginGetFailoverAllTestDetailsOptions) (*http.Response, error) { 716 var err error 717 const operationName = "VirtualNetworkGatewaysClient.BeginGetFailoverAllTestDetails" 718 ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) 719 ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) 720 defer func() { endSpan(err) }() 721 req, err := client.getFailoverAllTestDetailsCreateRequest(ctx, resourceGroupName, virtualNetworkGatewayName, typeParam, fetchLatest, options) 722 if err != nil { 723 return nil, err 724 } 725 httpResp, err := client.internal.Pipeline().Do(req) 726 if err != nil { 727 return nil, err 728 } 729 if !runtime.HasStatusCode(httpResp, http.StatusOK, http.StatusAccepted) { 730 err = runtime.NewResponseError(httpResp) 731 return nil, err 732 } 733 return httpResp, nil 734 } 735 736 // getFailoverAllTestDetailsCreateRequest creates the GetFailoverAllTestDetails request. 737 func (client *VirtualNetworkGatewaysClient) getFailoverAllTestDetailsCreateRequest(ctx context.Context, resourceGroupName string, virtualNetworkGatewayName string, typeParam string, fetchLatest bool, options *VirtualNetworkGatewaysClientBeginGetFailoverAllTestDetailsOptions) (*policy.Request, error) { 738 urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/virtualNetworkGateways/{virtualNetworkGatewayName}/getFailoverAllTestsDetails" 739 if resourceGroupName == "" { 740 return nil, errors.New("parameter resourceGroupName cannot be empty") 741 } 742 urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) 743 if virtualNetworkGatewayName == "" { 744 return nil, errors.New("parameter virtualNetworkGatewayName cannot be empty") 745 } 746 urlPath = strings.ReplaceAll(urlPath, "{virtualNetworkGatewayName}", url.PathEscape(virtualNetworkGatewayName)) 747 if client.subscriptionID == "" { 748 return nil, errors.New("parameter client.subscriptionID cannot be empty") 749 } 750 urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) 751 req, err := runtime.NewRequest(ctx, http.MethodPost, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) 752 if err != nil { 753 return nil, err 754 } 755 reqQP := req.Raw().URL.Query() 756 reqQP.Set("api-version", "2024-05-01") 757 reqQP.Set("fetchLatest", strconv.FormatBool(fetchLatest)) 758 reqQP.Set("type", typeParam) 759 req.Raw().URL.RawQuery = reqQP.Encode() 760 req.Raw().Header["Accept"] = []string{"application/json"} 761 return req, nil 762 } 763 764 // BeginGetFailoverSingleTestDetails - This operation retrieves the details of a particular failover test performed on the 765 // gateway based on the test Guid 766 // If the operation fails it returns an *azcore.ResponseError type. 767 // 768 // Generated from API version 2024-05-01 769 // - resourceGroupName - The name of the resource group. 770 // - virtualNetworkGatewayName - The name of the virtual network gateway. 771 // - peeringLocation - Peering location of the test 772 // - failoverTestID - The unique Guid value which identifies the test 773 // - options - VirtualNetworkGatewaysClientBeginGetFailoverSingleTestDetailsOptions contains the optional parameters for the 774 // VirtualNetworkGatewaysClient.BeginGetFailoverSingleTestDetails method. 775 func (client *VirtualNetworkGatewaysClient) BeginGetFailoverSingleTestDetails(ctx context.Context, resourceGroupName string, virtualNetworkGatewayName string, peeringLocation string, failoverTestID string, options *VirtualNetworkGatewaysClientBeginGetFailoverSingleTestDetailsOptions) (*runtime.Poller[VirtualNetworkGatewaysClientGetFailoverSingleTestDetailsResponse], error) { 776 if options == nil || options.ResumeToken == "" { 777 resp, err := client.getFailoverSingleTestDetails(ctx, resourceGroupName, virtualNetworkGatewayName, peeringLocation, failoverTestID, options) 778 if err != nil { 779 return nil, err 780 } 781 poller, err := runtime.NewPoller(resp, client.internal.Pipeline(), &runtime.NewPollerOptions[VirtualNetworkGatewaysClientGetFailoverSingleTestDetailsResponse]{ 782 FinalStateVia: runtime.FinalStateViaLocation, 783 Tracer: client.internal.Tracer(), 784 }) 785 return poller, err 786 } else { 787 return runtime.NewPollerFromResumeToken(options.ResumeToken, client.internal.Pipeline(), &runtime.NewPollerFromResumeTokenOptions[VirtualNetworkGatewaysClientGetFailoverSingleTestDetailsResponse]{ 788 Tracer: client.internal.Tracer(), 789 }) 790 } 791 } 792 793 // GetFailoverSingleTestDetails - This operation retrieves the details of a particular failover test performed on the gateway 794 // based on the test Guid 795 // If the operation fails it returns an *azcore.ResponseError type. 796 // 797 // Generated from API version 2024-05-01 798 func (client *VirtualNetworkGatewaysClient) getFailoverSingleTestDetails(ctx context.Context, resourceGroupName string, virtualNetworkGatewayName string, peeringLocation string, failoverTestID string, options *VirtualNetworkGatewaysClientBeginGetFailoverSingleTestDetailsOptions) (*http.Response, error) { 799 var err error 800 const operationName = "VirtualNetworkGatewaysClient.BeginGetFailoverSingleTestDetails" 801 ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) 802 ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) 803 defer func() { endSpan(err) }() 804 req, err := client.getFailoverSingleTestDetailsCreateRequest(ctx, resourceGroupName, virtualNetworkGatewayName, peeringLocation, failoverTestID, options) 805 if err != nil { 806 return nil, err 807 } 808 httpResp, err := client.internal.Pipeline().Do(req) 809 if err != nil { 810 return nil, err 811 } 812 if !runtime.HasStatusCode(httpResp, http.StatusOK, http.StatusAccepted) { 813 err = runtime.NewResponseError(httpResp) 814 return nil, err 815 } 816 return httpResp, nil 817 } 818 819 // getFailoverSingleTestDetailsCreateRequest creates the GetFailoverSingleTestDetails request. 820 func (client *VirtualNetworkGatewaysClient) getFailoverSingleTestDetailsCreateRequest(ctx context.Context, resourceGroupName string, virtualNetworkGatewayName string, peeringLocation string, failoverTestID string, options *VirtualNetworkGatewaysClientBeginGetFailoverSingleTestDetailsOptions) (*policy.Request, error) { 821 urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/virtualNetworkGateways/{virtualNetworkGatewayName}/getFailoverSingleTestDetails" 822 if resourceGroupName == "" { 823 return nil, errors.New("parameter resourceGroupName cannot be empty") 824 } 825 urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) 826 if virtualNetworkGatewayName == "" { 827 return nil, errors.New("parameter virtualNetworkGatewayName cannot be empty") 828 } 829 urlPath = strings.ReplaceAll(urlPath, "{virtualNetworkGatewayName}", url.PathEscape(virtualNetworkGatewayName)) 830 if client.subscriptionID == "" { 831 return nil, errors.New("parameter client.subscriptionID cannot be empty") 832 } 833 urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) 834 req, err := runtime.NewRequest(ctx, http.MethodPost, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) 835 if err != nil { 836 return nil, err 837 } 838 reqQP := req.Raw().URL.Query() 839 reqQP.Set("api-version", "2024-05-01") 840 reqQP.Set("failoverTestId", failoverTestID) 841 reqQP.Set("peeringLocation", peeringLocation) 842 req.Raw().URL.RawQuery = reqQP.Encode() 843 req.Raw().Header["Accept"] = []string{"application/json"} 844 return req, nil 845 } 846 847 // BeginGetLearnedRoutes - This operation retrieves a list of routes the virtual network gateway has learned, including routes 848 // learned from BGP peers. 849 // If the operation fails it returns an *azcore.ResponseError type. 850 // 851 // Generated from API version 2024-05-01 852 // - resourceGroupName - The name of the resource group. 853 // - virtualNetworkGatewayName - The name of the virtual network gateway. 854 // - options - VirtualNetworkGatewaysClientBeginGetLearnedRoutesOptions contains the optional parameters for the VirtualNetworkGatewaysClient.BeginGetLearnedRoutes 855 // method. 856 func (client *VirtualNetworkGatewaysClient) BeginGetLearnedRoutes(ctx context.Context, resourceGroupName string, virtualNetworkGatewayName string, options *VirtualNetworkGatewaysClientBeginGetLearnedRoutesOptions) (*runtime.Poller[VirtualNetworkGatewaysClientGetLearnedRoutesResponse], error) { 857 if options == nil || options.ResumeToken == "" { 858 resp, err := client.getLearnedRoutes(ctx, resourceGroupName, virtualNetworkGatewayName, options) 859 if err != nil { 860 return nil, err 861 } 862 poller, err := runtime.NewPoller(resp, client.internal.Pipeline(), &runtime.NewPollerOptions[VirtualNetworkGatewaysClientGetLearnedRoutesResponse]{ 863 FinalStateVia: runtime.FinalStateViaLocation, 864 Tracer: client.internal.Tracer(), 865 }) 866 return poller, err 867 } else { 868 return runtime.NewPollerFromResumeToken(options.ResumeToken, client.internal.Pipeline(), &runtime.NewPollerFromResumeTokenOptions[VirtualNetworkGatewaysClientGetLearnedRoutesResponse]{ 869 Tracer: client.internal.Tracer(), 870 }) 871 } 872 } 873 874 // GetLearnedRoutes - This operation retrieves a list of routes the virtual network gateway has learned, including routes 875 // learned from BGP peers. 876 // If the operation fails it returns an *azcore.ResponseError type. 877 // 878 // Generated from API version 2024-05-01 879 func (client *VirtualNetworkGatewaysClient) getLearnedRoutes(ctx context.Context, resourceGroupName string, virtualNetworkGatewayName string, options *VirtualNetworkGatewaysClientBeginGetLearnedRoutesOptions) (*http.Response, error) { 880 var err error 881 const operationName = "VirtualNetworkGatewaysClient.BeginGetLearnedRoutes" 882 ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) 883 ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) 884 defer func() { endSpan(err) }() 885 req, err := client.getLearnedRoutesCreateRequest(ctx, resourceGroupName, virtualNetworkGatewayName, options) 886 if err != nil { 887 return nil, err 888 } 889 httpResp, err := client.internal.Pipeline().Do(req) 890 if err != nil { 891 return nil, err 892 } 893 if !runtime.HasStatusCode(httpResp, http.StatusOK, http.StatusAccepted) { 894 err = runtime.NewResponseError(httpResp) 895 return nil, err 896 } 897 return httpResp, nil 898 } 899 900 // getLearnedRoutesCreateRequest creates the GetLearnedRoutes request. 901 func (client *VirtualNetworkGatewaysClient) getLearnedRoutesCreateRequest(ctx context.Context, resourceGroupName string, virtualNetworkGatewayName string, options *VirtualNetworkGatewaysClientBeginGetLearnedRoutesOptions) (*policy.Request, error) { 902 urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/virtualNetworkGateways/{virtualNetworkGatewayName}/getLearnedRoutes" 903 if resourceGroupName == "" { 904 return nil, errors.New("parameter resourceGroupName cannot be empty") 905 } 906 urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) 907 if virtualNetworkGatewayName == "" { 908 return nil, errors.New("parameter virtualNetworkGatewayName cannot be empty") 909 } 910 urlPath = strings.ReplaceAll(urlPath, "{virtualNetworkGatewayName}", url.PathEscape(virtualNetworkGatewayName)) 911 if client.subscriptionID == "" { 912 return nil, errors.New("parameter client.subscriptionID cannot be empty") 913 } 914 urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) 915 req, err := runtime.NewRequest(ctx, http.MethodPost, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) 916 if err != nil { 917 return nil, err 918 } 919 reqQP := req.Raw().URL.Query() 920 reqQP.Set("api-version", "2024-05-01") 921 req.Raw().URL.RawQuery = reqQP.Encode() 922 req.Raw().Header["Accept"] = []string{"application/json"} 923 return req, nil 924 } 925 926 // BeginGetVPNProfilePackageURL - Gets pre-generated VPN profile for P2S client of the virtual network gateway in the specified 927 // resource group. The profile needs to be generated first using generateVpnProfile. 928 // If the operation fails it returns an *azcore.ResponseError type. 929 // 930 // Generated from API version 2024-05-01 931 // - resourceGroupName - The name of the resource group. 932 // - virtualNetworkGatewayName - The name of the virtual network gateway. 933 // - options - VirtualNetworkGatewaysClientBeginGetVPNProfilePackageURLOptions contains the optional parameters for the VirtualNetworkGatewaysClient.BeginGetVPNProfilePackageURL 934 // method. 935 func (client *VirtualNetworkGatewaysClient) BeginGetVPNProfilePackageURL(ctx context.Context, resourceGroupName string, virtualNetworkGatewayName string, options *VirtualNetworkGatewaysClientBeginGetVPNProfilePackageURLOptions) (*runtime.Poller[VirtualNetworkGatewaysClientGetVPNProfilePackageURLResponse], error) { 936 if options == nil || options.ResumeToken == "" { 937 resp, err := client.getVPNProfilePackageURL(ctx, resourceGroupName, virtualNetworkGatewayName, options) 938 if err != nil { 939 return nil, err 940 } 941 poller, err := runtime.NewPoller(resp, client.internal.Pipeline(), &runtime.NewPollerOptions[VirtualNetworkGatewaysClientGetVPNProfilePackageURLResponse]{ 942 FinalStateVia: runtime.FinalStateViaLocation, 943 Tracer: client.internal.Tracer(), 944 }) 945 return poller, err 946 } else { 947 return runtime.NewPollerFromResumeToken(options.ResumeToken, client.internal.Pipeline(), &runtime.NewPollerFromResumeTokenOptions[VirtualNetworkGatewaysClientGetVPNProfilePackageURLResponse]{ 948 Tracer: client.internal.Tracer(), 949 }) 950 } 951 } 952 953 // GetVPNProfilePackageURL - Gets pre-generated VPN profile for P2S client of the virtual network gateway in the specified 954 // resource group. The profile needs to be generated first using generateVpnProfile. 955 // If the operation fails it returns an *azcore.ResponseError type. 956 // 957 // Generated from API version 2024-05-01 958 func (client *VirtualNetworkGatewaysClient) getVPNProfilePackageURL(ctx context.Context, resourceGroupName string, virtualNetworkGatewayName string, options *VirtualNetworkGatewaysClientBeginGetVPNProfilePackageURLOptions) (*http.Response, error) { 959 var err error 960 const operationName = "VirtualNetworkGatewaysClient.BeginGetVPNProfilePackageURL" 961 ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) 962 ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) 963 defer func() { endSpan(err) }() 964 req, err := client.getVPNProfilePackageURLCreateRequest(ctx, resourceGroupName, virtualNetworkGatewayName, options) 965 if err != nil { 966 return nil, err 967 } 968 httpResp, err := client.internal.Pipeline().Do(req) 969 if err != nil { 970 return nil, err 971 } 972 if !runtime.HasStatusCode(httpResp, http.StatusOK, http.StatusAccepted) { 973 err = runtime.NewResponseError(httpResp) 974 return nil, err 975 } 976 return httpResp, nil 977 } 978 979 // getVPNProfilePackageURLCreateRequest creates the GetVPNProfilePackageURL request. 980 func (client *VirtualNetworkGatewaysClient) getVPNProfilePackageURLCreateRequest(ctx context.Context, resourceGroupName string, virtualNetworkGatewayName string, options *VirtualNetworkGatewaysClientBeginGetVPNProfilePackageURLOptions) (*policy.Request, error) { 981 urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/virtualNetworkGateways/{virtualNetworkGatewayName}/getvpnprofilepackageurl" 982 if resourceGroupName == "" { 983 return nil, errors.New("parameter resourceGroupName cannot be empty") 984 } 985 urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) 986 if virtualNetworkGatewayName == "" { 987 return nil, errors.New("parameter virtualNetworkGatewayName cannot be empty") 988 } 989 urlPath = strings.ReplaceAll(urlPath, "{virtualNetworkGatewayName}", url.PathEscape(virtualNetworkGatewayName)) 990 if client.subscriptionID == "" { 991 return nil, errors.New("parameter client.subscriptionID cannot be empty") 992 } 993 urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) 994 req, err := runtime.NewRequest(ctx, http.MethodPost, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) 995 if err != nil { 996 return nil, err 997 } 998 reqQP := req.Raw().URL.Query() 999 reqQP.Set("api-version", "2024-05-01") 1000 req.Raw().URL.RawQuery = reqQP.Encode() 1001 req.Raw().Header["Accept"] = []string{"application/json"} 1002 return req, nil 1003 } 1004 1005 // BeginGetVpnclientConnectionHealth - Get VPN client connection health detail per P2S client connection of the virtual network 1006 // gateway in the specified resource group. 1007 // If the operation fails it returns an *azcore.ResponseError type. 1008 // 1009 // Generated from API version 2024-05-01 1010 // - resourceGroupName - The name of the resource group. 1011 // - virtualNetworkGatewayName - The name of the virtual network gateway. 1012 // - options - VirtualNetworkGatewaysClientBeginGetVpnclientConnectionHealthOptions contains the optional parameters for the 1013 // VirtualNetworkGatewaysClient.BeginGetVpnclientConnectionHealth method. 1014 func (client *VirtualNetworkGatewaysClient) BeginGetVpnclientConnectionHealth(ctx context.Context, resourceGroupName string, virtualNetworkGatewayName string, options *VirtualNetworkGatewaysClientBeginGetVpnclientConnectionHealthOptions) (*runtime.Poller[VirtualNetworkGatewaysClientGetVpnclientConnectionHealthResponse], error) { 1015 if options == nil || options.ResumeToken == "" { 1016 resp, err := client.getVpnclientConnectionHealth(ctx, resourceGroupName, virtualNetworkGatewayName, options) 1017 if err != nil { 1018 return nil, err 1019 } 1020 poller, err := runtime.NewPoller(resp, client.internal.Pipeline(), &runtime.NewPollerOptions[VirtualNetworkGatewaysClientGetVpnclientConnectionHealthResponse]{ 1021 FinalStateVia: runtime.FinalStateViaLocation, 1022 Tracer: client.internal.Tracer(), 1023 }) 1024 return poller, err 1025 } else { 1026 return runtime.NewPollerFromResumeToken(options.ResumeToken, client.internal.Pipeline(), &runtime.NewPollerFromResumeTokenOptions[VirtualNetworkGatewaysClientGetVpnclientConnectionHealthResponse]{ 1027 Tracer: client.internal.Tracer(), 1028 }) 1029 } 1030 } 1031 1032 // GetVpnclientConnectionHealth - Get VPN client connection health detail per P2S client connection of the virtual network 1033 // gateway in the specified resource group. 1034 // If the operation fails it returns an *azcore.ResponseError type. 1035 // 1036 // Generated from API version 2024-05-01 1037 func (client *VirtualNetworkGatewaysClient) getVpnclientConnectionHealth(ctx context.Context, resourceGroupName string, virtualNetworkGatewayName string, options *VirtualNetworkGatewaysClientBeginGetVpnclientConnectionHealthOptions) (*http.Response, error) { 1038 var err error 1039 const operationName = "VirtualNetworkGatewaysClient.BeginGetVpnclientConnectionHealth" 1040 ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) 1041 ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) 1042 defer func() { endSpan(err) }() 1043 req, err := client.getVpnclientConnectionHealthCreateRequest(ctx, resourceGroupName, virtualNetworkGatewayName, options) 1044 if err != nil { 1045 return nil, err 1046 } 1047 httpResp, err := client.internal.Pipeline().Do(req) 1048 if err != nil { 1049 return nil, err 1050 } 1051 if !runtime.HasStatusCode(httpResp, http.StatusOK, http.StatusAccepted) { 1052 err = runtime.NewResponseError(httpResp) 1053 return nil, err 1054 } 1055 return httpResp, nil 1056 } 1057 1058 // getVpnclientConnectionHealthCreateRequest creates the GetVpnclientConnectionHealth request. 1059 func (client *VirtualNetworkGatewaysClient) getVpnclientConnectionHealthCreateRequest(ctx context.Context, resourceGroupName string, virtualNetworkGatewayName string, options *VirtualNetworkGatewaysClientBeginGetVpnclientConnectionHealthOptions) (*policy.Request, error) { 1060 urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/virtualNetworkGateways/{virtualNetworkGatewayName}/getVpnClientConnectionHealth" 1061 if resourceGroupName == "" { 1062 return nil, errors.New("parameter resourceGroupName cannot be empty") 1063 } 1064 urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) 1065 if virtualNetworkGatewayName == "" { 1066 return nil, errors.New("parameter virtualNetworkGatewayName cannot be empty") 1067 } 1068 urlPath = strings.ReplaceAll(urlPath, "{virtualNetworkGatewayName}", url.PathEscape(virtualNetworkGatewayName)) 1069 if client.subscriptionID == "" { 1070 return nil, errors.New("parameter client.subscriptionID cannot be empty") 1071 } 1072 urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) 1073 req, err := runtime.NewRequest(ctx, http.MethodPost, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) 1074 if err != nil { 1075 return nil, err 1076 } 1077 reqQP := req.Raw().URL.Query() 1078 reqQP.Set("api-version", "2024-05-01") 1079 req.Raw().URL.RawQuery = reqQP.Encode() 1080 req.Raw().Header["Accept"] = []string{"application/json"} 1081 return req, nil 1082 } 1083 1084 // BeginGetVpnclientIPSecParameters - The Get VpnclientIpsecParameters operation retrieves information about the vpnclient 1085 // ipsec policy for P2S client of virtual network gateway in the specified resource group through Network resource 1086 // provider. 1087 // If the operation fails it returns an *azcore.ResponseError type. 1088 // 1089 // Generated from API version 2024-05-01 1090 // - resourceGroupName - The name of the resource group. 1091 // - virtualNetworkGatewayName - The virtual network gateway name. 1092 // - options - VirtualNetworkGatewaysClientBeginGetVpnclientIPSecParametersOptions contains the optional parameters for the 1093 // VirtualNetworkGatewaysClient.BeginGetVpnclientIPSecParameters method. 1094 func (client *VirtualNetworkGatewaysClient) BeginGetVpnclientIPSecParameters(ctx context.Context, resourceGroupName string, virtualNetworkGatewayName string, options *VirtualNetworkGatewaysClientBeginGetVpnclientIPSecParametersOptions) (*runtime.Poller[VirtualNetworkGatewaysClientGetVpnclientIPSecParametersResponse], error) { 1095 if options == nil || options.ResumeToken == "" { 1096 resp, err := client.getVpnclientIPSecParameters(ctx, resourceGroupName, virtualNetworkGatewayName, options) 1097 if err != nil { 1098 return nil, err 1099 } 1100 poller, err := runtime.NewPoller(resp, client.internal.Pipeline(), &runtime.NewPollerOptions[VirtualNetworkGatewaysClientGetVpnclientIPSecParametersResponse]{ 1101 FinalStateVia: runtime.FinalStateViaLocation, 1102 Tracer: client.internal.Tracer(), 1103 }) 1104 return poller, err 1105 } else { 1106 return runtime.NewPollerFromResumeToken(options.ResumeToken, client.internal.Pipeline(), &runtime.NewPollerFromResumeTokenOptions[VirtualNetworkGatewaysClientGetVpnclientIPSecParametersResponse]{ 1107 Tracer: client.internal.Tracer(), 1108 }) 1109 } 1110 } 1111 1112 // GetVpnclientIPSecParameters - The Get VpnclientIpsecParameters operation retrieves information about the vpnclient ipsec 1113 // policy for P2S client of virtual network gateway in the specified resource group through Network resource 1114 // provider. 1115 // If the operation fails it returns an *azcore.ResponseError type. 1116 // 1117 // Generated from API version 2024-05-01 1118 func (client *VirtualNetworkGatewaysClient) getVpnclientIPSecParameters(ctx context.Context, resourceGroupName string, virtualNetworkGatewayName string, options *VirtualNetworkGatewaysClientBeginGetVpnclientIPSecParametersOptions) (*http.Response, error) { 1119 var err error 1120 const operationName = "VirtualNetworkGatewaysClient.BeginGetVpnclientIPSecParameters" 1121 ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) 1122 ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) 1123 defer func() { endSpan(err) }() 1124 req, err := client.getVpnclientIPSecParametersCreateRequest(ctx, resourceGroupName, virtualNetworkGatewayName, options) 1125 if err != nil { 1126 return nil, err 1127 } 1128 httpResp, err := client.internal.Pipeline().Do(req) 1129 if err != nil { 1130 return nil, err 1131 } 1132 if !runtime.HasStatusCode(httpResp, http.StatusOK) { 1133 err = runtime.NewResponseError(httpResp) 1134 return nil, err 1135 } 1136 return httpResp, nil 1137 } 1138 1139 // getVpnclientIPSecParametersCreateRequest creates the GetVpnclientIPSecParameters request. 1140 func (client *VirtualNetworkGatewaysClient) getVpnclientIPSecParametersCreateRequest(ctx context.Context, resourceGroupName string, virtualNetworkGatewayName string, options *VirtualNetworkGatewaysClientBeginGetVpnclientIPSecParametersOptions) (*policy.Request, error) { 1141 urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/virtualNetworkGateways/{virtualNetworkGatewayName}/getvpnclientipsecparameters" 1142 if resourceGroupName == "" { 1143 return nil, errors.New("parameter resourceGroupName cannot be empty") 1144 } 1145 urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) 1146 if virtualNetworkGatewayName == "" { 1147 return nil, errors.New("parameter virtualNetworkGatewayName cannot be empty") 1148 } 1149 urlPath = strings.ReplaceAll(urlPath, "{virtualNetworkGatewayName}", url.PathEscape(virtualNetworkGatewayName)) 1150 if client.subscriptionID == "" { 1151 return nil, errors.New("parameter client.subscriptionID cannot be empty") 1152 } 1153 urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) 1154 req, err := runtime.NewRequest(ctx, http.MethodPost, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) 1155 if err != nil { 1156 return nil, err 1157 } 1158 reqQP := req.Raw().URL.Query() 1159 reqQP.Set("api-version", "2024-05-01") 1160 req.Raw().URL.RawQuery = reqQP.Encode() 1161 req.Raw().Header["Accept"] = []string{"application/json"} 1162 return req, nil 1163 } 1164 1165 // NewListPager - Gets all virtual network gateways by resource group. 1166 // 1167 // Generated from API version 2024-05-01 1168 // - resourceGroupName - The name of the resource group. 1169 // - options - VirtualNetworkGatewaysClientListOptions contains the optional parameters for the VirtualNetworkGatewaysClient.NewListPager 1170 // method. 1171 func (client *VirtualNetworkGatewaysClient) NewListPager(resourceGroupName string, options *VirtualNetworkGatewaysClientListOptions) *runtime.Pager[VirtualNetworkGatewaysClientListResponse] { 1172 return runtime.NewPager(runtime.PagingHandler[VirtualNetworkGatewaysClientListResponse]{ 1173 More: func(page VirtualNetworkGatewaysClientListResponse) bool { 1174 return page.NextLink != nil && len(*page.NextLink) > 0 1175 }, 1176 Fetcher: func(ctx context.Context, page *VirtualNetworkGatewaysClientListResponse) (VirtualNetworkGatewaysClientListResponse, error) { 1177 ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, "VirtualNetworkGatewaysClient.NewListPager") 1178 nextLink := "" 1179 if page != nil { 1180 nextLink = *page.NextLink 1181 } 1182 resp, err := runtime.FetcherForNextLink(ctx, client.internal.Pipeline(), nextLink, func(ctx context.Context) (*policy.Request, error) { 1183 return client.listCreateRequest(ctx, resourceGroupName, options) 1184 }, nil) 1185 if err != nil { 1186 return VirtualNetworkGatewaysClientListResponse{}, err 1187 } 1188 return client.listHandleResponse(resp) 1189 }, 1190 Tracer: client.internal.Tracer(), 1191 }) 1192 } 1193 1194 // listCreateRequest creates the List request. 1195 func (client *VirtualNetworkGatewaysClient) listCreateRequest(ctx context.Context, resourceGroupName string, options *VirtualNetworkGatewaysClientListOptions) (*policy.Request, error) { 1196 urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/virtualNetworkGateways" 1197 if resourceGroupName == "" { 1198 return nil, errors.New("parameter resourceGroupName cannot be empty") 1199 } 1200 urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) 1201 if client.subscriptionID == "" { 1202 return nil, errors.New("parameter client.subscriptionID cannot be empty") 1203 } 1204 urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) 1205 req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) 1206 if err != nil { 1207 return nil, err 1208 } 1209 reqQP := req.Raw().URL.Query() 1210 reqQP.Set("api-version", "2024-05-01") 1211 req.Raw().URL.RawQuery = reqQP.Encode() 1212 req.Raw().Header["Accept"] = []string{"application/json"} 1213 return req, nil 1214 } 1215 1216 // listHandleResponse handles the List response. 1217 func (client *VirtualNetworkGatewaysClient) listHandleResponse(resp *http.Response) (VirtualNetworkGatewaysClientListResponse, error) { 1218 result := VirtualNetworkGatewaysClientListResponse{} 1219 if err := runtime.UnmarshalAsJSON(resp, &result.VirtualNetworkGatewayListResult); err != nil { 1220 return VirtualNetworkGatewaysClientListResponse{}, err 1221 } 1222 return result, nil 1223 } 1224 1225 // NewListConnectionsPager - Gets all the connections in a virtual network gateway. 1226 // 1227 // Generated from API version 2024-05-01 1228 // - resourceGroupName - The name of the resource group. 1229 // - virtualNetworkGatewayName - The name of the virtual network gateway. 1230 // - options - VirtualNetworkGatewaysClientListConnectionsOptions contains the optional parameters for the VirtualNetworkGatewaysClient.NewListConnectionsPager 1231 // method. 1232 func (client *VirtualNetworkGatewaysClient) NewListConnectionsPager(resourceGroupName string, virtualNetworkGatewayName string, options *VirtualNetworkGatewaysClientListConnectionsOptions) *runtime.Pager[VirtualNetworkGatewaysClientListConnectionsResponse] { 1233 return runtime.NewPager(runtime.PagingHandler[VirtualNetworkGatewaysClientListConnectionsResponse]{ 1234 More: func(page VirtualNetworkGatewaysClientListConnectionsResponse) bool { 1235 return page.NextLink != nil && len(*page.NextLink) > 0 1236 }, 1237 Fetcher: func(ctx context.Context, page *VirtualNetworkGatewaysClientListConnectionsResponse) (VirtualNetworkGatewaysClientListConnectionsResponse, error) { 1238 ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, "VirtualNetworkGatewaysClient.NewListConnectionsPager") 1239 nextLink := "" 1240 if page != nil { 1241 nextLink = *page.NextLink 1242 } 1243 resp, err := runtime.FetcherForNextLink(ctx, client.internal.Pipeline(), nextLink, func(ctx context.Context) (*policy.Request, error) { 1244 return client.listConnectionsCreateRequest(ctx, resourceGroupName, virtualNetworkGatewayName, options) 1245 }, nil) 1246 if err != nil { 1247 return VirtualNetworkGatewaysClientListConnectionsResponse{}, err 1248 } 1249 return client.listConnectionsHandleResponse(resp) 1250 }, 1251 Tracer: client.internal.Tracer(), 1252 }) 1253 } 1254 1255 // listConnectionsCreateRequest creates the ListConnections request. 1256 func (client *VirtualNetworkGatewaysClient) listConnectionsCreateRequest(ctx context.Context, resourceGroupName string, virtualNetworkGatewayName string, options *VirtualNetworkGatewaysClientListConnectionsOptions) (*policy.Request, error) { 1257 urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/virtualNetworkGateways/{virtualNetworkGatewayName}/connections" 1258 if resourceGroupName == "" { 1259 return nil, errors.New("parameter resourceGroupName cannot be empty") 1260 } 1261 urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) 1262 if virtualNetworkGatewayName == "" { 1263 return nil, errors.New("parameter virtualNetworkGatewayName cannot be empty") 1264 } 1265 urlPath = strings.ReplaceAll(urlPath, "{virtualNetworkGatewayName}", url.PathEscape(virtualNetworkGatewayName)) 1266 if client.subscriptionID == "" { 1267 return nil, errors.New("parameter client.subscriptionID cannot be empty") 1268 } 1269 urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) 1270 req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) 1271 if err != nil { 1272 return nil, err 1273 } 1274 reqQP := req.Raw().URL.Query() 1275 reqQP.Set("api-version", "2024-05-01") 1276 req.Raw().URL.RawQuery = reqQP.Encode() 1277 req.Raw().Header["Accept"] = []string{"application/json"} 1278 return req, nil 1279 } 1280 1281 // listConnectionsHandleResponse handles the ListConnections response. 1282 func (client *VirtualNetworkGatewaysClient) listConnectionsHandleResponse(resp *http.Response) (VirtualNetworkGatewaysClientListConnectionsResponse, error) { 1283 result := VirtualNetworkGatewaysClientListConnectionsResponse{} 1284 if err := runtime.UnmarshalAsJSON(resp, &result.VirtualNetworkGatewayListConnectionsResult); err != nil { 1285 return VirtualNetworkGatewaysClientListConnectionsResponse{}, err 1286 } 1287 return result, nil 1288 } 1289 1290 // BeginReset - Resets the primary of the virtual network gateway in the specified resource group. 1291 // If the operation fails it returns an *azcore.ResponseError type. 1292 // 1293 // Generated from API version 2024-05-01 1294 // - resourceGroupName - The name of the resource group. 1295 // - virtualNetworkGatewayName - The name of the virtual network gateway. 1296 // - options - VirtualNetworkGatewaysClientBeginResetOptions contains the optional parameters for the VirtualNetworkGatewaysClient.BeginReset 1297 // method. 1298 func (client *VirtualNetworkGatewaysClient) BeginReset(ctx context.Context, resourceGroupName string, virtualNetworkGatewayName string, options *VirtualNetworkGatewaysClientBeginResetOptions) (*runtime.Poller[VirtualNetworkGatewaysClientResetResponse], error) { 1299 if options == nil || options.ResumeToken == "" { 1300 resp, err := client.reset(ctx, resourceGroupName, virtualNetworkGatewayName, options) 1301 if err != nil { 1302 return nil, err 1303 } 1304 poller, err := runtime.NewPoller(resp, client.internal.Pipeline(), &runtime.NewPollerOptions[VirtualNetworkGatewaysClientResetResponse]{ 1305 FinalStateVia: runtime.FinalStateViaLocation, 1306 Tracer: client.internal.Tracer(), 1307 }) 1308 return poller, err 1309 } else { 1310 return runtime.NewPollerFromResumeToken(options.ResumeToken, client.internal.Pipeline(), &runtime.NewPollerFromResumeTokenOptions[VirtualNetworkGatewaysClientResetResponse]{ 1311 Tracer: client.internal.Tracer(), 1312 }) 1313 } 1314 } 1315 1316 // Reset - Resets the primary of the virtual network gateway in the specified resource group. 1317 // If the operation fails it returns an *azcore.ResponseError type. 1318 // 1319 // Generated from API version 2024-05-01 1320 func (client *VirtualNetworkGatewaysClient) reset(ctx context.Context, resourceGroupName string, virtualNetworkGatewayName string, options *VirtualNetworkGatewaysClientBeginResetOptions) (*http.Response, error) { 1321 var err error 1322 const operationName = "VirtualNetworkGatewaysClient.BeginReset" 1323 ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) 1324 ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) 1325 defer func() { endSpan(err) }() 1326 req, err := client.resetCreateRequest(ctx, resourceGroupName, virtualNetworkGatewayName, options) 1327 if err != nil { 1328 return nil, err 1329 } 1330 httpResp, err := client.internal.Pipeline().Do(req) 1331 if err != nil { 1332 return nil, err 1333 } 1334 if !runtime.HasStatusCode(httpResp, http.StatusOK, http.StatusAccepted) { 1335 err = runtime.NewResponseError(httpResp) 1336 return nil, err 1337 } 1338 return httpResp, nil 1339 } 1340 1341 // resetCreateRequest creates the Reset request. 1342 func (client *VirtualNetworkGatewaysClient) resetCreateRequest(ctx context.Context, resourceGroupName string, virtualNetworkGatewayName string, options *VirtualNetworkGatewaysClientBeginResetOptions) (*policy.Request, error) { 1343 urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/virtualNetworkGateways/{virtualNetworkGatewayName}/reset" 1344 if resourceGroupName == "" { 1345 return nil, errors.New("parameter resourceGroupName cannot be empty") 1346 } 1347 urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) 1348 if virtualNetworkGatewayName == "" { 1349 return nil, errors.New("parameter virtualNetworkGatewayName cannot be empty") 1350 } 1351 urlPath = strings.ReplaceAll(urlPath, "{virtualNetworkGatewayName}", url.PathEscape(virtualNetworkGatewayName)) 1352 if client.subscriptionID == "" { 1353 return nil, errors.New("parameter client.subscriptionID cannot be empty") 1354 } 1355 urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) 1356 req, err := runtime.NewRequest(ctx, http.MethodPost, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) 1357 if err != nil { 1358 return nil, err 1359 } 1360 reqQP := req.Raw().URL.Query() 1361 reqQP.Set("api-version", "2024-05-01") 1362 if options != nil && options.GatewayVip != nil { 1363 reqQP.Set("gatewayVip", *options.GatewayVip) 1364 } 1365 req.Raw().URL.RawQuery = reqQP.Encode() 1366 req.Raw().Header["Accept"] = []string{"application/json"} 1367 return req, nil 1368 } 1369 1370 // BeginResetVPNClientSharedKey - Resets the VPN client shared key of the virtual network gateway in the specified resource 1371 // group. 1372 // If the operation fails it returns an *azcore.ResponseError type. 1373 // 1374 // Generated from API version 2024-05-01 1375 // - resourceGroupName - The name of the resource group. 1376 // - virtualNetworkGatewayName - The name of the virtual network gateway. 1377 // - options - VirtualNetworkGatewaysClientBeginResetVPNClientSharedKeyOptions contains the optional parameters for the VirtualNetworkGatewaysClient.BeginResetVPNClientSharedKey 1378 // method. 1379 func (client *VirtualNetworkGatewaysClient) BeginResetVPNClientSharedKey(ctx context.Context, resourceGroupName string, virtualNetworkGatewayName string, options *VirtualNetworkGatewaysClientBeginResetVPNClientSharedKeyOptions) (*runtime.Poller[VirtualNetworkGatewaysClientResetVPNClientSharedKeyResponse], error) { 1380 if options == nil || options.ResumeToken == "" { 1381 resp, err := client.resetVPNClientSharedKey(ctx, resourceGroupName, virtualNetworkGatewayName, options) 1382 if err != nil { 1383 return nil, err 1384 } 1385 poller, err := runtime.NewPoller(resp, client.internal.Pipeline(), &runtime.NewPollerOptions[VirtualNetworkGatewaysClientResetVPNClientSharedKeyResponse]{ 1386 FinalStateVia: runtime.FinalStateViaLocation, 1387 Tracer: client.internal.Tracer(), 1388 }) 1389 return poller, err 1390 } else { 1391 return runtime.NewPollerFromResumeToken(options.ResumeToken, client.internal.Pipeline(), &runtime.NewPollerFromResumeTokenOptions[VirtualNetworkGatewaysClientResetVPNClientSharedKeyResponse]{ 1392 Tracer: client.internal.Tracer(), 1393 }) 1394 } 1395 } 1396 1397 // ResetVPNClientSharedKey - Resets the VPN client shared key of the virtual network gateway in the specified resource group. 1398 // If the operation fails it returns an *azcore.ResponseError type. 1399 // 1400 // Generated from API version 2024-05-01 1401 func (client *VirtualNetworkGatewaysClient) resetVPNClientSharedKey(ctx context.Context, resourceGroupName string, virtualNetworkGatewayName string, options *VirtualNetworkGatewaysClientBeginResetVPNClientSharedKeyOptions) (*http.Response, error) { 1402 var err error 1403 const operationName = "VirtualNetworkGatewaysClient.BeginResetVPNClientSharedKey" 1404 ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) 1405 ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) 1406 defer func() { endSpan(err) }() 1407 req, err := client.resetVPNClientSharedKeyCreateRequest(ctx, resourceGroupName, virtualNetworkGatewayName, options) 1408 if err != nil { 1409 return nil, err 1410 } 1411 httpResp, err := client.internal.Pipeline().Do(req) 1412 if err != nil { 1413 return nil, err 1414 } 1415 if !runtime.HasStatusCode(httpResp, http.StatusOK, http.StatusAccepted) { 1416 err = runtime.NewResponseError(httpResp) 1417 return nil, err 1418 } 1419 return httpResp, nil 1420 } 1421 1422 // resetVPNClientSharedKeyCreateRequest creates the ResetVPNClientSharedKey request. 1423 func (client *VirtualNetworkGatewaysClient) resetVPNClientSharedKeyCreateRequest(ctx context.Context, resourceGroupName string, virtualNetworkGatewayName string, options *VirtualNetworkGatewaysClientBeginResetVPNClientSharedKeyOptions) (*policy.Request, error) { 1424 urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/virtualNetworkGateways/{virtualNetworkGatewayName}/resetvpnclientsharedkey" 1425 if resourceGroupName == "" { 1426 return nil, errors.New("parameter resourceGroupName cannot be empty") 1427 } 1428 urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) 1429 if virtualNetworkGatewayName == "" { 1430 return nil, errors.New("parameter virtualNetworkGatewayName cannot be empty") 1431 } 1432 urlPath = strings.ReplaceAll(urlPath, "{virtualNetworkGatewayName}", url.PathEscape(virtualNetworkGatewayName)) 1433 if client.subscriptionID == "" { 1434 return nil, errors.New("parameter client.subscriptionID cannot be empty") 1435 } 1436 urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) 1437 req, err := runtime.NewRequest(ctx, http.MethodPost, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) 1438 if err != nil { 1439 return nil, err 1440 } 1441 reqQP := req.Raw().URL.Query() 1442 reqQP.Set("api-version", "2024-05-01") 1443 req.Raw().URL.RawQuery = reqQP.Encode() 1444 req.Raw().Header["Accept"] = []string{"application/json"} 1445 return req, nil 1446 } 1447 1448 // BeginSetVpnclientIPSecParameters - The Set VpnclientIpsecParameters operation sets the vpnclient ipsec policy for P2S client 1449 // of virtual network gateway in the specified resource group through Network resource provider. 1450 // If the operation fails it returns an *azcore.ResponseError type. 1451 // 1452 // Generated from API version 2024-05-01 1453 // - resourceGroupName - The name of the resource group. 1454 // - virtualNetworkGatewayName - The name of the virtual network gateway. 1455 // - vpnclientIPSecParams - Parameters supplied to the Begin Set vpnclient ipsec parameters of Virtual Network Gateway P2S client 1456 // operation through Network resource provider. 1457 // - options - VirtualNetworkGatewaysClientBeginSetVpnclientIPSecParametersOptions contains the optional parameters for the 1458 // VirtualNetworkGatewaysClient.BeginSetVpnclientIPSecParameters method. 1459 func (client *VirtualNetworkGatewaysClient) BeginSetVpnclientIPSecParameters(ctx context.Context, resourceGroupName string, virtualNetworkGatewayName string, vpnclientIPSecParams VPNClientIPsecParameters, options *VirtualNetworkGatewaysClientBeginSetVpnclientIPSecParametersOptions) (*runtime.Poller[VirtualNetworkGatewaysClientSetVpnclientIPSecParametersResponse], error) { 1460 if options == nil || options.ResumeToken == "" { 1461 resp, err := client.setVpnclientIPSecParameters(ctx, resourceGroupName, virtualNetworkGatewayName, vpnclientIPSecParams, options) 1462 if err != nil { 1463 return nil, err 1464 } 1465 poller, err := runtime.NewPoller(resp, client.internal.Pipeline(), &runtime.NewPollerOptions[VirtualNetworkGatewaysClientSetVpnclientIPSecParametersResponse]{ 1466 FinalStateVia: runtime.FinalStateViaLocation, 1467 Tracer: client.internal.Tracer(), 1468 }) 1469 return poller, err 1470 } else { 1471 return runtime.NewPollerFromResumeToken(options.ResumeToken, client.internal.Pipeline(), &runtime.NewPollerFromResumeTokenOptions[VirtualNetworkGatewaysClientSetVpnclientIPSecParametersResponse]{ 1472 Tracer: client.internal.Tracer(), 1473 }) 1474 } 1475 } 1476 1477 // SetVpnclientIPSecParameters - The Set VpnclientIpsecParameters operation sets the vpnclient ipsec policy for P2S client 1478 // of virtual network gateway in the specified resource group through Network resource provider. 1479 // If the operation fails it returns an *azcore.ResponseError type. 1480 // 1481 // Generated from API version 2024-05-01 1482 func (client *VirtualNetworkGatewaysClient) setVpnclientIPSecParameters(ctx context.Context, resourceGroupName string, virtualNetworkGatewayName string, vpnclientIPSecParams VPNClientIPsecParameters, options *VirtualNetworkGatewaysClientBeginSetVpnclientIPSecParametersOptions) (*http.Response, error) { 1483 var err error 1484 const operationName = "VirtualNetworkGatewaysClient.BeginSetVpnclientIPSecParameters" 1485 ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) 1486 ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) 1487 defer func() { endSpan(err) }() 1488 req, err := client.setVpnclientIPSecParametersCreateRequest(ctx, resourceGroupName, virtualNetworkGatewayName, vpnclientIPSecParams, options) 1489 if err != nil { 1490 return nil, err 1491 } 1492 httpResp, err := client.internal.Pipeline().Do(req) 1493 if err != nil { 1494 return nil, err 1495 } 1496 if !runtime.HasStatusCode(httpResp, http.StatusOK, http.StatusAccepted) { 1497 err = runtime.NewResponseError(httpResp) 1498 return nil, err 1499 } 1500 return httpResp, nil 1501 } 1502 1503 // setVpnclientIPSecParametersCreateRequest creates the SetVpnclientIPSecParameters request. 1504 func (client *VirtualNetworkGatewaysClient) setVpnclientIPSecParametersCreateRequest(ctx context.Context, resourceGroupName string, virtualNetworkGatewayName string, vpnclientIPSecParams VPNClientIPsecParameters, options *VirtualNetworkGatewaysClientBeginSetVpnclientIPSecParametersOptions) (*policy.Request, error) { 1505 urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/virtualNetworkGateways/{virtualNetworkGatewayName}/setvpnclientipsecparameters" 1506 if resourceGroupName == "" { 1507 return nil, errors.New("parameter resourceGroupName cannot be empty") 1508 } 1509 urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) 1510 if virtualNetworkGatewayName == "" { 1511 return nil, errors.New("parameter virtualNetworkGatewayName cannot be empty") 1512 } 1513 urlPath = strings.ReplaceAll(urlPath, "{virtualNetworkGatewayName}", url.PathEscape(virtualNetworkGatewayName)) 1514 if client.subscriptionID == "" { 1515 return nil, errors.New("parameter client.subscriptionID cannot be empty") 1516 } 1517 urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) 1518 req, err := runtime.NewRequest(ctx, http.MethodPost, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) 1519 if err != nil { 1520 return nil, err 1521 } 1522 reqQP := req.Raw().URL.Query() 1523 reqQP.Set("api-version", "2024-05-01") 1524 req.Raw().URL.RawQuery = reqQP.Encode() 1525 req.Raw().Header["Accept"] = []string{"application/json"} 1526 if err := runtime.MarshalAsJSON(req, vpnclientIPSecParams); err != nil { 1527 return nil, err 1528 } 1529 return req, nil 1530 } 1531 1532 // BeginStartExpressRouteSiteFailoverSimulation - This operation starts failover simulation on the gateway for the specified 1533 // peering location 1534 // If the operation fails it returns an *azcore.ResponseError type. 1535 // 1536 // Generated from API version 2024-05-01 1537 // - resourceGroupName - The name of the resource group. 1538 // - virtualNetworkGatewayName - The name of the virtual network gateway. 1539 // - peeringLocation - Peering location of the test 1540 // - options - VirtualNetworkGatewaysClientBeginStartExpressRouteSiteFailoverSimulationOptions contains the optional parameters 1541 // for the VirtualNetworkGatewaysClient.BeginStartExpressRouteSiteFailoverSimulation method. 1542 func (client *VirtualNetworkGatewaysClient) BeginStartExpressRouteSiteFailoverSimulation(ctx context.Context, resourceGroupName string, virtualNetworkGatewayName string, peeringLocation string, options *VirtualNetworkGatewaysClientBeginStartExpressRouteSiteFailoverSimulationOptions) (*runtime.Poller[VirtualNetworkGatewaysClientStartExpressRouteSiteFailoverSimulationResponse], error) { 1543 if options == nil || options.ResumeToken == "" { 1544 resp, err := client.startExpressRouteSiteFailoverSimulation(ctx, resourceGroupName, virtualNetworkGatewayName, peeringLocation, options) 1545 if err != nil { 1546 return nil, err 1547 } 1548 poller, err := runtime.NewPoller(resp, client.internal.Pipeline(), &runtime.NewPollerOptions[VirtualNetworkGatewaysClientStartExpressRouteSiteFailoverSimulationResponse]{ 1549 FinalStateVia: runtime.FinalStateViaLocation, 1550 Tracer: client.internal.Tracer(), 1551 }) 1552 return poller, err 1553 } else { 1554 return runtime.NewPollerFromResumeToken(options.ResumeToken, client.internal.Pipeline(), &runtime.NewPollerFromResumeTokenOptions[VirtualNetworkGatewaysClientStartExpressRouteSiteFailoverSimulationResponse]{ 1555 Tracer: client.internal.Tracer(), 1556 }) 1557 } 1558 } 1559 1560 // StartExpressRouteSiteFailoverSimulation - This operation starts failover simulation on the gateway for the specified peering 1561 // location 1562 // If the operation fails it returns an *azcore.ResponseError type. 1563 // 1564 // Generated from API version 2024-05-01 1565 func (client *VirtualNetworkGatewaysClient) startExpressRouteSiteFailoverSimulation(ctx context.Context, resourceGroupName string, virtualNetworkGatewayName string, peeringLocation string, options *VirtualNetworkGatewaysClientBeginStartExpressRouteSiteFailoverSimulationOptions) (*http.Response, error) { 1566 var err error 1567 const operationName = "VirtualNetworkGatewaysClient.BeginStartExpressRouteSiteFailoverSimulation" 1568 ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) 1569 ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) 1570 defer func() { endSpan(err) }() 1571 req, err := client.startExpressRouteSiteFailoverSimulationCreateRequest(ctx, resourceGroupName, virtualNetworkGatewayName, peeringLocation, options) 1572 if err != nil { 1573 return nil, err 1574 } 1575 httpResp, err := client.internal.Pipeline().Do(req) 1576 if err != nil { 1577 return nil, err 1578 } 1579 if !runtime.HasStatusCode(httpResp, http.StatusOK, http.StatusAccepted) { 1580 err = runtime.NewResponseError(httpResp) 1581 return nil, err 1582 } 1583 return httpResp, nil 1584 } 1585 1586 // startExpressRouteSiteFailoverSimulationCreateRequest creates the StartExpressRouteSiteFailoverSimulation request. 1587 func (client *VirtualNetworkGatewaysClient) startExpressRouteSiteFailoverSimulationCreateRequest(ctx context.Context, resourceGroupName string, virtualNetworkGatewayName string, peeringLocation string, options *VirtualNetworkGatewaysClientBeginStartExpressRouteSiteFailoverSimulationOptions) (*policy.Request, error) { 1588 urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/virtualNetworkGateways/{virtualNetworkGatewayName}/startSiteFailoverTest" 1589 if resourceGroupName == "" { 1590 return nil, errors.New("parameter resourceGroupName cannot be empty") 1591 } 1592 urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) 1593 if virtualNetworkGatewayName == "" { 1594 return nil, errors.New("parameter virtualNetworkGatewayName cannot be empty") 1595 } 1596 urlPath = strings.ReplaceAll(urlPath, "{virtualNetworkGatewayName}", url.PathEscape(virtualNetworkGatewayName)) 1597 if client.subscriptionID == "" { 1598 return nil, errors.New("parameter client.subscriptionID cannot be empty") 1599 } 1600 urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) 1601 req, err := runtime.NewRequest(ctx, http.MethodPost, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) 1602 if err != nil { 1603 return nil, err 1604 } 1605 reqQP := req.Raw().URL.Query() 1606 reqQP.Set("api-version", "2024-05-01") 1607 reqQP.Set("peeringLocation", peeringLocation) 1608 req.Raw().URL.RawQuery = reqQP.Encode() 1609 req.Raw().Header["Accept"] = []string{"application/json"} 1610 return req, nil 1611 } 1612 1613 // BeginStartPacketCapture - Starts packet capture on virtual network gateway in the specified resource group. 1614 // If the operation fails it returns an *azcore.ResponseError type. 1615 // 1616 // Generated from API version 2024-05-01 1617 // - resourceGroupName - The name of the resource group. 1618 // - virtualNetworkGatewayName - The name of the virtual network gateway. 1619 // - options - VirtualNetworkGatewaysClientBeginStartPacketCaptureOptions contains the optional parameters for the VirtualNetworkGatewaysClient.BeginStartPacketCapture 1620 // method. 1621 func (client *VirtualNetworkGatewaysClient) BeginStartPacketCapture(ctx context.Context, resourceGroupName string, virtualNetworkGatewayName string, options *VirtualNetworkGatewaysClientBeginStartPacketCaptureOptions) (*runtime.Poller[VirtualNetworkGatewaysClientStartPacketCaptureResponse], error) { 1622 if options == nil || options.ResumeToken == "" { 1623 resp, err := client.startPacketCapture(ctx, resourceGroupName, virtualNetworkGatewayName, options) 1624 if err != nil { 1625 return nil, err 1626 } 1627 poller, err := runtime.NewPoller(resp, client.internal.Pipeline(), &runtime.NewPollerOptions[VirtualNetworkGatewaysClientStartPacketCaptureResponse]{ 1628 FinalStateVia: runtime.FinalStateViaLocation, 1629 Tracer: client.internal.Tracer(), 1630 }) 1631 return poller, err 1632 } else { 1633 return runtime.NewPollerFromResumeToken(options.ResumeToken, client.internal.Pipeline(), &runtime.NewPollerFromResumeTokenOptions[VirtualNetworkGatewaysClientStartPacketCaptureResponse]{ 1634 Tracer: client.internal.Tracer(), 1635 }) 1636 } 1637 } 1638 1639 // StartPacketCapture - Starts packet capture on virtual network gateway in the specified resource group. 1640 // If the operation fails it returns an *azcore.ResponseError type. 1641 // 1642 // Generated from API version 2024-05-01 1643 func (client *VirtualNetworkGatewaysClient) startPacketCapture(ctx context.Context, resourceGroupName string, virtualNetworkGatewayName string, options *VirtualNetworkGatewaysClientBeginStartPacketCaptureOptions) (*http.Response, error) { 1644 var err error 1645 const operationName = "VirtualNetworkGatewaysClient.BeginStartPacketCapture" 1646 ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) 1647 ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) 1648 defer func() { endSpan(err) }() 1649 req, err := client.startPacketCaptureCreateRequest(ctx, resourceGroupName, virtualNetworkGatewayName, options) 1650 if err != nil { 1651 return nil, err 1652 } 1653 httpResp, err := client.internal.Pipeline().Do(req) 1654 if err != nil { 1655 return nil, err 1656 } 1657 if !runtime.HasStatusCode(httpResp, http.StatusOK, http.StatusAccepted) { 1658 err = runtime.NewResponseError(httpResp) 1659 return nil, err 1660 } 1661 return httpResp, nil 1662 } 1663 1664 // startPacketCaptureCreateRequest creates the StartPacketCapture request. 1665 func (client *VirtualNetworkGatewaysClient) startPacketCaptureCreateRequest(ctx context.Context, resourceGroupName string, virtualNetworkGatewayName string, options *VirtualNetworkGatewaysClientBeginStartPacketCaptureOptions) (*policy.Request, error) { 1666 urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/virtualNetworkGateways/{virtualNetworkGatewayName}/startPacketCapture" 1667 if resourceGroupName == "" { 1668 return nil, errors.New("parameter resourceGroupName cannot be empty") 1669 } 1670 urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) 1671 if virtualNetworkGatewayName == "" { 1672 return nil, errors.New("parameter virtualNetworkGatewayName cannot be empty") 1673 } 1674 urlPath = strings.ReplaceAll(urlPath, "{virtualNetworkGatewayName}", url.PathEscape(virtualNetworkGatewayName)) 1675 if client.subscriptionID == "" { 1676 return nil, errors.New("parameter client.subscriptionID cannot be empty") 1677 } 1678 urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) 1679 req, err := runtime.NewRequest(ctx, http.MethodPost, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) 1680 if err != nil { 1681 return nil, err 1682 } 1683 reqQP := req.Raw().URL.Query() 1684 reqQP.Set("api-version", "2024-05-01") 1685 req.Raw().URL.RawQuery = reqQP.Encode() 1686 req.Raw().Header["Accept"] = []string{"application/json"} 1687 if options != nil && options.Parameters != nil { 1688 if err := runtime.MarshalAsJSON(req, *options.Parameters); err != nil { 1689 return nil, err 1690 } 1691 return req, nil 1692 } 1693 return req, nil 1694 } 1695 1696 // BeginStopExpressRouteSiteFailoverSimulation - This operation stops failover simulation on the gateway for the specified 1697 // peering location 1698 // If the operation fails it returns an *azcore.ResponseError type. 1699 // 1700 // Generated from API version 2024-05-01 1701 // - resourceGroupName - The name of the resource group. 1702 // - virtualNetworkGatewayName - The name of the virtual network gateway. 1703 // - stopParameters - Virtual network gateway stop simulation parameters supplied to stop failover simulation on gateway. 1704 // - options - VirtualNetworkGatewaysClientBeginStopExpressRouteSiteFailoverSimulationOptions contains the optional parameters 1705 // for the VirtualNetworkGatewaysClient.BeginStopExpressRouteSiteFailoverSimulation method. 1706 func (client *VirtualNetworkGatewaysClient) BeginStopExpressRouteSiteFailoverSimulation(ctx context.Context, resourceGroupName string, virtualNetworkGatewayName string, stopParameters ExpressRouteFailoverStopAPIParameters, options *VirtualNetworkGatewaysClientBeginStopExpressRouteSiteFailoverSimulationOptions) (*runtime.Poller[VirtualNetworkGatewaysClientStopExpressRouteSiteFailoverSimulationResponse], error) { 1707 if options == nil || options.ResumeToken == "" { 1708 resp, err := client.stopExpressRouteSiteFailoverSimulation(ctx, resourceGroupName, virtualNetworkGatewayName, stopParameters, options) 1709 if err != nil { 1710 return nil, err 1711 } 1712 poller, err := runtime.NewPoller(resp, client.internal.Pipeline(), &runtime.NewPollerOptions[VirtualNetworkGatewaysClientStopExpressRouteSiteFailoverSimulationResponse]{ 1713 FinalStateVia: runtime.FinalStateViaLocation, 1714 Tracer: client.internal.Tracer(), 1715 }) 1716 return poller, err 1717 } else { 1718 return runtime.NewPollerFromResumeToken(options.ResumeToken, client.internal.Pipeline(), &runtime.NewPollerFromResumeTokenOptions[VirtualNetworkGatewaysClientStopExpressRouteSiteFailoverSimulationResponse]{ 1719 Tracer: client.internal.Tracer(), 1720 }) 1721 } 1722 } 1723 1724 // StopExpressRouteSiteFailoverSimulation - This operation stops failover simulation on the gateway for the specified peering 1725 // location 1726 // If the operation fails it returns an *azcore.ResponseError type. 1727 // 1728 // Generated from API version 2024-05-01 1729 func (client *VirtualNetworkGatewaysClient) stopExpressRouteSiteFailoverSimulation(ctx context.Context, resourceGroupName string, virtualNetworkGatewayName string, stopParameters ExpressRouteFailoverStopAPIParameters, options *VirtualNetworkGatewaysClientBeginStopExpressRouteSiteFailoverSimulationOptions) (*http.Response, error) { 1730 var err error 1731 const operationName = "VirtualNetworkGatewaysClient.BeginStopExpressRouteSiteFailoverSimulation" 1732 ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) 1733 ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) 1734 defer func() { endSpan(err) }() 1735 req, err := client.stopExpressRouteSiteFailoverSimulationCreateRequest(ctx, resourceGroupName, virtualNetworkGatewayName, stopParameters, options) 1736 if err != nil { 1737 return nil, err 1738 } 1739 httpResp, err := client.internal.Pipeline().Do(req) 1740 if err != nil { 1741 return nil, err 1742 } 1743 if !runtime.HasStatusCode(httpResp, http.StatusOK, http.StatusAccepted) { 1744 err = runtime.NewResponseError(httpResp) 1745 return nil, err 1746 } 1747 return httpResp, nil 1748 } 1749 1750 // stopExpressRouteSiteFailoverSimulationCreateRequest creates the StopExpressRouteSiteFailoverSimulation request. 1751 func (client *VirtualNetworkGatewaysClient) stopExpressRouteSiteFailoverSimulationCreateRequest(ctx context.Context, resourceGroupName string, virtualNetworkGatewayName string, stopParameters ExpressRouteFailoverStopAPIParameters, options *VirtualNetworkGatewaysClientBeginStopExpressRouteSiteFailoverSimulationOptions) (*policy.Request, error) { 1752 urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/virtualNetworkGateways/{virtualNetworkGatewayName}/stopSiteFailoverTest" 1753 if resourceGroupName == "" { 1754 return nil, errors.New("parameter resourceGroupName cannot be empty") 1755 } 1756 urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) 1757 if virtualNetworkGatewayName == "" { 1758 return nil, errors.New("parameter virtualNetworkGatewayName cannot be empty") 1759 } 1760 urlPath = strings.ReplaceAll(urlPath, "{virtualNetworkGatewayName}", url.PathEscape(virtualNetworkGatewayName)) 1761 if client.subscriptionID == "" { 1762 return nil, errors.New("parameter client.subscriptionID cannot be empty") 1763 } 1764 urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) 1765 req, err := runtime.NewRequest(ctx, http.MethodPost, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) 1766 if err != nil { 1767 return nil, err 1768 } 1769 reqQP := req.Raw().URL.Query() 1770 reqQP.Set("api-version", "2024-05-01") 1771 req.Raw().URL.RawQuery = reqQP.Encode() 1772 req.Raw().Header["Accept"] = []string{"application/json"} 1773 if err := runtime.MarshalAsJSON(req, stopParameters); err != nil { 1774 return nil, err 1775 } 1776 return req, nil 1777 } 1778 1779 // BeginStopPacketCapture - Stops packet capture on virtual network gateway in the specified resource group. 1780 // If the operation fails it returns an *azcore.ResponseError type. 1781 // 1782 // Generated from API version 2024-05-01 1783 // - resourceGroupName - The name of the resource group. 1784 // - virtualNetworkGatewayName - The name of the virtual network gateway. 1785 // - parameters - Virtual network gateway packet capture parameters supplied to stop packet capture on gateway. 1786 // - options - VirtualNetworkGatewaysClientBeginStopPacketCaptureOptions contains the optional parameters for the VirtualNetworkGatewaysClient.BeginStopPacketCapture 1787 // method. 1788 func (client *VirtualNetworkGatewaysClient) BeginStopPacketCapture(ctx context.Context, resourceGroupName string, virtualNetworkGatewayName string, parameters VPNPacketCaptureStopParameters, options *VirtualNetworkGatewaysClientBeginStopPacketCaptureOptions) (*runtime.Poller[VirtualNetworkGatewaysClientStopPacketCaptureResponse], error) { 1789 if options == nil || options.ResumeToken == "" { 1790 resp, err := client.stopPacketCapture(ctx, resourceGroupName, virtualNetworkGatewayName, parameters, options) 1791 if err != nil { 1792 return nil, err 1793 } 1794 poller, err := runtime.NewPoller(resp, client.internal.Pipeline(), &runtime.NewPollerOptions[VirtualNetworkGatewaysClientStopPacketCaptureResponse]{ 1795 FinalStateVia: runtime.FinalStateViaLocation, 1796 Tracer: client.internal.Tracer(), 1797 }) 1798 return poller, err 1799 } else { 1800 return runtime.NewPollerFromResumeToken(options.ResumeToken, client.internal.Pipeline(), &runtime.NewPollerFromResumeTokenOptions[VirtualNetworkGatewaysClientStopPacketCaptureResponse]{ 1801 Tracer: client.internal.Tracer(), 1802 }) 1803 } 1804 } 1805 1806 // StopPacketCapture - Stops packet capture on virtual network gateway in the specified resource group. 1807 // If the operation fails it returns an *azcore.ResponseError type. 1808 // 1809 // Generated from API version 2024-05-01 1810 func (client *VirtualNetworkGatewaysClient) stopPacketCapture(ctx context.Context, resourceGroupName string, virtualNetworkGatewayName string, parameters VPNPacketCaptureStopParameters, options *VirtualNetworkGatewaysClientBeginStopPacketCaptureOptions) (*http.Response, error) { 1811 var err error 1812 const operationName = "VirtualNetworkGatewaysClient.BeginStopPacketCapture" 1813 ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) 1814 ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) 1815 defer func() { endSpan(err) }() 1816 req, err := client.stopPacketCaptureCreateRequest(ctx, resourceGroupName, virtualNetworkGatewayName, parameters, options) 1817 if err != nil { 1818 return nil, err 1819 } 1820 httpResp, err := client.internal.Pipeline().Do(req) 1821 if err != nil { 1822 return nil, err 1823 } 1824 if !runtime.HasStatusCode(httpResp, http.StatusOK, http.StatusAccepted) { 1825 err = runtime.NewResponseError(httpResp) 1826 return nil, err 1827 } 1828 return httpResp, nil 1829 } 1830 1831 // stopPacketCaptureCreateRequest creates the StopPacketCapture request. 1832 func (client *VirtualNetworkGatewaysClient) stopPacketCaptureCreateRequest(ctx context.Context, resourceGroupName string, virtualNetworkGatewayName string, parameters VPNPacketCaptureStopParameters, options *VirtualNetworkGatewaysClientBeginStopPacketCaptureOptions) (*policy.Request, error) { 1833 urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/virtualNetworkGateways/{virtualNetworkGatewayName}/stopPacketCapture" 1834 if resourceGroupName == "" { 1835 return nil, errors.New("parameter resourceGroupName cannot be empty") 1836 } 1837 urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) 1838 if virtualNetworkGatewayName == "" { 1839 return nil, errors.New("parameter virtualNetworkGatewayName cannot be empty") 1840 } 1841 urlPath = strings.ReplaceAll(urlPath, "{virtualNetworkGatewayName}", url.PathEscape(virtualNetworkGatewayName)) 1842 if client.subscriptionID == "" { 1843 return nil, errors.New("parameter client.subscriptionID cannot be empty") 1844 } 1845 urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) 1846 req, err := runtime.NewRequest(ctx, http.MethodPost, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) 1847 if err != nil { 1848 return nil, err 1849 } 1850 reqQP := req.Raw().URL.Query() 1851 reqQP.Set("api-version", "2024-05-01") 1852 req.Raw().URL.RawQuery = reqQP.Encode() 1853 req.Raw().Header["Accept"] = []string{"application/json"} 1854 if err := runtime.MarshalAsJSON(req, parameters); err != nil { 1855 return nil, err 1856 } 1857 return req, nil 1858 } 1859 1860 // SupportedVPNDevices - Gets a xml format representation for supported vpn devices. 1861 // If the operation fails it returns an *azcore.ResponseError type. 1862 // 1863 // Generated from API version 2024-05-01 1864 // - resourceGroupName - The name of the resource group. 1865 // - virtualNetworkGatewayName - The name of the virtual network gateway. 1866 // - options - VirtualNetworkGatewaysClientSupportedVPNDevicesOptions contains the optional parameters for the VirtualNetworkGatewaysClient.SupportedVPNDevices 1867 // method. 1868 func (client *VirtualNetworkGatewaysClient) SupportedVPNDevices(ctx context.Context, resourceGroupName string, virtualNetworkGatewayName string, options *VirtualNetworkGatewaysClientSupportedVPNDevicesOptions) (VirtualNetworkGatewaysClientSupportedVPNDevicesResponse, error) { 1869 var err error 1870 const operationName = "VirtualNetworkGatewaysClient.SupportedVPNDevices" 1871 ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) 1872 ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) 1873 defer func() { endSpan(err) }() 1874 req, err := client.supportedVPNDevicesCreateRequest(ctx, resourceGroupName, virtualNetworkGatewayName, options) 1875 if err != nil { 1876 return VirtualNetworkGatewaysClientSupportedVPNDevicesResponse{}, err 1877 } 1878 httpResp, err := client.internal.Pipeline().Do(req) 1879 if err != nil { 1880 return VirtualNetworkGatewaysClientSupportedVPNDevicesResponse{}, err 1881 } 1882 if !runtime.HasStatusCode(httpResp, http.StatusOK) { 1883 err = runtime.NewResponseError(httpResp) 1884 return VirtualNetworkGatewaysClientSupportedVPNDevicesResponse{}, err 1885 } 1886 resp, err := client.supportedVPNDevicesHandleResponse(httpResp) 1887 return resp, err 1888 } 1889 1890 // supportedVPNDevicesCreateRequest creates the SupportedVPNDevices request. 1891 func (client *VirtualNetworkGatewaysClient) supportedVPNDevicesCreateRequest(ctx context.Context, resourceGroupName string, virtualNetworkGatewayName string, options *VirtualNetworkGatewaysClientSupportedVPNDevicesOptions) (*policy.Request, error) { 1892 urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/virtualNetworkGateways/{virtualNetworkGatewayName}/supportedvpndevices" 1893 if resourceGroupName == "" { 1894 return nil, errors.New("parameter resourceGroupName cannot be empty") 1895 } 1896 urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) 1897 if virtualNetworkGatewayName == "" { 1898 return nil, errors.New("parameter virtualNetworkGatewayName cannot be empty") 1899 } 1900 urlPath = strings.ReplaceAll(urlPath, "{virtualNetworkGatewayName}", url.PathEscape(virtualNetworkGatewayName)) 1901 if client.subscriptionID == "" { 1902 return nil, errors.New("parameter client.subscriptionID cannot be empty") 1903 } 1904 urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) 1905 req, err := runtime.NewRequest(ctx, http.MethodPost, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) 1906 if err != nil { 1907 return nil, err 1908 } 1909 reqQP := req.Raw().URL.Query() 1910 reqQP.Set("api-version", "2024-05-01") 1911 req.Raw().URL.RawQuery = reqQP.Encode() 1912 req.Raw().Header["Accept"] = []string{"application/json"} 1913 return req, nil 1914 } 1915 1916 // supportedVPNDevicesHandleResponse handles the SupportedVPNDevices response. 1917 func (client *VirtualNetworkGatewaysClient) supportedVPNDevicesHandleResponse(resp *http.Response) (VirtualNetworkGatewaysClientSupportedVPNDevicesResponse, error) { 1918 result := VirtualNetworkGatewaysClientSupportedVPNDevicesResponse{} 1919 if err := runtime.UnmarshalAsJSON(resp, &result.Value); err != nil { 1920 return VirtualNetworkGatewaysClientSupportedVPNDevicesResponse{}, err 1921 } 1922 return result, nil 1923 } 1924 1925 // BeginUpdateTags - Updates a virtual network gateway tags. 1926 // If the operation fails it returns an *azcore.ResponseError type. 1927 // 1928 // Generated from API version 2024-05-01 1929 // - resourceGroupName - The name of the resource group. 1930 // - virtualNetworkGatewayName - The name of the virtual network gateway. 1931 // - parameters - Parameters supplied to update virtual network gateway tags. 1932 // - options - VirtualNetworkGatewaysClientBeginUpdateTagsOptions contains the optional parameters for the VirtualNetworkGatewaysClient.BeginUpdateTags 1933 // method. 1934 func (client *VirtualNetworkGatewaysClient) BeginUpdateTags(ctx context.Context, resourceGroupName string, virtualNetworkGatewayName string, parameters TagsObject, options *VirtualNetworkGatewaysClientBeginUpdateTagsOptions) (*runtime.Poller[VirtualNetworkGatewaysClientUpdateTagsResponse], error) { 1935 if options == nil || options.ResumeToken == "" { 1936 resp, err := client.updateTags(ctx, resourceGroupName, virtualNetworkGatewayName, parameters, options) 1937 if err != nil { 1938 return nil, err 1939 } 1940 poller, err := runtime.NewPoller(resp, client.internal.Pipeline(), &runtime.NewPollerOptions[VirtualNetworkGatewaysClientUpdateTagsResponse]{ 1941 FinalStateVia: runtime.FinalStateViaAzureAsyncOp, 1942 Tracer: client.internal.Tracer(), 1943 }) 1944 return poller, err 1945 } else { 1946 return runtime.NewPollerFromResumeToken(options.ResumeToken, client.internal.Pipeline(), &runtime.NewPollerFromResumeTokenOptions[VirtualNetworkGatewaysClientUpdateTagsResponse]{ 1947 Tracer: client.internal.Tracer(), 1948 }) 1949 } 1950 } 1951 1952 // UpdateTags - Updates a virtual network gateway tags. 1953 // If the operation fails it returns an *azcore.ResponseError type. 1954 // 1955 // Generated from API version 2024-05-01 1956 func (client *VirtualNetworkGatewaysClient) updateTags(ctx context.Context, resourceGroupName string, virtualNetworkGatewayName string, parameters TagsObject, options *VirtualNetworkGatewaysClientBeginUpdateTagsOptions) (*http.Response, error) { 1957 var err error 1958 const operationName = "VirtualNetworkGatewaysClient.BeginUpdateTags" 1959 ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) 1960 ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) 1961 defer func() { endSpan(err) }() 1962 req, err := client.updateTagsCreateRequest(ctx, resourceGroupName, virtualNetworkGatewayName, parameters, options) 1963 if err != nil { 1964 return nil, err 1965 } 1966 httpResp, err := client.internal.Pipeline().Do(req) 1967 if err != nil { 1968 return nil, err 1969 } 1970 if !runtime.HasStatusCode(httpResp, http.StatusOK, http.StatusAccepted) { 1971 err = runtime.NewResponseError(httpResp) 1972 return nil, err 1973 } 1974 return httpResp, nil 1975 } 1976 1977 // updateTagsCreateRequest creates the UpdateTags request. 1978 func (client *VirtualNetworkGatewaysClient) updateTagsCreateRequest(ctx context.Context, resourceGroupName string, virtualNetworkGatewayName string, parameters TagsObject, options *VirtualNetworkGatewaysClientBeginUpdateTagsOptions) (*policy.Request, error) { 1979 urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/virtualNetworkGateways/{virtualNetworkGatewayName}" 1980 if resourceGroupName == "" { 1981 return nil, errors.New("parameter resourceGroupName cannot be empty") 1982 } 1983 urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) 1984 if virtualNetworkGatewayName == "" { 1985 return nil, errors.New("parameter virtualNetworkGatewayName cannot be empty") 1986 } 1987 urlPath = strings.ReplaceAll(urlPath, "{virtualNetworkGatewayName}", url.PathEscape(virtualNetworkGatewayName)) 1988 if client.subscriptionID == "" { 1989 return nil, errors.New("parameter client.subscriptionID cannot be empty") 1990 } 1991 urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) 1992 req, err := runtime.NewRequest(ctx, http.MethodPatch, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) 1993 if err != nil { 1994 return nil, err 1995 } 1996 reqQP := req.Raw().URL.Query() 1997 reqQP.Set("api-version", "2024-05-01") 1998 req.Raw().URL.RawQuery = reqQP.Encode() 1999 req.Raw().Header["Accept"] = []string{"application/json"} 2000 if err := runtime.MarshalAsJSON(req, parameters); err != nil { 2001 return nil, err 2002 } 2003 return req, nil 2004 } 2005 2006 // VPNDeviceConfigurationScript - Gets a xml format representation for vpn device configuration script. 2007 // If the operation fails it returns an *azcore.ResponseError type. 2008 // 2009 // Generated from API version 2024-05-01 2010 // - resourceGroupName - The name of the resource group. 2011 // - virtualNetworkGatewayConnectionName - The name of the virtual network gateway connection for which the configuration script 2012 // is generated. 2013 // - parameters - Parameters supplied to the generate vpn device script operation. 2014 // - options - VirtualNetworkGatewaysClientVPNDeviceConfigurationScriptOptions contains the optional parameters for the VirtualNetworkGatewaysClient.VPNDeviceConfigurationScript 2015 // method. 2016 func (client *VirtualNetworkGatewaysClient) VPNDeviceConfigurationScript(ctx context.Context, resourceGroupName string, virtualNetworkGatewayConnectionName string, parameters VPNDeviceScriptParameters, options *VirtualNetworkGatewaysClientVPNDeviceConfigurationScriptOptions) (VirtualNetworkGatewaysClientVPNDeviceConfigurationScriptResponse, error) { 2017 var err error 2018 const operationName = "VirtualNetworkGatewaysClient.VPNDeviceConfigurationScript" 2019 ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) 2020 ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) 2021 defer func() { endSpan(err) }() 2022 req, err := client.vpnDeviceConfigurationScriptCreateRequest(ctx, resourceGroupName, virtualNetworkGatewayConnectionName, parameters, options) 2023 if err != nil { 2024 return VirtualNetworkGatewaysClientVPNDeviceConfigurationScriptResponse{}, err 2025 } 2026 httpResp, err := client.internal.Pipeline().Do(req) 2027 if err != nil { 2028 return VirtualNetworkGatewaysClientVPNDeviceConfigurationScriptResponse{}, err 2029 } 2030 if !runtime.HasStatusCode(httpResp, http.StatusOK) { 2031 err = runtime.NewResponseError(httpResp) 2032 return VirtualNetworkGatewaysClientVPNDeviceConfigurationScriptResponse{}, err 2033 } 2034 resp, err := client.vpnDeviceConfigurationScriptHandleResponse(httpResp) 2035 return resp, err 2036 } 2037 2038 // vpnDeviceConfigurationScriptCreateRequest creates the VPNDeviceConfigurationScript request. 2039 func (client *VirtualNetworkGatewaysClient) vpnDeviceConfigurationScriptCreateRequest(ctx context.Context, resourceGroupName string, virtualNetworkGatewayConnectionName string, parameters VPNDeviceScriptParameters, options *VirtualNetworkGatewaysClientVPNDeviceConfigurationScriptOptions) (*policy.Request, error) { 2040 urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/connections/{virtualNetworkGatewayConnectionName}/vpndeviceconfigurationscript" 2041 if resourceGroupName == "" { 2042 return nil, errors.New("parameter resourceGroupName cannot be empty") 2043 } 2044 urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) 2045 if virtualNetworkGatewayConnectionName == "" { 2046 return nil, errors.New("parameter virtualNetworkGatewayConnectionName cannot be empty") 2047 } 2048 urlPath = strings.ReplaceAll(urlPath, "{virtualNetworkGatewayConnectionName}", url.PathEscape(virtualNetworkGatewayConnectionName)) 2049 if client.subscriptionID == "" { 2050 return nil, errors.New("parameter client.subscriptionID cannot be empty") 2051 } 2052 urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) 2053 req, err := runtime.NewRequest(ctx, http.MethodPost, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) 2054 if err != nil { 2055 return nil, err 2056 } 2057 reqQP := req.Raw().URL.Query() 2058 reqQP.Set("api-version", "2024-05-01") 2059 req.Raw().URL.RawQuery = reqQP.Encode() 2060 req.Raw().Header["Accept"] = []string{"application/json"} 2061 if err := runtime.MarshalAsJSON(req, parameters); err != nil { 2062 return nil, err 2063 } 2064 return req, nil 2065 } 2066 2067 // vpnDeviceConfigurationScriptHandleResponse handles the VPNDeviceConfigurationScript response. 2068 func (client *VirtualNetworkGatewaysClient) vpnDeviceConfigurationScriptHandleResponse(resp *http.Response) (VirtualNetworkGatewaysClientVPNDeviceConfigurationScriptResponse, error) { 2069 result := VirtualNetworkGatewaysClientVPNDeviceConfigurationScriptResponse{} 2070 if err := runtime.UnmarshalAsJSON(resp, &result.Value); err != nil { 2071 return VirtualNetworkGatewaysClientVPNDeviceConfigurationScriptResponse{}, err 2072 } 2073 return result, nil 2074 }