github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/network/armnetwork/v6@v6.2.0/management_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 // ManagementClient contains the methods for the NetworkManagementClient group. 25 // Don't use this type directly, use NewManagementClient() instead. 26 type ManagementClient struct { 27 internal *arm.Client 28 subscriptionID string 29 } 30 31 // NewManagementClient creates a new instance of ManagementClient 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 NewManagementClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) (*ManagementClient, error) { 37 cl, err := arm.NewClient(moduleName, moduleVersion, credential, options) 38 if err != nil { 39 return nil, err 40 } 41 client := &ManagementClient{ 42 subscriptionID: subscriptionID, 43 internal: cl, 44 } 45 return client, nil 46 } 47 48 // CheckDNSNameAvailability - Checks whether a domain name in the cloudapp.azure.com zone is available for use. 49 // If the operation fails it returns an *azcore.ResponseError type. 50 // 51 // Generated from API version 2024-05-01 52 // - location - The location of the domain name. 53 // - domainNameLabel - The domain name to be verified. It must conform to the following regular expression: ^[a-z][a-z0-9-]{1,61}[a-z0-9]$. 54 // - options - ManagementClientCheckDNSNameAvailabilityOptions contains the optional parameters for the ManagementClient.CheckDNSNameAvailability 55 // method. 56 func (client *ManagementClient) CheckDNSNameAvailability(ctx context.Context, location string, domainNameLabel string, options *ManagementClientCheckDNSNameAvailabilityOptions) (ManagementClientCheckDNSNameAvailabilityResponse, error) { 57 var err error 58 const operationName = "ManagementClient.CheckDNSNameAvailability" 59 ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) 60 ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) 61 defer func() { endSpan(err) }() 62 req, err := client.checkDNSNameAvailabilityCreateRequest(ctx, location, domainNameLabel, options) 63 if err != nil { 64 return ManagementClientCheckDNSNameAvailabilityResponse{}, err 65 } 66 httpResp, err := client.internal.Pipeline().Do(req) 67 if err != nil { 68 return ManagementClientCheckDNSNameAvailabilityResponse{}, err 69 } 70 if !runtime.HasStatusCode(httpResp, http.StatusOK) { 71 err = runtime.NewResponseError(httpResp) 72 return ManagementClientCheckDNSNameAvailabilityResponse{}, err 73 } 74 resp, err := client.checkDNSNameAvailabilityHandleResponse(httpResp) 75 return resp, err 76 } 77 78 // checkDNSNameAvailabilityCreateRequest creates the CheckDNSNameAvailability request. 79 func (client *ManagementClient) checkDNSNameAvailabilityCreateRequest(ctx context.Context, location string, domainNameLabel string, options *ManagementClientCheckDNSNameAvailabilityOptions) (*policy.Request, error) { 80 urlPath := "/subscriptions/{subscriptionId}/providers/Microsoft.Network/locations/{location}/CheckDnsNameAvailability" 81 if location == "" { 82 return nil, errors.New("parameter location cannot be empty") 83 } 84 urlPath = strings.ReplaceAll(urlPath, "{location}", url.PathEscape(location)) 85 if client.subscriptionID == "" { 86 return nil, errors.New("parameter client.subscriptionID cannot be empty") 87 } 88 urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) 89 req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) 90 if err != nil { 91 return nil, err 92 } 93 reqQP := req.Raw().URL.Query() 94 reqQP.Set("api-version", "2024-05-01") 95 reqQP.Set("domainNameLabel", domainNameLabel) 96 req.Raw().URL.RawQuery = reqQP.Encode() 97 req.Raw().Header["Accept"] = []string{"application/json"} 98 return req, nil 99 } 100 101 // checkDNSNameAvailabilityHandleResponse handles the CheckDNSNameAvailability response. 102 func (client *ManagementClient) checkDNSNameAvailabilityHandleResponse(resp *http.Response) (ManagementClientCheckDNSNameAvailabilityResponse, error) { 103 result := ManagementClientCheckDNSNameAvailabilityResponse{} 104 if err := runtime.UnmarshalAsJSON(resp, &result.DNSNameAvailabilityResult); err != nil { 105 return ManagementClientCheckDNSNameAvailabilityResponse{}, err 106 } 107 return result, nil 108 } 109 110 // BeginDeleteBastionShareableLink - Deletes the Bastion Shareable Links for all the VMs specified in the request. 111 // If the operation fails it returns an *azcore.ResponseError type. 112 // 113 // Generated from API version 2024-05-01 114 // - resourceGroupName - The name of the resource group. 115 // - bastionHostName - The name of the Bastion Host. 116 // - bslRequest - Post request for Create/Delete/Get Bastion Shareable Link endpoints. 117 // - options - ManagementClientBeginDeleteBastionShareableLinkOptions contains the optional parameters for the ManagementClient.BeginDeleteBastionShareableLink 118 // method. 119 func (client *ManagementClient) BeginDeleteBastionShareableLink(ctx context.Context, resourceGroupName string, bastionHostName string, bslRequest BastionShareableLinkListRequest, options *ManagementClientBeginDeleteBastionShareableLinkOptions) (*runtime.Poller[ManagementClientDeleteBastionShareableLinkResponse], error) { 120 if options == nil || options.ResumeToken == "" { 121 resp, err := client.deleteBastionShareableLink(ctx, resourceGroupName, bastionHostName, bslRequest, options) 122 if err != nil { 123 return nil, err 124 } 125 poller, err := runtime.NewPoller(resp, client.internal.Pipeline(), &runtime.NewPollerOptions[ManagementClientDeleteBastionShareableLinkResponse]{ 126 FinalStateVia: runtime.FinalStateViaLocation, 127 Tracer: client.internal.Tracer(), 128 }) 129 return poller, err 130 } else { 131 return runtime.NewPollerFromResumeToken(options.ResumeToken, client.internal.Pipeline(), &runtime.NewPollerFromResumeTokenOptions[ManagementClientDeleteBastionShareableLinkResponse]{ 132 Tracer: client.internal.Tracer(), 133 }) 134 } 135 } 136 137 // DeleteBastionShareableLink - Deletes the Bastion Shareable Links for all the VMs specified in the request. 138 // If the operation fails it returns an *azcore.ResponseError type. 139 // 140 // Generated from API version 2024-05-01 141 func (client *ManagementClient) deleteBastionShareableLink(ctx context.Context, resourceGroupName string, bastionHostName string, bslRequest BastionShareableLinkListRequest, options *ManagementClientBeginDeleteBastionShareableLinkOptions) (*http.Response, error) { 142 var err error 143 const operationName = "ManagementClient.BeginDeleteBastionShareableLink" 144 ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) 145 ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) 146 defer func() { endSpan(err) }() 147 req, err := client.deleteBastionShareableLinkCreateRequest(ctx, resourceGroupName, bastionHostName, bslRequest, options) 148 if err != nil { 149 return nil, err 150 } 151 httpResp, err := client.internal.Pipeline().Do(req) 152 if err != nil { 153 return nil, err 154 } 155 if !runtime.HasStatusCode(httpResp, http.StatusOK, http.StatusAccepted) { 156 err = runtime.NewResponseError(httpResp) 157 return nil, err 158 } 159 return httpResp, nil 160 } 161 162 // deleteBastionShareableLinkCreateRequest creates the DeleteBastionShareableLink request. 163 func (client *ManagementClient) deleteBastionShareableLinkCreateRequest(ctx context.Context, resourceGroupName string, bastionHostName string, bslRequest BastionShareableLinkListRequest, options *ManagementClientBeginDeleteBastionShareableLinkOptions) (*policy.Request, error) { 164 urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/bastionHosts/{bastionHostName}/deleteShareableLinks" 165 if resourceGroupName == "" { 166 return nil, errors.New("parameter resourceGroupName cannot be empty") 167 } 168 urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) 169 if bastionHostName == "" { 170 return nil, errors.New("parameter bastionHostName cannot be empty") 171 } 172 urlPath = strings.ReplaceAll(urlPath, "{bastionHostName}", url.PathEscape(bastionHostName)) 173 if client.subscriptionID == "" { 174 return nil, errors.New("parameter client.subscriptionID cannot be empty") 175 } 176 urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) 177 req, err := runtime.NewRequest(ctx, http.MethodPost, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) 178 if err != nil { 179 return nil, err 180 } 181 reqQP := req.Raw().URL.Query() 182 reqQP.Set("api-version", "2024-05-01") 183 req.Raw().URL.RawQuery = reqQP.Encode() 184 req.Raw().Header["Accept"] = []string{"application/json"} 185 if err := runtime.MarshalAsJSON(req, bslRequest); err != nil { 186 return nil, err 187 } 188 return req, nil 189 } 190 191 // BeginDeleteBastionShareableLinkByToken - Deletes the Bastion Shareable Links for all the tokens specified in the request. 192 // If the operation fails it returns an *azcore.ResponseError type. 193 // 194 // Generated from API version 2024-05-01 195 // - resourceGroupName - The name of the resource group. 196 // - bastionHostName - The name of the Bastion Host. 197 // - bslTokenRequest - Post request for Delete Bastion Shareable Link By Token endpoint. 198 // - options - ManagementClientBeginDeleteBastionShareableLinkByTokenOptions contains the optional parameters for the ManagementClient.BeginDeleteBastionShareableLinkByToken 199 // method. 200 func (client *ManagementClient) BeginDeleteBastionShareableLinkByToken(ctx context.Context, resourceGroupName string, bastionHostName string, bslTokenRequest BastionShareableLinkTokenListRequest, options *ManagementClientBeginDeleteBastionShareableLinkByTokenOptions) (*runtime.Poller[ManagementClientDeleteBastionShareableLinkByTokenResponse], error) { 201 if options == nil || options.ResumeToken == "" { 202 resp, err := client.deleteBastionShareableLinkByToken(ctx, resourceGroupName, bastionHostName, bslTokenRequest, options) 203 if err != nil { 204 return nil, err 205 } 206 poller, err := runtime.NewPoller(resp, client.internal.Pipeline(), &runtime.NewPollerOptions[ManagementClientDeleteBastionShareableLinkByTokenResponse]{ 207 FinalStateVia: runtime.FinalStateViaLocation, 208 Tracer: client.internal.Tracer(), 209 }) 210 return poller, err 211 } else { 212 return runtime.NewPollerFromResumeToken(options.ResumeToken, client.internal.Pipeline(), &runtime.NewPollerFromResumeTokenOptions[ManagementClientDeleteBastionShareableLinkByTokenResponse]{ 213 Tracer: client.internal.Tracer(), 214 }) 215 } 216 } 217 218 // DeleteBastionShareableLinkByToken - Deletes the Bastion Shareable Links for all the tokens specified in the request. 219 // If the operation fails it returns an *azcore.ResponseError type. 220 // 221 // Generated from API version 2024-05-01 222 func (client *ManagementClient) deleteBastionShareableLinkByToken(ctx context.Context, resourceGroupName string, bastionHostName string, bslTokenRequest BastionShareableLinkTokenListRequest, options *ManagementClientBeginDeleteBastionShareableLinkByTokenOptions) (*http.Response, error) { 223 var err error 224 const operationName = "ManagementClient.BeginDeleteBastionShareableLinkByToken" 225 ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) 226 ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) 227 defer func() { endSpan(err) }() 228 req, err := client.deleteBastionShareableLinkByTokenCreateRequest(ctx, resourceGroupName, bastionHostName, bslTokenRequest, options) 229 if err != nil { 230 return nil, err 231 } 232 httpResp, err := client.internal.Pipeline().Do(req) 233 if err != nil { 234 return nil, err 235 } 236 if !runtime.HasStatusCode(httpResp, http.StatusAccepted) { 237 err = runtime.NewResponseError(httpResp) 238 return nil, err 239 } 240 return httpResp, nil 241 } 242 243 // deleteBastionShareableLinkByTokenCreateRequest creates the DeleteBastionShareableLinkByToken request. 244 func (client *ManagementClient) deleteBastionShareableLinkByTokenCreateRequest(ctx context.Context, resourceGroupName string, bastionHostName string, bslTokenRequest BastionShareableLinkTokenListRequest, options *ManagementClientBeginDeleteBastionShareableLinkByTokenOptions) (*policy.Request, error) { 245 urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/bastionHosts/{bastionHostName}/deleteShareableLinksByToken" 246 if resourceGroupName == "" { 247 return nil, errors.New("parameter resourceGroupName cannot be empty") 248 } 249 urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) 250 if bastionHostName == "" { 251 return nil, errors.New("parameter bastionHostName cannot be empty") 252 } 253 urlPath = strings.ReplaceAll(urlPath, "{bastionHostName}", url.PathEscape(bastionHostName)) 254 if client.subscriptionID == "" { 255 return nil, errors.New("parameter client.subscriptionID cannot be empty") 256 } 257 urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) 258 req, err := runtime.NewRequest(ctx, http.MethodPost, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) 259 if err != nil { 260 return nil, err 261 } 262 reqQP := req.Raw().URL.Query() 263 reqQP.Set("api-version", "2024-05-01") 264 req.Raw().URL.RawQuery = reqQP.Encode() 265 req.Raw().Header["Accept"] = []string{"application/json"} 266 if err := runtime.MarshalAsJSON(req, bslTokenRequest); err != nil { 267 return nil, err 268 } 269 return req, nil 270 } 271 272 // NewDisconnectActiveSessionsPager - Returns the list of currently active sessions on the Bastion. 273 // 274 // Generated from API version 2024-05-01 275 // - resourceGroupName - The name of the resource group. 276 // - bastionHostName - The name of the Bastion Host. 277 // - sessionIDs - The list of sessionids to disconnect. 278 // - options - ManagementClientDisconnectActiveSessionsOptions contains the optional parameters for the ManagementClient.NewDisconnectActiveSessionsPager 279 // method. 280 func (client *ManagementClient) NewDisconnectActiveSessionsPager(resourceGroupName string, bastionHostName string, sessionIDs SessionIDs, options *ManagementClientDisconnectActiveSessionsOptions) *runtime.Pager[ManagementClientDisconnectActiveSessionsResponse] { 281 return runtime.NewPager(runtime.PagingHandler[ManagementClientDisconnectActiveSessionsResponse]{ 282 More: func(page ManagementClientDisconnectActiveSessionsResponse) bool { 283 return page.NextLink != nil && len(*page.NextLink) > 0 284 }, 285 Fetcher: func(ctx context.Context, page *ManagementClientDisconnectActiveSessionsResponse) (ManagementClientDisconnectActiveSessionsResponse, error) { 286 ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, "ManagementClient.NewDisconnectActiveSessionsPager") 287 nextLink := "" 288 if page != nil { 289 nextLink = *page.NextLink 290 } 291 resp, err := runtime.FetcherForNextLink(ctx, client.internal.Pipeline(), nextLink, func(ctx context.Context) (*policy.Request, error) { 292 return client.disconnectActiveSessionsCreateRequest(ctx, resourceGroupName, bastionHostName, sessionIDs, options) 293 }, nil) 294 if err != nil { 295 return ManagementClientDisconnectActiveSessionsResponse{}, err 296 } 297 return client.disconnectActiveSessionsHandleResponse(resp) 298 }, 299 Tracer: client.internal.Tracer(), 300 }) 301 } 302 303 // disconnectActiveSessionsCreateRequest creates the DisconnectActiveSessions request. 304 func (client *ManagementClient) disconnectActiveSessionsCreateRequest(ctx context.Context, resourceGroupName string, bastionHostName string, sessionIDs SessionIDs, options *ManagementClientDisconnectActiveSessionsOptions) (*policy.Request, error) { 305 urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/bastionHosts/{bastionHostName}/disconnectActiveSessions" 306 if resourceGroupName == "" { 307 return nil, errors.New("parameter resourceGroupName cannot be empty") 308 } 309 urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) 310 if bastionHostName == "" { 311 return nil, errors.New("parameter bastionHostName cannot be empty") 312 } 313 urlPath = strings.ReplaceAll(urlPath, "{bastionHostName}", url.PathEscape(bastionHostName)) 314 if client.subscriptionID == "" { 315 return nil, errors.New("parameter client.subscriptionID cannot be empty") 316 } 317 urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) 318 req, err := runtime.NewRequest(ctx, http.MethodPost, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) 319 if err != nil { 320 return nil, err 321 } 322 reqQP := req.Raw().URL.Query() 323 reqQP.Set("api-version", "2024-05-01") 324 req.Raw().URL.RawQuery = reqQP.Encode() 325 req.Raw().Header["Accept"] = []string{"application/json"} 326 if err := runtime.MarshalAsJSON(req, sessionIDs); err != nil { 327 return nil, err 328 } 329 return req, nil 330 } 331 332 // disconnectActiveSessionsHandleResponse handles the DisconnectActiveSessions response. 333 func (client *ManagementClient) disconnectActiveSessionsHandleResponse(resp *http.Response) (ManagementClientDisconnectActiveSessionsResponse, error) { 334 result := ManagementClientDisconnectActiveSessionsResponse{} 335 if err := runtime.UnmarshalAsJSON(resp, &result.BastionSessionDeleteResult); err != nil { 336 return ManagementClientDisconnectActiveSessionsResponse{}, err 337 } 338 return result, nil 339 } 340 341 // ExpressRouteProviderPort - Retrieves detail of a provider port. 342 // If the operation fails it returns an *azcore.ResponseError type. 343 // 344 // Generated from API version 2024-05-01 345 // - providerport - The name of the provider port. 346 // - options - ManagementClientExpressRouteProviderPortOptions contains the optional parameters for the ManagementClient.ExpressRouteProviderPort 347 // method. 348 func (client *ManagementClient) ExpressRouteProviderPort(ctx context.Context, providerport string, options *ManagementClientExpressRouteProviderPortOptions) (ManagementClientExpressRouteProviderPortResponse, error) { 349 var err error 350 const operationName = "ManagementClient.ExpressRouteProviderPort" 351 ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) 352 ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) 353 defer func() { endSpan(err) }() 354 req, err := client.expressRouteProviderPortCreateRequest(ctx, providerport, options) 355 if err != nil { 356 return ManagementClientExpressRouteProviderPortResponse{}, err 357 } 358 httpResp, err := client.internal.Pipeline().Do(req) 359 if err != nil { 360 return ManagementClientExpressRouteProviderPortResponse{}, err 361 } 362 if !runtime.HasStatusCode(httpResp, http.StatusOK) { 363 err = runtime.NewResponseError(httpResp) 364 return ManagementClientExpressRouteProviderPortResponse{}, err 365 } 366 resp, err := client.expressRouteProviderPortHandleResponse(httpResp) 367 return resp, err 368 } 369 370 // expressRouteProviderPortCreateRequest creates the ExpressRouteProviderPort request. 371 func (client *ManagementClient) expressRouteProviderPortCreateRequest(ctx context.Context, providerport string, options *ManagementClientExpressRouteProviderPortOptions) (*policy.Request, error) { 372 urlPath := "/subscriptions/{subscriptionId}/providers/Microsoft.Network/expressRouteProviderPorts/{providerport}" 373 if providerport == "" { 374 return nil, errors.New("parameter providerport cannot be empty") 375 } 376 urlPath = strings.ReplaceAll(urlPath, "{providerport}", url.PathEscape(providerport)) 377 if client.subscriptionID == "" { 378 return nil, errors.New("parameter client.subscriptionID cannot be empty") 379 } 380 urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) 381 req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) 382 if err != nil { 383 return nil, err 384 } 385 reqQP := req.Raw().URL.Query() 386 reqQP.Set("api-version", "2024-05-01") 387 req.Raw().URL.RawQuery = reqQP.Encode() 388 req.Raw().Header["Accept"] = []string{"application/json"} 389 return req, nil 390 } 391 392 // expressRouteProviderPortHandleResponse handles the ExpressRouteProviderPort response. 393 func (client *ManagementClient) expressRouteProviderPortHandleResponse(resp *http.Response) (ManagementClientExpressRouteProviderPortResponse, error) { 394 result := ManagementClientExpressRouteProviderPortResponse{} 395 if err := runtime.UnmarshalAsJSON(resp, &result.ExpressRouteProviderPort); err != nil { 396 return ManagementClientExpressRouteProviderPortResponse{}, err 397 } 398 return result, nil 399 } 400 401 // BeginGeneratevirtualwanvpnserverconfigurationvpnprofile - Generates a unique VPN profile for P2S clients for VirtualWan 402 // and associated VpnServerConfiguration combination in the specified resource group. 403 // If the operation fails it returns an *azcore.ResponseError type. 404 // 405 // Generated from API version 2024-05-01 406 // - resourceGroupName - The resource group name. 407 // - virtualWANName - The name of the VirtualWAN whose associated VpnServerConfigurations is needed. 408 // - vpnClientParams - Parameters supplied to the generate VirtualWan VPN profile generation operation. 409 // - options - ManagementClientBeginGeneratevirtualwanvpnserverconfigurationvpnprofileOptions contains the optional parameters 410 // for the ManagementClient.BeginGeneratevirtualwanvpnserverconfigurationvpnprofile method. 411 func (client *ManagementClient) BeginGeneratevirtualwanvpnserverconfigurationvpnprofile(ctx context.Context, resourceGroupName string, virtualWANName string, vpnClientParams VirtualWanVPNProfileParameters, options *ManagementClientBeginGeneratevirtualwanvpnserverconfigurationvpnprofileOptions) (*runtime.Poller[ManagementClientGeneratevirtualwanvpnserverconfigurationvpnprofileResponse], error) { 412 if options == nil || options.ResumeToken == "" { 413 resp, err := client.generatevirtualwanvpnserverconfigurationvpnprofile(ctx, resourceGroupName, virtualWANName, vpnClientParams, options) 414 if err != nil { 415 return nil, err 416 } 417 poller, err := runtime.NewPoller(resp, client.internal.Pipeline(), &runtime.NewPollerOptions[ManagementClientGeneratevirtualwanvpnserverconfigurationvpnprofileResponse]{ 418 FinalStateVia: runtime.FinalStateViaLocation, 419 Tracer: client.internal.Tracer(), 420 }) 421 return poller, err 422 } else { 423 return runtime.NewPollerFromResumeToken(options.ResumeToken, client.internal.Pipeline(), &runtime.NewPollerFromResumeTokenOptions[ManagementClientGeneratevirtualwanvpnserverconfigurationvpnprofileResponse]{ 424 Tracer: client.internal.Tracer(), 425 }) 426 } 427 } 428 429 // Generatevirtualwanvpnserverconfigurationvpnprofile - Generates a unique VPN profile for P2S clients for VirtualWan and 430 // associated VpnServerConfiguration combination in the specified resource group. 431 // If the operation fails it returns an *azcore.ResponseError type. 432 // 433 // Generated from API version 2024-05-01 434 func (client *ManagementClient) generatevirtualwanvpnserverconfigurationvpnprofile(ctx context.Context, resourceGroupName string, virtualWANName string, vpnClientParams VirtualWanVPNProfileParameters, options *ManagementClientBeginGeneratevirtualwanvpnserverconfigurationvpnprofileOptions) (*http.Response, error) { 435 var err error 436 const operationName = "ManagementClient.BeginGeneratevirtualwanvpnserverconfigurationvpnprofile" 437 ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) 438 ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) 439 defer func() { endSpan(err) }() 440 req, err := client.generatevirtualwanvpnserverconfigurationvpnprofileCreateRequest(ctx, resourceGroupName, virtualWANName, vpnClientParams, options) 441 if err != nil { 442 return nil, err 443 } 444 httpResp, err := client.internal.Pipeline().Do(req) 445 if err != nil { 446 return nil, err 447 } 448 if !runtime.HasStatusCode(httpResp, http.StatusOK, http.StatusAccepted) { 449 err = runtime.NewResponseError(httpResp) 450 return nil, err 451 } 452 return httpResp, nil 453 } 454 455 // generatevirtualwanvpnserverconfigurationvpnprofileCreateRequest creates the Generatevirtualwanvpnserverconfigurationvpnprofile request. 456 func (client *ManagementClient) generatevirtualwanvpnserverconfigurationvpnprofileCreateRequest(ctx context.Context, resourceGroupName string, virtualWANName string, vpnClientParams VirtualWanVPNProfileParameters, options *ManagementClientBeginGeneratevirtualwanvpnserverconfigurationvpnprofileOptions) (*policy.Request, error) { 457 urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/virtualWans/{virtualWANName}/GenerateVpnProfile" 458 if client.subscriptionID == "" { 459 return nil, errors.New("parameter client.subscriptionID cannot be empty") 460 } 461 urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) 462 if resourceGroupName == "" { 463 return nil, errors.New("parameter resourceGroupName cannot be empty") 464 } 465 urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) 466 if virtualWANName == "" { 467 return nil, errors.New("parameter virtualWANName cannot be empty") 468 } 469 urlPath = strings.ReplaceAll(urlPath, "{virtualWANName}", url.PathEscape(virtualWANName)) 470 req, err := runtime.NewRequest(ctx, http.MethodPost, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) 471 if err != nil { 472 return nil, err 473 } 474 reqQP := req.Raw().URL.Query() 475 reqQP.Set("api-version", "2024-05-01") 476 req.Raw().URL.RawQuery = reqQP.Encode() 477 req.Raw().Header["Accept"] = []string{"application/json"} 478 if err := runtime.MarshalAsJSON(req, vpnClientParams); err != nil { 479 return nil, err 480 } 481 return req, nil 482 } 483 484 // BeginGetActiveSessions - Returns the list of currently active sessions on the Bastion. 485 // 486 // Generated from API version 2024-05-01 487 // - resourceGroupName - The name of the resource group. 488 // - bastionHostName - The name of the Bastion Host. 489 // - options - ManagementClientBeginGetActiveSessionsOptions contains the optional parameters for the ManagementClient.BeginGetActiveSessions 490 // method. 491 func (client *ManagementClient) BeginGetActiveSessions(ctx context.Context, resourceGroupName string, bastionHostName string, options *ManagementClientBeginGetActiveSessionsOptions) (*runtime.Poller[*runtime.Pager[ManagementClientGetActiveSessionsResponse]], error) { 492 pager := runtime.NewPager(runtime.PagingHandler[ManagementClientGetActiveSessionsResponse]{ 493 More: func(page ManagementClientGetActiveSessionsResponse) bool { 494 return page.NextLink != nil && len(*page.NextLink) > 0 495 }, 496 Fetcher: func(ctx context.Context, page *ManagementClientGetActiveSessionsResponse) (ManagementClientGetActiveSessionsResponse, error) { 497 ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, "ManagementClient.BeginGetActiveSessions") 498 resp, err := runtime.FetcherForNextLink(ctx, client.internal.Pipeline(), *page.NextLink, func(ctx context.Context) (*policy.Request, error) { 499 return client.getActiveSessionsCreateRequest(ctx, resourceGroupName, bastionHostName, options) 500 }, nil) 501 if err != nil { 502 return ManagementClientGetActiveSessionsResponse{}, err 503 } 504 return client.getActiveSessionsHandleResponse(resp) 505 }, 506 Tracer: client.internal.Tracer(), 507 }) 508 if options == nil || options.ResumeToken == "" { 509 resp, err := client.getActiveSessions(ctx, resourceGroupName, bastionHostName, options) 510 if err != nil { 511 return nil, err 512 } 513 poller, err := runtime.NewPoller(resp, client.internal.Pipeline(), &runtime.NewPollerOptions[*runtime.Pager[ManagementClientGetActiveSessionsResponse]]{ 514 FinalStateVia: runtime.FinalStateViaLocation, 515 Response: &pager, 516 Tracer: client.internal.Tracer(), 517 }) 518 return poller, err 519 } else { 520 return runtime.NewPollerFromResumeToken(options.ResumeToken, client.internal.Pipeline(), &runtime.NewPollerFromResumeTokenOptions[*runtime.Pager[ManagementClientGetActiveSessionsResponse]]{ 521 Response: &pager, 522 Tracer: client.internal.Tracer(), 523 }) 524 } 525 } 526 527 // GetActiveSessions - Returns the list of currently active sessions on the Bastion. 528 // 529 // Generated from API version 2024-05-01 530 func (client *ManagementClient) getActiveSessions(ctx context.Context, resourceGroupName string, bastionHostName string, options *ManagementClientBeginGetActiveSessionsOptions) (*http.Response, error) { 531 var err error 532 const operationName = "ManagementClient.BeginGetActiveSessions" 533 ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) 534 ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) 535 defer func() { endSpan(err) }() 536 req, err := client.getActiveSessionsCreateRequest(ctx, resourceGroupName, bastionHostName, options) 537 if err != nil { 538 return nil, err 539 } 540 httpResp, err := client.internal.Pipeline().Do(req) 541 if err != nil { 542 return nil, err 543 } 544 if !runtime.HasStatusCode(httpResp, http.StatusOK, http.StatusAccepted) { 545 err = runtime.NewResponseError(httpResp) 546 return nil, err 547 } 548 return httpResp, nil 549 } 550 551 // getActiveSessionsCreateRequest creates the GetActiveSessions request. 552 func (client *ManagementClient) getActiveSessionsCreateRequest(ctx context.Context, resourceGroupName string, bastionHostName string, options *ManagementClientBeginGetActiveSessionsOptions) (*policy.Request, error) { 553 urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/bastionHosts/{bastionHostName}/getActiveSessions" 554 if resourceGroupName == "" { 555 return nil, errors.New("parameter resourceGroupName cannot be empty") 556 } 557 urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) 558 if bastionHostName == "" { 559 return nil, errors.New("parameter bastionHostName cannot be empty") 560 } 561 urlPath = strings.ReplaceAll(urlPath, "{bastionHostName}", url.PathEscape(bastionHostName)) 562 if client.subscriptionID == "" { 563 return nil, errors.New("parameter client.subscriptionID cannot be empty") 564 } 565 urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) 566 req, err := runtime.NewRequest(ctx, http.MethodPost, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) 567 if err != nil { 568 return nil, err 569 } 570 reqQP := req.Raw().URL.Query() 571 reqQP.Set("api-version", "2024-05-01") 572 req.Raw().URL.RawQuery = reqQP.Encode() 573 req.Raw().Header["Accept"] = []string{"application/json"} 574 return req, nil 575 } 576 577 // getActiveSessionsHandleResponse handles the GetActiveSessions response. 578 func (client *ManagementClient) getActiveSessionsHandleResponse(resp *http.Response) (ManagementClientGetActiveSessionsResponse, error) { 579 result := ManagementClientGetActiveSessionsResponse{} 580 if err := runtime.UnmarshalAsJSON(resp, &result.BastionActiveSessionListResult); err != nil { 581 return ManagementClientGetActiveSessionsResponse{}, err 582 } 583 return result, nil 584 } 585 586 // NewGetBastionShareableLinkPager - Return the Bastion Shareable Links for all the VMs specified in the request. 587 // 588 // Generated from API version 2024-05-01 589 // - resourceGroupName - The name of the resource group. 590 // - bastionHostName - The name of the Bastion Host. 591 // - bslRequest - Post request for Create/Delete/Get Bastion Shareable Link endpoints. 592 // - options - ManagementClientGetBastionShareableLinkOptions contains the optional parameters for the ManagementClient.NewGetBastionShareableLinkPager 593 // method. 594 func (client *ManagementClient) NewGetBastionShareableLinkPager(resourceGroupName string, bastionHostName string, bslRequest BastionShareableLinkListRequest, options *ManagementClientGetBastionShareableLinkOptions) *runtime.Pager[ManagementClientGetBastionShareableLinkResponse] { 595 return runtime.NewPager(runtime.PagingHandler[ManagementClientGetBastionShareableLinkResponse]{ 596 More: func(page ManagementClientGetBastionShareableLinkResponse) bool { 597 return page.NextLink != nil && len(*page.NextLink) > 0 598 }, 599 Fetcher: func(ctx context.Context, page *ManagementClientGetBastionShareableLinkResponse) (ManagementClientGetBastionShareableLinkResponse, error) { 600 ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, "ManagementClient.NewGetBastionShareableLinkPager") 601 nextLink := "" 602 if page != nil { 603 nextLink = *page.NextLink 604 } 605 resp, err := runtime.FetcherForNextLink(ctx, client.internal.Pipeline(), nextLink, func(ctx context.Context) (*policy.Request, error) { 606 return client.getBastionShareableLinkCreateRequest(ctx, resourceGroupName, bastionHostName, bslRequest, options) 607 }, nil) 608 if err != nil { 609 return ManagementClientGetBastionShareableLinkResponse{}, err 610 } 611 return client.getBastionShareableLinkHandleResponse(resp) 612 }, 613 Tracer: client.internal.Tracer(), 614 }) 615 } 616 617 // getBastionShareableLinkCreateRequest creates the GetBastionShareableLink request. 618 func (client *ManagementClient) getBastionShareableLinkCreateRequest(ctx context.Context, resourceGroupName string, bastionHostName string, bslRequest BastionShareableLinkListRequest, options *ManagementClientGetBastionShareableLinkOptions) (*policy.Request, error) { 619 urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/bastionHosts/{bastionHostName}/getShareableLinks" 620 if resourceGroupName == "" { 621 return nil, errors.New("parameter resourceGroupName cannot be empty") 622 } 623 urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) 624 if bastionHostName == "" { 625 return nil, errors.New("parameter bastionHostName cannot be empty") 626 } 627 urlPath = strings.ReplaceAll(urlPath, "{bastionHostName}", url.PathEscape(bastionHostName)) 628 if client.subscriptionID == "" { 629 return nil, errors.New("parameter client.subscriptionID cannot be empty") 630 } 631 urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) 632 req, err := runtime.NewRequest(ctx, http.MethodPost, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) 633 if err != nil { 634 return nil, err 635 } 636 reqQP := req.Raw().URL.Query() 637 reqQP.Set("api-version", "2024-05-01") 638 req.Raw().URL.RawQuery = reqQP.Encode() 639 req.Raw().Header["Accept"] = []string{"application/json"} 640 if err := runtime.MarshalAsJSON(req, bslRequest); err != nil { 641 return nil, err 642 } 643 return req, nil 644 } 645 646 // getBastionShareableLinkHandleResponse handles the GetBastionShareableLink response. 647 func (client *ManagementClient) getBastionShareableLinkHandleResponse(resp *http.Response) (ManagementClientGetBastionShareableLinkResponse, error) { 648 result := ManagementClientGetBastionShareableLinkResponse{} 649 if err := runtime.UnmarshalAsJSON(resp, &result.BastionShareableLinkListResult); err != nil { 650 return ManagementClientGetBastionShareableLinkResponse{}, err 651 } 652 return result, nil 653 } 654 655 // ListActiveConnectivityConfigurations - Lists active connectivity configurations in a network manager. 656 // If the operation fails it returns an *azcore.ResponseError type. 657 // 658 // Generated from API version 2024-05-01 659 // - resourceGroupName - The name of the resource group. 660 // - networkManagerName - The name of the network manager. 661 // - parameters - Active Configuration Parameter. 662 // - options - ManagementClientListActiveConnectivityConfigurationsOptions contains the optional parameters for the ManagementClient.ListActiveConnectivityConfigurations 663 // method. 664 func (client *ManagementClient) ListActiveConnectivityConfigurations(ctx context.Context, resourceGroupName string, networkManagerName string, parameters ActiveConfigurationParameter, options *ManagementClientListActiveConnectivityConfigurationsOptions) (ManagementClientListActiveConnectivityConfigurationsResponse, error) { 665 var err error 666 const operationName = "ManagementClient.ListActiveConnectivityConfigurations" 667 ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) 668 ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) 669 defer func() { endSpan(err) }() 670 req, err := client.listActiveConnectivityConfigurationsCreateRequest(ctx, resourceGroupName, networkManagerName, parameters, options) 671 if err != nil { 672 return ManagementClientListActiveConnectivityConfigurationsResponse{}, err 673 } 674 httpResp, err := client.internal.Pipeline().Do(req) 675 if err != nil { 676 return ManagementClientListActiveConnectivityConfigurationsResponse{}, err 677 } 678 if !runtime.HasStatusCode(httpResp, http.StatusOK) { 679 err = runtime.NewResponseError(httpResp) 680 return ManagementClientListActiveConnectivityConfigurationsResponse{}, err 681 } 682 resp, err := client.listActiveConnectivityConfigurationsHandleResponse(httpResp) 683 return resp, err 684 } 685 686 // listActiveConnectivityConfigurationsCreateRequest creates the ListActiveConnectivityConfigurations request. 687 func (client *ManagementClient) listActiveConnectivityConfigurationsCreateRequest(ctx context.Context, resourceGroupName string, networkManagerName string, parameters ActiveConfigurationParameter, options *ManagementClientListActiveConnectivityConfigurationsOptions) (*policy.Request, error) { 688 urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/networkManagers/{networkManagerName}/listActiveConnectivityConfigurations" 689 if client.subscriptionID == "" { 690 return nil, errors.New("parameter client.subscriptionID cannot be empty") 691 } 692 urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) 693 if resourceGroupName == "" { 694 return nil, errors.New("parameter resourceGroupName cannot be empty") 695 } 696 urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) 697 if networkManagerName == "" { 698 return nil, errors.New("parameter networkManagerName cannot be empty") 699 } 700 urlPath = strings.ReplaceAll(urlPath, "{networkManagerName}", url.PathEscape(networkManagerName)) 701 req, err := runtime.NewRequest(ctx, http.MethodPost, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) 702 if err != nil { 703 return nil, err 704 } 705 reqQP := req.Raw().URL.Query() 706 if options != nil && options.Top != nil { 707 reqQP.Set("$top", strconv.FormatInt(int64(*options.Top), 10)) 708 } 709 reqQP.Set("api-version", "2024-05-01") 710 req.Raw().URL.RawQuery = reqQP.Encode() 711 req.Raw().Header["Accept"] = []string{"application/json"} 712 if err := runtime.MarshalAsJSON(req, parameters); err != nil { 713 return nil, err 714 } 715 return req, nil 716 } 717 718 // listActiveConnectivityConfigurationsHandleResponse handles the ListActiveConnectivityConfigurations response. 719 func (client *ManagementClient) listActiveConnectivityConfigurationsHandleResponse(resp *http.Response) (ManagementClientListActiveConnectivityConfigurationsResponse, error) { 720 result := ManagementClientListActiveConnectivityConfigurationsResponse{} 721 if err := runtime.UnmarshalAsJSON(resp, &result.ActiveConnectivityConfigurationsListResult); err != nil { 722 return ManagementClientListActiveConnectivityConfigurationsResponse{}, err 723 } 724 return result, nil 725 } 726 727 // ListActiveSecurityAdminRules - Lists active security admin rules in a network manager. 728 // If the operation fails it returns an *azcore.ResponseError type. 729 // 730 // Generated from API version 2024-05-01 731 // - resourceGroupName - The name of the resource group. 732 // - networkManagerName - The name of the network manager. 733 // - parameters - Active Configuration Parameter. 734 // - options - ManagementClientListActiveSecurityAdminRulesOptions contains the optional parameters for the ManagementClient.ListActiveSecurityAdminRules 735 // method. 736 func (client *ManagementClient) ListActiveSecurityAdminRules(ctx context.Context, resourceGroupName string, networkManagerName string, parameters ActiveConfigurationParameter, options *ManagementClientListActiveSecurityAdminRulesOptions) (ManagementClientListActiveSecurityAdminRulesResponse, error) { 737 var err error 738 const operationName = "ManagementClient.ListActiveSecurityAdminRules" 739 ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) 740 ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) 741 defer func() { endSpan(err) }() 742 req, err := client.listActiveSecurityAdminRulesCreateRequest(ctx, resourceGroupName, networkManagerName, parameters, options) 743 if err != nil { 744 return ManagementClientListActiveSecurityAdminRulesResponse{}, err 745 } 746 httpResp, err := client.internal.Pipeline().Do(req) 747 if err != nil { 748 return ManagementClientListActiveSecurityAdminRulesResponse{}, err 749 } 750 if !runtime.HasStatusCode(httpResp, http.StatusOK) { 751 err = runtime.NewResponseError(httpResp) 752 return ManagementClientListActiveSecurityAdminRulesResponse{}, err 753 } 754 resp, err := client.listActiveSecurityAdminRulesHandleResponse(httpResp) 755 return resp, err 756 } 757 758 // listActiveSecurityAdminRulesCreateRequest creates the ListActiveSecurityAdminRules request. 759 func (client *ManagementClient) listActiveSecurityAdminRulesCreateRequest(ctx context.Context, resourceGroupName string, networkManagerName string, parameters ActiveConfigurationParameter, options *ManagementClientListActiveSecurityAdminRulesOptions) (*policy.Request, error) { 760 urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/networkManagers/{networkManagerName}/listActiveSecurityAdminRules" 761 if client.subscriptionID == "" { 762 return nil, errors.New("parameter client.subscriptionID cannot be empty") 763 } 764 urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) 765 if resourceGroupName == "" { 766 return nil, errors.New("parameter resourceGroupName cannot be empty") 767 } 768 urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) 769 if networkManagerName == "" { 770 return nil, errors.New("parameter networkManagerName cannot be empty") 771 } 772 urlPath = strings.ReplaceAll(urlPath, "{networkManagerName}", url.PathEscape(networkManagerName)) 773 req, err := runtime.NewRequest(ctx, http.MethodPost, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) 774 if err != nil { 775 return nil, err 776 } 777 reqQP := req.Raw().URL.Query() 778 if options != nil && options.Top != nil { 779 reqQP.Set("$top", strconv.FormatInt(int64(*options.Top), 10)) 780 } 781 reqQP.Set("api-version", "2024-05-01") 782 req.Raw().URL.RawQuery = reqQP.Encode() 783 req.Raw().Header["Accept"] = []string{"application/json"} 784 if err := runtime.MarshalAsJSON(req, parameters); err != nil { 785 return nil, err 786 } 787 return req, nil 788 } 789 790 // listActiveSecurityAdminRulesHandleResponse handles the ListActiveSecurityAdminRules response. 791 func (client *ManagementClient) listActiveSecurityAdminRulesHandleResponse(resp *http.Response) (ManagementClientListActiveSecurityAdminRulesResponse, error) { 792 result := ManagementClientListActiveSecurityAdminRulesResponse{} 793 if err := runtime.UnmarshalAsJSON(resp, &result.ActiveSecurityAdminRulesListResult); err != nil { 794 return ManagementClientListActiveSecurityAdminRulesResponse{}, err 795 } 796 return result, nil 797 } 798 799 // ListNetworkManagerEffectiveConnectivityConfigurations - List all effective connectivity configurations applied on a virtual 800 // network. 801 // If the operation fails it returns an *azcore.ResponseError type. 802 // 803 // Generated from API version 2024-05-01 804 // - resourceGroupName - The name of the resource group. 805 // - virtualNetworkName - The name of the virtual network. 806 // - parameters - Parameters supplied to list correct page. 807 // - options - ManagementClientListNetworkManagerEffectiveConnectivityConfigurationsOptions contains the optional parameters 808 // for the ManagementClient.ListNetworkManagerEffectiveConnectivityConfigurations method. 809 func (client *ManagementClient) ListNetworkManagerEffectiveConnectivityConfigurations(ctx context.Context, resourceGroupName string, virtualNetworkName string, parameters QueryRequestOptions, options *ManagementClientListNetworkManagerEffectiveConnectivityConfigurationsOptions) (ManagementClientListNetworkManagerEffectiveConnectivityConfigurationsResponse, error) { 810 var err error 811 const operationName = "ManagementClient.ListNetworkManagerEffectiveConnectivityConfigurations" 812 ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) 813 ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) 814 defer func() { endSpan(err) }() 815 req, err := client.listNetworkManagerEffectiveConnectivityConfigurationsCreateRequest(ctx, resourceGroupName, virtualNetworkName, parameters, options) 816 if err != nil { 817 return ManagementClientListNetworkManagerEffectiveConnectivityConfigurationsResponse{}, err 818 } 819 httpResp, err := client.internal.Pipeline().Do(req) 820 if err != nil { 821 return ManagementClientListNetworkManagerEffectiveConnectivityConfigurationsResponse{}, err 822 } 823 if !runtime.HasStatusCode(httpResp, http.StatusOK) { 824 err = runtime.NewResponseError(httpResp) 825 return ManagementClientListNetworkManagerEffectiveConnectivityConfigurationsResponse{}, err 826 } 827 resp, err := client.listNetworkManagerEffectiveConnectivityConfigurationsHandleResponse(httpResp) 828 return resp, err 829 } 830 831 // listNetworkManagerEffectiveConnectivityConfigurationsCreateRequest creates the ListNetworkManagerEffectiveConnectivityConfigurations request. 832 func (client *ManagementClient) listNetworkManagerEffectiveConnectivityConfigurationsCreateRequest(ctx context.Context, resourceGroupName string, virtualNetworkName string, parameters QueryRequestOptions, options *ManagementClientListNetworkManagerEffectiveConnectivityConfigurationsOptions) (*policy.Request, error) { 833 urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/virtualNetworks/{virtualNetworkName}/listNetworkManagerEffectiveConnectivityConfigurations" 834 if client.subscriptionID == "" { 835 return nil, errors.New("parameter client.subscriptionID cannot be empty") 836 } 837 urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) 838 if resourceGroupName == "" { 839 return nil, errors.New("parameter resourceGroupName cannot be empty") 840 } 841 urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) 842 if virtualNetworkName == "" { 843 return nil, errors.New("parameter virtualNetworkName cannot be empty") 844 } 845 urlPath = strings.ReplaceAll(urlPath, "{virtualNetworkName}", url.PathEscape(virtualNetworkName)) 846 req, err := runtime.NewRequest(ctx, http.MethodPost, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) 847 if err != nil { 848 return nil, err 849 } 850 reqQP := req.Raw().URL.Query() 851 if options != nil && options.Top != nil { 852 reqQP.Set("$top", strconv.FormatInt(int64(*options.Top), 10)) 853 } 854 reqQP.Set("api-version", "2024-05-01") 855 req.Raw().URL.RawQuery = reqQP.Encode() 856 req.Raw().Header["Accept"] = []string{"application/json"} 857 if err := runtime.MarshalAsJSON(req, parameters); err != nil { 858 return nil, err 859 } 860 return req, nil 861 } 862 863 // listNetworkManagerEffectiveConnectivityConfigurationsHandleResponse handles the ListNetworkManagerEffectiveConnectivityConfigurations response. 864 func (client *ManagementClient) listNetworkManagerEffectiveConnectivityConfigurationsHandleResponse(resp *http.Response) (ManagementClientListNetworkManagerEffectiveConnectivityConfigurationsResponse, error) { 865 result := ManagementClientListNetworkManagerEffectiveConnectivityConfigurationsResponse{} 866 if err := runtime.UnmarshalAsJSON(resp, &result.ManagerEffectiveConnectivityConfigurationListResult); err != nil { 867 return ManagementClientListNetworkManagerEffectiveConnectivityConfigurationsResponse{}, err 868 } 869 return result, nil 870 } 871 872 // ListNetworkManagerEffectiveSecurityAdminRules - List all effective security admin rules applied on a virtual network. 873 // If the operation fails it returns an *azcore.ResponseError type. 874 // 875 // Generated from API version 2024-05-01 876 // - resourceGroupName - The name of the resource group. 877 // - virtualNetworkName - The name of the virtual network. 878 // - parameters - Parameters supplied to list correct page. 879 // - options - ManagementClientListNetworkManagerEffectiveSecurityAdminRulesOptions contains the optional parameters for the 880 // ManagementClient.ListNetworkManagerEffectiveSecurityAdminRules method. 881 func (client *ManagementClient) ListNetworkManagerEffectiveSecurityAdminRules(ctx context.Context, resourceGroupName string, virtualNetworkName string, parameters QueryRequestOptions, options *ManagementClientListNetworkManagerEffectiveSecurityAdminRulesOptions) (ManagementClientListNetworkManagerEffectiveSecurityAdminRulesResponse, error) { 882 var err error 883 const operationName = "ManagementClient.ListNetworkManagerEffectiveSecurityAdminRules" 884 ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) 885 ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) 886 defer func() { endSpan(err) }() 887 req, err := client.listNetworkManagerEffectiveSecurityAdminRulesCreateRequest(ctx, resourceGroupName, virtualNetworkName, parameters, options) 888 if err != nil { 889 return ManagementClientListNetworkManagerEffectiveSecurityAdminRulesResponse{}, err 890 } 891 httpResp, err := client.internal.Pipeline().Do(req) 892 if err != nil { 893 return ManagementClientListNetworkManagerEffectiveSecurityAdminRulesResponse{}, err 894 } 895 if !runtime.HasStatusCode(httpResp, http.StatusOK) { 896 err = runtime.NewResponseError(httpResp) 897 return ManagementClientListNetworkManagerEffectiveSecurityAdminRulesResponse{}, err 898 } 899 resp, err := client.listNetworkManagerEffectiveSecurityAdminRulesHandleResponse(httpResp) 900 return resp, err 901 } 902 903 // listNetworkManagerEffectiveSecurityAdminRulesCreateRequest creates the ListNetworkManagerEffectiveSecurityAdminRules request. 904 func (client *ManagementClient) listNetworkManagerEffectiveSecurityAdminRulesCreateRequest(ctx context.Context, resourceGroupName string, virtualNetworkName string, parameters QueryRequestOptions, options *ManagementClientListNetworkManagerEffectiveSecurityAdminRulesOptions) (*policy.Request, error) { 905 urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/virtualNetworks/{virtualNetworkName}/listNetworkManagerEffectiveSecurityAdminRules" 906 if client.subscriptionID == "" { 907 return nil, errors.New("parameter client.subscriptionID cannot be empty") 908 } 909 urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) 910 if resourceGroupName == "" { 911 return nil, errors.New("parameter resourceGroupName cannot be empty") 912 } 913 urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) 914 if virtualNetworkName == "" { 915 return nil, errors.New("parameter virtualNetworkName cannot be empty") 916 } 917 urlPath = strings.ReplaceAll(urlPath, "{virtualNetworkName}", url.PathEscape(virtualNetworkName)) 918 req, err := runtime.NewRequest(ctx, http.MethodPost, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) 919 if err != nil { 920 return nil, err 921 } 922 reqQP := req.Raw().URL.Query() 923 if options != nil && options.Top != nil { 924 reqQP.Set("$top", strconv.FormatInt(int64(*options.Top), 10)) 925 } 926 reqQP.Set("api-version", "2024-05-01") 927 req.Raw().URL.RawQuery = reqQP.Encode() 928 req.Raw().Header["Accept"] = []string{"application/json"} 929 if err := runtime.MarshalAsJSON(req, parameters); err != nil { 930 return nil, err 931 } 932 return req, nil 933 } 934 935 // listNetworkManagerEffectiveSecurityAdminRulesHandleResponse handles the ListNetworkManagerEffectiveSecurityAdminRules response. 936 func (client *ManagementClient) listNetworkManagerEffectiveSecurityAdminRulesHandleResponse(resp *http.Response) (ManagementClientListNetworkManagerEffectiveSecurityAdminRulesResponse, error) { 937 result := ManagementClientListNetworkManagerEffectiveSecurityAdminRulesResponse{} 938 if err := runtime.UnmarshalAsJSON(resp, &result.ManagerEffectiveSecurityAdminRulesListResult); err != nil { 939 return ManagementClientListNetworkManagerEffectiveSecurityAdminRulesResponse{}, err 940 } 941 return result, nil 942 } 943 944 // BeginPutBastionShareableLink - Creates a Bastion Shareable Links for all the VMs specified in the request. 945 // 946 // Generated from API version 2024-05-01 947 // - resourceGroupName - The name of the resource group. 948 // - bastionHostName - The name of the Bastion Host. 949 // - bslRequest - Post request for Create/Delete/Get Bastion Shareable Link endpoints. 950 // - options - ManagementClientBeginPutBastionShareableLinkOptions contains the optional parameters for the ManagementClient.BeginPutBastionShareableLink 951 // method. 952 func (client *ManagementClient) BeginPutBastionShareableLink(ctx context.Context, resourceGroupName string, bastionHostName string, bslRequest BastionShareableLinkListRequest, options *ManagementClientBeginPutBastionShareableLinkOptions) (*runtime.Poller[*runtime.Pager[ManagementClientPutBastionShareableLinkResponse]], error) { 953 pager := runtime.NewPager(runtime.PagingHandler[ManagementClientPutBastionShareableLinkResponse]{ 954 More: func(page ManagementClientPutBastionShareableLinkResponse) bool { 955 return page.NextLink != nil && len(*page.NextLink) > 0 956 }, 957 Fetcher: func(ctx context.Context, page *ManagementClientPutBastionShareableLinkResponse) (ManagementClientPutBastionShareableLinkResponse, error) { 958 ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, "ManagementClient.BeginPutBastionShareableLink") 959 resp, err := runtime.FetcherForNextLink(ctx, client.internal.Pipeline(), *page.NextLink, func(ctx context.Context) (*policy.Request, error) { 960 return client.putBastionShareableLinkCreateRequest(ctx, resourceGroupName, bastionHostName, bslRequest, options) 961 }, nil) 962 if err != nil { 963 return ManagementClientPutBastionShareableLinkResponse{}, err 964 } 965 return client.putBastionShareableLinkHandleResponse(resp) 966 }, 967 Tracer: client.internal.Tracer(), 968 }) 969 if options == nil || options.ResumeToken == "" { 970 resp, err := client.putBastionShareableLink(ctx, resourceGroupName, bastionHostName, bslRequest, options) 971 if err != nil { 972 return nil, err 973 } 974 poller, err := runtime.NewPoller(resp, client.internal.Pipeline(), &runtime.NewPollerOptions[*runtime.Pager[ManagementClientPutBastionShareableLinkResponse]]{ 975 FinalStateVia: runtime.FinalStateViaLocation, 976 Response: &pager, 977 Tracer: client.internal.Tracer(), 978 }) 979 return poller, err 980 } else { 981 return runtime.NewPollerFromResumeToken(options.ResumeToken, client.internal.Pipeline(), &runtime.NewPollerFromResumeTokenOptions[*runtime.Pager[ManagementClientPutBastionShareableLinkResponse]]{ 982 Response: &pager, 983 Tracer: client.internal.Tracer(), 984 }) 985 } 986 } 987 988 // PutBastionShareableLink - Creates a Bastion Shareable Links for all the VMs specified in the request. 989 // 990 // Generated from API version 2024-05-01 991 func (client *ManagementClient) putBastionShareableLink(ctx context.Context, resourceGroupName string, bastionHostName string, bslRequest BastionShareableLinkListRequest, options *ManagementClientBeginPutBastionShareableLinkOptions) (*http.Response, error) { 992 var err error 993 const operationName = "ManagementClient.BeginPutBastionShareableLink" 994 ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) 995 ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) 996 defer func() { endSpan(err) }() 997 req, err := client.putBastionShareableLinkCreateRequest(ctx, resourceGroupName, bastionHostName, bslRequest, options) 998 if err != nil { 999 return nil, err 1000 } 1001 httpResp, err := client.internal.Pipeline().Do(req) 1002 if err != nil { 1003 return nil, err 1004 } 1005 if !runtime.HasStatusCode(httpResp, http.StatusOK, http.StatusAccepted) { 1006 err = runtime.NewResponseError(httpResp) 1007 return nil, err 1008 } 1009 return httpResp, nil 1010 } 1011 1012 // putBastionShareableLinkCreateRequest creates the PutBastionShareableLink request. 1013 func (client *ManagementClient) putBastionShareableLinkCreateRequest(ctx context.Context, resourceGroupName string, bastionHostName string, bslRequest BastionShareableLinkListRequest, options *ManagementClientBeginPutBastionShareableLinkOptions) (*policy.Request, error) { 1014 urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/bastionHosts/{bastionHostName}/createShareableLinks" 1015 if resourceGroupName == "" { 1016 return nil, errors.New("parameter resourceGroupName cannot be empty") 1017 } 1018 urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) 1019 if bastionHostName == "" { 1020 return nil, errors.New("parameter bastionHostName cannot be empty") 1021 } 1022 urlPath = strings.ReplaceAll(urlPath, "{bastionHostName}", url.PathEscape(bastionHostName)) 1023 if client.subscriptionID == "" { 1024 return nil, errors.New("parameter client.subscriptionID cannot be empty") 1025 } 1026 urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) 1027 req, err := runtime.NewRequest(ctx, http.MethodPost, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) 1028 if err != nil { 1029 return nil, err 1030 } 1031 reqQP := req.Raw().URL.Query() 1032 reqQP.Set("api-version", "2024-05-01") 1033 req.Raw().URL.RawQuery = reqQP.Encode() 1034 req.Raw().Header["Accept"] = []string{"application/json"} 1035 if err := runtime.MarshalAsJSON(req, bslRequest); err != nil { 1036 return nil, err 1037 } 1038 return req, nil 1039 } 1040 1041 // putBastionShareableLinkHandleResponse handles the PutBastionShareableLink response. 1042 func (client *ManagementClient) putBastionShareableLinkHandleResponse(resp *http.Response) (ManagementClientPutBastionShareableLinkResponse, error) { 1043 result := ManagementClientPutBastionShareableLinkResponse{} 1044 if err := runtime.UnmarshalAsJSON(resp, &result.BastionShareableLinkListResult); err != nil { 1045 return ManagementClientPutBastionShareableLinkResponse{}, err 1046 } 1047 return result, nil 1048 } 1049 1050 // SupportedSecurityProviders - Gives the supported security providers for the virtual wan. 1051 // If the operation fails it returns an *azcore.ResponseError type. 1052 // 1053 // Generated from API version 2024-05-01 1054 // - resourceGroupName - The resource group name. 1055 // - virtualWANName - The name of the VirtualWAN for which supported security providers are needed. 1056 // - options - ManagementClientSupportedSecurityProvidersOptions contains the optional parameters for the ManagementClient.SupportedSecurityProviders 1057 // method. 1058 func (client *ManagementClient) SupportedSecurityProviders(ctx context.Context, resourceGroupName string, virtualWANName string, options *ManagementClientSupportedSecurityProvidersOptions) (ManagementClientSupportedSecurityProvidersResponse, error) { 1059 var err error 1060 const operationName = "ManagementClient.SupportedSecurityProviders" 1061 ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) 1062 ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) 1063 defer func() { endSpan(err) }() 1064 req, err := client.supportedSecurityProvidersCreateRequest(ctx, resourceGroupName, virtualWANName, options) 1065 if err != nil { 1066 return ManagementClientSupportedSecurityProvidersResponse{}, err 1067 } 1068 httpResp, err := client.internal.Pipeline().Do(req) 1069 if err != nil { 1070 return ManagementClientSupportedSecurityProvidersResponse{}, err 1071 } 1072 if !runtime.HasStatusCode(httpResp, http.StatusOK) { 1073 err = runtime.NewResponseError(httpResp) 1074 return ManagementClientSupportedSecurityProvidersResponse{}, err 1075 } 1076 resp, err := client.supportedSecurityProvidersHandleResponse(httpResp) 1077 return resp, err 1078 } 1079 1080 // supportedSecurityProvidersCreateRequest creates the SupportedSecurityProviders request. 1081 func (client *ManagementClient) supportedSecurityProvidersCreateRequest(ctx context.Context, resourceGroupName string, virtualWANName string, options *ManagementClientSupportedSecurityProvidersOptions) (*policy.Request, error) { 1082 urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/virtualWans/{virtualWANName}/supportedSecurityProviders" 1083 if client.subscriptionID == "" { 1084 return nil, errors.New("parameter client.subscriptionID cannot be empty") 1085 } 1086 urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) 1087 if resourceGroupName == "" { 1088 return nil, errors.New("parameter resourceGroupName cannot be empty") 1089 } 1090 urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) 1091 if virtualWANName == "" { 1092 return nil, errors.New("parameter virtualWANName cannot be empty") 1093 } 1094 urlPath = strings.ReplaceAll(urlPath, "{virtualWANName}", url.PathEscape(virtualWANName)) 1095 req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) 1096 if err != nil { 1097 return nil, err 1098 } 1099 reqQP := req.Raw().URL.Query() 1100 reqQP.Set("api-version", "2024-05-01") 1101 req.Raw().URL.RawQuery = reqQP.Encode() 1102 req.Raw().Header["Accept"] = []string{"application/json"} 1103 return req, nil 1104 } 1105 1106 // supportedSecurityProvidersHandleResponse handles the SupportedSecurityProviders response. 1107 func (client *ManagementClient) supportedSecurityProvidersHandleResponse(resp *http.Response) (ManagementClientSupportedSecurityProvidersResponse, error) { 1108 result := ManagementClientSupportedSecurityProvidersResponse{} 1109 if err := runtime.UnmarshalAsJSON(resp, &result.VirtualWanSecurityProviders); err != nil { 1110 return ManagementClientSupportedSecurityProvidersResponse{}, err 1111 } 1112 return result, nil 1113 }